Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
e5fcb50c
提交
e5fcb50c
编写于
11月 29, 2022
作者:
hebao@lab.ibiz5.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
规则及指标构建支持自定义sql条件(扩展参数设置extCond)
上级
0acbf836
变更
6
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
27 行增加
和
10 行删除
+27
-10
DABuildExService.java
.../cn/ibizlab/core/extensions/service/DABuildExService.java
+3
-1
RuleEngineExService.java
.../ibizlab/core/extensions/service/RuleEngineExService.java
+3
-1
CommonEntityService.java
...lab/core/lite/extensions/service/CommonEntityService.java
+1
-0
DbEntityService.java
...ibizlab/core/lite/extensions/service/DbEntityService.java
+14
-6
LiteDataService.java
...ibizlab/core/lite/extensions/service/LiteDataService.java
+2
-2
MongoEntityService.java
...zlab/core/lite/extensions/service/MongoEntityService.java
+4
-0
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/DABuildExService.java
浏览文件 @
e5fcb50c
...
...
@@ -134,11 +134,12 @@ public class DABuildExService extends DABuildServiceImpl {
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setEngineId
(
et
.
getBuildId
());
String
extCond
=
Setting
.
getValue
(
et
.
getExtParams
(),
"extCond"
);
java
.
sql
.
Timestamp
starttime
=
new
java
.
sql
.
Timestamp
(
System
.
currentTimeMillis
());
liteDataService
.
processDataModel
(
et
.
getModelId
(),
et
.
getLastRuntime
(),
new
LiteDataCallback
<
List
<
EntityObj
>>()
{
liteDataService
.
processDataModel
(
et
.
getModelId
(),
e
xtCond
,
e
t
.
getLastRuntime
(),
new
LiteDataCallback
<
List
<
EntityObj
>>()
{
@Override
public
void
total
(
Integer
total
)
{
String
state
=
"FINISH"
;
...
...
@@ -163,6 +164,7 @@ public class DABuildExService extends DABuildServiceImpl {
try
{
defaultMQProducerService
.
sendBuildMsg
(
engineMQMsg
);
}
catch
(
Exception
ex
)
{
log
.
error
(
String
.
format
(
"指标构建发送业务数据到MQ失败,error:%1$s\n data:%2$s"
,
ex
.
getMessage
(),
JSON
.
toJSONString
(
engineMQMsg
)));
return
false
;
}
return
true
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleEngineExService.java
浏览文件 @
e5fcb50c
...
...
@@ -99,11 +99,12 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setEngineId
(
et
.
getEngineId
());
String
extCond
=
Setting
.
getValue
(
et
.
getExtParams
(),
"extCond"
);
java
.
sql
.
Timestamp
starttime
=
new
java
.
sql
.
Timestamp
(
System
.
currentTimeMillis
());
liteDataService
.
processDataModel
(
et
.
getModelId
(),
et
.
getLastRuntime
(),
new
LiteDataCallback
<
List
<
EntityObj
>>()
{
liteDataService
.
processDataModel
(
et
.
getModelId
(),
e
xtCond
,
e
t
.
getLastRuntime
(),
new
LiteDataCallback
<
List
<
EntityObj
>>()
{
@Override
public
void
total
(
Integer
total
)
{
String
state
=
"FINISH"
;
...
...
@@ -128,6 +129,7 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
try
{
defaultMQProducerService
.
sendEngineMsg
(
engineMQMsg
);
}
catch
(
Exception
ex
)
{
log
.
error
(
String
.
format
(
"规则引擎发送业务数据到MQ失败,error:%1$s\n data:%2$s"
,
ex
.
getMessage
(),
JSON
.
toJSONString
(
engineMQMsg
)));
return
false
;
}
return
true
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/CommonEntityService.java
浏览文件 @
e5fcb50c
...
...
@@ -27,6 +27,7 @@ public interface CommonEntityService {
void
processList
(
DataModel
dataModel
,
Timestamp
lastModify
,
LiteDataCallback
callback
);
void
processList
(
DataModel
dataModel
,
String
extCond
,
Timestamp
lastModify
,
LiteDataCallback
callback
);
}
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/DbEntityService.java
浏览文件 @
e5fcb50c
...
...
@@ -64,9 +64,10 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
DynamicDataSourceContextHolder
.
push
(
dsName
);
DbEntitySearchContext
context
=
new
DbEntitySearchContext
();
context
.
setFilter
(
filter
);
QueryWrapper
qw
=
context
.
getSelectCond
();
if
(!
StringUtils
.
isEmpty
(
filter
.
getCustSqlSegment
()))
qw
.
apply
(
filter
.
getCustSqlSegment
());
QueryWrapper
<
EntityObj
>
qw
=
context
.
getSelectCond
();
if
(!
StringUtils
.
isEmpty
(
filter
.
getCustSqlSegment
()))
{
qw
.
and
(
wrapper
->
wrapper
.
apply
(
filter
.
getCustSqlSegment
()));
}
Integer
count
=
baseMapper
.
searchCount
(
sql
,
qw
);
...
...
@@ -349,13 +350,20 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
@Value
(
"${ibiz.syncBatchSize:500}"
)
private
int
processSize
=
500
;
@Override
public
void
processList
(
DataModel
dataModel
,
Timestamp
lastModify
,
LiteDataCallback
callback
)
public
void
processList
(
DataModel
dataModel
,
Timestamp
lastModify
,
LiteDataCallback
callback
){
this
.
processList
(
dataModel
,
""
,
lastModify
,
callback
);
}
@Override
public
void
processList
(
DataModel
dataModel
,
String
extCond
,
Timestamp
lastModify
,
LiteDataCallback
callback
)
{
EntityModel
entityModel
=
dataModel
.
getFactEntityModel
();
FieldModel
lastModifyField
=
entityModel
.
getLastModifyField
();
QueryFilter
filter
=
new
QueryFilter
();
if
(
lastModifyField
!=
null
)
filter
.
ge
(
lastModifyField
.
getColumnName
(),
lastModify
);
if
(
StringUtils
.
hasLength
(
extCond
)){
filter
.
cust
(
extCond
);
}
//记录处理的总业务数据量
String
sql
=
entityModel
.
getSqlSegment
(
"CORE"
);
...
...
@@ -376,9 +384,9 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
DbEntitySearchContext
context
=
new
DbEntitySearchContext
();
context
.
setFilter
(
filter
);
QueryWrapper
qw
=
context
.
getSelectCond
();
QueryWrapper
<
EntityObj
>
qw
=
context
.
getSelectCond
();
if
(!
StringUtils
.
isEmpty
(
filter
.
getCustSqlSegment
()))
qw
.
a
pply
(
filter
.
getCustSqlSegment
(
));
qw
.
a
nd
(
wrapper
->
wrapper
.
apply
(
filter
.
getCustSqlSegment
()
));
Map
<
String
,
Object
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"sql"
,
sql
);
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/LiteDataService.java
浏览文件 @
e5fcb50c
...
...
@@ -107,11 +107,11 @@ public class LiteDataService {
getEntityService
(
dsName
).
cursorRead
(
dsName
,
entityModel
,
sql
,
filter
,
callback
);
}
public
void
processDataModel
(
String
metaModelId
,
Timestamp
lastModify
,
LiteDataCallback
callback
)
public
void
processDataModel
(
String
metaModelId
,
String
extCond
,
Timestamp
lastModify
,
LiteDataCallback
callback
)
{
DataModel
dataModel
=
liteModelService
.
getDataModel
(
metaModelId
);
EntityModel
entityModel
=
dataModel
.
getFactEntityModel
();
getEntityService
(
entityModel
.
getDsName
()).
processList
(
dataModel
,
lastModify
,
callback
);
getEntityService
(
entityModel
.
getDsName
()).
processList
(
dataModel
,
extCond
,
lastModify
,
callback
);
}
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/MongoEntityService.java
浏览文件 @
e5fcb50c
...
...
@@ -61,6 +61,10 @@ public class MongoEntityService implements CommonEntityService{
@Override
public
void
processList
(
DataModel
dataModel
,
Timestamp
lastModify
,
LiteDataCallback
callback
)
{
this
.
processList
(
dataModel
,
""
,
lastModify
,
callback
);
}
@Override
public
void
processList
(
DataModel
dataModel
,
String
extCond
,
Timestamp
lastModify
,
LiteDataCallback
callback
)
{
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录