|
|
|
@ -281,32 +281,19 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
|
// FIXME 当天功率测试数据
|
|
|
|
|
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 start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
List<AnalyseDataTaosVO> 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<GenerationPowerVo> 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<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); |
|
|
|
|
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
List<AnalyseDataTaosVO> 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<Long> 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<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); |
|
|
|
|
// 下一班组
|
|
|
|
|
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<OperPhenomenonEntity> wrapper = Wrappers.lambdaQuery(); |
|
|
|
|
wrapper.ge(OperPhenomenonEntity::getCreateTime,startTime); |
|
|
|
|
//wrapper.le(OperPhenomenonEntity::getCreateTime,endTime);
|
|
|
|
|