Browse Source

#优化app首页接口

zhongwei
yang_shj 5 months ago
parent
commit
a436845b38
  1. 24
      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

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

@ -542,17 +542,18 @@ 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());
for(HzimsAnalyzeModelStationEntity item : modelList){
pool.submit(() -> {
try{
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList=new ArrayList<>(); List<MultiAnalyzeCodePO> multiAnalyzeCodePOList=new ArrayList<>();
MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO(); MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
R<List<AnalyzeCodeBySignagesVO>>result=analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); R<List<AnalyzeCodeBySignagesVO>>result=analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){
return;
}
WaterLevelVo waterLevelVo=new WaterLevelVo(); WaterLevelVo waterLevelVo=new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId()); waterLevelVo.setStationCode(item.getStationId());
// 前水位 // 前水位
@ -571,7 +572,20 @@ public class RealTargetServiceImpl implements RealTargetService {
Map<Integer, String> rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); Map<Integer, String> rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearCurveMap(rearCurveMap); waterLevelVo.setRearCurveMap(rearCurveMap);
list.add(waterLevelVo); 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