|
@@ -1,12 +1,16 @@
|
|
|
package com.gyee.wisdom.alarm.sharding.service;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.gyee.wisdom.alarm.sharding.controller.AlertRuleEventLogController;
|
|
|
import com.gyee.wisdom.alarm.sharding.entity.*;
|
|
|
import com.gyee.wisdom.alarm.sharding.logtool.LogService;
|
|
|
import com.gyee.wisdom.alarm.sharding.mapper.AlarmSnapMapper;
|
|
|
import com.gyee.wisdom.alarm.sharding.mapper.Alertrule2Mapper;
|
|
|
+import com.gyee.wisdom.alarm.sharding.mapper.WindturbinePartsMapper;
|
|
|
+import com.gyee.wisdom.alarm.sharding.model.AlarmHome;
|
|
|
import com.gyee.wisdom.alarm.sharding.model.Alertrule2Example;
|
|
|
import com.gyee.wisdom.alarm.sharding.model.TreeNode;
|
|
|
import com.gyee.wisdom.alarm.sharding.util.DateUtils;
|
|
@@ -20,8 +24,10 @@ import org.apache.logging.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.security.Key;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
@Service
|
|
@@ -39,6 +45,7 @@ public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2>
|
|
|
private RuleUpdateEventService eventService;
|
|
|
|
|
|
|
|
|
+
|
|
|
public int saveAndUpdateAlertrule2(Alertrule2 alertrule2,String userName) {
|
|
|
|
|
|
int result = 0;
|
|
@@ -93,8 +100,8 @@ public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2>
|
|
|
return alertrule2Mapper.deleteById(alertrule2.getId());
|
|
|
}
|
|
|
|
|
|
- public IPage<Alertrule2> pageQueryAll(Page page, String name,String station,String modelId,String rank,String category,String enabled) {
|
|
|
- return alertrule2Mapper.pageQueryAll(page, name,station,modelId,rank,category,enabled);
|
|
|
+ public IPage<Alertrule2> pageQueryAll(Page page, String name,String station,String modelId,String rank,String category,String enabled, String relatedparts) {
|
|
|
+ return alertrule2Mapper.pageQueryAll(page, name,station,modelId,rank,category,enabled,relatedparts);
|
|
|
}
|
|
|
|
|
|
//根据场站风机型号生成最新自定义报警规则ID
|
|
@@ -121,11 +128,77 @@ public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2>
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
public List<Alertrule2> queryTree() {
|
|
|
List<Alertrule2> dsList = alertrule2Mapper.queryTree();
|
|
|
return dsList;
|
|
|
}
|
|
|
|
|
|
+//首页风机部件查询
|
|
|
+ public Map<String,Integer> queryList(String station, String modelId) {
|
|
|
+ Map<String,Integer> map2 = new HashMap<>();
|
|
|
+ map2.put("CLX",0);
|
|
|
+ map2.put("YP",0);
|
|
|
+ map2.put("YY",0);
|
|
|
+ map2.put("BJXT",0);
|
|
|
+ map2.put("PHXT",0);
|
|
|
+ map2.put("BPXT",0);
|
|
|
+ map2.put("CFXT",0);
|
|
|
+ map2.put("ZZ",0);
|
|
|
+ map2.put("FDJ",0);
|
|
|
+ map2.put("QT",0);
|
|
|
+
|
|
|
+ List<Alertrule2> dslist = alertrule2Mapper.getAllByStationIdAndModelId2(station,modelId);
|
|
|
+ map2.put("SUM",dslist.size());
|
|
|
+ for(Alertrule2 ar : dslist) {
|
|
|
+ int cnt= 0;
|
|
|
+ switch (ar.getRelatedParts()) {
|
|
|
+ case "CLX":
|
|
|
+ cnt = map2.get("CLX").intValue();
|
|
|
+ map2.put("CLX", ++cnt);
|
|
|
+ break;
|
|
|
+ case "YP":
|
|
|
+ cnt = map2.get("YP").intValue();
|
|
|
+ map2.put("YP", ++cnt);
|
|
|
+ break;
|
|
|
+ case "YY":
|
|
|
+ cnt = map2.get("YY").intValue();
|
|
|
+ map2.put("YY", ++cnt);
|
|
|
+ break;
|
|
|
+ case "BJXT":
|
|
|
+ cnt = map2.get("BJXT").intValue();
|
|
|
+ map2.put("BJXT", ++cnt);
|
|
|
+ break;
|
|
|
+ case "PHXT":
|
|
|
+ cnt = map2.get("PHXT").intValue();
|
|
|
+ map2.put("PHXT", ++cnt);
|
|
|
+ break;
|
|
|
+ case "BPXT":
|
|
|
+ cnt = map2.get("BPXT").intValue();
|
|
|
+ map2.put("BPXT",++cnt);
|
|
|
+ break;
|
|
|
+ case "CFXT":
|
|
|
+ cnt = map2.get("CFXT").intValue();
|
|
|
+ map2.put("CFXT", ++cnt);
|
|
|
+ break;
|
|
|
+ case "ZZ":
|
|
|
+ cnt = map2.get("ZZ").intValue();
|
|
|
+ map2.put("ZZ", ++cnt);
|
|
|
+ break;
|
|
|
+ case "FDJ":
|
|
|
+ cnt = map2.get("FDJ").intValue();
|
|
|
+ map2.put("FDJ",++cnt);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ cnt = map2.get("QT").intValue();
|
|
|
+ map2.put("QT", ++cnt);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map2;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public List<Map<String, Alertrule2>> queryTree2(String relatedParts) {
|
|
|
List<Map<String, Alertrule2>> dsList = alertrule2Mapper.quertByrelatedParts(relatedParts);
|
|
|
return dsList;
|