|
|
@ -8,6 +8,8 @@ import com.mh.user.model.DeviceModel; |
|
|
|
import com.mh.user.model.PumpModel; |
|
|
|
import com.mh.user.model.PumpModel; |
|
|
|
import com.mh.user.model.WaterLevelModel; |
|
|
|
import com.mh.user.model.WaterLevelModel; |
|
|
|
import com.mh.user.service.*; |
|
|
|
import com.mh.user.service.*; |
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
@ -23,6 +25,7 @@ import java.util.List; |
|
|
|
@RequestMapping("monitor") |
|
|
|
@RequestMapping("monitor") |
|
|
|
public class NowDataController { |
|
|
|
public class NowDataController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(NowDataController.class); |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
NowDataService nowDataService; |
|
|
|
NowDataService nowDataService; |
|
|
|
|
|
|
|
|
|
|
@ -44,6 +47,7 @@ public class NowDataController { |
|
|
|
try{ |
|
|
|
try{ |
|
|
|
//把热泵的水温保存到公共信息中中的用水温度和回水温度
|
|
|
|
//把热泵的水温保存到公共信息中中的用水温度和回水温度
|
|
|
|
String avgWaterTemp=nowDataService.selectAve(buildingId); |
|
|
|
String avgWaterTemp=nowDataService.selectAve(buildingId); |
|
|
|
|
|
|
|
String maxWaterTemp=nowDataService.selectMaxTemp(buildingId); |
|
|
|
String buildingName=buildingService.queryBuildingName(buildingId);//获取楼栋名称
|
|
|
|
String buildingName=buildingService.queryBuildingName(buildingId);//获取楼栋名称
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
@ -56,9 +60,12 @@ public class NowDataController { |
|
|
|
nowPublicData.setBuildingName(buildingName); |
|
|
|
nowPublicData.setBuildingName(buildingName); |
|
|
|
if (avgWaterTemp!=null){ |
|
|
|
if (avgWaterTemp!=null){ |
|
|
|
nowPublicData.setBackWaterTemp(avgWaterTemp); |
|
|
|
nowPublicData.setBackWaterTemp(avgWaterTemp); |
|
|
|
nowPublicData.setUseWaterTemp(avgWaterTemp); |
|
|
|
|
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
nowPublicData.setBackWaterTemp("0"); |
|
|
|
nowPublicData.setBackWaterTemp("0"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (maxWaterTemp!=null){ |
|
|
|
|
|
|
|
nowPublicData.setUseWaterTemp(maxWaterTemp); |
|
|
|
|
|
|
|
}else{ |
|
|
|
nowPublicData.setUseWaterTemp("0"); |
|
|
|
nowPublicData.setUseWaterTemp("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
nowPublicDataService.saveNowHistoryPublicData(nowPublicData); |
|
|
|
nowPublicDataService.saveNowHistoryPublicData(nowPublicData); |
|
|
@ -95,7 +102,7 @@ public class NowDataController { |
|
|
|
list=nowDataService.queryNowData(buildingId); |
|
|
|
list=nowDataService.queryNowData(buildingId); |
|
|
|
return HttpResult.ok(list); |
|
|
|
return HttpResult.ok(list); |
|
|
|
}catch (Exception e){ |
|
|
|
}catch (Exception e){ |
|
|
|
// e.printStackTrace();
|
|
|
|
log.error("查询当前监控状态出错!",e); |
|
|
|
return HttpResult.error("查询当前监控状态出错!"); |
|
|
|
return HttpResult.error("查询当前监控状态出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|