Browse Source

modify:

1. 工作台项目库查询修改;
tags/24110101
WendyYang 1 month ago
parent
commit
e2958b5c29
6 changed files with 129 additions and 16 deletions
  1. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java
  2. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java
  3. +37
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/WorkbenchProjectLibSystemReplaceInfoVO.java
  4. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectGovSystemReplaceInfosService.java
  5. +70
    -16
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java
  6. +12
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java

+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java View File

@@ -13,6 +13,8 @@ public class ExistsSqlConst {
private ExistsSqlConst() {
}

public static final String PROJECT_EXISTS_SYSTEM_REPLACE_INFOS = "select 1 from nd_project_gov_system_replace_infos npgsri where npgsri.project_code = nd_project.project_code ";

public static final String PURCHASE_EXISTS_PROJECT = " select 1 from nd_project np where np.id = nd_purchase.project_id ";

public static final String PROJECT_EXISTS_PURCHASE = " select 1 from nd_purchase np where nd_project.id = np.project_id ";


+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java View File

@@ -188,4 +188,6 @@ public class ProjectLibListItemVO {
@ApiModelProperty("建设方案盖章件")
private String constructionPlanSealFile;

private List<WorkbenchProjectLibSystemReplaceInfoVO> referSystemReplaceInfos;

}

+ 37
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/WorkbenchProjectLibSystemReplaceInfoVO.java View File

@@ -0,0 +1,37 @@
package com.hz.pm.api.projectlib.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

/**
* <p>
* WorkbenchProjectLibSystemReplaceInfoVO
* </p>
*
* @author WendyYang
* @since 15:49 2024/10/30
*/
@Data
@Builder
public class WorkbenchProjectLibSystemReplaceInfoVO {

@ApiModelProperty("替代前系统名称")
private String sourceSystem;

@ApiModelProperty("被替代系统名称")
private String targetSystem;

@ApiModelProperty("替代方式")
private String replaceType;

@ApiModelProperty("替代前系统id")
private String sourceSystemId;

@ApiModelProperty("是否在主系统替代信息中")
private Boolean isInMhSystemReplaceInfos;

@ApiModelProperty("标段状态")
private Integer referBidStatus;

}

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectGovSystemReplaceInfosService.java View File

@@ -26,6 +26,12 @@ public interface IProjectGovSystemReplaceInfosService extends IService<ProjectGo
return list(wrapper);
}

default List<ProjectGovSystemReplaceInfos> listByProjectCodes(List<String> projectCodes) {
Wrapper<ProjectGovSystemReplaceInfos> wrapper = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
.in(ProjectGovSystemReplaceInfos::getProjectCode, projectCodes);
return list(wrapper);
}

default List<ProjectGovSystemReplaceInfos> listByBidIds(Collection<Long> bidIds) {
Wrapper<ProjectGovSystemReplaceInfos> wrapper = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
.in(ProjectGovSystemReplaceInfos::getBidId, bidIds);


+ 70
- 16
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -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));


+ 12
- 0
hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java View File

@@ -49,4 +49,16 @@ public class WorkbenchProjectLibReq extends PagePo {
@ApiModelProperty("批复金额")
private BigDecimal approveAmountMax;

@ApiModelProperty("项目状态")
private Integer status;

@ApiModelProperty("标段状态")
private Integer bidStatus;

@ApiModelProperty("改造前系统名称")
private String sourceSystem;

@ApiModelProperty("是否计划内系统")
private Boolean isInMhSystemReplaceInfos;

}

Loading…
Cancel
Save