|
|
@@ -16,6 +16,7 @@ import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Maps; |
|
|
|
import com.hz.pm.api.common.compare.CompareUtils; |
|
|
|
import com.hz.pm.api.common.enumeration.ProjectProcessType; |
|
|
|
import com.hz.pm.api.common.exception.ReturnException; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.model.constant.CommonConst; |
|
|
@@ -712,6 +713,16 @@ public class ProjectLibManage { |
|
|
|
BeanUtils.copyProperties(project, retProjectDetail); |
|
|
|
retProjectDetail.buildDynamicForm(project.getDynamicForm()); |
|
|
|
String projectCode = project.getProjectCode(); |
|
|
|
if (ProjectStatus.CHANGE_APPLY_PASSED.eq(project.getStatus())) { |
|
|
|
Wrapper<Project> newProjectQuery = Wrappers.lambdaQuery(Project.class) |
|
|
|
.select(Project::getId, Project::getProjectCode) |
|
|
|
.eq(Project::getHisProjectCode, project.getHisProjectCode()) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.last(BizConst.LIMIT_1); |
|
|
|
Project newProject = projectService.getOne(newProjectQuery); |
|
|
|
retProjectDetail.setNewProjectId(newProject.getId()); |
|
|
|
retProjectDetail.setNewProjectCode(newProject.getProjectCode()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(project.getHisProjectCode())) { |
|
|
|
retProjectDetail.setHisProjectId(ProjectIdCodeCacheUtil.newest(project.getHisProjectCode())); |
|
|
|
} |
|
|
@@ -913,6 +924,43 @@ public class ProjectLibManage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Project saveProjectNewVersion(ProjectDTO reqProj, |
|
|
|
Long userId, |
|
|
|
ProjectStatus status) { |
|
|
|
try { |
|
|
|
Project newProj = new Project(); |
|
|
|
BeanUtils.copyProperties(reqProj, newProj); |
|
|
|
newProj.setCreateOn(LocalDateTime.now()); |
|
|
|
newProj.setUpdateOn(LocalDateTime.now()); |
|
|
|
newProj.setIsBackReject(Boolean.FALSE); |
|
|
|
newProj.setStage(status.getStage()); |
|
|
|
newProj.setStatus(status.getCode()); |
|
|
|
newProj.setSponsor(String.valueOf(userId)); |
|
|
|
if (Objects.isNull(reqProj.getId())) { |
|
|
|
newProj.setProjectCode(projectCodeGenUtil.generateProjectCode(reqProj)); |
|
|
|
} else { |
|
|
|
Project oldProj = projectService.getById(reqProj.getId()); |
|
|
|
if (ProjectStatus.TO_BE_DECLARED.eq(status) |
|
|
|
&& !ProjectStatus.TO_BE_DECLARED.eq(oldProj.getStatus())) { |
|
|
|
throw ReturnException.wrap("项目状态异常,保存失败"); |
|
|
|
} |
|
|
|
newProj.setVersion(oldProj.getVersion() + 1); |
|
|
|
projectService.reverseNewest(newProj.getProjectCode(), newProj.getId()); |
|
|
|
} |
|
|
|
newProj.setId(null); |
|
|
|
newProj.setNewest(Boolean.TRUE); |
|
|
|
if (projectService.save(newProj)) { |
|
|
|
projectSaveHelper.saveApplication(reqProj, newProj, null); |
|
|
|
projectSaveHelper.savePaymentPlans(newProj, reqProj.getPaymentPlanList()); |
|
|
|
projectSaveHelper.saveGovSystemReplaceInfos(newProj.getId(), newProj.getProjectCode(), reqProj.getSystemReplaceInfos()); |
|
|
|
} |
|
|
|
return newProj; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("项目信息入库错误", e); |
|
|
|
throw BizException.wrap("项目信息入库错误"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 在其它项目阶段 保存项目信息和其它相关联的信息 |
|
|
|