Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
04337514
提交
04337514
编写于
1月 20, 2021
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
切面逻辑优化
上级
c8423bf6
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
26 行增加
和
17 行删除
+26
-17
DELogicAspect.java.ftl
...ain/java/%SYS_PKGPATH%/util/aspect/DELogicAspect.java.ftl
+26
-17
未找到文件。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/DELogicAspect.java.ftl
浏览文件 @
04337514
...
...
@@ -57,13 +57,22 @@ import java.util.regex.Pattern;
@
Slf4j
public
class
DELogicAspect
{
@
Value
(
"${r'${ibiz.filePath:D:/app/file/}'}"
)
private
String
fileRoot
;
public
enum
LogicMode
{
/**
*
本地
*/
LOCAL
,
/**
*
远程
*/
REMOTE
}
private
static
BpmnXMLConverter
bpmnXMLConverter
=
new
BpmnXMLConverter
();
private
final
ExpressionParser
parser
=
new
SpelExpressionParser
();
private
ConcurrentMap
<
String
,
DELogic
>
deLogicMap
=
new
ConcurrentHashMap
<>();
private
final
String
DEFAULT_MODULE_PACKAGE
=
"[
\\
w+
\\
.]
\\
.core.(
\\
w+)
\\
.domain"
;
@
Value
(
"${r'${ibiz.dynamicMode:
fals
e}'}"
)
@
Value
(
"${r'${ibiz.dynamicMode:
tru
e}'}"
)
private
boolean
dynamicMode
;
@
Value
(
"${r'${ibiz.dynamic.path:/app/file/dynamicmodel/}'}"
)
private
String
dynamicPath
;
...
...
@@ -108,13 +117,13 @@ public class DELogicAspect {
if
(
dynamicMode
)
{
bpmnFile
=
getRemoteModel
(
getDEModule
(
entity
),
entity
.
getClass
().
getSimpleName
(),
action
,
"before"
);
if
(
bpmnFile
.
exists
())
{
executeLogic
(
bpmnFile
,
entity
);
executeLogic
(
bpmnFile
,
entity
,
LogicMode
.
REMOTE
);
return
;
}
}
bpmnFile
=
getLocalModel
(
entity
.
getClass
().
getSimpleName
(),
action
,
"before"
);
if
(
bpmnFile
!= null && bpmnFile.exists()) {
executeLogic
(
bpmnFile
,
entity
);
executeLogic
(
bpmnFile
,
entity
,
LogicMode
.
LOCAL
);
}
}
...
...
@@ -129,13 +138,13 @@ public class DELogicAspect {
if
(
dynamicMode
)
{
bpmnFile
=
getRemoteModel
(
getDEModule
(
entity
),
entity
.
getClass
().
getSimpleName
(),
action
,
"after"
);
if
(
bpmnFile
.
exists
())
{
executeLogic
(
bpmnFile
,
entity
);
executeLogic
(
bpmnFile
,
entity
,
LogicMode
.
REMOTE
);
return
;
}
}
bpmnFile
=
getLocalModel
(
entity
.
getClass
().
getSimpleName
(),
action
,
"after"
);
if
(
bpmnFile
!= null && bpmnFile.exists()) {
executeLogic
(
bpmnFile
,
entity
);
executeLogic
(
bpmnFile
,
entity
,
LogicMode
.
LOCAL
);
}
}
...
...
@@ -150,13 +159,13 @@ public class DELogicAspect {
if
(
dynamicMode
)
{
bpmnFile
=
getRemoteModel
(
getDEModule
(
entity
),
entity
.
getClass
().
getSimpleName
(),
action
,
"exec"
);
if
(
bpmnFile
.
exists
())
{
executeLogic
(
bpmnFile
,
entity
);
executeLogic
(
bpmnFile
,
entity
,
LogicMode
.
REMOTE
);
return
;
}
}
bpmnFile
=
getLocalModel
(
entity
.
getClass
().
getSimpleName
(),
action
,
"exec"
);
if
(
bpmnFile
!= null && bpmnFile.exists()) {
executeLogic
(
bpmnFile
,
entity
);
executeLogic
(
bpmnFile
,
entity
,
LogicMode
.
LOCAL
);
}
}
...
...
@@ -166,10 +175,10 @@ public class DELogicAspect {
*
@
param
bpmnFile
*
@
param
entity
*/
private
void
executeLogic
(
File
bpmnFile
,
Object
entity
)
{
private
void
executeLogic
(
File
bpmnFile
,
Object
entity
,
LogicMode
logicMode
)
{
log
.
debug
(
"开始执行实体处理逻辑[{}]"
,
bpmnFile
.
getName
());
String
bpmnId
=
DigestUtils
.
md5DigestAsHex
(
bpmnFile
.
getName
().
getBytes
());
DELogic
logic
=
getDELogic
(
bpmnFile
,
entity
);
DELogic
logic
=
getDELogic
(
bpmnFile
,
entity
,
logicMode
);
if
(
logic
==
null
)
{
return
;
}
...
...
@@ -255,7 +264,7 @@ public class DELogicAspect {
*
@
return
*/
@
SneakyThrows
private
DELogic
getDELogic
(
File
bpmnFile
,
Object
entity
)
{
private
DELogic
getDELogic
(
File
bpmnFile
,
Object
entity
,
LogicMode
logicMode
)
{
DELogic
logic
=
null
;
XMLStreamReader
reader
=
null
;
InputStream
bpmn
=
null
;
...
...
@@ -283,8 +292,8 @@ public class DELogicAspect {
if
(
item
instanceof
CallActivity
)
{
CallActivity
subBpmn
=
(
CallActivity
)
item
;
String
bpmnFileName
=
subBpmn
.
getName
();
File
subBpmnFile
=
getSubBpmn
(
getDEModule
(
entity
),
entity
.
getClass
().
getSimpleName
(),
bpmnFileName
);
DELogic
refLogic
=
getDELogic
(
subBpmnFile
,
entity
);
File
subBpmnFile
=
getSubBpmn
(
getDEModule
(
entity
),
entity
.
getClass
().
getSimpleName
(),
bpmnFileName
,
logicMode
);
DELogic
refLogic
=
getDELogic
(
subBpmnFile
,
entity
,
logicMode
);
if
(
refLogic
!= null) {
refLogics
.
add
(
refLogic
);
if
(
!ObjectUtils.isEmpty(refLogic.getRefRuleFiles())) {
...
...
@@ -360,7 +369,7 @@ public class DELogicAspect {
*
@
return
*/
private
File
getLocalModel
(
String
entity
,
String
action
,
String
actionLogic
)
{
String
logicName
=
String
.
format
(
"
PSDEACTION.json.
%s.bpmn"
,
actionLogic
);
String
logicName
=
String
.
format
(
"%s.bpmn"
,
actionLogic
);
String
filePath
=
File
.
separator
+
"rules"
+
File
.
separator
+
entity
.
toLowerCase
()
+
File
.
separator
+
action
+
File
.
separator
+
logicName
;
URL
url
=
this
.
getClass
().
getResource
(
filePath
.
replace
(
"
\\
"
,
"/"
));
return
ObjectUtils
.
isEmpty
(
url
)
?
null
:
new
File
(
url
.
getPath
());
...
...
@@ -388,8 +397,8 @@ public class DELogicAspect {
*
@
param
logicName
*
@
return
*/
private
File
getSubBpmn
(
String
module
,
String
entity
,
String
logicName
)
{
if
(
dynamicMode
)
{
private
File
getSubBpmn
(
String
module
,
String
entity
,
String
logicName
,
LogicMode
logicMode
)
{
if
(
LogicMode
.
REMOTE
.
equals
(
logicMode
)
)
{
return
new
File
(
dynamicPath
+
File
.
separator
+
systemId
+
File
.
separator
+
"PSMODULES"
+
File
.
separator
+
module
+
File
.
separator
+
"PSDATAENTITIES"
+
File
.
separator
+
entity
+
File
.
separator
+
"PSDELOGICS"
+
File
.
separator
+
logicName
+
File
.
separator
+
"PSDELOGIC.json.bpmn"
);
}
else
{
String
filePath
=
String
.
format
(
"/rules/%s%sRuleFlow.bpmn"
,
entity
,
logicName
);
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录