|
|
@@ -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; |
|
|
|
|
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* 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<Project> 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<ProjectInst> 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{ |
|
|
|
//否则是重新提交的 新生成一个新版本的项目 |
|
|
|