@@ -136,7 +136,12 @@ public class ConstructionPlanManage { | |||||
log.info("建设方案项目申报成功 【{}】", instanceId); | log.info("建设方案项目申报成功 【{}】", instanceId); | ||||
//保存建设项目 | //保存建设项目 | ||||
modifyProject(projectInfo, instanceId, projectInfo.getConstructionPlanFile()); | |||||
if(dto.getRestart()){ | |||||
modifyProject(projectInfo, instanceId, projectInfo.getConstructionPlanFile()); | |||||
}else{ | |||||
//生成新版本 | |||||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()); | |||||
} | |||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | ||||
@@ -166,6 +171,7 @@ public class ConstructionPlanManage { | |||||
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, | Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, | ||||
ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | ||||
dto.getProjectInfo().setId(project.getId()); | dto.getProjectInfo().setId(project.getId()); | ||||
dto.setRestart(Boolean.TRUE); | |||||
return startTheProcess(dto); | return startTheProcess(dto); | ||||
} | } | ||||
@@ -136,7 +136,7 @@ public class PrequalificationDeclaredProjectManage { | |||||
}else if(ProjectStatusEnum.PRE_APPLYING | }else if(ProjectStatusEnum.PRE_APPLYING | ||||
.getCode().equals(projectInfo.getStatus())){ | .getCode().equals(projectInfo.getStatus())){ | ||||
//如果是非省级联审的项目 直接提交 预审 | //如果是非省级联审的项目 直接提交 预审 | ||||
instanceId = directStartProcess(projectInfo,employeeCode); | |||||
instanceId = directStartProcess(projectInfo,employeeCode,dto.getRestart()); | |||||
}else{ | }else{ | ||||
throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); | throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); | ||||
} | } | ||||
@@ -164,11 +164,12 @@ public class PrequalificationDeclaredProjectManage { | |||||
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, | Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, | ||||
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | ||||
dto.getProjectInfo().setId(project.getId()); | dto.getProjectInfo().setId(project.getId()); | ||||
dto.setRestart(Boolean.TRUE); | |||||
return startTheProcess(dto); | return startTheProcess(dto); | ||||
} | } | ||||
//直接提交预审方法 提取 在省级联审通过的时候 也可以用 | //直接提交预审方法 提取 在省级联审通过的时候 也可以用 | ||||
public String directStartProcess(Project projectInfo,String employeeCode){ | |||||
public String directStartProcess(Project projectInfo,String employeeCode,Boolean restart){ | |||||
VUtils.isTrue(Objects.isNull(employeeCode)) | VUtils.isTrue(Objects.isNull(employeeCode)) | ||||
.throwMessage("发起人 员工code 不能为空!"); | .throwMessage("发起人 员工code 不能为空!"); | ||||
@@ -197,7 +198,13 @@ public class PrequalificationDeclaredProjectManage { | |||||
log.info("提交预审项目成功 【{}】", instanceId); | log.info("提交预审项目成功 【{}】", instanceId); | ||||
//保存预审项目 | //保存预审项目 | ||||
preModifyProject(projectInfo, instanceId); | |||||
if(restart){ | |||||
//如果是重新提交 不用生成新版本 前面已经生成过了 | |||||
preModifyProject(projectInfo, instanceId); | |||||
}else{ | |||||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, | |||||
ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); | |||||
} | |||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | ||||
@@ -5,6 +5,7 @@ import com.google.common.collect.Maps; | |||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | ||||
@@ -46,6 +47,7 @@ public class ReviewByDeptJointManage { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final DefaultDeclaredProjectManage declaredProjectManage; | private final DefaultDeclaredProjectManage declaredProjectManage; | ||||
private final ProjectLibManage projectLibManage; | |||||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | ||||
private final NoticeManage noticeManage; | private final NoticeManage noticeManage; | ||||
@@ -99,9 +101,10 @@ public class ReviewByDeptJointManage { | |||||
log.info("部门联审申报成功 【{}】", instanceId); | log.info("部门联审申报成功 【{}】", instanceId); | ||||
//保存项目信息 | //保存项目信息 | ||||
if(!modifyProject(projectInfo, instanceId)){ | |||||
return Boolean.FALSE; | |||||
} | |||||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); | |||||
// if(!modifyProject(projectInfo, instanceId)){ | |||||
// return Boolean.FALSE; | |||||
// } | |||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | ||||
@@ -31,6 +31,9 @@ public class DefaultDeclaredDTO implements Serializable { | |||||
@ApiModelProperty("表单信息 新增模块") | @ApiModelProperty("表单信息 新增模块") | ||||
private Map<String,Object> formData; | private Map<String,Object> formData; | ||||
@ApiModelProperty("是否是重新提交 默认false") | |||||
private Boolean restart = Boolean.FALSE; | |||||
public Map<String,Object> getFormData(){ | public Map<String,Object> getFormData(){ | ||||
if(CollUtil.isEmpty(this.formData)){ | if(CollUtil.isEmpty(this.formData)){ | ||||
this.formData = Maps.newHashMap(); | this.formData = Maps.newHashMap(); | ||||
@@ -330,6 +330,99 @@ public class ProjectLibManage { | |||||
return project; | return project; | ||||
} | } | ||||
public Project saveProjectWithVersion(ProjectDTO projecDto,String instanceId,Integer instType){ | |||||
Project oldProject = projectService.getById(projecDto.getId()); | |||||
Project project = new Project(); | |||||
VUtils.isTrue(Objects.isNull(oldProject)) | |||||
.throwMessage("项目不存在!"); | |||||
BeanUtil.copyProperties(oldProject,project, CopyOptions.create() | |||||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||||
BeanUtil.copyProperties(projecDto,project, CopyOptions.create() | |||||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||||
project.setVersion(oldProject.getVersion() + 1); | |||||
project.setId(null); | |||||
project.setInstCode(instanceId); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
if(projectService.save(project)){ | |||||
//保存项目和实例的关系 | |||||
ProjectInst projectInst = new ProjectInst(); | |||||
projectInst.setProjectId(project.getId()); | |||||
projectInst.setInstCode(instanceId); | |||||
projectInst.setCreatOn(LocalDateTime.now()); | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | |||||
projectInst.setInstType(instType); | |||||
projectInstService.save(projectInst); | |||||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||||
.set(Project::getNewest,Boolean.FALSE) | |||||
.ne(Project::getId,project.getId()) | |||||
.eq(Project::getProjectCode,project.getProjectCode())); | |||||
//app | |||||
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList(); | |||||
if(CollUtil.isNotEmpty(applicationList)){ | |||||
List<ProjectApplication> apps = applicationList.stream() | |||||
.map(a -> { | |||||
ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); | |||||
app.setId(null); | |||||
app.setProjectId(project.getId()); | |||||
return app; | |||||
}) | |||||
.collect(Collectors.toList()); | |||||
projectApplicationService.saveBatch(apps); | |||||
} | |||||
} | |||||
return project; | |||||
} | |||||
public Project saveProjectWithVersion(Project oldProject,String instanceId,Integer instType){ | |||||
Project project = new Project(); | |||||
VUtils.isTrue(Objects.isNull(oldProject)) | |||||
.throwMessage("项目不存在!"); | |||||
BeanUtil.copyProperties(oldProject,project, CopyOptions.create() | |||||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||||
project.setVersion(oldProject.getVersion() + 1); | |||||
project.setId(null); | |||||
project.setInstCode(instanceId); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
if(projectService.save(project)){ | |||||
//保存项目和实例的关系 | |||||
ProjectInst projectInst = new ProjectInst(); | |||||
projectInst.setProjectId(project.getId()); | |||||
projectInst.setInstCode(instanceId); | |||||
projectInst.setCreatOn(LocalDateTime.now()); | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | |||||
projectInst.setInstType(instType); | |||||
projectInstService.save(projectInst); | |||||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||||
.set(Project::getNewest,Boolean.FALSE) | |||||
.ne(Project::getId,project.getId()) | |||||
.eq(Project::getProjectCode,project.getProjectCode())); | |||||
//app | |||||
List<ProjectApplication> applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,oldProject.getId())); | |||||
if(CollUtil.isNotEmpty(applicationList)){ | |||||
List<ProjectApplication> apps = applicationList.stream() | |||||
.map(a -> { | |||||
ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); | |||||
app.setId(null); | |||||
app.setProjectId(project.getId()); | |||||
return app; | |||||
}) | |||||
.collect(Collectors.toList()); | |||||
projectApplicationService.saveBatch(apps); | |||||
} | |||||
} | |||||
return project; | |||||
} | |||||
/** | /** | ||||
* @param projectId 项目详情 | * @param projectId 项目详情 | ||||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | ||||
@@ -70,7 +70,7 @@ public class Test extends AppTests{// | |||||
@org.junit.Test | @org.junit.Test | ||||
public void Test222(){ | public void Test222(){ | ||||
Project project = projectService.getById(340); | Project project = projectService.getById(340); | ||||
prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId()); | |||||
prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId(),Boolean.FALSE); | |||||
} | } | ||||
@org.junit.Test | @org.junit.Test | ||||