liwen 7 months ago
parent
commit
26cae371f7
  1. 24
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

24
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -1103,9 +1103,11 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return * @return
*/ */
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; // 开始日期
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(beginTime, endTime,6, 2,instanceCode,signage); // 结束日期
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59";
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(start, end,6, 2,instanceCode,signage);
if(CollectionUtil.isEmpty(datas)){ if(CollectionUtil.isEmpty(datas)){
return new HashMap<>(); return new HashMap<>();
} }
@ -1115,8 +1117,8 @@ public class RealTargetServiceImpl implements RealTargetService {
return dateTime.getHours(); return dateTime.getHours();
}, },
value -> { value -> {
if(StringUtil.isBlank(value.getVal())){ if(StringUtil.isEmpty(value.getVal())){
return "0"; return "";
} }
return value.getVal(); return value.getVal();
}) })
@ -1379,12 +1381,10 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return * @return
*/ */
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
// 结束日期
Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 开始日期 // 开始日期
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 24); String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); // 结束日期
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
@ -1394,7 +1394,9 @@ public class RealTargetServiceImpl implements RealTargetService {
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours()); load.setHour(time.getHours());
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); if(StringUtil.isNotBlank(record.getVal())){
load.setActivePower(record.getVal());
}
return load; return load;
}).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList()); }).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList());
} }

Loading…
Cancel
Save