diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java index 7f7dae5..211df2f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java @@ -46,6 +46,12 @@ public class ProjectLibController { return projectLibManage.projectLibListWithPermission(req,user); } + @GetMapping("/history-list/{id}") + @ApiOperation("项目历史版本列表") + public List historyProjects(@PathVariable Long id) { + return projectLibManage.historyProjects(id); + } + @GetMapping("/application/list") @ApiOperation("应用列表") public PageVo applicationList(ProjectApplicationListReq req) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 51729ff..a5a63b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -817,4 +817,29 @@ public class ProjectLibManage { }) .collect(Collectors.toList()); } + + /** + * 历史版本 项目列表 + * @param id + * @return + */ + public List historyProjects(Long id) { + Project project = projectService.getById(id); + + if(Objects.isNull(project)){ + return Collections.emptyList(); + } + + List historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectCode, project.getProjectCode()) + .orderByDesc(Project::getCreateOn)); + + if(CollUtil.isEmpty(historyProjects)){ + return Collections.emptyList(); + } + + return historyProjects.stream() + .map(p -> BeanUtil.copyProperties(p,ProjectDetailVO.class)) + .collect(Collectors.toList()); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index 2a9e516..994889d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectlib.model.vo; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.util.BizUtils; import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; @@ -367,6 +368,18 @@ public class ProjectDetailVO { @ApiModelProperty("初审人员") private List acceptancePersons; + @ApiModelProperty("版本号str") + private String versionStr; + + public String getVersionStr() { + if (Objects.nonNull(this.newest) && this.newest) { + this.versionStr = "当前版本"; + return this.versionStr; + } + this.versionStr = "v" + NdDateUtils.format(this.createOn,"yyyyMMddHHmmss"); + return this.versionStr; + } + public String getProjectTypeName() { if (Objects.nonNull(this.projectType)) {