|
@@ -152,7 +152,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
accountName = userAllocations.getAuthName();
|
|
|
}
|
|
|
try {
|
|
|
- if (!Check.isNull(notCopyGroups)) {
|
|
|
+ if (!Check.isNull(notCopyGroups) && !Check.isNull(notCopythreshold)) {
|
|
|
checkRuleGroups(notCopyGroups, notCopythreshold, indicators, matchData, type, false, accountName);
|
|
|
}
|
|
|
if (isCopy && !Check.isNull(isCopythreshold)) {
|
|
@@ -187,8 +187,10 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
if (isCopy) {
|
|
|
JSONObject batchNo = thresholdObj.getJSONObject(ruleGroup.getId().toString());
|
|
|
for (Map.Entry<String, Object> entry : batchNo.entrySet()) {
|
|
|
- JSONObject thresholdMap = (JSONObject) entry.getValue();
|
|
|
- CombinationRule(ruleGroup, ruleBaseList, thresholdMap, indicators, matchData, type, accountName);
|
|
|
+ JSONObject thresholdJn = (JSONObject) entry.getValue();
|
|
|
+ if (!Check.isNull(thresholdJn)) {
|
|
|
+ CombinationRule(ruleGroup, ruleBaseList, thresholdJn, indicators, matchData, type, accountName);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
boolean isGroup = "group".equals(ruleGroup.getRuleType());
|
|
@@ -203,8 +205,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
//指标阈值
|
|
|
String threshold = thresholdObj.getString(ruleBase.getId().toString());
|
|
|
//阈值为空时,或者阈值为“unlimited”(不限),不执行该规则
|
|
|
- if (Check.isNull(threshold) || "unlimited".equals(threshold)) {
|
|
|
- log.warn("阈值为空/不限,该规则({})不执行", ruleBase.getId());
|
|
|
+ if (Check.isNull(threshold) || threshold.contains("unlimited")) {
|
|
|
continue;
|
|
|
}
|
|
|
//维度数据
|
|
@@ -255,11 +256,11 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
continue;
|
|
|
}
|
|
|
JSONArray dimensionData = matchData.getJSONArray(ruleBase.getRuleDimension());
|
|
|
+ if (Check.isNull(dimensionData)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
//账户维度数据
|
|
|
if ("account".equals(ruleBase.getRuleDimension())) {
|
|
|
- if (Check.isNull(dimensionData)) {
|
|
|
- return;
|
|
|
- }
|
|
|
JSONObject accountEntity = dimensionData.getJSONObject(0);
|
|
|
if (MatchLogic.matchCondition(dataType, ruleBase.getRuleCondition(), threshold, accountEntity.getString(ruleBase.getIndicatorCode()), accountEntity)) {
|
|
|
accountDatas.add(accountEntity);
|
|
@@ -309,7 +310,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
* @author ZHAOXA
|
|
|
*/
|
|
|
private JSONArray getOKData(JSONArray ruleDatas, JSONArray dimensionData, RuleBase ruleBase, String type, String threshold) {
|
|
|
- if (ruleDatas.size() > 0) {
|
|
|
+ if (!Check.isNull(ruleDatas)) {
|
|
|
JSONArray okData = new JSONArray();
|
|
|
for (int i = 0; i < ruleDatas.size(); i++) {
|
|
|
JSONObject targetEntity = dimensionData.getJSONObject(i);
|
|
@@ -366,8 +367,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
} else {
|
|
|
//TODO
|
|
|
ISendMessageService sendMessageService = this.sendMessageService;
|
|
|
-// sendMessageService.sendMessage(user.getString("id"), msg);
|
|
|
- sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg);
|
|
|
+ sendMessageService.sendMessage(user.getString("id"), msg);
|
|
|
+// sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg);
|
|
|
//113dee46c7df464da78c07a985e92cd1 于蒙
|
|
|
}
|
|
|
log.debug("账户{}的{}预警已发送", accountId, ruleGroup.getGroupName());
|
|
@@ -376,6 +377,15 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
send.setAlarmDetail(msg);
|
|
|
send.setAlarmStatus(NoEn.NO1.valueStr());
|
|
|
send.setEventRuleId(ruleGroup.getId());
|
|
|
+ if (msg.contains("预警账户")) {
|
|
|
+ send.setMetricValueCode("account");
|
|
|
+ if (msg.contains("预警计划")) {
|
|
|
+ send.setMetricValueCode("plan");
|
|
|
+ if (msg.contains("预警创意")) {
|
|
|
+ send.setMetricValueCode("creative");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
send.setAlarmCondition(ruleGroup.getGroupName());
|
|
|
send.setUserId(user.getString("id"));
|
|
|
alarmEventSendMapper.insert(send);
|