Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
74d82616
提交
74d82616
编写于
3月 24, 2021
作者:
tangyaolong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改回退逻辑
上级
14408390
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
12 行增加
和
57 行删除
+12
-57
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+3
-52
WFCoreMapper.java
...in/java/cn/ibizlab/core/workflow/mapper/WFCoreMapper.java
+2
-0
WFCoreMapper.xml
...rc/main/resources/mapper/workflow/wfcore/WFCoreMapper.xml
+4
-0
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+3
-5
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
74d82616
...
...
@@ -98,8 +98,8 @@ public class WFCoreService
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
protected
ManagementService
managementService
;
@Autowired
protected
ManagementService
managementService
;
@Autowired
private
WFModelService
wfModelService
;
...
...
@@ -1095,7 +1095,7 @@ public class WFCoreService
bpmnLayout
.
execute
();
byte
[]
bs
=
bpmnXMLConverter
.
convertToXML
(
entitymodel
);
bmpmfileId
=
DigestUtils
.
md5DigestAsHex
(
bs
);
if
(
bmpmfileId
.
equals
(
old
.
getMd5check
()
))
if
(
bmpmfileId
.
equals
(
1
))
{
log
.
warn
(
"部署流程没有变化,忽略 name:"
+
curProcess
.
getName
()
+
" key "
+
processDefinitionKey
+
" deploy "
+
bmpmfileId
);
deployInfo
+=
curProcess
.
getName
()+
" key:"
+
processDefinitionKey
+
",流程配置没有变化,忽略发布"
+
"\r\n"
;
...
...
@@ -1904,53 +1904,4 @@ public class WFCoreService
});
return
true
;
}
/**
* @param taskId 当前需要回退的节点
* @return 回退上一个节点
*/
public
boolean
wfback
(
String
system
,
String
appname
,
String
entity
,
String
taskId
)
{
try
{
Boolean
flag
=
true
;
String
sourceRef
=
null
;
Task
task
=
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
();
String
taskDefinitionKey
=
task
.
getTaskDefinitionKey
();
if
(
taskDefinitionKey
==
null
)
{
log
.
debug
(
"taskDefinitionKey不存在"
);
return
false
;
}
String
processInstanceId
=
task
.
getProcessInstanceId
();
if
(
processInstanceId
==
null
)
{
log
.
debug
(
"processInstanceId不存在"
);
return
false
;
}
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionId
(
task
.
getProcessDefinitionId
()).
singleResult
();
BpmnModel
bpmnModel
=
repositoryService
.
getBpmnModel
(
processDefinition
.
getId
());
FlowNode
flowNode
=
(
FlowNode
)
bpmnModel
.
getFlowElement
(
task
.
getTaskDefinitionKey
());
// 获取历史路径
WFProcessInstance
instance
=
getWFHistory
(
system
,
appname
,
entity
,
taskDefinitionKey
,
task
.
getProcessInstanceId
());
if
(!
ObjectUtils
.
isEmpty
(
flowNode
)
&&
!
ObjectUtils
.
isEmpty
(
instance
))
{
List
<
WFProcessNode
>
usertasks
=
new
ArrayList
((
Collection
<?
extends
WFProcessNode
>)
instance
.
getExtensionparams
().
get
(
"usertasks"
));
for
(
WFProcessNode
node
:
usertasks
)
{
for
(
SequenceFlow
flow
:
flowNode
.
getIncomingFlows
())
{
if
(
node
.
getUsertaskid
().
equals
(
flow
.
getSourceRef
())&&
flow
.
getSourceRef
().
startsWith
(
"tid"
))
{
sourceRef
=
flow
.
getSourceRef
();
flag
=
false
;
break
;
}
}
if
(!
flag
)
{
break
;
}
}
}
else
{
return
false
;
}
// 执行回退
runtimeService
.
createChangeActivityStateBuilder
().
processInstanceId
(
processInstanceId
).
moveActivityIdTo
(
taskDefinitionKey
,
sourceRef
).
changeState
();
}
catch
(
Exception
e
)
{
throw
new
BadRequestAlertException
(
"回退失败"
,
"WFCoreService"
,
"wfback"
);
}
return
true
;
}
}
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/mapper/WFCoreMapper.java
浏览文件 @
74d82616
...
...
@@ -24,4 +24,6 @@ public interface WFCoreMapper {
Page
<
WFTask
>
searchUnReadTask
(
IPage
page
,
@Param
(
"srf"
)
WFTaskSearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
WFTask
>
wrapper
)
;
Object
readTask
(
@Param
(
"et"
)
Map
param
);
Map
serchSubProcess
(
@Param
(
"et"
)
Map
param
);
}
ibzwf-core/src/main/resources/mapper/workflow/wfcore/WFCoreMapper.xml
浏览文件 @
74d82616
...
...
@@ -30,6 +30,10 @@
<if
test=
"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere"
>
${ew.sqlSegment}
</if>
</select>
<select
id=
"serchSubProcess"
parameterType=
"cn.ibizlab.core.workflow.filter.WFTaskSearchContext"
resultType=
"java.util.Map"
>
select TASK_DEF_KEY_ as taskDefinitionKey from act_hi_taskinst where PROC_INST_ID_ = #{et.processInstanceId} and END_TIME_ is not null order by END_TIME_ desc
</select>
<select
id=
"searchMyTaskCnt"
parameterType=
"cn.ibizlab.core.workflow.filter.WFTaskSearchContext"
resultType=
"cn.ibizlab.core.workflow.domain.WFProcessNode"
>
...
...
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
浏览文件 @
74d82616
...
...
@@ -150,11 +150,9 @@ public class WFCoreResource
}
@ApiOperation
(
value
=
"wfback"
,
tags
=
{
"wfback"
},
notes
=
"工作流回退"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{taskId}/back"
)
public
ResponseEntity
<
Boolean
>
wfback
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"taskId"
)
String
taskId
){
return
ResponseEntity
.
ok
(
wfCoreService
.
wfback
(
system
,
appname
,
entity
,
taskId
));
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{taskId}/back"
)
public
ResponseEntity
<
Boolean
>
wfback
(
@PathVariable
(
"taskId"
)
String
taskId
){
return
ResponseEntity
.
ok
(
wfCoreService
.
wfback
(
taskId
));
}
//@PreAuthorize("hasPermission(#entity,'WFSTART',this.getEntity())")
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录