|
@@ -15,6 +15,7 @@ import cn.com.ctop.alarm.modules.mapper.RuleIndicatorMapper;
|
|
|
import cn.com.ctop.alarm.modules.mapper.RuleTemplateMapper;
|
|
|
import cn.com.ctop.alarm.modules.service.IRuleAccountTemplateService;
|
|
|
import cn.com.ctop.alarm.modules.service.IRuleGroupService;
|
|
|
+import cn.com.ctop.common.module.service.ISendMessageService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -56,6 +57,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
private IRuleGroupService ruleGroupService;
|
|
|
@Autowired
|
|
|
private IRuleAccountTemplateService ruleAccountTemplateService;
|
|
|
+ @Autowired
|
|
|
+ private ISendMessageService sendMessageService;
|
|
|
|
|
|
@Override
|
|
|
public void checkRules() {
|
|
@@ -130,17 +133,18 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
}
|
|
|
//执行发送
|
|
|
if (flag) {
|
|
|
-// MatchLogic.getMsg()
|
|
|
boolean isPause = "PAUSE".equals(ruleGroup.getOperate());
|
|
|
- String sendType = ruleGroup.getSendType();
|
|
|
- if(isPause){
|
|
|
+ if (isPause) {
|
|
|
//关停操作 TODO
|
|
|
|
|
|
}
|
|
|
+ //TODO
|
|
|
+ String msg = MatchLogic.getMsg(null, null, null, null);
|
|
|
+ String sendType = ruleGroup.getSendType();
|
|
|
if ("SMS".equals(sendType)) {
|
|
|
|
|
|
} else if ("WeChat".equals(sendType)) {
|
|
|
-
|
|
|
+ sendMessageService.sendMessage("", msg);
|
|
|
} else if ("EMAIL".equals(sendType)) {
|
|
|
|
|
|
} else if ("TEL".equals(sendType)) {
|
|
@@ -153,18 +157,6 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean checkThreshold(String threshold, RuleBase ruleBase, JSONObject indicator) {
|
|
|
- //条件
|
|
|
- String condition = ruleBase.getRuleCondition();
|
|
|
- //指标
|
|
|
- String indicatorCode = ruleBase.getIndicatorCode();
|
|
|
- //维度
|
|
|
- String ruleDimension = ruleBase.getRuleDimension();
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
//整理阈值数据
|
|
|
public JSONObject getThreshold(List<RuleAccountThreshold> thresholdList) {
|
|
|
if (Check.isNull(thresholdList)) {
|
|
@@ -223,10 +215,12 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
if (Check.isNull(strings)) {
|
|
|
return null;
|
|
|
}
|
|
|
+ JSONObject job = new JSONObject();
|
|
|
+ job.put("list", strings);
|
|
|
List<String> ids = new ArrayList<>();
|
|
|
- String[] idArray = strings.split(",");
|
|
|
- for (String id : idArray) {
|
|
|
- ids.add(id);
|
|
|
+ JSONArray idList = job.getJSONArray("list");
|
|
|
+ for (Object id : idList) {
|
|
|
+ ids.add(String.valueOf(id));
|
|
|
}
|
|
|
return ids;
|
|
|
}
|