Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
e33032d0
提交
e33032d0
编写于
1月 29, 2021
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibiz4j 发布系统代码 [ibiz-uaa,UAA鉴权]
上级
ca9d1266
变更
21
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
566 行增加
和
236 行删除
+566
-236
app-data-upload.vue
app_web/src/components/app-data-upload/app-data-upload.vue
+8
-2
dropdown-list-mpicker.vue
...omponents/dropdown-list-mpicker/dropdown-list-mpicker.vue
+2
-2
dropdown-list.vue
app_web/src/components/dropdown-list/dropdown-list.vue
+3
-1
environment.ts
app_web/src/environments/environment.ts
+2
-0
main-form-base.vue
...eb/src/widgets/sys-user-role/main-form/main-form-base.vue
+1
-1
SysUserServiceImpl.java
.../cn/ibizlab/core/uaa/service/impl/SysUserServiceImpl.java
+0
-2
ISysUserdeleteSysUserLogic.java
...ab/core/uaa/service/logic/ISysUserdeleteSysUserLogic.java
+0
-12
ISysUsersaveSysUserLogic.java
...zlab/core/uaa/service/logic/ISysUsersaveSysUserLogic.java
+0
-12
SysUserdeleteSysUserLogicImpl.java
...uaa/service/logic/impl/SysUserdeleteSysUserLogicImpl.java
+1
-55
SysUsersaveSysUserLogicImpl.java
...e/uaa/service/logic/impl/SysUsersaveSysUserLogicImpl.java
+1
-55
DroolsAutoConfiguration.java
.../cn/ibizlab/core/util/config/DroolsAutoConfiguration.java
+6
-89
h2_table.xml
ibzuaa-core/src/main/resources/liquibase/h2_table.xml
+1
-1
exec.bpmn
.../src/main/resources/rules/SysUser/DeleteSysUser/exec.bpmn
+15
-0
exec.bpmn
...re/src/main/resources/rules/SysUser/SaveSysUser/exec.bpmn
+15
-0
SysUserdeleteSysUserRuleFlow.bpmn
...rc/main/resources/rules/SysUserdeleteSysUserRuleFlow.bpmn
+1
-1
SysUsersaveSysUserRuleFlow.bpmn
.../src/main/resources/rules/SysUsersaveSysUserRuleFlow.bpmn
+1
-1
pom.xml
ibzuaa-dependencies/pom.xml
+11
-0
SysAuthLogResource.java
...src/main/java/cn/ibizlab/api/rest/SysAuthLogResource.java
+0
-2
pom.xml
ibzuaa-util/pom.xml
+34
-0
DELogicAspect.java
...l/src/main/java/cn/ibizlab/util/aspect/DELogicAspect.java
+445
-0
DELogic.java
...aa-util/src/main/java/cn/ibizlab/util/domain/DELogic.java
+19
-0
未找到文件。
app_web/src/components/app-data-upload/app-data-upload.vue
浏览文件 @
e33032d0
...
...
@@ -52,6 +52,7 @@ import CodeListService from "@/codelist/codelist-service";
import
EntityService
from
'@/service/entity-service'
;
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
}
from
'vue-property-decorator'
;
import
{
Environment
}
from
'@/environments/environment'
;
import
moment
from
"moment"
;
@
Component
({
})
...
...
@@ -395,11 +396,11 @@ export default class AppDataUploadView extends Vue {
let
reader
=
new
FileReader
();
reader
.
onload
=
(
e
:
any
)
=>
{
let
data
=
e
.
target
.
result
;
this
.
workBookData
=
XLSX
.
read
(
data
,
{
type
:
'binary'
});
this
.
workBookData
=
XLSX
.
read
(
data
,
{
type
:
'binary'
,
cellDates
:
true
});
let
xlsxData
=
XLSX
.
utils
.
sheet_to_json
(
this
.
workBookData
.
Sheets
[
this
.
workBookData
.
SheetNames
[
0
]]);
let
list1
=
this
.
getFirstRow
(
this
.
workBookData
);
xlsxData
=
this
.
AddXlsxData
(
xlsxData
,
list1
);
this
.
importDataArray
=
JSON
.
parse
(
JSON
.
stringify
(
xlsxData
)
);
this
.
importDataArray
=
this
.
$util
.
deepCopy
(
xlsxData
);
(
this
.
$refs
.
inputUpLoad
as
any
).
value
=
''
;
};
reader
.
readAsBinaryString
(
f
);
...
...
@@ -505,6 +506,11 @@ export default class AppDataUploadView extends Vue {
data
.
forEach
((
item
:
any
)
=>
{
let
curObject
:
any
=
{};
Object
.
keys
(
item
).
forEach
((
ele
:
any
)
=>
{
// todo XLSX读取时间为国际时间(东8区)+8H转为标准时间
if
(
item
[
ele
]
instanceof
Date
){
const
tempDate
:
Date
=
item
[
ele
];
item
[
ele
]
=
moment
(
tempDate
).
add
(
8
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
);
}
if
(
this
.
allFieldMap
.
get
(
ele
).
codelist
){
let
codelistTag
:
string
=
this
.
allFieldMap
.
get
(
ele
).
codelist
.
tag
;
let
codelistIsNumber
:
boolean
=
this
.
allFieldMap
.
get
(
ele
).
codelist
.
isnumber
;
...
...
app_web/src/components/dropdown-list-mpicker/dropdown-list-mpicker.vue
浏览文件 @
e33032d0
...
...
@@ -12,8 +12,8 @@
:filterable=
"filterable"
@
on-open-change=
"onClick"
:placeholder=
"placeholder?placeholder:$t('components.dropDownListMpicker.placeholder')"
>
<i-option
v-for=
"(item, index) in items"
:key=
"index"
:class=
"item.class"
:value=
"item.value
.toString()
"
:label=
"item.text"
>
<Checkbox
:value
=
"(currentVal.indexOf(item.value.toString()))==-1?false:
true"
>
<i-option
v-for=
"(item, index) in items"
:key=
"index"
:class=
"item.class"
:value=
"item.value
? item.value.toString():''
"
:label=
"item.text"
>
<Checkbox
:value
=
"(currentVal.indexOf(item.value ? item.value.toString() : '')) == -1 ? false :
true"
>
{{
Object
.
is
(
codelistType
,
'STATIC'
)
?
$t
(
'codelist.'
+
tag
+
'.'
+
item
.
value
)
:
item
.
text
}}
</Checkbox>
</i-option>
...
...
app_web/src/components/dropdown-list/dropdown-list.vue
浏览文件 @
e33032d0
...
...
@@ -394,7 +394,9 @@ export default class DropDownList extends Vue {
if
(
type
===
'number'
){
item
.
value
=
item
.
value
.
toString
();
}
else
{
if
(
item
.
value
.
indexOf
(
'.'
)
==
-
1
){
if
(
type
==
"null"
)
{
this
.
valueType
==
"number"
?
item
.
value
=
0
:
item
.
value
=
''
;
}
else
if
(
item
.
value
.
indexOf
(
'.'
)
==
-
1
){
item
.
value
=
parseInt
(
item
.
value
);
}
else
{
item
.
value
=
parseFloat
(
item
.
value
);
...
...
app_web/src/environments/environment.ts
浏览文件 @
e33032d0
...
...
@@ -45,6 +45,8 @@ export const Environment = {
ibizlabtUrl
:
'https://www.ibizlab.cn'
,
// ibiz论坛地址
ibizbbstUrl
:
'https://bbs.ibizlab.cn'
,
// 是否启用工作流
workflow
:
false
,
};
// 挂载外部配置文件
if
((
window
as
any
).
Environment
)
{
...
...
app_web/src/widgets/sys-user-role/main-form/main-form-base.vue
浏览文件 @
e33032d0
...
...
@@ -22,7 +22,7 @@
<i-col
v-show=
"detailsModel.sys_user_roleid.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'sys_user_roleid'
:itemRules=
"this.rules().sys_user_roleid"
class=
''
:caption=
"$t('entities.sysuserrole.main_form.details.sys_user_roleid')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.sys_user_roleid.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<app-span
name=
'sys_user_roleid'
:value=
"data.sys_user_roleid"
dataType=
"GUID"
:precision=
"0"
<app-span
name=
'sys_user_roleid'
:value=
"data.sys_user_roleid"
dataType=
"GUID"
unitName=
""
:precision=
"0"
:data=
"data"
:context=
"context"
:viewparams=
"viewparams"
:localContext =
'
{ }' :localParam ='{ }' style="">
</app-span>
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/service/impl/SysUserServiceImpl.java
浏览文件 @
e33032d0
...
...
@@ -135,7 +135,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@Transactional
public
SysUser
deleteSysUser
(
SysUser
et
)
{
deletesysuserLogic
.
execute
(
et
);
return
et
;
}
...
...
@@ -202,7 +201,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@Transactional
public
SysUser
saveSysUser
(
SysUser
et
)
{
savesysuserLogic
.
execute
(
et
);
return
et
;
}
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/service/logic/ISysUserdeleteSysUserLogic.java
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
core
.
uaa
.
service
.
logic
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.HashMap
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
/**
* 关系型数据实体[deleteSysUser] 对象
*/
public
interface
ISysUserdeleteSysUserLogic
{
void
execute
(
SysUser
et
)
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/service/logic/ISysUsersaveSysUserLogic.java
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
core
.
uaa
.
service
.
logic
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.HashMap
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
/**
* 关系型数据实体[saveSysUser] 对象
*/
public
interface
ISysUsersaveSysUserLogic
{
void
execute
(
SysUser
et
)
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/service/logic/impl/SysUserdeleteSysUserLogicImpl.java
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
core
.
uaa
.
service
.
logic
.
impl
;
import
java.util.Map
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.kie.api.runtime.KieSession
;
import
org.kie.api.runtime.KieContainer
;
import
cn.ibizlab.core.uaa.service.logic.ISysUserdeleteSysUserLogic
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
public
class
SysUserdeleteSysUserLogicImpl
{
/**
* 关系型数据实体[deleteSysUser] 对象
*/
@Slf4j
@Service
public
class
SysUserdeleteSysUserLogicImpl
implements
ISysUserdeleteSysUserLogic
{
@Autowired
private
KieContainer
kieContainer
;
@Autowired
private
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
sysuserservice
;
public
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
getSysuserService
()
{
return
this
.
sysuserservice
;
}
@Autowired
private
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
iBzSysDefaultService
;
public
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
getIBzSysDefaultService
()
{
return
this
.
iBzSysDefaultService
;
}
@Override
public
void
execute
(
SysUser
et
)
{
KieSession
kieSession
=
null
;
try
{
kieSession
=
kieContainer
.
newKieSession
();
kieSession
.
insert
(
et
);
kieSession
.
setGlobal
(
"sysuserdeletesysuserdefault"
,
et
);
kieSession
.
setGlobal
(
"sysuserservice"
,
sysuserservice
);
kieSession
.
setGlobal
(
"iBzSysSysuserDefaultService"
,
iBzSysDefaultService
);
kieSession
.
setGlobal
(
"curuser"
,
cn
.
ibizlab
.
util
.
security
.
AuthenticationUser
.
getAuthenticationUser
());
kieSession
.
startProcess
(
"cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"执行[删除用户信息]处理逻辑发生异常"
+
e
);
}
finally
{
if
(
kieSession
!=
null
)
{
kieSession
.
destroy
();
}
}
}
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/service/logic/impl/SysUsersaveSysUserLogicImpl.java
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
core
.
uaa
.
service
.
logic
.
impl
;
import
java.util.Map
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.kie.api.runtime.KieSession
;
import
org.kie.api.runtime.KieContainer
;
import
cn.ibizlab.core.uaa.service.logic.ISysUsersaveSysUserLogic
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
public
class
SysUsersaveSysUserLogicImpl
{
/**
* 关系型数据实体[saveSysUser] 对象
*/
@Slf4j
@Service
public
class
SysUsersaveSysUserLogicImpl
implements
ISysUsersaveSysUserLogic
{
@Autowired
private
KieContainer
kieContainer
;
@Autowired
private
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
sysuserservice
;
public
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
getSysuserService
()
{
return
this
.
sysuserservice
;
}
@Autowired
private
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
iBzSysDefaultService
;
public
cn
.
ibizlab
.
core
.
uaa
.
service
.
ISysUserService
getIBzSysDefaultService
()
{
return
this
.
iBzSysDefaultService
;
}
@Override
public
void
execute
(
SysUser
et
)
{
KieSession
kieSession
=
null
;
try
{
kieSession
=
kieContainer
.
newKieSession
();
kieSession
.
insert
(
et
);
kieSession
.
setGlobal
(
"sysusersavesysuserdefault"
,
et
);
kieSession
.
setGlobal
(
"sysuserservice"
,
sysuserservice
);
kieSession
.
setGlobal
(
"iBzSysSysuserDefaultService"
,
iBzSysDefaultService
);
kieSession
.
setGlobal
(
"curuser"
,
cn
.
ibizlab
.
util
.
security
.
AuthenticationUser
.
getAuthenticationUser
());
kieSession
.
startProcess
(
"cn.ibizlab.core.uaa.service.logic.sysusersavesysuser"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"执行[保存用户信息]处理逻辑发生异常"
+
e
);
}
finally
{
if
(
kieSession
!=
null
)
{
kieSession
.
destroy
();
}
}
}
}
ibzuaa-core/src/main/java/cn/ibizlab/core/util/config/DroolsAutoConfiguration.java
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
core
.
util
.
config
;
import
org.kie.api.KieBase
;
import
org.kie.api.KieServices
;
import
org.kie.api.builder.
*
;
import
org.kie.api.builder.
KieFileSystem
;
import
org.kie.api.runtime.KieContainer
;
import
org.kie.api.runtime.KieSession
;
import
org.kie.internal.io.ResourceFactory
;
import
org.kie.spring.KModuleBeanFactoryPostProcessor
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
java.io.IOException
;
import
java.util.List
;
@Configuration
public
class
DroolsAutoConfiguration
{
private
Log
logger
=
LogFactory
.
getLog
(
DroolsAutoConfiguration
.
class
);
private
static
final
String
RULES_PATH
=
"rules/"
;
@Bean
@ConditionalOnMissingBean
(
KieFileSystem
.
class
)
public
KieFileSystem
kieFileSystem
()
throws
IOException
{
KieFileSystem
kieFileSystem
=
getKieServices
().
newKieFileSystem
();
for
(
Resource
file
:
getRuleFiles
())
{
kieFileSystem
.
write
(
ResourceFactory
.
newUrlResource
(
file
.
getURL
()));
}
return
kieFileSystem
;
}
private
Resource
[]
getRuleFiles
()
throws
IOException
{
ResourcePatternResolver
resourcePatternResolver
=
new
PathMatchingResourcePatternResolver
();
return
resourcePatternResolver
.
getResources
(
"classpath*:"
+
RULES_PATH
+
"**/*.*"
);
}
@Bean
@ConditionalOnMissingBean
(
KieContainer
.
class
)
public
KieContainer
kieContainer
()
throws
IOException
{
final
KieRepository
kieRepository
=
getKieServices
().
getRepository
();
kieRepository
.
addKieModule
(
new
KieModule
()
{
public
ReleaseId
getReleaseId
()
{
return
kieRepository
.
getDefaultReleaseId
();
}
});
KieBuilder
kieBuilder
=
getKieServices
().
newKieBuilder
(
kieFileSystem
());
kieBuilder
.
buildAll
();
if
(
kieBuilder
.
getResults
().
hasMessages
(
new
Message
.
Level
[]
{
Message
.
Level
.
ERROR
})){
List
<
Message
>
errors
=
kieBuilder
.
getResults
().
getMessages
(
new
Message
.
Level
[]
{
Message
.
Level
.
ERROR
});
StringBuilder
stringBuilder
=
new
StringBuilder
(
"Errors:"
);
for
(
Message
msg
:
errors
)
{
stringBuilder
.
append
(
new
StringBuilder
().
append
(
"\n "
).
append
(
prettyBuildMessage
(
msg
)).
toString
());
}
logger
.
error
(
String
.
format
(
"初始化处理逻辑发生异常,异常原因为[%s]"
,
stringBuilder
.
toString
()));
//忽略处理逻辑
getKieServices
().
newKieBuilder
(
getKieServices
().
newKieFileSystem
()).
buildAll
();
}
return
getKieServices
().
newKieContainer
(
kieRepository
.
getDefaultReleaseId
());
}
private
KieServices
getKieServices
()
{
return
KieServices
.
Factory
.
get
();
}
@Bean
@ConditionalOnMissingBean
(
KieBase
.
class
)
public
KieBase
kieBase
()
throws
IOException
{
return
kieContainer
().
getKieBase
();
}
@Bean
@ConditionalOnMissingBean
(
KieSession
.
class
)
public
KieSession
kieSession
()
throws
IOException
{
return
kieContainer
().
newKieSession
();
}
@Bean
@ConditionalOnMissingBean
(
KModuleBeanFactoryPostProcessor
.
class
)
public
KModuleBeanFactoryPostProcessor
kiePostProcessor
()
{
return
new
KModuleBeanFactoryPostProcessor
();
}
/**
* 输出异常信息
* @param msg
* @return
*/
public
static
String
prettyBuildMessage
(
Message
msg
)
{
return
new
StringBuilder
().
append
(
"Message: {id="
).
append
(
msg
.
getId
()).
append
(
", level="
).
append
(
msg
.
getLevel
()).
append
(
", path="
).
append
(
msg
.
getPath
()).
append
(
", line="
).
append
(
msg
.
getLine
())
.
append
(
", column="
).
append
(
msg
.
getColumn
()).
append
(
", text=\""
).
append
(
msg
.
getText
()).
append
(
"\"}"
).
toString
();
public
KieContainer
kieContainer
()
{
KieServices
kieServices
=
KieServices
.
get
();
KieFileSystem
kieFileSystem
=
kieServices
.
newKieFileSystem
();
kieServices
.
newKieBuilder
(
kieFileSystem
).
buildAll
();
return
kieServices
.
newKieContainer
(
kieServices
.
getRepository
().
getDefaultReleaseId
());
}
}
\ No newline at end of file
ibzuaa-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
e33032d0
...
...
@@ -6,7 +6,7 @@
<!--输出实体[SYS_AUTHLOG]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_authlog-
3
-1"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_authlog-
6
-1"
>
<createTable
tableName=
"IBZAUTHLOG"
>
<column
name=
"LOGID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_AUTHLOG_LOGID"
/>
...
...
ibzuaa-core/src/main/resources/rules/SysUser/DeleteSysUser/exec.bpmn
0 → 100644
浏览文件 @
e33032d0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:di=
"http://www.omg.org/spec/DD/20100524/DI"
xmlns:g=
"http://www.jboss.org/drools/flow/gpd"
xmlns:tns=
"http://www.jboss.org/drools"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
expressionLanguage=
"http://www.mvel.org/2.0"
id=
"Definition"
name=
""
targetNamespace=
"http://www.jboss.org/drools"
typeLanguage=
"http://www.java.com/javaTypes"
>
<process
id=
"cn.ibizlab.core.extensions.service.logic.execute"
isClosed=
"false"
isExecutable=
"true"
name=
"uaa_sysuser_deletesysuser.execLogic"
processType=
"Private"
tns:packageName=
"cn.ibizlab.core.extensions.service.logic.execute"
>
<extensionElements>
<tns:import
name=
"java.util.Map"
/>
<tns:import
name=
"org.springframework.util.StringUtils"
/>
<tns:import
name=
"cn.ibizlab.util.helper.RuleUtils"
/>
</extensionElements>
<startEvent
id=
"begin"
isInterrupting=
"true"
/>
<endEvent
id=
"prepareparam1_end"
name=
"end"
/>
<callActivity
activiti:exclusive=
"true"
calledElement=
"cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser"
id=
"deleteSysUser"
name=
"SysUserdeleteSysUserRuleFlow.bpmn"
/>
<sequenceFlow
id=
"begin_deleteSysUser"
sourceRef=
"begin"
targetRef=
"deleteSysUser"
/>
<sequenceFlow
id=
"deleteSysUser_deleteSysUser"
sourceRef=
"deleteSysUser"
targetRef=
"prepareparam1_end"
/>
</process>
</definitions>
ibzuaa-core/src/main/resources/rules/SysUser/SaveSysUser/exec.bpmn
0 → 100644
浏览文件 @
e33032d0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:di=
"http://www.omg.org/spec/DD/20100524/DI"
xmlns:g=
"http://www.jboss.org/drools/flow/gpd"
xmlns:tns=
"http://www.jboss.org/drools"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
expressionLanguage=
"http://www.mvel.org/2.0"
id=
"Definition"
name=
""
targetNamespace=
"http://www.jboss.org/drools"
typeLanguage=
"http://www.java.com/javaTypes"
>
<process
id=
"cn.ibizlab.core.extensions.service.logic.execute"
isClosed=
"false"
isExecutable=
"true"
name=
"uaa_sysuser_savesysuser.execLogic"
processType=
"Private"
tns:packageName=
"cn.ibizlab.core.extensions.service.logic.execute"
>
<extensionElements>
<tns:import
name=
"java.util.Map"
/>
<tns:import
name=
"org.springframework.util.StringUtils"
/>
<tns:import
name=
"cn.ibizlab.util.helper.RuleUtils"
/>
</extensionElements>
<startEvent
id=
"begin"
isInterrupting=
"true"
/>
<endEvent
id=
"prepareparam1_end"
name=
"end"
/>
<callActivity
activiti:exclusive=
"true"
calledElement=
"cn.ibizlab.core.uaa.service.logic.sysusersavesysuser"
id=
"saveSysUser"
name=
"SysUsersaveSysUserRuleFlow.bpmn"
/>
<sequenceFlow
id=
"begin_saveSysUser"
sourceRef=
"begin"
targetRef=
"saveSysUser"
/>
<sequenceFlow
id=
"saveSysUser_saveSysUser"
sourceRef=
"saveSysUser"
targetRef=
"prepareparam1_end"
/>
</process>
</definitions>
ibzuaa-core/src/main/resources/rules/SysUserdeleteSysUserRuleFlow.bpmn
浏览文件 @
e33032d0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:di=
"http://www.omg.org/spec/DD/20100524/DI"
xmlns:g=
"http://www.jboss.org/drools/flow/gpd"
xmlns:tns=
"http://www.jboss.org/drools"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
expressionLanguage=
"http://www.mvel.org/2.0"
id=
"Definition"
name=
""
targetNamespace=
"http://www.jboss.org/drools"
typeLanguage=
"http://www.java.com/javaTypes"
>
<process
id=
"cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser"
isClosed=
"false"
isExecutable=
"true"
name=
"
ScoreRule
"
processType=
"Private"
tns:packageName=
"cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser"
>
<process
id=
"cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser"
isClosed=
"false"
isExecutable=
"true"
name=
"
uaa_sysuser_deletesysuser_RuleFlow
"
processType=
"Private"
tns:packageName=
"cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser"
>
<extensionElements>
<tns:import
name=
"java.util.Map"
/>
<tns:import
name=
"org.springframework.util.StringUtils"
/>
...
...
ibzuaa-core/src/main/resources/rules/SysUsersaveSysUserRuleFlow.bpmn
浏览文件 @
e33032d0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:di=
"http://www.omg.org/spec/DD/20100524/DI"
xmlns:g=
"http://www.jboss.org/drools/flow/gpd"
xmlns:tns=
"http://www.jboss.org/drools"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
expressionLanguage=
"http://www.mvel.org/2.0"
id=
"Definition"
name=
""
targetNamespace=
"http://www.jboss.org/drools"
typeLanguage=
"http://www.java.com/javaTypes"
>
<process
id=
"cn.ibizlab.core.uaa.service.logic.sysusersavesysuser"
isClosed=
"false"
isExecutable=
"true"
name=
"
ScoreRule
"
processType=
"Private"
tns:packageName=
"cn.ibizlab.core.uaa.service.logic.sysusersavesysuser"
>
<process
id=
"cn.ibizlab.core.uaa.service.logic.sysusersavesysuser"
isClosed=
"false"
isExecutable=
"true"
name=
"
uaa_sysuser_savesysuser_RuleFlow
"
processType=
"Private"
tns:packageName=
"cn.ibizlab.core.uaa.service.logic.sysusersavesysuser"
>
<extensionElements>
<tns:import
name=
"java.util.Map"
/>
<tns:import
name=
"org.springframework.util.StringUtils"
/>
...
...
ibzuaa-dependencies/pom.xml
浏览文件 @
e33032d0
...
...
@@ -86,6 +86,7 @@
<oracle.version>
19.8.0.0
</oracle.version>
<postgresql.version>
42.2.6
</postgresql.version>
<rocketmq.version>
4.7.0
</rocketmq.version>
<flowable-modeler.version>
6.4.2
</flowable-modeler.version>
</properties>
<dependencyManagement>
...
...
@@ -262,6 +263,16 @@
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-json-converter
</artifactId>
<version>
${flowable-modeler.version}
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-ui-modeler-conf
</artifactId>
<version>
${flowable-modeler.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SysAuthLogResource.java
浏览文件 @
e33032d0
...
...
@@ -47,7 +47,6 @@ public class SysAuthLogResource {
@Lazy
public
SysAuthLogMapping
sysauthlogMapping
;
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysAuthLog-Create-all')"
)
@ApiOperation
(
value
=
"新建认证日志"
,
tags
=
{
"认证日志"
},
notes
=
"新建认证日志"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/sysauthlogs"
)
public
ResponseEntity
<
SysAuthLogDTO
>
create
(
@Validated
@RequestBody
SysAuthLogDTO
sysauthlogdto
)
{
...
...
@@ -57,7 +56,6 @@ public class SysAuthLogResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysAuthLog-Create-all')"
)
@ApiOperation
(
value
=
"批量新建认证日志"
,
tags
=
{
"认证日志"
},
notes
=
"批量新建认证日志"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/sysauthlogs/batch"
)
public
ResponseEntity
<
Boolean
>
createBatch
(
@RequestBody
List
<
SysAuthLogDTO
>
sysauthlogdtos
)
{
...
...
ibzuaa-util/pom.xml
浏览文件 @
e33032d0
...
...
@@ -90,5 +90,39 @@
<artifactId>
feign-httpclient
</artifactId>
</dependency>
<!-- drools -->
<dependency>
<groupId>
org.drools
</groupId>
<artifactId>
drools-compiler
</artifactId>
</dependency>
<dependency>
<groupId>
org.drools
</groupId>
<artifactId>
drools-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.kie
</groupId>
<artifactId>
kie-spring
</artifactId>
</dependency>
<dependency>
<groupId>
org.kie
</groupId>
<artifactId>
kie-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-json-converter
</artifactId>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-ui-modeler-conf
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-slf4j-impl
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
ibzuaa-util/src/main/java/cn/ibizlab/util/aspect/DELogicAspect.java
0 → 100644
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
util
.
aspect
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
cn.ibizlab.util.domain.DELogic
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.helper.DEFieldCacheMap
;
import
org.apache.commons.io.IOUtils
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.flowable.bpmn.converter.BpmnXMLConverter
;
import
org.flowable.bpmn.model.*
;
import
org.flowable.bpmn.model.Process
;
import
org.kie.api.KieServices
;
import
org.kie.api.builder.KieBuilder
;
import
org.kie.api.builder.KieFileSystem
;
import
org.kie.api.builder.Message
;
import
org.kie.api.builder.Results
;
import
org.kie.api.runtime.KieContainer
;
import
org.kie.api.runtime.KieSession
;
import
org.kie.internal.io.ResourceFactory
;
import
org.springframework.expression.EvaluationContext
;
import
org.springframework.expression.Expression
;
import
org.springframework.expression.ExpressionParser
;
import
org.springframework.expression.spel.standard.SpelExpressionParser
;
import
org.springframework.expression.spel.support.StandardEvaluationContext
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
javax.xml.stream.XMLInputFactory
;
import
javax.xml.stream.XMLStreamReader
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.lang.reflect.Method
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
/**
* 实体处理逻辑切面(前后附加逻辑、实体行为调用处理逻辑)
*/
@Aspect
@Component
@Slf4j
public
class
DELogicAspect
{
private
static
BpmnXMLConverter
bpmnXMLConverter
=
new
BpmnXMLConverter
();
private
final
ExpressionParser
parser
=
new
SpelExpressionParser
();
private
ConcurrentMap
<
String
,
DELogic
>
deLogicMap
=
new
ConcurrentHashMap
<>();
private
static
Map
<
String
,
Object
>
validLogic
=
new
HashMap
<>();
/**
* 执行实体行为附加逻辑、实体行为调用处理逻辑
*
* @param point
* @return
* @throws Throwable
*/
@Around
(
"execution(* cn.ibizlab.core.*.service.*.*(..))"
)
public
Object
executeLogic
(
ProceedingJoinPoint
point
)
throws
Throwable
{
Object
args
[]
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
return
point
.
proceed
();
}
Object
service
=
point
.
getTarget
();
Object
arg
=
args
[
0
];
String
action
=
point
.
getSignature
().
getName
();
EntityBase
entity
=
null
;
if
(
"remove"
.
equalsIgnoreCase
(
action
)
||
"get"
.
equalsIgnoreCase
(
action
))
{
entity
=
getEntity
(
service
);
String
id
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
if
(
StringUtils
.
isEmpty
(
id
))
{
log
.
debug
(
"无法获取实体主键属性[{}]"
,
entity
.
getClass
().
getSimpleName
());
return
point
.
proceed
();
}
entity
.
set
(
id
,
arg
);
}
else
if
(
arg
instanceof
EntityBase
)
{
entity
=
(
EntityBase
)
arg
;
}
if
(
entity
!=
null
)
{
executeBeforeLogic
(
entity
,
action
);
Object
result
=
point
.
proceed
();
executeLogic
(
entity
,
action
);
executeAfterLogic
(
entity
,
action
);
return
result
;
}
return
point
.
proceed
();
}
/**
* 前附加逻辑
*
* @param entity
* @param action
*/
private
void
executeBeforeLogic
(
EntityBase
entity
,
String
action
)
{
File
bpmnFile
=
getLocalModel
(
entity
.
getClass
().
getSimpleName
(),
action
,
LogicExecMode
.
BEFORE
);
if
(
bpmnFile
!=
null
&&
bpmnFile
.
exists
()
&&
isValid
(
bpmnFile
,
entity
,
action
))
{
executeLogic
(
bpmnFile
,
entity
,
action
);
}
}
/**
* 后附加逻辑
*
* @param entity
* @param action
*/
private
void
executeAfterLogic
(
EntityBase
entity
,
String
action
)
{
File
bpmnFile
=
getLocalModel
(
entity
.
getClass
().
getSimpleName
(),
action
,
LogicExecMode
.
AFTER
);
if
(
bpmnFile
!=
null
&&
bpmnFile
.
exists
()
&&
isValid
(
bpmnFile
,
entity
,
action
))
{
executeLogic
(
bpmnFile
,
entity
,
action
);
}
}
/**
* 实体行为调用处理逻辑
*
* @param entity
* @param action
*/
private
void
executeLogic
(
EntityBase
entity
,
String
action
)
{
File
bpmnFile
=
getLocalModel
(
entity
.
getClass
().
getSimpleName
(),
action
,
LogicExecMode
.
EXEC
);
if
(
bpmnFile
!=
null
&&
bpmnFile
.
exists
()
&&
isValid
(
bpmnFile
,
entity
,
action
))
{
executeLogic
(
bpmnFile
,
entity
,
action
);
}
}
/**
* 编译并执行规则(bpmn、drl)
*
* @param bpmnFile
* @param entity
*/
private
void
executeLogic
(
File
bpmnFile
,
Object
entity
,
String
action
)
{
log
.
debug
(
"开始执行实体处理逻辑[{}:{}:{}:本地模式]"
,
entity
.
getClass
().
getSimpleName
(),
action
,
bpmnFile
.
getName
());
String
bpmnId
=
DigestUtils
.
md5DigestAsHex
(
bpmnFile
.
getPath
().
getBytes
());
DELogic
logic
=
getDELogic
(
bpmnFile
);
if
(
logic
==
null
)
{
return
;
}
if
(
deLogicMap
.
containsKey
(
bpmnId
)
&&
logic
.
getMd5
().
equals
(
deLogicMap
.
get
(
bpmnId
).
getMd5
()))
{
logic
=
deLogicMap
.
get
(
bpmnId
);
}
else
{
reloadLogic
(
logic
);
deLogicMap
.
put
(
bpmnId
,
logic
);
}
KieContainer
container
=
logic
.
getContainer
();
KieSession
kieSession
=
container
.
getKieBase
().
newKieSession
();
Process
mainProcess
=
logic
.
getProcess
();
//主流程参数
fillGlobalParam
(
kieSession
,
mainProcess
,
entity
);
//子流程参数
if
(!
ObjectUtils
.
isEmpty
(
logic
.
getRefLogic
()))
{
for
(
DELogic
subLogic
:
logic
.
getRefLogic
())
{
fillGlobalParam
(
kieSession
,
subLogic
.
getProcess
(),
entity
);
}
}
kieSession
.
startProcess
(
mainProcess
.
getId
());
log
.
debug
(
"实体处理逻辑[{}:{}:{}:本地模式]执行结束"
,
entity
.
getClass
().
getSimpleName
(),
action
,
bpmnFile
.
getName
());
}
/**
* 编译规则
*
* @param logic
*/
private
void
reloadLogic
(
DELogic
logic
)
{
KieServices
kieServices
=
KieServices
.
get
();
KieFileSystem
kieFileSystem
=
kieServices
.
newKieFileSystem
();
for
(
File
bpmn
:
logic
.
getRefRuleFiles
())
{
kieFileSystem
.
write
(
ResourceFactory
.
newFileResource
(
bpmn
));
}
KieBuilder
kieBuilder
=
kieServices
.
newKieBuilder
(
kieFileSystem
).
buildAll
();
Results
results
=
kieBuilder
.
getResults
();
if
(
results
.
hasMessages
(
Message
.
Level
.
ERROR
))
{
throw
new
BadRequestAlertException
(
String
.
format
(
"编译实体处理逻辑 [%s] 发生异常, %s"
,
logic
.
getName
(),
results
.
getMessages
()),
"LogicAspect"
,
"reloadLogic"
);
}
KieContainer
kieContainer
=
kieServices
.
newKieContainer
(
kieServices
.
getRepository
().
getDefaultReleaseId
());
logic
.
setContainer
(
kieContainer
);
}
/**
* 填充逻辑参数
*
* @param kieSession
* @param process
* @param entity
*/
private
void
fillGlobalParam
(
KieSession
kieSession
,
Process
process
,
Object
entity
)
{
Map
<
String
,
List
<
ExtensionElement
>>
params
=
process
.
getExtensionElements
();
for
(
Map
.
Entry
<
String
,
List
<
ExtensionElement
>>
param
:
params
.
entrySet
())
{
if
(
"metaData"
.
equalsIgnoreCase
(
param
.
getKey
()))
{
List
<
ExtensionElement
>
globalParams
=
param
.
getValue
();
for
(
ExtensionElement
globalParam
:
globalParams
)
{
Object
value
=
null
;
Map
<
String
,
List
<
ExtensionAttribute
>>
globalParamAttr
=
globalParam
.
getAttributes
();
if
(
globalParamAttr
.
containsKey
(
"name"
)
&&
globalParamAttr
.
containsKey
(
"type"
)
&&
globalParamAttr
.
containsKey
(
"express"
))
{
ExtensionAttribute
name
=
globalParamAttr
.
get
(
"name"
).
get
(
0
);
ExtensionAttribute
type
=
globalParamAttr
.
get
(
"type"
).
get
(
0
);
ExtensionAttribute
express
=
globalParamAttr
.
get
(
"express"
).
get
(
0
);
String
express_value
=
express
.
getValue
();
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
if
(
"entity"
.
equalsIgnoreCase
(
type
.
getValue
()))
{
value
=
entity
;
}
if
(!
ObjectUtils
.
isEmpty
(
type
.
getValue
())
&&
ObjectUtils
.
isEmpty
(
value
))
{
Expression
oldExp
=
parser
.
parseExpression
(
express_value
);
value
=
oldExp
.
getValue
(
oldContext
);
}
if
(
"entity"
.
equalsIgnoreCase
(
type
.
getValue
())
||
"refentity"
.
equalsIgnoreCase
(
type
.
getValue
()))
{
kieSession
.
insert
(
value
);
}
kieSession
.
setGlobal
(
name
.
getValue
(),
value
);
}
}
}
}
}
/**
* 获取逻辑配置
*
* @param bpmnFile
* @return
*/
@SneakyThrows
private
DELogic
getDELogic
(
File
bpmnFile
)
{
DELogic
logic
=
null
;
XMLStreamReader
reader
=
null
;
InputStream
bpmn
=
null
;
try
{
if
(
bpmnFile
.
exists
())
{
XMLInputFactory
factory
=
XMLInputFactory
.
newInstance
();
bpmn
=
new
FileInputStream
(
bpmnFile
);
reader
=
factory
.
createXMLStreamReader
(
bpmn
);
BpmnModel
model
=
bpmnXMLConverter
.
convertToBpmnModel
(
reader
);
Process
mainProcess
=
model
.
getMainProcess
();
if
(
mainProcess
==
null
)
{
return
null
;
}
List
<
DELogic
>
refLogics
=
new
ArrayList
<>();
List
<
File
>
refFiles
=
new
ArrayList
<>();
//自己 bpmn 及 drl
refFiles
.
add
(
bpmnFile
);
File
drlFile
=
getDrl
(
bpmnFile
);
if
(
drlFile
.
exists
())
{
refFiles
.
add
(
drlFile
);
}
//子 bpmn 及 drl
if
(!
ObjectUtils
.
isEmpty
(
model
.
getMainProcess
())
&&
!
ObjectUtils
.
isEmpty
(
model
.
getMainProcess
().
getFlowElementMap
()))
{
model
.
getMainProcess
().
getFlowElementMap
().
values
().
forEach
(
item
->
{
if
(
item
instanceof
CallActivity
)
{
CallActivity
subBpmn
=
(
CallActivity
)
item
;
String
bpmnFileName
=
subBpmn
.
getName
();
log
.
debug
(
"正在加载 BPMN:{}"
,
bpmnFileName
);
File
subBpmnFile
=
getSubBpmn
(
bpmnFileName
);
if
(
ObjectUtils
.
isEmpty
(
subBpmnFile
))
{
log
.
debug
(
"BPMN:{},缺少文件:{} "
,
bpmnFileName
,
subBpmnFile
);
}
DELogic
refLogic
=
getDELogic
(
subBpmnFile
);
if
(
refLogic
!=
null
)
{
refLogics
.
add
(
refLogic
);
if
(!
ObjectUtils
.
isEmpty
(
refLogic
.
getRefRuleFiles
()))
{
refFiles
.
addAll
(
refLogic
.
getRefRuleFiles
());
}
}
}
});
}
logic
=
new
DELogic
();
logic
.
setId
(
mainProcess
.
getId
());
logic
.
setName
(
mainProcess
.
getName
());
logic
.
setProcess
(
mainProcess
);
logic
.
setRefLogic
(
refLogics
);
logic
.
setRefRuleFiles
(
refFiles
);
logic
.
setMd5
(
getMd5
(
refFiles
));
}
}
catch
(
Exception
e
)
{
}
finally
{
try
{
if
(
reader
!=
null
)
{
reader
.
close
();
}
if
(
bpmn
!=
null
)
{
bpmn
.
close
();
}
}
catch
(
Exception
e
)
{
}
}
return
logic
;
}
/**
* 获取实体
*
* @param service
* @return
* @throws Exception
*/
private
EntityBase
getEntity
(
Object
service
)
throws
Exception
{
Method
[]
methods
=
service
.
getClass
().
getDeclaredMethods
();
for
(
Method
method
:
methods
)
{
for
(
Class
cls
:
method
.
getParameterTypes
())
{
try
{
Object
arg
=
cls
.
newInstance
();
if
(
arg
instanceof
EntityBase
)
{
return
(
EntityBase
)
arg
;
}
}
catch
(
InstantiationException
e
)
{
}
}
}
throw
new
BadRequestAlertException
(
"获取实体信息失败"
,
"DELogicAspect"
,
"getEntity"
);
}
/**
* 获取bpmn md5
*
* @param subFiles
* @return
*/
private
String
getMd5
(
List
<
File
>
subFiles
)
{
try
{
StringBuffer
buffer
=
new
StringBuffer
();
for
(
File
file
:
subFiles
)
{
InputStream
bpmnFile
=
null
;
try
{
bpmnFile
=
new
FileInputStream
(
file
);
if
(!
ObjectUtils
.
isEmpty
(
bpmnFile
))
{
String
strBpmn
=
IOUtils
.
toString
(
bpmnFile
,
"UTF-8"
);
buffer
.
append
(
strBpmn
);
}
}
catch
(
Exception
e
)
{
}
finally
{
if
(
bpmnFile
!=
null
)
{
bpmnFile
.
close
();
}
}
}
if
(!
StringUtils
.
isEmpty
(
buffer
.
toString
()))
{
return
DigestUtils
.
md5DigestAsHex
(
buffer
.
toString
().
getBytes
());
}
else
{
return
null
;
}
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* 本地逻辑
*
* @param entity
* @param action
* @param logicExecMode
* @return
*/
private
File
getLocalModel
(
String
entity
,
String
action
,
LogicExecMode
logicExecMode
)
{
String
logicName
=
String
.
format
(
"%s.bpmn"
,
logicExecMode
.
text
);
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
());
}
/**
* 处理逻辑 bpmn
*
* @param logicName
* @return
*/
private
File
getSubBpmn
(
String
logicName
)
{
String
filePath
=
String
.
format
(
"/rules/%s"
,
logicName
);
return
ObjectUtils
.
isEmpty
(
this
.
getClass
().
getResource
(
filePath
))
?
null
:
new
File
(
this
.
getClass
().
getResource
(
filePath
).
getPath
());
}
/**
* 处理逻辑 drl
*
* @param bpmn
* @return
*/
private
File
getDrl
(
File
bpmn
)
{
if
(
bpmn
.
getPath
().
endsWith
(
"RuleFlow.bpmn"
))
{
return
new
File
(
bpmn
.
getPath
().
replace
(
"RuleFlow.bpmn"
,
"Rule.drl"
));
}
else
{
return
new
File
(
bpmn
.
getPath
().
replace
(
".bpmn"
,
".drl"
));
}
}
/**
* 逻辑是否有效
*
* @param bpmn
* @param entity
* @param action
* @return
*/
private
boolean
isValid
(
File
bpmn
,
Object
entity
,
Object
action
)
{
String
logicId
=
String
.
format
(
"%s%s%s"
,
entity
.
getClass
().
getSimpleName
(),
action
,
bpmn
.
getName
()).
toLowerCase
();
if
(
validLogic
.
containsKey
(
logicId
))
{
return
true
;
}
else
{
return
false
;
}
}
static
{
validLogic
.
put
(
"sysuserdeletesysuserexec.bpmn"
,
1
);
validLogic
.
put
(
"sysusersavesysuserexec.bpmn"
,
1
);
}
public
enum
LogicExecMode
{
/**
* 前附加逻辑
*/
BEFORE
(
"0"
,
"before"
),
/**
* 后附加逻辑
*/
AFTER
(
"1"
,
"after"
),
/**
*
*/
EXEC
(
"2"
,
"exec"
);
LogicExecMode
(
String
value
,
String
text
)
{
this
.
value
=
value
;
this
.
text
=
text
;
}
private
String
value
;
private
String
text
;
}
}
ibzuaa-util/src/main/java/cn/ibizlab/util/domain/DELogic.java
0 → 100644
浏览文件 @
e33032d0
package
cn
.
ibizlab
.
util
.
domain
;
import
lombok.Data
;
import
org.flowable.bpmn.model.Process
;
import
org.kie.api.runtime.KieContainer
;
import
java.io.File
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
DELogic
implements
Serializable
{
String
id
;
String
name
;
Process
process
;
KieContainer
container
;
List
<
DELogic
>
refLogic
;
List
<
File
>
refRuleFiles
;
String
md5
;
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录