|
|
@ -41,42 +41,42 @@ public class NowDataController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
DeviceFloorService deviceFloorService; |
|
|
|
DeviceFloorService deviceFloorService; |
|
|
|
|
|
|
|
|
|
|
|
@SysLogger(title="实时监控",optDesc = "实时查看每楼栋热水运行情况") |
|
|
|
@SysLogger(title = "实时监控", optDesc = "实时查看每楼栋热水运行情况") |
|
|
|
@PostMapping("/queryNow") |
|
|
|
@PostMapping("/queryNow") |
|
|
|
public HttpResult queryNowData(@RequestParam(value = "buildingId") String buildingId){ |
|
|
|
public HttpResult queryNowData(@RequestParam(value = "buildingId") String buildingId) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
//把热泵的水温保存到公共信息中中的用水温度和回水温度
|
|
|
|
//把热泵的水温保存到公共信息中中的用水温度和回水温度
|
|
|
|
String avgWaterTemp=nowDataService.selectAve(buildingId); |
|
|
|
String avgWaterTemp = nowDataService.selectAve(buildingId); |
|
|
|
String maxWaterTemp=nowDataService.selectMaxTemp(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"); |
|
|
|
Date date=new Date(); |
|
|
|
Date date = new Date(); |
|
|
|
String curDate=sdf1.format(date); |
|
|
|
String curDate = sdf1.format(date); |
|
|
|
curDate=curDate.substring(0,13)+":00:00"; |
|
|
|
curDate = curDate.substring(0, 13) + ":00:00"; |
|
|
|
|
|
|
|
|
|
|
|
NowPublicDataEntity nowPublicData=new NowPublicDataEntity(); |
|
|
|
NowPublicDataEntity nowPublicData = new NowPublicDataEntity(); |
|
|
|
nowPublicData.setBuildingId(buildingId); |
|
|
|
nowPublicData.setBuildingId(buildingId); |
|
|
|
nowPublicData.setBuildingName(buildingName); |
|
|
|
nowPublicData.setBuildingName(buildingName); |
|
|
|
if (avgWaterTemp!=null){ |
|
|
|
if (avgWaterTemp != null) { |
|
|
|
nowPublicData.setBackWaterTemp(avgWaterTemp); |
|
|
|
nowPublicData.setBackWaterTemp(avgWaterTemp); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
nowPublicData.setBackWaterTemp("0"); |
|
|
|
nowPublicData.setBackWaterTemp("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (maxWaterTemp!=null){ |
|
|
|
if (maxWaterTemp != null) { |
|
|
|
nowPublicData.setUseWaterTemp(maxWaterTemp); |
|
|
|
nowPublicData.setUseWaterTemp(maxWaterTemp); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
nowPublicData.setUseWaterTemp("0"); |
|
|
|
nowPublicData.setUseWaterTemp("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
nowPublicDataService.saveNowHistoryPublicData(nowPublicData); |
|
|
|
nowPublicDataService.saveNowHistoryPublicData(nowPublicData); |
|
|
|
|
|
|
|
|
|
|
|
//监视表生成初始记录
|
|
|
|
//监视表生成初始记录
|
|
|
|
List<NowDataEntity> list=nowDataService.queryNowData(buildingId); |
|
|
|
List<NowDataEntity> list = nowDataService.queryNowData(buildingId); |
|
|
|
if (list.size()==0){//实时表生成记录
|
|
|
|
if (list.size() == 0) {//实时表生成记录
|
|
|
|
List<DeviceModel> deviceList=deviceInstallService.selectDevices(buildingId,"热泵"); |
|
|
|
List<DeviceModel> deviceList = deviceInstallService.selectDevices(buildingId, "热泵"); |
|
|
|
if (deviceList.size()>0){ |
|
|
|
if (deviceList.size() > 0) { |
|
|
|
for (DeviceModel list2:deviceList){ |
|
|
|
for (DeviceModel list2 : deviceList) { |
|
|
|
NowDataEntity nowData=new NowDataEntity(); |
|
|
|
NowDataEntity nowData = new NowDataEntity(); |
|
|
|
nowData.setPumpId(list2.getDeviceAddr()); |
|
|
|
nowData.setPumpId(list2.getDeviceAddr()); |
|
|
|
nowData.setPumpName(list2.getDeviceName()); |
|
|
|
nowData.setPumpName(list2.getDeviceName()); |
|
|
|
nowData.setBuildingId(buildingId); |
|
|
|
nowData.setBuildingId(buildingId); |
|
|
@ -85,10 +85,10 @@ public class NowDataController { |
|
|
|
nowDataService.saveNowData(nowData); //当前状态表
|
|
|
|
nowDataService.saveNowData(nowData); //当前状态表
|
|
|
|
nowDataService.saveHistoryData(nowData); //历史状态表
|
|
|
|
nowDataService.saveHistoryData(nowData); //历史状态表
|
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
NowDataEntity nowData=new NowDataEntity(); |
|
|
|
NowDataEntity nowData = new NowDataEntity(); |
|
|
|
PumpModel pump=deviceFloorService.selectDeviceId2("热泵",buildingId); |
|
|
|
PumpModel pump = deviceFloorService.selectDeviceId2("热泵", buildingId); |
|
|
|
if (pump!=null){ |
|
|
|
if (pump != null) { |
|
|
|
nowData.setPumpId(pump.getPumpId()); |
|
|
|
nowData.setPumpId(pump.getPumpId()); |
|
|
|
nowData.setPumpName(pump.getPumpName()); |
|
|
|
nowData.setPumpName(pump.getPumpName()); |
|
|
|
nowData.setBuildingId(buildingId); |
|
|
|
nowData.setBuildingId(buildingId); |
|
|
@ -99,140 +99,144 @@ 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) { |
|
|
|
log.error("查询当前监控状态出错!",e); |
|
|
|
log.error("查询当前监控状态出错!", e); |
|
|
|
return HttpResult.error("查询当前监控状态出错!"); |
|
|
|
return HttpResult.error("查询当前监控状态出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SysLogger(title="实时监控",optDesc = "分别查看热泵运行情况") |
|
|
|
@SysLogger(title = "实时监控", optDesc = "分别查看热泵运行情况") |
|
|
|
@PostMapping("/queryNowByPump") |
|
|
|
@PostMapping("/queryNowByPump") |
|
|
|
public HttpResult queryNowByPump(@RequestParam(value = "buildingId") String buildingId,@RequestParam(value = "pumpId") String pumpId){ |
|
|
|
public HttpResult queryNowByPump(@RequestParam(value = "buildingId") String buildingId, @RequestParam(value = "pumpId") String pumpId) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
NowDataEntity nowDataEntity=nowDataService.queryNowDataByPump(buildingId,pumpId); |
|
|
|
NowDataEntity nowDataEntity = nowDataService.queryNowDataByPump(buildingId, pumpId); |
|
|
|
return HttpResult.ok(nowDataEntity); |
|
|
|
return HttpResult.ok(nowDataEntity); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
return HttpResult.error("按热泵查询当前监控状态出错!"); |
|
|
|
return HttpResult.error("按热泵查询当前监控状态出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SysLogger(title="运行信息",optDesc = "热泵历史状态查询") |
|
|
|
@SysLogger(title = "运行信息", optDesc = "热泵历史状态查询") |
|
|
|
@PostMapping("/query") |
|
|
|
@PostMapping("/query") |
|
|
|
public HttpResult queryHistoryData(@RequestParam(value = "curDate") String curDate, |
|
|
|
public HttpResult queryHistoryData(@RequestParam(value = "curDate") String curDate, |
|
|
|
@RequestParam(value = "buildingId") String buildingId, |
|
|
|
@RequestParam(value = "buildingId") String buildingId, |
|
|
|
@RequestParam(value = "pumpId",required = false) String pumpId, |
|
|
|
@RequestParam(value = "pumpId", required = false) String pumpId, |
|
|
|
@RequestParam(value = "tankId",required = false) String tankId, |
|
|
|
@RequestParam(value = "tankId", required = false) String tankId, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "limit") int limit){ |
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
List<NowDataEntity> list; |
|
|
|
List<NowDataEntity> list; |
|
|
|
list=nowDataService.queryHistoryData(curDate,buildingId,pumpId,tankId,page,limit); |
|
|
|
list = nowDataService.queryHistoryData(curDate, buildingId, pumpId, tankId, page, limit); |
|
|
|
int count=nowDataService.getHistoryDataCount(curDate,buildingId,pumpId,tankId,page,limit); |
|
|
|
int count = nowDataService.getHistoryDataCount(curDate, buildingId, pumpId, tankId, page, limit); |
|
|
|
return HttpResult.ok(count,list); |
|
|
|
return HttpResult.ok(count, list); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
// e.printStackTrace();
|
|
|
|
// e.printStackTrace();
|
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询水位开始
|
|
|
|
//查询水位开始
|
|
|
|
@SysLogger(title="水位变化表",optDesc = "水位变化查询") |
|
|
|
@SysLogger(title = "水位变化表", optDesc = "水位变化查询") |
|
|
|
@PostMapping("/waterLevel") |
|
|
|
@PostMapping("/waterLevel") |
|
|
|
public HttpResult queryWaterLevel(@RequestParam(value = "curDate") String curDate, |
|
|
|
public HttpResult queryWaterLevel(@RequestParam(value = "curDate") String curDate, |
|
|
|
@RequestParam(value = "buildingID") String buildingID, |
|
|
|
@RequestParam(value = "buildingID") String buildingID, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "level", defaultValue = "0") int level, |
|
|
|
@RequestParam(value = "limit") int limit){ |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
try{ |
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
if (buildingID==null || buildingID.equals("") || buildingID.equals("所有楼栋")){ |
|
|
|
try { |
|
|
|
List<WaterLevelEntity> list=nowDataService.queryBuildWaterLevel(curDate, page, limit); |
|
|
|
if (buildingID == null || buildingID.equals("") || buildingID.equals("所有楼栋") || level == 0 || level == 1) { |
|
|
|
int count=nowDataService.buildWaterLevelCount(curDate); |
|
|
|
List<WaterLevelEntity> list = nowDataService.queryBuildWaterLevel(curDate, page, limit, level, buildingID); |
|
|
|
return HttpResult.ok(count,list); |
|
|
|
// int count = nowDataService.buildWaterLevelCount(curDate);
|
|
|
|
}else{ |
|
|
|
int count = list.size(); |
|
|
|
List<WaterLevelEntity> list=nowDataService.queryWaterLevel(curDate,buildingID,page,limit); |
|
|
|
return HttpResult.ok(count, list); |
|
|
|
int count=nowDataService.getWaterLevelCount(curDate,buildingID); |
|
|
|
} else { |
|
|
|
return HttpResult.ok(count,list); |
|
|
|
List<WaterLevelEntity> list = nowDataService.queryWaterLevel(curDate, buildingID, page, limit); |
|
|
|
|
|
|
|
int count = nowDataService.getWaterLevelCount(curDate, buildingID); |
|
|
|
|
|
|
|
return HttpResult.ok(count, list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
// e.printStackTrace();
|
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/levelByTime") |
|
|
|
@PostMapping("/levelByTime") |
|
|
|
public HttpResult queryWaterLevelByTime(@RequestParam(value = "curDate") String curDate, |
|
|
|
public HttpResult queryWaterLevelByTime(@RequestParam(value = "curDate") String curDate, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "limit") int limit){ |
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
int count=nowDataService.waterLevelByTimeCount(curDate); |
|
|
|
int count = nowDataService.waterLevelByTimeCount(curDate); |
|
|
|
List<WaterLevelModel> list=nowDataService.queryWaterLevelByTime(curDate,page,limit); |
|
|
|
List<WaterLevelModel> list = nowDataService.queryWaterLevelByTime(curDate, page, limit); |
|
|
|
return HttpResult.ok(count,list); |
|
|
|
return HttpResult.ok(count, list); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
// e.printStackTrace();
|
|
|
|
// e.printStackTrace();
|
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询水位结束
|
|
|
|
//查询水位结束
|
|
|
|
//查询水温,每天24小时情况
|
|
|
|
//查询水温,每天24小时情况
|
|
|
|
@SysLogger(title="温度变化表",optDesc = "温度变化查询") |
|
|
|
@SysLogger(title = "温度变化表", optDesc = "温度变化查询") |
|
|
|
@PostMapping("/waterTemp") |
|
|
|
@PostMapping("/waterTemp") |
|
|
|
public HttpResult queryWaterTemp(@RequestParam(value = "buildingID") String buildingID, |
|
|
|
public HttpResult queryWaterTemp(@RequestParam(value = "buildingID") String buildingID, |
|
|
|
@RequestParam(value = "curDate") String curDate, |
|
|
|
@RequestParam(value = "curDate") String curDate, |
|
|
|
|
|
|
|
@RequestParam(value = "level", defaultValue = "0") int level, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "limit") int limit){ |
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
List<WaterTempEntity> list; |
|
|
|
List<WaterTempEntity> list; |
|
|
|
int count; |
|
|
|
int count; |
|
|
|
if (buildingID==null || buildingID.equals("") || buildingID.equals("所有楼栋")){ |
|
|
|
// 校区或者区域
|
|
|
|
list=nowDataService.queryWaterTemp2(curDate,page,limit); |
|
|
|
if (buildingID == null || buildingID.equals("") || buildingID.equals("所有楼栋") || level == 0 || level == 1) { |
|
|
|
count=nowDataService.queryWaterTempCount2(curDate); |
|
|
|
list = nowDataService.queryWaterTemp2(curDate, page, limit, level, buildingID); |
|
|
|
}else{ |
|
|
|
// count = nowDataService.queryWaterTempCount2(curDate, level, buildingID);
|
|
|
|
list=nowDataService.queryWaterTemp(buildingID,curDate,page,limit); |
|
|
|
count = list.size(); |
|
|
|
count=nowDataService.queryWaterTempCount(buildingID,curDate); |
|
|
|
} else { |
|
|
|
|
|
|
|
list = nowDataService.queryWaterTemp(buildingID, curDate, page, limit); |
|
|
|
|
|
|
|
count = nowDataService.queryWaterTempCount(buildingID, curDate); |
|
|
|
} |
|
|
|
} |
|
|
|
return HttpResult.ok(count,list); |
|
|
|
return HttpResult.ok(count, list); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
// e.printStackTrace();
|
|
|
|
// e.printStackTrace();
|
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询运行时长
|
|
|
|
//查询运行时长
|
|
|
|
@SysLogger(title="运行时长",optDesc = "热泵运行时长查询") |
|
|
|
@SysLogger(title = "运行时长", optDesc = "热泵运行时长查询") |
|
|
|
@PostMapping("/minutes") |
|
|
|
@PostMapping("/minutes") |
|
|
|
public HttpResult pumpMinutes(@RequestParam(value = "startDate") String startDate, |
|
|
|
public HttpResult pumpMinutes(@RequestParam(value = "startDate") String startDate, |
|
|
|
@RequestParam(value = "endDate") String endDate, |
|
|
|
@RequestParam(value = "endDate") String endDate, |
|
|
|
@RequestParam(value = "buildingId",required = false) String buildingId, |
|
|
|
@RequestParam(value = "buildingId", required = false) String buildingId, |
|
|
|
@RequestParam(value = "pumpId",required = false) String pumpId, |
|
|
|
@RequestParam(value = "pumpId", required = false) String pumpId, |
|
|
|
@RequestParam(value = "type") int type, |
|
|
|
@RequestParam(value = "type") int type, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
@RequestParam(value = "limit") int limit){ |
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
int count=0; |
|
|
|
int count = 0; |
|
|
|
List<PumpMinutesEntity> list; |
|
|
|
List<PumpMinutesEntity> list; |
|
|
|
if(type==1){ |
|
|
|
if (type == 1) { |
|
|
|
list=nowDataService.pumpMinutes(startDate,endDate,buildingId,pumpId,page,limit); |
|
|
|
list = nowDataService.pumpMinutes(startDate, endDate, buildingId, pumpId, page, limit); |
|
|
|
count=nowDataService.pumpMinutesCount(startDate,endDate,buildingId,pumpId); |
|
|
|
count = nowDataService.pumpMinutesCount(startDate, endDate, buildingId, pumpId); |
|
|
|
}else if(type==2){ |
|
|
|
} else if (type == 2) { |
|
|
|
list=nowDataService.pumpWeekMinutes(startDate,endDate,buildingId,pumpId,page,limit); |
|
|
|
list = nowDataService.pumpWeekMinutes(startDate, endDate, buildingId, pumpId, page, limit); |
|
|
|
count=nowDataService.pumpWeekMinutesCount(startDate,endDate,buildingId,pumpId); |
|
|
|
count = nowDataService.pumpWeekMinutesCount(startDate, endDate, buildingId, pumpId); |
|
|
|
}else if(type==3){ |
|
|
|
} else if (type == 3) { |
|
|
|
list=nowDataService.pumpMonthMinutes(startDate,endDate,buildingId,pumpId,page,limit); |
|
|
|
list = nowDataService.pumpMonthMinutes(startDate, endDate, buildingId, pumpId, page, limit); |
|
|
|
count=nowDataService.pumpMonthMinutesCount(startDate,endDate,buildingId,pumpId); |
|
|
|
count = nowDataService.pumpMonthMinutesCount(startDate, endDate, buildingId, pumpId); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
list=nowDataService.pumpMinutes(startDate,endDate,buildingId,pumpId,page,limit); |
|
|
|
list = nowDataService.pumpMinutes(startDate, endDate, buildingId, pumpId, page, limit); |
|
|
|
count=nowDataService.pumpMinutesCount(startDate,endDate,buildingId,pumpId); |
|
|
|
count = nowDataService.pumpMinutesCount(startDate, endDate, buildingId, pumpId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return HttpResult.ok(count,list); |
|
|
|
return HttpResult.ok(count, list); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
// e.printStackTrace();
|
|
|
|
// e.printStackTrace();
|
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
return HttpResult.error("查询出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|