Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
ea872cd8
提交
ea872cd8
编写于
12月 16, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drl
上级
d174b69d
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
36 行增加
和
55 行删除
+36
-55
RuleItemExService.java
...cn/ibizlab/core/extensions/service/RuleItemExService.java
+28
-46
DSTRule.drl.ftl
ibzdst-core/src/main/resources/ftl/DSTRule.drl.ftl
+8
-9
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleItemExService.java
浏览文件 @
ea872cd8
package
cn
.
ibizlab
.
core
.
extensions
.
service
;
import
cn.ibizlab.core.extensions.util.FreeMakerHelper
;
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
;
import
cn.ibizlab.core.rule.domain.RuleItem
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -59,6 +63,9 @@ public class RuleItemExService extends RuleItemServiceImpl {
return
super
.
modelchange
(
et
);
}
@Autowired
private
LiteModelService
liteModelService
;
/**
* 按照规则生成drl文件
* @param et
...
...
@@ -105,22 +112,29 @@ public class RuleItemExService extends RuleItemServiceImpl {
strExt2field
=
obj
.
getString
(
"ext2field"
);
strDimfield
=
obj
.
getString
(
"dimfield"
);
strBusinesscatfield
=
obj
.
getString
(
"businesscatfield"
);
strDomainsfield
=
StringUtils
.
isEmpty
(
strDimfield
)?
obj
.
getString
(
"domainsfield"
):
strDimfield
;
strDomainsfield
=
obj
.
getString
(
"domainsfield"
)
;
}
if
(
StringUtils
.
isEmpty
(
strDomainsfield
))
strDomainsfield
=
et
.
getModelName
()+
".CBDW_BM"
;
strDomainsfield
=
strDimfield
;
Map
param
=
new
HashMap
();
param
.
put
(
"ruleid"
,
strRuleid
);
param
.
put
(
"rulecode"
,
et
.
getRuleCode
());
param
.
put
(
"rulename"
,
strRulename
);
param
.
put
(
"memo"
,
strMemo
);
DataModel
dataModel
=
liteModelService
.
getDataModel
(
et
.
getModelId
());
synchronized
(
lockModel
)
{
Hashtable
<
String
,
String
>
modelset
=
new
Hashtable
<
String
,
String
>();
param
.
put
(
"datamodelname"
,
dataModel
.
getDataModelName
());
modelset
.
put
(
"datamodelname"
,
dataModel
.
getDataModelName
());
param
.
put
(
"rulecond"
,
parseGroup
(
cfg
,
modelset
));
param
.
put
(
"releationcond"
,
parseRelationArr
(
JSONObject
.
parseObject
(
strCfg
),
modelset
));
String
strCond
=
""
;
for
(
String
key
:
modelset
.
keySet
())
{
if
(!
StringUtils
.
isEmpty
(
strCond
))
...
...
@@ -137,7 +151,9 @@ public class RuleItemExService extends RuleItemServiceImpl {
param
.
put
(
"keyvaluefield"
,
getFieldkeyset
(
strKeyvaluefield
,
modelset
));
param
.
put
(
"ext2field"
,
getFieldset
(
strExt2field
,
modelset
));
param
.
put
(
"domainsfield"
,
getFieldset
(
strDomainsfield
,
modelset
));
param
.
put
(
"dimfield"
,
getFieldset
(
strDomainsfield
,
modelset
));
param
.
put
(
"dimfield"
,
getFieldset
(
strDimfield
,
modelset
));
param
.
put
(
"dimfield_d"
,
dataModel
.
getDataModelName
()+
".$(\""
+
strDimfield
+
"\")"
);
param
.
put
(
"keyvaluefield_d"
,
StringUtils
.
isEmpty
(
strKeyvaluefield
)?
dataModel
.
getDataModelName
()+
".getRowKey()"
:
dataModel
.
getDataModelName
()+
".$(\""
+
strKeyvaluefield
+
"\")"
);
if
(!
StringUtils
.
isEmpty
(
strBusinesscatfield
))
{
hasBusinesscatField
=
true
;
param
.
put
(
"businesscatfield"
,
getFieldset
(
strBusinesscatfield
,
modelset
));
...
...
@@ -267,7 +283,7 @@ public class RuleItemExService extends RuleItemServiceImpl {
{
if
(!
modelset
.
containsKey
(
arr
[
0
]))
{
modelset
.
put
(
arr
[
0
],
"item"
);
modelset
.
put
(
arr
[
0
],
modelset
.
get
(
"datamodelname"
)
);
}
}
...
...
@@ -339,10 +355,11 @@ public class RuleItemExService extends RuleItemServiceImpl {
if
(!
StringUtils
.
isEmpty
(
strGroupCond
)){
if
(
relaConn
.
equals
(
"exists"
))
{
strRelationResult
=
String
.
format
(
"%s:ModelObj %s from %s.getNested(\"%s\")"
,
relaEntity
,
strGroupCond
,
relaEntity
,
relaEntity
);
strRelationResult
=
String
.
format
(
"%s:ModelObj %s from %s.getNested(\"%s\")"
,
relaEntity
,
strGroupCond
,
modelset
.
get
(
"datamodelname"
),
relaEntity
);
modelset
.
put
(
"EXIST"
,
relaEntity
);
}
else
if
(
relaConn
.
equals
(
"not exists"
)){
strRelationResult
=
String
.
format
(
"not(exists ModelObj %s from
item.getNested(\"%s\"))"
,
strGroupCond
,
relaEntity
);
strRelationResult
=
String
.
format
(
"not(exists ModelObj %s from
%s.getNested(\"%s\"))"
,
strGroupCond
,
modelset
.
get
(
"datamodelname"
)
,
relaEntity
);
}
}
if
(!
StringUtils
.
isEmpty
(
strRelationResult
))
...
...
@@ -356,8 +373,8 @@ public class RuleItemExService extends RuleItemServiceImpl {
{
String
str
=
this
.
getFieldset
(
fieldName
,
modelset
);
if
(
str
.
equals
(
"null"
))
return
"item.KEY
"
;
return
str
+
"
.getValue()
"
;
return
modelset
.
get
(
"datamodelname"
)+
".getRowKey()
"
;
return
str
+
""
;
}
private
String
getFieldset
(
String
fieldName
,
Hashtable
<
String
,
String
>
modelset
)
...
...
@@ -369,49 +386,14 @@ public class RuleItemExService extends RuleItemServiceImpl {
String
[]
arr
=
fieldName
.
split
(
"[.]"
);
if
(
arr
.
length
>=
2
)
{
if
(
modelset
.
containsKey
(
"AJXYRHZ"
))
{
String
tmp
=
arr
[
0
];
if
(
tmp
.
equalsIgnoreCase
(
"TYYW_GG_XYRJBXX"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_GS_XYRQK"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_KG_BXFRQK"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_SHB_XYRQK"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_WJ_BYXBLQK"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_WJ_FZXYR"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_WJ_QTXZQK"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_WJ_XYR"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_WJ_XYRQK"
)||
tmp
.
equalsIgnoreCase
(
"TYYW_ZIZ_FZXYR"
)
||
tmp
.
equalsIgnoreCase
(
"TYYW_ZJ_FZXYR"
))
{
return
"AJXYRHZ.$(\""
+
fieldName
+
"\")"
;
}
}
if
(
modelset
.
containsKey
(
"AJWSHZ"
))
{
String
tmp
=
arr
[
0
];
if
(
tmp
.
equalsIgnoreCase
(
"YX_WS_SL"
)||
tmp
.
equalsIgnoreCase
(
"YX_WS_AJJZWJ"
))
{
return
"AJWSHZ.$(\""
+
fieldName
+
"\")"
;
}
}
if
(
modelset
.
containsKey
(
"AJDZJZMLHZ"
))
{
String
tmp
=
arr
[
0
];
if
(
tmp
.
equalsIgnoreCase
(
"YX_DZJZ_JZML"
))
{
return
"AJDZJZMLHZ.$(\""
+
fieldName
+
"\")"
;
}
}
if
(
modelset
.
containsKey
(
"AJGGQZCSQKHZ"
))
{
String
tmp
=
arr
[
0
];
if
(
tmp
.
equalsIgnoreCase
(
"TYYW_GG_QZCSQK"
))
{
return
"AJGGQZCSQKHZ.$(\""
+
fieldName
+
"\")"
;
}
}
if
(
modelset
.
containsKey
(
arr
[
0
]))
if
(
modelset
.
containsKey
(
"EXIST"
))
{
return
modelset
.
get
(
arr
[
0
]
)+
".$(\""
+
fieldName
+
"\")"
;
return
modelset
.
get
(
"EXIST"
)+
".$(\""
+
fieldName
+
"\")"
;
}
}
}
return
"item
.$(\""
+
fieldName
+
"\")"
;
return
modelset
.
get
(
"datamodelname"
)+
"
.$(\""
+
fieldName
+
"\")"
;
}
}
ibzdst-core/src/main/resources/ftl/DSTRule.drl.ftl
浏览文件 @
ea872cd8
...
...
@@ -3,21 +3,20 @@ import cn.ibizlab.core.lite.extensions.ModelObj;
import
cn
.
ibizlab
.
core
.
extensions
.
service
.
BaseEntityService
;
global
BaseEntityService
BaseService
;
rule
"<#if rule
code??>${rulecode
}_1</#if>"
rule
"<#if rule
id??>${ruleid
}_1</#if>"
salience
100
activation
-
group
"<#if rule
code??>${rulecode
}</#if>"
activation
-
group
"<#if rule
id??>${ruleid
}</#if>"
when
item
:
ModelObj
(
<#
if
rulecond
??>${
rulecond
}</#
if
>
)
${
datamodelname
}
:
ModelObj
(
<#
if
rulecond
??>${
rulecond
}</#
if
>
)
<#
if
(
releationcond
??)>${
releationcond
}</#
if
>
then
BaseService
.
saveResult
(
item
,
"<#if rulecode??>${rulecode}</#if>"
,
"<#if rulename??>${rulename}</#if>"
,
"<#if memo??>${memo}</#if>"
,<#
if
businesscat
??><#
if
hasbusinesscatfield
>${
businesscatfield
}<#
else
>
"${businesscat}"
</#
if
>
</#
if
>,
1
,${
keyvaluefield
},${
domainsfield
},${
dimfield
},${
metricfield
},${
timefield
},${
ext1field
},${
ext2field
});
BaseService
.
saveResult
(
${
datamodelname
},
"<#if rulecode??>${rulecode}</#if>"
,
"<#if rulename??>${rulename}</#if>"
,
"<#if memo??>${memo}</#if>"
,<#
if
hasbusinesscatfield
>${
businesscatfield
}<#
else
>
"${businesscat}"
</#
if
>,
1
,${
keyvaluefield
},${
domainsfield
},${
dimfield
},${
metricfield
},${
timefield
},${
ext1field
},${
ext2field
});
end
rule
"<#if rule
code??>${rulecode
}_d</#if>"
rule
"<#if rule
id??>${ruleid
}_d</#if>"
salience
0
activation
-
group
"<#if rule
code??>${rulecode
}</#if>"
activation
-
group
"<#if rule
id??>${ruleid
}</#if>"
when
item
:
ModelObj
(
)
<#
if
(
releationcond
??)>${
releationcond
}</#
if
>
${
datamodelname
}:
ModelObj
(
)
then
BaseService
.
saveResult
(
item
,
"<#if rulecode??>${rulecode}</#if>"
,
null
,
null
,
null
,
0
,${
keyvaluefield
},${
domainsfield
},${
dimfield
},${
metricfield
},${
timefield
}
,
null
,
null
);
BaseService
.
saveResult
(
${
datamodelname
},
"<#if rulecode??>${rulecode}</#if>"
,
null
,
null
,
null
,
0
,${
keyvaluefield_d
},
null
,${
dimfield_d
},
0
,
null
,
null
,
null
);
end
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录