|
|
@@ -41,6 +41,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.SystemReplaceInfoVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO.ProjectGovSystemReplaceVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.WorkbenchProjectLibSystemReplaceInfoVO; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; |
|
|
@@ -647,26 +648,67 @@ public class WorkbenchManage { |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<String> projectCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode); |
|
|
|
Map<Long, Integer> bidStatusMap = new HashMap<>(); |
|
|
|
Map<String, List<ProjectGovSystemReplaceInfos>> systemReplaceInfoMap = new HashMap<>(); |
|
|
|
fillSystemReplaceInfosAndReferBidStatus(projectCodes, systemReplaceInfoMap, bidStatusMap); |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), |
|
|
|
w -> ProjectLibListItemVO.builder() |
|
|
|
.id(w.getId()) |
|
|
|
.fromType("1") |
|
|
|
.projectName(w.getProjectName()) |
|
|
|
.projectCode(w.getProjectCode()) |
|
|
|
.projectType(w.getProjectType()) |
|
|
|
.projectYear(w.getProjectYear()) |
|
|
|
.buildOrg(w.getBuildOrgName()) |
|
|
|
.buildOrgCode(w.getBuildOrgCode()) |
|
|
|
.approvedAmount(w.getApprovalAmount()) |
|
|
|
.reviewAmount(w.getReviewAmount()) |
|
|
|
.declaredAmount(w.getDeclareAmount()) |
|
|
|
.createOn(w.getCreateOn()) |
|
|
|
.stage(w.getStage()) |
|
|
|
.status(w.getStatus()) |
|
|
|
.build()); |
|
|
|
w -> { |
|
|
|
ProjectLibListItemVO item = ProjectLibListItemVO.builder() |
|
|
|
.id(w.getId()) |
|
|
|
.fromType("1") |
|
|
|
.projectName(w.getProjectName()) |
|
|
|
.projectCode(w.getProjectCode()) |
|
|
|
.projectType(w.getProjectType()) |
|
|
|
.projectYear(w.getProjectYear()) |
|
|
|
.buildOrg(w.getBuildOrgName()) |
|
|
|
.buildOrgCode(w.getBuildOrgCode()) |
|
|
|
.approvedAmount(w.getApprovalAmount()) |
|
|
|
.reviewAmount(w.getReviewAmount()) |
|
|
|
.declaredAmount(w.getDeclareAmount()) |
|
|
|
.createOn(w.getCreateOn()) |
|
|
|
.stage(w.getStage()) |
|
|
|
.status(w.getStatus()) |
|
|
|
.build(); |
|
|
|
buildReferSystemReplaceInfos(systemReplaceInfoMap, bidStatusMap, item); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return PageVo.of(records, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
private void fillSystemReplaceInfosAndReferBidStatus(List<String> projectCodes, |
|
|
|
Map<String, List<ProjectGovSystemReplaceInfos>> systemReplaceInfoMap, |
|
|
|
Map<Long, Integer> bidStatusMap) { |
|
|
|
List<ProjectGovSystemReplaceInfos> systemReplaceInfos = systemReplaceInfosService.listByProjectCodes(projectCodes); |
|
|
|
if (CollUtil.isNotEmpty(systemReplaceInfos)) { |
|
|
|
systemReplaceInfoMap.putAll(CollUtils.group(systemReplaceInfos, ProjectGovSystemReplaceInfos::getProjectCode)); |
|
|
|
List<Long> bidIds = CollUtils.fieldList(systemReplaceInfos, ProjectGovSystemReplaceInfos::getBidId); |
|
|
|
if (CollUtil.isNotEmpty(bidIds)) { |
|
|
|
List<Purchase> purchases = purchaseService.listByIds(bidIds); |
|
|
|
for (Purchase purchase : purchases) { |
|
|
|
bidStatusMap.put(purchase.getId(), purchase.getStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void buildReferSystemReplaceInfos(Map<String, List<ProjectGovSystemReplaceInfos>> systemReplaceInfoMap, Map<Long, Integer> bidStatusMap, ProjectLibListItemVO item) { |
|
|
|
if (systemReplaceInfoMap.containsKey(item.getProjectCode())) { |
|
|
|
List<ProjectGovSystemReplaceInfos> currSystemReplaceInfos = systemReplaceInfoMap.get(item.getProjectCode()); |
|
|
|
currSystemReplaceInfos.sort(Comparator.comparing(ProjectGovSystemReplaceInfos::getBatchNo)); |
|
|
|
List<WorkbenchProjectLibSystemReplaceInfoVO> retSystemReplaceInfos = CollUtils.convert(currSystemReplaceInfos, |
|
|
|
w1 -> WorkbenchProjectLibSystemReplaceInfoVO.builder() |
|
|
|
.sourceSystem(w1.getSourceSystem()) |
|
|
|
.targetSystem(w1.getTargetSystem()) |
|
|
|
.replaceType(w1.getReplaceType()) |
|
|
|
.sourceSystemId(w1.getSourceSystemId()) |
|
|
|
.isInMhSystemReplaceInfos(StrUtil.isNotBlank(w1.getSourceSystemId())) |
|
|
|
.referBidStatus(bidStatusMap.get(w1.getBidId())) |
|
|
|
.build()); |
|
|
|
item.setReferSystemReplaceInfos(retSystemReplaceInfos); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public SystemReplaceInfoVO listSystemReplaceInfos(WorkbenchProjectLibReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = workbenchProjectLibQuery(req); |
|
|
|
if (query == null) { |
|
|
@@ -715,6 +757,7 @@ public class WorkbenchManage { |
|
|
|
return null; |
|
|
|
} |
|
|
|
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(req.getStatus() != null, Project::getStatus, req.getStatus()) |
|
|
|
.eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) |
|
|
|
.like(StrUtil.isNotBlank(req.getBuildOrg()), Project::getBuildOrgName, req.getBuildOrg()) |
|
|
|
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) |
|
|
@@ -723,8 +766,19 @@ public class WorkbenchManage { |
|
|
|
.ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin()) |
|
|
|
.le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax()) |
|
|
|
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) |
|
|
|
.exists(StrUtil.isNotBlank(req.getSourceSystem()), ExistsSqlConst.PROJECT_EXISTS_SYSTEM_REPLACE_INFOS |
|
|
|
+ " and source_system like {0}", StrUtil.format("%{}%", req.getSourceSystem())) |
|
|
|
.exists(req.getBidStatus() != null, ExistsSqlConst.PROJECT_EXISTS_PURCHASE |
|
|
|
+ " and status = {0}", req.getBidStatus()) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.orderByDesc(Project::getUpdateOn); |
|
|
|
if (req.getIsInMhSystemReplaceInfos() != null) { |
|
|
|
if (Boolean.TRUE.equals(req.getIsInMhSystemReplaceInfos())) { |
|
|
|
query.exists(ExistsSqlConst.PROJECT_EXISTS_SYSTEM_REPLACE_INFOS + " and LENGTH(NVL(source_system_id,'')) > 0"); |
|
|
|
} else { |
|
|
|
query.notExists(ExistsSqlConst.PROJECT_EXISTS_SYSTEM_REPLACE_INFOS + " and LENGTH(NVL(source_system_id,'')) > 0"); |
|
|
|
} |
|
|
|
} |
|
|
|
List<Long> unitIds = unitQueryState.getUnitIds(); |
|
|
|
if (CollUtil.isNotEmpty(unitIds)) { |
|
|
|
query.in(Project::getBuildOrgCode, CollUtils.convert(unitIds, String::valueOf)); |
|
|
|