shilin пре 1 година
родитељ
комит
506d586400

+ 26 - 0
alarm-web/src/main/java/com/gyee/alarm/config/CorsConfig.java

@@ -0,0 +1,26 @@
+package com.gyee.alarm.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @ClassName : CorsConfig
+ * @Author : xieshengjie
+ * @Date: 2021/6/28 20:00
+ * @Description :
+ */
+@Configuration
+public class CorsConfig implements WebMvcConfigurer {
+
+    static final String[] ORIGINS = new String[]{"GET", "POST", "PUT", "DELETE"};  //请求方式
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**") //所有的当前站点的请求地址,都支持跨域访问
+                .allowedOrigins("*")// 所有的外部域都可跨域访问,这里注意2.4.0以后是allowedOriginPatterns,以前是allowedOrigins
+                .allowCredentials(true)  //是否支持跨域用户凭证
+                .allowedMethods(ORIGINS) //当前站点支持的跨域请求类型是什么
+                .maxAge(3600);  //超是时长,单位为秒。
+    }
+}

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

@@ -39,7 +39,30 @@ public class AlarmConfigurationController {
     @Autowired
     private AlarmConfigurationService alarmConfigurationService;
 
+    @GetMapping(value = "/querywtalarmdesclist")
+    @ApiOperation(value = "通过场站、型号和部件查询报警描述信息", notes = "通过场站、型号和部件查询报警描述信息")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult queryWtAlarmDescList(String wpId, String modelId,String components) {
+
+        List<AlarmConfigurationVo> vos=new ArrayList<>();
+
+        if (StringUtils.notEmp(wpId) && StringUtils.notEmp(modelId) && StringUtils.notEmp(components)) {
+
+            vos= alarmConfigurationService.queryWtAlarmDescList(wpId, modelId,components);
+
+        }
+
+        if (StringUtils.notEmp(vos)) {
 
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
+        }
+    }
 
     //@UserLoginToken
     @PostMapping(value = "/save")

+ 27 - 20
alarm-web/src/main/java/com/gyee/alarm/controller/AlarmHistoryController.java

@@ -7,6 +7,7 @@ import com.gyee.alarm.model.vo.AlarmVo;
 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;
 import io.swagger.annotations.ApiOperation;
@@ -72,6 +73,7 @@ public class AlarmHistoryController {
         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, pageNum, pageSize);
         return AjaxResult.successData(AjaxStatus.success.code, map);
 
@@ -98,34 +100,32 @@ public class AlarmHistoryController {
             @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 = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "components", 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 = "alarmIds", value = "报警编号集合", required = true, dataType = "string", paramType = "query")
            })
     public List<Map.Entry<String, List<AlarmStatVo>>> 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 = true) String modelId,
-            @RequestParam(value = "components", required = true) String components
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = true) String components,
+            @RequestParam(value = "alarmIds", required = true) String alarmIds
     ) throws ParseException {
 
 
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date dtStart = sdf.parse(begin);
         Date dtEnd = sdf.parse(end);
-        List<AlarmStatVo> pressureList = alarmHistoryService.findWtFeatureStat(stId,modelId, dtStart, dtEnd,components);
 
-//
-//        Map<String, List<AlarmStatVo>> map=new TreeMap<>();
-//
-//        for(AlarmStatVo vo:pressureList)
-//        {
-//            if(map.containsKey(vo.getRelateParts()))
-//            {
-//                List<AlarmStatVo>
-//            }
-//        }
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findWtFeatureStat(stId,modelId, dtStart, dtEnd,components,alarmIds);
+
+
         //根据风机编号分组
         Map<String, List<AlarmStatVo>> alarmStatMapGroupbyWindturbineId = pressureList.stream().collect(Collectors.groupingBy(AlarmStatVo::getWindturbineId));
 
@@ -160,23 +160,30 @@ public class AlarmHistoryController {
             @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 = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "description", 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 = "alarmIds", value = "报警编号集合", required = true, 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 = true) String modelId,
-            @RequestParam(value = "description", required = true) String description
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "components", required = true) String components,
+            @RequestParam(value = "alarmIds", required = true) String alarmIds
     ) throws ParseException {
 
 
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date dtStart = sdf.parse(begin);
         Date dtEnd = sdf.parse(end);
-        List<AlarmStatVo> pressureList = alarmHistoryService.findCtFeatureStat(stId,modelId, dtStart, dtEnd,description);
+
+        if(StringUtils.empty(modelId))
+        {
+            modelId=null;
+        }
+        List<AlarmStatVo> pressureList = alarmHistoryService.findCtFeatureStat(stId,modelId, dtStart, dtEnd,components,alarmIds);
 
 //
 //        Map<String, List<AlarmStatVo>> map=new TreeMap<>();

+ 28 - 0
alarm-web/src/main/java/com/gyee/alarm/controller/AlertRuleController.java

@@ -172,6 +172,9 @@ public class AlertRuleController {
         }
     }
 
+
+
+
     @GetMapping(value = "/querysubllist")
     @ApiOperation(value = "获得升压站列表信息", notes = "获得升压站列表信息")
     public AjaxResult querySublList() {
@@ -252,6 +255,31 @@ public class AlertRuleController {
         }
     }
 
+    @GetMapping(value = "/queryctalarmdesclist")
+    @ApiOperation(value = "通过场站、型号和部件查询报警描述信息", notes = "通过场站、型号和部件查询报警描述信息")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "modelId", value = "型号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "components", value = "部件", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult queryCtAlarmDescList(String wpId, String modelId,String components) {
+
+        List<AlarmConfigurationVo> vos=new ArrayList<>();
+
+        if (StringUtils.notEmp(wpId) && StringUtils.notEmp(modelId) && StringUtils.notEmp(components)) {
+
+            vos= alarmRuleService.queryCtAlarmDescList(wpId, modelId,components);
+
+        }
+
+        if (StringUtils.notEmp(vos)) {
+
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
+        }
+    }
+
     //@UserLoginToken
     @PostMapping(value = "/save")
     @ResponseBody

+ 13 - 1
alarm-web/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -172,7 +172,7 @@ public class CacheContext implements CommandLineRunner {
     public static List<ProEconAlarmConfiguration> wtalarmls = new ArrayList<>();
     public static List<ProEconAlarmConfiguration> customalarmls = new ArrayList<>();
     public static Map<String, Map<String, ProBasicStatusPoint>> pointdismap = new HashMap<>();
-
+    public static Map<String,List<ProEconAlarmRule>> ctAlarmMap=new HashMap<>();
     public static Map<String,List<ProEconAlarmConfiguration>> wtAlarmMap=new HashMap<>();
     public static Map<String,ProEconAlarmConfiguration> alarmMap=new HashMap<>();
 
@@ -623,10 +623,22 @@ public class CacheContext implements CommandLineRunner {
         {
             for(ProEconAlarmRule vo: customls)
             {
+                StringBuilder sb=new StringBuilder();
+                sb.append(vo.getStationId()).append(vo.getModelId());
                 if(StringUtils.notEmp(vo.getCategory()))
                 {
                     if(vo.getCategory().equals(AlarmCustomType.WT.getCode()))
                     {
+                        if(ctAlarmMap.containsKey(String.valueOf(sb)))
+                        {
+                            List<ProEconAlarmRule> ls=ctAlarmMap.get(String.valueOf(sb));
+                            ls.add(vo);
+                        }else
+                        {
+                            List<ProEconAlarmRule> ls=new ArrayList<>();
+                            ls.add(vo);
+                            ctAlarmMap.put(String.valueOf(sb),ls);
+                        }
                         wtCustomls.add(vo);
                     }else  if(vo.getCategory().equals(AlarmCustomType.BT.getCode()))
                     {

+ 24 - 13
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java

@@ -96,8 +96,7 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "select  last_row(ts) as lastts,ts,val,alarmid,alarmtype,characteristic,components,confirmed,description,deviceid,devicename,devicetype,enabled,lineid,linename," +
                     "modelId,projectid,projectname,rank,resettable,stationid,stationname,subcomponents,suffix,tagid,triggertype,uniformcode from #{superTableName} " ,
             "<where>" ,
-            "  ts &gt;= #{begin} ",
-            " and ts &lt;= #{end} ",
+
             "<if test='modelId != null'>",
             "and modelId= #{modelId}",
             "</if>",
@@ -117,8 +116,8 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "and stationid = #{stationid}",
             "</if>",
 
-
-            " and stationid in ('SXJ_KGDL_GJY_FDC_STA','SXJ_KGDL_DJY_FDC_STA')",
+            "and ts &gt;= #{begin}",
+            "and ts &lt;= #{end}",
             " and  confirmed = false ",
             " and  enabled = true ",
             "</where>",
@@ -128,7 +127,7 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
     List<AlarmVo> selectByWtLimit(@Param("begin")long begin,@Param("end")long end,@Param("modelId")String modelId,@Param("superTableName") String superTableName,@Param("alarmType")String alarmType,@Param("stationid")String stationid,@Param("deviceid")String deviceid,@Param("description")String description, @Param("deviceType")String deviceType, @Param("components")String components,@Param("limit")int limit, @Param("offset") int offset);
 
     @Select({"<script>",
-            "select count(*) from #{superTableName} " ,
+            "select count(tbname) from #{superTableName} " ,
             "<where>" ,
             "<if test='modelId != null'>",
             "and modelId= #{modelId}",
@@ -145,31 +144,39 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "<if test='components != null'>",
             "and components = #{components}",
             "</if>",
+            "<if test='stationid != null'>",
             "and stationid = #{stationid}",
+            "</if>",
             "and ts &gt;= #{begin}",
             "and ts &lt;= #{end}",
+            " and  confirmed = false ",
+            " and  enabled = true ",
             "</where>",
-
+            " group by tbname,alarmid,alarmtype,characteristic,components,description,deviceid,devicename,devicetype,enabled,lineid,linename,modelId,projectid,projectname,rank,resettable,stationid,stationname,subcomponents,suffix,tagid,triggertype,uniformcode ",
             "</script>"})
-    Integer selectByWtCount(@Param("begin")long begin,@Param("end")long end,@Param("modelId")String modelId,@Param("superTableName") String superTableName,@Param("alarmType")String alarmType,@Param("stationid")String stationid,@Param("deviceid")String deviceid,@Param("description")String description, @Param("deviceType")String deviceType, @Param("components")String components);
+    List<Integer> selectByWtCount(@Param("begin")long begin,@Param("end")long end,@Param("modelId")String modelId,@Param("superTableName") String superTableName,@Param("alarmType")String alarmType,@Param("stationid")String stationid,@Param("deviceid")String deviceid,@Param("description")String description, @Param("deviceType")String deviceType, @Param("components")String components);
 //    @Select("select deviceid as wtId,stationid as stationId,alarmid,description,components as typeCode,max(timeLong) as maxSeconds,min(timeLong) as minSeconds,avg(timeLong) as avgSeconds,sum(timeLong) as totalSeconds,count(*) as total from alarmWt where ts>=#{begin} and ts<=#{end}  and alarmtype='windturbine'  and #{begin} group by deviceid,components,stationid,alarmid,description")
 
     @Select({"<script>",
-            "select deviceid as wtId,stationid as stationId,alarmid,description,components as typeCode,max(timeLong) as maxSeconds,min(timeLong) as minSeconds,avg(timeLong) as avgSeconds,sum(timeLong) as totalSeconds,count(*) as total from alarmWt " ,
+            "select deviceid as wtId,stationid as stationId,alarmid,description,components as typeCode,max(timeLong) as maxSeconds,min(timeLong) as minSeconds,avg(timeLong) as avgSeconds,sum(timeLong) as totalSeconds,count(*) as total from alarmCt " ,
             "<where>" ,
 
             " ts &gt;= #{begin}",
             "and ts &lt;= #{end}",
             "and stationid = #{stationid}",
             "and modelId = #{modelId}",
+            "<if test='alarmid != null'>",
+            "and alarmid in(#{alarmid}) ",
+            "</if>",
             "<if test='components != null'>",
-            "and components= #{components}",
+            "and components in(#{components}) ",
             "</if>",
             "</where>",
+
             " group by deviceid,components,stationid,alarmid,description ",
             " order by deviceid  ",
             "</script>"})
-    List<ProBasicFeatureStat> findWtFeatureStat( @Param("begin")long begin, @Param("end") long end, @Param("stationid") String stationid, @Param("modelId")String modelId, @Param("components") String components);
+    List<ProBasicFeatureStat> findWtFeatureStat( @Param("begin")long begin, @Param("end") long end, @Param("stationid") String stationid, @Param("modelId")String modelId,@Param("components") List<String> components, @Param("alarmid") List<String> alarmid);
 
 
     @Select({"<script>",
@@ -180,14 +187,18 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "and ts &lt;= #{end}",
             "and stationid = #{stationid}",
             "and modelId = #{modelId}",
-            "<if test='description != null'>",
-            "and description= #{description}",
+            "<if test='alarmid != null'>",
+            "and alarmid in(#{alarmid}) ",
+            "</if>",
+            "<if test='components != null'>",
+            "and components in(#{components}) ",
             "</if>",
             "</where>",
+
             " group by deviceid,components,stationid,alarmid,description ",
             " order by deviceid  ",
             "</script>"})
-    List<ProBasicFeatureStat> findCtFeatureStat( @Param("begin")long begin, @Param("end") long end, @Param("stationid") String stationid, @Param("modelId")String modelId, @Param("description") String description);
+    List<ProBasicFeatureStat> findCtFeatureStat( @Param("begin")long begin, @Param("end") long end, @Param("stationid") String stationid, @Param("modelId")String modelId, @Param("components") List<String> components, @Param("alarmid") List<String> alarmid);
 
 
 }

+ 21 - 0
alarm-web/src/main/java/com/gyee/alarm/model/vo/AlarmConfigurationVo.java

@@ -0,0 +1,21 @@
+package com.gyee.alarm.model.vo;
+
+import lombok.Data;
+
+@Data
+public class AlarmConfigurationVo {
+
+    /**
+     * 报警标号
+     */
+    private String alarmId;
+
+    /**
+     * 报警描述
+     */
+    private String description;
+
+
+
+
+}

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

@@ -9,7 +9,7 @@ import com.gyee.alarm.mapper.auto.ProEconAlarmRuleMapper;
 import com.gyee.alarm.model.auto.ProBasicPowerstation;
 import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
 import com.gyee.alarm.model.auto.ProEconAlarmType;
-import com.gyee.alarm.model.vo.AlarmRuleVo;
+import com.gyee.alarm.model.vo.*;
 import com.gyee.alarm.service.auto.IProEconAlarmConfigurationService;
 import com.gyee.alarm.util.SnowflakeGenerator;
 import com.gyee.alarm.util.StringUtil;
@@ -17,10 +17,7 @@ import com.gyee.alarm.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 
 @Service
@@ -108,5 +105,52 @@ public class AlarmConfigurationService {
         return alertruleIPage;
     }
 
+    /**
+     * 查询报警信息接口
+     * @param wpId 场站不编号
+     * @param modelId 型号编号
+     * @param components 部件编号
+     * @return
+     */
+    public List<AlarmConfigurationVo> queryWtAlarmDescList(String wpId, String modelId, String components) {
 
+        List<AlarmConfigurationVo> vos=new ArrayList<>();
+        StringBuilder sb=new StringBuilder();
+        sb.append(wpId).append(modelId);
+
+
+        Map<String,String> map=new HashMap<>();
+
+        if(com.gyee.common.model.StringUtils.notEmp(components))
+        {
+            String [] componentsStr=components.split(",");
+            for(String c:componentsStr)
+            {
+                map.put(c,c);
+            }
+
+        }
+        if(CacheContext.wtAlarmMap.containsKey(String.valueOf(sb)))
+        {
+            List<ProEconAlarmConfiguration> ls=CacheContext.wtAlarmMap.get(String.valueOf(sb));
+
+            if(!ls.isEmpty())
+            {
+                for(ProEconAlarmConfiguration ac:ls)
+                {
+                    if(map.containsKey(ac.getComponents()))
+                    {
+
+                        AlarmConfigurationVo vo=new AlarmConfigurationVo();
+                        vo.setAlarmId(ac.getId());
+                        vo.setDescription(ac.getDescription());
+                        vos.add(vo);
+                    }
+                }
+            }
+
+        }
+
+        return vos;
+    }
 }

+ 112 - 69
alarm-web/src/main/java/com/gyee/alarm/service/AlarmHistoryService.java

@@ -61,19 +61,19 @@ public class AlarmHistoryService   {
 //
 //            whereSql.append(" and alarmtype=CONCAT('',").append(alarmType).append(",'')");
 
-           if(AlarmTypeValue.BT.getCode().equals(alarmType))
-           {
-               superTableName= AlarmSuperTalbeType.BT.getCode();
+            if(AlarmTypeValue.BT.getCode().equals(alarmType))
+            {
+                superTableName= AlarmSuperTalbeType.BT.getCode();
 
-           }else if(AlarmTypeValue.WT.getCode().equals(alarmType))
-           {
-               superTableName= AlarmSuperTalbeType.WT.getCode();
+            }else if(AlarmTypeValue.WT.getCode().equals(alarmType))
+            {
+                superTableName= AlarmSuperTalbeType.WT.getCode();
 
-           }else if(AlarmTypeValue.CT.getCode().equals(alarmType))
-           {
-               superTableName= AlarmSuperTalbeType.CT.getCode();
+            }else if(AlarmTypeValue.CT.getCode().equals(alarmType))
+            {
+                superTableName= AlarmSuperTalbeType.CT.getCode();
 
-           }
+            }
         }
 
 //        if(StringUtils.notEmp(stationid)  )
@@ -115,13 +115,10 @@ public class AlarmHistoryService   {
         {
             components=null;
         }
-        int limit = (pageNum - 1) * pageSize;
-        int offset = pageSize;
-        vos = alarmTsMapper.selectByWtLimit(begin, end, modelId, superTableName, alarmType, stationid, deviceid, description, deviceType, components, limit, offset);
-//        vos = alarmTsMapper.selectByWtLimit(begin,end,modelId,superTableName, alarmType, stationid, deviceid, description,deviceType,components, pageNum*pageSize, (pageNum*pageSize+pageSize));
+        vos = alarmTsMapper.selectByWtLimit(begin,end,modelId,superTableName, alarmType, stationid, deviceid, description,deviceType,components, pageNum*pageSize, (pageNum*pageSize+pageSize));
         map.put("ls",vos);
-        int total=alarmTsMapper.selectByWtCount(begin,end,modelId,superTableName, alarmType, stationid, deviceid, description,deviceType,components);
-        map.put("total",total);
+        List<Integer> total=alarmTsMapper.selectByWtCount(begin,end,modelId,superTableName, alarmType, stationid, deviceid, description,deviceType,components);
+        map.put("total",total.size());
         return map;
     }
 
@@ -136,24 +133,19 @@ public class AlarmHistoryService   {
         if(StringUtils.notEmp(type) )
         {
             Date endDate = new Date();
-            Date beginDate = DateUtils.addHours(endDate,-1);
-
-//            Calendar calendar = Calendar.getInstance();
-//            calendar.setTime(endDate);
-//            calendar.set(Calendar.MONTH, Calendar.AUGUST);
-//            calendar.set(Calendar.DAY_OF_MONTH, 18);
-//            Date beginDate = calendar.getTime();
+//            Date beginDate = DateUtils.addHours(endDate,-1);
+            Date beginDate = DateUtils.truncate(endDate);
             if(type.equals(AlarmTypeValue.BT.getCode()))
             {
-               vos = alarmTsMapper.selectByWtLimit(beginDate.getTime(),endDate.getTime(),null,AlarmSuperTalbeType.BT.getCode(), AlarmTypeValue.BT.getCode(), null, null, null,null,null, 0, home_pagep_size);
+                vos = alarmTsMapper.selectByWtLimit(beginDate.getTime(),endDate.getTime(),null,AlarmSuperTalbeType.BT.getCode(), AlarmTypeValue.BT.getCode(), null, null, null,null,null, 1, home_pagep_size);
 
             }else if(type.equals(AlarmTypeValue.WT.getCode()))
             {
-                vos = alarmTsMapper.selectByWtLimit(beginDate.getTime(),endDate.getTime(),null,AlarmSuperTalbeType.WT.getCode(), AlarmTypeValue.WT.getCode(), null, null, null,null, null,0, home_pagep_size);
+                vos = alarmTsMapper.selectByWtLimit(beginDate.getTime(),endDate.getTime(),null,AlarmSuperTalbeType.WT.getCode(), AlarmTypeValue.WT.getCode(), null, null, null,null, null,1, home_pagep_size);
 
             }else if(type.equals(AlarmTypeValue.CT.getCode()))
             {
-                vos = alarmTsMapper.selectByWtLimit(beginDate.getTime(),endDate.getTime(),null,AlarmSuperTalbeType.CT.getCode(), AlarmTypeValue.CT.getCode(), null, null, null,null, null,0, home_pagep_size);
+                vos = alarmTsMapper.selectByWtLimit(beginDate.getTime(),endDate.getTime(),null,AlarmSuperTalbeType.CT.getCode(), AlarmTypeValue.CT.getCode(), null, null, null,null, null,1, home_pagep_size);
 
             }
 
@@ -163,12 +155,37 @@ public class AlarmHistoryService   {
     }
 
 
-    public List<AlarmStatVo> findWtFeatureStat(String stationId,String modelId, Date startTime, Date endTime,String components) {
+    public List<AlarmStatVo> findWtFeatureStat(String stationId,String modelId, Date startTime, Date endTime,String components,String alarmIds) {
         List<AlarmStatVo> resultList = new ArrayList<>();
 
+        List<String> alarmIdList=new ArrayList();
+        List<String> componentsList=new ArrayList();
 
+        Map<String,String> alarmIdMap=new HashMap<>();
+        Map<String,String> componentsMap=new HashMap();
 
-        List<ProBasicFeatureStat> fsls = alarmTsMapper.findWtFeatureStat(startTime.getTime(), endTime.getTime(),stationId,modelId,components);
+        if(StringUtils.notEmp(components))
+        {
+            String [] componentsStr=components.split(",");
+            for(String c:componentsStr)
+            {
+                componentsList.add(c);
+                componentsMap.put(c,c);
+            }
+
+        }
+        if(StringUtils.notEmp(alarmIds))
+        {
+            String [] alarmIdStr=alarmIds.split(",");
+            for(String c:alarmIdStr)
+            {
+                alarmIdList.add(c);
+                alarmIdMap.put(c,c);
+            }
+
+        }
+
+        List<ProBasicFeatureStat> fsls = alarmTsMapper.findWtFeatureStat(startTime.getTime(), endTime.getTime(),stationId,modelId,componentsList,alarmIdList);
 
 
         Map<String, ProBasicFeatureStat> map = new HashMap<>();
@@ -176,7 +193,7 @@ public class AlarmHistoryService   {
 
         if (!fsls.isEmpty()) {
             for (ProBasicFeatureStat fs : fsls) {
-                if (com.gyee.alarm.util.StringUtils.notEmp(fs.getTypeCode()) && CacheContext.alarmTypeMap.containsKey(fs.getTypeCode())) {
+                if (StringUtils.notEmp(fs.getTypeCode()) && CacheContext.alarmTypeMap.containsKey(fs.getTypeCode())) {
                     ProEconAlarmType at = CacheContext.alarmTypeMap.get(fs.getTypeCode());
                     fs.setTypeName(at.getName());
                 }
@@ -199,9 +216,9 @@ public class AlarmHistoryService   {
                 if(CacheContext.wtAlarmMap.containsKey(String.valueOf(sb))) {
                     List<ProEconAlarmConfiguration> ls = CacheContext.wtAlarmMap.get(String.valueOf(sb));
                     for (ProEconAlarmConfiguration at : ls) {
-                        if(StringUtils.notEmp(components) )
+                        if(StringUtils.notEmp(components) && StringUtils.notEmp(alarmIdMap))
                         {
-                            if( components.equals(at.getComponents()))
+                            if( componentsMap.containsKey(at.getComponents()) && alarmIdMap.containsKey(at.getId()))
                             {
                                 setWtValues(statDate, map, vos, wt, at);
                             }
@@ -217,38 +234,38 @@ public class AlarmHistoryService   {
 
 
         Map<String,List<AlarmStatVo>> vomap=new HashMap<>();
-       for(ProBasicFeatureStat fs:vos)
-       {
-           AlarmStatVo d = new AlarmStatVo();
-           d.setRelateParts(fs.getTypeCode());
-           d.setRelatePartsText(fs.getTypeName());
-           d.setAlertText(fs.getDescription());
-           d.setCount(fs.getTotal());
-           d.setTime(fs.getTotalSeconds());
-           d.setStationId(fs.getStationId());
-           d.setSnapId(SnowflakeGenerator.generateId());
-           d.setWindturbineId(fs.getWtId());
-           if(CacheContext.wtmap.containsKey(fs.getWtId()))
-           {
-               ProBasicEquipment wt= CacheContext.wtmap.get(fs.getWtId());
-               d.setWindturbineCode(wt.getNemCode());
-           }
-
-           StringBuilder sb=new StringBuilder();
-           sb.append(fs.getWtId()).append("_").append(fs.getTypeCode()).append("_").append(fs.getAlarmid());
-
-           if(map.containsKey(String.valueOf(sb)))
-           {
-               List<AlarmStatVo> ls=vomap.get(String.valueOf(sb));
-               ls.add(d);
-           }else
-           {
-               List<AlarmStatVo> ls=new ArrayList<>();
-               ls.add(d);
-               vomap.put(String.valueOf(sb),ls);
-           }
-           resultList.add(d);
-       }
+        for(ProBasicFeatureStat fs:vos)
+        {
+            AlarmStatVo d = new AlarmStatVo();
+            d.setRelateParts(fs.getTypeCode());
+            d.setRelatePartsText(fs.getTypeName());
+            d.setAlertText(fs.getDescription());
+            d.setCount(fs.getTotal());
+            d.setTime(fs.getTotalSeconds());
+            d.setStationId(fs.getStationId());
+            d.setSnapId(SnowflakeGenerator.generateId());
+            d.setWindturbineId(fs.getWtId());
+            if(CacheContext.wtmap.containsKey(fs.getWtId()))
+            {
+                ProBasicEquipment wt= CacheContext.wtmap.get(fs.getWtId());
+                d.setWindturbineCode(wt.getNemCode());
+            }
+
+            StringBuilder sb=new StringBuilder();
+            sb.append(fs.getWtId()).append("_").append(fs.getTypeCode()).append("_").append(fs.getAlarmid());
+
+            if(map.containsKey(String.valueOf(sb)))
+            {
+                List<AlarmStatVo> ls=vomap.get(String.valueOf(sb));
+                ls.add(d);
+            }else
+            {
+                List<AlarmStatVo> ls=new ArrayList<>();
+                ls.add(d);
+                vomap.put(String.valueOf(sb),ls);
+            }
+            resultList.add(d);
+        }
 
 
         for (Map.Entry<String,List<AlarmStatVo>> entry : vomap.entrySet()) {
@@ -307,12 +324,37 @@ public class AlarmHistoryService   {
         vos.add(fs);
     }
 
-    public List<AlarmStatVo> findCtFeatureStat(String stationId,String modelId, Date startTime, Date endTime,String description) {
+    public List<AlarmStatVo> findCtFeatureStat(String stationId,String modelId, Date startTime, Date endTime,String components,String alarmIds) {
         List<AlarmStatVo> resultList = new ArrayList<>();
 
 
+        List<String> alarmIdList=new ArrayList();
+        List<String> componentsList=new ArrayList();
 
-        List<ProBasicFeatureStat> fsls = alarmTsMapper.findCtFeatureStat(startTime.getTime(), endTime.getTime(),stationId,modelId,description);
+        Map<String,String> alarmIdMap=new HashMap<>();
+        Map<String,String> componentsMap=new HashMap();
+
+        if(StringUtils.notEmp(components))
+        {
+            String [] componentsStr=components.split(",");
+            for(String c:componentsStr)
+            {
+                componentsList.add(c);
+                componentsMap.put(c,c);
+            }
+
+        }
+        if(StringUtils.notEmp(alarmIds))
+        {
+            String [] alarmIdStr=alarmIds.split(",");
+            for(String c:alarmIdStr)
+            {
+                alarmIdList.add(c);
+                alarmIdMap.put(c,c);
+            }
+
+        }
+        List<ProBasicFeatureStat> fsls = alarmTsMapper.findCtFeatureStat(startTime.getTime(), endTime.getTime(),stationId,modelId,componentsList,alarmIdList);
 
 
         Map<String, ProBasicFeatureStat> map = new HashMap<>();
@@ -344,19 +386,20 @@ public class AlarmHistoryService   {
                     List<ProEconAlarmRule> wtCustomls=CacheContext.alarmRulesMap.get(AlarmCustomType.WT.getCode());
 
                     for (ProEconAlarmRule at : wtCustomls) {
-                        if(StringUtils.notEmp(description) && description.equals(at.getDescription()))
+
+
+                        if(StringUtils.notEmp(components) && StringUtils.notEmp(alarmIdMap))
                         {
-                            if(description.equals(at.getDescription()))
+                            if(componentsMap.containsKey(at.getRelatedParts()) && alarmIdMap.containsKey(at.getId()))
                             {
                                 setCtValues(statDate, map, vos, wt, at);
                             }
-
                         }else
                         {
                             setCtValues(statDate, map, vos, wt, at);
                         }
-
                     }
+
                 }
             }
         }

+ 48 - 0
alarm-web/src/main/java/com/gyee/alarm/service/AlarmRuleService.java

@@ -10,6 +10,7 @@ import com.gyee.alarm.mapper.auto.ProEconAlarmRuleMapper;
 import com.gyee.alarm.model.auto.*;
 
 
+import com.gyee.alarm.model.vo.AlarmConfigurationVo;
 import com.gyee.alarm.model.vo.AlarmRuleVo;
 import com.gyee.alarm.service.auto.IProEconAlarmTypeService;
 import com.gyee.alarm.util.SnowflakeGenerator;
@@ -30,7 +31,54 @@ public class AlarmRuleService {
     @Resource
     private RuleUpdateEventService ruleUpdateEventService;
 
+    /**
+     * 查询报警信息接口
+     * @param wpId 场站不编号
+     * @param modelId 型号编号
+     * @param components 部件编号
+     * @return
+     */
+    public List<AlarmConfigurationVo> queryCtAlarmDescList(String wpId, String modelId, String components) {
 
+        List<AlarmConfigurationVo> vos=new ArrayList<>();
+        StringBuilder sb=new StringBuilder();
+        sb.append(wpId).append(modelId);
+
+
+        Map<String,String> map=new HashMap<>();
+
+        if(com.gyee.common.model.StringUtils.notEmp(components))
+        {
+            String [] componentsStr=components.split(",");
+            for(String c:componentsStr)
+            {
+                map.put(c,c);
+            }
+
+        }
+        if(CacheContext.ctAlarmMap.containsKey(String.valueOf(sb)))
+        {
+            List<ProEconAlarmRule> ls=CacheContext.ctAlarmMap.get(String.valueOf(sb));
+
+            if(!ls.isEmpty())
+            {
+                for(ProEconAlarmRule ac:ls)
+                {
+                    if(map.containsKey(ac.getRelatedParts()))
+                    {
+
+                        AlarmConfigurationVo vo=new AlarmConfigurationVo();
+                        vo.setAlarmId(ac.getId());
+                        vo.setDescription(ac.getDescription());
+                        vos.add(vo);
+                    }
+                }
+            }
+
+        }
+
+        return vos;
+    }
     private int saveAlertrule(ProEconAlarmRule alarmRule) throws Exception {
 
         int result = 0;

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

@@ -1,4 +1,4 @@
-package com.gyee.alarm.service.initalcache;/*
+package com.gyee.alarm.service.auto.initalcache;/*
 @author   谢生杰
 @date   2022/11/3-9:14
 */

Разлика између датотеке није приказан због своје велике величине
+ 748 - 1856
log/ota.log


BIN
log/ota.log.2023-08-14.0.gz


BIN
log/ota.log.2023-08-15.0.gz


BIN
log/ota.log.2023-08-16.0.gz


BIN
log/ota.log.2023-08-17.0.gz


BIN
log/ota.log.2023-08-18.0.gz