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