|
@@ -23,6 +23,7 @@ import org.flowable.bpmn.model.UserTask;
|
|
|
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
|
|
|
import org.flowable.common.engine.api.delegate.event.FlowableEngineEvent;
|
|
|
import org.flowable.engine.ManagementService;
|
|
|
+import org.flowable.engine.RuntimeService;
|
|
|
import org.flowable.engine.TaskService;
|
|
|
import org.flowable.engine.delegate.DelegateExecution;
|
|
|
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
|
|
@@ -30,6 +31,7 @@ import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
|
|
import org.flowable.engine.delegate.event.FlowableProcessStartedEvent;
|
|
|
import org.flowable.engine.delegate.event.impl.FlowableProcessCancelledEventImpl;
|
|
|
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
|
|
|
+import org.flowable.engine.runtime.ProcessInstance;
|
|
|
import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -59,6 +61,9 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
@Autowired
|
|
|
private RedisService<String> redisService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RuntimeService runtimeService;
|
|
|
+
|
|
|
// 任务创建监听器
|
|
|
@Override
|
|
|
protected void taskCreated(FlowableEngineEntityEvent event) {
|
|
@@ -139,8 +144,12 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
String fromName = form.getFlowDefine().getName();
|
|
|
notify.setSubject("新的审批任务" + "-" + fromName);
|
|
|
|
|
|
+ ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
|
|
+ .processInstanceId(instanceId)
|
|
|
+ .singleResult();
|
|
|
+
|
|
|
// 审批节点
|
|
|
- notify.setContent(entity.getName());
|
|
|
+ notify.setContent(processInstance.getName() + "-" + entity.getName());
|
|
|
notify.setSender(SecurityContextUtil.getUserId());
|
|
|
notify.setType(NotifyEnum.TODO);
|
|
|
// 接收者 entity.getAssignee() 下一节点的审批人
|
|
@@ -199,13 +208,19 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
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);
|
|
|
|
|
|
- notify.setContent(entity.getName());
|
|
|
+ // 获取表单标题
|
|
|
+ ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
|
|
+ .processInstanceId(instanceId)
|
|
|
+ .singleResult();
|
|
|
+
|
|
|
+ notify.setContent(processInstance.getName() + "-" + "已完结");
|
|
|
notify.setSender(entity.getStartUserId());
|
|
|
notify.setType(NotifyEnum.SYSTEM);
|
|
|
notify.setReceiver(entity.getStartUserId());
|