From adc341a4552d5c53c6aaf23f0a734d28fea06904 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 22 Nov 2023 15:44:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 61 +++++++++++++++++++++- .../pmapi/workbench/manage/WorkbenchManage.java | 5 +- 2 files changed, 61 insertions(+), 5 deletions(-) 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 2df0300..9bda063 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 @@ -297,8 +297,6 @@ public class ProjectLibManage { } UserFullInfoDTO finalUser = user; - Set projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toSet()); Set instCodes = page.getRecords().stream() .map(Project::getInstCode).collect(Collectors.toSet()); List tasks = taskService.createTaskQuery() @@ -542,6 +540,65 @@ public class ProjectLibManage { return PageVo.of(records, page.getTotal()); } + public PageVo listWithPermissionWorkbentch(ProjectListReq req, + UserFullInfoDTO user) { + req = buildProjectLibPermission(req,user); + Page page = projectService.pagelibWithPermission(req.page(), req); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set instCodes = page.getRecords().stream() + .map(ProjectPO::getInstCode).collect(Collectors.toSet()); + List tasks = taskService.createTaskQuery() + .processInstanceIdIn(instCodes) + .orderByTaskCreateTime() + .asc() + .list(); + Map> map = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(tasks)){ + map = tasks.stream() + .collect(Collectors.groupingBy(Task::getProcessInstanceId)); + userMap = searchUser(tasks,userInfoHelper); + } + + List records = Lists.newArrayList(); + for(ProjectPO w : page.getRecords()){ + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + item.setCanPreDeclared(Boolean.TRUE); + } + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + item.setPrePlanProjectId(w.getPrePlanProjectId()); + records.add(item); + } + return PageVo.of(records, page.getTotal()); + } + public static BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; for(ProjectRenewalFundDeclaration prf : prfs){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java index 9da1750..99398f4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java @@ -115,10 +115,9 @@ public class WorkbenchManage { //这个不能放入子线程 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setPageNumber(1); - projectListReq.setPageSize(5); + projectListReq.setPageSize(2000); projectListReq.setProjectYear(year); - projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); - res.setProjects(new ArrayList<>(projectLibManage.projectLibListApprove(projectListReq, user).getRecords())); + res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq,user).getRecords())); return res; }