Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
24899b83
提交
24899b83
编写于
7月 26, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增pg
上级
8511edba
变更
8
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
91 行增加
和
38 行删除
+91
-38
ExecResultExMapper.java
...cn/ibizlab/core/extensions/mapper/ExecResultExMapper.java
+1
-0
AnalyseEntityServiceImpl.java
...lab/core/extensions/service/AnalyseEntityServiceImpl.java
+2
-2
AnalyseSqlServiceImpl.java
...bizlab/core/extensions/service/AnalyseSqlServiceImpl.java
+10
-10
BaseEntityServiceImpl.java
...bizlab/core/extensions/service/BaseEntityServiceImpl.java
+15
-10
DABuildExService.java
.../cn/ibizlab/core/extensions/service/DABuildExService.java
+12
-4
ExecResultExService.java
.../ibizlab/core/extensions/service/ExecResultExService.java
+8
-4
RuleEngineExService.java
.../ibizlab/core/extensions/service/RuleEngineExService.java
+14
-8
ExecResultExMapper.xml
...n/resources/mapper/rule/execresult/ExecResultExMapper.xml
+29
-0
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/mapper/ExecResultExMapper.java
浏览文件 @
24899b83
...
...
@@ -11,6 +11,7 @@ public interface ExecResultExMapper extends BaseMapper<EntityObj>{
int
replaceBatch
(
@Param
(
"list"
)
List
<
ExecResult
>
var1
,
@Param
(
"resultTableName"
)
String
tableName
);
int
replaceBatchByOracle
(
@Param
(
"list"
)
List
<
ExecResult
>
var1
,
@Param
(
"resultTableName"
)
String
tableName
);
int
replaceBatchByPG
(
@Param
(
"list"
)
List
<
ExecResult
>
var1
,
@Param
(
"resultTableName"
)
String
tableName
);
int
clearBatch
(
@Param
(
"list"
)
List
<
ExecResult
>
var1
,
@Param
(
"resultTableName"
)
String
tableName
);
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/AnalyseEntityServiceImpl.java
浏览文件 @
24899b83
...
...
@@ -198,10 +198,10 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
modelObj
.
set
(
Tag_EngineId
,
msg
.
getEngineId
());
modelObj
.
set
(
"systemid"
,
msg
.
getSystemid
());
if
(!
StringUtils
.
isEmpty
(
msg
.
getResultDataSource
())){
modelObj
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
msg
.
getResultDataSource
());
modelObj
.
set
(
"resultDataSource"
,
msg
.
getResultDataSource
());
}
if
(!
StringUtils
.
isEmpty
(
msg
.
getResultTableName
())){
modelObj
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
msg
.
getResultTableName
());
modelObj
.
set
(
"resultTableName"
,
msg
.
getResultTableName
());
}
processRule
(
modelObj
,
modelObj
.
getRowKey
(),
strResId
);
ResultsMQMsg
resultsMQMsg
=
new
ResultsMQMsg
();
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/AnalyseSqlServiceImpl.java
浏览文件 @
24899b83
...
...
@@ -97,17 +97,17 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
result
.
setDomainsField
(
DOMAINSFIELD
.
getValue
(
String
.
class
,
""
));
result
.
setSystemId
(
DataObject
.
getStringValue
(
param
.
get
(
"systemid"
),
null
));
Object
resultDataSource
=
ExecResultExService
.
Default_ResultDataSource
;
Object
resultTableName
=
ExecResultExService
.
Default_ResultTableName
;
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultDataSource
.
toUpperCase
())
){
resultDataSource
=
param
.
get
(
RuleEngineExService
.
Setting_ResultDataSource
);
Object
resultDataSource
=
Default_ResultDataSource
;
Object
resultTableName
=
Default_ResultTableName
;
if
(
param
.
get
(
"resultDataSource"
)!=
null
){
resultDataSource
=
param
.
get
(
"resultDataSource"
);
}
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultTableName
.
toUpperCase
())
){
resultTableName
=
param
.
get
(
RuleEngineExService
.
Setting_ResultTableName
);
if
(
param
.
get
(
"resultTableName"
)!=
null
){
resultTableName
=
param
.
get
(
"resultTableName"
);
}
result
.
set
(
Tag_EngineId
,
param
.
get
(
Tag_EngineId
));
result
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
resultDataSource
);
result
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
resultTableName
);
result
.
set
(
"resultDataSource"
,
resultDataSource
);
result
.
set
(
"resultTableName"
,
resultTableName
);
if
((!
StringUtils
.
isEmpty
(
result
.
getRuleId
()))&&(!
StringUtils
.
isEmpty
(
result
.
getKeyValueField
())))
{
...
...
@@ -209,10 +209,10 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
modelObj
.
set
(
Tag_EngineId
,
msg
.
getEngineId
());
modelObj
.
set
(
"systemid"
,
msg
.
getSystemid
());
if
(!
StringUtils
.
isEmpty
(
msg
.
getResultDataSource
())){
modelObj
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
msg
.
getResultDataSource
());
modelObj
.
set
(
"resultDataSource"
,
msg
.
getResultDataSource
());
}
if
(!
StringUtils
.
isEmpty
(
msg
.
getResultTableName
())){
modelObj
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
msg
.
getResultTableName
());
modelObj
.
set
(
"resultTableName"
,
msg
.
getResultTableName
());
}
processRule
(
modelObj
,
modelObj
.
getRowKey
(),
strResId
);
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BaseEntityServiceImpl.java
浏览文件 @
24899b83
...
...
@@ -55,6 +55,11 @@ public class BaseEntityServiceImpl implements BaseEntityService
KieContainer
kContainer
=
ks
.
getKieClasspathContainer
();
}
@Value
(
"${defaultResultDataSource:default}"
)
protected
String
Default_ResultDataSource
;
@Value
(
"${defaultResultTableName:IBZRULERESULT}"
)
protected
String
Default_ResultTableName
;
public
void
saveResult
(
ModelObj
param
,
String
RULEID
,
String
RULECODE
,
String
RULENAME
,
String
RU_EXECRESULTNAME
,
FieldObj
BUSINESSCAT
,
Integer
RETVALUE
,
FieldObj
KEYVALUEFIELD
,
FieldObj
DOMAINSFIELD
,
FieldObj
DIMFIELD
,
FieldObj
METRICFIELD
,
FieldObj
TIMEFIELD
,
FieldObj
EXT1FIELD
,
FieldObj
EXT2FIELD
)
...
...
@@ -121,17 +126,17 @@ public class BaseEntityServiceImpl implements BaseEntityService
}
Object
resultDataSource
=
ExecResultExService
.
Default_ResultDataSource
;
Object
resultTableName
=
ExecResultExService
.
Default_ResultTableName
;
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultDataSource
.
toUpperCase
())
){
resultDataSource
=
param
.
get
(
RuleEngineExService
.
Setting_ResultDataSource
);
Object
resultDataSource
=
Default_ResultDataSource
;
Object
resultTableName
=
Default_ResultTableName
;
if
(
param
.
get
(
"resultDataSource"
)!=
null
){
resultDataSource
=
param
.
get
(
"resultDataSource"
);
}
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultTableName
.
toUpperCase
())
){
resultTableName
=
param
.
get
(
RuleEngineExService
.
Setting_ResultTableName
);
if
(
param
.
get
(
"resultTableName"
)!=
null
){
resultTableName
=
param
.
get
(
"resultTableName"
);
}
result
.
set
(
Tag_EngineId
,
param
.
get
(
Tag_EngineId
));
result
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
resultDataSource
);
result
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
resultTableName
);
result
.
set
(
"resultDataSource"
,
resultDataSource
);
result
.
set
(
"resultTableName"
,
resultTableName
);
if
(
DIMFIELD
.
isEmpty
())
return
;
...
...
@@ -475,10 +480,10 @@ public class BaseEntityServiceImpl implements BaseEntityService
modelObj
.
set
(
Tag_EngineId
,
msg
.
getEngineId
());
modelObj
.
set
(
"systemid"
,
msg
.
getSystemid
());
if
(!
StringUtils
.
isEmpty
(
msg
.
getResultDataSource
())){
modelObj
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
msg
.
getResultDataSource
());
modelObj
.
set
(
"resultDataSource"
,
msg
.
getResultDataSource
());
}
if
(!
StringUtils
.
isEmpty
(
msg
.
getResultTableName
())){
modelObj
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
msg
.
getResultTableName
());
modelObj
.
set
(
"resultTableName"
,
msg
.
getResultTableName
());
}
processRule
(
modelObj
,
modelObj
.
getRowKey
(),
strResId
);
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/DABuildExService.java
浏览文件 @
24899b83
...
...
@@ -51,6 +51,12 @@ public class DABuildExService extends DABuildServiceImpl {
@Value
(
"${ibiz.rulepath:/app/file/rules/}"
)
private
String
rulePath
;
@Value
(
"${defaultResultDataSource:default}"
)
private
String
Default_ResultDataSource
;
@Value
(
"${defaultResultTableName:IBZRULERESULT}"
)
private
String
Default_ResultTableName
;
@Autowired
protected
IExecLogService
ruExecLogService
;
...
...
@@ -177,12 +183,14 @@ public class DABuildExService extends DABuildServiceImpl {
msg
.
setEngineId
(
engineMQMsg
.
getEngineId
());
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultDataSource"
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultTableName"
);
if
(
!
StringUtils
.
isEmpty
(
resultDataSource
)){
msg
.
setResultDataSource
(
resultDataSource
)
;
if
(
StringUtils
.
isEmpty
(
resultDataSource
)){
resultDataSource
=
Default_ResultDataSource
;
}
if
(
!
StringUtils
.
isEmpty
(
resultTableName
)){
msg
.
setResultTableName
(
resultTableName
)
;
if
(
StringUtils
.
isEmpty
(
resultTableName
)){
resultTableName
=
Default_ResultTableName
;
}
msg
.
setResultDataSource
(
resultDataSource
);
msg
.
setResultTableName
(
resultTableName
);
ExecLog
execlog
=
new
ExecLog
();
execlog
.
setId
(
msg
.
getId
());
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/ExecResultExService.java
浏览文件 @
24899b83
...
...
@@ -9,6 +9,7 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import
com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
...
...
@@ -27,8 +28,11 @@ import java.util.*;
@Service
(
"ExecResultExService"
)
public
class
ExecResultExService
extends
ExecResultServiceImpl
{
public
static
final
String
Default_ResultDataSource
=
"default"
;
public
static
final
String
Default_ResultTableName
=
"IBZRULERESULT"
;
@Value
(
"${defaultResultDataSource:default}"
)
private
String
Default_ResultDataSource
;
@Value
(
"${defaultResultTableName:IBZRULERESULT}"
)
private
String
Default_ResultTableName
;
@Autowired
@Lazy
...
...
@@ -163,8 +167,8 @@ public class ExecResultExService extends ExecResultServiceImpl {
*/
private
void
addExecResult
(
Map
<
String
,
List
<
ExecResult
>>
execResultMap
,
ExecResult
execResult
)
{
Object
engineId
=
execResult
.
get
(
BaseEntityServiceImpl
.
Tag_EngineId
);
Object
dsName
=
execResult
.
get
(
RuleEngineExService
.
Setting_ResultDataSource
);
Object
tabName
=
execResult
.
get
(
RuleEngineExService
.
Setting_ResultTableName
);
Object
dsName
=
execResult
.
get
(
"resultDataSource"
);
Object
tabName
=
execResult
.
get
(
"resultTableName"
);
String
id
=
String
.
format
(
"%s|%s|%s"
,
engineId
,
dsName
,
tabName
);
if
(
ObjectUtils
.
isEmpty
(
engineId
))
{
log
.
error
(
"存储规则结果失败,无法数据[{}]的引擎标识!"
,
execResult
.
getId
());
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleEngineExService.java
浏览文件 @
24899b83
...
...
@@ -45,9 +45,12 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
}
public
static
final
String
Setting_ResultDataSource
=
"resultDataSource"
;
public
static
final
String
Setting_ResultTableName
=
"resultTableName"
;
@Value
(
"${defaultResultDataSource:default}"
)
private
String
Default_ResultDataSource
;
@Value
(
"${defaultResultTableName:IBZRULERESULT}"
)
private
String
Default_ResultTableName
;
@Autowired
private
IRuleItemService
ruleItemService
;
...
...
@@ -138,14 +141,17 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
msg
.
setBatch
(
engineMQMsg
.
getBatch
());
msg
.
setSystemid
(
et
.
getSystemId
());
msg
.
setEngineId
(
engineMQMsg
.
getEngineId
());
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
Setting_ResultDataSource
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
Setting_ResultTableName
);
if
(
!
StringUtils
.
isEmpty
(
resultDataSource
)){
msg
.
setResultDataSource
(
resultDataSource
)
;
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultDataSource"
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultTableName"
);
if
(
StringUtils
.
isEmpty
(
resultDataSource
)){
resultDataSource
=
Default_ResultDataSource
;
}
if
(
!
StringUtils
.
isEmpty
(
resultTableName
)){
msg
.
setResultTableName
(
resultTableName
)
;
if
(
StringUtils
.
isEmpty
(
resultTableName
)){
resultTableName
=
Default_ResultTableName
;
}
msg
.
setResultDataSource
(
resultDataSource
);
msg
.
setResultTableName
(
resultTableName
);
ExecLog
execlog
=
new
ExecLog
();
execlog
.
setId
(
msg
.
getId
());
execlog
.
setName
(
msg
.
getBatch
());
...
...
ibzdst-core/src/main/resources/mapper/rule/execresult/ExecResultExMapper.xml
浏览文件 @
24899b83
...
...
@@ -33,6 +33,20 @@
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, B.systemId)
</insert>
<insert
id=
"replaceBatchByPG"
parameterType=
"java.util.List"
databaseId=
"postgresql"
>
INSERT INTO ${resultTableName}
(ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat , systemid )
VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{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.systemId} )
</foreach>
ON conflict(ru_execresultid) DO UPDATE set
ru_execresultname=excluded.name, updatedate=current_timestamp, ruleid=excluded.ruleId, rulename=excluded.ruleName,
retvalue=excluded.retValue, keyvaluefield=excluded.keyValueField, dimfield=excluded.dimField, metricfield=excluded.metricField,domainsfield=excluded.domainsField,timefield=excluded.timeField,
ext1field=excluded.ext1Field,ext2field=excluded.ext2Field, businesscat=excluded.businessCat,systemid=excluded.systemId
</insert>
<!--t1.BUSINESSCAT, t1.CREATEDATE, t1.DIMFIELD, t1.DOMAINSFIELD, t1.EXT1FIELD, t1.EXT2FIELD, t1.KEYVALUEFIELD, t1.METRICFIELD,
t1.RETVALUE, t1.RULEID, t1.RULENAME, t1.RU_EXECRESULTID, t1.RU_EXECRESULTNAME, t1.SYSTEMID, t1.TIMEFIELD, t1.UPDATEDATE-->
<insert
id=
"replaceBatchByOracle"
parameterType=
"java.util.List"
>
...
...
@@ -48,6 +62,21 @@
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, B.systemId)
</insert>
<insert
id=
"replaceBatchByPG"
parameterType=
"java.util.List"
>
INSERT INTO ${resultTableName}
(ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat , systemid )
VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{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.systemId} )
</foreach>
ON conflict(ru_execresultid) DO UPDATE set
ru_execresultname=excluded.name, updatedate=current_timestamp, ruleid=excluded.ruleId, rulename=excluded.ruleName,
retvalue=excluded.retValue, keyvaluefield=excluded.keyValueField, dimfield=excluded.dimField, metricfield=excluded.metricField,domainsfield=excluded.domainsField,timefield=excluded.timeField,
ext1field=excluded.ext1Field,ext2field=excluded.ext2Field, businesscat=excluded.businessCat,systemid=excluded.systemId
</insert>
<delete
id=
"clearBatch"
parameterType=
"java.util.List"
>
delete from ${resultTableName} where (ru_execresultid) in
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录