|
@@ -60,8 +60,6 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
@Autowired
|
|
|
private RedisService<String> redisService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private UserService userService;
|
|
|
@Autowired
|
|
|
private RepositoryService repositoryService;
|
|
|
|
|
@@ -150,37 +148,31 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
// 审批节点
|
|
|
notify.setContent(fromName + "-" + entity.getName());
|
|
|
|
|
|
- // 获取流程定义-判断是否为第一个和最后一个节点
|
|
|
+ // 获取流程定义-判断是否为最后一个节点
|
|
|
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
|
|
|
.processDefinitionId(execution.getProcessDefinitionId())
|
|
|
.singleResult();
|
|
|
|
|
|
- // 获取流程定义中的所有流元素-判断是否为第一个和最后一个节点
|
|
|
+ // 获取流程定义中的所有流元素-判断是否为最后一个节点
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
|
|
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
|
|
|
|
|
|
- // 获取第一个节点(开始事件)和最后一个节点(结束事件)的 ID-判断是否为第一个和最后一个节点
|
|
|
- String startActivityId = null;
|
|
|
+ // 获取最后一个节点(结束事件)的 ID
|
|
|
String endActivityId = null;
|
|
|
for (FlowElement flowElement : flowElements) {
|
|
|
- if (flowElement instanceof StartEvent) {
|
|
|
- startActivityId = flowElement.getId();
|
|
|
- } else if (flowElement instanceof EndEvent) {
|
|
|
+ if (flowElement instanceof EndEvent) {
|
|
|
endActivityId = flowElement.getId();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 判断是否是第一个节点或最后一个节点
|
|
|
- boolean isFirstNode = currentFlowElement.getId().equals(startActivityId);
|
|
|
+ // 判断是否是最后一个节点
|
|
|
boolean isLastNode = currentFlowElement.getId().equals(endActivityId);
|
|
|
+ log.info("flowElement.getId: {}", endActivityId);
|
|
|
+ log.info("currentFlowElement.getId: {}", currentFlowElement.getId());
|
|
|
|
|
|
-
|
|
|
- // // 判断是否是第一个节点或最后一个节点
|
|
|
- // boolean isFirstNode = ProcessElementUtil.isFirstNode(currentFlowElement);
|
|
|
- // boolean isLastNode = ProcessElementUtil.isLastNode(currentFlowElement);
|
|
|
- //
|
|
|
- if (isFirstNode || isLastNode) {
|
|
|
- // 第一个节点或最后一个节点,消息发送人为当前登录用户
|
|
|
+ if (isLastNode) {
|
|
|
+ // 最后一个节点,消息发送人为当前登录用户
|
|
|
+ log.info("这是最后一个节点,登录用户{}", SecurityContextUtil.getUserInfo().getUsername());
|
|
|
notify.setSender(Objects.requireNonNull(SecurityContextUtil.getUserInfo()).getUsername());
|
|
|
} else {
|
|
|
// 其余节点,消息发送人为发起人
|
|
@@ -264,8 +256,6 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
|
|
|
notify.setReceivingTime(LocalDateTime.now());
|
|
|
notify.setUrl("/flow/submit");
|
|
|
notifyService.notify(notify);
|
|
|
-
|
|
|
- log.info("实例开始userId{}", (entity.getStartUserId()));
|
|
|
}
|
|
|
});
|
|
|
}
|