Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
f37d3656
提交
f37d3656
编写于
6月 24, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
job部署bpmn
上级
ae5cc094
变更
3
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
82 行增加
和
13 行删除
+82
-13
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+75
-13
apiSecurityConfig.java
...rc/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
+1
-0
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+6
-0
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
f37d3656
...
@@ -12,6 +12,7 @@ import cn.ibizlab.util.security.AuthenticationUser;
...
@@ -12,6 +12,7 @@ import cn.ibizlab.util.security.AuthenticationUser;
import
cn.ibizlab.util.service.RemoteService
;
import
cn.ibizlab.util.service.RemoteService
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.IOUtils
;
import
org.flowable.bpmn.BpmnAutoLayout
;
import
org.flowable.bpmn.BpmnAutoLayout
;
import
org.flowable.bpmn.converter.BpmnXMLConverter
;
import
org.flowable.bpmn.converter.BpmnXMLConverter
;
import
org.flowable.bpmn.model.*
;
import
org.flowable.bpmn.model.*
;
...
@@ -505,23 +506,68 @@ public class WFCoreService
...
@@ -505,23 +506,68 @@ public class WFCoreService
protected
BpmnXMLConverter
bpmnXMLConverter
=
new
BpmnXMLConverter
();
protected
BpmnXMLConverter
bpmnXMLConverter
=
new
BpmnXMLConverter
();
protected
BpmnJsonConverter
bpmnJsonConverter
=
new
BpmnJsonConverter
();
protected
BpmnJsonConverter
bpmnJsonConverter
=
new
BpmnJsonConverter
();
public
synchronized
boolean
wfdeploybpmns
(
List
bpmnfiles
){
if
(
bpmnfiles
.
size
()>
0
){
bpmnfiles
.
forEach
(
item
->{
Map
<
String
,
Object
>
bpmnfile
=
(
Map
)
item
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bpmnfile
.
entrySet
())
{
InputStream
in
=
null
;
try
{
in
=
IOUtils
.
toInputStream
(
String
.
valueOf
(
entry
.
getValue
()),
"utf8"
);
wfdeploy
(
entry
.
getKey
(),
getBpmnFile
(
in
),
new
WFREModel
());
}
catch
(
IOException
e
)
{}
finally
{
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
IOException
e
)
{}
}
}
}
}
);
}
return
true
;
}
public
synchronized
boolean
wfdeploy
(
File
bpmnFile
,
WFREModel
wfreModel
)
public
synchronized
boolean
wfdeploy
(
File
bpmnFile
,
WFREModel
wfreModel
)
{
InputStream
in
=
null
;
try
{
in
=
new
FileInputStream
(
bpmnFile
);
return
wfdeploy
(
bpmnFile
.
getName
(),
getBpmnFile
(
in
),
wfreModel
);
}
catch
(
IOException
e
)
{}
finally
{
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
IOException
e
)
{}
}
}
return
false
;
}
public
synchronized
boolean
wfdeploy
(
String
bpmnFileName
,
ByteArrayOutputStream
bpmnFile
,
WFREModel
wfreModel
)
{
{
String
deployInfo
=
""
;
String
deployInfo
=
""
;
if
(
bpmnFile
==
null
){
log
.
error
(
String
.
format
(
"解析失败,无法获取流程文件[%s]"
,
bpmnFileName
));
deployInfo
+=
String
.
format
(
"解析失败,无法获取流程文件[%s] \r\n"
,
bpmnFileName
);
wfreModel
.
setName
(
deployInfo
);
return
false
;
}
if
(!
StringUtils
.
isEmpty
(
wfreModel
.
getName
()))
if
(!
StringUtils
.
isEmpty
(
wfreModel
.
getName
()))
deployInfo
=
wfreModel
.
getName
();
deployInfo
=
wfreModel
.
getName
();
XMLStreamReader
reader
=
null
;
XMLStreamReader
reader
=
null
;
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
try
{
try
{
XMLInputFactory
factory
=
XMLInputFactory
.
newInstance
();
XMLInputFactory
factory
=
XMLInputFactory
.
newInstance
();
inputStream
=
new
FileInputStream
(
bpmnFile
);
inputStream
=
new
ByteArrayInputStream
(
bpmnFile
.
toByteArray
()
);
reader
=
factory
.
createXMLStreamReader
(
inputStream
);
reader
=
factory
.
createXMLStreamReader
(
inputStream
);
BpmnModel
model
=
bpmnXMLConverter
.
convertToBpmnModel
(
reader
);
BpmnModel
model
=
bpmnXMLConverter
.
convertToBpmnModel
(
reader
);
List
<
Process
>
processes
=
model
.
getProcesses
();
List
<
Process
>
processes
=
model
.
getProcesses
();
Process
curProcess
=
null
;
Process
curProcess
=
null
;
if
(
CollectionUtils
.
isEmpty
(
processes
))
{
if
(
CollectionUtils
.
isEmpty
(
processes
))
{
deployInfo
+=
bpmnFile
.
getName
()
+
"解析失败,没有找到流程配置信息"
+
"\r\n"
;
deployInfo
+=
bpmnFile
Name
+
"解析失败,没有找到流程配置信息"
+
"\r\n"
;
wfreModel
.
setName
(
deployInfo
);
wfreModel
.
setName
(
deployInfo
);
return
false
;
return
false
;
}
}
...
@@ -530,8 +576,8 @@ public class WFCoreService
...
@@ -530,8 +576,8 @@ public class WFCoreService
String
refgroups
=
""
;
String
refgroups
=
""
;
if
(!
curProcess
.
getExtensionElements
().
containsKey
(
"field"
))
if
(!
curProcess
.
getExtensionElements
().
containsKey
(
"field"
))
{
{
log
.
error
(
bpmnFile
.
getName
()
+
"没有实体订阅"
);
log
.
error
(
bpmnFile
Name
+
"没有实体订阅"
);
deployInfo
+=
bpmnFile
.
getName
()
+
"解析失败,没有实体订阅配置"
+
"\r\n"
;
deployInfo
+=
bpmnFile
Name
+
"解析失败,没有实体订阅配置"
+
"\r\n"
;
wfreModel
.
setName
(
deployInfo
);
wfreModel
.
setName
(
deployInfo
);
return
false
;
return
false
;
}
}
...
@@ -544,8 +590,8 @@ public class WFCoreService
...
@@ -544,8 +590,8 @@ public class WFCoreService
}
}
if
(
StringUtils
.
isEmpty
(
bookings
))
if
(
StringUtils
.
isEmpty
(
bookings
))
{
{
log
.
error
(
bpmnFile
.
getName
()
+
"没有实体订阅"
);
log
.
error
(
bpmnFile
Name
+
"没有实体订阅"
);
deployInfo
+=
bpmnFile
.
getName
()
+
"解析失败,没有实体订阅配置"
+
"\r\n"
;
deployInfo
+=
bpmnFile
Name
+
"解析失败,没有实体订阅配置"
+
"\r\n"
;
wfreModel
.
setName
(
deployInfo
);
wfreModel
.
setName
(
deployInfo
);
return
false
;
return
false
;
}
}
...
@@ -573,8 +619,8 @@ public class WFCoreService
...
@@ -573,8 +619,8 @@ public class WFCoreService
String
[]
params
=
curProcess
.
getId
().
split
(
"-"
);
String
[]
params
=
curProcess
.
getId
().
split
(
"-"
);
if
(
params
.
length
!=
2
)
if
(
params
.
length
!=
2
)
{
{
log
.
error
(
bpmnFile
.
getName
()
+
"没有系统名称"
);
log
.
error
(
bpmnFile
Name
+
"没有系统名称"
);
deployInfo
+=
bpmnFile
.
getName
()
+
"解析失败,没有发布系统配置"
+
"\r\n"
;
deployInfo
+=
bpmnFile
Name
+
"解析失败,没有发布系统配置"
+
"\r\n"
;
wfreModel
.
setName
(
deployInfo
);
wfreModel
.
setName
(
deployInfo
);
return
false
;
return
false
;
}
}
...
@@ -595,7 +641,7 @@ public class WFCoreService
...
@@ -595,7 +641,7 @@ public class WFCoreService
AppDefinitionRepresentation
appModel
=
appDefinitionService
.
getAppDefinition
(
appKeyInfo
.
getId
());
AppDefinitionRepresentation
appModel
=
appDefinitionService
.
getAppDefinition
(
appKeyInfo
.
getId
());
inputStream
=
new
FileInputStream
(
bpmnFile
);
inputStream
=
new
ByteArrayInputStream
(
bpmnFile
.
toByteArray
()
);
boolean
bchange
=
false
;
boolean
bchange
=
false
;
for
(
String
booking:
bookings
.
split
(
","
))
for
(
String
booking:
bookings
.
split
(
","
))
{
{
...
@@ -617,7 +663,7 @@ public class WFCoreService
...
@@ -617,7 +663,7 @@ public class WFCoreService
String
fileFullPath
=
""
;
String
fileFullPath
=
""
;
BpmnModel
entitymodel
=
null
;
BpmnModel
entitymodel
=
null
;
try
{
try
{
inputStream2
=
new
FileInputStream
(
bpmnFile
);
inputStream2
=
new
ByteArrayInputStream
(
bpmnFile
.
toByteArray
()
);
reader2
=
factory
.
createXMLStreamReader
(
inputStream2
);
reader2
=
factory
.
createXMLStreamReader
(
inputStream2
);
entitymodel
=
bpmnXMLConverter
.
convertToBpmnModel
(
reader2
);
entitymodel
=
bpmnXMLConverter
.
convertToBpmnModel
(
reader2
);
entitymodel
.
getMainProcess
().
setId
(
processDefinitionKey
);
entitymodel
.
getMainProcess
().
setId
(
processDefinitionKey
);
...
@@ -737,8 +783,8 @@ public class WFCoreService
...
@@ -737,8 +783,8 @@ public class WFCoreService
return
true
;
return
true
;
}
}
catch
(
Exception
e
){
catch
(
Exception
e
){
log
.
error
(
bpmnFile
.
getName
()
+
"BPMN模型创建流程异常"
,
e
);
log
.
error
(
bpmnFile
Name
+
"BPMN模型创建流程异常"
,
e
);
deployInfo
+=
bpmnFile
.
getName
()
+
"BPMN模型创建流程异常"
+
"\r\n"
;
deployInfo
+=
bpmnFile
Name
+
"BPMN模型创建流程异常"
+
"\r\n"
;
wfreModel
.
setName
(
deployInfo
);
wfreModel
.
setName
(
deployInfo
);
return
false
;
return
false
;
}
}
...
@@ -897,4 +943,20 @@ public class WFCoreService
...
@@ -897,4 +943,20 @@ public class WFCoreService
return
strUsers
;
return
strUsers
;
}
}
private
ByteArrayOutputStream
getBpmnFile
(
InputStream
input
)
{
try
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
len
;
while
((
len
=
input
.
read
(
buffer
))
>
-
1
)
{
baos
.
write
(
buffer
,
0
,
len
);
}
baos
.
flush
();
return
baos
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
}
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
浏览文件 @
f37d3656
...
@@ -119,6 +119,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -119,6 +119,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/deploybpmn"
).
permitAll
()
// 所有请求都需要认证
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
// 防止iframe 造成跨域
...
...
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
浏览文件 @
f37d3656
...
@@ -12,6 +12,7 @@ import org.springframework.util.StringUtils;
...
@@ -12,6 +12,7 @@ import org.springframework.util.StringUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Slf4j
@Api
(
tags
=
{
"wfcore"
})
@Api
(
tags
=
{
"wfcore"
})
...
@@ -111,4 +112,9 @@ public class WFCoreResource
...
@@ -111,4 +112,9 @@ public class WFCoreResource
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getBusinessKeys
(
system
,
""
,
entity
,
processDefinitionKey
,
taskDefinitionKey
,
userId
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getBusinessKeys
(
system
,
""
,
entity
,
processDefinitionKey
,
taskDefinitionKey
,
userId
));
}
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/deploybpmn"
)
public
ResponseEntity
<
Boolean
>
deployBpmnFile
(
@RequestBody
List
<
Map
<
String
,
Object
>>
bpmnfiles
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
wfdeploybpmns
(
bpmnfiles
));
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录