Jelajahi Sumber

1.springdoc 注解语法调整
2.增加字典数据,风机报警配置工具 中风机型号由datadictionary中获取
报警部件:alertrule_category CLX 齿轮箱
预警类型:early_category performance 性能下降
用户设置:userset jumpwindow 是否故障弹窗 faultread 是否语音播报
风机型号:windtrubinemodel
3.调整故障弹窗确认逻辑,更改为只更新faulthistory中最近12小时的流水
4.调整风机报警保存时id生成逻辑 warning2

wanghs 2 tahun lalu
induk
melakukan
da23eaf181

+ 4 - 4
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlertRuleEventLogController.java

@@ -30,10 +30,10 @@ public class AlertRuleEventLogController {
     @Operation(description = "分页查询报警规则修改日志")
     @GetMapping("/page")
     public ResponseWrapper getRuleEventLog(
-            @Parameter(name = "当前页") @RequestParam(value = "pagenum",required = true) Integer pageNum,
-            @Parameter(name = "分页大小") @RequestParam(value = "pagesize",required = true) Integer pageSize,
-            @Parameter(name = "报警名称") @RequestParam(value = "ruleName",required = false) String ruleName,
-            @Parameter(name = "规则类型(风机报警,升压站报警,自定义报警)") @RequestParam(value = "ruleType",required = false) String ruleType
+            @Parameter(  name ="pagenum",description = "当前页") @RequestParam(value = "pagenum",required = true) Integer pageNum,
+            @Parameter(  name ="pagesize",description = "分页大小") @RequestParam(value = "pagesize",required = true) Integer pageSize,
+            @Parameter(  name ="ruleName",description = "报警名称") @RequestParam(value = "ruleName",required = false) String ruleName,
+            @Parameter(  name ="ruleType",description = "规则类型(风机报警,升压站报警,自定义报警)") @RequestParam(value = "ruleType",required = false) String ruleType
 
 
             ) {

+ 25 - 9
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/DatadictionaryController.java

@@ -27,6 +27,13 @@ import java.util.List;
 @Tag(name = "字典接口")
 public class DatadictionaryController {
 
+    /*
+   报警部件: alertrule_category CLX 齿轮箱
+   预警类型:	early_category	performance	性能下降
+   用户设置	userset	jumpwindow	是否故障弹窗 faultread	是否语音播报
+   风机型号   windtrubinemodel
+    * */
+
     @Autowired
     private DatadictionaryService datadictionaryService;
 
@@ -39,32 +46,41 @@ public class DatadictionaryController {
     @Operation(description = "分页查询字典")
     @GetMapping(value = "/page")
     public ResponseWrapper queryByPage(
-            @Parameter(name = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
-            @Parameter(name = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
-            @Parameter(name = "字典名称") @RequestParam(value = "name", required = false) String name,
-            @Parameter(name = "字典类型") @RequestParam(value = "category", required = false) String category
+            @Parameter(name = "pagenum", description = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
+            @Parameter(name = "pagesize", description = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
+            @Parameter(name = "name", description = "字典名称") @RequestParam(value = "name", required = false) String name,
+            @Parameter(name = "category", description = "字典类型") @RequestParam(value = "category", required = false) String category
     ) {
         Page<Datadictionary> page = new Page(pageNum, pageSize);
-        IPage<Datadictionary> pageResult = datadictionaryService.pageQueryAll(page, name,category);
+        IPage<Datadictionary> pageResult = datadictionaryService.pageQueryAll(page, name, category);
 
-        return ResponseWrapper.success("请求成功",pageResult);
+        return ResponseWrapper.success("请求成功", pageResult);
     }
 
     @Operation(description = "新增或修改字典")
     @PostMapping(value = "/saveorupdate")
     @ResponseBody
-    public ResponseWrapper saveDatadictionary(@Parameter(description = "字典对象") @RequestBody Datadictionary datadictionary){
+    public ResponseWrapper saveDatadictionary(@Parameter(description = "字典对象") @RequestBody Datadictionary datadictionary) {
         ResponseWrapper<Datadictionary> wrapper = null;
         int result = datadictionaryService.saveOrUpdateDatadictionary(datadictionary);
         if (result <= 0) {
             wrapper = ResponseWrapper.error("操作数据库失败");
-        }
-        else {
+        } else {
             wrapper = ResponseWrapper.success("操作数据库成功");
         }
         return wrapper;
     }
 
+    @Operation(description = "根据字典类型获取字典集合")
+    @GetMapping("/list")
+    @ResponseBody
+    public ResponseWrapper getDictionary(@Parameter(name = "category",description = "字典类型")String category) {
+
+        List<Datadictionary> datadictionary = datadictionaryService.getDatadictionary(category);
+        ResponseWrapper wrapper = ResponseWrapper.success("获取成功", datadictionary);
+        return wrapper;
+    }
+
     @Operation(description = "删除字典")
     @DeleteMapping(value = "/{id}")
     @ResponseBody

+ 11 - 11
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/DeviceController.java

@@ -143,13 +143,13 @@ public class DeviceController {
     @GetMapping(value = "/metrics/page")
     @Operation(description = "分页查询标准测点")
     public IPage<DeviceMetrics> queryByPage(
-            @Parameter(description = "当前页")  @RequestParam(value = "pagenum")Integer pageNum,
-            @Parameter(description = "分页大小")@RequestParam(value = "pagesize")Integer pageSize,
-            @Parameter(description = "测点类型 AI-遥测 CI-计算 MI-遥调")  @RequestParam(value = "categorydata")String categorydata,
-            @Parameter(description = "名称关键字")  @RequestParam(value = "keyword",required = false)String  keyword,
-            @Parameter(description = "型号")  @RequestParam(value = "model",required = false)String  model,
-            @Parameter(description = "设备类型") @RequestParam(value = "deviceId", required = false) String deviceId,
-            @Parameter(description = "结构码")   @RequestParam(value = "structureCode",required = false) String structureCode
+            @Parameter(name="pagenum",description = "当前页")  @RequestParam(value = "pagenum")Integer pageNum,
+            @Parameter(name="pagesize",description = "分页大小")@RequestParam(value = "pagesize")Integer pageSize,
+            @Parameter(name="categorydata",description = "测点类型 AI-遥测 CI-计算 MI-遥调")  @RequestParam(value = "categorydata")String categorydata,
+            @Parameter(name="keyword",description = "名称关键字")  @RequestParam(value = "keyword",required = false)String  keyword,
+            @Parameter(name="model",description = "型号")  @RequestParam(value = "model",required = false)String  model,
+            @Parameter(name="deviceId",description = "设备类型") @RequestParam(value = "deviceId", required = false) String deviceId,
+            @Parameter(name="structureCode",description = "结构码")   @RequestParam(value = "structureCode",required = false) String structureCode
     ){
         Page<DeviceMetrics> page =new Page(pageNum,pageSize);
 
@@ -235,10 +235,10 @@ public class DeviceController {
     @Operation(description = "风机型号分页查询")
     @GetMapping(value = "/model/page")
     public ResponseWrapper queryByPage(
-            @Parameter(name = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
-            @Parameter(name = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
-            @Parameter(name = "风机型号") @RequestParam(value = "code", required = false) String code,
-            @Parameter(name = "场站名称") @RequestParam(value = "stationname", required = false) String stationname
+            @Parameter(name = "pagenum",description="当前页") @RequestParam(value = "pagenum") Integer pageNum,
+            @Parameter(name = "pagesize",description="分页大小") @RequestParam(value = "pagesize") Integer pageSize,
+            @Parameter(name = "code",description="风机型号") @RequestParam(value = "code", required = false) String code,
+            @Parameter(name = "stationname",description="场站名称") @RequestParam(value = "stationname", required = false) String stationname
     ) {
         Page<DeviceModel> page = new Page(pageNum, pageSize);
         IPage<DeviceModel> pageResult = deviceService.pageQueryDeviceModel(page, code,stationname);

+ 30 - 24
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/FaultInfoController.java

@@ -12,9 +12,8 @@ import org.apache.logging.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @descrition:
@@ -44,18 +43,18 @@ public class FaultInfoController {
             @RequestParam(value = "isopened", required = false) Integer isOpened
     ) {
         try {
-            if(null != pageNum && null !=pageSize ){
+            if (null != pageNum && null != pageSize) {
                 Page<FaultInfo> page = new Page(pageNum, pageSize);
-                IPage<FaultInfo> result = faultService.queryFaultInfo(page, stId, keyWord,cateGory1, startTime, endTime, isOpened);
+                IPage<FaultInfo> result = faultService.queryFaultInfo(page, stId, keyWord, cateGory1, startTime, endTime, isOpened);
                 for (FaultInfo fi : result.getRecords()) {
                     fi.setProjectId("" + result.getTotal());
                 }
                 return result.getRecords();
             }
-            List<FaultInfo> result = faultService.queryFaultInfo(stId, keyWord, startTime, endTime,messageType);
+            List<FaultInfo> result = faultService.queryFaultInfo(stId, keyWord, startTime, endTime, messageType);
             return result;
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
             return null;
         }
     }
@@ -88,8 +87,8 @@ public class FaultInfoController {
     }
 
     @GetMapping("/history")
-    public List<FaultInfo> getHistoryById(@RequestParam(value = "ids", required = false) String ids){
-        if(ids==null){
+    public List<FaultInfo> getHistoryById(@RequestParam(value = "ids", required = false) String ids) {
+        if (ids == null) {
             return null;
         }
         String[] nids = ids.split(",");
@@ -102,8 +101,8 @@ public class FaultInfoController {
     public List<FaultSnap> queryByTimeAndStation(
             @RequestParam(value = "startTime", required = false) String startTime,
             @RequestParam(value = "endTime", required = false) String endTime,
-            @RequestParam(value = "stationId", required = false) String stationId){
-        return faultService.queryByTimeAndStation(startTime,endTime,stationId);
+            @RequestParam(value = "stationId", required = false) String stationId) {
+        return faultService.queryByTimeAndStation(startTime, endTime, stationId);
     }
 
 
@@ -111,7 +110,15 @@ public class FaultInfoController {
     public List<FaultInfo> getRecentFault(
             @RequestParam(value = "faulttime", required = true) String faultTime
     ) {
-        return faultService.getRecentFault(faultTime);
+        List<FaultInfo> recentFaultList = faultService.getRecentFault(faultTime);
+
+        //针对升压站 变化触发测点报警,进行去重,以及同一时间段的反复报警进行去重
+
+      //  List<FaultInfo> syzFaultInfoList = recentFaultList.stream().filter(s -> s.getCategoryName().equals("升压站")).collect(Collectors.toList());
+        ArrayList<FaultInfo> distinctResult =
+                recentFaultList.stream().collect(Collectors.collectingAndThen(
+                        Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(FaultInfo::getSnapID))), ArrayList::new));
+        return distinctResult;
     }
 
     @GetMapping(value = "/history/page")
@@ -128,7 +135,7 @@ public class FaultInfoController {
             Page<FaultInfo> page = new Page(pageNum, pageSize);
             return faultService.queryFaultInfo(page, stId, keyWord, "", startTime, endTime, isOpened);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
             return null;
         }
 
@@ -142,19 +149,19 @@ public class FaultInfoController {
         try {
             return faultService.getTopNumFault(topNum);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
             return null;
         }
     }
 
 
     @PostMapping("/history")
-    public void saveFaultHistory(@RequestBody FaultHistory faultHistory){
-        logger.info("请求数据:id = {},snapId = {},confirmPerson = {}",faultHistory.getId(),faultHistory.getSnapId(),faultHistory.getConfirmPerson());
+    public void saveFaultHistory(@RequestBody FaultHistory faultHistory) {
+        logger.info("请求数据:id = {},snapId = {},confirmPerson = {}", faultHistory.getId(), faultHistory.getSnapId(), faultHistory.getConfirmPerson());
         try {
             faultService.saveFaultHistory(faultHistory);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
         }
     }
 
@@ -164,7 +171,7 @@ public class FaultInfoController {
         try {
             return faultService.queryFaultHistoryById(historyId);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
             return null;
         }
     }
@@ -175,14 +182,14 @@ public class FaultInfoController {
         try {
             return faultService.queryMultiFaultSnap(snapIds);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
             return null;
         }
     }
 
 
     @GetMapping(value = "/snap/single")
-    public FaultSnap queryByTagId(@RequestParam(value = "tagId", required = true) String tagId){
+    public FaultSnap queryByTagId(@RequestParam(value = "tagId", required = true) String tagId) {
         return faultService.queryByTagId(tagId);
     }
 
@@ -200,12 +207,11 @@ public class FaultInfoController {
             Date et = new Date(endTime);
             faultService.faultClear(st, et);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
         }
     }
 
 
-
     //故障确认操作
     @GetMapping("/confirm")
     public void confirmFault(
@@ -215,9 +221,9 @@ public class FaultInfoController {
             @RequestParam(value = "snapId") long snapId) {
 
         try {
-            faultService.confirmBatch(faultHistoryId,confirmType,userName,snapId);
+            faultService.confirmBatch(faultHistoryId, confirmType, userName, snapId);
         } catch (Exception e) {
-            logger.error("操作失败",e);
+            logger.error("操作失败", e);
         }
     }
 }

+ 1 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/InfoController.java

@@ -96,7 +96,7 @@ public class InfoController {
     @Operation(description = "根据场站名称查询所有风机编号")
     @RequestMapping(value = "/windturbine")
     @ResponseBody
-    public List<Windturbine> getWindturbineByStation( @Parameter(name = "场站名称") @RequestParam(value = "stationId", required = false) String stationId) {
+    public List<Windturbine> getWindturbineByStation( @Parameter(name ="stationId",description = "场站名称") @RequestParam(value = "stationId", required = false) String stationId) {
         List<Windturbine> lst = windturbineService.selectWindturbineByStationid(stationId);
         return lst;
     }

+ 1 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/TestingPointDIController.java

@@ -43,7 +43,7 @@ public class TestingPointDIController {
     @ResponseBody
     @Operation(description = "根据子型号获取测点")
     public ResponseWrapper getTestingPointDIByModel(
-            @Parameter(description = "风机子型号如UP82_NSS")   @RequestParam(value = "minModel", required = true) String minModel
+            @Parameter(name="minModel", description = "风机子型号如UP82_NSS")   @RequestParam(value = "minModel", required = true) String minModel
     ) {
         List<TestingPointDI> lst = testingPointDIService.getTestingPointDIByMinModelId(minModel);
         ResponseWrapper result = ResponseWrapper.success("查询成功", lst);

+ 2 - 2
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/UserSetController.java

@@ -28,7 +28,7 @@ public class UserSetController {
 
     @Operation(description = "是否故障弹窗提示")
     @PostMapping("/jumpwindow")
-    public ResponseWrapper saveJumpWindow(@Parameter(name = "是否弹窗") @RequestParam(value = "isjump", required = true) boolean isJump) {
+    public ResponseWrapper saveJumpWindow(@Parameter(name = "isjump",description = "是否弹窗") @RequestParam(value = "isjump", required = true) boolean isJump) {
 
         boolean b = datadictionaryService.saveOrUpdateUserSet("userset", "jumpwindow", isJump);
         String msg = isJump?"故障弹窗开启":"故障弹窗关闭";
@@ -42,7 +42,7 @@ public class UserSetController {
 
     @Operation(description = "是否故障语音播报")
     @PostMapping("/faultread")
-    public ResponseWrapper saveFaultRead(@Parameter(name = "是否播报") @RequestParam(value = "isread", required = true) boolean isread) {
+    public ResponseWrapper saveFaultRead(@Parameter(name = "isread",description = "是否播报") @RequestParam(value = "isread", required = true) boolean isread) {
         boolean b = datadictionaryService.saveOrUpdateUserSet("userset", "faultread", isread);
         String msg = isread?"语音播报开启":"语音播报关闭";
         ResponseWrapper resultWrapper=null;

+ 28 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/Warning2.java

@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.gyee.wisdom.alarm.sharding.util.ChineseDes;
+import lombok.AccessLevel;
 import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.io.Serializable;
 
@@ -39,6 +42,7 @@ public class Warning2 implements Serializable {
     private String modelId;
     @TableField("CODENAME")
     private String codeName;
+    @Setter(AccessLevel.NONE)
     @ChineseDes("统一编码")
     @TableField("EDNAVALUE")
     private int ednaValue;
@@ -62,7 +66,31 @@ public class Warning2 implements Serializable {
     @ChineseDes("关联部件")
     @TableField("RELATEDPARTS")
     private String relatedParts;//关联部件
+    //统一编码
+    @Setter(AccessLevel.NONE)
+    @TableField(exist = false)
+    private String uniformCode;
 
     @TableField(exist = false)
     private String userName;//操作人
+
+    public void setUniformCode(String code) {
+        this.uniformCode = code;
+        try {
+            this.ednaValue = Integer.valueOf(code.replace("DI", ""));
+        } catch (Exception ex) {
+
+        }
+
+    }
+
+    public void setEdnaValue(int value) {
+        this.ednaValue = value;
+        if (value >= 100) {
+            this.uniformCode = "DI" + value;
+
+        } else {
+            this.uniformCode = "DI0" + value;
+        }
+    }
 }

+ 5 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/DatadictionaryService.java

@@ -85,4 +85,9 @@ public class DatadictionaryService extends ServiceImpl<DatadictionaryMapper, Dat
         else
             return null;
     }
+
+    public List<Datadictionary> getDatadictionary(String category){
+        List<Datadictionary> lst = datadictionaryMapper.selectList(new QueryWrapper<Datadictionary>().eq("CATEGORY", category));
+        return lst;
+    }
 }

+ 5 - 5
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/Warning2Service.java

@@ -27,11 +27,11 @@ public class Warning2Service extends ServiceImpl<Warning2Mapper, Warning2> {
     private RuleUpdateEventService eventService;
 
     public int saveAndUpdateWarning2(Warning2 warning2,String userName) {
-        String modelId = warning2.getModelId();
-        String[] s = modelId.split("_");
-        if(s.length>1){
-            warning2.setModelId(s[0]);
-        }
+//        String modelId = warning2.getModelId();
+//        String[] s = modelId.split("_");
+//        if(s.length>1){
+//            warning2.setModelId(s[0]);
+//        }
         Warning2 oldData=null;
         int result = 0;
         if (StringUtils.isBlank(warning2.getId())) {

+ 1 - 1
warning-web/src/main/resources/mappers-oracle/FaultHistoryMapper.xml

@@ -26,7 +26,7 @@
 
 
     <update id="batchConfirm" parameterType="java.util.Map">
-            UPDATE faulthistory  SET  CONFIRMTYPE=#{confirmType} ,CONFIRMPERSON=#{userName},ALERTSNAPID=#{alarmSnpaId},CONFIRMTIME=sysdate  where SNAPID = #{faultSnapId} and CONFIRMTYPE=0
+            UPDATE faulthistory  SET  CONFIRMTYPE=#{confirmType} ,CONFIRMPERSON=#{userName},ALERTSNAPID=#{alarmSnpaId},CONFIRMTIME=sysdate  where SNAPID = #{faultSnapId} and CONFIRMTYPE=0 and faultTime>(sysdate - interval '12' hour)
     </update>
 
 

+ 2 - 2
warning-web/src/main/resources/mappers/FaultInfoMapper.xml

@@ -47,7 +47,7 @@
         order by h.faultTime desc
     </select>
 
-    <select id="getRecentFault2" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+    <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
         SELECT
         h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
         s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
@@ -62,7 +62,7 @@
         AND h.faultTime >= #{faulttime}
         order by h.faultTime desc
     </select>
-    <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+    <select id="getRecentFault_bak" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
         SELECT
         s.lastupdatetime as faultTime , s.isopened as messageType, s.id as snapID, '0' as confirmType,s.lastupdatetime as confirmTime, '' as confirmPerson,
         s.id,