Переглянути джерело

精益时间告警采集表字段修改003

qiangxuan 8 місяців тому
батько
коміт
c81dd50f91

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

@@ -15,8 +15,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -24,7 +27,7 @@ import java.util.stream.Collectors;
 @Slf4j
 @EnableAsync
 @Component
-//@EnableScheduling
+@EnableScheduling
 public class LeanEventTriggerWarnTask {
 
     @Autowired
@@ -48,7 +51,7 @@ public class LeanEventTriggerWarnTask {
     @Autowired
     ILeanEventWarnInfoService leanEventWarnInfoService;
 
-    @Scheduled(cron = "0/10 * * * * *")
+//    @Scheduled(cron = "0/10 * * * * *")
     public void leanEventTriggerWarnHandle(){
         LambdaQueryWrapper<FpgGatherData> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(FpgGatherData::getEventWarnState, "0").isNotNull(FpgGatherData::getDeviceInformationId).orderByDesc(FpgGatherData::getCreateTime);
@@ -60,8 +63,10 @@ public class LeanEventTriggerWarnTask {
             });
         }
         // 逻辑删除已校验完精益事件告警的采集数据,事件告警使用状态0:使用中1:使用结束
-        List<FpgGatherData> updateFpgGatherDataList = fpgGatherDataList.stream().map(s -> s.setEventWarnState("1")).collect(Collectors.toList());
-        fpgGatherDataService.updateBatchById(updateFpgGatherDataList);
+//        List<FpgGatherData> updateFpgGatherDataList = fpgGatherDataList.stream().map(s -> s.setEventWarnState("1")).collect(Collectors.toList());
+//        if (oConvertUtils.listIsNotEmpty(updateFpgGatherDataList)){
+//            fpgGatherDataService.updateBatchById(updateFpgGatherDataList);
+//        }
     }
 
 
@@ -70,13 +75,12 @@ public class LeanEventTriggerWarnTask {
      * @param fpgGatherData
      */
     public void leanEventsHostTriggerWarnHandle(FpgGatherData fpgGatherData){
-        String keyMainString = String.format("sys:opcData:syn::%s:%s", "leanEventsHost","deviceInformationMainIds");
+        String keyMainString = String.format("sys:opcSynData::%s","deviceInformationMainIds");
         String keySubString = String.format("sys:opcSynData::%s","deviceInformationSubIds");
         // 1、根据采集过来的数据,根据主设备ID,处理精益事件配置信息(host_open;host_stop)
         if (redisTemplate.hasKey(keyMainString)){
-            String text = oConvertUtils.getString(redisTemplate.opsForValue().get(keyMainString));
-            List<String> deviceInformationIdIds = Arrays.asList(text.split(","));
-            boolean exists = deviceInformationIdIds.stream().allMatch(x -> x.equals(fpgGatherData.getDeviceInformationId()));
+            List<String> deviceInformationIdIds = (List<String>) redisTemplate.opsForValue().get(keyMainString);
+            boolean exists = deviceInformationIdIds.stream().anyMatch(x -> x.contains(fpgGatherData.getDeviceInformationId()));
             if (exists){
                 // 根据主设备ID查询多条精益事件设备启停信息 处理事件类型为host_open、host_stop
                 LambdaQueryWrapper<LeanEventsHost> queryLeanEventsHost = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getDeviceInformationId, fpgGatherData.getDeviceInformationId()).isNotNull(LeanEventsHost::getDeviceInformationType);
@@ -94,9 +98,8 @@ public class LeanEventTriggerWarnTask {
         }
         // 2、根据采集过来的数据,根据辅设备ID,处理精益事件配置信息3:FPG开,4:FPG关
         if (redisTemplate.hasKey(keySubString)){
-            String text = oConvertUtils.getString(redisTemplate.opsForValue().get(keySubString));
-            List<String> deviceInformationIdList = Arrays.asList(text.split(","));
-            boolean exists = deviceInformationIdList.stream().allMatch(x -> x.equals(fpgGatherData.getDeviceInformationId()));
+            List<String> deviceInformationIdList = (List<String>) redisTemplate.opsForValue().get(keySubString);
+            boolean exists = deviceInformationIdList.stream().anyMatch(x -> x.contains(fpgGatherData.getDeviceInformationId()));
             if (exists){
                 // 根据辅设备ID模糊查询多条关于FPG精益事件设备启停信息 处理事件类型为fpg_open、fpg_close、fpg_ing_time、fpg_power_limit
                 List<LeanEventsHost> leanEventsHostList = leanEventsHostService.getFpgLeanEventsHostList(fpgGatherData.getDeviceInformationId());

+ 0 - 39
jeecg-module-gather/src/main/java/org/jeecg/modules/gatherData/controller/FpgGatherDataController.java

@@ -1,39 +0,0 @@
-package org.jeecg.modules.gatherData.controller;
-
-import java.util.Arrays;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.modules.gatherData.entity.FpgGatherData;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.extern.slf4j.Slf4j;
-
-import org.jeecg.modules.gatherData.service.IFpgGatherDataService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-
- /**
- * @Description: 峰平谷数据采集
- * @Author: jeecg-boot
- * @Date:   2024-10-28
- * @Version: V1.0
- */
-@Api(tags="峰平谷数据采集")
-@RestController
-@RequestMapping("/jeecgModuleLesm/fpgGatherData")
-@Slf4j
-public class FpgGatherDataController extends JeecgController<FpgGatherData, IFpgGatherDataService> {
-	@Autowired
-	private IFpgGatherDataService fpgGatherDataService;
-
-}

+ 1 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/gatherData/entity/FpgGatherData.java

@@ -70,7 +70,7 @@ public class FpgGatherData implements Serializable {
 	/**运行电流*/
 	@Excel(name = "运行电流", width = 15)
     @ApiModelProperty(value = "运行电流")
-    private BigDecimal current;
+    private BigDecimal runCurrent;
 	/**有功功率*/
 	@Excel(name = "有功功率", width = 15)
     @ApiModelProperty(value = "有功功率")

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

@@ -60,7 +60,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         // 根据采集点的运行电流,判断是否需要上报告警信息 (辅设备电流小于等于5,上报告警信息)
         BigDecimal limitVoltage = new BigDecimal("5");
 
-        if (fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+        if (fpgGatherData.getRunCurrent().compareTo(limitVoltage) < 0){
             // 上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("HOST_OPEN状态下,辅设备电流小于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -78,7 +78,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         leanEventWarnInfo.setCreateTime(new Date());
         // 根据采集点的电流,判断是否需要上报告警信息 (辅设备电流大于5,上报告警信息)
         BigDecimal limitVoltage = new BigDecimal("5");
-        if (fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+        if (fpgGatherData.getRunCurrent().compareTo(limitVoltage) > 0){
             // 上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("HOST_CLOSE状态下,辅设备电流大于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -110,7 +110,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
 
         boolean topsIsExit = topsNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (topsIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+        if (topsIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) < 0){
             // 采集到的数据电流小于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,尖时段采集到的数据电流小于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -118,7 +118,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
             baseMapper.insert(leanEventWarnInfo);
         }
         boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (peaksIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+        if (peaksIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) < 0){
             // 采集到的数据电流小于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,峰时段采集到的数据电流小于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -126,7 +126,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
             baseMapper.insert(leanEventWarnInfo);
         }
         boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (flatIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+        if (flatIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) < 0){
             // 采集到的数据电流小于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,平时段采集到的数据电流小于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -134,7 +134,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
             baseMapper.insert(leanEventWarnInfo);
         }
         boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (valleysIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+        if (valleysIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) < 0){
             // 采集到的数据电流小于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,谷时段采集到的数据电流小于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -167,7 +167,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
         Instant instant = fpgGatherData.getCreateTime().toInstant();
         LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
         boolean topsIsExit = topsNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (topsIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+        if (topsIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) > 0){
             // 采集到的数据电流大于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -175,7 +175,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
             baseMapper.insert(leanEventWarnInfo);
         }
         boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (peaksIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+        if (peaksIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) > 0){
             // 采集到的数据电流大于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -183,7 +183,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
             baseMapper.insert(leanEventWarnInfo);
         }
         boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (flatIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+        if (flatIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) > 0){
             // 采集到的数据电流大于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
@@ -191,7 +191,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
             baseMapper.insert(leanEventWarnInfo);
         }
         boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-        if (valleysIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+        if (valleysIsExit && fpgGatherData.getRunCurrent().compareTo(limitVoltage) > 0){
             // 采集到的数据电流大于5A,上报告警信息
             leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");