@@ -60,8 +60,8 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.*; | import com.ningdatech.pmapi.projectlib.service.*; | ||||
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | |||||
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | ||||
import com.ningdatech.pmapi.todocenter.service.ITodoService; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.exception.BusinessException; | import com.wflow.exception.BusinessException; | ||||
@@ -69,7 +69,6 @@ import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.checkerframework.checker.nullness.qual.Nullable; | |||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
@@ -113,7 +112,7 @@ public class ProjectLibManage { | |||||
private final IPaymentPlanService paymentPlanService; | private final IPaymentPlanService paymentPlanService; | ||||
private final TodoCenterManage todoCenterManage; | |||||
private final ITodoService todoService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
@@ -1195,7 +1194,7 @@ public class ProjectLibManage { | |||||
ProcessDetailReq req = new ProcessDetailReq(); | ProcessDetailReq req = new ProcessDetailReq(); | ||||
req.setProjectId(lastProject.getId()); | req.setProjectId(lastProject.getId()); | ||||
req.setInstanceId(lastProject.getInstCode()); | req.setInstanceId(lastProject.getInstCode()); | ||||
res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoCenterManage.getProcessDetail(req)); | |||||
res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoService.getProcessDetail(req)); | |||||
return res; | return res; | ||||
} | } | ||||
} | } |
@@ -479,7 +479,7 @@ public class HandlerManage { | |||||
* @param taskId | * @param taskId | ||||
* @return | * @return | ||||
*/ | */ | ||||
public Boolean checkIsContainsTask(List<ProgressNode> progressNodes, String taskId) { | |||||
public static Boolean checkIsContainsTask(List<ProgressNode> progressNodes, String taskId) { | |||||
if(CollUtil.isEmpty(progressNodes)){ | if(CollUtil.isEmpty(progressNodes)){ | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
} | } | ||||
@@ -599,7 +599,7 @@ public class TodoCenterManage { | |||||
.equals(userFullInfoDTO.getEmpPosUnitCode())){ | .equals(userFullInfoDTO.getEmpPosUnitCode())){ | ||||
//说明是此单位的人 | //说明是此单位的人 | ||||
//那么要去看 taskId 是不是 在这个单位内的任务 | //那么要去看 taskId 是不是 在这个单位内的任务 | ||||
Boolean isContainsTask = handlerManage.checkIsContainsTask(children,taskId); | |||||
Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); | |||||
if(isContainsTask){ | if(isContainsTask){ | ||||
res[0] = Boolean.TRUE; | res[0] = Boolean.TRUE; | ||||
return; | return; | ||||
@@ -0,0 +1,19 @@ | |||||
package com.ningdatech.pmapi.todocenter.service; | |||||
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | |||||
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | |||||
/** | |||||
* @Classname ITodoService | |||||
* @Description | |||||
* @Date 2023/7/25 15:41 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
public interface ITodoService { | |||||
/** | |||||
* 获取事例详情 | |||||
* @param request | |||||
* @return | |||||
*/ | |||||
ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) ; | |||||
} |
@@ -0,0 +1,128 @@ | |||||
package com.ningdatech.pmapi.todocenter.service.impl; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.todocenter.handle.PassHandle; | |||||
import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; | |||||
import com.ningdatech.pmapi.todocenter.manage.HandlerManage; | |||||
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | |||||
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | |||||
import com.ningdatech.pmapi.todocenter.service.ITodoService; | |||||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||||
import com.wflow.workflow.bean.process.ProgressNode; | |||||
import com.wflow.workflow.bean.process.enums.NodeTypeEnum; | |||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||||
import com.wflow.workflow.service.ProcessInstanceService; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* @Classname TodoService | |||||
* @Description | |||||
* @Date 2023/7/25 15:41 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Service | |||||
@AllArgsConstructor | |||||
@Slf4j | |||||
public class TodoServiceImpl implements ITodoService { | |||||
private final ProcessInstanceService processInstanceService; | |||||
private final BuildUserUtils buildUserUtils; | |||||
private final UserInfoHelper userInfoHelper; | |||||
private final WithDrawHandle withDrawHandle; | |||||
private final PassHandle passHandle; | |||||
private final ProjectLibManage projectLibManage; | |||||
/** | |||||
* 查询流程表单数据及审批的进度步骤 | |||||
* | |||||
* @param request 请求参数 | |||||
* @return 流程进度及表单详情 | |||||
*/ | |||||
public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { | |||||
String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); | |||||
String instanceId = request.getInstanceId(); | |||||
String nodeId = request.getNodeId(); | |||||
Long projectId = request.getProjectId(); | |||||
String taskId = request.getTaskId(); | |||||
ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId,taskId); | |||||
if(Objects.isNull(progressInstanceDetail)){ | |||||
return null; | |||||
} | |||||
List<ProgressNode> progressInfo = progressInstanceDetail.getProgressInfo(); | |||||
Boolean isHighLine = Boolean.FALSE; | |||||
if (CollUtil.isNotEmpty(progressInfo)){ | |||||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||||
isHighLine = checkHighLine(progressInfo,taskId,LoginUserUtil.loginUserDetail()); | |||||
} | |||||
ProcessProgressDetailVo res = new ProcessProgressDetailVo(); | |||||
res.setProcessProgressVo(progressInstanceDetail); | |||||
res.setStatus(progressInstanceDetail.getStatus()); | |||||
res.setProjectId(projectId); | |||||
res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId,progressInstanceDetail,request.getTaskId())); | |||||
res.setIsHighLine(isHighLine); | |||||
passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res); | |||||
//是不是被 驳回|退回 | |||||
res.setIsChange(projectLibManage.isChangeRecord(projectId)); | |||||
return res; | |||||
} | |||||
/** | |||||
* 筛选 当前登录人 是不是 上级条线单位的审批 | |||||
* @param progressInfo | |||||
* @param taskId | |||||
* @param user | |||||
* @return | |||||
*/ | |||||
private Boolean checkHighLine(List<ProgressNode> progressInfo, String taskId, UserInfoDetails user) { | |||||
if(CollUtil.isEmpty(progressInfo)){ | |||||
return Boolean.FALSE; | |||||
} | |||||
final Boolean[] res = {Boolean.FALSE}; | |||||
progressInfo.forEach(p -> { | |||||
//如果是 子流程 | |||||
if(Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())){ | |||||
//如果不是上级条线单位 根本不用理 | |||||
if(!p.getIsHighLine()){ | |||||
return; | |||||
} | |||||
List<ProgressNode> children = p.getChildren(); | |||||
ProgressNode progressNode = children.get(0); | |||||
String userId = progressNode.getUserId(); | |||||
if(StringUtils.isBlank(userId)){ | |||||
return; | |||||
} | |||||
UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); | |||||
if(Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() | |||||
.equals(userFullInfoDTO.getEmpPosUnitCode())){ | |||||
//说明是此单位的人 | |||||
//那么要去看 taskId 是不是 在这个单位内的任务 | |||||
Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); | |||||
if(isContainsTask){ | |||||
res[0] = Boolean.TRUE; | |||||
return; | |||||
} | |||||
} | |||||
} | |||||
}); | |||||
return res[0]; | |||||
} | |||||
} |