Browse Source

预警规则匹配逻辑

zhaoxian 4 years ago
parent
commit
7eee51f3cc

+ 14 - 9
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -212,15 +212,20 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
 
     //拆分逗号拼接数据
     private List<String> strToList(String strings) {
-        if (Check.isNull(strings)) {
-            return null;
-        }
-        JSONObject job = new JSONObject();
-        job.put("list", strings);
-        List<String> ids = new ArrayList<>();
-        JSONArray idList = job.getJSONArray("list");
-        for (Object id : idList) {
-            ids.add(String.valueOf(id));
+        List<String> ids = null;
+        try {
+            if (Check.isNull(strings)) {
+                return null;
+            }
+            JSONObject job = new JSONObject();
+            job.put("list", strings);
+            ids = new ArrayList<>();
+            JSONArray idList = job.getJSONArray("list");
+            for (Object id : idList) {
+                ids.add(String.valueOf(id));
+            }
+        } catch (Exception e) {
+            log.error("ids格式转换异常", e);
         }
         return ids;
     }