Browse Source

测试 并行撤回

tags/24080901
PoffyZhang 1 year ago
parent
commit
556eb15a40
1 changed files with 25 additions and 29 deletions
  1. +25
    -29
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 25
- 29
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -11,22 +11,20 @@ import java.util.stream.Stream;
import javax.servlet.http.HttpServletResponse;

import cn.hutool.core.util.ObjectUtil;
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant;
import com.ningdatech.pmapi.todocenter.handle.PassHandle;
import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle;
import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import com.wflow.workflow.utils.ProcessTaskUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.ActivityInstanceQuery;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task;
import org.flowable.variable.api.history.HistoricVariableInstance;
import org.springframework.beans.BeanUtils;
@@ -34,7 +32,6 @@ import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -51,11 +48,8 @@ import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.irs.sign.IRSAPIRequest;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.enumeration.FourSystemEnum;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
@@ -71,9 +65,6 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.signature.entity.CompanySignature;
import com.ningdatech.pmapi.signature.service.ICompanySignatureService;
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService;
import com.ningdatech.pmapi.staging.service.IProjectStagingService;
import com.ningdatech.pmapi.sys.service.INotifyService;
import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum;
import com.ningdatech.pmapi.todocenter.enumeration.IsOrNotEnum;
import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO;
@@ -119,7 +110,7 @@ public class TodoCenterManage {

private final ProcessTaskService processTaskService;
private final HistoryService historyService;
private final RuntimeService runtimeService;
private final TaskService taskService;
private final IProjectService projectService;
private final ProjectLibManage projectLibManage;
private final ProcessInstanceService processInstanceService;
@@ -127,7 +118,6 @@ public class TodoCenterManage {
private final IProjectApplicationService projectApplicationService;
private final UserInfoHelper userInfoHelper;
private final BuildUserUtils buildUserUtils;
private final TaskService taskService;
private final IProjectInstService projectInstService;
private final PdfUtils pdfUtils;
private final FileService fileService;
@@ -140,6 +130,8 @@ public class TodoCenterManage {

private final PassHandle passHandle;

private final RepositoryService repositoryService;

/**
* 待办中心待我处理项目列表查询
*
@@ -353,7 +345,7 @@ public class TodoCenterManage {
//通过审核后 所处理的逻辑
handlerManage.afterPassTodo(declaredProject,instance);

return findNextTaskId(instance,employeeCode);
return findNextTaskId(instance,employeeCode,param.getTaskId());
// 驳回
case REJECT:
// 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:
@@ -389,7 +381,7 @@ public class TodoCenterManage {
//上个审批人处理逻辑
processTaskService.lastWithdrawTask(param);

return findNextTaskId(instance,employeeCode);
return findNextTaskId(instance,employeeCode,param.getTaskId());
}
break;
default:
@@ -1215,19 +1207,25 @@ public class TodoCenterManage {
* @param instance
* @return
*/
private String findNextTaskId(HistoricProcessInstance instance,String employeeCode) {
List<ActivityInstance> userTasks = runtimeService.createActivityInstanceQuery()
.activityType("userTask")
private String findNextTaskId(HistoricProcessInstance instance,String employeeCode,String taskId) {
BpmnModel bpmnModel = repositoryService.getBpmnModel(instance.getProcessDefinitionId());
Map<String, String> subNodeMap = ProcessTaskUtils.getSubNodeMap(bpmnModel);
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String subProcessId = subNodeMap.get(task.getTaskDefinitionKey());
Map<String, List<String>> allSubNodeMap = ProcessTaskUtils.loadSubNodeMap(bpmnModel);
List<String> nodeIds = allSubNodeMap.get(subProcessId);

List<Task> tasks = taskService.createTaskQuery()
.processInstanceId(instance.getId())
.taskAssignee(employeeCode)
.orderByActivityInstanceStartTime()
.taskDefinitionKeys(nodeIds)
.orderByTaskCreateTime()
.asc()
.unfinished()
.list();
if(CollUtil.isEmpty(userTasks)){
if(CollUtil.isEmpty(tasks)){
return "处理成功";
}
return userTasks.get(0).getTaskId();
return tasks.get(0).getId();
}

/**
@@ -1237,17 +1235,15 @@ public class TodoCenterManage {
*/
public String todoTaskId(String instanceId) {
String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode();
List<ActivityInstance> userTasks = runtimeService.createActivityInstanceQuery()
.activityType("userTask")
List<Task> tasks = taskService.createTaskQuery()
.processInstanceId(instanceId)
.taskAssignee(employeeCode)
.orderByActivityInstanceStartTime()
.orderByTaskCreateTime()
.asc()
.unfinished()
.list();
if(CollUtil.isEmpty(userTasks)){
if(CollUtil.isEmpty(tasks)){
return null;
}
return userTasks.get(0).getTaskId();
return tasks.get(0).getId();
}
}

Loading…
Cancel
Save