From 7ae675ebbea3de1be064f341b9ea3d5940ed56bd Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 14 Aug 2023 11:55:09 +0800 Subject: [PATCH] wps --- .../pmapi/projectlib/manage/ProjectLibManage.java | 56 ++++++++++++++++++++++ .../projectlib/model/vo/ProjectLibListItemVO.java | 3 ++ 2 files changed, 59 insertions(+) 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 ddf7ba1..f5c7549 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 @@ -47,6 +47,7 @@ import com.ningdatech.pmapi.projectdeclared.service.*; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.projectlib.constant.ProjectConstant; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; @@ -135,6 +136,22 @@ public class ProjectLibManage { if ((total = page.getTotal()) == 0) { return PageVo.empty(); } + + //已验收项目ID + List acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) + .map(Project::getId).collect(Collectors.toList()); + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(acceptedProjectId)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectId, acceptedProjectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); + } + + Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -153,6 +170,12 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if(finalRenewalMap.containsKey(item.getId())){ + List prfs = finalRenewalMap.get(item.getId()); + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); + }else{ + item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); + } return item; }); return PageVo.of(records, total); @@ -188,6 +211,21 @@ public class ProjectLibManage { Map> finalTagMap = tagMap; Map finalTagNameMap = tagNameMap; + //已验收项目ID + List acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) + .map(Project::getId).collect(Collectors.toList()); + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(acceptedProjectId)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectId, acceptedProjectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); + } + + Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -216,11 +254,25 @@ public class ProjectLibManage { item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); setTag(item,finalTagMap,finalTagNameMap); + if(finalRenewalMap.containsKey(item.getId())){ + List prfs = finalRenewalMap.get(item.getId()); + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); + }else{ + item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); + } return item; }); return PageVo.of(records, total); } + private BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { + BigDecimal res = cuurentAmount; + for(ProjectRenewalFundDeclaration prf : prfs){ + res = res.add(prf.getAnnualPaymentAmount()); + } + return res; + } + private void setTag(ProjectLibListItemVO item, Map> finalTagMap, Map finalTagNameMap) { if(finalTagMap.containsKey(item.getProjectCode())){ List tags = Lists.newArrayList(); @@ -339,6 +391,8 @@ public class ProjectLibManage { .build()); List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> declarations.forEach(declaration -> { @@ -467,6 +521,8 @@ public class ProjectLibManage { .build()); List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> declarations.forEach(declaration -> { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java index 400263c..73eea9f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java @@ -155,6 +155,9 @@ public class ProjectLibListItemVO { //预审申报时候 需不需要上传上级条线意见文件 private Boolean needUploadSuperLineFile; + + @ApiModelProperty("年度投资金额总额") + private BigDecimal annualAccumulateAmount; public Boolean getNeedUploadSuperLineFile() { UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); //要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审