CMM 1 rok temu
rodzic
commit
ce650e7d11
2 zmienionych plików z 59 dodań i 0 usunięć
  1. +56
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java

+ 56
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Wyświetl plik

@@ -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 -> {


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java Wyświetl plik

@@ -155,6 +155,9 @@ public class ProjectLibListItemVO {

//预审申报时候 需不需要上传上级条线意见文件
private Boolean needUploadSuperLineFile;

@ApiModelProperty("年度投资金额总额")
private BigDecimal annualAccumulateAmount;
public Boolean getNeedUploadSuperLineFile() {
UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail();
//要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审


Ładowanie…
Anuluj
Zapisz