|
|
@@ -64,6 +64,7 @@ import com.wflow.workflow.bean.vo.ProcessDetailVO; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.checkerframework.checker.nullness.qual.Nullable; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
@@ -213,16 +214,6 @@ public class ProjectLibManage { |
|
|
|
String employeeCode, Project oldProject) { |
|
|
|
|
|
|
|
Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject); |
|
|
|
|
|
|
|
// 将旧的项目状态、阶段置为null,版本置为不是最新 |
|
|
|
oldProject.setNewest(Boolean.FALSE); |
|
|
|
projectService.updateById(oldProject); |
|
|
|
|
|
|
|
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()); |
|
|
@@ -314,6 +305,8 @@ public class ProjectLibManage { |
|
|
|
//为空 代表是新申报的 |
|
|
|
if(Objects.isNull(projectDto.getId())){ |
|
|
|
BeanUtils.copyProperties(projectDto, project); |
|
|
|
// 被撤回重新申报的项目,项目ID要置空 |
|
|
|
project.setId(null); |
|
|
|
project.setCreateOn(LocalDateTime.now()); |
|
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
|
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); |
|
|
@@ -326,10 +319,20 @@ public class ProjectLibManage { |
|
|
|
// 标记为建设方案申报 |
|
|
|
project.setIsConstruct(Boolean.TRUE); |
|
|
|
// 保存初步方案项目ID |
|
|
|
project.setPrePlanProjectId(oldProject.getId()); |
|
|
|
if (Boolean.TRUE.equals(oldProject.getIsConstruct())){ |
|
|
|
project.setPrePlanProjectId(oldProject.getPrePlanProjectId()); |
|
|
|
}else { |
|
|
|
project.setPrePlanProjectId(oldProject.getId()); |
|
|
|
} |
|
|
|
projectService.save(project); |
|
|
|
|
|
|
|
// 将旧的项目版本置为不是最新 |
|
|
|
projectService.update(Wrappers.lambdaUpdate(Project.class) |
|
|
|
.set(Project::getNewest,Boolean.FALSE) |
|
|
|
.ne(Project::getId,oldProject.getId()) |
|
|
|
.eq(Project::getProjectCode,oldProject.getProjectCode())); |
|
|
|
}else{ |
|
|
|
//否则是重新提交的 新生成一个新版本的项目 |
|
|
|
//否则是被驳回,重新提交的 新生成一个新版本的项目 |
|
|
|
project = newProjectWithVersion(projectDto); |
|
|
|
if(Objects.nonNull(project)){ |
|
|
|
project.setInstCode(instanceId); |
|
|
@@ -341,6 +344,9 @@ public class ProjectLibManage { |
|
|
|
//保存项目应用 |
|
|
|
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) |
|
|
|
? Boolean.TRUE : Boolean.FALSE; |
|
|
|
//采取批量删除 批量添加的方式 |
|
|
|
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) |
|
|
|
.eq(ProjectApplication::getProjectId,project.getId())); |
|
|
|
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { |
|
|
|
Project finalProject = project; |
|
|
|
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { |
|
|
@@ -353,7 +359,7 @@ public class ProjectLibManage { |
|
|
|
projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); |
|
|
|
return projectApplication; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
projectApplicationService.saveOrUpdateBatch(applications); |
|
|
|
projectApplicationService.saveBatch(applications); |
|
|
|
} |
|
|
|
return project; |
|
|
|
} catch (Exception e) { |
|
|
@@ -652,7 +658,27 @@ public class ProjectLibManage { |
|
|
|
// 查询应用 |
|
|
|
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) |
|
|
|
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())); |
|
|
|
Optional.ofNullable(applications).ifPresent(apps -> |
|
|
|
|
|
|
|
// 查出同一项目编号,建设方案申报前的项目ID |
|
|
|
List<Long> projectIdList = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(Project::getProjectCode, projectInfo.getProjectCode()) |
|
|
|
.eq(Project::getIsConstruct, Boolean.FALSE)).stream() |
|
|
|
.map(Project::getId).collect(Collectors.toList()); |
|
|
|
List<ProjectApplication> applicationList; |
|
|
|
// 如果是建设方案申报后的项目,过滤掉初步方案的应用信息 |
|
|
|
if (Boolean.TRUE.equals(projectInfo.getIsConstruct())){ |
|
|
|
applicationList = applications.stream() |
|
|
|
.filter(a -> !projectIdList.contains(a.getProjectId())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
// 如果不是,展示初步方案的应用信息 |
|
|
|
else { |
|
|
|
applicationList = applications.stream() |
|
|
|
.filter(a -> projectIdList.contains(a.getProjectId())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
Optional.ofNullable(applicationList).ifPresent(apps -> |
|
|
|
vo.setProjectApplications(CollUtils.convert(apps, |
|
|
|
ProjectHelper::convertVO) |
|
|
|
)); |
|
|
@@ -739,8 +765,17 @@ public class ProjectLibManage { |
|
|
|
vo.buildDynamicForm(projectInfo.getDynamicForm()); |
|
|
|
// 查询应用 |
|
|
|
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) |
|
|
|
.eq(ProjectApplication::getProjectId, vo.getId())); |
|
|
|
Optional.ofNullable(applications).ifPresent(apps -> |
|
|
|
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())); |
|
|
|
// 查出同一项目编号,建设方案申报前的项目ID |
|
|
|
List<Long> projectIdList = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(Project::getProjectCode, projectInfo.getProjectCode()) |
|
|
|
.eq(Project::getIsConstruct, Boolean.FALSE)).stream() |
|
|
|
.map(Project::getId).collect(Collectors.toList()); |
|
|
|
List<ProjectApplication> applicationList = applications.stream() |
|
|
|
.filter(a -> projectIdList.contains(a.getProjectId())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
Optional.ofNullable(applicationList).ifPresent(apps -> |
|
|
|
vo.setProjectApplications(CollUtils.convert(apps, |
|
|
|
ProjectHelper::convertVO) |
|
|
|
)); |
|
|
|