@@ -11,6 +11,7 @@ import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||
@@ -136,7 +137,7 @@ public class DeclaredProjectManage { | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) | |||
.last("limit 1")); | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到单位流程配置", regionCode); | |||
@@ -98,9 +98,9 @@ public class ProjectAdjustmentManage { | |||
} | |||
//修改项目内容 | |||
if(!modifyProject(projectDto)){ | |||
throw new BusinessException("调整项目失败!"); | |||
} | |||
// if(!modifyProject(projectDto)){ | |||
// throw new BusinessException("调整项目失败!"); | |||
// } | |||
//最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 | |||
Function<DefaultDeclaredDTO, String> declaredFunction = | |||
@@ -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 | |||
@@ -91,12 +97,23 @@ public class ReviewByProvincialDeptManage { | |||
// 对接省级联审的接口 | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId, projectInfo.getId())); | |||
Project p = projectLibManage.saveProjectWithVersionAndStatus(project,null, | |||
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | |||
//入库暂存表 后续处理 对接外部接口 | |||
p.setUpdateOn(LocalDateTime.now()); | |||
//保存一下 当前的主管单位发起人 | |||
p.setPreStartUserId(p.getSponsor()); | |||
//当前实例置为空 | |||
p.setInstCode(TodoCenterContant.Declared.NULL_INST_CODE); | |||
declaringDTO.getProjectInfo().setId(p.getId()); | |||
projectService.updateById(p); | |||
if(!joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(projectInfo,applications,fileService))){ | |||
ApplicationConverter.convertProject(p,applications,fileService))){ | |||
throw new BusinessException("提交省级部门联审失败"); | |||
} | |||
projectInfo = projectLibManage.saveProjectWithVersionAndStatus(project,null, | |||
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | |||
return String.valueOf(projectInfo.getId()); | |||
return String.valueOf(p.getId()); | |||
} | |||
} |
@@ -79,7 +79,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | |||
} | |||
if (Objects.isNull(instanceDetail)){ | |||
throw new BizException("未获取到历史版本的流程详情!"); | |||
throw new BizException("未获取到单位内部审核流程详情!"); | |||
} | |||
String status = instanceDetail.getStatus(); | |||
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ | |||
@@ -28,6 +28,7 @@ import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | |||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
@@ -304,11 +305,26 @@ 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<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; | |||
@@ -11,6 +11,8 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import com.wflow.workflow.enums.ProcessHandlerEnum; | |||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||
import com.wflow.workflow.service.ProcessInstanceService; | |||
import liquibase.pro.packaged.I; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -59,7 +61,8 @@ public class ProjectVersionUtil { | |||
if (projectList.size() < CommonConst.VERSION_SIZE){ | |||
throw new BizException("未发现该项目的历史版本!"); | |||
} | |||
// 获取上个版本的项目 | |||
// 获取之前版本的项目 | |||
int index = projectList.size() - 1; | |||
ProcessProgressVo instanceDetail = null; | |||
while (index > 0){ | |||
@@ -70,13 +73,18 @@ public class ProjectVersionUtil { | |||
.eq(ProjectInst::getProjectId, preProject.getId()) | |||
.eq(ProjectInst::getInstType,instTypeEnum.getCode())); | |||
if (CollUtil.isNotEmpty(projectInstList)) { | |||
// 获取最新一个对应审核类型的项目关联实例 | |||
ProjectInst projectInst = projectInstList.get(projectInstList.size() - 1); | |||
// 获取流程详情 | |||
instanceDetail = processInstanceService.getProgressInstanceDetail(null, projectInst.getInstCode()); | |||
if (Objects.nonNull(instanceDetail)){ | |||
return instanceDetail; | |||
List<ProcessProgressVo> processProgressVoList = projectInstList.stream() | |||
.map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode())) | |||
.collect(Collectors.toList()); | |||
// 筛选出上个版本该类型审核流程通过的流程详情 | |||
List<ProcessProgressVo> instanceDetailList = processProgressVoList.stream() | |||
.filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus())) | |||
.collect(Collectors.toList()); | |||
if (CollUtil.isEmpty(instanceDetailList)){ | |||
continue; | |||
} | |||
// 获取最后一个流程详情 | |||
return instanceDetailList.get(instanceDetailList.size() - 1); | |||
} | |||
} | |||
return null; | |||