|
|
@@ -413,6 +413,79 @@ public class ConstructionManage { |
|
|
|
return PageVo.of(records, total); |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> xcfhxProjectList(ProjectListReq req) { |
|
|
|
UserInfoDetails user = LoginUserUtil.loginUserDetail(); |
|
|
|
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
//建设中状态 |
|
|
|
query.eq(Project::getStatus, ProjectStatusEnum.ON_FIRST_INSPECTED.getCode()); |
|
|
|
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); |
|
|
|
query.eq(Project::getNewest, Boolean.TRUE); |
|
|
|
//只能看自己单位的 |
|
|
|
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); |
|
|
|
query.orderByAsc(Project::getDeliveryTime); |
|
|
|
Page<Project> page = projectService.page(req.page(), query); |
|
|
|
long total; |
|
|
|
if ((total = page.getTotal()) == 0) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<Long> projectIds = new ArrayList<>(); |
|
|
|
for (Project project : page.getRecords()) { |
|
|
|
projectIds.add(project.getId()); |
|
|
|
} |
|
|
|
List<Purchase> purchases = purchaseService.listByProjectIds(projectIds); |
|
|
|
Map<Long, List<Purchase>> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId); |
|
|
|
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds); |
|
|
|
Map<Long, List<ProjectAnnualPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); |
|
|
|
|
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
|
item.setProjectName(w.getProjectName()); |
|
|
|
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.setApprovedAmount(w.getApprovalAmount()); |
|
|
|
item.setApprovalDate(w.getApprovalDate()); |
|
|
|
item.setDeliveryTime(w.getDeliveryTime()); |
|
|
|
item.setContractAmount(w.getContractAmount()); |
|
|
|
List<ProjectAnnualPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); |
|
|
|
BigDecimal totalAnnualAmount = paymentPlans.stream() |
|
|
|
.map(ProjectAnnualPaymentPlan::getAnnualPlanAmount) |
|
|
|
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO); |
|
|
|
item.setAnnualPlanAmount(totalAnnualAmount); |
|
|
|
item.setTransactionTime(w.getTransactionTime()); |
|
|
|
item.setTransactionAmount(w.getTransactionAmount()); |
|
|
|
List<Purchase> currPurchases = purchaseMap.get(w.getId()); |
|
|
|
if (currPurchases != null) { |
|
|
|
List<TenderListInfoVO> tmpPurchases = CollUtils.convert(currPurchases, x -> { |
|
|
|
TenderListInfoVO tender = new TenderListInfoVO(); |
|
|
|
tender.setBidName(x.getBidName()); |
|
|
|
tender.setBidId(x.getId()); |
|
|
|
tender.setBidStatus(x.getStatus()); |
|
|
|
tender.setBidStatusName(TenderStatusEnum.getDescByStatus(x.getStatus())); |
|
|
|
Contract contract = contractMap.get(x.getId()); |
|
|
|
if (contract != null) { |
|
|
|
tender.setConstructionAmount(contract.getTotalAmount()); |
|
|
|
} |
|
|
|
return tender; |
|
|
|
}); |
|
|
|
item.setTenders(tmpPurchases); |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return PageVo.of(records, total); |
|
|
|
} |
|
|
|
|
|
|
|
public void exportPreList(HttpServletResponse response, ProjectListReq param) { |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); |
|
|
|