|
@@ -195,17 +195,20 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
for (Map.Entry<String, Object> entry : batchNo.entrySet()) {
|
|
|
JSONObject thresholdJn = (JSONObject) entry.getValue();
|
|
|
if (!Check.isNull(thresholdJn)) {
|
|
|
- CombinationRule(ruleGroup, ruleBaseList, thresholdJn, indicators, matchData, complianceList);
|
|
|
+ CombinationRule(ruleBaseList, thresholdJn, indicators, matchData, complianceList);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
boolean isGroup = "group".equals(ruleGroup.getRuleType());
|
|
|
//匹配组合规则
|
|
|
if (isGroup) {
|
|
|
- CombinationRule(ruleGroup, ruleBaseList, thresholdObj, indicators, matchData, complianceList);
|
|
|
+ CombinationRule(ruleBaseList, thresholdObj, indicators, matchData, complianceList);
|
|
|
//匹配单规则
|
|
|
} else {
|
|
|
RuleBase ruleBase = ruleBaseList.get(0);
|
|
|
+ if (Check.isNull(ruleBase)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
//指标对象
|
|
|
JSONObject indicator = indicators.getJSONObject(ruleBase.getIndicatorCode());
|
|
|
//指标阈值
|
|
@@ -222,7 +225,6 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
String value = obj.getString(ruleBase.getIndicatorCode());
|
|
|
if (MatchLogic.matchCondition(indicator.getString("dataType"), ruleBase.getRuleCondition(), threshold, value, obj)) {
|
|
|
complianceList.add(obj);
|
|
|
-// sendMsg(ruleGroup, obj, type, accountName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -248,7 +250,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
* @throws
|
|
|
* @author ZHAOXA
|
|
|
*/
|
|
|
- private void CombinationRule(RuleGroup ruleGroup, List<RuleBase> ruleBaseList, JSONObject thresholdObj, JSONObject indicators, JSONObject matchData, JSONArray complianceList) {
|
|
|
+ private void CombinationRule(List<RuleBase> ruleBaseList, JSONObject thresholdObj, JSONObject indicators, JSONObject matchData, JSONArray complianceList) {
|
|
|
//符合规则的数据集
|
|
|
JSONArray targetDatas = new JSONArray();
|
|
|
JSONArray planDatas = new JSONArray();
|
|
@@ -263,10 +265,34 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
String threshold = thresholdObj.getString(ruleBase.getId().toString());
|
|
|
//阈值为空时,或者阈值为“unlimited”(不限),不执行该规则
|
|
|
if (Check.isNull(threshold) || "unlimited".equals(threshold)) {
|
|
|
- continue;
|
|
|
+ if (!Check.isNull(accountDatas)) {
|
|
|
+ accountDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planDatas)) {
|
|
|
+ planDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(creativeDatas)) {
|
|
|
+ creativeDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(targetDatas)) {
|
|
|
+ targetDatas = null;
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
JSONArray dimensionData = matchData.getJSONArray(ruleBase.getRuleDimension());
|
|
|
if (Check.isNull(dimensionData)) {
|
|
|
+ if (!Check.isNull(accountDatas)) {
|
|
|
+ accountDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planDatas)) {
|
|
|
+ planDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(creativeDatas)) {
|
|
|
+ creativeDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(targetDatas)) {
|
|
|
+ targetDatas = null;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
//账户维度数据
|
|
@@ -275,29 +301,72 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
if (MatchLogic.matchCondition(dataType, ruleBase.getRuleCondition(), threshold, accountEntity.getString(ruleBase.getIndicatorCode()), accountEntity)) {
|
|
|
accountDatas.add(accountEntity);
|
|
|
} else {
|
|
|
- log.warn("匹配规则组({}),账户维度数据不符合直接跳过", ruleGroup.getId());
|
|
|
- break;
|
|
|
- }
|
|
|
- if (Check.isNull(accountDatas)) {
|
|
|
+ if (!Check.isNull(accountDatas)) {
|
|
|
+ accountDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planDatas)) {
|
|
|
+ planDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(creativeDatas)) {
|
|
|
+ creativeDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(targetDatas)) {
|
|
|
+ targetDatas = null;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
} else if (PLAN.equals(ruleBase.getRuleDimension())) {
|
|
|
planDatas = getOKData(planDatas, dimensionData, ruleBase, dataType, threshold);
|
|
|
if (Check.isNull(planDatas)) {
|
|
|
+ if (!Check.isNull(accountDatas)) {
|
|
|
+ accountDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planDatas)) {
|
|
|
+ planDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(creativeDatas)) {
|
|
|
+ creativeDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(targetDatas)) {
|
|
|
+ targetDatas = null;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
} else if (CREATIVE.equals(ruleBase.getRuleDimension())) {
|
|
|
creativeDatas = getOKData(creativeDatas, dimensionData, ruleBase, dataType, threshold);
|
|
|
if (Check.isNull(creativeDatas)) {
|
|
|
+ if (!Check.isNull(accountDatas)) {
|
|
|
+ accountDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planDatas)) {
|
|
|
+ planDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(creativeDatas)) {
|
|
|
+ creativeDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(targetDatas)) {
|
|
|
+ targetDatas = null;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
} else if ("target".equals(ruleBase.getRuleDimension())) {
|
|
|
targetDatas = getOKData(targetDatas, dimensionData, ruleBase, dataType, threshold);
|
|
|
if (Check.isNull(targetDatas)) {
|
|
|
+ if (!Check.isNull(accountDatas)) {
|
|
|
+ accountDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(planDatas)) {
|
|
|
+ planDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(creativeDatas)) {
|
|
|
+ creativeDatas = null;
|
|
|
+ }
|
|
|
+ if (!Check.isNull(targetDatas)) {
|
|
|
+ targetDatas = null;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//获取达标可发送的数据
|
|
|
JSONArray sendData = MatchLogic.getSendData(accountDatas, planDatas, creativeDatas, targetDatas);
|
|
@@ -461,7 +530,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
// sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg + i);
|
|
|
// Thread.sleep(2000);
|
|
|
// }
|
|
|
- sendMessageService.sendMessage(user.getString("id"), msg);
|
|
|
+ sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg);
|
|
|
Thread.sleep(200);
|
|
|
}
|
|
|
if (!Check.isNull(msg)) {
|