|
@@ -195,8 +195,21 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
@Override
|
|
|
protected void processCompleted(FlowableEngineEntityEvent event) {
|
|
|
ExecutionEntityImpl entity = (ExecutionEntityImpl) event.getEntity();
|
|
|
+ String instanceId = entity.getProcessInstanceId();
|
|
|
+
|
|
|
+ // 获取表单标题(实例名称)
|
|
|
+ ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
|
|
+ .processInstanceId(instanceId)
|
|
|
+ .singleResult();
|
|
|
+ String formTitle = processInstance.getName();
|
|
|
+
|
|
|
+ // 获取模版名称
|
|
|
+ FormInfo form = flowInstanceService.getForm(instanceId);
|
|
|
+ String fromName = form.getFlowDefine().getName();
|
|
|
+
|
|
|
// 更新流程实例状态
|
|
|
FlowInstance flowInstance = FlowInstance.buildStatus(entity.getProcessInstanceId(), ProcessStatus.COMPLETED);
|
|
|
+
|
|
|
flowInstanceService.updateById(flowInstance);
|
|
|
redisService.del(event.getProcessInstanceId());
|
|
|
|
|
@@ -206,21 +219,9 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
public void afterCommit() {
|
|
|
Notify notify = new Notify();
|
|
|
notify.setSubject("申请已通过");
|
|
|
-
|
|
|
// notify.setContent(String.format("您申请的流程《%s》已通过", entity.getName()));
|
|
|
- // 获取表单(模板)名称
|
|
|
- String instanceId = entity.getProcessInstanceId();
|
|
|
- FormInfo form = flowInstanceService.getForm(instanceId);
|
|
|
- String fromName = form.getFlowDefine().getName();
|
|
|
-
|
|
|
notify.setSubject("申请已通过" + "-" + fromName);
|
|
|
-
|
|
|
- // 获取表单标题
|
|
|
- ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
|
|
- .processInstanceId(instanceId)
|
|
|
- .singleResult();
|
|
|
-
|
|
|
- notify.setContent(processInstance.getName() + "-" + "已完结");
|
|
|
+ notify.setContent(formTitle + "-" + "已完结");
|
|
|
notify.setSender(entity.getStartUserId());
|
|
|
notify.setType(NotifyEnum.SYSTEM);
|
|
|
notify.setReceiver(entity.getStartUserId());
|