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

补充system

上级 67ab0f76
......@@ -61,6 +61,8 @@ public class BaseEntityServiceImpl implements BaseEntityService
result.setRuleName(RULENAME);
result.setName(RU_EXECRESULTNAME);
result.setRetValue(RETVALUE);
if(param.get("systemid")!=null)
result.setSystemId(param.get("systemid").toString());
if(BUSINESSCAT!=null && BUSINESSCAT instanceof String){
result.setBusinessCat(String.valueOf(BUSINESSCAT));
}
......@@ -366,12 +368,8 @@ public class BaseEntityServiceImpl implements BaseEntityService
ExecLog execlog=new ExecLog();
execlog.setId(msg.getId());
execlog.setName(msg.getBatch());
execlog.setKeyValueField(msg.getModel());
execlog.setRunBody(msg.toString());
execlog.setSystemId(msg.getSystemid());
ruExecLogService.create(execlog);
StringBuilder strErrorInfo=new StringBuilder();
int count = 0;
int errorcount = 0;
......@@ -401,6 +399,7 @@ public class BaseEntityServiceImpl implements BaseEntityService
count++;
modelObj.set("BATCH",msg.getBatch());
modelObj.set(Tag_EngineId, msg.getEngineId());
modelObj.set("systemid",msg.getSystemid());
if(!StringUtils.isEmpty(msg.getResultDataSource())){
modelObj.set(RuleEngineExService.Setting_ResultDataSource, msg.getResultDataSource());
}
......
......@@ -12,6 +12,7 @@ import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import cn.ibizlab.core.rule.domain.ExecLog;
import cn.ibizlab.core.rule.domain.RuleEngine;
import cn.ibizlab.core.rule.domain.RuleItem;
import cn.ibizlab.core.rule.service.IExecLogService;
import cn.ibizlab.core.rule.service.IRuleItemService;
import cn.ibizlab.core.rule.service.impl.RuleEngineServiceImpl;
import cn.ibizlab.util.helper.CachedBeanCopier;
......@@ -139,6 +140,8 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
}
@Autowired
protected IExecLogService ruExecLogService;
public void processData(EngineMQMsg engineMQMsg){
RuleEngine et = get(engineMQMsg.getEngineId());
......@@ -157,7 +160,12 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
if(!StringUtils.isEmpty(resultTableName)){
msg.setResultTableName(resultTableName);
}
java.sql.Timestamp starttime = new java.sql.Timestamp(System.currentTimeMillis());
ExecLog execlog=new ExecLog();
execlog.setId(msg.getId());
execlog.setName(msg.getBatch());
execlog.setKeyValueField(msg.getModel());
execlog.setSystemId(msg.getSystemid());
ruExecLogService.create(execlog);
List<String> rules = new ArrayList<>();
DataModel dataModel=liteModelService.getDataModel(et.getModelId());
......@@ -195,7 +203,7 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
msg.setRules(rules);
msg.setDatas(liteDataService.getModelObjs(et.getModelId(),fillpropertys,engineMQMsg.getDatas()));
ExecLog execlog = baseEntityService.processAll(msg);
baseEntityService.processAll(msg);
}catch (Exception ex){
log.error(String.format("构建数据错误:%1$s", ex.getMessage()));
......
......@@ -5,6 +5,8 @@ import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import cn.ibizlab.core.lite.extensions.util.LiteStorage;
import cn.ibizlab.core.rule.service.impl.RuleItemServiceImpl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
......@@ -78,8 +80,8 @@ public class RuleItemExService extends RuleItemServiceImpl {
//获取实体配置信息
String strCfg = et.getCfg();
String strRuleid = et.getRuleId();
String strRulename = et.getRuleName();
String strMemo = et.getMemo();
String strRulename = StringUtils.isEmpty(et.getRuleName())?"":et.getRuleName().replace("\\", "");
String strMemo = StringUtils.isEmpty(et.getMemo())?"":et.getMemo().replace("\\", "");
String strRuleGroup = et.getGroup();
String strFieldset=et.getFieldSet();
String strMetricfield = "",strTimefield= "",strExt1field= "",strKeyvaluefield= "",strExt2field= "",strDomainsfield="" ,strDimfield="" ,strBusinesscatfield="";
......@@ -162,7 +164,7 @@ public class RuleItemExService extends RuleItemServiceImpl {
hasBusinesscatField = true;
param.put("businesscatfield", getFieldset(strBusinesscatfield, modelset));
} else {
strBusinesscatfield = et.getBusinessCat();
strBusinesscatfield = StringUtils.isEmpty(et.getBusinessCat())?"":et.getBusinessCat().replace("\\", "");
param.put("businesscat", strBusinesscatfield);
}
param.put("hasbusinesscatfield", hasBusinesscatField);
......
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="mac (generated)" id="1608271176254-1">
<changeSet author="mac (generated)" id="1608271176255-1">
<sql>
create unique index IBZRULERESULT_INDEX on ibzruleresult (RULEID, DIMFIELD, KEYVALUEFIELD);
create index IBZRULERESULT_INDEX on ibzruleresult (RULEID, DIMFIELD, KEYVALUEFIELD);
</sql>
</changeSet>
</databaseChangeLog>
......@@ -6,14 +6,14 @@
<insert id="replaceBatch" parameterType="java.util.List" databaseId="mysql">
<foreach collection="list" item="item" index="index" separator=";">
INSERT INTO ${resultTableName}
(ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat )
(ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat , systemid )
VALUES
(#{item.id}, #{item.name}, now(), now(), #{item.ruleId}, #{item.ruleName}, #{item.retValue}, #{item.keyValueField}, #{item.dimField}, #{item.metricField},
#{item.domainsField},#{item.timeField}, #{item.ext1Field}, #{item.ext2Field},#{item.businessCat} )
#{item.domainsField},#{item.timeField}, #{item.ext1Field}, #{item.ext2Field},#{item.businessCat},#{item.systemId} )
ON DUPLICATE KEY UPDATE
ru_execresultname=#{item.name}, createdate=now(), updatedate=now(), ruleid=#{item.ruleId}, rulename=#{item.ruleName},
retvalue=#{item.retValue}, keyvaluefield=#{item.keyValueField}, dimfield=#{item.dimField}, metricfield=#{item.metricField},domainsfield=#{item.domainsField},timefield=#{item.timeField},
ext1field=#{item.ext1Field},ext2field=#{item.ext2Field}, businesscat=#{item.businessCat}
ext1field=#{item.ext1Field},ext2field=#{item.ext2Field}, businesscat=#{item.businessCat},systemid=#{item.systemId}
</foreach>
</insert>
......@@ -23,14 +23,14 @@
MERGE INTO ${resultTableName} A USING (
<foreach collection='list' item='item' index='index' separator='UNION ALL'>
select #{item.id} as ru_execresultid, #{item.name} as ru_execresultname, sysdate as createdate, sysdate as updatedate, #{item.ruleId} as ruleid, #{item.ruleName} as rulename,#{item.retValue} as retvalue, #{item.keyValueField} as keyvaluefield, #{item.dimField} as dimfield,
#{item.metricField} as metricfield,#{item.domainsField} as domainsfield,#{item.timeField} as timefield, #{item.ext1Field} as ext1field,#{item.ext2Field} as ext2field,#{item.businessCat} as businesscat from dual
#{item.metricField} as metricfield,#{item.domainsField} as domainsfield,#{item.timeField} as timefield, #{item.ext1Field} as ext1field,#{item.ext2Field} as ext2field,#{item.businessCat} as businesscat,#{item.systemId} as systemid from dual
</foreach>
) B ON (A.ru_execresultid = B.ru_execresultid) WHEN MATCHED THEN
UPDATE SET A.ru_execresultname=B.ru_execresultname, A.updatedate=B.updatedate, A.ruleid=B.ruleid, A.rulename=B.rulename, A.retvalue=B.retvalue, A.keyvaluefield=B.keyvaluefield,
A.dimfield=B.dimfield, A.metricfield=B.metricfield,A.domainsfield=B.domainsfield,A.timefield=B.timefield,A.ext1field=B.ext1field,A.ext2field=B.ext2field, A.businesscat=B.businesscat
A.dimfield=B.dimfield, A.metricfield=B.metricfield,A.domainsfield=B.domainsfield,A.timefield=B.timefield,A.ext1field=B.ext1field,A.ext2field=B.ext2field, A.businesscat=B.businesscat, A.systemid=B.systemid
WHEN NOT MATCHED THEN
INSERT ( ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat )
VALUES (B.ru_execresultid,B.ru_execresultname, B.createdate, B.updatedate, B.ruleid, B.rulename, B.retvalue, B.keyvaluefield,B.dimfield, B.metricfield,B.domainsfield,B.timefield,B.ext1field,B.ext2field, B.businesscat)
INSERT ( ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat, systemid )
VALUES (B.ru_execresultid,B.ru_execresultname, B.createdate, B.updatedate, B.ruleid, B.rulename, B.retvalue, B.keyvaluefield,B.dimfield, B.metricfield,B.domainsfield,B.timefield,B.ext1field,B.ext2field, B.businesscat, #{item.systemId})
</insert>
<!--t1.BUSINESSCAT, t1.CREATEDATE, t1.DIMFIELD, t1.DOMAINSFIELD, t1.EXT1FIELD, t1.EXT2FIELD, t1.KEYVALUEFIELD, t1.METRICFIELD,
......@@ -39,14 +39,14 @@
MERGE INTO ${resultTableName} A USING (
<foreach collection='list' item='item' index='index' separator='UNION ALL'>
select #{item.id} as ru_execresultid, #{item.name} as ru_execresultname, sysdate as createdate, sysdate as updatedate, #{item.ruleId} as ruleid, #{item.ruleName} as rulename,#{item.retValue} as retvalue, #{item.keyValueField} as keyvaluefield, #{item.dimField} as dimfield,
#{item.metricField} as metricfield,#{item.domainsField} as domainsfield,#{item.timeField} as timefield, #{item.ext1Field} as ext1field,#{item.ext2Field} as ext2field,#{item.businessCat} as businesscat from dual
#{item.metricField} as metricfield,#{item.domainsField} as domainsfield,#{item.timeField} as timefield, #{item.ext1Field} as ext1field,#{item.ext2Field} as ext2field,#{item.businessCat} as businesscat,#{item.systemId} as systemid from dual
</foreach>
) B ON (A.ru_execresultid = B.ru_execresultid) WHEN MATCHED THEN
UPDATE SET A.ru_execresultname=B.ru_execresultname, A.updatedate=B.updatedate, A.ruleid=B.ruleid, A.rulename=B.rulename, A.retvalue=B.retvalue, A.keyvaluefield=B.keyvaluefield,
A.dimfield=B.dimfield, A.metricfield=B.metricfield,A.domainsfield=B.domainsfield,A.timefield=B.timefield,A.ext1field=B.ext1field,A.ext2field=B.ext2field, A.businesscat=B.businesscat
A.dimfield=B.dimfield, A.metricfield=B.metricfield,A.domainsfield=B.domainsfield,A.timefield=B.timefield,A.ext1field=B.ext1field,A.ext2field=B.ext2field, A.businesscat=B.businesscat, A.systemid=B.systemid
WHEN NOT MATCHED THEN
INSERT ( ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat )
VALUES (B.ru_execresultid,B.ru_execresultname, B.createdate, B.updatedate, B.ruleid, B.rulename, B.retvalue, B.keyvaluefield,B.dimfield, B.metricfield,B.domainsfield,B.timefield,B.ext1field,B.ext2field, B.businesscat)
INSERT ( ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat, systemid )
VALUES (B.ru_execresultid,B.ru_execresultname, B.createdate, B.updatedate, B.ruleid, B.rulename, B.retvalue, B.keyvaluefield,B.dimfield, B.metricfield,B.domainsfield,B.timefield,B.ext1field,B.ext2field, B.businesscat, #{item.systemId})
</insert>
<delete id="clearBatch" parameterType="java.util.List" >
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册