diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 23a3cf7..7da6a9e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -351,7 +351,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl> result = alarmClient.getByStationsAndTime(condition); IPage page = Condition.getPage(query); if(result.isSuccess() && ObjectUtil.isNotEmpty(result)){ - // 步骤3.TODO 过滤完成告警处理数据 + // 步骤3.过滤完成告警处理数据 List alarms = result.getData().getRecords().stream().map(record ->{ AlarmVo alarm = new AlarmVo(); alarm.setId(record.getId()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index d3dc3df..c9e67f1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -281,32 +281,19 @@ public class HydropowerServiceImpl implements HydropowerService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - // FIXME 当天功率测试数据 - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - List list = new ArrayList<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - ActivePowerVo load = new ActivePowerVo(); - load.setHour(start.get(Calendar.HOUR_OF_DAY)); - load.setActivePower(String.valueOf(random.nextDouble() * 500)); - list.add(load); - start.add(Calendar.HOUR_OF_DAY,1); - } - return list; - /*String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { return new ArrayList<>(); } return records.stream().map(record -> { - PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); + ActivePowerVo load = new ActivePowerVo(); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); - load.setHour(DateUtil.format(time,"yyyy-mm-dd HH")); + load.setHour(time.getHours()); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); return load; - }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList());*/ + }).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList()); } /** @@ -527,25 +514,9 @@ public class HydropowerServiceImpl implements HydropowerService { * @return */ private List getGenerationPowerList(EminfoAndEmParamVo device) { - // FIXME 测试数据 - String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH,-29); - calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); - calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); - calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); - String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); - Random random = new Random(); - List generates = new ArrayList<>(); - if(calendar.getTime().compareTo(new Date()) <= 0){ - GenerationPowerVo generate = new GenerationPowerVo(); - generate.setDate(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE)); - generate.setGenerate(random.nextFloat() * 500000f); - generates.add(generate); - } - return generates; - - /*List records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); + String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; + String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + List records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); if(CollectionUtil.isEmpty(records)){ return new ArrayList<>(); } @@ -555,7 +526,7 @@ public class HydropowerServiceImpl implements HydropowerService { generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); return generate; - }).collect(Collectors.toList());*/ + }).collect(Collectors.toList()); } /** @@ -1499,7 +1470,7 @@ public class HydropowerServiceImpl implements HydropowerService { if(CollectionUtil.isEmpty(list)){ return 0; } - return (float) list.stream().filter(o->createDept.equals(o.getDeptId())).mapToDouble(o->Double.valueOf(o.getActivePower())).sum(); + return (float) list.stream().filter(o->createDept.equals(o.getDeptId())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum(); } /** @@ -1597,7 +1568,7 @@ public class HydropowerServiceImpl implements HydropowerService { this.settingBase(duty,item); // 开始时间、结束时间 LocalDateTime localDateTime = LocalDateTime.ofInstant(duty.getDutyDate().toInstant(), ZoneId.systemDefault()); - LocalDateTime startDate = localDateTime.withHour(duty.getStartTime().getHours()).withMinute(duty.getStartTime().getMinutes()).withSecond(00); + LocalDateTime startDate = localDateTime.withHour(duty.getStartTime().getHours()).withMinute(duty.getStartTime().getMinutes()).withSecond(0); //LocalDateTime endDate = localDateTime.withHour(duty.getEndTime().getHours()).withMinute(duty.getEndTime().getMinutes()).withSecond(00); DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); String start = dtf.format(startDate); @@ -1605,7 +1576,7 @@ public class HydropowerServiceImpl implements HydropowerService { List deptList = Collections.singletonList(deptId); // 使用多线程处理数据 ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build(); - ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); CountDownLatch countDownLatch = new CountDownLatch(DUTY_POOL_QUANTITY); // 下一班组 pool.execute(()-> { @@ -1614,7 +1585,7 @@ public class HydropowerServiceImpl implements HydropowerService { }); // 缺陷 pool.execute(()-> { - this.getDutyDefect(item,startDate,null); + this.getDutyDefect(item,startDate); countDownLatch.countDown(); }); // 巡检 @@ -1766,11 +1737,11 @@ public class HydropowerServiceImpl implements HydropowerService { /** * 获取当班缺陷数据 + * * @param item * @param startTime - * @param endTime */ - private void getDutyDefect(AppAreaDutyVo item, LocalDateTime startTime, LocalDateTime endTime) { + private void getDutyDefect(AppAreaDutyVo item, LocalDateTime startTime) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.ge(OperPhenomenonEntity::getCreateTime,startTime); //wrapper.le(OperPhenomenonEntity::getCreateTime,endTime); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java index a6f4cf8..c51451f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java @@ -301,20 +301,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - // FIXME 当天功率测试数据 - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - List list = new ArrayList<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); - load.setHour(start.get(Calendar.HOUR_OF_DAY)); - load.setActivePower(String.valueOf(random.nextDouble() * 500)); - list.add(load); - start.add(Calendar.HOUR_OF_DAY,1); - } - return list.stream().sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); - /*String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { @@ -326,7 +313,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { load.setHour(time.getHours()); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); return load; - }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList());*/ + }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); } /** @@ -1347,20 +1334,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { * @return */ private List periodLoadDay(List stations) { - // FIXME 当天功率测试数据 - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - List list = new ArrayList<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - PhotovoltaicLoadGenerateVo load = new PhotovoltaicLoadGenerateVo(); - load.setPeriod(DateUtil.format(start.getTime(),"yyyy-mm-dd HH")); - load.setValue(random.nextFloat() * 500); - list.add(load); - start.add(Calendar.HOUR_OF_DAY,1); - } - return list; - /* // redis实时数据 List photovoltaics = (List) redisTemplate.opsForValue().get(load_photovoltaic_target_key); if(CollectionUtil.isEmpty(photovoltaics)){ @@ -1385,7 +1358,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { target.setPeriod(String.valueOf(time.getHour())); target.setValue((float) entry.getValue().stream().mapToDouble(o-> Double.parseDouble(String.valueOf(o.getVal()))).sum()); return target; - }).collect(Collectors.toList());*/ + }).collect(Collectors.toList()); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java index 13ceb92..198ad61 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java @@ -289,19 +289,7 @@ public class WaterServiceImpl implements IWaterService { * @return */ private Map getWaterLevelMap(String instanceCode, String signage) { - /** - * FIXME 水位测试数据 - */ - Calendar start = Calendar.getInstance(); - start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY)); - Map map = new HashMap<>(); - Random random = new Random(); - while (start.getTime().compareTo(new Date()) <= 0){ - map.put(start.get(Calendar.HOUR_OF_DAY),String.valueOf(random.nextDouble() * 500)); - start.add(Calendar.HOUR_OF_DAY,1); - } - return map; - /*LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); + LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); LocalDateTime endTime = LocalDateTime.now(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); List signboardConditions = new ArrayList<>(); @@ -334,7 +322,7 @@ public class WaterServiceImpl implements IWaterService { return "0"; } return value.getVal(); - }));*/ + })); } /**