executor 为空时忽略

This commit is contained in:
zhou-hao 2020-04-21 14:12:05 +08:00
parent 1dcafe5f57
commit cbbeaa3813
1 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import org.jetlinks.rule.engine.api.model.RuleNodeModel;
import org.jetlinks.rule.engine.model.RuleModelParserStrategy;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
@ -46,6 +47,9 @@ public class SqlRuleModelParser implements RuleModelParserStrategy {
if (!CollectionUtils.isEmpty(sqlRule.getWhenErrorThen())) {
int index = 0;
for (Action act : sqlRule.getWhenErrorThen()) {
if (!StringUtils.hasText(act.getExecutor())) {
continue;
}
RuleNodeModel action = new RuleNodeModel();
action.setId("error:action:" + index);
action.setName("错误处理:" + index);
@ -85,6 +89,9 @@ public class SqlRuleModelParser implements RuleModelParserStrategy {
if (!CollectionUtils.isEmpty(sqlRule.getActions())) {
int index = 0;
for (Action operation : sqlRule.getActions()) {
if (!StringUtils.hasText(operation.getExecutor())) {
continue;
}
RuleNodeModel action = new RuleNodeModel();
action.setId("action:" + index);
action.setName("执行动作:" + index);