From 207f717a7cc41c4e5db4e07cdb8c617527d9eae2 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Fri, 14 Jul 2023 10:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E6=96=B9=E6=A1=88=E7=94=B3?= =?UTF-8?q?=E6=8A=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/ConstructionPlanManage.java | 2 +- .../pmapi/projectlib/manage/ProjectLibManage.java | 38 ++++++++++++++++++---- .../pmapi/projectlib/model/entity/Project.java | 3 ++ .../projectlib/model/vo/ProjectLibListItemVO.java | 6 ++++ 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index f1b75ac..1cbab70 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -168,7 +168,7 @@ public class ConstructionPlanManage { log.info("建设方案项目申报成功 【{}】", instanceId); // 保存建设项目相关 - Project buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode); + Project buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject); //发送给第一个审批人消息 noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, 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 6fc6f63..617a738 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 @@ -4,10 +4,10 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; @@ -19,7 +19,6 @@ import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.BizUtils; @@ -74,8 +73,6 @@ import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; -import static com.ningdatech.pmapi.irs.config.IrsSealPlatformProperties.projectId; - /** *

* ProjectLibManage @@ -170,6 +167,7 @@ public class ProjectLibManage { && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } + item.setPrePlanProjectId(w.getPrePlanProjectId()); return item; }); return PageVo.of(records, total); @@ -204,14 +202,36 @@ public class ProjectLibManage { /** * 建设方案申报项目时 保存项目信息和其它相关联的信息 + * * @param projectDto * @param instanceId * @param employeeCode + * @param oldProject * @return */ public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, - String employeeCode) { - Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode); + String employeeCode, Project oldProject) { + // 将旧的项目状态置为,版本置为不是最新 + oldProject.setNewest(Boolean.FALSE); + projectService.updateById(oldProject); + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Project.class); + updateWrapper.set(Project::getStage,null) + .set(Project::getStatus,null) + .eq(Project::getId,oldProject.getId()); + projectService.update(updateWrapper); + + Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject); + Long newProjectId = project.getId(); + // 关联旧的项目的审核实例到新的项目ID + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getProjectId, oldProject.getId())) + .stream().map(p -> { + p.setProjectId(newProjectId); + return p; + }).collect(Collectors.toList()); + projectInstService.updateBatchById(projectInstList); + //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -288,13 +308,15 @@ public class ProjectLibManage { /** * 建设方案申报项目时 保存项目信息和其它相关联的信息 + * * @param projectDto * @param instanceId * @param employeeCode + * @param oldProject * @return */ public Project saveConstructProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode) { + String employeeCode, Project oldProject) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { Project project = new Project(); @@ -311,6 +333,8 @@ public class ProjectLibManage { project.setProjectCode(projectCode); // 标记为建设方案申报 project.setIsConstruct(Boolean.TRUE); + // 保存初步方案项目ID + project.setPrePlanProjectId(oldProject.getId()); projectService.save(project); }else{ //否则是重新提交的 新生成一个新版本的项目 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index 175890d..a9f014d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -366,4 +366,7 @@ public class Project implements Serializable { @ApiModelProperty("是否为建设方案申报") private Boolean isConstruct; + + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java index 8cc1c39..375dc13 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java @@ -136,6 +136,12 @@ public class ProjectLibListItemVO { @ApiModelProperty("是否可以申请延期") private Boolean canDelayApply = Boolean.TRUE; + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; + //预审申报时候 需不需要上传上级条线意见文件 private Boolean needUploadSuperLineFile; public Boolean getNeedUploadSuperLineFile() {