瀏覽代碼

精益告警触发逻辑开发002

qiangxuan 7 月之前
父節點
當前提交
df7692da18

+ 3 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/common/enums/EDeviceInformationType.java

@@ -5,7 +5,9 @@ public enum EDeviceInformationType {
     HOST_OPEN("host_open", "峰平谷开启"),
     HOST_STOP("host_stop", "峰平谷关闭"),
     FPG_OPEN("fpg_open", "主设备开启"),
-    FPG_CLOSE("fpg_close", "主设备关闭");
+    FPG_CLOSE("fpg_close", "主设备关闭"),
+    FPG_ING_TIME("fpg_ing_time", "峰平谷运行时间"),
+    FPG_POWER_LIMIT("fpg_power_limit", "峰平谷功率限制");
 
     private final String code;
     private final String description;

+ 3 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/events/mapper/xml/LeanEventsHostMapper.xml

@@ -8,6 +8,8 @@
         WHERE
             FIND_IN_SET(#{deviceInformationList}, device_information_list)
             AND device_information_type = 'fpg_open'
-            OR device_information_type = 'fpg_close';
+            OR device_information_type = 'fpg_close'
+            OR device_information_type = 'fpg_ing_time'
+            OR device_information_type = 'fpg_power_limit';
     </select>
 </mapper>

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

@@ -3,8 +3,10 @@ package org.jeecg.modules.fpgJob;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.common.enums.EDeviceInformationType;
 import org.jeecg.modules.device.service.IDeviceInformationService;
 import org.jeecg.modules.devicePoint.service.IDevicePointService;
+import org.jeecg.modules.events.entity.LeanEventsHost;
 import org.jeecg.modules.events.service.ILeanEventsHostService;
 import org.jeecg.modules.gatherData.entity.FpgGatherData;
 import org.jeecg.modules.gatherData.service.IFpgGatherDataService;
@@ -15,8 +17,7 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.scheduling.annotation.EnableAsync;
 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;
 
@@ -44,21 +45,89 @@ public class LeanEventTriggerWarnTask {
     @Autowired
     ILeanEventsHostService leanEventsHostService;
 
-//    @Autowired
-//    ILeanEventWarnInfoService leanEventWarnInfoService;
+    @Autowired
+    ILeanEventWarnInfoService leanEventWarnInfoService;
 
     @Scheduled(cron = "0/10 * * * * *")
     public void leanEventTriggerWarnHandle(){
         LambdaQueryWrapper<FpgGatherData> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.isNotNull(FpgGatherData::getDeviceInformationId).orderByDesc(FpgGatherData::getCreateTime);
+        queryWrapper.eq(FpgGatherData::getEventWarnState, "0").isNotNull(FpgGatherData::getDeviceInformationId).orderByDesc(FpgGatherData::getCreateTime);
         List<FpgGatherData> fpgGatherDataList = fpgGatherDataService.list(queryWrapper);
-        List<String> fpgGatherDataIds = new ArrayList<>();
         if (oConvertUtils.listIsNotEmpty(fpgGatherDataList)){
-            fpgGatherDataIds = fpgGatherDataList.stream().map(FpgGatherData::getId).collect(Collectors.toList());
+            fpgGatherDataList.forEach(x ->{
+                // 触发告警信息逻辑处理
+                leanEventsHostTriggerWarnHandle(x);
+            });
+        }
+        // 逻辑删除已校验完精益事件告警的采集数据,事件告警使用状态0:使用中1:使用结束
+        List<FpgGatherData> updateFpgGatherDataList = fpgGatherDataList.stream().map(s -> s.setEventWarnState("1")).collect(Collectors.toList());
+        fpgGatherDataService.updateBatchById(updateFpgGatherDataList);
+    }
 
-//            fpgGatherDataService.removeBatchByIds(, )
+
+    /**
+     * 根据采集过来的数据、运行电流、精益事件配置(设备开启、设备关闭、FPG开启、FPG关闭《峰平谷的时间区间配置》),来触发告警信息,并保存
+     * @param fpgGatherData
+     */
+    public void leanEventsHostTriggerWarnHandle(FpgGatherData fpgGatherData){
+        String keyMainString = String.format("sys:opcData:syn::%s:%s", "leanEventsHost","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()));
+            if (exists){
+                // 根据主设备ID查询多条精益事件设备启停信息 处理事件类型为host_open、host_stop
+                LambdaQueryWrapper<LeanEventsHost> queryLeanEventsHost = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getDeviceInformationId, fpgGatherData.getDeviceInformationId()).isNotNull(LeanEventsHost::getDeviceInformationType);
+                List<LeanEventsHost> leanEventsHostList =  leanEventsHostService.list(queryLeanEventsHost);
+                leanEventsHostList.forEach(y ->{
+                    // 事件类型为host_stop、host_open
+                    if (EDeviceInformationType.HOST_OPEN.getCode().equals(y.getDeviceInformationType())){
+                        leanEventWarnInfoService.openDeviceTriggerWarnInfo(fpgGatherData);
+                    }
+                    if (EDeviceInformationType.HOST_STOP.getCode().equals(y.getDeviceInformationType())){
+                        leanEventWarnInfoService.stopDeviceTriggerWarnInfo(fpgGatherData);
+                    }
+                });
+            }
+        }
+        // 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()));
+            if (exists){
+                // 根据辅设备ID模糊查询多条关于FPG精益事件设备启停信息 处理事件类型为fpg_open、fpg_close、fpg_ing_time、fpg_power_limit
+                List<LeanEventsHost> leanEventsHostList = leanEventsHostService.getFpgLeanEventsHostList(fpgGatherData.getDeviceInformationId());
+                leanEventsHostList.forEach(s ->{
+                    // 事件类型为 fpg_open
+                    if (EDeviceInformationType.FPG_OPEN.getCode().equals(s.getDeviceInformationType())){
+                        leanEventWarnInfoService.openFpgTriggerWarnInfo(fpgGatherData);
+                    }
+                    // 事件类型为 fpg_close
+                    if (EDeviceInformationType.FPG_CLOSE.getCode().equals(s.getDeviceInformationType())){
+                        leanEventWarnInfoService.closeFpgTriggerWarnInfo(fpgGatherData);
+                    }
+                    // 事件类型为 fpg_ing_time
+                    if (EDeviceInformationType.FPG_ING_TIME.getCode().equals(s.getDeviceInformationType())){
+                        leanEventWarnInfoService.runTimeTriggerWarnInfo(fpgGatherData, s);
+                    }
+                    // 事件类型为 fpg_power_limit
+                    if (EDeviceInformationType.FPG_POWER_LIMIT.getCode().equals(s.getDeviceInformationType())){
+                        leanEventWarnInfoService.powerLimitTriggerWarnInfo(fpgGatherData, s);
+                    }
+                });
+            }
         }
     }
 
 
+    /**
+     * 峰平谷采集数据 过期数据定时删除
+     */
+//    @Scheduled(cron = "0 */10 * * * *")
+    public void removeFpgGatherDataHandle(){
+
+    }
 }

+ 2 - 4
jeecg-module-gather/src/main/java/org/jeecg/modules/fpgJob/LeanModelStatistics.java

@@ -96,11 +96,9 @@ public class LeanModelStatistics {
                         fpgGatherData.setDeviceRegionId(opcConn.getDeviceRegionId()); // 区域id
                         fpgGatherData.setDevicePointId(opcPoint.getId()); // 采集点ID
                         fpgGatherData.setCreateTime(curentDate); // 创建时间
+                        fpgGatherData.setEventWarnState("0");
+                        fpgGatherData.setFpgModelState("0");
                         fpgGatherDataService.addC(fpgGatherData);
-                        if(oConvertUtils.isEmpty(opcConn.getId())){
-                            return;
-                        }
-                        String deviceInformationId = opcConn.getId();
                     }
                 }
             } catch (Exception e) {

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

@@ -84,4 +84,14 @@ public class FpgGatherData implements Serializable {
 	@Dict(dicCode = "fpg_type")
     @ApiModelProperty(value = "峰平谷类型")
     private java.lang.String fpgType;
+
+    /**峰平谷模型使用状态*/
+    @Excel(name = "峰平谷模型使用状态", width = 15, dicCode = "fpg_model_state")
+    @ApiModelProperty(value = "峰平谷模型使用状态0:使用中1:使用结束")
+    private java.lang.String fpgModelState;
+
+    /**峰平谷类型*/
+    @Excel(name = "事件告警使用状态", width = 15, dicCode = "event_warn_state")
+    @ApiModelProperty(value = "事件告警使用状态0:使用中1:使用结束")
+    private java.lang.String eventWarnState;
 }

+ 78 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/entity/LeanEventsHostConfig.java

@@ -0,0 +1,78 @@
+package org.jeecg.modules.leanEventWarn.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 精益事件配置关联表
+ * @Author: jeecg-boot
+ * @Date:   2024-10-30
+ * @Version: V1.0
+ */
+@Data
+@TableName("lean_events_host_config")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="lean_events_host_config对象", description="精益事件配置关联表")
+public class LeanEventsHostConfig implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private String id;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建日期*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新日期*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新日期")
+    private Date updateTime;
+	/**所属部门*/
+    @ApiModelProperty(value = "所属部门")
+    private String sysOrgCode;
+	/**辅设备ID*/
+	@Excel(name = "辅设备ID", width = 15)
+    @ApiModelProperty(value = "辅设备ID")
+    private String deviceInformationListId;
+	/**运行时间*/
+	@Excel(name = "运行时间", width = 15)
+    @ApiModelProperty(value = "运行时间")
+    private String runTime;
+	/**功率限制*/
+	@Excel(name = "功率限制", width = 15)
+    @ApiModelProperty(value = "功率限制")
+    private String powerLimit;
+	/**限制类型*/
+	@Excel(name = "限制类型", width = 15)
+    @ApiModelProperty(value = "限制类型")
+    private String limitType;
+	/**拓展字段*/
+	@Excel(name = "拓展字段", width = 15)
+    @ApiModelProperty(value = "拓展字段")
+    private String remark;
+    @Excel(name = "精益事件id", width = 15)
+    @ApiModelProperty(value = "精益事件id")
+    private String eventsId;
+}

+ 15 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/mapper/LeanEventsHostConfigMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.leanEventWarn.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.leanEventWarn.entity.LeanEventsHostConfig;
+
+
+/**
+ * @Description: 精益事件配置关联表
+ * @Author: jeecg-boot
+ * @Date:   2024-10-30
+ * @Version: V1.0
+ */
+public interface LeanEventsHostConfigMapper extends BaseMapper<LeanEventsHostConfig> {
+
+}

+ 5 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/mapper/xml/LeanEventsHostConfigMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.leanEventWarn.mapper.LeanEventsHostConfigMapper">
+
+</mapper>

+ 8 - 5
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/service/ILeanEventWarnInfoService.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.leanEventWarn.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.events.entity.LeanEventsHost;
 import org.jeecg.modules.gatherData.entity.FpgGatherData;
 import org.jeecg.modules.leanEventWarn.entity.LeanEventWarnInfo;
 
@@ -12,13 +13,15 @@ import org.jeecg.modules.leanEventWarn.entity.LeanEventWarnInfo;
  */
 public interface ILeanEventWarnInfoService extends IService<LeanEventWarnInfo> {
 
-    void insertWarnInfo(LeanEventWarnInfo leanEventWarnInfo);
+    void openDeviceTriggerWarnInfo(FpgGatherData fpgGatherData);
 
-    void openDeviceTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData);
+    void stopDeviceTriggerWarnInfo(FpgGatherData fpgGatherData);
 
-    void stopDeviceTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData);
+    void openFpgTriggerWarnInfo(FpgGatherData fpgGatherData);
 
-    void openFpgTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData);
+    void closeFpgTriggerWarnInfo(FpgGatherData fpgGatherData);
 
-    void closeFpgTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData);
+    void runTimeTriggerWarnInfo(FpgGatherData fpgGatherData, LeanEventsHost leanEventsHost);
+
+    void powerLimitTriggerWarnInfo(FpgGatherData fpgGatherData, LeanEventsHost leanEventsHost);
 }

+ 14 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/service/ILeanEventsHostConfigService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.leanEventWarn.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.leanEventWarn.entity.LeanEventsHostConfig;
+
+/**
+ * @Description: 精益事件配置关联表
+ * @Author: jeecg-boot
+ * @Date:   2024-10-30
+ * @Version: V1.0
+ */
+public interface ILeanEventsHostConfigService extends IService<LeanEventsHostConfig> {
+
+}

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

@@ -1,15 +1,19 @@
 package org.jeecg.modules.leanEventWarn.service.impl;
+import org.jeecg.modules.events.entity.LeanEventsHost;
 import org.jeecg.modules.leanEventWarn.entity.LeanEventWarnInfo;
+import org.jeecg.modules.leanEventWarn.entity.LeanEventsHostConfig;
 import org.jeecg.modules.leanEventWarn.mapper.LeanEventWarnInfoMapper;
 import org.jeecg.modules.leanEventWarn.service.ILeanEventWarnInfoService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.gatherData.entity.FpgGatherData;
 import org.jeecg.modules.gatherData.service.IFpgGatherDataService;
+import org.jeecg.modules.leanEventWarn.service.ILeanEventsHostConfigService;
 import org.jeecg.modules.peaksAndValleysTimeConfig.entity.PeaksAndValleysTimeConfig;
 import org.jeecg.modules.peaksAndValleysTimeConfig.entity.PeaksAndValleysTimeConfigParam;
 import org.jeecg.modules.peaksAndValleysTimeConfig.service.IPeaksAndValleysTimeConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -20,8 +24,6 @@ import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -41,98 +43,58 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
     @Autowired
     IPeaksAndValleysTimeConfigService peaksAndValleysTimeConfigService;
 
-    @Override
-    public void insertWarnInfo(LeanEventWarnInfo leanEventWarnInfo) {
-        baseMapper.insert(leanEventWarnInfo);
-    }
+    @Autowired
+    ILeanEventsHostConfigService leanEventsHostConfigService;
+
+    @Autowired
+    MongoTemplate mongoTemplate;
 
     @Override
-    public void openDeviceTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData) {
+    public void openDeviceTriggerWarnInfo(FpgGatherData fpgGatherData) {
         LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
         leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
         leanEventWarnInfo.setDeviceInformationId(fpgGatherData.getDeviceInformationId());
         leanEventWarnInfo.setDevicePointId(fpgGatherData.getDevicePointId());
         leanEventWarnInfo.setCreateTime(new Date());
-        // 通过主设备ID、设备区域ID、采集点ID查询采集信息 fpg_gather_data
-        List<String> deviceChildTites = Arrays.asList(deviceInformationList.split(","));
-        LambdaQueryWrapper<FpgGatherData> fpgGatherDataLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        fpgGatherDataLambdaQueryWrapper.in(FpgGatherData::getDeviceInformationId, deviceChildTites).eq(FpgGatherData::getDevicePointId, fpgGatherData.getDevicePointId()).eq(FpgGatherData::getDeviceRegionId, fpgGatherData.getDeviceRegionId());
-        List<FpgGatherData> gatherDataList = fpgGatherDataService.list(fpgGatherDataLambdaQueryWrapper);
-        if (!oConvertUtils.listIsNotEmpty(gatherDataList)){
+
+        // 根据采集点的运行电流,判断是否需要上报告警信息 (辅设备电流小于等于5,上报告警信息)
+        BigDecimal limitVoltage = new BigDecimal("5");
+
+        if (fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
             // 上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("HOST_OPEN状态下,查询采集数据为空,主设备未开启,触发精益事件告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("HOST_OPEN状态下,辅设备电流小于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
             leanEventWarnInfo.setDeviceWarnLevel("0");
             baseMapper.insert(leanEventWarnInfo);
-            return;
         }
-        // 根据采集点的运行电流,判断是否需要上报告警信息 (辅设备电流小于等于5,上报告警信息)
-        BigDecimal limitVoltage = new BigDecimal("5");
-        gatherDataList.forEach(x ->{
-            if (x.getCurrent().compareTo(limitVoltage) < 0){
-                // 上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("HOST_OPEN状态下,辅设备电流大于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-        });
     }
 
     @Override
-    public void stopDeviceTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData) {
+    public void stopDeviceTriggerWarnInfo(FpgGatherData fpgGatherData) {
         LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
         leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
         leanEventWarnInfo.setDeviceInformationId(fpgGatherData.getDeviceInformationId());
         leanEventWarnInfo.setDevicePointId(fpgGatherData.getDevicePointId());
         leanEventWarnInfo.setCreateTime(new Date());
-        // 通过主设备ID、设备区域ID、采集点ID查询采集信息 fpg_gather_data
-        List<String> deviceChildTites = Arrays.asList(deviceInformationList.split(","));
-        LambdaQueryWrapper<FpgGatherData> fpgGatherDataLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        fpgGatherDataLambdaQueryWrapper.in(FpgGatherData::getDeviceInformationId, deviceChildTites).eq(FpgGatherData::getDevicePointId, fpgGatherData.getDevicePointId()).eq(FpgGatherData::getDeviceRegionId, fpgGatherData.getDeviceRegionId());
-        List<FpgGatherData> gatherDataList = fpgGatherDataService.list(fpgGatherDataLambdaQueryWrapper);
-        if (!oConvertUtils.listIsNotEmpty(gatherDataList)){
+        // 根据采集点的电流,判断是否需要上报告警信息 (辅设备电流大于5,上报告警信息)
+        BigDecimal limitVoltage = new BigDecimal("5");
+        if (fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
             // 上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("HOST_CLOSE状态下,查询采集数据为空,主设备未开启,触发精益事件告警!");
+            leanEventWarnInfo.setDeviceWarnInfo("HOST_CLOSE状态下,辅设备电流大于5A,触发精益事件告警!");
             leanEventWarnInfo.setWarnType("1");
             leanEventWarnInfo.setDeviceWarnLevel("0");
             baseMapper.insert(leanEventWarnInfo);
-            return;
         }
-        // 根据采集点的电流,判断是否需要上报告警信息 (辅设备电流大于5,上报告警信息)
-        BigDecimal limitVoltage = new BigDecimal("5");
-        gatherDataList.forEach(x ->{
-            if (x.getCurrent().compareTo(limitVoltage) > 0){
-                // 上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("HOST_CLOSE状态下,辅设备电流大于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-        });
     }
 
     @Override
-    public void openFpgTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData) {
+    public void openFpgTriggerWarnInfo(FpgGatherData fpgGatherData) {
         LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
         leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
         leanEventWarnInfo.setDeviceInformationId(fpgGatherData.getDeviceInformationId());
         leanEventWarnInfo.setDevicePointId(fpgGatherData.getDevicePointId());
         leanEventWarnInfo.setCreateTime(new Date());
         PeaksAndValleysTimeConfigParam peaksAndValleysTimeConfigParam = peaksAndValleysTimeConfigService.get();
-        // 通过主设备ID、设备区域ID、采集点ID查询采集信息 fpg_gather_data
-        List<String> deviceChildTites = Arrays.asList(deviceInformationList.split(","));
-        LambdaQueryWrapper<FpgGatherData> fpgGatherDataLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        fpgGatherDataLambdaQueryWrapper.in(FpgGatherData::getDeviceInformationId, deviceChildTites).eq(FpgGatherData::getDevicePointId, fpgGatherData.getDevicePointId()).eq(FpgGatherData::getDeviceRegionId, fpgGatherData.getDeviceRegionId());
-        List<FpgGatherData> gatherDataList = fpgGatherDataService.list(fpgGatherDataLambdaQueryWrapper);
-        if (!oConvertUtils.listIsNotEmpty(gatherDataList)){
-            // 上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,查询采集数据为空,触发精益事件告警!");
-            leanEventWarnInfo.setWarnType("1");
-            leanEventWarnInfo.setDeviceWarnLevel("0");
-            baseMapper.insert(leanEventWarnInfo);
-            return;
-        }
         // 获取尖、峰、平、谷配置信息并拼接开始时间、结束时间
         List<PeaksAndValleysTimeConfig> topsNewPeaksAndValleysTimeConfigList = getPeaksAndValleysTimeConfigByType(peaksAndValleysTimeConfigParam, "tops");
 
@@ -144,66 +106,52 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
 
         BigDecimal limitVoltage = new BigDecimal("5");
         // 根据采集到的数据 创建时间,跟峰平谷配置的时间,判断属于哪个时段(尖、峰、平、谷)
-        gatherDataList.forEach(x ->{
-            Instant instant = x.getCreateTime().toInstant();
-            LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
-
-            boolean topsIsExit = topsNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (topsIsExit && x.getCurrent().compareTo(limitVoltage) < 0){
-                // 采集到的数据电流小于5A,上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,尖时段采集到的数据电流小于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-            boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (peaksIsExit && x.getCurrent().compareTo(limitVoltage) < 0){
-                // 采集到的数据电流小于5A,上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,峰采集到的数据电流小于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-            boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (flatIsExit && x.getCurrent().compareTo(limitVoltage) < 0){
-                // 采集到的数据电流小于5A,上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,平时段采集到的数据电流小于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-            boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (valleysIsExit && x.getCurrent().compareTo(limitVoltage) < 0){
-                // 采集到的数据电流小于5A,上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,谷时段采集到的数据电流小于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-        });
+        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){
+            // 采集到的数据电流小于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,尖时段采集到的数据电流小于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+        boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
+        if (peaksIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+            // 采集到的数据电流小于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,峰时段采集到的数据电流小于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+        boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
+        if (flatIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+            // 采集到的数据电流小于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,平时段采集到的数据电流小于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+        boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
+        if (valleysIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) < 0){
+            // 采集到的数据电流小于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_OPEN状态下,谷时段采集到的数据电流小于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
     }
 
     @Override
-    public void closeFpgTriggerWarnInfo(String deviceInformationList, FpgGatherData fpgGatherData) {
+    public void closeFpgTriggerWarnInfo(FpgGatherData fpgGatherData) {
         LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
         leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
         leanEventWarnInfo.setDeviceInformationId(fpgGatherData.getDeviceInformationId());
         leanEventWarnInfo.setDevicePointId(fpgGatherData.getDevicePointId());
         leanEventWarnInfo.setCreateTime(new Date());
         PeaksAndValleysTimeConfigParam peaksAndValleysTimeConfigParam = peaksAndValleysTimeConfigService.get();
-        // 通过主设备ID、设备区域ID、采集点ID查询采集信息 fpg_gather_data
-        List<String> deviceChildTites = Arrays.asList(deviceInformationList.split(","));
-        LambdaQueryWrapper<FpgGatherData> fpgGatherDataLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        fpgGatherDataLambdaQueryWrapper.in(FpgGatherData::getDeviceInformationId, deviceChildTites).eq(FpgGatherData::getDevicePointId, fpgGatherData.getDevicePointId()).eq(FpgGatherData::getDeviceRegionId, fpgGatherData.getDeviceRegionId());
-        List<FpgGatherData> gatherDataList = fpgGatherDataService.list(fpgGatherDataLambdaQueryWrapper);
-        if (!oConvertUtils.listIsNotEmpty(gatherDataList)){
-            // 上报告警信息
-            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,查询采集数据为空,触发精益事件告警!");
-            leanEventWarnInfo.setWarnType("1");
-            leanEventWarnInfo.setDeviceWarnLevel("0");
-            baseMapper.insert(leanEventWarnInfo);
-            return;
-        }
+
         // 获取尖、峰、平、谷配置信息并拼接开始时间、结束时间
         List<PeaksAndValleysTimeConfig> topsNewPeaksAndValleysTimeConfigList = getPeaksAndValleysTimeConfigByType(peaksAndValleysTimeConfigParam, "tops");
 
@@ -215,46 +163,100 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
 
         // 根据采集到的数据 创建时间,跟峰平谷配置的时间,判断属于哪个时段(尖、峰、平、谷)
         BigDecimal limitVoltage = new BigDecimal("5");
-        gatherDataList.forEach(x ->{
-            Instant instant = x.getCreateTime().toInstant();
-            LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
-            boolean topsIsExit = topsNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (topsIsExit && x.getCurrent().compareTo(limitVoltage) > 0){
-                // 采集到的数据电流大于5A,上报告警信息
-                // 上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-            boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (peaksIsExit && x.getCurrent().compareTo(limitVoltage) > 0){
-                // 采集到的数据电流大于5A,上报告警信息
-                // 上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
-                leanEventWarnInfo.setWarnType("1");
-                leanEventWarnInfo.setDeviceWarnLevel("0");
-                baseMapper.insert(leanEventWarnInfo);
-            }
-            boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (flatIsExit && x.getCurrent().compareTo(limitVoltage) > 0){
-                // 采集到的数据电流大于5A,上报告警信息
-                // 上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+
+        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){
+            // 采集到的数据电流大于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+        boolean peaksIsExit = peaksNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
+        if (peaksIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+            // 采集到的数据电流大于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+        boolean flatIsExit = flatNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
+        if (flatIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+            // 采集到的数据电流大于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+        boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
+        if (valleysIsExit && fpgGatherData.getCurrent().compareTo(limitVoltage) > 0){
+            // 采集到的数据电流大于5A,上报告警信息
+            leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+            leanEventWarnInfo.setWarnType("1");
+            leanEventWarnInfo.setDeviceWarnLevel("0");
+            baseMapper.insert(leanEventWarnInfo);
+        }
+    }
+
+    @Override
+    public void runTimeTriggerWarnInfo(FpgGatherData fpgGatherData, LeanEventsHost leanEventsHost) {
+        LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
+        leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
+        leanEventWarnInfo.setDeviceInformationId(fpgGatherData.getDeviceInformationId());
+        leanEventWarnInfo.setDevicePointId(fpgGatherData.getDevicePointId());
+        leanEventWarnInfo.setCreateTime(new Date());
+        // 获取MongoDB中设备的限制运行时间
+        int sumRunTime = 10;
+
+        // 根据辅设备ID、事件ID、限制类型,获取精益时间配置关联信息
+        LambdaQueryWrapper<LeanEventsHostConfig> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(LeanEventsHostConfig::getDeviceInformationListId, fpgGatherData.getDeviceInformationId())
+                .eq(LeanEventsHostConfig::getEventsId, leanEventsHost.getEventsId()).eq(LeanEventsHostConfig::getLimitType, "0");
+        LeanEventsHostConfig leanEventsHostConfig = leanEventsHostConfigService.list(queryWrapper).stream().findFirst().orElse(null);
+        if (leanEventsHostConfig != null){
+            // 判断MongoDB中的累加运行时长是否大于 LeanEventsHostConfig中的限制时长
+            int runTimeLimit = Integer.parseInt(leanEventsHostConfig.getRunTime());
+            if (sumRunTime > runTimeLimit){
+                // 累加运行时长超过限制时长,触发告警
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_ING_TIME,累计运行时长超过限制时长,触发精益事件告警!");
                 leanEventWarnInfo.setWarnType("1");
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 baseMapper.insert(leanEventWarnInfo);
             }
-            boolean valleysIsExit = valleysNewPeaksAndValleysTimeConfigList.stream().anyMatch(a -> containsCreateTime(localDateTime, a.getStartTime(), a.getEndTime()));
-            if (valleysIsExit && x.getCurrent().compareTo(limitVoltage) > 0){
-                // 采集到的数据电流大于5A,上报告警信息
-                // 上报告警信息
-                leanEventWarnInfo.setDeviceWarnInfo("FPG_CLOSE状态下,采集到的数据电流大于5A,触发精益事件告警!");
+        }
+
+    }
+
+    @Override
+    public void powerLimitTriggerWarnInfo(FpgGatherData fpgGatherData, LeanEventsHost leanEventsHost) {
+        LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
+        leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
+        leanEventWarnInfo.setDeviceInformationId(fpgGatherData.getDeviceInformationId());
+        leanEventWarnInfo.setDevicePointId(fpgGatherData.getDevicePointId());
+        leanEventWarnInfo.setCreateTime(new Date());
+        // 获取MongoDB中设备的功率限制
+        int sumPowerLimit = 10;
+
+        // 根据辅设备ID、事件ID、限制类型,获取精益时间配置关联信息
+        LambdaQueryWrapper<LeanEventsHostConfig> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(LeanEventsHostConfig::getDeviceInformationListId, fpgGatherData.getDeviceInformationId())
+                .eq(LeanEventsHostConfig::getEventsId, leanEventsHost.getEventsId()).eq(LeanEventsHostConfig::getLimitType, "1");
+        LeanEventsHostConfig leanEventsHostConfig = leanEventsHostConfigService.list(queryWrapper).stream().findFirst().orElse(null);
+        if (leanEventsHostConfig != null){
+            // 判断MongoDB中的累加功率限制是否大于 LeanEventsHostConfig中的功率限制
+            int powerLimit = Integer.parseInt(leanEventsHostConfig.getPowerLimit());
+            if (sumPowerLimit > powerLimit){
+                // 累加运行时长超过限制时长,触发告警
+                leanEventWarnInfo.setDeviceWarnInfo("事件类型为FPG_POWER_LIMIT,累计功率超过功率限制,触发精益事件告警!");
                 leanEventWarnInfo.setWarnType("1");
                 leanEventWarnInfo.setDeviceWarnLevel("0");
                 baseMapper.insert(leanEventWarnInfo);
             }
-        });
+        }
+
+
     }
 
     /**

+ 19 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/leanEventWarn/service/impl/LeanEventsHostConfigServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.leanEventWarn.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import org.jeecg.modules.leanEventWarn.entity.LeanEventsHostConfig;
+import org.jeecg.modules.leanEventWarn.mapper.LeanEventsHostConfigMapper;
+import org.jeecg.modules.leanEventWarn.service.ILeanEventsHostConfigService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description: 精益事件配置关联表
+ * @Author: jeecg-boot
+ * @Date:   2024-10-30
+ * @Version: V1.0
+ */
+@Service
+public class LeanEventsHostConfigServiceImpl extends ServiceImpl<LeanEventsHostConfigMapper, LeanEventsHostConfig> implements ILeanEventsHostConfigService {
+
+}

+ 0 - 77
jeecg-module-gather/src/main/java/org/jeecg/modules/watch/OpcGatherWatch.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.common.enums.EDeviceInformationType;
 import org.jeecg.modules.dataRepository.entity.PointData;
 import org.jeecg.modules.device.entity.DeviceInformation;
 import org.jeecg.modules.device.service.IDeviceInformationService;
@@ -13,16 +12,11 @@ import org.jeecg.modules.devicePoint.entity.DevicePoint;
 import org.jeecg.modules.devicePoint.service.IDevicePointService;
 import org.jeecg.modules.gatherData.entity.FpgGatherData;
 import org.jeecg.modules.gatherData.service.IFpgGatherDataService;
-import org.jeecg.modules.events.entity.LeanEventsHost;
-import org.jeecg.modules.events.service.ILeanEventsHostService;
-import org.jeecg.modules.leanEventWarn.service.ILeanEventWarnInfoService;
 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.Scheduled;
 import org.springframework.stereotype.Component;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -43,15 +37,6 @@ public class OpcGatherWatch {
 
     @Autowired
     MongoTemplate mongoTemplate;
-
-    @Autowired
-    RedisTemplate redisTemplate;
-
-    @Autowired
-    ILeanEventsHostService leanEventsHostService;
-
-    @Autowired
-    ILeanEventWarnInfoService leanEventWarnInfoService;
     // 采集频率设置值(数据库字典匹配,否则不执行查询不到设备)
     @Scheduled(fixedDelay = 500)
     public void t1(){
@@ -133,19 +118,6 @@ public class OpcGatherWatch {
                         mongoTemplate.insert(new PointData(opcPoint, freq, readText, curentDate),  opcPoint.getId());
                         //更新数据库点位信息
                         devicePointService.updateById(opcPoint);
-                        // 存入采集设备
-                        FpgGatherData fpgGatherData = new FpgGatherData();
-                        fpgGatherData.setDeviceInformationId(opcConn.getId()); // 设备ID
-                        fpgGatherData.setDeviceRegionId(opcConn.getDeviceRegionId()); // 区域id
-                        fpgGatherData.setDevicePointId(opcPoint.getId()); // 采集点ID
-                        fpgGatherData.setCreateTime(curentDate); // 创建时间
-                        fpgGatherDataService.addC(fpgGatherData);
-                        if(oConvertUtils.isEmpty(opcConn.getId())){
-                            return;
-                        }
-                        String deviceInformationId = opcConn.getId();
-                        // 告警信息上报处理
-                        leanEventsHostTriggerWarnHandle(fpgGatherData, deviceInformationId);
                     }
                 }
             } catch (Exception e) {
@@ -160,53 +132,4 @@ public class OpcGatherWatch {
             }
         });
     }
-
-    /**
-     * 根据采集过来的数据、运行电流、精益事件配置(设备开启、设备关闭、FPG开启、FPG关闭《峰平谷的时间区间配置》),来触发告警信息,并保存
-     * @param fpgGatherData
-     * @param deviceInformationId
-     */
-    public void leanEventsHostTriggerWarnHandle(FpgGatherData fpgGatherData, String deviceInformationId){
-        String keyMainString = String.format("sys:opcData:syn::%s:%s", "leanEventsHost","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(deviceInformationId));
-            if (exists){
-                // 根据主设备ID查询多条精益事件设备启停信息 处理事件类型为host_open、host_stop
-                LambdaQueryWrapper<LeanEventsHost> queryLeanEventsHost = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getDeviceInformationId, deviceInformationId).isNotNull(LeanEventsHost::getDeviceInformationType);
-                List<LeanEventsHost> leanEventsHostList =  leanEventsHostService.list(queryLeanEventsHost);
-                leanEventsHostList.forEach(y ->{
-                    // 事件类型为host_stop、host_open,fpg_open、fpg_close
-                    if (EDeviceInformationType.HOST_OPEN.getCode().equals(y.getDeviceInformationType())){
-                        leanEventWarnInfoService.openDeviceTriggerWarnInfo(y.getDeviceInformationList(), fpgGatherData);
-                    }
-                    if (EDeviceInformationType.HOST_STOP.getCode().equals(y.getDeviceInformationType())){
-                        leanEventWarnInfoService.stopDeviceTriggerWarnInfo(y.getDeviceInformationList(), fpgGatherData);
-                    }
-                });
-            }
-        }
-        // 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(deviceInformationId));
-            if (exists){
-                // 根据辅设备ID模糊查询多条关于FPG精益事件设备启停信息 处理事件类型为fpg_open、fpg_close
-                List<LeanEventsHost> leanEventsHostList = leanEventsHostService.getFpgLeanEventsHostList(deviceInformationId);
-                leanEventsHostList.forEach(s ->{
-                    // 事件类型为fpg_open、fpg_close
-                    if (EDeviceInformationType.FPG_OPEN.getCode().equals(s.getDeviceInformationType())){
-                        leanEventWarnInfoService.openFpgTriggerWarnInfo(s.getDeviceInformationList(), fpgGatherData);
-                    }
-                    if (EDeviceInformationType.FPG_CLOSE.getCode().equals(s.getDeviceInformationType())){
-                        leanEventWarnInfoService.closeFpgTriggerWarnInfo(s.getDeviceInformationList(), fpgGatherData);
-                    }
-                });
-            }
-        }
-    }
 }