diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java index 6b524df..676adbb 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java @@ -21,11 +21,11 @@ import javax.annotation.Resource; @Resource public class ScheduledApplication extends SpringBootServletInitializer { public static void main(String[] args) { - BladeApplication.run("hzims-scheduled", ScheduledApplication.class, args); + BladeApplication.run("hzims-scheduled-ysj", ScheduledApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { - return BladeApplication.createSpringApplicationBuilder(builder, "hzims-scheduled", ScheduledApplication.class); + return BladeApplication.createSpringApplicationBuilder(builder, "hzims-scheduled-ysj", ScheduledApplication.class); } } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java index 9591c87..a2b873f 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java @@ -110,9 +110,10 @@ public class RealTargetScheduledTask { /** * 水利-站点水位数据 */ - @XxlJob(LOAD_WATER_LEVEL) - //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadWaterLevel(String param) { + //@XxlJob(LOAD_WATER_LEVEL) + @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadWaterLevel() { + String param = ""; if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 52e5fd1..522184b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -545,40 +545,9 @@ public class RealTargetServiceImpl implements RealTargetService { List list = new CopyOnWriteArrayList<>(); CountDownLatch countDownLatch = new CountDownLatch(modelList.size()); for(HzimsAnalyzeModelStationEntity item : modelList){ - pool.submit(() -> { - try{ - List multiAnalyzeCodePOList=new ArrayList<>(); - MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO(); - multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); - multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); - multiAnalyzeCodePOList.add(multiAnalyzeCodePO); - R>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 frontCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); - waterLevelVo.setFrontCurveMap(frontCurveMap); - // 后水位当日曲线 - Map rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); - waterLevelVo.setRearCurveMap(rearCurveMap); - list.add(waterLevelVo); - } - log.error("load_water_level : 线程执行完成 {}", item.getInstanceCode()); - countDownLatch.countDown(); - } catch (Exception exception) { - log.error("load_water_level_error : 线程执行失败 {}", exception.getMessage()); - countDownLatch.countDown(); - } + pool.execute(() -> { + this.queryWaterLeve(list,item); + countDownLatch.countDown(); }); } try { @@ -588,11 +557,50 @@ public class RealTargetServiceImpl implements RealTargetService { e.printStackTrace(); Thread.currentThread().interrupt(); } - log.error("load_water_level :线程执行完成"); + log.error("load_water_level :线程执行结束"); redisTemplate.opsForValue().set(loadwater_level_key,list); } /** + * 水位数据查询 + * @param list + * @param item + */ + private void queryWaterLeve(List list,HzimsAnalyzeModelStationEntity item) { + try{ + List multiAnalyzeCodePOList=new ArrayList<>(); + MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO(); + multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); + multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); + multiAnalyzeCodePOList.add(multiAnalyzeCodePO); + R>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 frontCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); + waterLevelVo.setFrontCurveMap(frontCurveMap); + // 后水位当日曲线 + Map rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); + waterLevelVo.setRearCurveMap(rearCurveMap); + list.add(waterLevelVo); + } + log.error("load_water_level : 小节线程执行完成 {}", item.getInstanceCode()); + } catch (Exception exception) { + log.error("load_water_level_error : 线程执行失败 {}", exception.getMessage()); + } + } + + /** * 光伏站-逆变器实时加载 * * @param param