提交 3f3875cb 编写于 作者: sq3536's avatar sq3536

补齐

上级 2fcc245e
package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.extensions.domain.BaseRequest;
import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.core.lite.extensions.service.DbEntityService;
import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import cn.ibizlab.core.rule.domain.ExecLog;
import cn.ibizlab.core.rule.domain.RuleItem;
import cn.ibizlab.core.rule.filter.RuleItemSearchContext;
......@@ -9,6 +11,7 @@ import cn.ibizlab.core.rule.service.IRuleItemService;
import cn.ibizlab.core.rule.service.impl.RuleEngineServiceImpl;
import cn.ibizlab.util.helper.CachedBeanCopier;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
......@@ -45,6 +48,9 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
@Autowired
private BaseEntityService baseEntityService;
@Autowired
private LiteModelService liteModelService;
@Value("${ibiz.rulepath:/app/file/rules/}")
private String rulePath;
/**
......@@ -68,9 +74,8 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
java.sql.Timestamp starttime = new java.sql.Timestamp(System.currentTimeMillis());
List<String> rules = new ArrayList<>();
HashSet<String> propertys=new HashSet<>();
DataModel dataModel=liteModelService.getDataModel(et.getModelId());
HashSet<String> fillpropertys=new HashSet<>();
ruleItemService.list(Wrappers.<RuleItem>lambdaQuery()
.eq(RuleItem::getModelId,et.getModelId()).ne(RuleItem::getGroup,"REP").like(RuleItem::getGroup,et.getGroup()))
.forEach(ruleItem -> {
......@@ -86,12 +91,26 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
rules.add(path);
}
if((!StringUtils.isEmpty(ruleItem.getCond()))&&ruleItem.getCond().startsWith("["))
propertys.addAll(JSON.toJavaObject(JSON.parseArray(ruleItem.getCond()),LinkedHashSet.class));
fillpropertys.addAll(JSON.toJavaObject(JSON.parseArray(ruleItem.getCond()),LinkedHashSet.class));
});
dataModel.getAllProperty().forEach(prop->{
if(fillpropertys.contains(prop.getPropertyName()))
{
DataModel p=prop.getOwnerDataModel().getParentDataModel();
while (p!=null)
{
fillpropertys.add(p.getFactPorperty().getPropertyName());
p=p.getParentDataModel();
}
}
});
msg.setRules(rules);
msg.setDatas(dbEntityService.getModelObjs(et.getModelId(),propertys,et.getLastRuntime()));
msg.setDatas(dbEntityService.getModelObjs(et.getModelId(),fillpropertys,et.getLastRuntime()));
......@@ -123,8 +142,8 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
ruleItemService.list(Wrappers.<RuleItem>lambdaQuery()
.eq(RuleItem::getModelId,et.getModelId()).ne(RuleItem::getGroup,"REP").like(RuleItem::getGroup,et.getGroup()))
.forEach(ruleItem -> {
ruleItemService.update(ruleItem);
ruleItemService.buildRuleFile(ruleItem);
});
}
return super.run(et);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册