Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
3640194c
提交
3640194c
编写于
12月 30, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
37988d56
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
89 行增加
和
48 行删除
+89
-48
BaseEntityServiceImpl.java
...bizlab/core/extensions/service/BaseEntityServiceImpl.java
+84
-48
RuleEngineExService.java
.../ibizlab/core/extensions/service/RuleEngineExService.java
+5
-0
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BaseEntityServiceImpl.java
浏览文件 @
3640194c
...
...
@@ -6,6 +6,8 @@ import cn.ibizlab.core.rule.domain.ExecLog;
import
cn.ibizlab.core.rule.domain.ExecResult
;
import
cn.ibizlab.core.rule.service.IExecLogService
;
import
cn.ibizlab.core.rule.service.IExecResultService
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.RuleUtils
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
lombok.extern.slf4j.Slf4j
;
import
org.kie.api.KieBase
;
...
...
@@ -61,53 +63,46 @@ 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
));
}
if
(
KEYVALUEFIELD
==
null
)
{
result
.
setKeyValueField
(
param
.
getRowKey
());
}
else
{
result
.
setKeyValueField
(
KEYVALUEFIELD
.
toString
());
}
result
.
setKeyValueField
(
DataObject
.
getStringValue
(
valueOf
(
KEYVALUEFIELD
),
param
.
getRowKey
()));
if
(
METRICFIELD
!=
null
)
{
Object
val
=
METRICFIELD
;
if
(
(
val
instanceof
BigDecimal
))
result
.
setMetricField
(((
BigDecimal
)
val
));
else
if
(
(
val
instanceof
BigInteger
))
result
.
setMetricField
(
new
BigDecimal
((
BigInteger
)
val
));
else
if
(
(
val
instanceof
Double
))
result
.
setMetricField
(
new
BigDecimal
((
Double
)
val
));
else
if
(
(
val
instanceof
Float
))
result
.
setMetricField
(
new
BigDecimal
(((
Float
)
val
).
doubleValue
()));
else
if
(
(
val
instanceof
Long
))
result
.
setMetricField
(
new
BigDecimal
((
Long
)
val
));
else
if
(
(
val
instanceof
Integer
))
result
.
setMetricField
(
new
BigDecimal
((
int
)
val
));
if
(
1
==
RETVALUE
)
{
result
.
setSystemId
(
DataObject
.
getStringValue
(
param
.
get
(
"systemid"
),
null
));
result
.
setBusinessCat
(
DataObject
.
getStringValue
(
valueOf
(
BUSINESSCAT
),
null
));
if
(
METRICFIELD
!=
null
)
{
Object
val
=
METRICFIELD
;
if
(
(
val
instanceof
BigDecimal
))
result
.
setMetricField
(((
BigDecimal
)
val
));
else
if
(
(
val
instanceof
Double
))
result
.
setMetricField
(
new
BigDecimal
((
Double
)
val
));
else
if
(
(
val
instanceof
Float
))
result
.
setMetricField
(
new
BigDecimal
(((
Float
)
val
).
doubleValue
()));
else
if
(
(
val
instanceof
Integer
))
result
.
setMetricField
(
new
BigDecimal
((
int
)
val
));
else
result
.
setMetricField
(
new
BigDecimal
(
1
));
}
else
result
.
setMetricField
(
new
BigDecimal
(
1
));
Object
timefield
=
valueOf
(
TIMEFIELD
);
if
(
timefield
!=
null
&&
timefield
instanceof
Timestamp
)
result
.
setTimeField
((
Timestamp
)
timefield
);
if
(
EXT1FIELD
!=
null
)
{
String
ext1
=
valuesOf
(
EXT1FIELD
);
if
(
ext1
!=
null
&&
ext1
.
length
()>
330
)
ext1
=
ext1
.
substring
(
0
,
330
)+
"..."
;
result
.
setExt1Field
(
ext1
);
}
if
(
EXT2FIELD
!=
null
)
{
String
ext2
=
valuesOf
(
EXT2FIELD
);
if
(
ext2
!=
null
&&
ext2
.
length
()>
330
)
ext2
=
ext2
.
substring
(
0
,
330
)+
"..."
;
result
.
setExt2Field
(
ext2
);
}
}
else
result
.
setMetricField
(
new
BigDecimal
(
1
));
if
(
DOMAINSFIELD
!=
null
)
{
result
.
setDomainsField
(
DOMAINSFIELD
.
toString
());
}
else
{
result
.
setDomainsField
(
result
.
getKeyValueField
());
}
if
(
TIMEFIELD
!=
null
&&
TIMEFIELD
instanceof
Timestamp
)
result
.
setTimeField
((
Timestamp
)
TIMEFIELD
);
if
(
EXT1FIELD
!=
null
)
result
.
setExt1Field
(
EXT1FIELD
.
toString
());
if
(
EXT2FIELD
!=
null
)
result
.
setExt2Field
(
EXT2FIELD
.
toString
());
Object
resultDataSource
=
ExecResultExService
.
Default_ResultDataSource
;
Object
resultTableName
=
ExecResultExService
.
Default_ResultTableName
;
if
(
param
.
containsKey
(
RuleEngineExService
.
Setting_ResultDataSource
)){
...
...
@@ -123,20 +118,22 @@ public class BaseEntityServiceImpl implements BaseEntityService
if
(
DIMFIELD
==
null
){
return
;
}
List
dims
=
n
ew
ArrayList
()
;
List
dims
=
n
ull
;
if
(
DIMFIELD
instanceof
List
){
dims
=
(
List
)
DIMFIELD
;
}
else
if
(
DIMFIELD
instanceof
String
){
dims
.
add
(
DIMFIELD
);
}
else
{
dims
=
new
ArrayList
();
dims
.
add
(
DataObject
.
getStringValue
(
DIMFIELD
,
null
));
}
for
(
Object
obj
:
dims
){
if
(
StringUtils
.
isEmpty
(
obj
))
result
.
setDimField
(
DataObject
.
getStringValue
(
obj
,
null
));
if
(
StringUtils
.
isEmpty
(
result
.
getDimField
()))
continue
;
result
.
setDimField
(
String
.
valueOf
(
obj
));
result
.
setId
(
result
.
getDefaultKey
(
true
).
toString
());
if
(
result
.
getRetValue
()==
1
)
{
result
.
setRuleId
(
RULECODE
);
result
.
setDomainsField
(
DataObject
.
getStringValue
(
valueOf
(
DOMAINSFIELD
),
result
.
getDimField
()));
ruExecResultService
.
saveAsync
(
result
);
}
else
...
...
@@ -146,6 +143,45 @@ public class BaseEntityServiceImpl implements BaseEntityService
}
}
private
Object
valueOf
(
Object
val
)
{
Object
rt
=
null
;
if
(
val
!=
null
&&
val
instanceof
List
)
{
for
(
Object
item:
(
List
)
val
){
if
(
item
!=
null
)
{
if
(
rt
==
null
||
RuleUtils
.
gt
(
rt
,
val
))
rt
=
item
;
}
}
}
else
if
(
val
!=
null
)
{
rt
=
val
;
}
return
rt
;
}
private
String
valuesOf
(
Object
val
)
{
String
rt
=
null
;
if
(
val
!=
null
&&
val
instanceof
List
)
{
for
(
Object
item:
(
List
)
val
){
if
(
item
!=
null
)
{
if
(!
StringUtils
.
isEmpty
(
rt
))
rt
=
rt
+
","
;
rt
=
rt
+
DataObject
.
getStringValue
(
item
,
""
);
}
}
}
else
{
rt
=
DataObject
.
getStringValue
(
val
,
null
);
}
return
rt
;
}
@Autowired
private
IExecResultService
ruExecResultService
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleEngineExService.java
浏览文件 @
3640194c
...
...
@@ -15,6 +15,7 @@ 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.errors.BadRequestAlertException
;
import
cn.ibizlab.util.helper.CachedBeanCopier
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
...
...
@@ -94,11 +95,15 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
{
CachedBeanCopier
.
copy
(
get
(
et
.
getEngineId
()),
et
);
if
(
"RUNNING"
.
equalsIgnoreCase
(
et
.
getState
()))
throw
new
BadRequestAlertException
(
"引擎正在执行中,不能重复执行"
,
"RuleEngine"
,
et
.
getEngineId
());
BaseRequest
msg
=
new
BaseRequest
();
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setEngineId
(
et
.
getEngineId
());
java
.
sql
.
Timestamp
starttime
=
new
java
.
sql
.
Timestamp
(
System
.
currentTimeMillis
());
liteDataService
.
processDataModel
(
et
.
getModelId
(),
et
.
getLastRuntime
(),
new
LiteDataCallback
<
List
<
EntityObj
>>()
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录