Browse Source

建设方案申报修改

master
CMM 1 year ago
parent
commit
b756553444
1 changed files with 24 additions and 8 deletions
  1. +24
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java

+ 24
- 8
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -214,6 +214,12 @@ public class ProjectLibManage {
String employeeCode, Project oldProject) {

Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject);
// 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表
LambdaUpdateWrapper<Project> updateWrapper = Wrappers.lambdaUpdate(Project.class);
updateWrapper.set(Project::getStage,null)
.set(Project::getStatus,null)
.eq(Project::getId,oldProject.getId());
projectService.update(updateWrapper);
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
@@ -320,6 +326,7 @@ public class ProjectLibManage {
project.setIsConstruct(Boolean.TRUE);
// 保存初步方案项目ID
if (Boolean.TRUE.equals(oldProject.getIsConstruct())){
// 重新提交
project.setPrePlanProjectId(oldProject.getPrePlanProjectId());
}else {
project.setPrePlanProjectId(oldProject.getId());
@@ -329,8 +336,8 @@ public class ProjectLibManage {
// 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,oldProject.getId())
.eq(Project::getProjectCode,oldProject.getProjectCode()));
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
}else{
//否则是被驳回,重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto);
@@ -344,9 +351,15 @@ public class ProjectLibManage {
//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
List<Long> projectIdList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, oldProject.getProjectCode())
.eq(Project::getIsConstruct, Boolean.TRUE)).stream()
.map(Project::getId).collect(Collectors.toList());
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
.eq(ProjectApplication::getProjectCode,oldProject.getProjectCode())
.in(ProjectApplication::getProjectId,projectIdList));

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
@@ -460,11 +473,14 @@ public class ProjectLibManage {
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));

//采取批量删除 批量添加的方式
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
List<Long> projectIdList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, project.getProjectCode())
.eq(Project::getIsConstruct, Boolean.TRUE)).stream()
.map(Project::getId).collect(Collectors.toList());
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode()));
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.in(ProjectApplication::getProjectId,projectIdList));

//app
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();


Loading…
Cancel
Save