diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java index 794fc73..ba4cbed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -13,11 +13,15 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; +import com.ningdatech.pmapi.staging.service.IProjectStagingService; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; import java.util.List; import java.util.Objects; @@ -42,6 +46,8 @@ public class ReviewByProvincialDeptManage { private final ProjectLibManage projectLibManage; + private final IProjectStagingService projectStagingService; + /** * 省级部门联审 * @param project @@ -95,8 +101,17 @@ public class ReviewByProvincialDeptManage { ApplicationConverter.convertProject(projectInfo,applications,fileService))){ throw new BusinessException("提交省级部门联审失败"); } - projectInfo = projectLibManage.saveProjectWithVersionAndStatus(project,null, - ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); - return String.valueOf(projectInfo.getId()); + Project p = projectLibManage.saveProjectWithVersionAndStatus(project,null, + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + + //入库暂存表 后续处理 对接外部接口 + projectInfo.setUpdateOn(LocalDateTime.now()); + //保存一下 当前的主管单位发起人 + projectInfo.setPreStartUserId(p.getSponsor()); + //当前实例置为空 + projectInfo.setInstCode(TodoCenterContant.Declared.NULL_INST_CODE); + projectStagingService.addByProject(projectInfo,"省级部门联审-重新提交"); + declaringDTO.getProjectInfo().setId(p.getId()); + return String.valueOf(p.getId()); } } 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 006964d..c2c8568 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 @@ -304,13 +304,28 @@ public class ProjectLibManage { if(Objects.nonNull(statusCode)){ project.setStatus(statusCode); } + if(projectService.save(project)){ projectService.update(Wrappers.lambdaUpdate(Project.class) .set(Project::getNewest,Boolean.FALSE) .ne(Project::getId,project.getId()) .eq(Project::getProjectCode,project.getProjectCode())); + + //继承它的app + List apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, oldProject.getId())); + if(CollUtil.isNotEmpty(apps)){ + List newApps = apps.stream() + .map(a -> { + a.setProjectId(project.getId()); + return a; + }) + .collect(Collectors.toList()); + projectApplicationService.saveBatch(newApps); + } } + return project; }