决策树
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.solution.rule.domain.config.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("单个规则决策树分块")
|
||||
public class RuleDecisionBlockVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("分块标识:equipment/target/position/track")
|
||||
private String blockId;
|
||||
|
||||
@ApiModelProperty("模块编码")
|
||||
private String moduleCode;
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("Drools 规则名")
|
||||
private String droolsRuleName;
|
||||
|
||||
@ApiModelProperty("salience")
|
||||
private Integer salience;
|
||||
|
||||
@ApiModelProperty("树节点")
|
||||
private List<RuleDecisionNodeVO> nodes;
|
||||
|
||||
public List<RuleDecisionNodeVO> safeNodes() {
|
||||
if (nodes == null) {
|
||||
nodes = new ArrayList<>();
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.solution.rule.domain.config.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("规则决策树节点")
|
||||
public class RuleDecisionNodeVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("节点唯一键")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty("节点标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("节点类型")
|
||||
private String nodeType;
|
||||
|
||||
@ApiModelProperty("补充说明")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("右侧值文本")
|
||||
private String valueText;
|
||||
|
||||
@ApiModelProperty("子节点")
|
||||
private List<RuleDecisionNodeVO> children;
|
||||
|
||||
public List<RuleDecisionNodeVO> safeChildren() {
|
||||
if (children == null) {
|
||||
children = new ArrayList<>();
|
||||
}
|
||||
return children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.solution.rule.domain.config.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ApiModel("规则决策树")
|
||||
public class RuleDecisionTreeVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("与运行时 globalParams 一致的参数快照")
|
||||
private Map<String, Object> globalParamsPreview;
|
||||
|
||||
@ApiModelProperty("四大规则分块")
|
||||
private List<RuleDecisionBlockVO> blocks;
|
||||
|
||||
public Map<String, Object> safeGlobalParamsPreview() {
|
||||
if (globalParamsPreview == null) {
|
||||
globalParamsPreview = new LinkedHashMap<>();
|
||||
}
|
||||
return globalParamsPreview;
|
||||
}
|
||||
|
||||
public List<RuleDecisionBlockVO> safeBlocks() {
|
||||
if (blocks == null) {
|
||||
blocks = new ArrayList<>();
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.solution.rule.domain.config.RuleConfigExcelRow;
|
||||
import com.solution.rule.domain.config.RuleConfigQuery;
|
||||
import com.solution.rule.domain.config.RuleDictItem;
|
||||
import com.solution.rule.domain.config.RuleParamMeta;
|
||||
import com.solution.rule.domain.config.vo.RuleDecisionTreeVO;
|
||||
import com.solution.rule.domain.config.vo.RuleFourBlocksGraphVO;
|
||||
import com.solution.rule.domain.config.vo.RuleGraphVO;
|
||||
|
||||
@@ -38,6 +39,8 @@ public interface IRuleConfigService {
|
||||
*/
|
||||
RuleGraphVO buildKnowledgeGraph(List<RuleConfig> ruleConfigs);
|
||||
|
||||
RuleDecisionTreeVO buildDecisionTree(List<RuleConfig> ruleConfigs);
|
||||
|
||||
/**
|
||||
* 四块规则知识图谱(装备/目标/阵位/航迹):中枢 If/Then + 环形参数,参数值与 {@link #loadEnabledGlobalParams()} 一致。
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,9 @@ import com.solution.rule.domain.config.graph.RuleFourBlockDefinition;
|
||||
import com.solution.rule.domain.config.graph.RuleFourBlockRuleOutputCatalog;
|
||||
import com.solution.rule.domain.config.graph.RuleParamOutputHint;
|
||||
import com.solution.rule.domain.config.vo.RuleFourBlockClusterVO;
|
||||
import com.solution.rule.domain.config.vo.RuleDecisionBlockVO;
|
||||
import com.solution.rule.domain.config.vo.RuleDecisionNodeVO;
|
||||
import com.solution.rule.domain.config.vo.RuleDecisionTreeVO;
|
||||
import com.solution.rule.domain.config.vo.RuleFourBlockParamRowVO;
|
||||
import com.solution.rule.domain.config.vo.RuleFourBlocksGraphVO;
|
||||
import com.solution.rule.domain.config.vo.RuleGraphEdgeVO;
|
||||
@@ -389,6 +392,58 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
||||
return graph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleDecisionTreeVO buildDecisionTree(List<RuleConfig> ruleConfigs) {
|
||||
RuleDecisionTreeVO out = new RuleDecisionTreeVO();
|
||||
Map<String, Object> globalPreview = loadEnabledGlobalParams();
|
||||
out.setGlobalParamsPreview(new LinkedHashMap<>(globalPreview));
|
||||
|
||||
List<RuleConfig> source = ruleConfigs != null ? ruleConfigs : Collections.emptyList();
|
||||
List<String> ruleCodes = source.stream()
|
||||
.filter(r -> r != null && ObjectUtil.isNotEmpty(r.getRuleCode()))
|
||||
.map(RuleConfig::getRuleCode)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, List<RuleConfigParam>> paramsByRule = ruleCodes.isEmpty()
|
||||
? new LinkedHashMap<>()
|
||||
: ruleConfigMapper.selectParamsByRuleCodes(ruleCodes).stream()
|
||||
.filter(p -> p != null && ObjectUtil.isNotEmpty(p.getRuleCode()))
|
||||
.collect(Collectors.groupingBy(RuleConfigParam::getRuleCode, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
Map<String, List<String>> taskTypesByRule = new LinkedHashMap<>();
|
||||
if (!ruleCodes.isEmpty()) {
|
||||
List<RuleConfigTaskTypeRow> taskRows = ruleConfigMapper.selectTaskTypesByRuleCodes(ruleCodes);
|
||||
for (RuleConfigTaskTypeRow row : taskRows) {
|
||||
if (row == null || ObjectUtil.isEmpty(row.getRuleCode()) || ObjectUtil.isEmpty(row.getTaskTypeCode())) {
|
||||
continue;
|
||||
}
|
||||
taskTypesByRule.computeIfAbsent(row.getRuleCode(), k -> new ArrayList<>()).add(row.getTaskTypeCode());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, List<RuleConfig>> byModule = source.stream()
|
||||
.filter(r -> r != null && ObjectUtil.isNotEmpty(r.getModuleCode()))
|
||||
.collect(Collectors.groupingBy(RuleConfig::getModuleCode, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
List<RuleDecisionBlockVO> blocks = new ArrayList<>();
|
||||
for (RuleFourBlockDefinition def : RuleFourBlockDefinition.ordered()) {
|
||||
List<RuleConfig> moduleRules = new ArrayList<>(byModule.getOrDefault(def.getModuleCode(), Collections.emptyList()));
|
||||
moduleRules.sort(Comparator.comparing(RuleConfig::getPriorityNo, Comparator.nullsLast(Integer::compareTo)));
|
||||
|
||||
RuleDecisionBlockVO block = new RuleDecisionBlockVO();
|
||||
block.setBlockId(def.getBlockId());
|
||||
block.setModuleCode(def.getModuleCode());
|
||||
block.setTitle(def.getDroolsRuleName());
|
||||
block.setDroolsRuleName(def.getDroolsRuleName());
|
||||
block.setSalience(def.getSalience());
|
||||
block.setNodes(buildDecisionBlockNodes(def, moduleRules, paramsByRule, taskTypesByRule, globalPreview));
|
||||
blocks.add(block);
|
||||
}
|
||||
out.setBlocks(blocks);
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleFourBlocksGraphVO buildFourBlocksKnowledgeGraph() {
|
||||
RuleFourBlocksGraphVO out = new RuleFourBlocksGraphVO();
|
||||
@@ -446,6 +501,272 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
||||
return out;
|
||||
}
|
||||
|
||||
private List<RuleDecisionNodeVO> buildDecisionBlockNodes(RuleFourBlockDefinition def,
|
||||
List<RuleConfig> moduleRules,
|
||||
Map<String, List<RuleConfigParam>> paramsByRule,
|
||||
Map<String, List<String>> taskTypesByRule,
|
||||
Map<String, Object> globalPreview) {
|
||||
List<RuleDecisionNodeVO> nodes = new ArrayList<>();
|
||||
nodes.add(buildDecisionInputNode(def, moduleRules, paramsByRule, globalPreview));
|
||||
nodes.add(buildDecisionStepNode(def));
|
||||
nodes.add(buildDecisionRulesNode(def, moduleRules, paramsByRule, taskTypesByRule, globalPreview));
|
||||
nodes.add(buildDecisionOutcomeNode(def, moduleRules, paramsByRule, globalPreview));
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private RuleDecisionNodeVO buildDecisionInputNode(RuleFourBlockDefinition def,
|
||||
List<RuleConfig> moduleRules,
|
||||
Map<String, List<RuleConfigParam>> paramsByRule,
|
||||
Map<String, Object> globalPreview) {
|
||||
RuleDecisionNodeVO root = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":input",
|
||||
"输入参数",
|
||||
"input_group",
|
||||
"当前块启用参数会先进入 globalParams,再被规则与 Java 算子读取",
|
||||
"共 " + countEnabledParams(moduleRules, paramsByRule) + " 个");
|
||||
|
||||
Map<String, RuleDecisionNodeVO> uniqueByKey = new LinkedHashMap<>();
|
||||
for (RuleConfig rule : moduleRules) {
|
||||
if (rule == null || ObjectUtil.isEmpty(rule.getRuleCode())) {
|
||||
continue;
|
||||
}
|
||||
List<RuleConfigParam> plist = paramsByRule.getOrDefault(rule.getRuleCode(), Collections.emptyList());
|
||||
for (RuleConfigParam param : plist) {
|
||||
if (param == null || ObjectUtil.isEmpty(param.getParamKey())) {
|
||||
continue;
|
||||
}
|
||||
if (param.getEnabled() != null && param.getEnabled() == 0) {
|
||||
continue;
|
||||
}
|
||||
uniqueByKey.computeIfAbsent(param.getParamKey(), key -> {
|
||||
RuleParamMeta meta = resolveMeta(key);
|
||||
Object effective = globalPreview.get(key);
|
||||
String description = meta != null && ObjectUtil.isNotEmpty(meta.getDescription())
|
||||
? meta.getDescription()
|
||||
: "由命中的规则参数写入运行时参数池";
|
||||
String valueText = "生效值: " + String.valueOf(effective != null ? effective : param.getParamVal());
|
||||
return decisionNode(
|
||||
"decision:" + def.getBlockId() + ":input:" + key,
|
||||
ObjectUtil.defaultIfBlank(param.getParamName(), key),
|
||||
"input_param",
|
||||
description,
|
||||
valueText);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (uniqueByKey.isEmpty()) {
|
||||
root.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":input:empty",
|
||||
"当前没有启用参数",
|
||||
"empty",
|
||||
"导入或新增参数后,这里会展示参与该块运算的参数",
|
||||
null));
|
||||
} else {
|
||||
root.safeChildren().addAll(uniqueByKey.values());
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private RuleDecisionNodeVO buildDecisionStepNode(RuleFourBlockDefinition def) {
|
||||
RuleDecisionNodeVO root = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":steps",
|
||||
"运算步骤",
|
||||
"step_group",
|
||||
"展示该规则块在运算中的主路径",
|
||||
"salience=" + def.getSalience());
|
||||
List<String> steps = def.getComputationSteps();
|
||||
for (int i = 0; i < steps.size(); i++) {
|
||||
String step = steps.get(i);
|
||||
root.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":step:" + i,
|
||||
"步骤 " + (i + 1),
|
||||
"step",
|
||||
step,
|
||||
null));
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private RuleDecisionNodeVO buildDecisionRulesNode(RuleFourBlockDefinition def,
|
||||
List<RuleConfig> moduleRules,
|
||||
Map<String, List<RuleConfigParam>> paramsByRule,
|
||||
Map<String, List<String>> taskTypesByRule,
|
||||
Map<String, Object> globalPreview) {
|
||||
RuleDecisionNodeVO root = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rules",
|
||||
"规则链",
|
||||
"rule_group",
|
||||
"按优先级展示该块会如何判断、读取参数并产生产出",
|
||||
"共 " + moduleRules.size() + " 条");
|
||||
|
||||
if (CollUtil.isEmpty(moduleRules)) {
|
||||
root.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rules:empty",
|
||||
"当前没有规则项",
|
||||
"empty",
|
||||
"该块暂无可展示的规则配置",
|
||||
null));
|
||||
return root;
|
||||
}
|
||||
|
||||
for (RuleConfig rule : moduleRules) {
|
||||
if (rule == null || ObjectUtil.isEmpty(rule.getRuleCode())) {
|
||||
continue;
|
||||
}
|
||||
String ruleCode = rule.getRuleCode();
|
||||
RuleDecisionNodeVO ruleNode = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode,
|
||||
ObjectUtil.defaultIfBlank(rule.getRuleName(), ruleCode),
|
||||
"rule",
|
||||
ObjectUtil.defaultIfBlank(rule.getRemark(), "根据条件命中后执行当前规则"),
|
||||
"优先级 " + String.valueOf(rule.getPriorityNo() != null ? rule.getPriorityNo() : "-"));
|
||||
|
||||
ruleNode.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":condition",
|
||||
"命中条件",
|
||||
"condition",
|
||||
ObjectUtil.defaultIfBlank(rule.getConditionExpr(), def.getWhenExpr()),
|
||||
null));
|
||||
|
||||
List<String> taskTypes = taskTypesByRule.getOrDefault(ruleCode, Collections.emptyList());
|
||||
ruleNode.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":task-types",
|
||||
"适用任务",
|
||||
"task_types",
|
||||
taskTypes.isEmpty() ? "未单独限定任务类型" : joinTaskTypes(taskTypes),
|
||||
taskTypes.isEmpty() ? "全部/默认" : "共 " + taskTypes.size() + " 类"));
|
||||
|
||||
RuleDecisionNodeVO paramGroup = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":params",
|
||||
"读取参数",
|
||||
"param_group",
|
||||
"规则命中后会读取这些参数参与计算",
|
||||
null);
|
||||
List<RuleConfigParam> plist = new ArrayList<>(paramsByRule.getOrDefault(ruleCode, Collections.emptyList()));
|
||||
plist.sort(Comparator
|
||||
.comparing((RuleConfigParam p) -> p.getSortNo() == null ? Integer.MAX_VALUE : p.getSortNo())
|
||||
.thenComparing(RuleConfigParam::getParamKey, Comparator.nullsLast(String::compareTo)));
|
||||
for (RuleConfigParam param : plist) {
|
||||
if (param == null || ObjectUtil.isEmpty(param.getParamKey())) {
|
||||
continue;
|
||||
}
|
||||
if (param.getEnabled() != null && param.getEnabled() == 0) {
|
||||
continue;
|
||||
}
|
||||
String key = param.getParamKey();
|
||||
RuleParamMeta meta = resolveMeta(key);
|
||||
String desc = meta != null && ObjectUtil.isNotEmpty(meta.getDescription())
|
||||
? meta.getDescription()
|
||||
: RuleParamOutputHint.effectLine(key, def.getModuleCode());
|
||||
Object effective = globalPreview.get(key);
|
||||
paramGroup.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":param:" + key,
|
||||
ObjectUtil.defaultIfBlank(param.getParamName(), key),
|
||||
"param",
|
||||
desc,
|
||||
"参数键=" + key + ";生效值=" + String.valueOf(effective != null ? effective : param.getParamVal())));
|
||||
}
|
||||
if (CollUtil.isEmpty(paramGroup.getChildren())) {
|
||||
paramGroup.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":params:empty",
|
||||
"无参数",
|
||||
"empty",
|
||||
"当前规则未配置可展示参数",
|
||||
null));
|
||||
}
|
||||
ruleNode.safeChildren().add(paramGroup);
|
||||
|
||||
RuleDecisionNodeVO outputGroup = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":outputs",
|
||||
"产出结果",
|
||||
"output_group",
|
||||
ObjectUtil.defaultIfBlank(rule.getActionExpr(), def.getThenAction()),
|
||||
null);
|
||||
List<String> outputs = RuleFourBlockRuleOutputCatalog.outputsForRule(def.getModuleCode(), ruleCode);
|
||||
if (CollUtil.isEmpty(outputs)) {
|
||||
outputGroup.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":outputs:default",
|
||||
"执行块运算",
|
||||
"output",
|
||||
def.getThenAction(),
|
||||
"写入结果对象"));
|
||||
} else {
|
||||
for (int i = 0; i < outputs.size(); i++) {
|
||||
outputGroup.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":rule:" + ruleCode + ":output:" + i,
|
||||
"结果 " + (i + 1),
|
||||
"output",
|
||||
outputs.get(i),
|
||||
null));
|
||||
}
|
||||
}
|
||||
ruleNode.safeChildren().add(outputGroup);
|
||||
root.safeChildren().add(ruleNode);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private RuleDecisionNodeVO buildDecisionOutcomeNode(RuleFourBlockDefinition def,
|
||||
List<RuleConfig> moduleRules,
|
||||
Map<String, List<RuleConfigParam>> paramsByRule,
|
||||
Map<String, Object> globalPreview) {
|
||||
RuleDecisionNodeVO root = decisionNode(
|
||||
"decision:" + def.getBlockId() + ":outcome",
|
||||
"最终结果",
|
||||
"outcome_group",
|
||||
"汇总该块在命中规则后可能产出的业务结果",
|
||||
null);
|
||||
|
||||
LinkedHashSet<String> lines = new LinkedHashSet<>();
|
||||
for (RuleConfig rule : moduleRules) {
|
||||
if (rule == null || ObjectUtil.isEmpty(rule.getRuleCode())) {
|
||||
continue;
|
||||
}
|
||||
List<String> outputs = RuleFourBlockRuleOutputCatalog.outputsForRule(def.getModuleCode(), rule.getRuleCode());
|
||||
lines.addAll(outputs);
|
||||
for (RuleConfigParam param : paramsByRule.getOrDefault(rule.getRuleCode(), Collections.emptyList())) {
|
||||
if (param == null || ObjectUtil.isEmpty(param.getParamKey())) {
|
||||
continue;
|
||||
}
|
||||
if (param.getEnabled() != null && param.getEnabled() == 0) {
|
||||
continue;
|
||||
}
|
||||
Object effective = globalPreview.get(param.getParamKey());
|
||||
lines.add(ObjectUtil.defaultIfBlank(param.getParamName(), param.getParamKey())
|
||||
+ " -> "
|
||||
+ RuleParamOutputHint.effectLine(param.getParamKey(), def.getModuleCode())
|
||||
+ (effective != null ? "(当前值: " + effective + ")" : ""));
|
||||
}
|
||||
}
|
||||
|
||||
if (lines.isEmpty()) {
|
||||
root.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":outcome:empty",
|
||||
"暂无结果描述",
|
||||
"empty",
|
||||
"当前块暂无可汇总的产出",
|
||||
null));
|
||||
} else {
|
||||
int index = 0;
|
||||
for (String line : lines) {
|
||||
root.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":outcome:" + index,
|
||||
"结果说明 " + (index + 1),
|
||||
"outcome",
|
||||
line,
|
||||
null));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
root.safeChildren().add(decisionNode(
|
||||
"decision:" + def.getBlockId() + ":outcome:end",
|
||||
"输出 / 结束",
|
||||
"outcome",
|
||||
"当前规则块的决策链在这里收束,结果写入执行对象或作为后续环节输入",
|
||||
null));
|
||||
return root;
|
||||
}
|
||||
|
||||
private List<RuleFourBlockParamRowVO> buildFourBlockParamRows(RuleFourBlockDefinition def,
|
||||
Map<String, RuleConfig> ruleByCode,
|
||||
List<RuleConfigParam> plist,
|
||||
@@ -664,6 +985,35 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
||||
return graph;
|
||||
}
|
||||
|
||||
private int countEnabledParams(List<RuleConfig> moduleRules, Map<String, List<RuleConfigParam>> paramsByRule) {
|
||||
int count = 0;
|
||||
for (RuleConfig rule : moduleRules) {
|
||||
if (rule == null || ObjectUtil.isEmpty(rule.getRuleCode())) {
|
||||
continue;
|
||||
}
|
||||
for (RuleConfigParam param : paramsByRule.getOrDefault(rule.getRuleCode(), Collections.emptyList())) {
|
||||
if (param == null || ObjectUtil.isEmpty(param.getParamKey())) {
|
||||
continue;
|
||||
}
|
||||
if (param.getEnabled() != null && param.getEnabled() == 0) {
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private RuleDecisionNodeVO decisionNode(String key, String title, String nodeType, String description, String valueText) {
|
||||
RuleDecisionNodeVO node = new RuleDecisionNodeVO();
|
||||
node.setKey(key);
|
||||
node.setTitle(title);
|
||||
node.setNodeType(nodeType);
|
||||
node.setDescription(description);
|
||||
node.setValueText(valueText);
|
||||
return node;
|
||||
}
|
||||
|
||||
private List<RuleDictItem> safeDict(String dictType) {
|
||||
List<RuleDictItem> list = ruleConfigMapper.selectDictByType(dictType);
|
||||
return list != null ? list : Collections.emptyList();
|
||||
|
||||
Reference in New Issue
Block a user