Browse Source

#设备状态设置修改

zhongwei
yang_shj 5 months ago
parent
commit
d1dbac3f12
  1. 82
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  2. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

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

@ -127,7 +127,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
// 创建线程池 // 创建线程池
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
@Override @Override
public void loadEmInfo(String param) { public void loadEmInfo(String param) {
@ -281,24 +281,38 @@ public class RealTargetServiceImpl implements RealTargetService {
// 水电站设备 // 水电站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(devices)){
targets.addAll(devices.stream().map(device->{ CountDownLatch countDownLatch = new CountDownLatch(devices.size());
HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); for(EminfoAndEmParamVo device : devices) {
target.setDeptId(device.getCreateDept()); pool.submit(() -> {
target.setDeviceCode(device.getEmCode()); try{
target.setDeviceName(device.getName()); HydropowerUnitTargetVo target = new HydropowerUnitTargetVo();
target.setDeptName(device.getName()); target.setDeptId(device.getCreateDept());
// 当年发电量 target.setDeviceCode(device.getEmCode());
target.setPowerYear(this.getGenerationPower(device,0)); target.setDeviceName(device.getName());
// 当月发电量 target.setDeptName(device.getName());
target.setPowerMon(this.getGenerationPower(device,1)); // 当年发电量
// 当日发电量 target.setPowerYear(this.getGenerationPower(device, 0));
target.setPowerDay(this.getGenerationPower(device,2)); // 当月发电量
// 当天有功功率 target.setPowerMon(this.getGenerationPower(device, 1));
target.setActivePowerVoList(this.getLoadsByDay(device)); // 当日发电量
// 30天发电量 target.setPowerDay(this.getGenerationPower(device, 2));
target.setGenerationPowerVoList(this.getGenerationPowerList(device)); // 当天有功功率
return target; target.setActivePowerVoList(this.getLoadsByDay(device));
}).collect(Collectors.toList())); // 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(device));
targets.add(target);
countDownLatch.countDown();
}catch (Exception exception){
countDownLatch.countDown();
}
});
}
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
} }
// 站点指标数据为空 // 站点指标数据为空
if(CollectionUtil.isEmpty(targets)){ if(CollectionUtil.isEmpty(targets)){
@ -1252,23 +1266,23 @@ public class RealTargetServiceImpl implements RealTargetService {
List<List<StationEntity>> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList()); List<List<StationEntity>> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList());
CountDownLatch countDownLatch = new CountDownLatch(limits.size()); CountDownLatch countDownLatch = new CountDownLatch(limits.size());
for(List<StationEntity> item : limits){ for(List<StationEntity> item : limits){
try{
pool.submit(()->{ pool.submit(()->{
item.forEach(station->{ try{
// 站点设备集合 item.forEach(station->{
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); // 站点设备集合
Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end); List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(MapUtils.isEmpty(generateMap)){ Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end);
return; if(MapUtils.isEmpty(generateMap)){
} return;
powerMap.put(station.getId(),generateMap); }
}); powerMap.put(station.getId(),generateMap);
countDownLatch.countDown(); });
log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); countDownLatch.countDown();
log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
}catch (Exception e){
countDownLatch.countDown();
}
}); });
}catch (Exception e){
log.error("pool_item_execute_complete_error : {}" ,e.getMessage());
}
} }
// 等待所有线程执行完成 // 等待所有线程执行完成
try { try {

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -279,12 +279,13 @@ public class ShowServiceImpl implements ShowService {
Map<String,List<String>> deviceClassifyMap = new HashMap<>(); Map<String,List<String>> deviceClassifyMap = new HashMap<>();
List<String> deviceCodeList = devices.stream().map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); List<String> deviceCodeList = devices.stream().map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList());
// 故障 // 故障
List<OperPhenomenonEntity> operPhenomenonEntityList = phenomenonService.list(new QueryWrapper<OperPhenomenonEntity>() {{ /*List<OperPhenomenonEntity> operPhenomenonEntityList = phenomenonService.list(new QueryWrapper<OperPhenomenonEntity>() {{
in("EM_CODE", deviceCodeList); in("EM_CODE", deviceCodeList);
ne("IS_DEFECT", DefectConstant.IsDefectStatusEnum.IS_DEFECT.getStatus()); ne("IS_DEFECT", DefectConstant.IsDefectStatusEnum.NOT_DEFECT.getStatus());
ne("CONCLUSION_STATUS", DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()); ne("CONCLUSION_STATUS", DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus());
}}); }});
List<String> faultList = operPhenomenonEntityList.stream().map(OperPhenomenonEntity::getEmCode).distinct().collect(Collectors.toList()); operPhenomenonEntityList.stream().map(OperPhenomenonEntity::getEmCode).distinct().collect(Collectors.toList());*/
List<String> faultList = new ArrayList<>();
deviceClassifyMap.put(HomePageConstant.FAULT,faultList); deviceClassifyMap.put(HomePageConstant.FAULT,faultList);
// 检修 // 检修
List<OperAccessTaskEntity> operAccessTaskEntityList = accessService.list(new QueryWrapper<OperAccessTaskEntity>() {{ List<OperAccessTaskEntity> operAccessTaskEntityList = accessService.list(new QueryWrapper<OperAccessTaskEntity>() {{

Loading…
Cancel
Save