Browse Source

优化流程处理

master
CMM 1 year ago
parent
commit
009fe4836a
3 changed files with 57 additions and 43 deletions
  1. +0
    -35
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProcessComment.java
  2. +56
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  3. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java

+ 0
- 35
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProcessComment.java View File

@@ -1,35 +0,0 @@
package com.ningdatech.pmapi.todocenter.bean.entity;

import com.ningdatech.pmapi.common.model.FileBasicInfo;
import com.wflow.workflow.bean.vo.ProcessHandlerParamsVo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Collections;
import java.util.List;

/**
* 审核意见实体
*
* @author CMM
* @since 2023/02/01 16:25
*/
@Data
@NoArgsConstructor
public class ProcessComment {
/**
* 文字评论
*/
protected String text;
/**
* 评论附件
*/
protected List<FileBasicInfo> attachments;

public ProcessComment(String text, List<FileBasicInfo> attachments) {
this.text = text;
this.attachments = null == attachments ? Collections.emptyList() : attachments;
}
}

+ 56
- 6
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -22,7 +22,6 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo;
import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum;
@@ -43,6 +42,7 @@ import com.wflow.exception.BusinessException;
import com.wflow.mapper.WflowCcTasksMapper;
import com.wflow.mapper.WflowModelHistorysMapper;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.ProcessComment;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
@@ -61,7 +61,6 @@ import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
@@ -105,7 +104,6 @@ public class TodoCenterManage {
private final ZwddClient zwddClient;
private final IDingEmployeeInfoService dingEmployeeInfoService;
private final IDingOrganizationService dingOrganizationService;

private final ProcessInstanceService processInstanceService;

/**
@@ -207,13 +205,66 @@ public class TodoCenterManage {
// 获取登录用户ID
Long userId = LoginUserUtil.getUserId();

// 获取入参
String processInstanceId = param.getInstanceId();
Long projectId = param.getProjectId();

// 获取当前要处理的流程实例
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
// 获取流程发起人信息
String startUserId = instance.getStartUserId();
ProcessInstanceUserDto startUser = userInfoService.getUserInfo(startUserId);

// 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作)
if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)) {
// 当前登录用户是流程发起人
if (userId.equals(Long.valueOf(startUser.getUserId()))){
// processTaskService.handleTask(param, userId);
// 获取当前申报项目
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, processInstanceId)
.eq(Project::getId,projectId));
// 获取当前项目状态
Integer projectStatus = declaredProject.getStatus();
// TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录
// 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) {
// 当前项目状态是单位内部审核中
case UNDER_INTERNAL_AUDIT:
// 当前项目状态是预审中
case PRE_APPLYING:
// 当前项目状态是部门联审中
case DEPARTMENT_JOINT_REVIEW:
// 当前项目状态是方案评审中
case SCHEME_UNDER_REVIEW:
// 当前项目状态是终验审核中
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW:
updateWithdrawProjectStatus(userId, declaredProject);
break;
default:
throw new IllegalStateException("Unexpected value: " + projectStatus);
}
}else {
// 当前登录用户不是流程发起人
ProcessProgressVo progressInstanceDetail = processInstanceService
.getProgressInstanceDetail(null, processInstanceId);
List<ProgressNode> progressInfo = progressInstanceDetail.getProgressInfo();
// 获取当前当前工作流任务前一个审核人信息
ProgressNode beforeProgressNode = progressInfo.get(progressInfo.size() - 2);
ProcessInstanceUserDto beforeUser = beforeProgressNode.getUser();
// 获取当前当前工作流任务当前审核人信息
ProgressNode currentProgressNode = progressInfo.get(progressInfo.size() - 1);
ProcessInstanceUserDto currentUser = currentProgressNode.getUser();
// 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常

Boolean orgFlag = true;
// processTaskService.handleTask(param, userId);
}
HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery()
.taskId(param.getTaskId())
.singleResult();
// 获取要处理的项目ID
Long projectId = param.getProjectId();
doWithDrawProcess(handledTaskInstance, userId, projectId);
return;
}
@@ -873,7 +924,6 @@ public class TodoCenterManage {
// 获取登录用户ID
Long userId = LoginUserUtil.getUserId();

// String userId = param.getUserId();
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);



+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java View File

@@ -1,8 +1,7 @@
package com.ningdatech.pmapi.todocenter.model.dto.req;

import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.wflow.workflow.bean.process.ProcessComment;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


Loading…
Cancel
Save