Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
355fc9e1
提交
355fc9e1
编写于
12月 23, 2020
作者:
hebao@lab.ibiz5.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
result保存调整
上级
64569b5c
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
38 行增加
和
29 行删除
+38
-29
BaseEntityServiceImpl.java
...bizlab/core/extensions/service/BaseEntityServiceImpl.java
+9
-5
ExecResultExService.java
.../ibizlab/core/extensions/service/ExecResultExService.java
+22
-19
MQConsumeMsgListenerProcessor.java
...b/core/extensions/util/MQConsumeMsgListenerProcessor.java
+7
-5
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BaseEntityServiceImpl.java
浏览文件 @
355fc9e1
...
...
@@ -106,13 +106,17 @@ public class BaseEntityServiceImpl implements BaseEntityService
result
.
setExt1Field
(
EXT1FIELD
.
toString
());
if
(
EXT2FIELD
!=
null
)
result
.
setExt2Field
(
EXT2FIELD
.
toString
());
result
.
set
(
Tag_EngineId
,
param
.
get
(
Tag_EngineId
));
Object
resultDataSource
=
ExecResultExService
.
Default_ResultDataSource
;
Object
resultTableName
=
ExecResultExService
.
Default_ResultTableName
;
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultDataSource
)){
result
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
param
.
get
(
RuleEngineExService
.
Setting_ResultDataSource
));
}
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultTableName
)){
result
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
param
.
get
(
RuleEngineExService
.
Setting_ResultTableName
));
resultDataSource
=
param
.
get
(
RuleEngineExService
.
Setting_ResultDataSource
);
}
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultTableName
)){
resultTableName
=
param
.
get
(
RuleEngineExService
.
Setting_ResultTableName
);
}
result
.
set
(
Tag_EngineId
,
param
.
get
(
Tag_EngineId
));
result
.
set
(
RuleEngineExService
.
Setting_ResultDataSource
,
resultDataSource
);
result
.
set
(
RuleEngineExService
.
Setting_ResultTableName
,
resultTableName
);
if
(
DIMFIELD
==
null
){
return
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/ExecResultExService.java
浏览文件 @
355fc9e1
...
...
@@ -27,6 +27,8 @@ import java.util.*;
@Service
(
"ExecResultExService"
)
public
class
ExecResultExService
extends
ExecResultServiceImpl
{
public
static
final
String
Default_ResultDataSource
=
"default"
;
public
static
final
String
Default_ResultTableName
=
"IBZRULERESULT"
;
@Autowired
@Lazy
...
...
@@ -177,8 +179,6 @@ public class ExecResultExService extends ExecResultServiceImpl {
}
}
public
static
final
String
Default_ResultTableName
=
"IBZRULERESULT"
;
@Autowired
private
DstDataSourceExService
dstDataSourceService
;
...
...
@@ -194,20 +194,17 @@ public class ExecResultExService extends ExecResultServiceImpl {
public
int
saveResultBatch
(
List
<
ExecResult
>
execResults
,
String
dsName
,
String
tableName
)
{
int
result
=
0
;
try
{
if
(!
ObjectUtils
.
isEmpty
(
dsName
)
&&
!
dsName
.
equalsIgnoreCase
(
"null"
))
{
if
(!
Default_ResultDataSource
.
equalsIgnoreCase
(
dsName
))
{
dstDataSourceService
.
initDataSource
(
dsName
);
DynamicDataSourceContextHolder
.
push
(
dsName
);
}
if
(
StringUtils
.
isEmpty
(
tableName
)
||
tableName
.
equalsIgnoreCase
(
"null"
)){
tableName
=
Default_ResultTableName
;
}
Map
<
String
,
DataSource
>
dynamicDSMap
=
dynamicRoutingDataSource
.
getCurrentDataSources
();
if
(!
ObjectUtils
.
isEmpty
(
dynamicDSMap
)
&&
dynamicDSMap
.
containsKey
(
dsName
))
{
DataSource
ds
=
dynamicDSMap
.
get
(
dsName
);
if
(
ds
instanceof
DruidDataSource
)
{
DruidDataSource
druidDataSource
=
(
DruidDataSource
)
dynamicDSMap
.
get
(
dsName
);
if
(
"oracle"
.
equals
(
druidDataSource
.
getDbType
()))
{
return
execResultExMapper
.
replaceBatchByOracle
(
execResults
,
tableName
);
Map
<
String
,
DataSource
>
dynamicDSMap
=
dynamicRoutingDataSource
.
getCurrentDataSources
();
if
(!
ObjectUtils
.
isEmpty
(
dynamicDSMap
)
&&
dynamicDSMap
.
containsKey
(
dsName
))
{
DataSource
ds
=
dynamicDSMap
.
get
(
dsName
);
if
(
ds
instanceof
DruidDataSource
)
{
DruidDataSource
druidDataSource
=
(
DruidDataSource
)
dynamicDSMap
.
get
(
dsName
);
if
(
"oracle"
.
equals
(
druidDataSource
.
getDbType
()))
{
return
execResultExMapper
.
replaceBatchByOracle
(
execResults
,
tableName
);
}
}
}
}
...
...
@@ -215,7 +212,9 @@ public class ExecResultExService extends ExecResultServiceImpl {
}
catch
(
Exception
ex
)
{
log
.
error
(
"存储规则结果发生异常,详细错误信息:"
+
ex
.
getMessage
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
if
(!
Default_ResultDataSource
.
equalsIgnoreCase
(
dsName
))
{
DynamicDataSourceContextHolder
.
poll
();
}
}
return
result
;
}
...
...
@@ -223,13 +222,17 @@ public class ExecResultExService extends ExecResultServiceImpl {
public
int
clearResultBatch
(
List
<
ExecResult
>
execResults
,
String
dsName
,
String
tableName
)
{
int
result
=
0
;
try
{
dstDataSourceService
.
initDataSource
(
dsName
);
DynamicDataSourceContextHolder
.
push
(
dsName
);
result
=
execResultExMapper
.
clearBatch
(
execResults
,
tableName
);
if
(!
Default_ResultDataSource
.
equalsIgnoreCase
(
dsName
)){
dstDataSourceService
.
initDataSource
(
dsName
);
DynamicDataSourceContextHolder
.
push
(
dsName
);
}
//result = execResultExMapper.clearBatch(execResults, tableName);
}
catch
(
Exception
ex
)
{
log
.
error
(
"存储规则结果发生异常,详细错误信息:"
+
ex
.
getMessage
());
}
finally
{
DynamicDataSourceContextHolder
.
poll
();
if
(!
Default_ResultDataSource
.
equalsIgnoreCase
(
dsName
))
{
DynamicDataSourceContextHolder
.
poll
();
}
}
return
result
;
}
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/util/MQConsumeMsgListenerProcessor.java
浏览文件 @
355fc9e1
...
...
@@ -35,7 +35,7 @@ public class MQConsumeMsgListenerProcessor implements MessageListenerOrderly {
log
.
info
(
"MQ接收消息为空,直接返回成功"
);
return
ConsumeOrderlyStatus
.
SUCCESS
;
}
System
.
out
.
println
(
System
.
currentTimeMillis
());
//
System.out.println(System.currentTimeMillis());
MessageExt
messageExt
=
list
.
get
(
0
);
log
.
info
(
"MQ接收到的消息为:"
+
messageExt
.
toString
());
try
{
...
...
@@ -58,11 +58,13 @@ public class MQConsumeMsgListenerProcessor implements MessageListenerOrderly {
protected
void
processRuleEngineData
(
MessageExt
messageExt
){
try
{
String
body
=
new
String
(
messageExt
.
getBody
(),
"utf-8"
);
String
body
=
new
String
(
messageExt
.
getBody
(),
"utf-8"
);
// Thread.sleep(10000);
EngineMQMsg
engineMQMsg
=
JSON
.
parseObject
(
body
,
new
TypeReference
<
EngineMQMsg
>()
{});
ruleEngineExService
.
processData
(
engineMQMsg
);
// System.out.println("start sleep");
// Thread.sleep(80000);
// System.out.println("end sleep");
EngineMQMsg
engineMQMsg
=
JSON
.
parseObject
(
body
,
new
TypeReference
<
EngineMQMsg
>()
{});
ruleEngineExService
.
processData
(
engineMQMsg
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取MQ消息内容异常{}"
,
e
);
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录