。。。

This commit is contained in:
wangliwen 2022-07-07 13:57:02 +08:00
parent e494a94c57
commit 9226d20e7a
1 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.*;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.engine.task.Comment;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
@ -32,6 +33,7 @@ import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
/**
*
@ -167,10 +169,12 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
&& demandDataDTO.getApplyUserId().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
try {
Thread.sleep(100l);
Thread.sleep(1000l);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
@ -208,10 +212,11 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为已拒绝---------------------------------");
} else {
Optional<Comment> comment = taskService.getTaskComments(delegateTask.getId()).stream().findFirst();
demandDataDTO.setFlag(TDemandDataEntityFlag.APPROVE.getFlag());
demandDataDTO.setApprovalUserDeptName(userDTO != null ? userDTO.getDeptName() : null);
demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
demandDataDTO.setApprovalOpinions(comment.isPresent() ? comment.get().getFullMessage() : "");
logger.error("---------------------------更新状态为已通过---------------------------------");
}
logger.error("demandDataDTO:" + demandDataDTO);