From ffecf0ffdb5ea7d2304c62a540347edb04db1a5b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 1 Aug 2024 10:26:55 +0800 Subject: [PATCH 01/19] =?UTF-8?q?#=E6=96=B0=E7=89=88=E7=94=B5=E7=AB=99?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/home/impl/RealTargetServiceImpl.java | 186 +++++++++++++++++---- 1 file changed, 152 insertions(+), 34 deletions(-) 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 0392d17..527d67a 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 @@ -1,6 +1,5 @@ package com.hnac.hzims.scheduled.service.operation.home.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -8,6 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.equipment.entity.EmParamEntity; +import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity; +import com.hnac.hzims.equipment.entity.ThreeGenerationEntity; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; @@ -20,6 +21,8 @@ import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.scheduled.service.equipment.DeviceParamService; import com.hnac.hzims.scheduled.service.equipment.DeviceService; +import com.hnac.hzims.scheduled.service.equipment.ThirtyGenerateService; +import com.hnac.hzims.scheduled.service.equipment.ThreeGenerateService; import com.hnac.hzims.scheduled.service.operation.fill.*; import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; @@ -38,8 +41,6 @@ import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; -import com.hnac.hzinfo.sdk.v5.device.dto.ReductionDataDTO; -import com.hnac.hzinfo.sdk.v5.device.vo.ReductionDataVO; import com.xxl.job.core.log.XxlJobLogger; import io.undertow.util.CopyOnWriteMap; import lombok.RequiredArgsConstructor; @@ -58,7 +59,6 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.*; @@ -98,6 +98,10 @@ public class RealTargetServiceImpl implements RealTargetService { private final ModelStationService modelStationService; + private final ThreeGenerateService threeGenerateService; + + private final ThirtyGenerateService thirtyGenerateService; + private final RedisTemplate redisTemplate; private final IHeWeatherWeatherClient heWeatherWeatherClient; @@ -278,6 +282,10 @@ public class RealTargetServiceImpl implements RealTargetService { if(CollectionUtil.isEmpty(stations)){ return; } + // 设备30日发电量 + List generations = this.thirtyGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); + // 设备当年发电量 + List generationYears = this.threeGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); // 补充填补发电指标 List targets = this.generteFill(stations); // 水电站设备 @@ -289,19 +297,20 @@ public class RealTargetServiceImpl implements RealTargetService { try{ HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); target.setDeptId(device.getCreateDept()); + Optional station = stations.stream().filter(o->o.getRefDept().equals(device.getCreateDept())).findFirst(); + station.ifPresent(stationEntity -> target.setDeptName(stationEntity.getName())); target.setDeviceCode(device.getEmCode()); target.setDeviceName(device.getName()); - target.setDeptName(device.getName()); // 当年发电量 - target.setPowerYear(this.getGenerationPower(device, 0)); + target.setPowerYear(this.devicePowerYear(generationYears,device)); // 当月发电量 - target.setPowerMon(this.getGenerationPower(device, 1)); + target.setPowerMon(this.devicePowerMon(generationYears,device)); // 当日发电量 - target.setPowerDay(this.getGenerationPower(device, 2)); + target.setPowerDay(this.devicePowerDay(generations,device)); // 当天有功功率 target.setActivePowerVoList(this.getLoadsByDay(device)); // 30天发电量 - target.setGenerationPowerVoList(this.getGenerationPowerList(device)); + target.setGenerationPowerVoList(this.getGenerationPowerList(generations,device)); targets.add(target); countDownLatch.countDown(); }catch (Exception exception){ @@ -323,6 +332,75 @@ public class RealTargetServiceImpl implements RealTargetService { redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets); } + + /** + * 去年发电量 + * @param generations + * @param device + * @return + */ + private Float devicePowerYesterYear(List generations, EminfoAndEmParamVo device) { + if(CollectionUtil.isEmpty(generations)){ + return 0f; + } + return (float) generations.stream().filter(o -> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode())).mapToDouble(o->o.getGenerate().doubleValue()).sum(); + } + + /** + * 当年发电量 + * @param generations + * @param device + * @return + */ + private Float devicePowerYear(List generations, EminfoAndEmParamVo device) { + if(CollectionUtil.isEmpty(generations)){ + return 0f; + } + return (float) generations.stream().filter(o -> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode())).mapToDouble(o->o.getGenerate().doubleValue()).sum(); + } + + /** + * 当月发电量 + * @param generations + * @param device + * @return + */ + private Float devicePowerMon(List generations, EminfoAndEmParamVo device) { + if(CollectionUtil.isEmpty(generations)){ + return 0f; + } + return (float) generations.stream().filter(o-> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode()) && o.getStrMonth().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(o->o.getGenerate().doubleValue()).sum(); + + } + + /** + * 设备当日发电量 + * @param generations + * @param device + * @return + */ + private Float devicePowerDay(List generations, EminfoAndEmParamVo device) { + if(CollectionUtil.isEmpty(generations)){ + return 0f; + } + return (float) generations.stream().filter(o->o.getDeviceCode().equals(device.getEmCode()) && o.getStrDay().contains(DateUtil.format(new Date(),DateUtil.PATTERN_DATE))).mapToDouble(o->o.getGenerate().doubleValue()).sum(); + } + + /** + * 设备昨日发电量 + * @param generations + * @param device + * @return + */ + private Float devicePowerYesterDay(List generations, EminfoAndEmParamVo device) { + if(CollectionUtil.isEmpty(generations)){ + return 0f; + } + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DAY_OF_MONTH,-1); + return (float) generations.stream().filter(o->o.getDeviceCode().equals(device.getEmCode()) && o.getStrDay().contains(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE))).mapToDouble(o->o.getGenerate().doubleValue()).sum(); + } + /** * 水利-泵组实时加载 * @param param @@ -1365,9 +1443,6 @@ public class RealTargetServiceImpl implements RealTargetService { in(StationEntity::getType, types); } }}); - // 设备信息 -// List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference>() { -// }); // 开始时间 Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); @@ -1381,8 +1456,6 @@ public class RealTargetServiceImpl implements RealTargetService { Map> powerMap = new HashMap<>(); stationList.forEach(station -> { // 站点设备集合 -// List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); -// log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices ); Map generateMap = this.getGenerateYearByWindEnergy(station,start,end); if(MapUtils.isEmpty(generateMap)){ return; @@ -1890,33 +1963,78 @@ public class RealTargetServiceImpl implements RealTargetService { return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); } + /** - * 近30天发电量 - * @param device + * 站点设备近30天发电量 + * @param stations * @return */ - private List getGenerationPowerList(EminfoAndEmParamVo device) { + private List thirtyGenerations(List stations) { Calendar calendar = Calendar.getInstance(); String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); calendar.add(Calendar.DAY_OF_MONTH,-29); - calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); - calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); - calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); - String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); - List records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); - if(CollectionUtil.isEmpty(records)){ - return new ArrayList<>(); - } - return records.stream().map(record -> { - GenerationPowerVo generate = new GenerationPowerVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); - generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); - if(StringUtil.isEmpty(record.getVal())){ - generate.setGenerate(0f); + String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE); + return thirtyGenerateService.list(Wrappers.lambdaQuery() + .in(ThirtyGenerationEntity::getStationId,stations) + .ge(ThirtyGenerationEntity::getStrDay,start) + .le(ThirtyGenerationEntity::getStrDay,end) + ); + } + + /** + * 站点设备今年发电量 + * @param stations + * @return + */ + private List threeGenerations(List stations) { + return threeGenerateService.list(Wrappers.lambdaQuery() + .in(ThreeGenerationEntity::getStationId,stations) + .like(ThreeGenerationEntity::getStrMonth,DateUtil.format(new Date(),"yyyy")) + ); + } + + /** + * 查询设备去年发电量 + * @param stations + * @return + */ + private List threeYesterGenerations(List stations) { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.YEAR,-1); + return threeGenerateService.list(Wrappers.lambdaQuery() + .in(ThreeGenerationEntity::getStationId,stations) + .like(ThreeGenerationEntity::getStrMonth,DateUtil.format(calendar.getTime(),"yyyy")) + ); + } + + + /** + * 设备近30天发电量组装 + * @param generations + * @param device + * @return + */ + private List getGenerationPowerList(List generations,EminfoAndEmParamVo device) { + Calendar calendar = Calendar.getInstance(); + Date end = calendar.getTime(); + calendar.add(Calendar.DAY_OF_MONTH,-29); + Date start = calendar.getTime(); + List powers = new ArrayList<>(); + while (end.compareTo(start) >= 0){ + GenerationPowerVo power = new GenerationPowerVo(); + if (CollectionUtil.isEmpty(generations)) { + power.setDate(DateUtil.format(start,DateUtil.PATTERN_DATE)); + power.setGenerate(0f); }else{ - generate.setGenerate(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()))); + String date = DateUtil.format(start,DateUtil.PATTERN_DATE); + power.setDate(date); + power.setGenerate((float) generations.stream().filter(iter->iter.getDeviceCode().equals(device.getEmCode()) && iter.getStrDay().contains(date)).mapToDouble(o->o.getGenerate().doubleValue()).sum()); } - return generate; - }).collect(Collectors.toList()); + calendar.add(Calendar.DAY_OF_MONTH,1); + powers.add(power); + start = calendar.getTime(); + } + return powers; } + } \ No newline at end of file From f6570f00b42690b6bccbd15660c530528e4bed7c Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 1 Aug 2024 10:57:56 +0800 Subject: [PATCH 02/19] =?UTF-8?q?#=E7=A5=81=E9=98=B3=E5=9B=A2=E7=BB=93?= =?UTF-8?q?=E5=8A=9F=E7=8E=87=E7=BB=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduled/service/operation/monitor/impl/MonitorServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index 279ef93..ed55ba7 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -361,7 +361,7 @@ public class MonitorServiceImpl implements MonitorService { device.setState(-1); return; } - if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ + if("0.000000".equals(powers.get(0).getValue()) || "0.000005".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ device.setState(-1); return; } From 39d1799b045720515c02cbf0a8cec808705c07d2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 7 Aug 2024 11:04:56 +0800 Subject: [PATCH 03/19] =?UTF-8?q?#=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java | 10 +++------- .../main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java | 9 ++------- .../java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java | 11 +++-------- .../main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java | 9 +++------ .../java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java | 9 +++------ 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java index 87acece..e52a759 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java @@ -29,16 +29,12 @@ public class DroolsMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("DroolsMqttConsumer监听到消息"+data.toString()); + log.error("DroolsMqttConsumer监听到消息"+data.toString()); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = droolsAlarmService.receiveMessage(s); + log.error("监听规则引擎有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("规则引擎告警数据处理报错(DroolsAlarm):"+e); - System.out.println("规则引擎告警数据处理报错(DroolsAlarm):"+e); - } + alarmSaveService.save(alarmEntities); } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java index 827825c..aa5f4ca 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java @@ -29,18 +29,13 @@ public class FdpMqttConsumer implements SubscribeCallBack { @Override public void onMessage(Map data) { String s = JSONObject.toJSONString(data); - log.info("监听Fdp消息 : {}" ,s); + log.error("FdpMqttConsumer监听到消息 : {}" ,s); //消费代码 List alarmEntities = fdpAlarmService.receiveMessage(s); if(CollectionUtil.isEmpty(alarmEntities)){ return; } log.error("监听Fdp有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); - //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - throw new ServiceException("集中监控告警数据处理报错(FdpAlarm):"+e); - } + alarmSaveService.save(alarmEntities); } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java index 82880ad..c891b9f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java @@ -29,18 +29,13 @@ public class HZ300MqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.error("HZ3000队列监听到消息 : {}",data); + log.error("HZ3000MqttConsumer监听到消息 : {}",data); //消费代码 List alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data)); if(CollectionUtil.isEmpty(alarmEntities)){ - log.error("HZ3000消息转换数据异常"); return; } - //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("HZ3000告警数据处理报错(HZ300Alarm):{}" , e.getMessage()); - } + log.error("监听HZ3000有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); + alarmSaveService.save(alarmEntities); } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java index 13fae87..2ecbe66 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java @@ -27,15 +27,12 @@ public class SoeMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("SoeMqttConsumer监听到消息"+data.toString()); + log.error("SoeMqttConsumer监听到消息"+data.toString()); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = soeAlarmService.receiveMessage(s); + log.error("监听设备实例有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("条件告警数据处理报错(SoeAlarm):"+e); - } + alarmSaveService.save(alarmEntities); } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java index 447db7b..eaa9ef6 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java @@ -26,15 +26,12 @@ public class VideoMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("VideoMqttConsumer队列监听到消息 : {}",data); + log.error("VideoMqttConsumer监听到消息 : {}",data); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = videoAlarmService.receiveMessage(s); + log.error("监听视频告警有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("HZ3000告警数据处理报错(HZ300Alarm):"+e); - } + alarmSaveService.save(alarmEntities); } } From 44b1e25b165ae474aa8cef94bb5ec6a6866f909f Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 8 Aug 2024 20:01:35 +0800 Subject: [PATCH 04/19] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/alarm/mqtt/MqttConfig.java | 4 ++-- .../source/service/impl/SoeAlarmServiceImpl.java | 19 +++++++++++-------- .../operation/monitor/impl/MonitorServiceImpl.java | 6 ++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java index 6a2c34e..2c78b7d 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java @@ -72,9 +72,9 @@ public class MqttConfig { MqttAsyncClient hz3000Client = hz3000SoeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), hz300MqttConsumer); log.info(hz3000Client.toString()+hz3000Client.getClientId()); //视频 - SoeSubscribe subscribe = new SoeSubscribe(); + /*SoeSubscribe subscribe = new SoeSubscribe(); MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig, Collections.singletonList("#"), videoMqttConsumer); - log.info(videoClient.toString()+videoClient.getClientId()); + log.info(videoClient.toString()+videoClient.getClientId());*/ }catch (MqttException e){ log.error(e.toString()) ; } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SoeAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SoeAlarmServiceImpl.java index cf05d3d..dfff6be 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SoeAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SoeAlarmServiceImpl.java @@ -3,27 +3,24 @@ package com.hnac.hzims.alarm.source.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.alarm.config.entity.AlarmEntity; -import com.hnac.hzims.alarm.config.vo.DroolsAlarmVo; import com.hnac.hzims.alarm.config.vo.SoeAlarmVo; import com.hnac.hzims.alarm.show.service.AlarmService; -import com.hnac.hzims.alarm.source.service.DroolsAlarmService; import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.source.service.SoeAlarmService; import com.hnac.hzims.common.constant.CommonConstant; -import com.hnac.hzims.common.utils.CommonUtil; import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.ZoneId; -import java.util.*; +import java.util.Collections; +import java.util.List; import java.util.stream.Collectors; import static com.hnac.hzims.alarm.config.constants.AlarmConstants.*; @@ -60,10 +57,9 @@ public class SoeAlarmServiceImpl implements SoeAlarmService { private AlarmEntity getAlarmEntity(SoeAlarmVo item) { AlarmEntity entity = new AlarmEntity(); - String format = DateUtil.format(item.getTs(), org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME_MINI); - entity.setAlarmId(format+"-"+item.getDeviceCode()); + String format = DateUtil.format(item.getTs(),DateUtil.PATTERN_DATETIME_MINI); + entity.setAlarmId(format); entity.setAlarmSource(LEVEL_ALARM); - entity.setAlarmType(ONE_LEVEL); entity.setAlarmContext(item.getName()); ZoneId zoneId = ZoneId.systemDefault(); LocalDateTime localDateTime = LocalDateTime.ofInstant(item.getTs().toInstant(), zoneId); @@ -71,6 +67,13 @@ public class SoeAlarmServiceImpl implements SoeAlarmService { entity.setAlarmValue(item.getCurrentValue()); entity.setAlarmSignage(item.getSignage()); entity.setAlarmLevel(Integer.valueOf(item.getLevel())); + if(entity.getAlarmLevel() == 0){ + entity.setAlarmType(ONE_LEVEL); + }else if (entity.getAlarmLevel() == 1){ + entity.setAlarmType(TWO_LEVEL); + }else { + entity.setAlarmType(THREE_LEVEL); + } entity.setAlarmStatus(1); entity.setDeviceCode(item.getDeviceCode()); entity.setTenantId(CommonConstant.TENANT_ID); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index ed55ba7..3fbfb56 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService { private final IAnalyseDataSearchClient analyseDataSearchClient; - private static final ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); + private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); @Value("${hzims.equipment.emInfo.emInfoList}") @@ -191,13 +191,12 @@ public class MonitorServiceImpl implements MonitorService { // 数据切割 int limit = countStep(stationRealVos.size()); List> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList()); - ExecutorService pool = Executors.newFixedThreadPool(limit); // Map valueMap = new ConcurrentHashMap<>(); // > Map> keyMap = new ConcurrentHashMap<>(); CountDownLatch countDownLatch = new CountDownLatch(limit); - pool.execute(()-> list.forEach(stations -> { + pool.execute(()-> list.forEach(stations -> { stations.forEach(stationReal -> { String[] realIdArr = stationReal.getRealId(); List realIds = Stream.of(realIdArr).collect(Collectors.toList()); @@ -230,7 +229,6 @@ public class MonitorServiceImpl implements MonitorService { e.printStackTrace(); Thread.currentThread().interrupt(); } - pool.shutdown(); // redis 存储 redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); From cf8f6896cac492a1e3edac176a69606a13bb5d39 Mon Sep 17 00:00:00 2001 From: Jone <515616805@qq.com> Date: Fri, 9 Aug 2024 16:32:52 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E5=88=A0=E9=99=A4iml=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blade-gateway/blade-gateway.iml | 293 ---------------- hzims-back.iml | 81 ----- hzims-biz-common/hzims-biz-common.iml | 287 ---------------- hzims-service-api/alarm-api/alarm-api.iml | 288 ---------------- hzims-service-api/assets-api/assets-api.iml | 321 ----------------- hzims-service-api/base-info-api/base-info-api.iml | 239 ------------- hzims-service-api/basic-api/basic-api.iml | 297 ---------------- hzims-service-api/common-api/common-api.iml | 300 ---------------- .../dam-safety-api/dam-safety-api.iml | 239 ------------- .../digital-twin-display-api.iml | 238 ------------- hzims-service-api/equipment-api/equipment-api.iml | 295 ---------------- .../hzims-operational-api.iml | 311 ----------------- hzims-service-api/hzims-service-api.iml | 276 --------------- hzims-service-api/inspect-api/inspect-api.iml | 18 - hzims-service-api/message-api/message-api.iml | 298 ---------------- .../safeproduct-api/safeproduct-api.iml | 8 - hzims-service-api/spare-api/spare-api.iml | 226 ------------ hzims-service-api/ticket-api/ticket-api.iml | 313 ----------------- hzims-service-api/topvision-api/topvision-api.iml | 287 ---------------- .../video-image-api/video-image-api.iml | 239 ------------- .../water-quality-api/water-quality-api.iml | 239 ------------- .../water-rain-api/water-rain-api.iml | 239 ------------- hzims-service/assets/assets.iml | 364 -------------------- hzims-service/equipment/hzims-equipment.iml | 369 -------------------- hzims-service/hzims-alarm/hzims-alarm.iml | 339 ------------------ hzims-service/hzims-basic/hzims-basic.iml | 341 ------------------ hzims-service/hzims-service.iml | 291 ---------------- hzims-service/inspect/hzinfo-inspect.iml | 18 - hzims-service/message/message.iml | 363 -------------------- hzims-service/operational/hzims-operational.iml | 363 -------------------- hzims-service/safeproduct/safeproduct.iml | 380 --------------------- hzims-service/ticket/hzims-ticket.iml | 368 -------------------- hzims-service/topvision/topvision.iml | 344 ------------------- 33 files changed, 8872 deletions(-) delete mode 100644 blade-gateway/blade-gateway.iml delete mode 100644 hzims-back.iml delete mode 100644 hzims-biz-common/hzims-biz-common.iml delete mode 100644 hzims-service-api/alarm-api/alarm-api.iml delete mode 100644 hzims-service-api/assets-api/assets-api.iml delete mode 100644 hzims-service-api/base-info-api/base-info-api.iml delete mode 100644 hzims-service-api/basic-api/basic-api.iml delete mode 100644 hzims-service-api/common-api/common-api.iml delete mode 100644 hzims-service-api/dam-safety-api/dam-safety-api.iml delete mode 100644 hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml delete mode 100644 hzims-service-api/equipment-api/equipment-api.iml delete mode 100644 hzims-service-api/hzims-operational-api/hzims-operational-api.iml delete mode 100644 hzims-service-api/hzims-service-api.iml delete mode 100644 hzims-service-api/inspect-api/inspect-api.iml delete mode 100644 hzims-service-api/message-api/message-api.iml delete mode 100644 hzims-service-api/safeproduct-api/safeproduct-api.iml delete mode 100644 hzims-service-api/spare-api/spare-api.iml delete mode 100644 hzims-service-api/ticket-api/ticket-api.iml delete mode 100644 hzims-service-api/topvision-api/topvision-api.iml delete mode 100644 hzims-service-api/video-image-api/video-image-api.iml delete mode 100644 hzims-service-api/water-quality-api/water-quality-api.iml delete mode 100644 hzims-service-api/water-rain-api/water-rain-api.iml delete mode 100644 hzims-service/assets/assets.iml delete mode 100644 hzims-service/equipment/hzims-equipment.iml delete mode 100644 hzims-service/hzims-alarm/hzims-alarm.iml delete mode 100644 hzims-service/hzims-basic/hzims-basic.iml delete mode 100644 hzims-service/hzims-service.iml delete mode 100644 hzims-service/inspect/hzinfo-inspect.iml delete mode 100644 hzims-service/message/message.iml delete mode 100644 hzims-service/operational/hzims-operational.iml delete mode 100644 hzims-service/safeproduct/safeproduct.iml delete mode 100644 hzims-service/ticket/hzims-ticket.iml delete mode 100644 hzims-service/topvision/topvision.iml diff --git a/blade-gateway/blade-gateway.iml b/blade-gateway/blade-gateway.iml deleted file mode 100644 index 66b262b..0000000 --- a/blade-gateway/blade-gateway.iml +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-back.iml b/hzims-back.iml deleted file mode 100644 index 219078a..0000000 --- a/hzims-back.iml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-biz-common/hzims-biz-common.iml b/hzims-biz-common/hzims-biz-common.iml deleted file mode 100644 index 2a5f11b..0000000 --- a/hzims-biz-common/hzims-biz-common.iml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/alarm-api/alarm-api.iml b/hzims-service-api/alarm-api/alarm-api.iml deleted file mode 100644 index c167c30..0000000 --- a/hzims-service-api/alarm-api/alarm-api.iml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/assets-api/assets-api.iml b/hzims-service-api/assets-api/assets-api.iml deleted file mode 100644 index ea3ac1c..0000000 --- a/hzims-service-api/assets-api/assets-api.iml +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/base-info-api/base-info-api.iml b/hzims-service-api/base-info-api/base-info-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/base-info-api/base-info-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/basic-api/basic-api.iml b/hzims-service-api/basic-api/basic-api.iml deleted file mode 100644 index cdcc109..0000000 --- a/hzims-service-api/basic-api/basic-api.iml +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/common-api/common-api.iml b/hzims-service-api/common-api/common-api.iml deleted file mode 100644 index 1990bc3..0000000 --- a/hzims-service-api/common-api/common-api.iml +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/dam-safety-api/dam-safety-api.iml b/hzims-service-api/dam-safety-api/dam-safety-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/dam-safety-api/dam-safety-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml b/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml deleted file mode 100644 index 277c4cb..0000000 --- a/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/equipment-api/equipment-api.iml b/hzims-service-api/equipment-api/equipment-api.iml deleted file mode 100644 index ba71ce8..0000000 --- a/hzims-service-api/equipment-api/equipment-api.iml +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/hzims-operational-api.iml b/hzims-service-api/hzims-operational-api/hzims-operational-api.iml deleted file mode 100644 index e4b498c..0000000 --- a/hzims-service-api/hzims-operational-api/hzims-operational-api.iml +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/hzims-service-api.iml b/hzims-service-api/hzims-service-api.iml deleted file mode 100644 index 0fc3a82..0000000 --- a/hzims-service-api/hzims-service-api.iml +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/inspect-api/inspect-api.iml b/hzims-service-api/inspect-api/inspect-api.iml deleted file mode 100644 index 40defed..0000000 --- a/hzims-service-api/inspect-api/inspect-api.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/message-api/message-api.iml b/hzims-service-api/message-api/message-api.iml deleted file mode 100644 index 37d66d3..0000000 --- a/hzims-service-api/message-api/message-api.iml +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/safeproduct-api.iml b/hzims-service-api/safeproduct-api/safeproduct-api.iml deleted file mode 100644 index 1daccae..0000000 --- a/hzims-service-api/safeproduct-api/safeproduct-api.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/spare-api/spare-api.iml b/hzims-service-api/spare-api/spare-api.iml deleted file mode 100644 index 660192e..0000000 --- a/hzims-service-api/spare-api/spare-api.iml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/ticket-api/ticket-api.iml b/hzims-service-api/ticket-api/ticket-api.iml deleted file mode 100644 index 02fe1c6..0000000 --- a/hzims-service-api/ticket-api/ticket-api.iml +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/topvision-api/topvision-api.iml b/hzims-service-api/topvision-api/topvision-api.iml deleted file mode 100644 index 4e0e3d6..0000000 --- a/hzims-service-api/topvision-api/topvision-api.iml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/video-image-api/video-image-api.iml b/hzims-service-api/video-image-api/video-image-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/video-image-api/video-image-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/water-quality-api/water-quality-api.iml b/hzims-service-api/water-quality-api/water-quality-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/water-quality-api/water-quality-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/water-rain-api/water-rain-api.iml b/hzims-service-api/water-rain-api/water-rain-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/water-rain-api/water-rain-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/assets/assets.iml b/hzims-service/assets/assets.iml deleted file mode 100644 index ce48480..0000000 --- a/hzims-service/assets/assets.iml +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/equipment/hzims-equipment.iml b/hzims-service/equipment/hzims-equipment.iml deleted file mode 100644 index f654d02..0000000 --- a/hzims-service/equipment/hzims-equipment.iml +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-alarm/hzims-alarm.iml b/hzims-service/hzims-alarm/hzims-alarm.iml deleted file mode 100644 index bdc9342..0000000 --- a/hzims-service/hzims-alarm/hzims-alarm.iml +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-basic/hzims-basic.iml b/hzims-service/hzims-basic/hzims-basic.iml deleted file mode 100644 index e3753b5..0000000 --- a/hzims-service/hzims-basic/hzims-basic.iml +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-service.iml b/hzims-service/hzims-service.iml deleted file mode 100644 index 06a88a4..0000000 --- a/hzims-service/hzims-service.iml +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/inspect/hzinfo-inspect.iml b/hzims-service/inspect/hzinfo-inspect.iml deleted file mode 100644 index 40defed..0000000 --- a/hzims-service/inspect/hzinfo-inspect.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/message/message.iml b/hzims-service/message/message.iml deleted file mode 100644 index 4ad42fe..0000000 --- a/hzims-service/message/message.iml +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/operational/hzims-operational.iml b/hzims-service/operational/hzims-operational.iml deleted file mode 100644 index dd41660..0000000 --- a/hzims-service/operational/hzims-operational.iml +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/safeproduct/safeproduct.iml b/hzims-service/safeproduct/safeproduct.iml deleted file mode 100644 index 0abed5b..0000000 --- a/hzims-service/safeproduct/safeproduct.iml +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/ticket/hzims-ticket.iml b/hzims-service/ticket/hzims-ticket.iml deleted file mode 100644 index fd84d02..0000000 --- a/hzims-service/ticket/hzims-ticket.iml +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/topvision/topvision.iml b/hzims-service/topvision/topvision.iml deleted file mode 100644 index 2371ba1..0000000 --- a/hzims-service/topvision/topvision.iml +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From e71ee9a69f072d1ea5773190bdc3aca819d07090 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 12 Aug 2024 08:37:06 +0800 Subject: [PATCH 06/19] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/monitor/impl/MonitorServiceImpl.java | 54 +++++++++++++--------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index 3fbfb56..bb23b2d 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService { private final IAnalyseDataSearchClient analyseDataSearchClient; - private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); + private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 60L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); @Value("${hzims.equipment.emInfo.emInfoList}") @@ -196,7 +196,7 @@ public class MonitorServiceImpl implements MonitorService { // > Map> keyMap = new ConcurrentHashMap<>(); CountDownLatch countDownLatch = new CountDownLatch(limit); - pool.execute(()-> list.forEach(stations -> { + pool.execute(()-> list.forEach(stations -> { stations.forEach(stationReal -> { String[] realIdArr = stationReal.getRealId(); List realIds = Stream.of(realIdArr).collect(Collectors.toList()); @@ -222,9 +222,12 @@ public class MonitorServiceImpl implements MonitorService { }); countDownLatch.countDown(); })); - // 等待所有线程执行完成 try { - countDownLatch.await(); + // 等待所有线程执行完成(至多等待三秒,超过三秒任务认为线程发生阻塞) + boolean flag = countDownLatch.await(3,TimeUnit.SECONDS); + if(!flag){ + log.error("实时数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + } } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); @@ -299,27 +302,36 @@ public class MonitorServiceImpl implements MonitorService { for(Map> item : limit){ // 提交线程任务 pool.submit(()->{ - item.forEach((key,value)->{ - RealStationVo realStation = new RealStationVo(); - // 设备信息 - List devices = this.monitorRealDevice(value,realTimeData); - // 设备状态 - this.deviceStatus(devices,deviceClassifyMap); - realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); - // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 - this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); - // 站点总功率计算 - this.stationActivePower(devices,realStation); - // 站点铃铛、数据中断状态 - this.stationStatus(aborts,bells,realStation); - realStations.add(realStation); - }); - countDownLatch.countDown(); + try{ + item.forEach((key,value)->{ + RealStationVo realStation = new RealStationVo(); + // 设备信息 + List devices = this.monitorRealDevice(value,realTimeData); + // 设备状态 + this.deviceStatus(devices,deviceClassifyMap); + realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); + // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 + this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); + // 站点总功率计算 + this.stationActivePower(devices,realStation); + // 站点铃铛、数据中断状态 + this.stationStatus(aborts,bells,realStation); + realStations.add(realStation); + }); + countDownLatch.countDown(); + }catch (Exception e){ + countDownLatch.countDown(); + Thread.currentThread().interrupt(); + } }); } // 等待所有线程执行完成 try { - countDownLatch.await(); + // 等待所有线程执行完成(至多等待二秒,超过二秒任务认为线程发生阻塞) + boolean flag = countDownLatch.await(2,TimeUnit.SECONDS); + if(!flag){ + log.error("集中监控数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + } } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); From 02dd1fece2b823cb353da21f1eb90d79bf226ae1 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 12 Aug 2024 15:56:27 +0800 Subject: [PATCH 07/19] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BB=BB=E5=8A=A1=E8=BF=90=E8=A1=8C=E5=A0=B5?= =?UTF-8?q?=E5=A1=9E=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/common/constant/CommonConstant.java | 1 + .../operation/monitor/impl/MonitorServiceImpl.java | 31 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/constant/CommonConstant.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/constant/CommonConstant.java index 71e02f3..16e5c92 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/constant/CommonConstant.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/constant/CommonConstant.java @@ -59,4 +59,5 @@ public interface CommonConstant { */ Long SYSTEM_USER = 1434782836098891778L; + Long SYSTEM_DEPT_ID = 20000001L; } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index bb23b2d..b7a2a03 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -6,11 +6,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.hnac.hzims.common.constant.CommonConstant; import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; +import com.hnac.hzims.message.dto.MailPushDto; +import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.operational.config.enume.ConfigStatus; import com.hnac.hzims.operational.config.vo.StationRealVo; import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; import com.hnac.hzims.operational.main.vo.RealAttributeVo; import com.hnac.hzims.operational.main.vo.RealDeviceVo; import com.hnac.hzims.operational.main.vo.RealStationVo; @@ -35,6 +39,7 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.entity.User; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -76,6 +81,8 @@ public class MonitorServiceImpl implements MonitorService { private final RedisClient redisClient; + private final IPushMsgClient pushMsgClient; + private final IAnalyseDataSearchClient analyseDataSearchClient; private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 60L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); @@ -227,6 +234,8 @@ public class MonitorServiceImpl implements MonitorService { boolean flag = countDownLatch.await(3,TimeUnit.SECONDS); if(!flag){ log.error("实时数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + // 发生邮件 + this.sendMonthReport("实时数据运行堵塞"); } } catch (InterruptedException e) { e.printStackTrace(); @@ -331,6 +340,8 @@ public class MonitorServiceImpl implements MonitorService { boolean flag = countDownLatch.await(2,TimeUnit.SECONDS); if(!flag){ log.error("集中监控数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + // 发生邮件 + this.sendMonthReport("集中监控数据运行堵塞"); } } catch (InterruptedException e) { e.printStackTrace(); @@ -748,4 +759,24 @@ public class MonitorServiceImpl implements MonitorService { } return result; } + + /** + * 推送当月月报 + */ + private void sendMonthReport(String text) { + // 发送邮件 + MailPushDto pushDto = new MailPushDto(); + pushDto.setBusinessClassify("system"); + pushDto.setBusinessKey("Run_Blocking"); + pushDto.setSubject(text); + pushDto.setText(text); + pushDto.setToAccount(Collections.singletonList("1069818635@qq.com").toArray(new String[0])); + pushDto.setHtml(false); + pushDto.setCreateUser(CommonConstant.SYSTEM_USER); + pushDto.setTenantId(CommonConstant.TENANT_ID); + pushDto.setCreateDept(CommonConstant.SYSTEM_DEPT_ID); + pushDto.setMailType(0); + pushDto.setFromAccount("huangxing951023@163.com"); + pushMsgClient.sendMail(pushDto); + } } \ No newline at end of file From d3a9d08b94eaf49ac973ad149c17c32fd1d4164f Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 12 Aug 2024 17:07:38 +0800 Subject: [PATCH 08/19] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BB=BB=E5=8A=A1=E8=BF=90=E8=A1=8C=E5=A0=B5?= =?UTF-8?q?=E5=A1=9E=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/monitor/impl/MonitorServiceImpl.java | 62 +++++++++++----------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index b7a2a03..6a39591 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -85,8 +85,9 @@ public class MonitorServiceImpl implements MonitorService { private final IAnalyseDataSearchClient analyseDataSearchClient; - private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 60L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); + private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 2L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); + private static boolean isSendMail = true; @Value("${hzims.equipment.emInfo.emInfoList}") public String device_cache_final; @@ -232,18 +233,19 @@ public class MonitorServiceImpl implements MonitorService { try { // 等待所有线程执行完成(至多等待三秒,超过三秒任务认为线程发生阻塞) boolean flag = countDownLatch.await(3,TimeUnit.SECONDS); - if(!flag){ + if(!flag && isSendMail){ log.error("实时数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + isSendMail = false; // 发生邮件 this.sendMonthReport("实时数据运行堵塞"); + }else if(flag){ + // redis 存储 + redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); + redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); } } catch (InterruptedException e) { - e.printStackTrace(); Thread.currentThread().interrupt(); } - // redis 存储 - redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); - redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); } /** @@ -310,44 +312,40 @@ public class MonitorServiceImpl implements MonitorService { // 切割数据遍历 for(Map> item : limit){ // 提交线程任务 - pool.submit(()->{ - try{ - item.forEach((key,value)->{ - RealStationVo realStation = new RealStationVo(); - // 设备信息 - List devices = this.monitorRealDevice(value,realTimeData); - // 设备状态 - this.deviceStatus(devices,deviceClassifyMap); - realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); - // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 - this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); - // 站点总功率计算 - this.stationActivePower(devices,realStation); - // 站点铃铛、数据中断状态 - this.stationStatus(aborts,bells,realStation); - realStations.add(realStation); - }); - countDownLatch.countDown(); - }catch (Exception e){ - countDownLatch.countDown(); - Thread.currentThread().interrupt(); - } + pool.execute(()->{ + item.forEach((key,value)->{ + RealStationVo realStation = new RealStationVo(); + // 设备信息 + List devices = this.monitorRealDevice(value,realTimeData); + // 设备状态 + this.deviceStatus(devices,deviceClassifyMap); + realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); + // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 + this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); + // 站点总功率计算 + this.stationActivePower(devices,realStation); + // 站点铃铛、数据中断状态 + this.stationStatus(aborts,bells,realStation); + realStations.add(realStation); + }); + countDownLatch.countDown(); }); } // 等待所有线程执行完成 try { // 等待所有线程执行完成(至多等待二秒,超过二秒任务认为线程发生阻塞) - boolean flag = countDownLatch.await(2,TimeUnit.SECONDS); - if(!flag){ + boolean flag = countDownLatch.await(3,TimeUnit.SECONDS); + if(!flag && isSendMail){ log.error("集中监控数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + isSendMail = false; // 发生邮件 this.sendMonthReport("集中监控数据运行堵塞"); + }else if(flag){ + redisTemplate.opsForValue().set(moniter_station_cache_final, realStations); } } catch (InterruptedException e) { - e.printStackTrace(); Thread.currentThread().interrupt(); } - redisTemplate.opsForValue().set(moniter_station_cache_final, realStations); } /** From dbd5fb04ddc94084a9882406a732e1a6aaee0753 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 13 Aug 2024 09:08:00 +0800 Subject: [PATCH 09/19] =?UTF-8?q?fix:=20=E5=9F=B9=E8=AE=AD=E5=B9=B4?= =?UTF-8?q?=E5=BA=A6=E7=BB=9F=E8=AE=A1=E7=AB=99=E7=82=B9=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/safeproduct/service/impl/TrainPlanServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java index 40fb225..9987b46 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java @@ -20,6 +20,7 @@ import com.hnac.hzims.safeproduct.service.ITrainPlanService; import com.hnac.hzims.safeproduct.service.ITrainRecordService; import com.hnac.hzims.safeproduct.vo.TrainMonthVO; import com.hnac.hzims.safeproduct.vo.TrainYearVO; +import org.apache.commons.collections4.map.HashedMap; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.utils.DateUtil; @@ -34,10 +35,7 @@ import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; /** @@ -105,7 +103,7 @@ public class TrainPlanServiceImpl extends ServiceImpl unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year); // 将各单位每个月的培训计划数据写入统计列表 - List res = new ArrayList<>(); + HashedMap map = new HashedMap<>(); unitMonthDataList.forEach(data -> { TrainYearVO trainYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit())) .collect(Collectors.toList()).get(0); @@ -161,9 +159,11 @@ public class TrainPlanServiceImpl extends ServiceImpl list = new ArrayList<>(map.values()); + List res = list.stream().sorted(Comparator.comparing(TrainYearVO::getUnit)).collect(Collectors.toList()); unitPage.setRecords(res); return unitPage; } From c1cfd0c0ac80517460e2f0c5b0624a8a1604061e Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 13 Aug 2024 15:37:58 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E4=BA=A4?= =?UTF-8?q?=E6=8E=A5=E7=8F=AD=E5=B7=A1=E6=A3=80=E5=BC=80=E5=A7=8B=E5=92=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=89=8D30=E5=88=86=E9=92=9F=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/duty/constant/DutyRecProcessConstant.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/constant/DutyRecProcessConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/constant/DutyRecProcessConstant.java index c9576da..ab1e3e5 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/constant/DutyRecProcessConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/constant/DutyRecProcessConstant.java @@ -40,8 +40,8 @@ public interface DutyRecProcessConstant { String INSPECT_PANL_AUTO_VIDEO = "0";//普通巡检 String INSPECT_PANL_AUTO_CYCLE = "0";//计划周期 int INSPECT_PANL_TASK_TIMES_A_DAY = 1;//一天任务次数 - int INSPECT_PANL_START_REMIND = 1;//开始前提醒(分钟) - int INSPECT_PANL_END_REMIND = 1;//结束前提醒(分钟) + int INSPECT_PANL_START_REMIND = 30;//开始前提醒(分钟) + int INSPECT_PANL_END_REMIND = 30;//结束前提醒(分钟) /** From a5bc7b52e55b33540f4aea0f4917ddab3591640e Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 13 Aug 2024 20:11:26 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=9C=88=E6=8A=A5=E4=B8=A4=E7=A5=A8=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java | 2 +- .../standardTicket/service/impl/StandardTicketInfoServiceImpl.java | 5 ++++- .../ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java index 0101bfa..caab640 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java @@ -74,7 +74,7 @@ public class TicketInfoAllClient implements ITicketInfoAllClient { int completeNum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoCompleteNum).sum(); int invalidatedNum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoInvalidatedNum).sum(); int qualifiedNum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum(); - Double proportion = new BigDecimal(qualifiedNum).divide(new BigDecimal(sum),2, RoundingMode.UP) + Double proportion = new BigDecimal(qualifiedNum).divide(new BigDecimal(sum),4, RoundingMode.UP) .multiply(new BigDecimal(100)).setScale(2, RoundingMode.UP).doubleValue(); ticketInfoStatisticVO.setTicketInfoNumber(sum); ticketInfoStatisticVO.setTicketInfoCompleteNum(completeNum); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index 6094606..96c1e08 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -705,7 +705,10 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl "作废".equals(item.getFlowTaskName())).collect(Collectors.toList()).size(); //计算合格率 - double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue(); + Double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum) + .divide(new BigDecimal(typeOperateTicket.getValue().size()),4, RoundingMode.HALF_UP) + .multiply(new BigDecimal(100)) + .setScale(2, RoundingMode.HALF_UP).doubleValue(); TicketInfoStatisticVO ticketInfoStatisticVO = TicketInfoStatisticVO.builder().ticketInfoType(type) .ticketInfoNumber(typeOperateTicket.getValue().size()) .ticketInfoCompleteNum(ticketInfoCompleteNum) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java index c5ac658..5080435 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java @@ -1149,7 +1149,9 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl Func.isNotEmpty(ticket.getEvaluation()) && ticket.getEvaluation().intValue() == 1) .collect(Collectors.toList()).size(); //计算合格率 - Double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) workTicketReportStatistic.size() *100) + Double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum) + .divide(new BigDecimal(typeWorkTicket.getValue().size()),4, RoundingMode.HALF_UP) + .multiply(new BigDecimal(100)) .setScale(2, RoundingMode.HALF_UP).doubleValue(); TicketInfoStatisticVO workTicketStatistic = TicketInfoStatisticVO.builder() .ticketInfoType(ticketInfoType) From 6b961b8719411e24c03434f6e6283905fcd172a9 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 15 Aug 2024 08:35:49 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9Ablade-system?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 90876d9..ebd1e6b 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ org.springblade blade-system-api - 5.1.1.RELEASE.fix.4 + 5.1.1.RELEASE.fix.5 org.springblade From edc2249686062c147f7feec1de89a8e9b6f164f0 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 20 Aug 2024 13:55:10 +0800 Subject: [PATCH 13/19] =?UTF-8?q?#=E6=88=AA=E5=8F=96=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 20c2f8a..5959f86 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -100,6 +100,9 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { alarm.setCreateDept(optional.get().getCreateDept()); alarm.setStationName(optional.get().getName()); alarm.setTenantId(optional.get().getTenantId()); + if(StringUtil.isNotBlank(alarm.getAlarmValue()) && alarm.getAlarmValue().length() > 2048){ + alarm.setAlarmValue(alarm.getAlarmValue().substring(0,2048)); + } alarm.setStatus(0); // 步骤4.根据站点查询配置标识 AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType()); From 9ea4f65782dc4a3cc52d700950b8d77df7f4b6c9 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 23 Aug 2024 14:48:46 +0800 Subject: [PATCH 14/19] =?UTF-8?q?#=E5=B9=B3=E5=8F=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=94=B9=E9=80=A0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/impl/ObtainGenerationServiceImpl.java | 21 ++++++- .../operation/home/impl/RealTargetServiceImpl.java | 64 +++++++++++++++++++--- .../operation/report/impl/ReportServiceImpl.java | 7 ++- .../data/service/impl/HzimsDataServiceImpl.java | 7 ++- 4 files changed, 85 insertions(+), 14 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java index 0259de2..e791794 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java @@ -165,7 +165,12 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { generate.setCreateDept(station.getRefDept()); generate.setCreateUser(station.getCreateUser()); generate.setUpdateUser(station.getUpdateUser()); - Date time = DateUtil.parse(records.get(0).getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(records.get(0).getTs().contains(".0")){ + time = DateUtil.parse(records.get(0).getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(records.get(0).getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); generate.setDay(time.getDate()); if(StringUtil.isEmpty(records.get(0).getVal())){ @@ -293,7 +298,12 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { generate.setCreateDept(station.getRefDept()); generate.setCreateUser(station.getCreateUser()); generate.setUpdateUser(station.getUpdateUser()); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); generate.setDay(time.getDate()); if(StringUtil.isEmpty(record.getVal())){ @@ -364,7 +374,12 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { generate.setCreateDept(station.getRefDept()); generate.setCreateUser(station.getCreateUser()); generate.setUpdateUser(station.getUpdateUser()); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setMonth(time.getMonth() + 1); if(StringUtil.isEmpty(record.getVal())){ 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 527d67a..81bdc75 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 @@ -633,6 +633,8 @@ public class RealTargetServiceImpl implements RealTargetService { 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()); @@ -934,7 +936,12 @@ public class RealTargetServiceImpl implements RealTargetService { } return datas.stream().map(data->{ ActivePowerVo active = new ActivePowerVo(); - Date dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date dateTime; + if(data.getTs().contains(".0")){ + dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + dateTime = DateUtil.parse(data.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } active.setHour(dateTime.getHours()); if (StringUtil.isBlank(data.getVal())) { active.setActivePower("0"); @@ -961,7 +968,12 @@ public class RealTargetServiceImpl implements RealTargetService { } return records.stream().map(record -> { UsrPowerVo usr = new UsrPowerVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); return usr; @@ -991,7 +1003,12 @@ public class RealTargetServiceImpl implements RealTargetService { } return records.stream().map(record -> { PowerMonthVo generate = new PowerMonthVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); if(StringUtil.isEmpty(record.getVal())){ generate.setPower(0f); @@ -1232,7 +1249,11 @@ public class RealTargetServiceImpl implements RealTargetService { } return datas.stream().collect(Collectors.toMap( key-> { - Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + if(key.getTs().contains(".0")){ + Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + return dateTime.getHours(); + } + Date dateTime = DateUtil.parse(key.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); return dateTime.getHours(); }, value -> { @@ -1404,7 +1425,12 @@ public class RealTargetServiceImpl implements RealTargetService { } datas.addAll(records.stream().map(record -> { PowerMonthVo generate = new PowerMonthVo(); - Date time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.get("ts").contains(".0")){ + time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.get("ts") + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER); if(StringUtil.isEmpty(val)){ @@ -1480,7 +1506,12 @@ public class RealTargetServiceImpl implements RealTargetService { } return records.stream().map(record -> { ActivePowerVo load = new ActivePowerVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); load.setHour(time.getHours()); if(StringUtil.isNotBlank(record.getVal())){ @@ -1508,7 +1539,12 @@ public class RealTargetServiceImpl implements RealTargetService { } datas.addAll(records.stream().map(record -> { PowerMonthVo generate = new PowerMonthVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); if(StringUtil.isEmpty(record.getVal())){ generate.setPower(0f); @@ -1751,7 +1787,12 @@ public class RealTargetServiceImpl implements RealTargetService { } return records.stream().map(record -> { PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(records.get(0).getTs().contains(".0")){ + time = DateUtil.parse(records.get(0).getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(records.get(0).getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } load.setHour(time.getHours()); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); return load; @@ -1778,7 +1819,12 @@ public class RealTargetServiceImpl implements RealTargetService { } return records.stream().map(record -> { GenerationPowerVo generate = new GenerationPowerVo(); - Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE)); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); return generate; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index 843473d..a6bca20 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -993,7 +993,12 @@ public class ReportServiceImpl implements ReportService { } analyseDatas.addAll(data.getList().stream().peek(item->{ item.setSignage(data.getSignage()); - Date date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date date; + if(item.getTs().contains(".0")){ + date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + date = DateUtil.parse(item.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } day.setTime(date); item.setTs(String.valueOf(day.get(Calendar.DAY_OF_MONTH))); }).collect(Collectors.toList())); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index 59b40ab..86f9972 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java @@ -456,7 +456,12 @@ public class HzimsDataServiceImpl implements HzimsDataService { } datas.forEach(data->{ ConverElectricityVo electricity = new ConverElectricityVo(); - Date date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + Date date; + if(data.getTs().contains(".0")){ + date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss"); + } electricity.setTime(DateUtil.format(date,DateUtil.PATTERN_DATE)); if(StringUtil.isEmpty(data.getVal())){ electricity.setElectricity(0.0); From 4a1ac3f8e560fb7dedbe216f57a78945655b26c7 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 28 Aug 2024 14:53:21 +0800 Subject: [PATCH 15/19] =?UTF-8?q?#=E7=94=B5=E9=87=8F=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java | 3 +++ .../com/hnac/hzims/operational/main/constant/HomePageConstant.java | 1 + .../service/operation/home/impl/ObtainGenerationServiceImpl.java | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java index 276d3f7..5498e9d 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java @@ -40,4 +40,7 @@ public class ThreeGenerationEntity extends TenantEntity { @ApiModelProperty(value = "发电量") private BigDecimal generate; + + @ApiModelProperty(value = "无功电量") + private BigDecimal reactiveGenerate; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index 4337c56..accbd76 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java @@ -173,6 +173,7 @@ public interface HomePageConstant { // 水电站实时属性名称 String HYDROPOWER_GENERATE_POWER = "generation_capacity"; // 发电量 + String HYDROPOWER_REACTIVE_GENERATE = "reactive_generate"; // 无功电量 String HYDROPOWER_ACTIVE_POWER = "active_power"; // 有功功率 String HYDROPOWER_REACTIVE_POWER = "reactive_power"; // 有功功率 String HYDROPOWER_POWERFACTOR = "index_jz_cos"; // 功率因数 diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java index e791794..ff44095 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java @@ -363,6 +363,7 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { if(CollectionUtil.isEmpty(records)){ return; } + List reactives = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_REACTIVE_GENERATE); // 保存设备发电量 threeGenerateService.saveBatch(records.stream().map(record -> { ThreeGenerationEntity generate = new ThreeGenerationEntity(); @@ -387,6 +388,11 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { }else{ generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())); } + // 无功电量 + if(CollectionUtil.isEmpty(reactives)){ + generate.setReactiveGenerate(BigDecimal.ZERO); + } + return generate; }).collect(Collectors.toList())); }); From ddbc0860e75525cf51dd65a96316ea8d2084abf1 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Aug 2024 11:43:08 +0800 Subject: [PATCH 16/19] =?UTF-8?q?#=E6=97=A0=E5=8A=9F=E7=94=B5=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/entity/ThirtyGenerationEntity.java | 3 + .../scheduled/GenerationScheduledTask.java | 2 + .../home/impl/ObtainGenerationServiceImpl.java | 154 ++++++++++++++------- 3 files changed, 107 insertions(+), 52 deletions(-) diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThirtyGenerationEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThirtyGenerationEntity.java index 7e38d5d..a5be934 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThirtyGenerationEntity.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThirtyGenerationEntity.java @@ -40,4 +40,7 @@ public class ThirtyGenerationEntity extends TenantEntity { @ApiModelProperty(value = "发电量") private BigDecimal generate; + + @ApiModelProperty(value = "无功电量") + private BigDecimal reactiveGenerate; } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java index b574b22..80be76b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java @@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Arrays; @@ -33,6 +34,7 @@ public class GenerationScheduledTask { * @return */ @XxlJob(THREE_YEAR_POWER_GENERATION) + //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT threeYearPowerGeneration(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/ObtainGenerationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java index ff44095..f304eaf 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java @@ -146,13 +146,24 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { if(CollectionUtil.isEmpty(records)){ return; } + List reactives = dataService.periodTargetData(start,end,5,3,device.getEmCode(),HomePageConstant.HYDROPOWER_REACTIVE_GENERATE); // 是否包含今日累计发电量数据 Optional optional = generations.stream().filter(o->o.getStationId().equals(station.getCode()) && o.getDeviceCode().equals(device.getEmCode())).findFirst(); if(optional.isPresent()){ if(StringUtil.isEmpty(records.get(0).getVal())){ optional.get().setGenerate(BigDecimal.ZERO); }else{ - optional.get().setGenerate(BigDecimal.valueOf(Double.parseDouble(records.get(0).getVal()) * device.getRideCount())); + optional.get().setGenerate(BigDecimal.valueOf(Double.parseDouble(records.get(0).getVal()) * device.getRideCount()).setScale(2, RoundingMode.HALF_UP)); + } + // 无功电量 + if(CollectionUtil.isEmpty(reactives)){ + optional.get().setReactiveGenerate(BigDecimal.ZERO); + }else{ + if(StringUtil.isEmpty(reactives.get(0).getVal())){ + optional.get().setReactiveGenerate(BigDecimal.ZERO); + }else{ + optional.get().setReactiveGenerate(BigDecimal.valueOf(Double.parseDouble(reactives.get(0).getVal()))); + } } saves.add(optional.get()); }else{ @@ -178,6 +189,16 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { }else{ generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(records.get(0).getVal()) * device.getRideCount())); } + // 无功电量 + if(CollectionUtil.isEmpty(reactives)){ + generate.setReactiveGenerate(BigDecimal.ZERO); + }else{ + if(StringUtil.isEmpty(reactives.get(0).getVal())){ + generate.setReactiveGenerate(BigDecimal.ZERO); + }else{ + generate.setReactiveGenerate(BigDecimal.valueOf(Double.parseDouble(reactives.get(0).getVal()))); + } + } saves.add(generate); } }); @@ -287,6 +308,7 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { if(CollectionUtil.isEmpty(records)){ return; } + List reactives = dataService.periodTargetData(start,end,5,3,device.getEmCode(),HomePageConstant.HYDROPOWER_REACTIVE_GENERATE); // 保存设备发电量 thirtyGenerateService.saveBatch(records.stream().map(record -> { ThirtyGenerationEntity generate = new ThirtyGenerationEntity(); @@ -309,7 +331,22 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { if(StringUtil.isEmpty(record.getVal())){ generate.setGenerate(BigDecimal.ZERO); }else{ - generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())); + generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()).setScale(2, RoundingMode.HALF_UP)); + } + // 无功电量 + if(CollectionUtil.isEmpty(reactives)){ + generate.setReactiveGenerate(BigDecimal.ZERO); + }else{ + Optional optional = reactives.stream().filter(reactive-> record.getTs().equals(reactive.getTs())).findFirst(); + if(optional.isPresent()){ + if(StringUtil.isEmpty(optional.get().getVal())){ + generate.setReactiveGenerate(BigDecimal.ZERO); + }else{ + generate.setReactiveGenerate(BigDecimal.valueOf(Double.parseDouble(optional.get().getVal()))); + } + }else{ + generate.setReactiveGenerate(BigDecimal.ZERO); + } } return generate; }).collect(Collectors.toList())); @@ -352,60 +389,70 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { List> 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()); for(List item : limits){ - try{ pool.submit(()->{ - item.forEach(station->{ - // 站点设备集合 - List eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); - // 遍历查询发电量 - eminfos.forEach(device->{ - List records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); - if(CollectionUtil.isEmpty(records)){ - return; - } - List reactives = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_REACTIVE_GENERATE); - // 保存设备发电量 - threeGenerateService.saveBatch(records.stream().map(record -> { - ThreeGenerationEntity generate = new ThreeGenerationEntity(); - generate.setStationId(station.getCode()); - generate.setStationName(station.getName()); - generate.setDeviceCode(device.getEmCode()); - generate.setDeviceName(device.getName()); - generate.setTenantId(station.getTenantId()); - generate.setCreateDept(station.getRefDept()); - generate.setCreateUser(station.getCreateUser()); - generate.setUpdateUser(station.getUpdateUser()); - Date time; - if(record.getTs().contains(".0")){ - time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); - }else{ - time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); - } - generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); - generate.setMonth(time.getMonth() + 1); - if(StringUtil.isEmpty(record.getVal())){ - generate.setGenerate(BigDecimal.ZERO); - }else{ - generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())); - } - // 无功电量 - if(CollectionUtil.isEmpty(reactives)){ - generate.setReactiveGenerate(BigDecimal.ZERO); + try{ + item.forEach(station->{ + // 站点设备集合 + List eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); + // 遍历查询发电量 + eminfos.forEach(device->{ + List records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); + if(CollectionUtil.isEmpty(records)){ + return; } - - return generate; - }).collect(Collectors.toList())); + List reactives = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_REACTIVE_GENERATE); + // 保存设备发电量 + threeGenerateService.saveBatch(records.stream().map(record -> { + ThreeGenerationEntity generate = new ThreeGenerationEntity(); + generate.setStationId(station.getCode()); + generate.setStationName(station.getName()); + generate.setDeviceCode(device.getEmCode()); + generate.setDeviceName(device.getName()); + generate.setTenantId(station.getTenantId()); + generate.setCreateDept(station.getRefDept()); + generate.setCreateUser(station.getCreateUser()); + generate.setUpdateUser(station.getUpdateUser()); + Date time; + if(record.getTs().contains(".0")){ + time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + }else{ + time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); + } + generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); + generate.setMonth(time.getMonth() + 1); + if(StringUtil.isEmpty(record.getVal())){ + generate.setGenerate(BigDecimal.ZERO); + }else{ + generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()).setScale(2, RoundingMode.HALF_UP)); + } + // 无功电量 + if(CollectionUtil.isEmpty(reactives)){ + generate.setReactiveGenerate(BigDecimal.ZERO); + }else{ + Optional optional = reactives.stream().filter(reactive-> record.getTs().equals(reactive.getTs())).findFirst(); + if(optional.isPresent()){ + if(StringUtil.isEmpty(optional.get().getVal())){ + generate.setReactiveGenerate(BigDecimal.ZERO); + }else{ + generate.setReactiveGenerate(BigDecimal.valueOf(Double.parseDouble(optional.get().getVal()))); + } + }else{ + generate.setReactiveGenerate(BigDecimal.ZERO); + } + } + return generate; + }).collect(Collectors.toList())); + }); + // 填报发电量保存 + threeGenerateService.saveBatch(this.saveFillGenerate(station,start,end)); }); - // 填报发电量保存 - threeGenerateService.saveBatch(this.saveFillGenerate(station,start,end)); - }); - countDownLatch.countDown(); - log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); + countDownLatch.countDown(); + log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); + }catch (Exception e){ + countDownLatch.countDown(); + log.error("save_generation_execute_complete_error : {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); + } }); - }catch (Exception e){ - countDownLatch.countDown(); - log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); - } } // 等待所有线程执行完成 try { @@ -453,6 +500,9 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { }else{ generation.setGenerate(BigDecimal.valueOf(Double.parseDouble(power.getPower().toString())).setScale(2, RoundingMode.HALF_UP)); } + generation.setReactiveGenerate(BigDecimal.ZERO + + ); return generation; }).collect(Collectors.toList()); } From 611d995be244caa712640db5ece7aa41eb69c464 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Aug 2024 15:11:55 +0800 Subject: [PATCH 17/19] =?UTF-8?q?#=E6=97=A0=E5=8A=9F=E7=94=B5=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/scheduled/ScheduledApplication.java | 2 +- .../hzims/scheduled/scheduled/GenerationScheduledTask.java | 4 +++- .../operation/home/impl/ObtainGenerationServiceImpl.java | 14 +++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) 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..17f210b 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,7 +21,7 @@ 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 diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java index 80be76b..c42a00e 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java @@ -8,7 +8,6 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Arrays; @@ -49,6 +48,7 @@ public class GenerationScheduledTask { * @return */ @XxlJob(THIRTY_DAY_POWER_GENERATION) + //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT thirtyDayPowerGeneration(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); @@ -63,6 +63,7 @@ public class GenerationScheduledTask { * @return */ @XxlJob(THIS_DAY_POWER_GENERATION) + //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT thisDayPowerGeneration(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); @@ -77,6 +78,7 @@ public class GenerationScheduledTask { * @return */ @XxlJob(LOAD_THREE_YEAR_POWER_GENERATION) + //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT loadThreeYearPowerGeneration(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/ObtainGenerationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java index f304eaf..6e74235 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java @@ -297,8 +297,8 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { List> 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()); for(List item : limits){ - try{ - pool.submit(()->{ + pool.submit(()->{ + try{ item.forEach(station->{ // 站点设备集合 List eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); @@ -354,11 +354,11 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService { }); countDownLatch.countDown(); log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); - }); - }catch (Exception e){ - countDownLatch.countDown(); - log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); - } + }catch (Exception e){ + countDownLatch.countDown(); + log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); + } + }); } // 等待所有线程执行完成 try { From f5646f5ad12b36e3e1ca6c8b06a7a3925c422645 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Aug 2024 16:48:33 +0800 Subject: [PATCH 18/19] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java | 1 + .../scheduled/service/operation/monitor/impl/MonitorServiceImpl.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java index 60f2d44..ad9bd43 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java @@ -6,6 +6,7 @@ import com.hnac.hzinfo.subscribe.HZ3000SoeSubscribe; import com.hnac.hzinfo.subscribe.SoeSubscribe; import lombok.extern.slf4j.Slf4j; import org.eclipse.paho.client.mqttv3.MqttAsyncClient; +import org.eclipse.paho.client.mqttv3.MqttException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index ef5bdbf..0dfd7c4 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -12,7 +12,6 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.operational.config.enume.ConfigStatus; import com.hnac.hzims.operational.config.vo.StationRealVo; import com.hnac.hzims.operational.main.constant.HomePageConstant; -import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; import com.hnac.hzims.operational.main.vo.RealAttributeVo; import com.hnac.hzims.operational.main.vo.RealDeviceVo; import com.hnac.hzims.operational.main.vo.RealStationVo; @@ -35,6 +34,8 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; +import org.springblade.message.dto.MailPushDto; +import org.springblade.message.fegin.IPushMsgClient; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; import org.springframework.beans.factory.annotation.Value; From 71db7337606c2a64abd3ce253098044a9c1abb39 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Aug 2024 17:03:00 +0800 Subject: [PATCH 19/19] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java | 6 ++---- .../hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java index f2f52b6..256e8d0 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java @@ -65,10 +65,8 @@ public class BasicScheduledTask { * realId刷新 */ @XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) -// @Scheduled(cron = "0/40 * * * * ? ") + //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT certificatetDeadLineNotice(String param) throws ParseException { -// public ReturnT certificatetDeadLineNotice() throws ParseException { -// String param=""; Date endTime = new Date(); if (StringUtils.isNotBlank(param)) { endTime = new SimpleDateFormat("yyyy-MM-dd").parse(param); @@ -118,7 +116,7 @@ public class BasicScheduledTask { } private void sendMessage(CertificatetEntity certificatetEntity, Integer date, String users,String personNotice) { -// //注意:通知人是创建人所在机构 + //注意:通知人是创建人所在机构 BusinessMessageDTO message = new BusinessMessageDTO(); message.setBusinessClassify("system"); message.setBusinessKey("certificatet-notice-message"); 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 9986873..5e84cdf 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 @@ -60,10 +60,9 @@ public class RealTargetScheduledTask { /** * 水电站-机组指标加载 */ - //@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET) - @Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadHydropowerTarget() { - String param = ""; + @XxlJob(LOAD_HYDROPOWER_UNIT_TARGET) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadHydropowerTarget(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); }