diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 01b91b3..488d3eb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -147,31 +147,34 @@ public class ProjectFileManage { vo.setProjectName(p.getProjectName()); // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode,employeeCode) .eq(ProjectApplyBorrow::getProjectId, p.getId()) .orderByDesc(ProjectApplyBorrow::getCreateOn) .last("limit 1")); - String instCode = projectApplyBorrow.getInstanceId(); - // 获取流程实例 - HistoricProcessInstance newInstance = - historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); - ProjectInst projectInst = projectInstService - .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); - // 推送省局联审的项目流程实例为EMPTY - if (Objects.nonNull(projectInst)) { - Integer instType = projectInst.getInstType(); - // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 - ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers - .lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) - .eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); - // 延期申请流程还未审核结束 - if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) - && Objects.isNull(newInstance.getEndActivityId())) { - vo.setCanApplyBorrow(Boolean.FALSE); - } - // 如果是延期申请审核被驳回,设置项目可以申请延期申报 - else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && - HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { - vo.setCanApplyBorrow(Boolean.TRUE); + if (Objects.nonNull(projectApplyBorrow)) { + String instCode = projectApplyBorrow.getInstanceId(); + // 获取流程实例 + HistoricProcessInstance newInstance = + historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); + ProjectInst projectInst = projectInstService + .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); + // 推送省局联审的项目流程实例为EMPTY + if (Objects.nonNull(projectInst)) { + Integer instType = projectInst.getInstType(); + // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 + ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers + .lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) + .eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); + // 延期申请流程还未审核结束 + if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) + && Objects.isNull(newInstance.getEndActivityId())) { + vo.setCanApplyBorrow(Boolean.FALSE); + } + // 如果是延期申请审核被驳回,设置项目可以申请延期申报 + else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && + HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { + vo.setCanApplyBorrow(Boolean.TRUE); + } } } return vo; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java index b06e90c..c3aef15 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java @@ -143,23 +143,25 @@ public class DelayedApplyManage { .eq(ProjectDelayApply::getProjectId, w.getId()) .orderByDesc(ProjectDelayApply::getCreateOn) .last("limit 1")); - String instCode = delayApply.getInstanceId(); - // 获取流程实例 - HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instCode) - .singleResult(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode)); - Integer instType = projectInst.getInstType(); - // 延期申请流程还未审核结束 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && - Objects.isNull(newInstance.getEndActivityId())){ - item.setCanDelayApply(Boolean.FALSE); - } - // 如果是延期申请审核被驳回,设置项目可以申请延期申报 - else if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && - HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { - item.setCanDelayApply(Boolean.TRUE); + if (Objects.nonNull(delayApply)) { + String instCode = delayApply.getInstanceId(); + // 获取流程实例 + HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instCode) + .singleResult(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode)); + Integer instType = projectInst.getInstType(); + // 延期申请流程还未审核结束 + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && + Objects.isNull(newInstance.getEndActivityId())) { + item.setCanDelayApply(Boolean.FALSE); + } + // 如果是延期申请审核被驳回,设置项目可以申请延期申报 + else if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && + HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { + item.setCanDelayApply(Boolean.TRUE); + } } return item; });