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)){
return;
}
List<WaterLevelVo> list = new ArrayList<>();
modelList.forEach(item -> {
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>();
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return;
}
WaterLevelVo waterLevelVo = new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId());
// 前水位
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 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> rearCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearCurveMap(rearCurveMap);
list.add(waterLevelVo);
});
List<WaterLevelVo> list = new CopyOnWriteArrayList<>();
CountDownLatch countDownLatch = new CountDownLatch(modelList.size());
for(HzimsAnalyzeModelStationEntity item : modelList){
pool.submit(() -> {
try{
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList=new ArrayList<>();
MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
R<List<AnalyzeCodeBySignagesVO>>result=analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){
WaterLevelVo waterLevelVo=new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId());
// 前水位
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 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> rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
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);
}

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));
return area;
}).sorted(Comparator.comparing(HydropowerAreaVo::getReality)).collect(Collectors.toList());
redisTemplate.opsForValue().set(loadwater_group_key,hydropowerAreas);
redisTemplate.expire(loadwater_group_key,5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(loadwater_group_key + deptId,hydropowerAreas);
redisTemplate.expire(loadwater_group_key + deptId,5, TimeUnit.MINUTES);
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.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());
if(CollectionUtil.isNotEmpty(devices)){

Loading…
Cancel
Save