|
|
|
|
@ -17,7 +17,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
@ -42,6 +46,9 @@ public class NowDataController {
|
|
|
|
|
@Autowired |
|
|
|
|
DeviceFloorService deviceFloorService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
CollectionParamsManageService collectingManagerService; |
|
|
|
|
|
|
|
|
|
@SysLogger(title = "实时监控", optDesc = "实时查看每楼栋热水运行情况") |
|
|
|
|
@PostMapping("/queryNow") |
|
|
|
|
public HttpResult queryNowData(@RequestParam(value = "buildingId") String buildingId) { |
|
|
|
|
@ -51,15 +58,22 @@ public class NowDataController {
|
|
|
|
|
String maxWaterTemp = nowDataService.selectMaxTemp(buildingId); |
|
|
|
|
String buildingName = buildingService.queryBuildingName(buildingId);//获取楼栋名称
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
Date date = new Date(); |
|
|
|
|
String curDate = sdf1.format(date); |
|
|
|
|
curDate = curDate.substring(0, 13) + ":00:00"; |
|
|
|
|
|
|
|
|
|
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// Date date = new Date();
|
|
|
|
|
// String curDate = sdf1.format(date);
|
|
|
|
|
// curDate = curDate.substring(0, 13) + ":00:00";
|
|
|
|
|
String curDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00:00")); |
|
|
|
|
|
|
|
|
|
NowPublicDataEntity nowPublicData = new NowPublicDataEntity(); |
|
|
|
|
nowPublicData.setBuildingId(buildingId); |
|
|
|
|
nowPublicData.setBuildingName(buildingName); |
|
|
|
|
if (avgWaterTemp != null) { |
|
|
|
|
|
|
|
|
|
// 判断是否有回水温度
|
|
|
|
|
CollectionParamsManageEntity collectionParamsManageEntity = collectingManagerService.selectDeviceInstallByOtherName("回水温度", buildingId); |
|
|
|
|
if (collectionParamsManageEntity != null && collectionParamsManageEntity.getCurValue().compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
nowPublicData.setBackWaterTemp(collectionParamsManageEntity.getCurValue().setScale(1, RoundingMode.HALF_UP).toString()); |
|
|
|
|
} else if (avgWaterTemp != null) { |
|
|
|
|
nowPublicData.setBackWaterTemp(avgWaterTemp); |
|
|
|
|
} else { |
|
|
|
|
nowPublicData.setBackWaterTemp("0"); |
|
|
|
|
@ -117,10 +131,12 @@ public class NowDataController {
|
|
|
|
|
String maxWaterTemp = nowDataService.selectMaxTemp(buildingId); |
|
|
|
|
String buildingName = buildingService.queryBuildingName(buildingId);//获取楼栋名称
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
Date date = new Date(); |
|
|
|
|
String curDate = sdf1.format(date); |
|
|
|
|
curDate = curDate.substring(0, 13) + ":00:00"; |
|
|
|
|
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// Date date = new Date();
|
|
|
|
|
// String curDate = sdf1.format(date);
|
|
|
|
|
// curDate = curDate.substring(0, 13) + ":00:00";
|
|
|
|
|
|
|
|
|
|
String curDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00:00")); |
|
|
|
|
|
|
|
|
|
NowPublicDataEntity nowPublicData = new NowPublicDataEntity(); |
|
|
|
|
nowPublicData.setBuildingId(buildingId); |
|
|
|
|
@ -306,10 +322,10 @@ public class NowDataController {
|
|
|
|
|
@SysLogger(title = "压力变化表", optDesc = "压力变化查询") |
|
|
|
|
@PostMapping("/waterPressure") |
|
|
|
|
public HttpResult queryWaterPressure(@RequestParam(value = "buildingID") String buildingID, |
|
|
|
|
@RequestParam(value = "curDate") String curDate, |
|
|
|
|
@RequestParam(value = "level", defaultValue = "0") int level, |
|
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
|
@RequestParam(value = "curDate") String curDate, |
|
|
|
|
@RequestParam(value = "level", defaultValue = "0") int level, |
|
|
|
|
@RequestParam(value = "page") int page, |
|
|
|
|
@RequestParam(value = "limit") int limit) { |
|
|
|
|
try { |
|
|
|
|
List<WaterPressureEntity> list; |
|
|
|
|
int count; |
|
|
|
|
@ -323,7 +339,7 @@ public class NowDataController {
|
|
|
|
|
} |
|
|
|
|
return HttpResult.ok(count, list); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return HttpResult.error("查询出错!"+e.getMessage()); |
|
|
|
|
return HttpResult.error("查询出错!" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|