Browse Source

update001

qiangxuan 6 months ago
parent
commit
226af84962

+ 1 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/fpgJob/LeanEventTriggerWarnTask.java

@@ -42,7 +42,7 @@ public class LeanEventTriggerWarnTask {
     @Autowired
     ILeanEventWarnInfoService leanEventWarnInfoService;
 
-    @Scheduled(cron = "0 */1 * * * *")
+    @Scheduled(cron = "0 */2 * * * *")
     public void leanEventTriggerWarnHandle(){
         LambdaQueryWrapper<FpgGatherData> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.isNull(FpgGatherData::getEventWarnUpdatetime).isNotNull(FpgGatherData::getDeviceInformationId).orderByDesc(FpgGatherData::getCreateTime);

+ 21 - 25
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/service/impl/LeanEventWarnInfoServiceImpl.java

@@ -111,7 +111,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         BigDecimal limitCurrent = new BigDecimal(systemVariable.getDefaultValue());
         if (fpgGatherData.getRunCurrent().compareTo(limitCurrent) > 0){
             // 上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("HOST_CLOSE状态下,辅设备电流大于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("HOST_CLOSE状态下,辅设备电流大于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.HOST_STOP.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -154,7 +154,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean topsIsExit = topsNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (topsIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) < 0){
             // 采集到的数据电流小于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,尖时段采集到的数据电流小于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,尖时段采集到的数据电流小于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_OPEN.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -163,7 +163,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (peaksIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) < 0){
             // 采集到的数据电流小于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,峰时段采集到的数据电流小于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,峰时段采集到的数据电流小于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_OPEN.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -172,7 +172,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (flatIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) < 0){
             // 采集到的数据电流小于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,平时段采集到的数据电流小于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,平时段采集到的数据电流小于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_OPEN.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -181,7 +181,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (valleysIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) < 0){
             // 采集到的数据电流小于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,谷时段采集到的数据电流小于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,谷时段采集到的数据电流小于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_OPEN.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -244,7 +244,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean topsIsExit = topsNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (topsIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) > 0){
             // 采集到的数据电流大于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,尖采集到的数据电流大于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_CLOSE.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -253,7 +253,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (peaksIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) > 0){
             // 采集到的数据电流大于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,峰采集到的数据电流大于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_CLOSE.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -262,7 +262,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (flatIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) > 0){
             // 采集到的数据电流大于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,平采集到的数据电流大于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_CLOSE.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -271,7 +271,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
         if (valleysIsExit && fpgGatherData.getRunCurrent().compareTo(limitCurrent) > 0){
             // 采集到的数据电流大于5A,上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,谷采集到的数据电流大于" + limitCurrent + "A,触发告警!");
             leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_CLOSE.getCode());
             leanEventWarnInfo.setDeviceWarnLevel("0");
             // 更新或者新增逻辑处理
@@ -323,7 +323,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
                     .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
             if (topsIngTimeSum.intValue() > runTimeLimit){
                 // 尖——累加运行时长超过限制时长,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,尖运行时长超过限制时长,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,尖运行时长超过限制时长" + runTimeLimit + ",触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_ING_TIME.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
@@ -334,7 +334,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
                     .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
             if (peaksIngTimeSum.intValue() > runTimeLimit){
                 // 峰——累加运行时长超过限制时长,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,峰运行时长超过限制时长,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,峰运行时长超过限制时长" + runTimeLimit + ",触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_ING_TIME.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
@@ -345,7 +345,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
                     .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
             if (flatIngTimeSum.intValue() > runTimeLimit){
                 // 平——累加运行时长超过限制时长,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,平运行时长超过限制时长,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,平运行时长超过限制时长" + runTimeLimit + ",触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_ING_TIME.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
@@ -356,7 +356,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
                     .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
             if (valleysIngTimeSum.intValue() > runTimeLimit){
                 // 谷——累加运行时长超过限制时长,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,谷运行时长超过限制时长,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,谷运行时长超过限制时长" + runTimeLimit + ",触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_ING_TIME.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
@@ -405,44 +405,40 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         // 判断MongoDB中的累加运行时长是否大于 LeanEventsHostConfig中的尖峰平谷运行限制时长
         int powerLimit = Integer.parseInt(leanEventsHostConfig.getPowerLimit());
         if("tops".equals(leanEventsHost.getDeviceInformationId())){
-            BigDecimal topsPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getTopsPower)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
+            BigDecimal topsPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getTopsPower).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (topsPowerLimitSum.intValue() > powerLimit){
                 // 尖——累加累计功率超过功率限制,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,尖累计功率超过功率限制,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,尖累计功率超过功率限制" + powerLimit +"A,触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_POWER_LIMIT.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
                 saveOrUpdateLeanEventWarnInfo(fpgGatherData, leanEventWarnInfo);
             }
         }else if ("peaks".equals(leanEventsHost.getDeviceInformationId())){
-            BigDecimal peaksPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getPeaksPower)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
+            BigDecimal peaksPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getPeaksPower).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (peaksPowerLimitSum.intValue() > powerLimit){
                 // 峰——累加累计功率超过功率限制,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,峰累计功率超过功率限制,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,峰累计功率超过功率限制" + powerLimit +"A,触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_POWER_LIMIT.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
                 saveOrUpdateLeanEventWarnInfo(fpgGatherData, leanEventWarnInfo);
             }
         }else if ("flat".equals(leanEventsHost.getDeviceInformationId())){
-            BigDecimal flatPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getFlatPower)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
+            BigDecimal flatPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getFlatPower).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (flatPowerLimitSum.intValue() > powerLimit){
                 // 平——累加累计功率超过功率限制,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,平累计功率超过功率限制,触发告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,平累计功率超过功率限制" + powerLimit +"A,触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_POWER_LIMIT.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理
                 saveOrUpdateLeanEventWarnInfo(fpgGatherData, leanEventWarnInfo);
             }
         } else if ("valleys".equals(leanEventsHost.getDeviceInformationId())) {
-            BigDecimal valleysPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getValleysPower)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(60), 0, RoundingMode.CEILING);
+            BigDecimal valleysPowerLimitSum = fpgStatiscsModelDataList.stream().map(FpgStatiscsModelMongodb::getValleysPower).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (valleysPowerLimitSum.intValue() > powerLimit){
                 // 谷——累加累计功率超过功率限制,触发告警
-                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,谷累计功率超过功率限制,触发精益事件告警!");
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,谷累计功率超过功率限制" + powerLimit +"A,触发告警!");
                 leanEventWarnInfo.setWarnType(EDeviceInformationType.FPG_POWER_LIMIT.getCode());
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 // 更新或者新增逻辑处理