Browse Source

报警统计功能

shilin 1 year ago
parent
commit
46e4712d69

+ 1 - 0
alarm-service/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java

@@ -49,6 +49,7 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
 //tagid NCHAR(100),报警触发测点
 //triggertype INT,触发条件
 //uniformcode NCHAR(50)统一编码
+
     @Update("CREATE STABLE if not exists ${superTableName} (ts TIMESTAMP,val INT,confirmed BOOL,endts TIMESTAMP,timeLong DOUBLE) " +
             "TAGS (alarmid NCHAR(100),alarmtype NCHAR(50),characteristic NCHAR(50)," +
             "components NCHAR(50),description NCHAR(500),deviceid NCHAR(50),devicename NCHAR(70)," +

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

@@ -85,26 +85,18 @@ public class AlarmConfigurationController {
             @ApiImplicitParam(name = "pagesize", value = "每页显示多少行", required = true, dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "rank", value = "级别", required = false, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "category", value = "类别(booststation:升压站报警,windturbine:风机报警)", required = false, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "enabled", value = "是否可用", required = false, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "relatedparts", value = "部件", required = false, dataType = "string", paramType = "query")})
+            @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query")})
 
     public AjaxResult queryByPage(HttpServletRequest request,
                                   @RequestParam(value = "pagenum") Integer pageNum,
                                   @RequestParam(value = "pagesize") Integer pageSize,
                                   @RequestParam(value = "name", required = false) String name,
                                   @RequestParam(value = "wpId", required = false) String wpId,
-                                  @RequestParam(value = "modelId", required = false) String modelId,
-                                  @RequestParam(value = "rank", required = false) String rank,
-                                  @RequestParam(value = "category", required = false) String category,
-                                  @RequestParam(value = "enabled", required = false) String enabled,
-                                  @RequestParam(value = "relatedparts", required = false) String relatedparts
+                                  @RequestParam(value = "modelId", required = false) String modelId
     ) {
         Page<ProEconAlarmConfiguration> page = new Page(pageNum, pageSize);
 
-        IPage<ProEconAlarmConfiguration> pageResult = alarmConfigurationService.pageQueryAll(page, name, wpId, modelId, rank, category, enabled, relatedparts);
+        IPage<ProEconAlarmConfiguration> pageResult = alarmConfigurationService.pageQueryAll(page, name, wpId, modelId);
 
 
         if (StringUtils.notEmp(pageResult)) {

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

@@ -76,8 +76,7 @@ public class AlertRuleController {
             for (ProEconAlarmType type : typels) {
                 if (type.getCategory().equals(AlarmType.FJBJ.getCode())) {
                     fjbjls.add(type);
-                }
-                if (type.getCategory().equals(AlarmType.FJBJ.getCode())) {
+                }else if (type.getCategory().equals(AlarmType.GFBJ.getCode())) {
                     gfbjls.add(type);
                 } else if (type.getCategory().equals(AlarmType.YJ.getCode())) {
                     yjls.add(type);

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

@@ -1,8 +1,23 @@
 package com.gyee.alarm.controller;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.ProEconRuleUpdateEvent;
+import com.gyee.alarm.model.vo.AjaxResult;
+import com.gyee.alarm.model.vo.AjaxStatus;
+import com.gyee.alarm.service.RuleUpdateEventService;
+import com.gyee.alarm.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -14,7 +29,44 @@ import org.springframework.web.bind.annotation.RestController;
  * @since 2023-08-15
  */
 @RestController
-@RequestMapping("//pro-econ-rule-update-event")
+@RequestMapping("/ruleupdate")
+@Api(value = "报警规则修改记录", tags = "报警规则修改记录")
 public class ProEconRuleUpdateEventController {
 
+
+    @Autowired
+    private RuleUpdateEventService ruleUpdateEventService;
+
+    @ApiOperation(value = "分页查询报警规则修改日志")
+    @GetMapping("/page")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "pagenum", value = "页号", required = true, dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "pagesize", value = "每页显示多少行", required = true, dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "ruleName", value = "规则名称", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "ruleType", value = "规则类型", required = false, dataType = "string", paramType = "query")})
+
+    public AjaxResult getRuleEventLog(
+            @RequestParam(value = "pagenum") Integer pageNum,
+            @RequestParam(value = "pagesize") Integer pageSize,
+            @RequestParam(value = "ruleName", required = false) String ruleName,
+            @RequestParam(value = "ruleType", required = false) String ruleType
+
+    ) {
+        IPage updateEventByPage =new Page();
+        if(StringUtils.notEmp(pageNum) && StringUtils.notEmp(pageSize))
+        {
+            Page<ProEconRuleUpdateEvent> page = new Page(pageNum, pageSize);
+
+             updateEventByPage = ruleUpdateEventService.getUpdateEventByPage(page, ruleName,ruleType);
+        }
+
+        if (StringUtils.notEmp(updateEventByPage)) {
+
+            return AjaxResult.successData(AjaxStatus.success.code, updateEventByPage);
+        } else {
+            return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
+        }
+    }
+
 }

+ 6 - 4
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmConfigurationMapper.java

@@ -22,13 +22,15 @@ public interface ProEconAlarmConfigurationMapper extends BaseMapper<ProEconAlarm
     @Select({"<script>",
             "select * from pro_econ_alarm_configuration ",
             "<where>",
-            "station_id  = #{wpId}",
-
+            " 1=1 ",
+            "<if test='wpId !=null  '>",
+            "and station_id = #{wpId} ",
+            "</if>",
             "<if test='description !=null  '>",
-            "and description like '#{description}'",
+            "and description like #{description} ",
             "</if>",
             "<if test='modelId !=null  '>",
-            "and model_id = #{modelId}",
+            "and model_id = #{modelId} ",
             "</if>",
 
             "</where>",

+ 10 - 7
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRuleMapper.java

@@ -52,25 +52,28 @@ public interface ProEconAlarmRuleMapper extends BaseMapper<ProEconAlarmRule> {
     @Select({"<script>",
             "select a.* from pro_econ_alarm_rule a",
             "<where>",
-            "a.station_id  = #{wpId}",
+            " 1=1 ",
 
+            "<if test='wpId !=null  '>",
+            "a.station_id  = #{wpId} ",
+            "</if>",
             "<if test='name !=null  '>",
-            "and a.name like '#{name}'",
+            "and a.name like #{name} ",
             "</if>",
             "<if test='modelId !=null  '>",
-            "and a.model_id = #{modelId}",
+            "and a.model_id = #{modelId} ",
             "</if>",
             "<if test='rank !=null  '>",
-            "and a.rank = #{rank}",
+            "and a.rank = #{rank} ",
             "</if>",
             "<if test='category !=null  '>",
-            "and a.category = #{category}",
+            "and a.category = #{category} ",
             "</if>",
             "<if test='enable !=null  '>",
-            "and a.enable = #{enable}",
+            "and a.enable = #{enable} ",
             "</if>",
             "<if test='relatedparts !=null  '>",
-            "and a.related_parts = #{relatedparts}",
+            "and a.related_parts = #{relatedparts} ",
             "</if>",
             "</where>",
 

+ 4 - 1
alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconRuleUpdateEvent.java

@@ -1,8 +1,10 @@
 package com.gyee.alarm.model.auto;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.time.LocalDateTime;
 import java.util.Date;
+import java.util.List;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -66,5 +68,6 @@ public class ProEconRuleUpdateEvent extends Model {
      */
     private String modelId;
 
-
+    @TableField(exist = false)
+    private List<ProEconRuleUpdateInfo> infoList;
 }

+ 1 - 1
alarm-web/src/main/java/com/gyee/alarm/model/vo/AlarmType.java

@@ -3,7 +3,7 @@ package com.gyee.alarm.model.vo;
 public enum AlarmType {
 
     FJBJ("alertrule_category", "风机部件"),
-    GFBJ("alertrule_category", "光伏部件"),
+    GFBJ("alertrule_category_GF", "光伏部件"),
     YJ("early_category", "预警"),
     SD("userset", "用户设定");
 

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

@@ -82,7 +82,7 @@ public class AlarmConfigurationService {
     }
 
 
-    public IPage<ProEconAlarmConfiguration> pageQueryAll(Page page, String name, String station, String modelId, String rank, String category, String enabled, String relatedparts) {
+    public IPage<ProEconAlarmConfiguration> pageQueryAll(Page page, String name, String station, String modelId) {
 
 
         if(StringUtils.notEmp(name))

+ 18 - 0
alarm-web/src/main/java/com/gyee/alarm/service/RuleUpdateEventService.java

@@ -47,6 +47,24 @@ public class RuleUpdateEventService {
 
 
         IPage<ProEconRuleUpdateEvent> ruleUpdateEventIPage =proEconRuleUpdateEventService.getBaseMapper().selectPage(page, wrapper);
+
+        if(!ruleUpdateEventIPage.getRecords().isEmpty())
+        {
+            for(ProEconRuleUpdateEvent vo:ruleUpdateEventIPage.getRecords())
+            {
+                List<ProEconRuleUpdateInfo> infoList=new ArrayList<>();
+                QueryWrapper<ProEconRuleUpdateInfo> wrapper2 = new QueryWrapper<>();
+
+                if (StringUtils.notEmp(vo.getId()))
+                {
+                    wrapper2.eq("event_id", vo.getId());
+                }
+
+                infoList= proEconRuleUpdateInfoService.list(wrapper2);
+                vo.setInfoList(infoList);
+            }
+        }
+
         return ruleUpdateEventIPage;
 
     }

File diff suppressed because it is too large
+ 1017 - 4128
log/ota.log


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