Browse Source

modify:

1. 获取复核通过的项目;
tags/24110701
WendyYang 3 weeks ago
parent
commit
5c4f96d505
5 changed files with 226 additions and 2 deletions
  1. +15
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiProjectLibController.java
  2. +113
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java
  3. +27
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/open/model/po/ReviewPassProjectListPO.java
  4. +37
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/open/model/vo/ReferSystemReplaceInfoToMhVO.java
  5. +34
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/open/model/vo/ReviewPassProjectInfoToMhVO.java

+ 15
- 2
hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiProjectLibController.java View File

@@ -1,8 +1,14 @@
package com.hz.pm.api.open.controller;

import com.hz.pm.api.open.manage.OpenApiProjectLibManage;
import com.hz.pm.api.open.model.po.ReviewPassProjectListPO;
import com.hz.pm.api.open.model.vo.ReviewPassProjectInfoToMhVO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
@@ -17,5 +23,12 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/open/api/projectLib")
public class OpenApiProjectLibController {

private final OpenApiProjectLibManage openApiProjectLibManage;

@PostMapping("/listReviewPassProject")
@ApiOperation("获取已复核通过的项目列表")
public List<ReviewPassProjectInfoToMhVO> listReviewPassProject(@RequestBody @Valid ReviewPassProjectListPO po) {
return openApiProjectLibManage.listReviewPassProject(po);
}

}

+ 113
- 0
hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java View File

@@ -0,0 +1,113 @@
package com.hz.pm.api.open.manage;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.ExistsSqlConst;
import com.hz.pm.api.common.util.BizDateUtil;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.open.model.po.ReviewPassProjectListPO;
import com.hz.pm.api.open.model.vo.ReviewPassProjectInfoToMhVO;
import com.hz.pm.api.open.model.vo.ReferSystemReplaceInfoToMhVO;
import com.hz.pm.api.open.util.OpenApiCheckSignUtil;
import com.hz.pm.api.projectlib.entity.MhSystemReplaceInfo;
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.service.IMhSystemReplaceInfoService;
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.ningdatech.basic.util.CollUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* <p>
* OpenApiProjectLibManage
* </p>
*
* @author WendyYang
* @since 10:22 2024/11/7
*/
@Component
@RequiredArgsConstructor
public class OpenApiProjectLibManage {

private final OpenApiCheckSignUtil openApiCheckSignUtil;
private final IProjectService projectService;
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService;
private final IMhSystemReplaceInfoService mhSystemReplaceInfoService;

/**
* 获取已复核通过的项目列表
*
* @param po 参数
* @return 复核通过的项目
*/
public List<ReviewPassProjectInfoToMhVO> listReviewPassProject(ReviewPassProjectListPO po) {
openApiCheckSignUtil.checkSign(po.getKey());
StringBuilder sql = new StringBuilder(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE)
.append(" and npsc.event = 'PROJECT_REVIEW_PASS'");
if (po.getReviewPassTime() != null) {
sql.append(String.format(" and npsc.create_on >= '%s'", BizDateUtil.toDateStr(po.getReviewPassTime())));
}
Wrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.select(Project::getProjectCode, Project::getProjectName, Project::getBuildOrgCode, Project::getBuildOrgName)
.exists(sql.toString())
.eq(Project::getNewest, Boolean.TRUE)
.notIn(Project::getStage, ProjectStatus.CHANGE.getCode(), ProjectStatus.STOPPED.getCode())
.orderByDesc(Project::getCreateOn);
List<Project> projects = projectService.list(query);
if (projects.isEmpty()) {
return Collections.emptyList();
}
List<String> projectCodes = CollUtils.fieldList(projects, Project::getProjectCode);
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.listByProjectCodes(projectCodes);
replaceInfos.removeIf(w -> StrUtil.isBlank(w.getSourceSystemId()));
Map<String, List<MhSystemReplaceInfo>> replaceInfoMap;
if (!replaceInfos.isEmpty()) {
List<String> sourceSystemIds = CollUtils.fieldList(replaceInfos, ProjectGovSystemReplaceInfos::getSourceSystemId);
List<MhSystemReplaceInfo> mhSystemReplaceInfos = mhSystemReplaceInfoService.listByIds(sourceSystemIds);
Map<String, MhSystemReplaceInfo> mhReplaceInfoMap = CollUtils.listToMap(mhSystemReplaceInfos, MhSystemReplaceInfo::getId);
replaceInfoMap = replaceInfos.stream()
.filter(w -> mhReplaceInfoMap.containsKey(w.getSourceSystemId()))
.collect(Collectors.groupingBy(ProjectGovSystemReplaceInfos::getProjectCode,
Collectors.mapping(w -> mhReplaceInfoMap.get(w.getSourceSystemId()), Collectors.toList())));
} else {
replaceInfoMap = Collections.emptyMap();
}

return projects.stream().map(w -> {
ReviewPassProjectInfoToMhVO item = new ReviewPassProjectInfoToMhVO();
item.setProjectCode(w.getProjectCode());
item.setProjectName(w.getProjectName());
item.setBuildOrgCode(w.getBuildOrgCode());
item.setBuildOrgName(w.getBuildOrgName());
List<MhSystemReplaceInfo> replaceInfoList = replaceInfoMap.get(w.getProjectCode());
if (replaceInfoList != null) {
List<ReferSystemReplaceInfoToMhVO> referSystemList = CollUtils.convert(replaceInfoList,
t -> ReferSystemReplaceInfoToMhVO.builder()
.id(t.getId())
.buildOrgCode(t.getBuildOrgCode())
.buildOrgName(t.getBuildOrgName())
.systemName(t.getSourceName())
.alternativeName(t.getTargetName())
.alternativeType(t.getReplaceType())
.build());
item.setReferSystemList(referSystemList);
} else {
item.setReferSystemList(Collections.emptyList());
}
return item;
}).collect(Collectors.toList());
}


}

+ 27
- 0
hz-pm-api/src/main/java/com/hz/pm/api/open/model/po/ReviewPassProjectListPO.java View File

@@ -0,0 +1,27 @@
package com.hz.pm.api.open.model.po;

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

import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;

/**
* <p>
* ReviewPassProjectListPO
* </p>
*
* @author WendyYang
* @since 10:59 2024/11/7
*/
@Data
public class ReviewPassProjectListPO {

@ApiModelProperty("校验公钥")
@NotBlank(message = "秘钥不能为空")
private String key;

@ApiModelProperty("复核通过时间")
private LocalDateTime reviewPassTime;

}

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

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

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

/**
* <p>
* ReferSystemReplaceInfoToMhVO
* </p>
*
* @author WendyYang
* @since 10:17 2024/11/7
*/
@Data
@Builder
public class ReferSystemReplaceInfoToMhVO {

@ApiModelProperty("底账ID")
private String id;

@ApiModelProperty("建设单位编码")
private Integer buildOrgCode;

@ApiModelProperty("建设单位名称")
private String buildOrgName;

@ApiModelProperty("系统名称")
private String systemName;

@ApiModelProperty("替代后系统名称")
private String alternativeName;

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

}

+ 34
- 0
hz-pm-api/src/main/java/com/hz/pm/api/open/model/vo/ReviewPassProjectInfoToMhVO.java View File

@@ -0,0 +1,34 @@
package com.hz.pm.api.open.model.vo;

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

import java.util.List;

/**
* <p>
* ProjectInfoToMhVO
* </p>
*
* @author WendyYang
* @since 10:14 2024/11/7
*/
@Data
public class ReviewPassProjectInfoToMhVO {

@ApiModelProperty("项目编码")
private String projectCode;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("建设单位编码")
private String buildOrgCode;

@ApiModelProperty("建设单位名称")
private String buildOrgName;

@ApiModelProperty("项目系统列表")
private List<ReferSystemReplaceInfoToMhVO> referSystemList;

}

Loading…
Cancel
Save