This commit is contained in:
wangliwen 2022-09-02 09:20:13 +08:00
parent 087b1ca78f
commit c542c51e5c
1 changed files with 5 additions and 4 deletions

View File

@ -209,13 +209,14 @@ public class CorrectionListenerV3 implements TaskListener, ExecutionListener, Ac
private void mpComplete(List<TAbilityApplicationDTO> abilityApplicationDTO, DelegateTask delegateTask, final String assignee) { // 处理免批或申请人为资源提供方部门审批人 private void mpComplete(List<TAbilityApplicationDTO> abilityApplicationDTO, DelegateTask delegateTask, final String assignee) { // 处理免批或申请人为资源提供方部门审批人
Optional<TAbilityApplicationDTO> abilityApplicationDTOOptional = abilityApplicationDTO.stream().findAny(); Optional<TAbilityApplicationDTO> abilityApplicationDTOOptional = abilityApplicationDTO.stream().findAny();
abilityApplicationDTOOptional.ifPresent(index -> { if (abilityApplicationDTOOptional.isPresent()) {
if (abilityApplicationDTOOptional.get().getUserId().equals(delegateTask.getAssignee())) { if (abilityApplicationDTOOptional.get().getUserId().equals(delegateTask.getAssignee())) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "申请人为资源提供方部门审批人,默认通过"); taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "申请人为资源提供方部门审批人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables()); taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return; return;
} }
}); }
if (StringUtils.isNotEmpty(assignee) if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class)) && StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
&& delegateTask.getVariable("creator", String.class).equals(assignee)) { && delegateTask.getVariable("creator", String.class).equals(assignee)) {
@ -227,9 +228,9 @@ public class CorrectionListenerV3 implements TaskListener, ExecutionListener, Ac
return; return;
} }
List<HistoricActivityInstance> historicActivityInstanceList=historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId()) List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
.activityType("userTask").unfinished().orderByHistoricActivityInstanceEndTime().desc().list(); .activityType("userTask").unfinished().orderByHistoricActivityInstanceEndTime().desc().list();
if(!historicActivityInstanceList.isEmpty() && historicActivityInstanceList.get(0).getAssignee().equals(assignee)){ if (!historicActivityInstanceList.isEmpty() && historicActivityInstanceList.get(0).getAssignee().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过"); taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE); taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE); taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);