From 97d161d1c75bce59a27e1418c451e1b12769f6c9 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 25 Jul 2023 15:37:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=20=E5=92=8C=20=E5=BD=93=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/constant/ProjectConstant.java | 4 ++++ .../pmapi/projectlib/controller/ProjectLibController.java | 2 +- .../pmapi/projectlib/manage/ProjectLibManage.java | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java index 9d032e9..c34a508 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ProjectConstant.java @@ -11,5 +11,9 @@ public interface ProjectConstant { class ProjectLib{ public static final String PROJECT_BASIC = "basic"; public static final String PROJECT_CONSTRUCT = "construct"; + + public static final String CHANGES_KEY = "changes"; + + public static final String PROCESS_KEY = "process"; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java index f0c4902..b462e64 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java @@ -54,7 +54,7 @@ public class ProjectLibController { } @GetMapping("/change-record/{id}") - @ApiOperation("查看项目变更记录-输入任一项目ID即可") + @ApiOperation("查看项目变更记录") public JSONObject changeRecord(@PathVariable Long id) { return projectLibManage.changeRecord(id); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 05d7e6c..9065a85 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -60,6 +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.ProjectLibListItemVO; 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.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; @@ -111,6 +113,8 @@ public class ProjectLibManage { private final IPaymentPlanService paymentPlanService; + private final TodoCenterManage todoCenterManage; + public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); query.eq(Project::getNewest,Boolean.TRUE); @@ -1184,6 +1188,14 @@ public class ProjectLibManage { return res; } - return new CompareUtils().compareToJson(twoVersions.get(0), twoVersions.get(1),null); + Project lastProject = twoVersions.get(1); + Project thisProject = twoVersions.get(0); + res.put(ProjectConstant.ProjectLib.CHANGES_KEY, + new CompareUtils().compareToJson(thisProject, lastProject,null)); + ProcessDetailReq req = new ProcessDetailReq(); + req.setProjectId(lastProject.getId()); + req.setInstanceId(lastProject.getInstCode()); + res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoCenterManage.getProcessDetail(req)); + return res; } } From d34186ac6e0ca9a1eb313992c1c0b5a8d83b4b25 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 25 Jul 2023 15:48:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=20=E5=92=8C=20=E5=BD=93=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 7 +- .../pmapi/todocenter/manage/HandlerManage.java | 2 +- .../pmapi/todocenter/manage/TodoCenterManage.java | 2 +- .../pmapi/todocenter/service/ITodoService.java | 19 +++ .../todocenter/service/impl/TodoServiceImpl.java | 128 +++++++++++++++++++++ 5 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 9065a85..52bf8a9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -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.ProjectLibListItemVO; 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.service.ITodoService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; @@ -69,7 +69,6 @@ import com.wflow.workflow.bean.vo.ProcessDetailVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -113,7 +112,7 @@ public class ProjectLibManage { private final IPaymentPlanService paymentPlanService; - private final TodoCenterManage todoCenterManage; + private final ITodoService todoService; public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -1195,7 +1194,7 @@ public class ProjectLibManage { ProcessDetailReq req = new ProcessDetailReq(); req.setProjectId(lastProject.getId()); req.setInstanceId(lastProject.getInstCode()); - res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoCenterManage.getProcessDetail(req)); + res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoService.getProcessDetail(req)); return res; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 04ad446..bc72d51 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -479,7 +479,7 @@ public class HandlerManage { * @param taskId * @return */ - public Boolean checkIsContainsTask(List progressNodes, String taskId) { + public static Boolean checkIsContainsTask(List progressNodes, String taskId) { if(CollUtil.isEmpty(progressNodes)){ return Boolean.FALSE; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 404d13c..8ba8ec0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -599,7 +599,7 @@ public class TodoCenterManage { .equals(userFullInfoDTO.getEmpPosUnitCode())){ //说明是此单位的人 //那么要去看 taskId 是不是 在这个单位内的任务 - Boolean isContainsTask = handlerManage.checkIsContainsTask(children,taskId); + Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); if(isContainsTask){ res[0] = Boolean.TRUE; return; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java new file mode 100644 index 0000000..5c8c530 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/ITodoService.java @@ -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) ; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java new file mode 100644 index 0000000..34cd985 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java @@ -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 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 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 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]; + } +} From d4d02e75362cae7b67a267cabaf84b6891c8ea77 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 25 Jul 2023 15:51:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=20=E5=92=8C=20=E5=BD=93=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E8=AE=B0=E5=BD=95=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todocenter/service/impl/TodoServiceImpl.java | 42 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java index 34cd985..e5a0490 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java @@ -1,8 +1,12 @@ package com.ningdatech.pmapi.todocenter.service.impl; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; +import com.ningdatech.pmapi.projectlib.service.IProjectInstService; +import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.todocenter.handle.PassHandle; import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; import com.ningdatech.pmapi.todocenter.manage.HandlerManage; @@ -46,7 +50,9 @@ public class TodoServiceImpl implements ITodoService { private final PassHandle passHandle; - private final ProjectLibManage projectLibManage; + private final IProjectService projectService; + + private final IProjectInstService projectInstService; /** * 查询流程表单数据及审批的进度步骤 @@ -80,7 +86,7 @@ public class TodoServiceImpl implements ITodoService { res.setIsHighLine(isHighLine); passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res); //是不是被 驳回|退回 - res.setIsChange(projectLibManage.isChangeRecord(projectId)); + res.setIsChange(isChangeRecord(projectId)); return res; } @@ -125,4 +131,34 @@ public class TodoServiceImpl implements ITodoService { }); return res[0]; } + + /** + * 判断 当前项目是不是被驳回 或者 退回过 + * @param projectId + * @return + */ + private Boolean isChangeRecord(Long projectId) { + //1.先判断下 项目存不存在 + Project project = projectService.getById(projectId); + if(Objects.isNull(project)){ + return Boolean.FALSE; + } + + List projectIds = projectService.getAllVersionProjectId(project); + //2.要判断 项目在当前状态 有没有被驳回和退回过 + //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 + List pis = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIds) + .orderByDesc(ProjectInst::getInstType) + .last("limit 2")); + if(CollUtil.isEmpty(pis)){ + return Boolean.FALSE; + } + if( pis.size() < 2 || + !pis.get(0).getInstType().equals(pis.get(1).getInstType())) { + return Boolean.FALSE; + } + + return Boolean.TRUE; + } }