|
@@ -269,6 +269,98 @@ public class ProjectLibManage { |
|
|
return PageVo.of(records, page.getTotal()); |
|
|
return PageVo.of(records, page.getTotal()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 项目申报和项目归集的并集 |
|
|
|
|
|
* @param req |
|
|
|
|
|
* @param user |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public PageVo<ProjectLibListItemVO> projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { |
|
|
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
|
|
user = buildProjectLibPermission(query, user); |
|
|
|
|
|
//项目查最新 |
|
|
|
|
|
query.eq(Project::getNewest, Boolean.TRUE); |
|
|
|
|
|
Page<Project> page = projectService.page(req.page(), query); |
|
|
|
|
|
long total; |
|
|
|
|
|
if (CollUtil.isEmpty(page.getRecords())) { |
|
|
|
|
|
return PageVo.empty(); |
|
|
|
|
|
} |
|
|
|
|
|
UserFullInfoDTO finalUser = user; |
|
|
|
|
|
|
|
|
|
|
|
Set<String> projectCodes = page.getRecords().stream() |
|
|
|
|
|
.map(Project::getProjectCode).collect(Collectors.toSet()); |
|
|
|
|
|
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) |
|
|
|
|
|
.in(ProjectTag::getProjectCode, projectCodes)); |
|
|
|
|
|
Map<String,List<ProjectTag>> tagMap = Maps.newHashMap(); |
|
|
|
|
|
Map<Long,String> tagNameMap = Maps.newHashMap(); |
|
|
|
|
|
if(CollUtil.isNotEmpty(pts)){ |
|
|
|
|
|
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); |
|
|
|
|
|
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); |
|
|
|
|
|
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) |
|
|
|
|
|
.in(Tag::getId, tagIds)); |
|
|
|
|
|
if(CollUtil.isNotEmpty(tags)){ |
|
|
|
|
|
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Map<String, List<ProjectTag>> finalTagMap = tagMap; |
|
|
|
|
|
Map<Long,String> finalTagNameMap = tagNameMap; |
|
|
|
|
|
|
|
|
|
|
|
//已验收项目编号 |
|
|
|
|
|
List<String> acceptedProjectCode = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) |
|
|
|
|
|
.map(Project::getProjectCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
|
|
if(CollUtil.isNotEmpty(acceptedProjectCode)){ |
|
|
|
|
|
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
|
|
|
.in(ProjectRenewalFundDeclaration::getProjectCode, acceptedProjectCode) |
|
|
|
|
|
.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()); |
|
|
|
|
|
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()); |
|
|
|
|
|
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()); |
|
|
|
|
|
setTag(item,finalTagMap,finalTagNameMap); |
|
|
|
|
|
if(finalRenewalMap.containsKey(item.getId())){ |
|
|
|
|
|
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); |
|
|
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); |
|
|
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); |
|
|
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); |
|
|
|
|
|
} |
|
|
|
|
|
return item; |
|
|
|
|
|
}); |
|
|
|
|
|
return PageVo.of(records, page.getTotal()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private BigDecimal computeAmount(BigDecimal cuurentAmount,List<ProjectRenewalFundDeclaration> prfs) { |
|
|
private BigDecimal computeAmount(BigDecimal cuurentAmount,List<ProjectRenewalFundDeclaration> prfs) { |
|
|
BigDecimal res = cuurentAmount; |
|
|
BigDecimal res = cuurentAmount; |
|
|
for(ProjectRenewalFundDeclaration prf : prfs){ |
|
|
for(ProjectRenewalFundDeclaration prf : prfs){ |
|
|