|
|
@@ -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<Long> acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) |
|
|
|
.map(Project::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
if(CollUtil.isNotEmpty(acceptedProjectId)){ |
|
|
|
List<ProjectRenewalFundDeclaration> 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<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap; |
|
|
|
List<ProjectLibListItemVO> 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<ProjectRenewalFundDeclaration> 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<String, List<ProjectTag>> finalTagMap = tagMap; |
|
|
|
Map<Long,String> finalTagNameMap = tagNameMap; |
|
|
|
|
|
|
|
//已验收项目ID |
|
|
|
List<Long> acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) |
|
|
|
.map(Project::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
if(CollUtil.isNotEmpty(acceptedProjectId)){ |
|
|
|
List<ProjectRenewalFundDeclaration> 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<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap; |
|
|
|
List<ProjectLibListItemVO> 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<ProjectRenewalFundDeclaration> 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<ProjectRenewalFundDeclaration> prfs) { |
|
|
|
BigDecimal res = cuurentAmount; |
|
|
|
for(ProjectRenewalFundDeclaration prf : prfs){ |
|
|
|
res = res.add(prf.getAnnualPaymentAmount()); |
|
|
|
} |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) { |
|
|
|
if(finalTagMap.containsKey(item.getProjectCode())){ |
|
|
|
List<TagVO> tags = Lists.newArrayList(); |
|
|
@@ -339,6 +391,8 @@ public class ProjectLibManage { |
|
|
|
.build()); |
|
|
|
List<ProjectRenewalFundDeclaration> 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<ProjectRenewalFundDeclaration> 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 -> { |
|
|
|