Browse Source

项目库修改

tags/24080901
WendyYang 9 months ago
parent
commit
d5704b7e3c
2 changed files with 18 additions and 23 deletions
  1. +16
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java
  2. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java

+ 16
- 21
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java View File

@@ -1,11 +1,12 @@
package com.hz.pm.api.todocenter.handle; package com.hz.pm.api.todocenter.handle;


import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.model.entity.ProjectInst;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.constant.TodoCenterConst;
import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserFullInfoDTO;
@@ -19,7 +20,6 @@ import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.enums.ProcessStatusEnum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
import org.flowable.bpmn.model.*; import org.flowable.bpmn.model.*;
import org.flowable.engine.HistoryService; import org.flowable.engine.HistoryService;
@@ -61,7 +61,7 @@ public class WithDrawHandle {
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instanceId).singleResult(); .processInstanceId(instanceId).singleResult();
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail();
String employeeCode = userInfoDetails.getEmployeeCode();
String userId = userInfoDetails.getEmployeeCode();
//如果不是审核中 //如果不是审核中
if (!ProcessStatusEnum.UNDER_REVIEW.getDesc() if (!ProcessStatusEnum.UNDER_REVIEW.getDesc()
.equals(progressInstanceDetail.getStatus())) { .equals(progressInstanceDetail.getStatus())) {
@@ -69,7 +69,7 @@ public class WithDrawHandle {
} }
// 如果当前登录用户是流程发起人,判断流程是否已经开始审批,如果开始审批,不能撤回 // 如果当前登录用户是流程发起人,判断流程是否已经开始审批,如果开始审批,不能撤回
Boolean userIsRoot = checkUserIsRoot(instanceId, null); Boolean userIsRoot = checkUserIsRoot(instanceId, null);
if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, employeeCode)) {
if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, userId)) {
return Boolean.TRUE; return Boolean.TRUE;
} }
ReqProcessHandlerDTO dto = new ReqProcessHandlerDTO(); ReqProcessHandlerDTO dto = new ReqProcessHandlerDTO();
@@ -264,7 +264,7 @@ public class WithDrawHandle {
return null; return null;
} }
//进入上一个节点的标识 //进入上一个节点的标识
Boolean enterBefore = Boolean.FALSE;
boolean enterBefore = Boolean.FALSE;
//假设 作为当前会签的第一个点 //假设 作为当前会签的第一个点
String thisAndOrNodeId = curr.getNodeId(); String thisAndOrNodeId = curr.getNodeId();
//假设 作为上一个会签/或签的第一个点 //假设 作为上一个会签/或签的第一个点
@@ -309,23 +309,22 @@ public class WithDrawHandle {
* 1.判断 当前 撤回人 是否是 发起人 * 1.判断 当前 撤回人 是否是 发起人
* 2.并且流程 尚未开始审批 * 2.并且流程 尚未开始审批
* *
* @return
* @return
*/ */
public boolean canRootWithDraw(HistoricProcessInstance instance, String employeeCode) {
public boolean canRootWithDraw(HistoricProcessInstance instance, String userId) {
String startUserId = instance.getStartUserId(); String startUserId = instance.getStartUserId();
// 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false // 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false
String instanceId = instance.getId();
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instanceId));
LambdaQueryWrapper<ProjectInst> piQuery = Wrappers.lambdaQuery(ProjectInst.class)
.select(ProjectInst::getInstType)
.eq(ProjectInst::getInstCode, instance.getId());
ProjectInst projectInst = projectInstService.getOne(piQuery);
Integer instType = projectInst.getInstType(); Integer instType = projectInst.getInstType();


if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) ||
InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) {
if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType)) {
return Boolean.FALSE; return Boolean.FALSE;
} }
//如果流程发起人 不是 当前登录人 直接返回false //如果流程发起人 不是 当前登录人 直接返回false
if (StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId)
|| !employeeCode.equals(startUserId)) {
if (StrUtils.hasBlank(userId, startUserId) || !userId.equals(startUserId)) {
return Boolean.FALSE; return Boolean.FALSE;
} }


@@ -333,14 +332,10 @@ public class WithDrawHandle {
.processInstanceId(instance.getId()).finished() .processInstanceId(instance.getId()).finished()
.activityType(TodoCenterConst.Handler.ACTIVITY_APPROVAL) .activityType(TodoCenterConst.Handler.ACTIVITY_APPROVAL)
.orderByHistoricActivityInstanceEndTime().asc().list(); .orderByHistoricActivityInstanceEndTime().asc().list();
List<HistoricActivityInstance> instances = finished.stream()
long count = finished.stream()
.filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason())) .filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason()))
.collect(Collectors.toList());
.count();
//如果有已经被审核过的 节点 返回false //如果有已经被审核过的 节点 返回false
if (CollUtil.isNotEmpty(instances)) {
return Boolean.FALSE;
}

return Boolean.TRUE;
return count == 0;
} }
} }

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java View File

@@ -322,7 +322,7 @@ public class TodoCenterManage {
/** /**
* 流程处理相关操作 * 流程处理相关操作
* *
* @param param
* @param param \
* @return void * @return void
* @author CMM * @author CMM
* @since 2023/02/01 * @since 2023/02/01
@@ -403,7 +403,7 @@ public class TodoCenterManage {
break; break;
// 撤回(流程发起人和当前流程审核人的前一个审核人操作) // 撤回(流程发起人和当前流程审核人的前一个审核人操作)
case WITHDRAW: { case WITHDRAW: {
/**
/*
* 新逻辑 * 新逻辑
* 不判断前端传的taskId * 不判断前端传的taskId
* 1.先判断 用户是否是ROOT 发起人 并且流程没有开始审批 * 1.先判断 用户是否是ROOT 发起人 并且流程没有开始审批


Loading…
Cancel
Save