Browse Source

#bug修改

zhongwei
yang_shj 2 years ago
parent
commit
ef3ac2deed
  1. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  2. 57
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  3. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  4. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -351,7 +351,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
Result<HzPage<SoeData>> result = alarmClient.getByStationsAndTime(condition); Result<HzPage<SoeData>> result = alarmClient.getByStationsAndTime(condition);
IPage<AlarmVo> page = Condition.getPage(query); IPage<AlarmVo> page = Condition.getPage(query);
if(result.isSuccess() && ObjectUtil.isNotEmpty(result)){ if(result.isSuccess() && ObjectUtil.isNotEmpty(result)){
// 步骤3.TODO 过滤完成告警处理数据 // 步骤3.过滤完成告警处理数据
List<AlarmVo> alarms = result.getData().getRecords().stream().map(record ->{ List<AlarmVo> alarms = result.getData().getRecords().stream().map(record ->{
AlarmVo alarm = new AlarmVo(); AlarmVo alarm = new AlarmVo();
alarm.setId(record.getId()); alarm.setId(record.getId());

57
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 * @return
*/ */
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
// FIXME 当天功率测试数据 String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
List<ActivePowerVo> 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 end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
return records.stream().map(record -> { 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"); 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")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load; 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 * @return
*/ */
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) {
// FIXME 测试数据 String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
Calendar calendar = Calendar.getInstance(); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
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<GenerationPowerVo> 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<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){ if(CollectionUtil.isEmpty(records)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -555,7 +526,7 @@ public class HydropowerServiceImpl implements HydropowerService {
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")));
return generate; return generate;
}).collect(Collectors.toList());*/ }).collect(Collectors.toList());
} }
/** /**
@ -1499,7 +1470,7 @@ public class HydropowerServiceImpl implements HydropowerService {
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return 0; 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); this.settingBase(duty,item);
// 开始时间、结束时间 // 开始时间、结束时间
LocalDateTime localDateTime = LocalDateTime.ofInstant(duty.getDutyDate().toInstant(), ZoneId.systemDefault()); 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); //LocalDateTime endDate = localDateTime.withHour(duty.getEndTime().getHours()).withMinute(duty.getEndTime().getMinutes()).withSecond(00);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
String start = dtf.format(startDate); String start = dtf.format(startDate);
@ -1605,7 +1576,7 @@ public class HydropowerServiceImpl implements HydropowerService {
List<Long> deptList = Collections.singletonList(deptId); List<Long> deptList = Collections.singletonList(deptId);
// 使用多线程处理数据 // 使用多线程处理数据
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build(); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(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); CountDownLatch countDownLatch = new CountDownLatch(DUTY_POOL_QUANTITY);
// 下一班组 // 下一班组
pool.execute(()-> { pool.execute(()-> {
@ -1614,7 +1585,7 @@ public class HydropowerServiceImpl implements HydropowerService {
}); });
// 缺陷 // 缺陷
pool.execute(()-> { pool.execute(()-> {
this.getDutyDefect(item,startDate,null); this.getDutyDefect(item,startDate);
countDownLatch.countDown(); countDownLatch.countDown();
}); });
// 巡检 // 巡检
@ -1766,11 +1737,11 @@ public class HydropowerServiceImpl implements HydropowerService {
/** /**
* 获取当班缺陷数据 * 获取当班缺陷数据
*
* @param item * @param item
* @param startTime * @param startTime
* @param endTime
*/ */
private void getDutyDefect(AppAreaDutyVo item, LocalDateTime startTime, LocalDateTime endTime) { private void getDutyDefect(AppAreaDutyVo item, LocalDateTime startTime) {
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.lambdaQuery();
wrapper.ge(OperPhenomenonEntity::getCreateTime,startTime); wrapper.ge(OperPhenomenonEntity::getCreateTime,startTime);
//wrapper.le(OperPhenomenonEntity::getCreateTime,endTime); //wrapper.le(OperPhenomenonEntity::getCreateTime,endTime);

33
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 * @return
*/ */
private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
// FIXME 当天功率测试数据 String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
List<PhotovoltaicPowerVo> 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 end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
@ -326,7 +313,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
load.setHour(time.getHours()); load.setHour(time.getHours());
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load; 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 * @return
*/ */
private List<PhotovoltaicLoadGenerateVo> periodLoadDay(List<Long> stations) { private List<PhotovoltaicLoadGenerateVo> periodLoadDay(List<Long> stations) {
// FIXME 当天功率测试数据
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
List<PhotovoltaicLoadGenerateVo> 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实时数据 // redis实时数据
List<PhotovoltaicTargetVo> photovoltaics = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key); List<PhotovoltaicTargetVo> photovoltaics = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtil.isEmpty(photovoltaics)){ if(CollectionUtil.isEmpty(photovoltaics)){
@ -1385,7 +1358,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
target.setPeriod(String.valueOf(time.getHour())); target.setPeriod(String.valueOf(time.getHour()));
target.setValue((float) entry.getValue().stream().mapToDouble(o-> Double.parseDouble(String.valueOf(o.getVal()))).sum()); target.setValue((float) entry.getValue().stream().mapToDouble(o-> Double.parseDouble(String.valueOf(o.getVal()))).sum());
return target; return target;
}).collect(Collectors.toList());*/ }).collect(Collectors.toList());
} }
/** /**

16
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 * @return
*/ */
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
/** LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER);
* FIXME 水位测试数据
*/
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
Map<Integer, String> 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 endTime = LocalDateTime.now(); LocalDateTime endTime = LocalDateTime.now();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
@ -334,7 +322,7 @@ public class WaterServiceImpl implements IWaterService {
return "0"; return "0";
} }
return value.getVal(); return value.getVal();
}));*/ }));
} }
/** /**

Loading…
Cancel
Save