Pārlūkot izejas kodu

添加异步多线程调度功能

shilin 2 mēneši atpakaļ
vecāks
revīzija
ec4af2de61
32 mainītis faili ar 1975 papildinājumiem un 486 dzēšanām
  1. 13 2
      alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java
  2. 229 151
      alarm-custom/src/main/java/com/gyee/alarm/util/realtimesource/EdosUtil.java
  3. 4 4
      alarm-service/src/main/java/com/gyee/alarm/config/GeneratorCodeConfig.java
  4. 20 0
      alarm-service/src/main/java/com/gyee/alarm/controller/ProEconAlarmPlanController.java
  5. 20 0
      alarm-service/src/main/java/com/gyee/alarm/controller/ProEconAlarmRealController.java
  6. 16 0
      alarm-service/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmPlanMapper.java
  7. 16 0
      alarm-service/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRealMapper.java
  8. 47 0
      alarm-service/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmPlan.java
  9. 37 0
      alarm-service/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmReal.java
  10. 14 14
      alarm-service/src/main/java/com/gyee/alarm/service/AlarmBtService.java
  11. 16 0
      alarm-service/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmPlanService.java
  12. 16 0
      alarm-service/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmRealService.java
  13. 20 0
      alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmPlanServiceImpl.java
  14. 20 0
      alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRealServiceImpl.java
  15. 6 1
      alarm-web/pom.xml
  16. 2 2
      alarm-web/src/main/java/com/gyee/alarm/config/GeneratorCodeConfig.java
  17. 47 0
      alarm-web/src/main/java/com/gyee/alarm/controller/AlertRuleController.java
  18. 242 0
      alarm-web/src/main/java/com/gyee/alarm/controller/ProEconAlarmPlanController.java
  19. 2 2
      alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java
  20. 329 0
      alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper3.java
  21. 74 0
      alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmPlanMapper.java
  22. 34 0
      alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRealMapper.java
  23. 2 0
      alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRuleMapper.java
  24. 61 0
      alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmPlan.java
  25. 40 0
      alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmReal.java
  26. 3 0
      alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmRule.java
  27. 380 0
      alarm-web/src/main/java/com/gyee/alarm/service/TokenNoTokenService.java
  28. 20 310
      alarm-web/src/main/java/com/gyee/alarm/service/TokenService.java
  29. 38 0
      alarm-web/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmPlanService.java
  30. 16 0
      alarm-web/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmRealService.java
  31. 171 0
      alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmPlanServiceImpl.java
  32. 20 0
      alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRealServiceImpl.java

+ 13 - 2
alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -4,6 +4,7 @@ package com.gyee.alarm.init;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.alibaba.fastjson.TypeReference;
 import com.gyee.alarm.init.redis.RedisService;
 import com.gyee.alarm.init.redis.RedisService;
+import com.gyee.alarm.model.vo.AlarmTypeValue;
 import com.gyee.alarm.model.vo.AlarmVo;
 import com.gyee.alarm.model.vo.AlarmVo;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.model.StringUtils;
@@ -31,7 +32,8 @@ import java.util.stream.Collectors;
 @Component
 @Component
 public class CacheContext implements CommandLineRunner {
 public class CacheContext implements CommandLineRunner {
     Logger logger = LoggerFactory.getLogger(CacheContext.class);
     Logger logger = LoggerFactory.getLogger(CacheContext.class);
-
+    @Value("${initialcode}")
+    private String initialcode;
     @Resource
     @Resource
     private IProBasicEquipmentService proBasicEquipmentService;
     private IProBasicEquipmentService proBasicEquipmentService;
     @Resource
     @Resource
@@ -397,7 +399,16 @@ public class CacheContext implements CommandLineRunner {
             if(null !=stringWindturbinetestingpointnewMap)
             if(null !=stringWindturbinetestingpointnewMap)
             {
             {
                 for(Map.Entry<String,ProBasicEquipmentPoint> entry : stringWindturbinetestingpointnewMap.entrySet()){
                 for(Map.Entry<String,ProBasicEquipmentPoint> entry : stringWindturbinetestingpointnewMap.entrySet()){
-                    wtPointList.add(entry.getValue());
+
+
+                    if (com.gyee.alarm.util.StringUtils.notEmp(initialcode) &&
+                            com.gyee.alarm.util.StringUtils.notEmp(entry.getValue().getNemCode()) &&
+                            !entry.getValue().getNemCode().equals(initialcode)
+                    )
+                    {
+                        wtPointList.add(entry.getValue());
+                    }
+
                 }
                 }
             }
             }
 
 

+ 229 - 151
alarm-custom/src/main/java/com/gyee/alarm/util/realtimesource/EdosUtil.java

@@ -51,23 +51,28 @@ public class EdosUtil implements IEdosUtil {
                 if (point.getNemCode().startsWith("GF-")){
                 if (point.getNemCode().startsWith("GF-")){
                     url =  baseURL2 + "/latest?null=0";
                     url =  baseURL2 + "/latest?null=0";
                 }
                 }
-                if (keys.isPresent())
+                if (keys.isPresent()) {
                     url = url + "&keys=" + keys.get();
                     url = url + "&keys=" + keys.get();
-                if (thingType.isPresent())
+                }
+                if (thingType.isPresent()) {
                     url = url + "&thingType=" + thingType.get();
                     url = url + "&thingType=" + thingType.get();
-                if (thingId.isPresent())
+                }
+                if (thingId.isPresent()) {
                     url = url + "&thingId=" + thingId.get();
                     url = url + "&thingId=" + thingId.get();
-                if (uniformCodes.isPresent())
+                }
+                if (uniformCodes.isPresent()) {
                     url = url + "&uniformCodes=" + uniformCodes.get();
                     url = url + "&uniformCodes=" + uniformCodes.get();
+                }
 
 
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonArray = resp.getBody();
                 JSONObject jsonArray = resp.getBody();
                 if (StringUtils.isNotEmpty(jsonArray)){
                 if (StringUtils.isNotEmpty(jsonArray)){
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                    if (list.size() > 0)
+                    if (list.size() > 0) {
                         return list.get(0);
                         return list.get(0);
-                    else
+                    } else {
                         return ErrorRequest.RequestError(point.getNemCode());
                         return ErrorRequest.RequestError(point.getNemCode());
+                    }
                 } else {
                 } else {
                     return ErrorRequest.RequestError(point.getNemCode());
                     return ErrorRequest.RequestError(point.getNemCode());
                 }
                 }
@@ -84,7 +89,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             return po;
             return po;
         }
         }
 
 
@@ -105,10 +110,11 @@ public class EdosUtil implements IEdosUtil {
             JSONObject jsonArray = resp.getBody();
             JSONObject jsonArray = resp.getBody();
             if (StringUtils.isNotEmpty(jsonArray)){
             if (StringUtils.isNotEmpty(jsonArray)){
                 List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                 List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                if (list.size() > 0)
+                if (list.size() > 0) {
                     return list.get(0);
                     return list.get(0);
-                else
+                } else {
                     return ErrorRequest.RequestError(point);
                     return ErrorRequest.RequestError(point);
+                }
             } else {
             } else {
                 return ErrorRequest.RequestError(point);
                 return ErrorRequest.RequestError(point);
             }
             }
@@ -117,7 +123,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point);
             po.setEdnaId(point);
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             return po;
             return po;
         }
         }
     }
     }
@@ -135,10 +141,11 @@ public class EdosUtil implements IEdosUtil {
             JSONObject jsonArray = resp.getBody();
             JSONObject jsonArray = resp.getBody();
             if (StringUtils.isNotEmpty(jsonArray)){
             if (StringUtils.isNotEmpty(jsonArray)){
                 List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                 List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                if (list.size() > 0)
+                if (list.size() > 0) {
                     return list.get(0);
                     return list.get(0);
-                else
+                } else {
                     return ErrorRequest.RequestError(point.getNemCode());
                     return ErrorRequest.RequestError(point.getNemCode());
+                }
             } else {
             } else {
                 return ErrorRequest.RequestError(point.getNemCode());
                 return ErrorRequest.RequestError(point.getNemCode());
             }
             }
@@ -147,7 +154,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             return po;
             return po;
         }
         }
 
 
@@ -170,10 +177,11 @@ public class EdosUtil implements IEdosUtil {
             JSONObject jsonArray = resp.getBody();
             JSONObject jsonArray = resp.getBody();
             if (StringUtils.isNotEmpty(jsonArray)){
             if (StringUtils.isNotEmpty(jsonArray)){
                 List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                 List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                if (list.size() > 0)
+                if (list.size() > 0) {
                     return list.get(0);
                     return list.get(0);
-                else
+                } else {
                     return ErrorRequest.RequestError(point.getNemCode());
                     return ErrorRequest.RequestError(point.getNemCode());
+                }
             } else {
             } else {
                 return ErrorRequest.RequestError(point.getNemCode());
                 return ErrorRequest.RequestError(point.getNemCode());
             }
             }
@@ -182,7 +190,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             return po;
             return po;
         }
         }
     }
     }
@@ -201,12 +209,13 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             Long finalInterval;
-            if (pried != null)
+            if (pried != null) {
                 finalInterval = pried;
                 finalInterval = pried;
-            else if (count != null)
+            } else if (count != null) {
                 finalInterval = (endDate - beginDate) / count;
                 finalInterval = (endDate - beginDate) / count;
-            else
+            } else {
                 return ErrorRequest.RequestListError(point.getNemCode());
                 return ErrorRequest.RequestListError(point.getNemCode());
+            }
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
 
             try {
             try {
@@ -216,22 +225,28 @@ public class EdosUtil implements IEdosUtil {
                 }
                 }
 
 
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
+                    }
+                    if (uniformCode.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCode.get();
                         url = url + "&uniformCodes=" + uniformCode.get();
+                    }
                 }
                 }
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
@@ -276,7 +291,7 @@ public class EdosUtil implements IEdosUtil {
                                 } else {
                                 } else {
                                     PointData data = new PointData();
                                     PointData data = new PointData();
                                     data.setEdnaId(point.getNemCode());
                                     data.setEdnaId(point.getNemCode());
-                                    data.setPointTime(0l);
+                                    data.setPointTime(0L);
                                     data.setPointValue("0");
                                     data.setPointValue("0");
                                     data.setPointName("1");
                                     data.setPointName("1");
                                     data.setPointValueInDouble(0.0);
                                     data.setPointValueInDouble(0.0);
@@ -285,7 +300,7 @@ public class EdosUtil implements IEdosUtil {
                             } else {
                             } else {
                                 PointData data = new PointData();
                                 PointData data = new PointData();
                                 data.setEdnaId(point.getNemCode());
                                 data.setEdnaId(point.getNemCode());
-                                data.setPointTime(0l);
+                                data.setPointTime(0L);
                                 data.setPointValue("0");
                                 data.setPointValue("0");
                                 data.setPointName("1");
                                 data.setPointName("1");
                                 data.setPointValueInDouble(0.0);
                                 data.setPointValueInDouble(0.0);
@@ -316,7 +331,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -355,7 +370,7 @@ public class EdosUtil implements IEdosUtil {
             } else {
             } else {
                 PointData data = new PointData();
                 PointData data = new PointData();
                 data.setEdnaId(pointid);
                 data.setEdnaId(pointid);
-                data.setPointTime(0l);
+                data.setPointTime(0L);
                 data.setPointValue("0");
                 data.setPointValue("0");
                 data.setPointName("1");
                 data.setPointName("1");
                 data.setPointValueInDouble(0.0);
                 data.setPointValueInDouble(0.0);
@@ -391,27 +406,32 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/snap?null=0";
                     url = baseURL2 + "/history/snap?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
+                    }
+                    if (uniformCode.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCode.get();
                         url = url + "&uniformCodes=" + uniformCode.get();
+                    }
                 }
                 }
 
 
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
+                if (jsonArray != null) {
                     return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
                     return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
-                else {
+                } else {
                     return ErrorRequest.RequestListError(point.getNemCode());
                     return ErrorRequest.RequestListError(point.getNemCode());
                 }
                 }
 
 
@@ -429,7 +449,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -455,24 +475,28 @@ public class EdosUtil implements IEdosUtil {
                 }
                 }
 
 
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (keys.isPresent())
+                if (keys.isPresent()) {
                     url = url + "&keys=" + keys.get();
                     url = url + "&keys=" + keys.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCodes.isPresent())
+                    }
+                    if (uniformCodes.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCodes.get();
                         url = url + "&uniformCodes=" + uniformCodes.get();
+                    }
                 }
                 }
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonArray = resp.getBody();
                 JSONObject jsonArray = resp.getBody();
                 if (StringUtils.isNotEmpty(jsonArray)){
                 if (StringUtils.isNotEmpty(jsonArray)){
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                    if (list.size() > 0)
+                    if (list.size() > 0) {
                         return list.get(0);
                         return list.get(0);
-                    else
+                    } else {
                         return ErrorRequest.RequestError(point.getNemCode());
                         return ErrorRequest.RequestError(point.getNemCode());
+                    }
                 } else {
                 } else {
                     return ErrorRequest.RequestError(point.getNemCode());
                     return ErrorRequest.RequestError(point.getNemCode());
                 }
                 }
@@ -490,7 +514,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             return po;
             return po;
         }
         }
 
 
@@ -509,12 +533,13 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             Long finalInterval;
-            if (pried != null)
+            if (pried != null) {
                 finalInterval = pried;
                 finalInterval = pried;
-            else if (count != null)
+            } else if (count != null) {
                 finalInterval = (endDate - beginDate) / count;
                 finalInterval = (endDate - beginDate) / count;
-            else
+            } else {
                 return ErrorRequest.RequestListError(point.getNemCode());
                 return ErrorRequest.RequestListError(point.getNemCode());
+            }
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
 
             try {
             try {
@@ -525,22 +550,28 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL + "/history/snap?null=0";
                     url = baseURL + "/history/snap?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
+                    }
+                    if (uniformCode.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCode.get();
                         url = url + "&uniformCodes=" + uniformCode.get();
+                    }
                 }
                 }
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
@@ -586,7 +617,7 @@ public class EdosUtil implements IEdosUtil {
                                 } else {
                                 } else {
                                     PointData data = new PointData();
                                     PointData data = new PointData();
                                     data.setEdnaId(point.getNemCode());
                                     data.setEdnaId(point.getNemCode());
-                                    data.setPointTime(0l);
+                                    data.setPointTime(0L);
                                     data.setPointValue("0");
                                     data.setPointValue("0");
                                     data.setPointName("1");
                                     data.setPointName("1");
                                     data.setPointValueInDouble(0.0);
                                     data.setPointValueInDouble(0.0);
@@ -595,7 +626,7 @@ public class EdosUtil implements IEdosUtil {
                             } else {
                             } else {
                                 PointData data = new PointData();
                                 PointData data = new PointData();
                                 data.setEdnaId(point.getNemCode());
                                 data.setEdnaId(point.getNemCode());
-                                data.setPointTime(0l);
+                                data.setPointTime(0L);
                                 data.setPointValue("0");
                                 data.setPointValue("0");
                                 data.setPointName("1");
                                 data.setPointName("1");
                                 data.setPointValueInDouble(0.0);
                                 data.setPointValueInDouble(0.0);
@@ -623,7 +654,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -649,27 +680,32 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL + "/history/snap?null=0";
                     url = baseURL + "/history/snap?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
+                    }
+                    if (uniformCode.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCode.get();
                         url = url + "&uniformCodes=" + uniformCode.get();
+                    }
                 }
                 }
 
 
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
+                if (jsonArray != null) {
                     return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
                     return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
-                else {
+                } else {
                     return ErrorRequest.RequestListError(point.getNemCode());
                     return ErrorRequest.RequestListError(point.getNemCode());
                 }
                 }
             } catch (HttpClientErrorException exception) {
             } catch (HttpClientErrorException exception) {
@@ -686,7 +722,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -705,19 +741,21 @@ public class EdosUtil implements IEdosUtil {
             }
             }
 
 
             try {
             try {
-                if (keys.isPresent())
+                if (keys.isPresent()) {
                     url = url + "&keys=" + keys.get();
                     url = url + "&keys=" + keys.get();
-                else
+                } else {
                     return null;
                     return null;
+                }
 
 
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonArray = resp.getBody();
                 JSONObject jsonArray = resp.getBody();
                 if (StringUtils.isNotEmpty(jsonArray)){
                 if (StringUtils.isNotEmpty(jsonArray)){
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
                     List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                    if (list.size() > 0)
+                    if (list.size() > 0) {
                         return list.get(0);
                         return list.get(0);
-                    else
+                    } else {
                         return ErrorRequest.RequestError(pointid);
                         return ErrorRequest.RequestError(pointid);
+                    }
                 } else {
                 } else {
                     return ErrorRequest.RequestError(pointid);
                     return ErrorRequest.RequestError(pointid);
                 }
                 }
@@ -735,7 +773,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(pointid);
             po.setEdnaId(pointid);
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             return po;
             return po;
         }
         }
 
 
@@ -752,9 +790,9 @@ public class EdosUtil implements IEdosUtil {
             url = baseURL2 + "/latest?null=0";
             url = baseURL2 + "/latest?null=0";
         }
         }
         try {
         try {
-            if (keys.isPresent())
+            if (keys.isPresent()) {
                 url = url + "&keys=" + keys.get();
                 url = url + "&keys=" + keys.get();
-            else {
+            } else {
                 return ErrorRequest.RequestListError(pointids);
                 return ErrorRequest.RequestListError(pointids);
             }
             }
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
@@ -784,8 +822,9 @@ public class EdosUtil implements IEdosUtil {
                     // 获得key
                     // 获得key
                     String key = sIterator.next();
                     String key = sIterator.next();
                     PointData pointData = pointDataHashMap.get(key);
                     PointData pointData = pointDataHashMap.get(key);
-                    if (pointData == null)
+                    if (pointData == null) {
                         continue;
                         continue;
+                    }
                     // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
                     // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
                     JSONObject jsonData = jsonObject.getJSONObject(key);
                     JSONObject jsonData = jsonObject.getJSONObject(key);
                     Long ts = jsonData.getLong("ts");
                     Long ts = jsonData.getLong("ts");
@@ -846,9 +885,9 @@ public class EdosUtil implements IEdosUtil {
             url = baseURL2 + "/latest?null=0";
             url = baseURL2 + "/latest?null=0";
         }
         }
         try {
         try {
-            if (keys.isPresent())
+            if (keys.isPresent()) {
                 url = url + "&keys=" + keys.get();
                 url = url + "&keys=" + keys.get();
-            else {
+            } else {
                 String[] arr = new String[pointids.size()];
                 String[] arr = new String[pointids.size()];
                 return ErrorRequest.RequestListError(pointids.toArray(arr));
                 return ErrorRequest.RequestListError(pointids.toArray(arr));
             }
             }
@@ -880,8 +919,9 @@ public class EdosUtil implements IEdosUtil {
                     // 获得key
                     // 获得key
                     String key = sIterator.next();
                     String key = sIterator.next();
                     PointData pointData = pointDataHashMap.get(key);
                     PointData pointData = pointDataHashMap.get(key);
-                    if (pointData == null)
+                    if (pointData == null) {
                         continue;
                         continue;
+                    }
                     // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
                     // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
                     JSONObject jsonData = jsonObject.getJSONObject(key);
                     JSONObject jsonData = jsonObject.getJSONObject(key);
                     Long ts = jsonData.getLong("ts");
                     Long ts = jsonData.getLong("ts");
@@ -951,10 +991,11 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/latest?null=0";
                     url = baseURL2 + "/latest?null=0";
                 }
                 }
                 try {
                 try {
-                    if (keys.isPresent())
+                    if (keys.isPresent()) {
                         url = url + "&keys=" + keys.get();
                         url = url + "&keys=" + keys.get();
-                    else
+                    } else {
                         return null;
                         return null;
+                    }
                     ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                     ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                     JSONObject jsonArray = resp.getBody();
                     JSONObject jsonArray = resp.getBody();
                     if (StringUtils.isNotEmpty(jsonArray)){
                     if (StringUtils.isNotEmpty(jsonArray)){
@@ -980,8 +1021,9 @@ public class EdosUtil implements IEdosUtil {
                         }
                         }
                         return resultMap;
                         return resultMap;
 
 
-                    } else
+                    } else {
                         return ErrorRequest.RequestMapError();
                         return ErrorRequest.RequestMapError();
+                    }
                 } catch (HttpClientErrorException exception) {
                 } catch (HttpClientErrorException exception) {
                     if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
                     if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
                         //System.out.println("404请求错误");
                         //System.out.println("404请求错误");
@@ -1029,12 +1071,13 @@ public class EdosUtil implements IEdosUtil {
 
 
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             Long finalInterval;
-            if (pried != null)
+            if (pried != null) {
                 finalInterval = pried;
                 finalInterval = pried;
-            else if (count != null)
+            } else if (count != null) {
                 finalInterval = (endDate - beginDate) / count;
                 finalInterval = (endDate - beginDate) / count;
-            else
+            } else {
                 return ErrorRequest.RequestListError(pointid);
                 return ErrorRequest.RequestListError(pointid);
+            }
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
 
             try {
             try {
@@ -1043,15 +1086,19 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/snap?null=0";
                     url = baseURL2 + "/history/snap?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
+                }
 
 
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
@@ -1095,7 +1142,7 @@ public class EdosUtil implements IEdosUtil {
                                 } else {
                                 } else {
                                     PointData data = new PointData();
                                     PointData data = new PointData();
                                     data.setEdnaId(pointid);
                                     data.setEdnaId(pointid);
-                                    data.setPointTime(0l);
+                                    data.setPointTime(0L);
                                     data.setPointValue("0");
                                     data.setPointValue("0");
                                     data.setPointName("1");
                                     data.setPointName("1");
                                     data.setPointValueInDouble(0.0);
                                     data.setPointValueInDouble(0.0);
@@ -1104,7 +1151,7 @@ public class EdosUtil implements IEdosUtil {
                             } else {
                             } else {
                                 PointData data = new PointData();
                                 PointData data = new PointData();
                                 data.setEdnaId(pointid);
                                 data.setEdnaId(pointid);
-                                data.setPointTime(0l);
+                                data.setPointTime(0L);
                                 data.setPointValue("0");
                                 data.setPointValue("0");
                                 data.setPointName("1");
                                 data.setPointName("1");
                                 data.setPointValueInDouble(0.0);
                                 data.setPointValueInDouble(0.0);
@@ -1132,7 +1179,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(pointid);
             po.setEdnaId(pointid);
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -1158,19 +1205,22 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/raw?null=0";
                     url = baseURL2 + "/history/raw?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                if (startTs.isPresent())
+                }
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
 
 
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
+                if (jsonArray != null) {
                     return JsonObjectHelper.phrasePointData(jsonArray, pointid);
                     return JsonObjectHelper.phrasePointData(jsonArray, pointid);
-                else {
+                } else {
                     return ErrorRequest.RequestListError(pointid);
                     return ErrorRequest.RequestListError(pointid);
                 }
                 }
             } catch (HttpClientErrorException exception) {
             } catch (HttpClientErrorException exception) {
@@ -1187,7 +1237,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(pointid);
             po.setEdnaId(pointid);
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -1214,12 +1264,13 @@ public class EdosUtil implements IEdosUtil {
 
 
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             Long finalInterval;
-            if (pried != null)
+            if (pried != null) {
                 finalInterval = pried;
                 finalInterval = pried;
-            else if (count != null)
+            } else if (count != null) {
                 finalInterval = (endDate - beginDate) / count;
                 finalInterval = (endDate - beginDate) / count;
-            else
+            } else {
                 return ErrorRequest.RequestListError(point.getNemCode());
                 return ErrorRequest.RequestListError(point.getNemCode());
+            }
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
 
             try {
             try {
@@ -1230,28 +1281,34 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL + "/history/stat?null=0";
                     url = baseURL + "/history/stat?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
+                    }
+                    if (uniformCode.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCode.get();
                         url = url + "&uniformCodes=" + uniformCode.get();
+                    }
                 }
                 }
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
+                if (jsonArray != null) {
                     return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
                     return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
-                else {
+                } else {
                     return ErrorRequest.RequestListError(point.getNemCode());
                     return ErrorRequest.RequestListError(point.getNemCode());
                 }
                 }
             } catch (HttpClientErrorException exception) {
             } catch (HttpClientErrorException exception) {
@@ -1268,7 +1325,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -1288,12 +1345,13 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             Long finalInterval;
-            if (pried != null)
+            if (pried != null) {
                 finalInterval = pried;
                 finalInterval = pried;
-            else if (count != null)
+            } else if (count != null) {
                 finalInterval = (endDate - beginDate) / count;
                 finalInterval = (endDate - beginDate) / count;
-            else
+            } else {
                 return ErrorRequest.RequestListError(point.getNemCode());
                 return ErrorRequest.RequestListError(point.getNemCode());
+            }
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
 
             try {
             try {
@@ -1302,28 +1360,34 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/stat?null=0";
                     url = baseURL2 + "/history/stat?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                else {
+                } else {
-                    if (thingType.isPresent())
+                    if (thingType.isPresent()) {
                         url = url + "&thingType=" + thingType.get();
                         url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
+                    }
+                    if (thingId.isPresent()) {
                         url = url + "&thingId=" + thingId.get();
                         url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
+                    }
+                    if (uniformCode.isPresent()) {
                         url = url + "&uniformCodes=" + uniformCode.get();
                         url = url + "&uniformCodes=" + uniformCode.get();
+                    }
                 }
                 }
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
+                if (jsonArray != null) {
                     return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
                     return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
-                else {
+                } else {
                     return ErrorRequest.RequestListError(point.getNemCode());
                     return ErrorRequest.RequestListError(point.getNemCode());
                 }
                 }
             } catch (HttpClientErrorException exception) {
             } catch (HttpClientErrorException exception) {
@@ -1340,7 +1404,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(point.getNemCode());
             po.setEdnaId(point.getNemCode());
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -1358,12 +1422,13 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             Long finalInterval;
-            if (count != null)
+            if (count != null) {
                 finalInterval = (endDate - beginDate) / count;
                 finalInterval = (endDate - beginDate) / count;
-            else if (pried != null)
+            } else if (pried != null) {
                 finalInterval = pried;
                 finalInterval = pried;
-            else
+            } else {
                 return null;
                 return null;
+            }
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             try {
             try {
                 String url = baseURL + "/history/stat?null=0";
                 String url = baseURL + "/history/stat?null=0";
@@ -1371,20 +1436,24 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/stat?null=0";
                     url = baseURL2 + "/history/stat?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                if (startTs.isPresent())
+                }
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 JSONArray jsonArray = resp.getBody();
                 JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
+                if (jsonArray != null) {
                     return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, pointid, type);
                     return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, pointid, type);
-                else {
+                } else {
                     return ErrorRequest.RequestListError(pointid);
                     return ErrorRequest.RequestListError(pointid);
                 }
                 }
             } catch (HttpClientErrorException exception) {
             } catch (HttpClientErrorException exception) {
@@ -1402,7 +1471,7 @@ public class EdosUtil implements IEdosUtil {
             PointData po=new PointData();
             PointData po=new PointData();
             po.setEdnaId(pointid);
             po.setEdnaId(pointid);
             po.setPointValueInDouble(0.0);
             po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
+            po.setPointTime(0L);
             pols.add(po);
             pols.add(po);
             return pols;
             return pols;
         }
         }
@@ -1427,14 +1496,18 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/stat?null=0";
                     url = baseURL2 + "/history/stat?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
-                if (startTs.isPresent())
+                }
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=" + interval.get();
                     url = url + "&interval=" + interval.get();
+                }
 
 
                 ////System.out.println(restTemplate.getForEntity(url, JSONArray.class));
                 ////System.out.println(restTemplate.getForEntity(url, JSONArray.class));
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
@@ -1650,8 +1723,9 @@ public class EdosUtil implements IEdosUtil {
                     throw exception;
                     throw exception;
                 }
                 }
             }
             }
-        } else
+        } else {
             return;
             return;
+        }
     }
     }
 
 
 
 
@@ -1772,7 +1846,7 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
 
 
             //通过时间区间和时间间隔获取点数
             //通过时间区间和时间间隔获取点数
-            Long finalInterval=60l;
+            Long finalInterval= 60L;
 
 
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
 
@@ -1782,15 +1856,19 @@ public class EdosUtil implements IEdosUtil {
                     url = baseURL2 + "/history/snap?null=0";
                     url = baseURL2 + "/history/snap?null=0";
                 }
                 }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
+                if (tagName.isPresent()) {
                     url = url + "&tagName=" + tagName.get();
                     url = url + "&tagName=" + tagName.get();
+                }
 
 
-                if (startTs.isPresent())
+                if (startTs.isPresent()) {
                     url = url + "&startTs=" + startTs.get();
                     url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
+                }
+                if (endTs.isPresent()) {
                     url = url + "&endTs=" + endTs.get();
                     url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
+                }
+                if (interval.isPresent()) {
                     url = url + "&interval=60" ;
                     url = url + "&interval=60" ;
+                }
 
 
 
 
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
                 ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);

+ 4 - 4
alarm-service/src/main/java/com/gyee/alarm/config/GeneratorCodeConfig.java

@@ -39,8 +39,8 @@ public class GeneratorCodeConfig {
         // 全局配置
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
         GlobalConfig gc = new GlobalConfig();
         String projectPath = System.getProperty("user.dir");
         String projectPath = System.getProperty("user.dir");
-        gc.setOutputDir(projectPath+"/alarmXK"+ "/src/main/java");
+        gc.setOutputDir(projectPath+"/alarm-service"+ "/src/main/java");
-        gc.setAuthor("xieshengjie");
+        gc.setAuthor("shilin");
         gc.setOpen(false);
         gc.setOpen(false);
         //实体属性 Swagger2 注解
         //实体属性 Swagger2 注解
         gc.setSwagger2(false);
         gc.setSwagger2(false);
@@ -61,7 +61,7 @@ public class GeneratorCodeConfig {
         dsc.setDriverName("org.postgresql.Driver");
         dsc.setDriverName("org.postgresql.Driver");
         dsc.setUsername("postgres");
         dsc.setUsername("postgres");
         dsc.setPassword("gd123");
         dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:postgresql://127.0.0.1:5432/sd20230309");
+        dsc.setUrl("jdbc:postgresql://127.0.0.1:5432/IMS_NEM_JN");
 //        dsc.setDriverName("org.postgresql.Driver");
 //        dsc.setDriverName("org.postgresql.Driver");
 //        dsc.setUsername("postgres");
 //        dsc.setUsername("postgres");
 //        dsc.setPassword("postgres");
 //        dsc.setPassword("postgres");
@@ -76,7 +76,7 @@ public class GeneratorCodeConfig {
         // 包配置
         // 包配置
         PackageConfig pc = new PackageConfig();
         PackageConfig pc = new PackageConfig();
 //        pc.setModuleName(scanner("模块名"));
 //        pc.setModuleName(scanner("模块名"));
-        pc.setParent("com.gyee.generation");
+        pc.setParent("com.gyee.alarm");
         pc.setEntity("model.auto");
         pc.setEntity("model.auto");
         pc.setMapper("mapper.auto");
         pc.setMapper("mapper.auto");
         pc.setService("service.auto");
         pc.setService("service.auto");

+ 20 - 0
alarm-service/src/main/java/com/gyee/alarm/controller/ProEconAlarmPlanController.java

@@ -0,0 +1,20 @@
+package com.gyee.alarm.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@RestController
+@RequestMapping("//pro-econ-alarm-plan")
+public class ProEconAlarmPlanController {
+
+}

+ 20 - 0
alarm-service/src/main/java/com/gyee/alarm/controller/ProEconAlarmRealController.java

@@ -0,0 +1,20 @@
+package com.gyee.alarm.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@RestController
+@RequestMapping("//pro-econ-alarm-real")
+public class ProEconAlarmRealController {
+
+}

+ 16 - 0
alarm-service/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmPlanMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.alarm.mapper.auto;
+
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface ProEconAlarmPlanMapper extends BaseMapper<ProEconAlarmPlan> {
+
+}

+ 16 - 0
alarm-service/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRealMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.alarm.mapper.auto;
+
+import com.gyee.alarm.model.auto.ProEconAlarmReal;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface ProEconAlarmRealMapper extends BaseMapper<ProEconAlarmReal> {
+
+}

+ 47 - 0
alarm-service/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmPlan.java

@@ -0,0 +1,47 @@
+package com.gyee.alarm.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconAlarmPlan extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 类型
+     */
+    private String types;
+
+    /**
+     * 排查方法
+     */
+    private String troubleMethod;
+
+    /**
+     * 处理方法
+     */
+    private String processMethod;
+
+    /**
+     * 工器具
+     */
+    private String tools;
+
+
+}

+ 37 - 0
alarm-service/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmReal.java

@@ -0,0 +1,37 @@
+package com.gyee.alarm.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconAlarmReal extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 预警编号
+     */
+    private String alarmId;
+
+    /**
+     * 排查方法
+     */
+    private String alarmPlan;
+
+
+}

+ 14 - 14
alarm-service/src/main/java/com/gyee/alarm/service/AlarmBtService.java

@@ -78,20 +78,20 @@ public class AlarmBtService {
                         vo.getName(),
                         vo.getName(),
                         vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
                         vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
 
 
-                alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
+//                alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
-                        vo.getCharacteristic(), vo.getComponents(),
+//                        vo.getCharacteristic(), vo.getComponents(),
-                        vo.getDescription(),
+//                        vo.getDescription(),
-                        vo.getDeviceid(), vo.getDevicename(),
+//                        vo.getDeviceid(), vo.getDevicename(),
-                        vo.getDevicetype(), vo.getEnabled(),
+//                        vo.getDevicetype(), vo.getEnabled(),
-                        vo.getLineid(), vo.getLinename(),
+//                        vo.getLineid(), vo.getLinename(),
-                        vo.getModelId(), vo.getProjectid(),
+//                        vo.getModelId(), vo.getProjectid(),
-                        vo.getProjectname(), vo.getRank(),
+//                        vo.getProjectname(), vo.getRank(),
-                        vo.getResettable(), vo.getStationid(),
+//                        vo.getResettable(), vo.getStationid(),
-                        vo.getStationname(), vo.getSubcomponents(),
+//                        vo.getStationname(), vo.getSubcomponents(),
-                        vo.getSuffix(), vo.getTagid(),
+//                        vo.getSuffix(), vo.getTagid(),
-                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
+//                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
-                        vo.getName(),
+//                        vo.getName(),
-                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
+//                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
 
 
             }
             }
         }
         }

+ 16 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmPlanService.java

@@ -0,0 +1,16 @@
+package com.gyee.alarm.service.auto;
+
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface IProEconAlarmPlanService extends IService<ProEconAlarmPlan> {
+
+}

+ 16 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmRealService.java

@@ -0,0 +1,16 @@
+package com.gyee.alarm.service.auto;
+
+import com.gyee.alarm.model.auto.ProEconAlarmReal;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface IProEconAlarmRealService extends IService<ProEconAlarmReal> {
+
+}

+ 20 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmPlanServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.alarm.service.auto.impl;
+
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.gyee.alarm.mapper.auto.ProEconAlarmPlanMapper;
+import com.gyee.alarm.service.auto.IProEconAlarmPlanService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Service
+public class ProEconAlarmPlanServiceImpl extends ServiceImpl<ProEconAlarmPlanMapper, ProEconAlarmPlan> implements IProEconAlarmPlanService {
+
+}

+ 20 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRealServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.alarm.service.auto.impl;
+
+import com.gyee.alarm.model.auto.ProEconAlarmReal;
+import com.gyee.alarm.mapper.auto.ProEconAlarmRealMapper;
+import com.gyee.alarm.service.auto.IProEconAlarmRealService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Service
+public class ProEconAlarmRealServiceImpl extends ServiceImpl<ProEconAlarmRealMapper, ProEconAlarmReal> implements IProEconAlarmRealService {
+
+}

+ 6 - 1
alarm-web/pom.xml

@@ -156,10 +156,15 @@
             <version>3.17</version>
             <version>3.17</version>
         </dependency>
         </dependency>
 
 
+<!--        <dependency>-->
+<!--            <groupId>com.taosdata.jdbc</groupId>-->
+<!--            <artifactId>taos-jdbcdriver</artifactId>-->
+<!--            <version>3.2.2</version>-->
+<!--        </dependency>-->
         <dependency>
         <dependency>
             <groupId>com.taosdata.jdbc</groupId>
             <groupId>com.taosdata.jdbc</groupId>
             <artifactId>taos-jdbcdriver</artifactId>
             <artifactId>taos-jdbcdriver</artifactId>
-            <version>3.2.2</version>
+            <version>2.0.39</version>
         </dependency>
         </dependency>
         <!-- 工具类相关 -->
         <!-- 工具类相关 -->
         <dependency>
         <dependency>

+ 2 - 2
alarm-web/src/main/java/com/gyee/alarm/config/GeneratorCodeConfig.java

@@ -39,7 +39,7 @@ public class GeneratorCodeConfig {
         // 全局配置
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
         GlobalConfig gc = new GlobalConfig();
         String projectPath = System.getProperty("user.dir");
         String projectPath = System.getProperty("user.dir");
-        gc.setOutputDir(projectPath+"/alarm-web"+ "/src/main/java");
+        gc.setOutputDir(projectPath+"/alarm-service"+ "/src/main/java");
         gc.setAuthor("shilin");
         gc.setAuthor("shilin");
         gc.setOpen(false);
         gc.setOpen(false);
         //实体属性 Swagger2 注解
         //实体属性 Swagger2 注解
@@ -61,7 +61,7 @@ public class GeneratorCodeConfig {
         dsc.setDriverName("org.postgresql.Driver");
         dsc.setDriverName("org.postgresql.Driver");
         dsc.setUsername("postgres");
         dsc.setUsername("postgres");
         dsc.setPassword("gd123");
         dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/IMS_NEM_JN");
+        dsc.setUrl("jdbc:postgresql://127.0.0.1:5432/IMS_NEM_JN");
 //        dsc.setDriverName("org.postgresql.Driver");
 //        dsc.setDriverName("org.postgresql.Driver");
 //        dsc.setUsername("postgres");
 //        dsc.setUsername("postgres");
 //        dsc.setPassword("postgres");
 //        dsc.setPassword("postgres");

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

@@ -9,6 +9,8 @@ import com.gyee.alarm.model.vo.*;
 import com.gyee.alarm.service.AlarmRuleService;
 import com.gyee.alarm.service.AlarmRuleService;
 
 
 import com.gyee.alarm.service.TokenService;
 import com.gyee.alarm.service.TokenService;
+import com.gyee.alarm.service.auto.IProEconAlarmPlanService;
+import com.gyee.alarm.service.auto.IProEconAlarmRealService;
 import com.gyee.alarm.service.auto.IProEconAlarmTypeService;
 import com.gyee.alarm.service.auto.IProEconAlarmTypeService;
 import com.gyee.alarm.util.ExcelUtils;
 import com.gyee.alarm.util.ExcelUtils;
 import com.gyee.alarm.util.SnowflakeGenerator;
 import com.gyee.alarm.util.SnowflakeGenerator;
@@ -50,9 +52,48 @@ public class AlertRuleController {
     @Resource
     @Resource
     private IProEconAlarmTypeService proEconAlarmTypeService;
     private IProEconAlarmTypeService proEconAlarmTypeService;
 
 
+
+    @Resource
+    private IProEconAlarmPlanService proEconAlarmPlanService;
+
+    @Resource
+    private IProEconAlarmRealService proEconAlarmRealService;
+
     @Resource
     @Resource
     private TokenService tokenService;
     private TokenService tokenService;
 
 
+
+
+    @GetMapping(value = "/alarmPlanlist")
+    @ApiOperation(value = "预警解决方案列表", notes = "预警解决方案列表")
+    public AjaxResult queryAlarmPlanlist() {
+        List<ProEconAlarmPlan> alertrules = proEconAlarmPlanService.list();
+        if (StringUtils.notEmp(alertrules)) {
+
+            return AjaxResult.successData(AjaxStatus.success.code, alertrules);
+        } else {
+            return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
+        }
+    }
+
+    @GetMapping(value = "/alarmPlanlistById")
+    @ApiOperation(value = "通过预警编号获得报警解决方案列表", notes = "通过预警编号获得报警解决方案列表")
+    public AjaxResult alarmPlanlistById(String alarmId) {
+
+        List<ProEconAlarmPlan> vos=new ArrayList<>();
+        if(StringUtils.notEmp( alarmId) )
+        {
+            vos= proEconAlarmPlanService.alarmPlanlistById(alarmId);
+        }
+
+        if (StringUtils.notEmp(vos)) {
+
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
+        }
+    }
+
     @GetMapping(value = "/querywtalarmdesclist")
     @GetMapping(value = "/querywtalarmdesclist")
     @ApiOperation(value = "通过场站、型号和部件查询报警描述信息", notes = "通过场站、型号和部件查询报警描述信息")
     @ApiOperation(value = "通过场站、型号和部件查询报警描述信息", notes = "通过场站、型号和部件查询报警描述信息")
     @ApiImplicitParams({
     @ApiImplicitParams({
@@ -410,8 +451,11 @@ public class AlertRuleController {
 
 
         if (StringUtils.notEmp(alarmRule)) {
         if (StringUtils.notEmp(alarmRule)) {
 
 
+
             int result = alarmRuleService.saveAndUpdateAlertrule(alarmRule);
             int result = alarmRuleService.saveAndUpdateAlertrule(alarmRule);
 
 
+            proEconAlarmPlanService.updatePlanlistById(alarmRule.getId(), alarmRule.getAlarmPlan());
+
             return AjaxResult.successData(AjaxStatus.success.code, result);
             return AjaxResult.successData(AjaxStatus.success.code, result);
         } else {
         } else {
             return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
             return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
@@ -429,6 +473,9 @@ public class AlertRuleController {
 
 
         int i = alarmRuleService.deleteAlertrule(id);
         int i = alarmRuleService.deleteAlertrule(id);
 
 
+
+
+
         if (StringUtils.notEmp(i)) {
         if (StringUtils.notEmp(i)) {
             return AjaxResult.successData(AjaxStatus.success.code, i);
             return AjaxResult.successData(AjaxStatus.success.code, i);
         } else {
         } else {

+ 242 - 0
alarm-web/src/main/java/com/gyee/alarm/controller/ProEconAlarmPlanController.java

@@ -0,0 +1,242 @@
+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.ProEconAlarmPlan;
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.gyee.alarm.model.vo.AjaxResult;
+import com.gyee.alarm.model.vo.AjaxStatus;
+import com.gyee.alarm.model.vo.AlarmCustomType;
+import com.gyee.alarm.service.auto.IProEconAlarmPlanService;
+import com.gyee.alarm.util.ExcelUtils;
+import com.gyee.alarm.util.StringUtils;
+import com.gyee.common.util.DateUtils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@RestController
+@RequestMapping("//alarmplan")
+public class ProEconAlarmPlanController {
+
+    @Resource
+    private IProEconAlarmPlanService proEconAlarmPlanService;
+
+
+    //@UserLoginToken
+    @PostMapping(value = "/save")
+    @ResponseBody
+    @ApiOperation(value = "进行修改和保存", notes = "进行修改和保存")
+    public AjaxResult saveAndUpdateAlertrule(HttpServletRequest request, @RequestBody ProEconAlarmPlan alarmRule) throws Exception {
+
+
+        if (StringUtils.notEmp(alarmRule)) {
+
+
+            int result = proEconAlarmPlanService.saveAndUpdateAlertrule(alarmRule);
+
+
+            return AjaxResult.successData(AjaxStatus.success.code, result);
+        } else {
+            return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
+        }
+
+
+    }
+
+    @DeleteMapping(value = "/delete")
+    @ApiOperation(value = "删除", notes = "删除")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "id", value = "自定义报警主键", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult deleteAlertrule(String id) {
+        boolean i =false;
+        if(StringUtils.notEmp(id))
+        {
+            List<String> idls= Arrays.asList(id.split(","));   ;
+            i = proEconAlarmPlanService.deleteAlertrule(idls);
+        }
+
+
+
+
+
+        if (StringUtils.notEmp(i)) {
+            return AjaxResult.successData(AjaxStatus.success.code, i);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, "error");
+        }
+    }
+
+    //@UserLoginToken
+    @GetMapping(value = "/page")
+    @ApiOperation(value = "分页查询", notes = "分页查询")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "pageNum", value = "页号", required = true, dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "pageSize", value = "每页显示多少行", required = true, dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "name", 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
+    ) {
+        Page<ProEconAlarmPlan> page = new Page(pageNum, pageSize);
+
+        IPage<ProEconAlarmPlan> pageResult = proEconAlarmPlanService.pageQueryAll(page, name);
+
+
+        if (StringUtils.notEmp(pageResult)) {
+
+            return AjaxResult.successData(AjaxStatus.success.code, pageResult);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, "error");
+        }
+    }
+
+
+    //@UserLoginToken
+    @PostMapping(value = "/save-batch")
+    @ResponseBody
+    @ApiOperation(value = "批量保存", notes = "分页查询")
+    public AjaxResult saveAlertruleBatch(HttpServletRequest request, @RequestBody List<ProEconAlarmPlan> lst) throws Exception {
+
+
+        boolean allCheck = true;
+
+        for (ProEconAlarmPlan alertrule : lst) {
+            String msg = "";
+            boolean result = true;
+            if (StringUtils.isBlank(alertrule.getName())) {
+                msg = "名称不能为空";
+                result = false;
+            } else if (StringUtils.isBlank(alertrule.getSpareParts())) {
+                msg = "备件不能为空";
+                result = false;
+            } else if (StringUtils.isBlank(alertrule.getTroubleMethod())) {
+                msg = "排查步骤不能为空";
+                result = false;
+            } else if (StringUtils.empty(alertrule.getProcessMethod())) {
+                msg = "检修方案不能为空";
+                result = false;
+            } else if (StringUtils.isBlank(alertrule.getTools())) {
+                msg = "所需工具不能为空";
+                result = false;
+            }
+
+            if (result != true) {
+                allCheck = false;
+                if (!result) {
+                    return AjaxResult.successData(AjaxStatus.error.code, msg);
+                }
+            }
+        }
+        if (allCheck) {
+            for (ProEconAlarmPlan alertRule : lst) {
+                int result = proEconAlarmPlanService.saveAndUpdateAlertrule(alertRule);
+                if (result <= 0) {
+                    return AjaxResult.successData(AjaxStatus.error.code, alertRule.getName() + ":" + "操作数据库失败");
+
+                }
+            }
+            return AjaxResult.successData(AjaxStatus.success.code, "ok");
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, "error");
+        }
+
+
+    }
+
+
+    @GetMapping("/importtemplate")
+    @ApiOperation(value = "获得导入模板")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        // 手动创建导出 demo
+
+
+        List<ProEconAlarmPlan> list = Arrays.asList(
+                ProEconAlarmPlan.builder().id("1").types("类型1").troubleMethod("排查步骤1")
+                        .processMethod("检修方案").tools("所需工具1").spareParts("备品备件1").name("名字1")
+
+                        .build(),
+                ProEconAlarmPlan.builder().id("2").types("类型2").troubleMethod("排查步骤2")
+                        .processMethod("检修方案2").tools("所需工具2").spareParts("备品备件2").name("名字2")
+
+                        .build()
+
+        );
+
+        // 输出
+        ExcelUtils.write(response, "导入模板.xls", "导入模板", ProEconAlarmPlan.class, list);
+    }
+
+    @PostMapping("/import")
+    @ApiOperation(value = "导入", notes = "导入")
+    public AjaxResult importExcel(@RequestParam("file") MultipartFile file) throws Exception {
+        List<ProEconAlarmPlan> list = ExcelUtils.read(file, ProEconAlarmPlan.class);
+
+        if (com.gyee.common.model.StringUtils.notEmp(list) && !list.isEmpty()) {
+            boolean allCheck = true;
+            for (ProEconAlarmPlan alertrule : list) {
+                String msg = "";
+                boolean result = true;
+                if (StringUtils.isBlank(alertrule.getTypes())) {
+                    msg = "类型不能为空";
+                    result = false;
+                } else if (StringUtils.isBlank(alertrule.getTroubleMethod())) {
+                    msg = "排查方法不能为空";
+                    result = false;
+                } else if (StringUtils.isBlank(alertrule.getProcessMethod())) {
+                    msg = "处理方法不能为空";
+                    result = false;
+                } else if (StringUtils.empty(alertrule.getTools())) {
+                    msg = "处理工具不能为空";
+                    result = false;
+                }
+                if (result != true) {
+                    allCheck = false;
+                    if (!result) {
+                        return AjaxResult.successData(AjaxStatus.error.code, msg);
+                    }
+                }
+
+                if (allCheck) {
+
+
+                    proEconAlarmPlanService.saveAndUpdateAlertrule(alertrule);
+                }
+
+            }
+        }
+        if (com.gyee.common.model.StringUtils.isNotNull(list)) {
+            return AjaxResult.successData(AjaxStatus.success.code, list);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, "error");
+        }
+
+
+    }
+
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 329 - 0
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper3.java


+ 74 - 0
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmPlanMapper.java

@@ -0,0 +1,74 @@
+package com.gyee.alarm.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.gyee.alarm.model.auto.ProEconAlarmRule;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface ProEconAlarmPlanMapper extends BaseMapper<ProEconAlarmPlan> {
+
+
+
+    @Select({"<script>",
+            "select trouble_method from pro_econ_alarm_plan ",
+            "<where>",
+            " 1=1 ",
+
+            "<if test='troubleMethod !=null  '>",
+            "and trouble_method = #{troubleMethod} ",
+            "</if>",
+
+            "</where>",
+
+            "</script>"})
+    List<ProEconAlarmPlan> queryObject(@Param("troubleMethod") String troubleMethod);
+
+
+    @Update({"<script>",
+            "update pro_econ_alarm_plan ",
+            "<set>",
+            "types = #{types}",
+            "trouble_method = #{troubleMethod}",
+            "process_method = #{processMethod}",
+            "tools = #{tools}" ,
+            "spare_parts = #{spareParts}" ,
+            "name = #{name}" ,
+            "</set>",
+            "where id = #{id}",
+
+            "</script>"})
+    Integer updateByAlertruleId(ProEconAlarmPlan alertrule);
+
+
+    @Select({"<script>",
+            "select * from pro_econ_alarm_plan ",
+            "<where>",
+            " 1=1 ",
+
+
+            "<if test='name !=null  '>",
+            "and a.name like #{name} ",
+            "</if>",
+
+            "</where>",
+
+            "</script>"})
+    IPage<ProEconAlarmPlan> pageQueryAll(Page page,
+                                         @Param("name") String name);
+
+
+}

+ 34 - 0
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRealMapper.java

@@ -0,0 +1,34 @@
+package com.gyee.alarm.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.gyee.alarm.model.auto.ProEconAlarmReal;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface ProEconAlarmRealMapper extends BaseMapper<ProEconAlarmReal> {
+
+
+    @Select({"<script>",
+            "select a.* from pro_econ_alarm_real a",
+            "<where>",
+            " a.alarm_id = #{alarmId} ",
+            "</where>",
+
+            "</script>"})
+    List<ProEconAlarmReal> alarmPlanlistById( @Param("alarmId") String alarmId);
+
+    void update(ProEconAlarmReal ar);
+}

+ 2 - 0
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconAlarmRuleMapper.java

@@ -2,6 +2,7 @@ package com.gyee.alarm.mapper.auto;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
 import com.gyee.alarm.model.auto.ProEconAlarmRule;
 import com.gyee.alarm.model.auto.ProEconAlarmRule;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.alarm.model.vo.AlarmRuleVo;
 import com.gyee.alarm.model.vo.AlarmRuleVo;
@@ -23,6 +24,7 @@ import java.util.List;
 public interface ProEconAlarmRuleMapper extends BaseMapper<ProEconAlarmRule> {
 public interface ProEconAlarmRuleMapper extends BaseMapper<ProEconAlarmRule> {
 
 
 
 
+
     @Update({"<script>",
     @Update({"<script>",
             "update pro_econ_alarm_rule ",
             "update pro_econ_alarm_rule ",
             "<set>",
             "<set>",

+ 61 - 0
alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmPlan.java

@@ -0,0 +1,61 @@
+package com.gyee.alarm.model.auto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
+public class ProEconAlarmPlan extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "ID",type = IdType.INPUT)
+    private String id;
+
+    /**
+     * 类型
+     */
+    private String types;
+
+    /**
+     * 排查步骤
+     */
+    private String troubleMethod;
+
+    /**
+     * 检修方案
+     */
+    private String processMethod;
+
+    /**
+     * 所需工具
+     */
+    private String tools;
+    /**
+     * 备品备件
+     */
+    private String spareParts;
+    /**
+     * 名称
+     */
+    private String name;
+}

+ 40 - 0
alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmReal.java

@@ -0,0 +1,40 @@
+package com.gyee.alarm.model.auto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconAlarmReal extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "ID",type = IdType.INPUT)
+    private String id;
+
+    /**
+     * 预警编号
+     */
+    private String alarmId;
+
+    /**
+     * 排查方法
+     */
+    private String alarmPlan;
+
+
+}

+ 3 - 0
alarm-web/src/main/java/com/gyee/alarm/model/auto/ProEconAlarmRule.java

@@ -159,4 +159,7 @@ public class ProEconAlarmRule extends Model {
     private String stationName;
     private String stationName;
     @TableField(exist = false)
     @TableField(exist = false)
     private String relatedPartsName;
     private String relatedPartsName;
+
+    @TableField(exist = false)
+    private String alarmPlan;
 }
 }

+ 380 - 0
alarm-web/src/main/java/com/gyee/alarm/service/TokenNoTokenService.java

@@ -0,0 +1,380 @@
+package com.gyee.alarm.service;
+
+
+import cn.hutool.core.bean.BeanUtil;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.model.vo.TokenVo;
+import com.gyee.alarm.service.auto.ISysUserService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+@Service
+public class TokenNoTokenService {
+    @Resource
+    private ISysUserService sysUserService;
+
+
+    public static Map<String, List<ProBasicEquipment>> sessionWtMap = new ConcurrentHashMap<>();
+    public static Map<String, List<ProBasicPowerstation>> sessionWpMap = new ConcurrentHashMap<>();
+    public static Map<String,  List<ProBasicSubStation> > sessionSubMap = new ConcurrentHashMap<>();
+    public static Map<String, List<ProBasicWeatherStation>> sessionWeMap = new ConcurrentHashMap<>();
+
+    public static Map<String, TokenVo> sessionMap=  new ConcurrentHashMap<>();
+
+    public  List<ProBasicEquipment>  getWtls(HttpServletRequest request ) {
+
+        String token = request.getHeader("token");
+        String userId = request.getHeader("userId");
+
+        List<ProBasicEquipment> wtlist = new ArrayList<>();
+        if (StringUtils.notEmp(token) && StringUtils.notEmp(userId))
+        {
+//            if (sessionMap.containsKey(token) && !sessionWtMap.containsKey(token)) {
+
+                List<String> depls = sysUserService.getUserByuserId(Long.valueOf(userId));
+                if (!depls.isEmpty()) {
+                    String depId = depls.get(0);
+
+                    if (CacheContext.wpwtmap.containsKey(depId)) {
+
+                        List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(depId);
+                        for(ProBasicEquipment wt:wtls)
+                        {
+                            ProBasicEquipment newWt=  new ProBasicEquipment();
+                            BeanUtil.copyProperties( wt,newWt);
+                            wtlist.add(newWt);
+                        }
+
+                    } else if (CacheContext.cmwtlsmap.containsKey(depId)) {
+
+                        List<ProBasicEquipment> wtls=CacheContext.cmwtlsmap.get(depId);
+                        for(ProBasicEquipment wt:wtls)
+                        {
+                            ProBasicEquipment newWt=  new ProBasicEquipment();
+                            BeanUtil.copyProperties( wt,newWt);
+                            wtlist.add(newWt);
+                        }
+
+                    } else if (CacheContext.rgwtlsmap.containsKey(depId)) {
+
+                        List<ProBasicEquipment> wtls=CacheContext.rgwtlsmap.get(depId);
+                        for(ProBasicEquipment wt:wtls)
+                        {
+                            ProBasicEquipment newWt=  new ProBasicEquipment();
+                            BeanUtil.copyProperties( wt,newWt);
+                            wtlist.add(newWt);
+                        }
+
+                    }else  if(depId.equals("0"))
+                    {
+                        for(ProBasicEquipment wt:CacheContext.wtls)
+                        {
+                            ProBasicEquipment newWt=  new ProBasicEquipment();
+                            BeanUtil.copyProperties( wt,newWt);
+                            wtlist.add(newWt);
+                        }
+
+                    }
+                }
+//                sessionWtMap.put(token,wtlist);
+//            } else if (sessionMap.containsKey(token) && sessionWtMap.containsKey(token))
+//            {
+//                wtlist =sessionWtMap.get(token);
+//            }
+        }else
+        {
+            for(ProBasicEquipment wt:CacheContext.wtls)
+            {
+                ProBasicEquipment newWt=  new ProBasicEquipment();
+                BeanUtil.copyProperties( wt,newWt);
+                wtlist.add(newWt);
+            }
+
+        }
+        return wtlist;
+    }
+
+    public  List<ProBasicPowerstation>  getWpls(HttpServletRequest request )
+    {
+        String token = request.getHeader("token");
+        String userId = request.getHeader("userId");
+
+        List<ProBasicPowerstation> wplist=new ArrayList<>();
+        if(StringUtils.notEmp(token)  && StringUtils.notEmp(token))
+        {
+//            if(sessionMap.containsKey(token) && !sessionWpMap.containsKey(token))
+//            {
+
+                List<String> depls= sysUserService.getUserByuserId(Long.valueOf(userId));
+                if(!depls.isEmpty())
+                {
+                    String depId=depls.get(0);
+
+                    if(CacheContext.wpmap.containsKey(depId))
+                    {
+
+                        ProBasicPowerstation wp= CacheContext.wpmap.get(depId);
+                        ProBasicPowerstation newWp=  new ProBasicPowerstation();
+                        BeanUtil.copyProperties(wp, newWp);
+                        wplist.add(newWp);
+                    }else  if(CacheContext.cpwpmap.containsKey(depId))
+                    {
+                        List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(depId);
+                        for(ProBasicPowerstation wp:wpls)
+                        {
+                            ProBasicPowerstation newWp=  new ProBasicPowerstation();
+                            BeanUtil.copyProperties(wp, newWp);
+                            wplist.add(newWp);
+                        }
+
+                    }else  if(CacheContext.rgmap.containsKey(depId))
+                    {
+                        List<ProBasicCompany> rgcpls= CacheContext.rgcpmap.get(depId);
+                        for(ProBasicCompany cp:rgcpls)
+                        {
+                            List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(cp.getId());
+                            for(ProBasicPowerstation wp:wpls)
+                            {
+                                ProBasicPowerstation newWp=  new ProBasicPowerstation();
+                                BeanUtil.copyProperties(wp, newWp);
+                                wplist.add(newWp);
+                            }
+                        }
+
+                    }else if(depId.equals("0"))
+                    {
+                        wplist=sessionWpMap.get(token);
+                    }else if(depId.equals("0"))
+                    {
+                        List<ProBasicPowerstation> wpls=CacheContext.wpls;
+                        for(ProBasicPowerstation wp:wpls)
+                        {
+                            ProBasicPowerstation newWp=  new ProBasicPowerstation();
+                            BeanUtil.copyProperties(wp, newWp);
+                            wplist.add(newWp);
+                        }
+
+                    }
+                }
+//                sessionWpMap.put(token,wplist);
+//            }else if (sessionMap.containsKey(token) && sessionWpMap.containsKey(token))
+//            {
+//                wplist=sessionWpMap.get(token);
+//            }
+
+        }else
+        {
+            List<ProBasicPowerstation> wpls=CacheContext.wpls;
+            for(ProBasicPowerstation wp:wpls)
+            {
+                ProBasicPowerstation newWp=  new ProBasicPowerstation();
+                BeanUtil.copyProperties(wp, newWp);
+                wplist.add(newWp);
+            }
+        }
+        return wplist;
+    }
+
+    public  List<ProBasicSubStation>  getSubwpls(HttpServletRequest request )
+    {
+        String token = request.getHeader("token");
+        String userId = request.getHeader("userId");
+        List<ProBasicSubStation> wplist=new ArrayList<>();
+        if(StringUtils.notEmp(token) && StringUtils.notEmp(userId))
+        {
+//            if(!sessionSubMap.containsKey(token))
+//            {
+
+                List<String> depls= sysUserService.getUserByuserId(Long.valueOf(userId));
+                if(!depls.isEmpty())
+                {
+                    String depId=depls.get(0);
+
+                    if(CacheContext.wpmap.containsKey(depId))
+                    {
+                        for(ProBasicSubStation subStation:CacheContext.subwpls)
+                        {
+                            if(subStation.getWindpowerstationId().equals(depId))
+                            {
+                                ProBasicSubStation newSub=  new ProBasicSubStation();
+                                BeanUtil.copyProperties(subStation, newSub);
+                                wplist.add(newSub);
+                            }
+                        }
+                    }else  if(CacheContext.cpwpmap.containsKey(depId))
+                    {
+                        List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(depId);
+
+                        for(ProBasicPowerstation wp:wpls)
+                        {
+                            for(ProBasicSubStation subStation:CacheContext.subwpls)
+                            {
+                                if(subStation.getWindpowerstationId().equals(wp.getId()))
+                                {
+                                    ProBasicSubStation newSub=  new ProBasicSubStation();
+                                    BeanUtil.copyProperties(subStation, newSub);
+                                    wplist.add(newSub);
+                                    break;
+                                }
+                            }
+                        }
+                    }else  if(CacheContext.rgmap.containsKey(depId))
+                    {
+                        List<ProBasicCompany> rgcpls= CacheContext.rgcpmap.get(depId);
+                        for(ProBasicCompany cp:rgcpls)
+                        {
+                            List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(cp.getId());
+
+                            for(ProBasicPowerstation wp:wpls)
+                            {
+                                for(ProBasicSubStation subStation:CacheContext.subwpls)
+                                {
+                                    if(subStation.getWindpowerstationId().equals(wp.getId()))
+                                    {
+                                        ProBasicSubStation newSub=  new ProBasicSubStation();
+                                        BeanUtil.copyProperties(subStation, newSub);
+                                        wplist.add(newSub);
+                                        break;
+                                    }
+                                }
+
+                            }
+                        }
+                    }else if(depId.equals("0"))
+                    {
+                        for(ProBasicSubStation subStation:CacheContext.subwpls)
+                        {
+                            ProBasicSubStation newSub=  new ProBasicSubStation();
+                            BeanUtil.copyProperties(subStation, newSub);
+                            wplist.add(newSub);
+                        }
+
+                    }
+                }
+//                sessionSubMap.put(token,wplist);
+//            }else  if (sessionMap.containsKey(token) && sessionSubMap.containsKey(token))
+//            {
+//                wplist=sessionSubMap.get(token);
+//
+//            }
+        }else
+        {
+            for(ProBasicSubStation subStation:CacheContext.subwpls)
+            {
+                ProBasicSubStation newSub=  new ProBasicSubStation();
+                BeanUtil.copyProperties(subStation, newSub);
+                wplist.add(newSub);
+            }
+        }
+        return wplist;
+    }
+
+
+    public   List<ProBasicWeatherStation>  getWeawpls (HttpServletRequest request )
+    {
+        String token = request.getHeader("token");
+        String userId = request.getHeader("userId");
+
+        List<ProBasicWeatherStation> wplist=new ArrayList<>();
+        if(StringUtils.notEmp(token) && StringUtils.notEmp(userId))
+        {
+//            if(!sessionWeMap.containsKey(token))
+//            {
+
+                List<String> depls= sysUserService.getUserByuserId(Long.valueOf(userId));
+                if(!depls.isEmpty())
+                {
+                    String depId=depls.get(0);
+
+                    if(CacheContext.wpmap.containsKey(depId))
+                    {
+                        for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
+                        {
+                            if(weatherStation.getWindpowerstationId().equals(depId))
+                            {
+
+                                ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+                                BeanUtil.copyProperties(weatherStation, newWeb);
+                                wplist.add(newWeb);
+                            }
+                        }
+
+                    }else  if(CacheContext.cpwpmap.containsKey(depId))
+                    {
+                        List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(depId);
+
+                        for(ProBasicPowerstation wp:wpls)
+                        {
+                            for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
+                            {
+                                if(weatherStation.getWindpowerstationId().equals(wp.getId()))
+                                {
+                                    ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+                                    BeanUtil.copyProperties(weatherStation, newWeb);
+                                    wplist.add(newWeb);
+                                    break;
+                                }
+                            }
+
+                        }
+                    }else  if(CacheContext.rgmap.containsKey(depId))
+                    {
+                        List<ProBasicCompany> rgcpls= CacheContext.rgcpmap.get(depId);
+                        for(ProBasicCompany cp:rgcpls)
+                        {
+                            List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(cp.getId());
+
+                            for(ProBasicPowerstation wp:wpls)
+                            {
+                                for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
+                                {
+                                    if(weatherStation.getWindpowerstationId().equals(wp.getId()))
+                                    {
+                                        ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+                                        BeanUtil.copyProperties(weatherStation, newWeb);
+                                        wplist.add(newWeb);
+                                        break;
+                                    }
+                                }
+
+                            }
+                        }
+
+                    }else if(depId.equals("0"))
+                    {
+                        for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
+                        {
+                            ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+                            BeanUtil.copyProperties(weatherStation, newWeb);
+                            wplist.add(newWeb);
+                        }
+                    }
+                }
+//                sessionWeMap.put(token,wplist);
+//            }else  if (sessionMap.containsKey(token) && sessionWeMap.containsKey(token))
+//            {
+//                wplist=sessionWeMap.get(token);
+//            }
+
+        }else
+        {
+            for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
+            {
+                ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+                BeanUtil.copyProperties(weatherStation, newWeb);
+                wplist.add(newWeb);
+            }
+
+
+        }
+        return wplist;
+    }
+}

+ 20 - 310
alarm-web/src/main/java/com/gyee/alarm/service/TokenService.java

@@ -34,248 +34,44 @@ public class TokenService {
 
 
     public  List<ProBasicEquipment>  getWtls(HttpServletRequest request ) {
     public  List<ProBasicEquipment>  getWtls(HttpServletRequest request ) {
 
 
-        String token = request.getHeader("token");
-        String userId = request.getHeader("userId");
 
 
-        List<ProBasicEquipment> wtlist = new ArrayList<>();
-        if (StringUtils.notEmp(token) && StringUtils.notEmp(userId))
-        {
-//            if (sessionMap.containsKey(token) && !sessionWtMap.containsKey(token)) {
-
-                List<String> depls = sysUserService.getUserByuserId(Long.valueOf(userId));
-                if (!depls.isEmpty()) {
-                    String depId = depls.get(0);
-
-                    if (CacheContext.wpwtmap.containsKey(depId)) {
-
-                        List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(depId);
-                        for(ProBasicEquipment wt:wtls)
-                        {
-                            ProBasicEquipment newWt=  new ProBasicEquipment();
-                            BeanUtil.copyProperties( wt,newWt);
-                            wtlist.add(newWt);
-                        }
-
-                    } else if (CacheContext.cmwtlsmap.containsKey(depId)) {
-
-                        List<ProBasicEquipment> wtls=CacheContext.cmwtlsmap.get(depId);
-                        for(ProBasicEquipment wt:wtls)
-                        {
-                            ProBasicEquipment newWt=  new ProBasicEquipment();
-                            BeanUtil.copyProperties( wt,newWt);
-                            wtlist.add(newWt);
-                        }
-
-                    } else if (CacheContext.rgwtlsmap.containsKey(depId)) {
-
-                        List<ProBasicEquipment> wtls=CacheContext.rgwtlsmap.get(depId);
-                        for(ProBasicEquipment wt:wtls)
-                        {
-                            ProBasicEquipment newWt=  new ProBasicEquipment();
-                            BeanUtil.copyProperties( wt,newWt);
-                            wtlist.add(newWt);
-                        }
-
-                    }else  if(depId.equals("0"))
-                    {
-                        for(ProBasicEquipment wt:CacheContext.wtls)
-                        {
-                            ProBasicEquipment newWt=  new ProBasicEquipment();
-                            BeanUtil.copyProperties( wt,newWt);
-                            wtlist.add(newWt);
-                        }
 
 
-                    }
+        List<ProBasicEquipment> wtlist = new ArrayList<>();
-                }
+        for(ProBasicEquipment wt:CacheContext.wtls)
-//                sessionWtMap.put(token,wtlist);
-//            } else if (sessionMap.containsKey(token) && sessionWtMap.containsKey(token))
-//            {
-//                wtlist =sessionWtMap.get(token);
-//            }
-        }else
         {
         {
-            for(ProBasicEquipment wt:CacheContext.wtls)
+            ProBasicEquipment newWt=  new ProBasicEquipment();
-            {
+            BeanUtil.copyProperties( wt,newWt);
-                ProBasicEquipment newWt=  new ProBasicEquipment();
+            wtlist.add(newWt);
-                BeanUtil.copyProperties( wt,newWt);
-                wtlist.add(newWt);
-            }
-
         }
         }
         return wtlist;
         return wtlist;
     }
     }
 
 
     public  List<ProBasicPowerstation>  getWpls(HttpServletRequest request )
     public  List<ProBasicPowerstation>  getWpls(HttpServletRequest request )
     {
     {
-        String token = request.getHeader("token");
-        String userId = request.getHeader("userId");
-
-        List<ProBasicPowerstation> wplist=new ArrayList<>();
-        if(StringUtils.notEmp(token)  && StringUtils.notEmp(token))
-        {
-//            if(sessionMap.containsKey(token) && !sessionWpMap.containsKey(token))
-//            {
 
 
-                List<String> depls= sysUserService.getUserByuserId(Long.valueOf(userId));
-                if(!depls.isEmpty())
-                {
-                    String depId=depls.get(0);
 
 
-                    if(CacheContext.wpmap.containsKey(depId))
+        List<ProBasicPowerstation> wplist=new ArrayList<>();
-                    {
-
-                        ProBasicPowerstation wp= CacheContext.wpmap.get(depId);
-                        ProBasicPowerstation newWp=  new ProBasicPowerstation();
-                        BeanUtil.copyProperties(wp, newWp);
-                        wplist.add(newWp);
-                    }else  if(CacheContext.cpwpmap.containsKey(depId))
-                    {
-                        List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(depId);
-                        for(ProBasicPowerstation wp:wpls)
-                        {
-                            ProBasicPowerstation newWp=  new ProBasicPowerstation();
-                            BeanUtil.copyProperties(wp, newWp);
-                            wplist.add(newWp);
-                        }
-
-                    }else  if(CacheContext.rgmap.containsKey(depId))
-                    {
-                        List<ProBasicCompany> rgcpls= CacheContext.rgcpmap.get(depId);
-                        for(ProBasicCompany cp:rgcpls)
-                        {
-                            List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(cp.getId());
-                            for(ProBasicPowerstation wp:wpls)
-                            {
-                                ProBasicPowerstation newWp=  new ProBasicPowerstation();
-                                BeanUtil.copyProperties(wp, newWp);
-                                wplist.add(newWp);
-                            }
-                        }
-
-                    }else if(depId.equals("0"))
-                    {
-                        wplist=sessionWpMap.get(token);
-                    }else if(depId.equals("0"))
-                    {
-                        List<ProBasicPowerstation> wpls=CacheContext.wpls;
-                        for(ProBasicPowerstation wp:wpls)
-                        {
-                            ProBasicPowerstation newWp=  new ProBasicPowerstation();
-                            BeanUtil.copyProperties(wp, newWp);
-                            wplist.add(newWp);
-                        }
-
-                    }
-                }
-//                sessionWpMap.put(token,wplist);
-//            }else if (sessionMap.containsKey(token) && sessionWpMap.containsKey(token))
-//            {
-//                wplist=sessionWpMap.get(token);
-//            }
 
 
-        }else
+        List<ProBasicPowerstation> wpls=CacheContext.wpls;
+        for(ProBasicPowerstation wp:wpls)
         {
         {
-            List<ProBasicPowerstation> wpls=CacheContext.wpls;
+            ProBasicPowerstation newWp=  new ProBasicPowerstation();
-            for(ProBasicPowerstation wp:wpls)
+            BeanUtil.copyProperties(wp, newWp);
-            {
+            wplist.add(newWp);
-                ProBasicPowerstation newWp=  new ProBasicPowerstation();
-                BeanUtil.copyProperties(wp, newWp);
-                wplist.add(newWp);
-            }
         }
         }
         return wplist;
         return wplist;
     }
     }
 
 
     public  List<ProBasicSubStation>  getSubwpls(HttpServletRequest request )
     public  List<ProBasicSubStation>  getSubwpls(HttpServletRequest request )
     {
     {
-        String token = request.getHeader("token");
-        String userId = request.getHeader("userId");
-        List<ProBasicSubStation> wplist=new ArrayList<>();
-        if(StringUtils.notEmp(token) && StringUtils.notEmp(userId))
-        {
-//            if(!sessionSubMap.containsKey(token))
-//            {
-
-                List<String> depls= sysUserService.getUserByuserId(Long.valueOf(userId));
-                if(!depls.isEmpty())
-                {
-                    String depId=depls.get(0);
-
-                    if(CacheContext.wpmap.containsKey(depId))
-                    {
-                        for(ProBasicSubStation subStation:CacheContext.subwpls)
-                        {
-                            if(subStation.getWindpowerstationId().equals(depId))
-                            {
-                                ProBasicSubStation newSub=  new ProBasicSubStation();
-                                BeanUtil.copyProperties(subStation, newSub);
-                                wplist.add(newSub);
-                            }
-                        }
-                    }else  if(CacheContext.cpwpmap.containsKey(depId))
-                    {
-                        List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(depId);
-
-                        for(ProBasicPowerstation wp:wpls)
-                        {
-                            for(ProBasicSubStation subStation:CacheContext.subwpls)
-                            {
-                                if(subStation.getWindpowerstationId().equals(wp.getId()))
-                                {
-                                    ProBasicSubStation newSub=  new ProBasicSubStation();
-                                    BeanUtil.copyProperties(subStation, newSub);
-                                    wplist.add(newSub);
-                                    break;
-                                }
-                            }
-                        }
-                    }else  if(CacheContext.rgmap.containsKey(depId))
-                    {
-                        List<ProBasicCompany> rgcpls= CacheContext.rgcpmap.get(depId);
-                        for(ProBasicCompany cp:rgcpls)
-                        {
-                            List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(cp.getId());
 
 
-                            for(ProBasicPowerstation wp:wpls)
+        List<ProBasicSubStation> wplist=new ArrayList<>();
-                            {
-                                for(ProBasicSubStation subStation:CacheContext.subwpls)
-                                {
-                                    if(subStation.getWindpowerstationId().equals(wp.getId()))
-                                    {
-                                        ProBasicSubStation newSub=  new ProBasicSubStation();
-                                        BeanUtil.copyProperties(subStation, newSub);
-                                        wplist.add(newSub);
-                                        break;
-                                    }
-                                }
-
-                            }
-                        }
-                    }else if(depId.equals("0"))
-                    {
-                        for(ProBasicSubStation subStation:CacheContext.subwpls)
-                        {
-                            ProBasicSubStation newSub=  new ProBasicSubStation();
-                            BeanUtil.copyProperties(subStation, newSub);
-                            wplist.add(newSub);
-                        }
 
 
-                    }
+        for(ProBasicSubStation subStation:CacheContext.subwpls)
-                }
-//                sessionSubMap.put(token,wplist);
-//            }else  if (sessionMap.containsKey(token) && sessionSubMap.containsKey(token))
-//            {
-//                wplist=sessionSubMap.get(token);
-//
-//            }
-        }else
         {
         {
-            for(ProBasicSubStation subStation:CacheContext.subwpls)
+            ProBasicSubStation newSub=  new ProBasicSubStation();
-            {
+            BeanUtil.copyProperties(subStation, newSub);
-                ProBasicSubStation newSub=  new ProBasicSubStation();
+            wplist.add(newSub);
-                BeanUtil.copyProperties(subStation, newSub);
-                wplist.add(newSub);
-            }
         }
         }
         return wplist;
         return wplist;
     }
     }
@@ -283,100 +79,14 @@ public class TokenService {
 
 
     public   List<ProBasicWeatherStation>  getWeawpls (HttpServletRequest request )
     public   List<ProBasicWeatherStation>  getWeawpls (HttpServletRequest request )
     {
     {
-        String token = request.getHeader("token");
-        String userId = request.getHeader("userId");
 
 
         List<ProBasicWeatherStation> wplist=new ArrayList<>();
         List<ProBasicWeatherStation> wplist=new ArrayList<>();
-        if(StringUtils.notEmp(token) && StringUtils.notEmp(userId))
-        {
-//            if(!sessionWeMap.containsKey(token))
-//            {
-
-                List<String> depls= sysUserService.getUserByuserId(Long.valueOf(userId));
-                if(!depls.isEmpty())
-                {
-                    String depId=depls.get(0);
-
-                    if(CacheContext.wpmap.containsKey(depId))
-                    {
-                        for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
-                        {
-                            if(weatherStation.getWindpowerstationId().equals(depId))
-                            {
 
 
-                                ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+        for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
-                                BeanUtil.copyProperties(weatherStation, newWeb);
-                                wplist.add(newWeb);
-                            }
-                        }
-
-                    }else  if(CacheContext.cpwpmap.containsKey(depId))
-                    {
-                        List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(depId);
-
-                        for(ProBasicPowerstation wp:wpls)
-                        {
-                            for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
-                            {
-                                if(weatherStation.getWindpowerstationId().equals(wp.getId()))
-                                {
-                                    ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
-                                    BeanUtil.copyProperties(weatherStation, newWeb);
-                                    wplist.add(newWeb);
-                                    break;
-                                }
-                            }
-
-                        }
-                    }else  if(CacheContext.rgmap.containsKey(depId))
-                    {
-                        List<ProBasicCompany> rgcpls= CacheContext.rgcpmap.get(depId);
-                        for(ProBasicCompany cp:rgcpls)
-                        {
-                            List<ProBasicPowerstation> wpls=CacheContext.cpwpmap.get(cp.getId());
-
-                            for(ProBasicPowerstation wp:wpls)
-                            {
-                                for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
-                                {
-                                    if(weatherStation.getWindpowerstationId().equals(wp.getId()))
-                                    {
-                                        ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
-                                        BeanUtil.copyProperties(weatherStation, newWeb);
-                                        wplist.add(newWeb);
-                                        break;
-                                    }
-                                }
-
-                            }
-                        }
-
-                    }else if(depId.equals("0"))
-                    {
-                        for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
-                        {
-                            ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
-                            BeanUtil.copyProperties(weatherStation, newWeb);
-                            wplist.add(newWeb);
-                        }
-                    }
-                }
-//                sessionWeMap.put(token,wplist);
-//            }else  if (sessionMap.containsKey(token) && sessionWeMap.containsKey(token))
-//            {
-//                wplist=sessionWeMap.get(token);
-//            }
-
-        }else
         {
         {
-            for(ProBasicWeatherStation weatherStation:CacheContext.weawpls)
+            ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
-            {
+            BeanUtil.copyProperties(weatherStation, newWeb);
-                ProBasicWeatherStation newWeb=  new ProBasicWeatherStation();
+            wplist.add(newWeb);
-                BeanUtil.copyProperties(weatherStation, newWeb);
-                wplist.add(newWeb);
-            }
-
-
         }
         }
         return wplist;
         return wplist;
     }
     }

+ 38 - 0
alarm-web/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmPlanService.java

@@ -0,0 +1,38 @@
+package com.gyee.alarm.service.auto;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.gyee.alarm.model.auto.ProEconAlarmRule;
+import com.gyee.alarm.model.vo.AlarmConfigurationVo;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface IProEconAlarmPlanService extends IService<ProEconAlarmPlan> {
+
+
+   public  List<ProEconAlarmPlan>  alarmPlanlistById(String alarmId) ;
+
+   void  updatePlanlistById(String alarmId,String planIds) ;
+
+   public int saveAndUpdateAlertrule(ProEconAlarmPlan alarmRule) throws Exception;
+
+
+   public boolean deleteAlertrule( List<String> idls);
+
+   public IPage<ProEconAlarmPlan> pageQueryAll(Page page, String name);
+
+}

+ 16 - 0
alarm-web/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmRealService.java

@@ -0,0 +1,16 @@
+package com.gyee.alarm.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.alarm.model.auto.ProEconAlarmReal;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+public interface IProEconAlarmRealService extends IService<ProEconAlarmReal> {
+
+}

+ 171 - 0
alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmPlanServiceImpl.java

@@ -0,0 +1,171 @@
+package com.gyee.alarm.service.auto.impl;
+
+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.alarm.init.CacheContext;
+import com.gyee.alarm.mapper.auto.ProEconAlarmPlanMapper;
+import com.gyee.alarm.mapper.auto.ProEconAlarmRealMapper;
+import com.gyee.alarm.mapper.auto.ProEconAlarmPlanMapper;
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.model.auto.ProEconAlarmPlan;
+import com.gyee.alarm.model.vo.AlarmConfigurationVo;
+import com.gyee.alarm.service.RuleUpdateEventService;
+import com.gyee.alarm.service.auto.IProEconAlarmPlanService;
+import com.gyee.alarm.util.SnowflakeGenerator;
+import com.gyee.alarm.util.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Service
+public class ProEconAlarmPlanServiceImpl extends ServiceImpl<ProEconAlarmPlanMapper, ProEconAlarmPlan> implements IProEconAlarmPlanService {
+
+
+    @Resource
+    private ProEconAlarmRealMapper proEconAlarmRealMapper;
+
+    @Resource
+    private ProEconAlarmPlanMapper proEconAlarmPlanMapper;
+      public void  updatePlanlistById(String alarmId, String planIds)
+    {
+        List<ProEconAlarmReal>  ls= proEconAlarmRealMapper.alarmPlanlistById( alarmId);
+
+        if(!ls.isEmpty())
+        {
+            ProEconAlarmReal ar=ls.get(0);
+
+            ar.setAlarmPlan(planIds);
+
+            proEconAlarmRealMapper.update(ar);
+        }else
+        {
+            ProEconAlarmReal ar=new ProEconAlarmReal();
+
+            ar.setId(StringUtils.getUUID());
+            ar.setAlarmId(alarmId);
+            ar.setAlarmPlan(planIds);
+
+            proEconAlarmRealMapper.insert(ar);
+        }
+    }
+    public  List<ProEconAlarmPlan>  alarmPlanlistById(String alarmId) {
+
+        List<ProEconAlarmPlan> vos=new ArrayList();
+
+        List<ProEconAlarmReal>  ls= proEconAlarmRealMapper.alarmPlanlistById( alarmId);
+
+        if(!ls.isEmpty())
+        {
+            ProEconAlarmReal ar=ls.get(0);
+
+            if(StringUtils.notEmp(ar.getAlarmPlan()))
+            {
+               String[] strs= ar.getAlarmPlan().split(",");
+
+                List<String> alarmPlanListId = Arrays.stream(strs).filter(s -> StringUtils.notEmp(s)).collect(Collectors.toList());
+
+                QueryWrapper<ProEconAlarmPlan> qw = new QueryWrapper<>();
+
+
+                if (alarmPlanListId != null && !alarmPlanListId.isEmpty()) {
+                    qw.in("id", alarmPlanListId);
+                }
+                List<ProEconAlarmPlan> list = baseMapper.selectList(qw);
+                return list;
+            }
+        }
+
+
+
+        return vos;
+    }
+
+
+    public int saveAndUpdateAlertrule(ProEconAlarmPlan alarmRule) throws Exception {
+
+        int result = 0;
+
+        if (StringUtils.notEmp(alarmRule) && null !=alarmRule.getTroubleMethod()) {
+
+            List<ProEconAlarmPlan>  oldRulels = proEconAlarmPlanMapper.queryObject(alarmRule.getTroubleMethod());
+            if(!oldRulels.isEmpty())
+            {
+                ProEconAlarmPlan   oldRule2=oldRulels.get(0);
+                if (oldRule2 != null) {
+
+                    alarmRule.setId(oldRule2.getId());
+                    result = proEconAlarmPlanMapper.updateByAlertruleId(alarmRule);
+
+                }else
+                {
+                    alarmRule.setId(String.valueOf(SnowflakeGenerator.generateId()));
+                    result = saveAlertrule(alarmRule);
+                }
+            }else
+            {
+                if(StringUtils.empty(alarmRule.getId()))
+                {
+                    alarmRule.setId(String.valueOf(SnowflakeGenerator.generateId()));
+                }
+
+                result = saveAlertrule(alarmRule);
+            }
+        }
+
+        return result;
+    }
+
+
+    private int saveAlertrule(ProEconAlarmPlan alarmRule) throws Exception {
+
+        int result = 0;
+
+        if (StringUtils.notEmp(alarmRule)) {
+
+
+            alarmRule.setId(String.valueOf(SnowflakeGenerator.generateId()));
+
+            result= proEconAlarmPlanMapper.insert(alarmRule);
+        }
+//        if (result > 0) {
+//            int i = eventService.saveEventAlertRule(alarmRule, oldRule2, userData.getUserName());
+        return result;
+    }
+
+    public boolean deleteAlertrule( List<String> idls) {
+
+
+          return removeByIds(idls);
+    }
+
+
+    public IPage<ProEconAlarmPlan> pageQueryAll(Page page, String name) {
+
+
+        if(StringUtils.notEmp(name))
+        {
+            name="%"+name+"%";
+        }else
+        {
+            name=null;
+        }
+
+
+        IPage<ProEconAlarmPlan> alertruleIPage = proEconAlarmPlanMapper.pageQueryAll(page, name);
+
+
+        return alertruleIPage;
+    }
+}

+ 20 - 0
alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRealServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.alarm.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.alarm.mapper.auto.ProEconAlarmRealMapper;
+import com.gyee.alarm.model.auto.ProEconAlarmReal;
+import com.gyee.alarm.service.auto.IProEconAlarmRealService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2024-10-28
+ */
+@Service
+public class ProEconAlarmRealServiceImpl extends ServiceImpl<ProEconAlarmRealMapper, ProEconAlarmReal> implements IProEconAlarmRealService {
+
+}