Browse Source

#优化app首页接口

zhongwei
yang_shj 5 months ago
parent
commit
a436845b38
  1. 74
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  2. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

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

@ -542,36 +542,50 @@ public class RealTargetServiceImpl implements RealTargetService {
if(CollectionUtil.isEmpty(modelList)){ if(CollectionUtil.isEmpty(modelList)){
return; return;
} }
List<WaterLevelVo> list = new ArrayList<>(); List<WaterLevelVo> list = new CopyOnWriteArrayList<>();
modelList.forEach(item -> { CountDownLatch countDownLatch = new CountDownLatch(modelList.size());
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>(); for(HzimsAnalyzeModelStationEntity item : modelList){
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); pool.submit(() -> {
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); try{
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); List<MultiAnalyzeCodePO> multiAnalyzeCodePOList=new ArrayList<>();
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO();
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
return; multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
} R<List<AnalyzeCodeBySignagesVO>>result=analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
WaterLevelVo waterLevelVo = new WaterLevelVo(); if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){
waterLevelVo.setStationCode(item.getStationId()); WaterLevelVo waterLevelVo=new WaterLevelVo();
// 前水位 waterLevelVo.setStationCode(item.getStationId());
double frontWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); // 前水位
waterLevelVo.setFrontWaterLevel(frontWaterLevel); double frontWaterLevel=this.getWaterLevel(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
// 后水位 waterLevelVo.setFrontWaterLevel(frontWaterLevel);
double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); // 后水位
waterLevelVo.setRearWaterLevel(rearWaterLevel); double rearWaterLevel=this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
// 下泄流量 waterLevelVo.setRearWaterLevel(rearWaterLevel);
double dischargeFlow = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW); // 下泄流量
waterLevelVo.setDischargeFlow(dischargeFlow); double dischargeFlow=this.getWaterLevel(item.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW);
// 前水位当日曲线 waterLevelVo.setDischargeFlow(dischargeFlow);
Map<Integer,String> frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); // 前水位当日曲线
waterLevelVo.setFrontCurveMap(frontCurveMap); Map<Integer, String> frontCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
// 后水位当日曲线 waterLevelVo.setFrontCurveMap(frontCurveMap);
Map<Integer,String> rearCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); // 后水位当日曲线
waterLevelVo.setRearCurveMap(rearCurveMap); Map<Integer, String> rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
list.add(waterLevelVo); waterLevelVo.setRearCurveMap(rearCurveMap);
}); list.add(waterLevelVo);
}
countDownLatch.countDown();
}catch (Exception exception){
log.error("load_water_level_error : {}",exception.getMessage());
countDownLatch.countDown();
}
});
}
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
redisTemplate.opsForValue().set(loadwater_level_key,list); redisTemplate.opsForValue().set(loadwater_level_key,list);
} }

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -893,8 +893,8 @@ public class HydropowerServiceImpl implements HydropowerService {
area.setStationTargets(this.stationTarget(entry.getValue(),reals,targets,plans)); area.setStationTargets(this.stationTarget(entry.getValue(),reals,targets,plans));
return area; return area;
}).sorted(Comparator.comparing(HydropowerAreaVo::getReality)).collect(Collectors.toList()); }).sorted(Comparator.comparing(HydropowerAreaVo::getReality)).collect(Collectors.toList());
redisTemplate.opsForValue().set(loadwater_group_key,hydropowerAreas); redisTemplate.opsForValue().set(loadwater_group_key + deptId,hydropowerAreas);
redisTemplate.expire(loadwater_group_key,5, TimeUnit.MINUTES); redisTemplate.expire(loadwater_group_key + deptId,5, TimeUnit.MINUTES);
return hydropowerAreas; return hydropowerAreas;
} }
@ -1155,11 +1155,6 @@ public class HydropowerServiceImpl implements HydropowerService {
hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getInstalledCapacity())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getInstalledCapacity())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
// 运行天数 // 运行天数
hydropower.setRunDay(this.getRunDay(station)); hydropower.setRunDay(this.getRunDay(station));
// 告警
Result<List<SoeData>> result = soeClient.getByLastLimitTime(null, station.getCode(), 1);
if(result.isSuccess() || CollectionUtil.isNotEmpty(result.getData())){
hydropower.setAlertList(result.getData());
}
// 站点设备 // 站点设备
List<HydropowerUnitRealVo> devices = reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); List<HydropowerUnitRealVo> devices = reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(devices)){

Loading…
Cancel
Save