Browse Source

宁夏分公司代码修改

shilin 2 months ago
parent
commit
c3fbf6c83b

+ 17 - 0
alarm-service/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmConfigurationaiMapper.java

@@ -0,0 +1,17 @@
+package com.gyee.alarm.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.ProEconAlarmConfigurationai;
+
+/**
+ * <p>
+ * 报警配置表 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-06-19
+ */
+public interface ProEconAlarmConfigurationaiMapper extends BaseMapper<ProEconAlarmConfigurationai> {
+
+}

+ 125 - 0
alarm-service/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmConfigurationai.java

@@ -0,0 +1,125 @@
+package com.gyee.alarm.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 报警配置表
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-06-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconAlarmConfigurationai extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 测点(如果根据uniformcode配置此字段可为空)
+     */
+    private String tagId;
+
+    /**
+     * 报警类别,0触发,1触发,-1变化触发,4ai点触发
+     */
+    private Integer triggerType;
+
+    /**
+     * 设备ID
+     */
+    private String deviceId;
+
+    /**
+     * 后缀
+     */
+    private String suffix;
+
+    /**
+     * 报警级别
+     */
+    private Integer rank;
+
+    /**
+     * 统一识别码(如果通过uniformCode配置,则设备类型,场站,机型不能为空)
+     */
+    private String uniformCode;
+
+    /**
+     * 场站ID
+     */
+    private String stationId;
+
+    /**
+     * 机型
+     */
+    private String modelId;
+
+    /**
+     * 报警类型 /自定义报警 custom,风机 windturbine,场站 station,升压站 booststation
+     */
+    private String alarmType;
+
+    /**
+     * 设备类型,场站 station,风机 windturbine,升压站 booststation
+     */
+    private String deviceType;
+
+    /**
+     * 设备部件
+     */
+    private String components;
+
+    /**
+     * 设备子部件
+     */
+    private String subcomponents;
+
+    /**
+     * 报警描述
+     */
+    private String description;
+
+    /**
+     * 特性
+     */
+    private String characteristic;
+
+    /**
+     * 是否可复位
+     */
+    private Boolean resetTable;
+
+    /**
+     * 是否启用
+     */
+    private Boolean enable;
+
+    /**
+     * 故障名称
+     */
+    private String name;
+
+    /**
+     *故障码
+     */
+    private String nemCode;
+
+    /**
+     * 故障原因
+     */
+    private String faultCause;
+
+    /**
+     * 排查方法
+     */
+    private String resolvent;
+}

+ 69 - 1
alarm-service/src/main/java/com/gyee/alarm/service/AlarmInService.java

@@ -135,7 +135,75 @@ public class AlarmInService {
                     if (!alarmls.isEmpty()) {
 //                        System.out.println(wt.getId());
                         for (ProEconAlarmConfiguration alarm : alarmls) {
-                            if (pointMap.containsKey(alarm.getUniformCode())) {
+                            if (pointMap.containsKey(alarm.getUniformCode()) && alarm.getDeviceId().equals(wt.getId())) {
+                                ProBasicEquipmentPoint equipmentPoint = pointMap.get(alarm.getUniformCode());
+
+                                if(StringUtils.notEmp(initialcode) &&
+                                        StringUtils.notEmp(equipmentPoint.getNemCode()) &&
+                                        !equipmentPoint.getNemCode().equals(initialcode) &&
+                                        alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())
+                                )
+
+
+                                {
+
+//                                    System.out.println("ok");
+                                    AlarmVo vo=new AlarmVo();
+                                    StringBuilder tbName = new StringBuilder();
+                                    tbName.append(wt.getId()).append("_").append(alarm.getId());
+                                    vo.setTbName(String.valueOf(tbName));
+                                    vo.setAlarmid(alarm.getId());
+                                    vo.setTagid(equipmentPoint.getNemCode());
+                                    vo.setAlarmtype(alarm.getAlarmType());
+                                    vo.setCharacteristic(alarm.getCharacteristic());
+                                    vo.setComponents(alarm.getComponents());
+                                    vo.setDescription(alarm.getDescription());
+                                    vo.setDeviceid(wt.getId());
+                                    vo.setDevicename(wt.getName());
+                                    vo.setDevicetype(alarm.getDeviceType());
+                                    vo.setEnabled(alarm.getEnable());
+                                    vo.setLineid(wt.getLineId());
+                                    if(CacheContext.lnmap.containsKey(wt.getLineId()))
+                                    {
+                                        ProBasicLine ln=CacheContext.lnmap.get(wt.getLineId());
+                                        vo.setLinename(ln.getName());
+                                    }
+                                    vo.setModelId(wt.getModelId());
+                                    vo.setProjectid(wt.getProjectId());
+                                    if(CacheContext.pjmap.containsKey(wt.getProjectId()))
+                                    {
+                                        ProBasicProject pj=CacheContext.pjmap.get(wt.getProjectId());
+                                        vo.setProjectname(pj.getName());
+                                    }
+                                    vo.setRank(alarm.getRank());
+                                    vo.setResettable(alarm.getResetTable());
+                                    vo.setStationid(wt.getWindpowerstationId());
+                                    if(CacheContext.wpmap.containsKey(wt.getWindpowerstationId()))
+                                    {
+                                        ProBasicPowerstation wp=CacheContext.wpmap.get(wt.getWindpowerstationId());
+                                        vo.setStationname(wp.getName());
+                                    }
+                                    vo.setSubcomponents(alarm.getSubcomponents());
+                                    vo.setSuffix(alarm.getSuffix());
+                                    vo.setTriggertype(alarm.getTriggerType());
+                                    vo.setUniformcode(alarm.getUniformCode());
+                                    vo.setSuperTableName(AlarmSuperTalbeType.WT.getCode());
+                                    vo.setFaultType(alarm.getDeviceId());
+                                    vo.setAname(alarm.getSuffix());
+//                                    PointData temp=edosUtil.getRealData(equipmentPoint.getNemCode());
+//                                    vo.setVal((int)temp.getPointValueInDouble());
+//                                    vo.setOval((int)temp.getPointValueInDouble());
+
+                                    vo.setVal(null);
+                                    vo.setOval(null);
+                                    vo.setName(alarm.getName());
+                                    vo.setNemCode(alarm.getNemCode());
+                                    vo.setFaultCause(alarm.getFaultCause());
+                                    vo.setResolvent(alarm.getResolvent());
+                                    alarmVoList.add(vo);
+                                }
+
+                            }else if (pointMap.containsKey(alarm.getUniformCode()) && StringUtils.empty(alarm.getDeviceId())) {
                                 ProBasicEquipmentPoint equipmentPoint = pointMap.get(alarm.getUniformCode());
 
                                 if(StringUtils.notEmp(initialcode) &&

+ 62 - 0
alarm-service/src/main/java/com/gyee/alarm/service/AlarmWtService.java

@@ -251,6 +251,68 @@ public class AlarmWtService {
                                     alarmVoList.add(vo);
                                 }
 
+                            }else if (pointMap.containsKey(alarm.getUniformCode()) && StringUtils.empty(alarm.getDeviceId())) {
+                                ProBasicEquipmentPoint equipmentPoint = pointMap.get(alarm.getUniformCode());
+
+                                if (StringUtils.notEmp(initialcode) &&
+                                        StringUtils.notEmp(equipmentPoint.getNemCode()) &&
+                                        !equipmentPoint.getNemCode().equals(initialcode) &&
+                                        alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())
+                                ) {
+
+//                                    System.out.println("ok");
+                                    AlarmVo vo = new AlarmVo();
+                                    StringBuilder tbName = new StringBuilder();
+                                    tbName.append(wt.getId()).append("_").append(alarm.getId());
+                                    vo.setTbName(String.valueOf(tbName));
+                                    vo.setAlarmid(alarm.getId());
+                                    vo.setTagid(equipmentPoint.getNemCode());
+                                    vo.setAlarmtype(alarm.getAlarmType());
+                                    vo.setCharacteristic(alarm.getCharacteristic());
+                                    vo.setComponents(alarm.getComponents());
+                                    vo.setDescription(alarm.getDescription());
+                                    vo.setDeviceid(wt.getId());
+                                    vo.setDevicename(wt.getName());
+                                    vo.setDevicetype(alarm.getDeviceType());
+                                    vo.setEnabled(alarm.getEnable());
+                                    vo.setLineid(wt.getLineId());
+                                    if (CacheContext.lnmap.containsKey(wt.getLineId())) {
+                                        ProBasicLine ln = CacheContext.lnmap.get(wt.getLineId());
+                                        vo.setLinename(ln.getName());
+                                    }
+                                    vo.setModelId(wt.getModelId());
+                                    vo.setProjectid(wt.getProjectId());
+                                    if (CacheContext.pjmap.containsKey(wt.getProjectId())) {
+                                        ProBasicProject pj = CacheContext.pjmap.get(wt.getProjectId());
+                                        vo.setProjectname(pj.getName());
+                                    }
+                                    vo.setRank(alarm.getRank());
+                                    vo.setResettable(alarm.getResetTable());
+                                    vo.setStationid(wt.getWindpowerstationId());
+                                    if (CacheContext.wpmap.containsKey(wt.getWindpowerstationId())) {
+                                        ProBasicPowerstation wp = CacheContext.wpmap.get(wt.getWindpowerstationId());
+                                        vo.setStationname(wp.getName());
+                                    }
+                                    vo.setSubcomponents(alarm.getSubcomponents());
+                                    vo.setSuffix(alarm.getSuffix());
+                                    vo.setTriggertype(alarm.getTriggerType());
+                                    vo.setUniformcode(alarm.getUniformCode());
+                                    vo.setSuperTableName(AlarmSuperTalbeType.WT.getCode());
+                                    vo.setFaultType(alarm.getDeviceId());
+                                    vo.setAname(alarm.getSuffix());
+//                                    PointData temp=edosUtil.getRealData(equipmentPoint.getNemCode());
+//                                    vo.setVal((int)temp.getPointValueInDouble());
+//                                    vo.setOval((int)temp.getPointValueInDouble());
+
+                                    vo.setVal(null);
+                                    vo.setOval(null);
+                                    vo.setName(alarm.getName());
+                                    vo.setNemCode(alarm.getNemCode());
+                                    vo.setFaultCause(alarm.getFaultCause());
+                                    vo.setResolvent(alarm.getResolvent());
+                                    alarmVoList.add(vo);
+                                }
+
                             }
 
                         }

+ 17 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmConfigurationaiService.java

@@ -0,0 +1,17 @@
+package com.gyee.alarm.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.ProEconAlarmConfigurationai;
+
+/**
+ * <p>
+ * 报警配置表 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-06-19
+ */
+public interface IProEconAlarmConfigurationaiService extends IService<ProEconAlarmConfigurationai> {
+
+}

+ 23 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmConfigurationaiServiceImpl.java

@@ -0,0 +1,23 @@
+package com.gyee.alarm.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.alarm.mapper.auto.ProEconAlarmConfigurationMapper;
+import com.gyee.alarm.mapper.auto.ProEconAlarmConfigurationaiMapper;
+import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.ProEconAlarmConfigurationai;
+import com.gyee.alarm.service.auto.IProEconAlarmConfigurationService;
+import com.gyee.alarm.service.auto.IProEconAlarmConfigurationaiService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 报警配置表 服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-06-19
+ */
+@Service
+public class ProEconAlarmConfigurationaiServiceImpl extends ServiceImpl<ProEconAlarmConfigurationaiMapper, ProEconAlarmConfigurationai> implements IProEconAlarmConfigurationaiService {
+
+}

+ 1 - 1
alarm-web/src/main/java/com/gyee/alarm/controller/AlarmConfigurationController.java

@@ -154,7 +154,7 @@ public class AlarmConfigurationController {
 
                     if(CacheContext.wtmap.containsKey(ac.getDeviceId()))
                     {
-                        vo.setDeviceName(CacheContext.wtmap.get(ac.getDeviceId()).getNemCode());
+                        vo.setDeviceName(CacheContext.wtmap.get(ac.getDeviceId()).getAname());
                     }
                     vos.add(vo);
                 }

+ 63 - 14
alarm-web/src/main/java/com/gyee/alarm/controller/AlarmHistoryController.java

@@ -3,7 +3,6 @@ package com.gyee.alarm.controller;
 import com.gyee.alarm.model.vo.*;
 import com.gyee.alarm.service.AlarmHistoryService;
 
-import com.gyee.alarm.util.DateUtils;
 import com.gyee.alarm.util.StringUtils;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -12,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -20,6 +18,7 @@ import javax.annotation.Resource;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 
@@ -30,7 +29,7 @@ import java.util.stream.Collectors;
 public class AlarmHistoryController {
 
 
-    Logger logger = LogManager.getLogger(AlarmHistoryController.class);
+    Logger logger = LogManager.getLogger(AlarmHistoryNXFController.class);
 
     @Resource
     private AlarmHistoryService alarmHistoryService;
@@ -44,7 +43,7 @@ public class AlarmHistoryController {
     public AjaxResult updateAlarms(@RequestBody List<AlarmTag> tagLs) throws Exception {
 
 
-       alarmHistoryService.updateAlarms(tagLs);
+        alarmHistoryService.updateAlarms(tagLs);
         return AjaxResult.successData(AjaxStatus.success.code, "ok");
 
     }
@@ -97,7 +96,7 @@ public class AlarmHistoryController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "type", value = "报警类型 booststation:升压站报警,windturbine:设备报警,custom:自定义报警", required = true, dataType = "string", paramType = "query")
     })
-   public AjaxResult findAlarmByTypelist(String type) throws Exception {
+    public AjaxResult findAlarmByTypelist(String type) throws Exception {
 
 
         List<AlarmVo> ls = alarmHistoryService.findAlarmByTypelist(type);
@@ -117,9 +116,12 @@ public class AlarmHistoryController {
             @ApiImplicitParam(name = "components", value = "部件编号", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "alarmIds", value = "报警编号集合", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "alarmType", value = "报警类型 booststation:升压站报警,windturbine:设备报警", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query")
-           })
-    public List<Map.Entry<String, List<AlarmStatVo>>> findWtFeatureStat(
+            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "pageNum", value = "页号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "pageSize", value = "每页显示行数", required = true, dataType = "string", paramType = "query")})
+
+
+    public   Map<String,Object> findWtFeatureStat(
 
             @RequestParam(value = "begin", required = true) String begin,
             @RequestParam(value = "end", required = true) String end,
@@ -128,7 +130,9 @@ public class AlarmHistoryController {
             @RequestParam(value = "components", required = false) String components,
             @RequestParam(value = "alarmIds", required = false) String alarmIds,
             @RequestParam(value = "alarmType", required = false) String alarmType,
-            @RequestParam(value = "timeType", required = false) String timeType
+            @RequestParam(value = "timeType", required = false) String timeType,
+            @RequestParam(value = "pageNum", required = true) Integer pageNum,
+            @RequestParam(value = "pageSize", required = true) Integer pageSize
     ) throws ParseException {
 
 
@@ -159,10 +163,37 @@ public class AlarmHistoryController {
         Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getWindturbineId));
 
         Map<String, List<AlarmStatVo>> resultMap = new TreeMap<>();
+        int max=0;
+
+
 
         for (Map.Entry<String, List<AlarmStatVo>> entry : alarmStatMapGroupbyWindturbineId.entrySet()) {
             String windturbineId = entry.getKey();
-            resultMap.put(windturbineId, entry.getValue());
+
+            if(StringUtils.empty(pageNum))
+            {
+                pageNum=1;
+            }
+            if(StringUtils.empty(pageSize))
+            {
+                pageSize=15;
+            }
+
+
+
+
+            List<AlarmStatVo> distinctList = entry.getValue().stream()
+                    .collect(Collectors.toMap(AlarmStatVo::getAlertText, Function.identity(), (existing, replacement) -> existing))
+                    .values()
+                    .stream()
+                    .collect(Collectors.toList());
+            // 获取分页数据
+            List<AlarmStatVo> pagedData = getPagedData(distinctList, pageSize, pageNum);
+            resultMap.put(windturbineId, pagedData);
+            if(distinctList.size()>max)
+            {
+                max=distinctList.size();
+            }
         }
 
         //根据风机编号进行排序
@@ -170,17 +201,35 @@ public class AlarmHistoryController {
         Collections.sort(list, new Comparator<Map.Entry<String, List<AlarmStatVo>>>() {
             @Override
             public int compare(Map.Entry<String, List<AlarmStatVo>> o1, Map.Entry<String, List<AlarmStatVo>> o2) {
-               String key1=o1.getKey();
-               String key2=o1.getKey();
-               return key1.compareTo(key2);
+                String key1=o1.getKey();
+                String key2=o1.getKey();
+                return key1.compareTo(key2);
             }
         });
 
-        return list;
 
+        Map<String,Object> result =new HashMap<>();
+        result.put("total",max);
+        result.put("result",list);
+
+//        return list;
+        return result;
 
     }
+    public  List<AlarmStatVo> getPagedData(List<AlarmStatVo> dataList, int pageSize, int pageNumber) {
+        // 计算起始索引
+        int fromIndex = (pageNumber - 1) * pageSize;
+        // 计算结束索引
+        int toIndex = Math.min(fromIndex + pageSize, dataList.size());
+
+        // 检查起始索引是否超出范围
+        if (fromIndex >= dataList.size() || fromIndex < 0) {
+            return new ArrayList<>(); // 返回空列表
+        }
 
+        // 返回分页数据
+        return dataList.subList(fromIndex, toIndex);
+    }
 
     @GetMapping(value = "/history/findCtFeatureStat")
     @ApiOperation(value = "查询自定义报警类型、报警时长、报警次数", notes = "查询报警类型、报警时长、报警次数")

+ 506 - 0
alarm-web/src/main/java/com/gyee/alarm/controller/AlarmHistoryNXFController.java

@@ -0,0 +1,506 @@
+package com.gyee.alarm.controller;
+
+import com.gyee.alarm.model.vo.*;
+import com.gyee.alarm.service.AlarmHistoryService;
+
+import com.gyee.alarm.util.StringUtils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Slf4j
+@RestController
+@RequestMapping("/alarm")
+@CrossOrigin
+public class AlarmHistoryNXFController {
+
+
+    Logger logger = LogManager.getLogger(AlarmHistoryNXFController.class);
+
+    @Resource
+    private AlarmHistoryService alarmHistoryService;
+
+
+    @PostMapping(value = "/history/updateAlarms")
+    @ApiOperation(value = "确认报警", notes = "确认报警")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "tagLs", value = "需要确认的报警", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult updateAlarms(@RequestBody List<AlarmTag> tagLs) throws Exception {
+
+
+        alarmHistoryService.updateAlarms(tagLs);
+        return AjaxResult.successData(AjaxStatus.success.code, "ok");
+
+    }
+
+    @GetMapping(value = "/history/findAlarmlist")
+    @ApiOperation(value = "报警信息查询", notes = "报警信息查询")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmType", value = "报警类型 booststation:升压站报警,windturbine:设备报警,custom:自定义报警", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "stationid", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceid", value = "设备编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "description", value = "描述", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceType", value = "报警类型 booststation:升压站报警,windturbine:设备报警", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmId", value = "报警编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "isclose", value = "是否完成 不传全查,true 完成的,false 没完成的", required = false, dataType = "Boolean", paramType = "query"),
+            @ApiImplicitParam(name = "pageNum", value = "页号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "pageSize", value = "每页显示行数", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult findAlarmlist(
+            @RequestParam(value = "begin", required = true) String begin,
+            @RequestParam(value = "end", required = true) String end,
+            @RequestParam(value = "alarmType", required = false) String alarmType,
+            @RequestParam(value = "stationid", required = false) String stationid,
+            @RequestParam(value = "deviceid", required = false) String deviceid,
+            @RequestParam(value = "description", required = false) String description,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "deviceType", required = false) String deviceType,
+            @RequestParam(value = "components", required = false) String components,
+            @RequestParam(value = "alarmId", required = false) String alarmId,
+            @RequestParam(value = "isclose", required = false) Boolean isclose,
+            @RequestParam(value = "pageNum", required = true) Integer pageNum,
+            @RequestParam(value = "pageSize", required = true) Integer pageSize
+
+    ) throws Exception {
+
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date beginDate = df.parse(begin);
+        Date endDate = df.parse(end);
+        pageNum=pageNum-1;
+        Map<String,Object> map = alarmHistoryService.findAlarmlist(modelId,beginDate.getTime(), endDate.getTime(), alarmType, stationid,deviceid, description,deviceType,components,alarmId,isclose, pageNum, pageSize);
+        return AjaxResult.successData(AjaxStatus.success.code, map);
+
+    }
+
+    @GetMapping(value = "/history/findAlarmByTypelist")
+    @ApiOperation(value = "获取升压站、设备、自定义报警报警信息查询", notes = "报警信息查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "报警类型 booststation:升压站报警,windturbine:设备报警,custom:自定义报警", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult findAlarmByTypelist(String type) throws Exception {
+
+
+        List<AlarmVo> ls = alarmHistoryService.findAlarmByTypelist(type);
+        return AjaxResult.successData(AjaxStatus.success.code, ls);
+
+    }
+
+
+    @GetMapping(value = "/history/findWtFeatureStat")
+    @ApiOperation(value = "查询原始报警类型、报警时长、报警次数", notes = "查询报警类型、报警时长、报警次数")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "stationid", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmIds", value = "报警编号集合", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmType", value = "报警类型 booststation:升压站报警,windturbine:设备报警", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "pageNum", value = "页号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "pageSize", value = "每页显示行数", required = true, dataType = "string", paramType = "query")})
+
+
+    public   Map<String,Object> findWtFeatureStat(
+
+            @RequestParam(value = "begin", required = true) String begin,
+            @RequestParam(value = "end", required = true) String end,
+            @RequestParam(value = "stationid", required = true) String stId,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = false) String components,
+            @RequestParam(value = "alarmIds", required = false) String alarmIds,
+            @RequestParam(value = "alarmType", required = false) String alarmType,
+            @RequestParam(value = "timeType", required = false) String timeType,
+            @RequestParam(value = "pageNum", required = true) Integer pageNum,
+            @RequestParam(value = "pageSize", required = true) Integer pageSize
+    ) throws ParseException {
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date dtStart = sdf.parse(begin);
+        Date dtEnd = sdf.parse(end);
+
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        if(StringUtils.empty(components))
+        {
+            components=null;
+        }
+        if(StringUtils.empty(alarmIds))
+        {
+            alarmIds=null;
+        }
+        if(StringUtils.empty(alarmType))
+        {
+            alarmType=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findWtFeatureStat(stId,modelId, dtStart, dtEnd,components,alarmIds,alarmType,timeType);
+
+
+        //根据风机编号分组
+        Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getWindturbineId));
+
+        Map<String, List<AlarmStatVo>> resultMap = new TreeMap<>();
+        int max=0;
+
+
+        for (Map.Entry<String, List<AlarmStatVo>> entry : alarmStatMapGroupbyWindturbineId.entrySet()) {
+            String windturbineId = entry.getKey();
+
+            if(StringUtils.empty(pageNum))
+            {
+                pageNum=1;
+            }
+            if(StringUtils.empty(pageSize))
+            {
+                pageSize=15;
+            }
+
+            // 获取分页数据
+            List<AlarmStatVo> pagedData = getPagedData(entry.getValue(), pageSize, pageNum);
+            resultMap.put(windturbineId, pagedData);
+            if(entry.getValue().size()>max)
+            {
+                max=entry.getValue().size();
+            }
+        }
+
+        //根据风机编号进行排序
+        List<Map.Entry<String, List<AlarmStatVo>>> list = new ArrayList<>(resultMap.entrySet());
+        Collections.sort(list, new Comparator<Map.Entry<String, List<AlarmStatVo>>>() {
+            @Override
+            public int compare(Map.Entry<String, List<AlarmStatVo>> o1, Map.Entry<String, List<AlarmStatVo>> o2) {
+                String key1=o1.getKey();
+                String key2=o1.getKey();
+                return key1.compareTo(key2);
+            }
+        });
+
+
+        Map<String,Object> result =new HashMap<>();
+        result.put("total",max);
+        result.put("result",list);
+
+//        return list;
+        return result;
+
+    }
+    public  List<AlarmStatVo> getPagedData(List<AlarmStatVo> dataList, int pageSize, int pageNumber) {
+        // 计算起始索引
+        int fromIndex = (pageNumber - 1) * pageSize;
+        // 计算结束索引
+        int toIndex = Math.min(fromIndex + pageSize, dataList.size());
+
+        // 检查起始索引是否超出范围
+        if (fromIndex >= dataList.size() || fromIndex < 0) {
+            return new ArrayList<>(); // 返回空列表
+        }
+
+        // 返回分页数据
+        return dataList.subList(fromIndex, toIndex);
+    }
+
+    @GetMapping(value = "/history/findCtFeatureStat")
+    @ApiOperation(value = "查询自定义报警类型、报警时长、报警次数", notes = "查询报警类型、报警时长、报警次数")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "stationid", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceType", value = "报警类型 booststation:升压站报警,windturbine:设备报警,inverter:光伏", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmIds", value = "报警编号集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query")
+    })
+    public List<Map.Entry<String, List<AlarmStatVo>>> findCtFeatureStat(
+
+            @RequestParam(value = "begin", required = true) String begin,
+            @RequestParam(value = "end", required = true) String end,
+            @RequestParam(value = "stationid", required = true) String stId,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = true) String components,
+            @RequestParam(value = "deviceType", required = true) String deviceType,
+            @RequestParam(value = "alarmIds", required = true) String alarmIds,
+            @RequestParam(value = "timeType", required = false) String timeType
+    ) throws ParseException {
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date dtStart = sdf.parse(begin);
+        Date dtEnd = sdf.parse(end);
+
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findCtFeatureStat(stId,modelId, dtStart, dtEnd,components,deviceType,alarmIds,timeType);
+        //根据风机编号分组
+        Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getWindturbineId));
+
+        Map<String, List<AlarmStatVo>> resultMap = new TreeMap<>();
+
+        for (Map.Entry<String, List<AlarmStatVo>> entry : alarmStatMapGroupbyWindturbineId.entrySet()) {
+            String windturbineId = entry.getKey();
+            resultMap.put(windturbineId, entry.getValue());
+        }
+
+        //根据风机编号进行排序
+        List<Map.Entry<String, List<AlarmStatVo>>> list = new ArrayList<>(resultMap.entrySet());
+        Collections.sort(list, new Comparator<Map.Entry<String, List<AlarmStatVo>>>() {
+            @Override
+            public int compare(Map.Entry<String, List<AlarmStatVo>> o1, Map.Entry<String, List<AlarmStatVo>> o2) {
+                String key1=o1.getKey();
+                String key2=o1.getKey();
+                return key1.compareTo(key2);
+            }
+        });
+
+        return list;
+
+
+    }
+
+
+
+    @GetMapping(value = "/history/findCtFeatureStatByWpId")
+    @ApiOperation(value = "查询自定义报警类型、报警时长、报警次数", notes = "查询报警类型、报警时长、报警次数")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "stationid", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceType", value = "报警类型 booststation:升压站报警,windturbine:设备报警,inverter:光伏", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmIds", value = "报警编号集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query")
+    })
+    public List<Map.Entry<String, List<AlarmStatVo>>> findCtFeatureStatByWpId(
+
+            @RequestParam(value = "begin", required = true) String begin,
+            @RequestParam(value = "end", required = true) String end,
+            @RequestParam(value = "stationid", required = true) String stId,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = true) String components,
+            @RequestParam(value = "deviceType", required = true) String deviceType,
+            @RequestParam(value = "alarmIds", required = true) String alarmIds,
+            @RequestParam(value = "timeType", required = false) String timeType
+    ) throws ParseException {
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date dtStart = sdf.parse(begin);
+        Date dtEnd = sdf.parse(end);
+
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findCtFeatureStatByWpId(modelId, dtStart, dtEnd,components,deviceType,alarmIds,timeType);
+
+//
+//        Map<String, List<AlarmStatVo>> map=new TreeMap<>();
+//
+//        for(AlarmStatVo vo:pressureList)
+//        {
+//            if(map.containsKey(vo.getRelateParts()))
+//            {
+//                List<AlarmStatVo>
+//            }
+//        }
+        //根据风机编号分组
+        Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getStationId));
+
+        Map<String, List<AlarmStatVo>> resultMap = new TreeMap<>();
+
+        for (Map.Entry<String, List<AlarmStatVo>> entry : alarmStatMapGroupbyWindturbineId.entrySet()) {
+            String wpId = entry.getKey();
+            resultMap.put(wpId, entry.getValue());
+        }
+
+        //根据风机编号进行排序
+        List<Map.Entry<String, List<AlarmStatVo>>> list = new ArrayList<>(resultMap.entrySet());
+        Collections.sort(list, new Comparator<Map.Entry<String, List<AlarmStatVo>>>() {
+            @Override
+            public int compare(Map.Entry<String, List<AlarmStatVo>> o1, Map.Entry<String, List<AlarmStatVo>> o2) {
+                String key1=o1.getKey();
+                String key2=o1.getKey();
+                return key1.compareTo(key2);
+            }
+        });
+
+        return list;
+
+    }
+
+
+    @GetMapping(value = "/history/findCtFeatureStatByLnId")
+    @ApiOperation(value = "查询自定义报警类型、报警时长、报警次数", notes = "查询报警类型、报警时长、报警次数")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "stationid", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceType", value = "报警类型 booststation:升压站报警,windturbine:设备报警,inverter:光伏", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmIds", value = "报警编号集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query")
+    })
+    public List<Map.Entry<String, List<AlarmStatVo>>> findCtFeatureStatByLnId(
+
+            @RequestParam(value = "begin", required = true) String begin,
+            @RequestParam(value = "end", required = true) String end,
+            @RequestParam(value = "stationid", required = true) String stId,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = true) String components,
+            @RequestParam(value = "deviceType", required = true) String deviceType,
+            @RequestParam(value = "alarmIds", required = true) String alarmIds,
+            @RequestParam(value = "timeType", required = false) String timeType
+    ) throws ParseException {
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date dtStart = sdf.parse(begin);
+        Date dtEnd = sdf.parse(end);
+
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findCtFeatureStatByLnId(stId,modelId, dtStart, dtEnd,components,deviceType,alarmIds,timeType);
+
+//
+//        Map<String, List<AlarmStatVo>> map=new TreeMap<>();
+//
+//        for(AlarmStatVo vo:pressureList)
+//        {
+//            if(map.containsKey(vo.getRelateParts()))
+//            {
+//                List<AlarmStatVo>
+//            }
+//        }
+        //根据风机编号分组
+        Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getStationId));
+
+        Map<String, List<AlarmStatVo>> resultMap = new TreeMap<>();
+
+        for (Map.Entry<String, List<AlarmStatVo>> entry : alarmStatMapGroupbyWindturbineId.entrySet()) {
+            String wpId = entry.getKey();
+            resultMap.put(wpId, entry.getValue());
+        }
+
+        //根据风机编号进行排序
+        List<Map.Entry<String, List<AlarmStatVo>>> list = new ArrayList<>(resultMap.entrySet());
+        Collections.sort(list, new Comparator<Map.Entry<String, List<AlarmStatVo>>>() {
+            @Override
+            public int compare(Map.Entry<String, List<AlarmStatVo>> o1, Map.Entry<String, List<AlarmStatVo>> o2) {
+                String key1=o1.getKey();
+                String key2=o1.getKey();
+                return key1.compareTo(key2);
+            }
+        });
+
+        return list;
+
+    }
+
+
+
+    @GetMapping(value = "/history/findCtFeatureStatByWtId")
+    @ApiOperation(value = "查询自定义报警类型、报警时长、报警次数", notes = "查询报警类型、报警时长、报警次数")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceid", value = "设备编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件集合", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "deviceType", value = "报警类型 booststation:升压站报警,windturbine:设备报警,inverter:光伏", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "alarmIds", value = "报警编号集合", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "timeType", value = "秒、分、时(s,m,h)", required = false, dataType = "string", paramType = "query")
+    })
+    public List<Map.Entry<String, List<AlarmStatVo>>> findCtFeatureStatByWtId(
+
+            @RequestParam(value = "begin", required = true) String begin,
+            @RequestParam(value = "end", required = true) String end,
+            @RequestParam(value = "deviceid", required = true) String wtId,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = false) String components,
+            @RequestParam(value = "deviceType", required = false) String deviceType,
+            @RequestParam(value = "alarmIds", required = false) String alarmIds,
+            @RequestParam(value = "timeType", required = false) String timeType
+    ) throws ParseException {
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date dtStart = sdf.parse(begin);
+        Date dtEnd = sdf.parse(end);
+
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findCtFeatureStatByWtId(wtId,modelId, dtStart, dtEnd,components,deviceType,alarmIds,timeType);
+
+//
+//        Map<String, List<AlarmStatVo>> map=new TreeMap<>();
+//
+//        for(AlarmStatVo vo:pressureList)
+//        {
+//            if(map.containsKey(vo.getRelateParts()))
+//            {
+//                List<AlarmStatVo>
+//            }
+//        }
+        //根据风机编号分组
+        Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getStationId));
+
+        Map<String, List<AlarmStatVo>> resultMap = new TreeMap<>();
+
+        for (Map.Entry<String, List<AlarmStatVo>> entry : alarmStatMapGroupbyWindturbineId.entrySet()) {
+            String wpId = entry.getKey();
+            resultMap.put(wpId, entry.getValue());
+        }
+
+        //根据风机编号进行排序
+        List<Map.Entry<String, List<AlarmStatVo>>> list = new ArrayList<>(resultMap.entrySet());
+        Collections.sort(list, new Comparator<Map.Entry<String, List<AlarmStatVo>>>() {
+            @Override
+            public int compare(Map.Entry<String, List<AlarmStatVo>> o1, Map.Entry<String, List<AlarmStatVo>> o2) {
+                String key1=o1.getKey();
+                String key2=o1.getKey();
+                return key1.compareTo(key2);
+            }
+        });
+
+        return list;
+
+    }
+}
+
+
+
+

+ 1 - 1
alarm-web/src/main/java/com/gyee/alarm/service/AlarmConfigurationService.java

@@ -86,7 +86,7 @@ public class AlarmConfigurationService {
         }
 
 
-//        proEconAlarmConfigurationService.inital(alarmRule);
+   //     proEconAlarmConfigurationService.inital(alarmRule);
 
         return result;
     }

+ 13 - 1
alarm-web/src/main/java/com/gyee/alarm/service/AlarmHistoryService.java

@@ -368,6 +368,11 @@ public class AlarmHistoryService   {
             {
                 vo.setComponents(CacheContext.alarmTypeMap.get(vo.getComponents()).getName());
             }
+            if(CacheContext.alarmMap.containsKey(vo.getAlarmId()))
+            {
+                vo.setComponents(CacheContext.alarmMap.get(vo.getAlarmId()).getDescription());
+            }
+
         }
 
 
@@ -579,7 +584,7 @@ public class AlarmHistoryService   {
             if(CacheContext.wtmap.containsKey(fs.getWtId()))
             {
                 ProBasicEquipment wt= CacheContext.wtmap.get(fs.getWtId());
-                d.setWindturbineCode(wt.getNemCode());
+                d.setWindturbineCode(wt.getAname());
             }
 
             StringBuilder sb=new StringBuilder();
@@ -808,6 +813,13 @@ public class AlarmHistoryService   {
                 d.setWindturbineCode(wt.getNemCode());
             }
 
+            if(CacheContext.wtmap.containsKey(fs.getWtId()))
+            {
+                ProBasicEquipment wt= CacheContext.wtmap.get(fs.getWtId());
+                d.setCode(wt.getAname());
+            }
+
+
 //            StringBuilder sb=new StringBuilder();
 //            sb.append(fs.getWtId()).append("_").append(fs.getTypeCode()).append("_").append(fs.getAlarmid());
 //

+ 22 - 1
alarm-web/src/main/java/com/gyee/alarm/service/AlarmRuleService.java

@@ -185,7 +185,28 @@ public class AlarmRuleService {
             }
 
             //同步内存和实时数据库新建测点
-//            proEconAlarmRuleService.inital(alarmRule);
+
+            // 设置最大重试次数
+            int maxRetries = 6;
+            int retries = 0;
+
+            while (retries < maxRetries) {
+                try {
+                    // 尝试执行可能会抛出异常的操作
+                    proEconAlarmRuleService.inital(alarmRule);
+                    System.out.println("操作成功!");
+                    break; // 如果操作成功,跳出循环
+                } catch (Exception e) {
+                    retries++;
+                    System.out.println("操作失败,正在重试...(" + retries + "次尝试)");
+                    if (retries >= maxRetries) {
+                        System.out.println("已达到最大重试次数,程序终止。");
+                        break; // 如果达到最大重试次数,跳出循环
+                    }
+                }
+            }
+
+//
 
             proEconAlarmPlanService.updatePlanlistById(alarmRule.getId(), alarmRule.getAlarmPlan());
         }