@@ -163,8 +163,10 @@ public class ConstructionPlanManage { | |||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | ||||
VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); | VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); | ||||
//直接先到待方案审批 | //直接先到待方案审批 | ||||
projectInfo.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||||
projectService.updateById(projectInfo); | |||||
Project project = projectLibManage.reSaveProjectNewVersion(projectDto); | |||||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||||
dto.getProjectInfo().setId(project.getId()); | |||||
projectService.updateById(project); | |||||
return startTheProcess(dto); | return startTheProcess(dto); | ||||
} | } | ||||
@@ -26,6 +26,7 @@ import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
@@ -73,7 +74,7 @@ public class DeclaredProjectManage { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectApplicationService projectApplicationService; | |||||
private final ProjectLibManage projectLibManage; | |||||
private final IProjectDraftService projectDraftService; | private final IProjectDraftService projectDraftService; | ||||
@@ -81,8 +82,6 @@ public class DeclaredProjectManage { | |||||
private final ProcessModelService processModelService; | private final ProcessModelService processModelService; | ||||
private final IProjectInstService projectInstService; | |||||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | ||||
private final NoticeManage noticeManage; | private final NoticeManage noticeManage; | ||||
@@ -90,7 +89,6 @@ public class DeclaredProjectManage { | |||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final RegionCacheHelper regionCacheHelper; | private final RegionCacheHelper regionCacheHelper; | ||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
/** | /** | ||||
* 新项目 启动实例 | * 新项目 启动实例 | ||||
@@ -165,7 +163,8 @@ public class DeclaredProjectManage { | |||||
log.info("申报项目成功 【{}】", instanceId); | log.info("申报项目成功 【{}】", instanceId); | ||||
//如果是重新提交的话 判断下 项目是否存在 | //如果是重新提交的话 判断下 项目是否存在 | ||||
Project buildProject = saveOrUpdateProject(projectInfo, instanceId,employeeCode); | |||||
//保存项目相关 | |||||
Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo,instanceId,employeeCode); | |||||
if(Objects.nonNull(projectInfo.getDraftId())){ | if(Objects.nonNull(projectInfo.getDraftId())){ | ||||
//如果是草稿箱提交 删除对应的草稿箱 | //如果是草稿箱提交 删除对应的草稿箱 | ||||
projectDraftService.removeById(projectInfo.getDraftId()); | projectDraftService.removeById(projectInfo.getDraftId()); | ||||
@@ -236,68 +235,16 @@ public class DeclaredProjectManage { | |||||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("重新申报项目成功 【{}】", instanceId); | log.info("重新申报项目成功 【{}】", instanceId); | ||||
//保存项目 | |||||
saveOrUpdateProject(projectDto,instanceId,employeeCode); | |||||
//保存项目相关 | |||||
Project buildProject = projectLibManage.saveProjectInDeclared(projectDto,instanceId,employeeCode); | |||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | |||||
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, | |||||
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | ||||
return instanceId; | return instanceId; | ||||
} | } | ||||
/** | |||||
* 申报项目 时 新增项目到项目库 | |||||
* | |||||
* @param projectDto | |||||
* @param instanceId | |||||
*/ | |||||
private Project saveOrUpdateProject(ProjectDTO projectDto, String instanceId, | |||||
String employeeCode) { | |||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||||
try { | |||||
//保存项目表信息 | |||||
Project project = new Project(); | |||||
BeanUtils.copyProperties(projectDto, project); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||||
project.setInstCode(instanceId); | |||||
project.setSponsor(employeeCode); | |||||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||||
project.setProjectCode(projectCode); | |||||
projectService.saveOrUpdate(project); | |||||
//保存项目应用 | |||||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,project.getId())); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setProjectId(project.getId()); | |||||
return projectApplication; | |||||
}).collect(Collectors.toList()); | |||||
projectApplicationService.saveOrUpdateBatch(applications); | |||||
} | |||||
//保存项目和实例的关系 | |||||
ProjectInst projectInst = new ProjectInst(); | |||||
projectInst.setProjectId(project.getId()); | |||||
projectInst.setInstCode(instanceId); | |||||
projectInst.setCreatOn(LocalDateTime.now()); | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | |||||
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||||
projectInstService.save(projectInst); | |||||
return project; | |||||
} catch (Exception e) { | |||||
log.error("项目信息入库错误 " + e); | |||||
throw new BusinessException("项目信息入库错误 :" + e); | |||||
} | |||||
} | |||||
public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | ||||
Long userId = LoginUserUtil.getUserId(); | Long userId = LoginUserUtil.getUserId(); | ||||
Page<ProjectDraft> page = params.page(); | Page<ProjectDraft> page = params.page(); | ||||
@@ -9,6 +9,7 @@ import com.ningdatech.basic.function.VUtils; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.basic.util.NdDateUtils; | import com.ningdatech.basic.util.NdDateUtils; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | ||||
@@ -20,6 +21,7 @@ import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredLi | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
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; | ||||
@@ -65,6 +67,8 @@ public class PrequalificationDeclaredProjectManage { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final ProjectLibManage projectLibManage; | |||||
private final StateMachineUtils stateMachineUtils; | private final StateMachineUtils stateMachineUtils; | ||||
private final IProjectStagingService projectStagingService; | private final IProjectStagingService projectStagingService; | ||||
@@ -156,9 +160,11 @@ public class PrequalificationDeclaredProjectManage { | |||||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | ||||
Project projectInfo = projectService.getById(projectDto.getId()); | Project projectInfo = projectService.getById(projectDto.getId()); | ||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | ||||
//先回到 待预审状态 | |||||
projectInfo.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||||
projectService.updateById(projectInfo); | |||||
//重新提交 生成新版本号 回到 待预审状态 | |||||
Project project = projectLibManage.reSaveProjectNewVersion(projectDto); | |||||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||||
projectService.updateById(project); | |||||
dto.getProjectInfo().setId(project.getId()); | |||||
return startTheProcess(dto); | return startTheProcess(dto); | ||||
} | } | ||||
@@ -179,7 +185,7 @@ public class PrequalificationDeclaredProjectManage { | |||||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | ||||
.eq(WflowModels::getRegionCode, regionCode) | .eq(WflowModels::getRegionCode, regionCode) | ||||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) | .eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) | ||||
.last("limit 1")); | |||||
.last(BizConst.LIMIT_1)); | |||||
if (Objects.isNull(model)) { | if (Objects.isNull(model)) { | ||||
log.error("此 【{}】区域找不到 预审流程配置", regionCode); | log.error("此 【{}】区域找不到 预审流程配置", regionCode); | ||||
@@ -6,6 +6,7 @@ import com.ningdatech.file.service.FileService; | |||||
import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | ||||
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.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
@@ -39,6 +40,8 @@ public class ReviewByProvincialDeptManage { | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final ProjectLibManage projectLibManage; | |||||
/** | /** | ||||
* 省级部门联审 | * 省级部门联审 | ||||
* @param project | * @param project | ||||
@@ -92,6 +95,7 @@ public class ReviewByProvincialDeptManage { | |||||
ApplicationConverter.convertProject(projectInfo,applications,fileService))){ | ApplicationConverter.convertProject(projectInfo,applications,fileService))){ | ||||
throw new BusinessException("提交省级部门联审失败"); | throw new BusinessException("提交省级部门联审失败"); | ||||
} | } | ||||
projectInfo = projectLibManage.reSaveProjectNewVersion(project); | |||||
projectInfo.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | projectInfo.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | ||||
projectService.updateById(projectInfo); | projectService.updateById(projectInfo); | ||||
return String.valueOf(projectInfo.getId()); | return String.valueOf(projectInfo.getId()); | ||||
@@ -106,6 +106,7 @@ public class AnnualPlanLibManage { | |||||
throw new BizException("请传入是否临时增补标志!"); | throw new BizException("请传入是否临时增补标志!"); | ||||
} | } | ||||
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); | query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); | ||||
query.eq(Project::getNewest,Boolean.TRUE); | |||||
query.orderByDesc(Project::getAnnualPlanAddTime); | query.orderByDesc(Project::getAnnualPlanAddTime); | ||||
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | ||||
//数据权限 | //数据权限 | ||||
@@ -1,15 +1,19 @@ | |||||
package com.ningdatech.pmapi.projectlib.manage; | package com.ningdatech.pmapi.projectlib.manage; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.function.VUtils; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.file.entity.File; | import com.ningdatech.file.entity.File; | ||||
import com.ningdatech.file.service.FileService; | import com.ningdatech.file.service.FileService; | ||||
import com.ningdatech.pmapi.common.constant.CommonConst; | import com.ningdatech.pmapi.common.constant.CommonConst; | ||||
import com.ningdatech.pmapi.common.constant.RegionConst; | 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.RegionCacheHelper; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | ||||
@@ -17,22 +21,23 @@ import com.ningdatech.pmapi.common.util.BizUtils; | |||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | import com.ningdatech.pmapi.common.util.ExcelDownUtil; | ||||
import com.ningdatech.pmapi.datascope.model.DataScopeDTO; | import com.ningdatech.pmapi.datascope.model.DataScopeDTO; | ||||
import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; | import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; | ||||
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.ningdatech.pmapi.projectlib.service.*; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.exception.BusinessException; | |||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -41,7 +46,9 @@ import org.springframework.beans.BeanUtils; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
import java.time.LocalDateTime; | |||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -60,11 +67,12 @@ public class ProjectLibManage { | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | ||||
private final ProcessExecuteChainHandle processExecuteHandle; | private final ProcessExecuteChainHandle processExecuteHandle; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final RegionCacheHelper regionCacheHelper; | private final RegionCacheHelper regionCacheHelper; | ||||
private final FileService fileService; | private final FileService fileService; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IProjectApplicationService projectApplicationService; | |||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
private final IProjectInstService projectInstService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
@@ -96,6 +104,8 @@ public class ProjectLibManage { | |||||
public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
UserFullInfoDTO user = buildProjectLibPermission(query); | UserFullInfoDTO user = buildProjectLibPermission(query); | ||||
//项目查最新 | |||||
query.eq(Project::getNewest,Boolean.TRUE); | |||||
Page<Project> page = projectService.page(req.page(), query); | Page<Project> page = projectService.page(req.page(), query); | ||||
long total; | long total; | ||||
if ((total = page.getTotal()) == 0) { | if ((total = page.getTotal()) == 0) { | ||||
@@ -133,6 +143,135 @@ public class ProjectLibManage { | |||||
} | } | ||||
/** | /** | ||||
* 申报新项目时 保存项目信息和其它相关联的信息 | |||||
* @param projectDto | |||||
* @param instanceId | |||||
* @param employeeCode | |||||
* @return | |||||
*/ | |||||
public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, | |||||
String employeeCode) { | |||||
Project project = saveProjectNewVersion(projectDto,instanceId,employeeCode); | |||||
//保存项目和实例的关系 | |||||
ProjectInst projectInst = new ProjectInst(); | |||||
projectInst.setProjectId(project.getId()); | |||||
projectInst.setInstCode(instanceId); | |||||
projectInst.setCreatOn(LocalDateTime.now()); | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | |||||
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||||
projectInstService.save(projectInst); | |||||
return project; | |||||
} | |||||
/** | |||||
* 申报新项目时 保存项目信息和其它相关联的信息 | |||||
* @param projectDto | |||||
* @param instanceId | |||||
* @param employeeCode | |||||
* @return | |||||
*/ | |||||
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||||
String employeeCode) { | |||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||||
try { | |||||
Project project = new Project(); | |||||
//为空 代表是新申报的 | |||||
if(Objects.isNull(projectDto.getId())){ | |||||
BeanUtils.copyProperties(projectDto, project); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||||
project.setInstCode(instanceId); | |||||
project.setSponsor(employeeCode); | |||||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||||
project.setProjectCode(projectCode); | |||||
projectService.save(project); | |||||
}else{ | |||||
//否则是重新提交的 新生成一个新版本的项目 | |||||
project = newProjectWithVersion(projectDto); | |||||
} | |||||
//保存项目应用 | |||||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,project.getId())); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
Project finalProject = project; | |||||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setProjectId(finalProject.getId()); | |||||
return projectApplication; | |||||
}).collect(Collectors.toList()); | |||||
projectApplicationService.saveOrUpdateBatch(applications); | |||||
} | |||||
return project; | |||||
} catch (Exception e) { | |||||
log.error("项目信息入库错误 " + e); | |||||
throw new BusinessException("项目信息入库错误 :" + e); | |||||
} | |||||
} | |||||
/** | |||||
* 在其它项目阶段 保存项目信息和其它相关联的信息 | |||||
* @param projectDto | |||||
* @return | |||||
*/ | |||||
public Project reSaveProjectNewVersion(ProjectDTO projectDto) { | |||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||||
try { | |||||
Project project = newProjectWithVersion(projectDto); | |||||
//保存项目应用 | |||||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,project.getId())); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
Project finalProject = project; | |||||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setProjectId(finalProject.getId()); | |||||
return projectApplication; | |||||
}).collect(Collectors.toList()); | |||||
projectApplicationService.saveOrUpdateBatch(applications); | |||||
} | |||||
return project; | |||||
} catch (Exception e) { | |||||
log.error("项目信息入库错误 " + e); | |||||
throw new BusinessException("项目信息入库错误 :" + e); | |||||
} | |||||
} | |||||
/** | |||||
* 重新提交工作流时 舍弃在原有项目修改 | |||||
* 新增一个新的项目 新的版本号 | |||||
*/ | |||||
public Project newProjectWithVersion(ProjectDTO projecDto){ | |||||
Project project = projectService.getById(projecDto.getId()); | |||||
VUtils.isTrue(Objects.isNull(project)) | |||||
.throwMessage("项目不存在!"); | |||||
project.setVersion(project.getVersion() + 1); | |||||
BeanUtils.copyProperties(projecDto,project); | |||||
project.setId(null); | |||||
projectService.save(project); | |||||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||||
.set(Project::getNewest,Boolean.FALSE) | |||||
.ne(Project::getId,project.getId()) | |||||
.eq(Project::getProjectCode,project.getProjectCode())); | |||||
return project; | |||||
} | |||||
/** | |||||
* @param projectId 项目详情 | * @param projectId 项目详情 | ||||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | ||||
* @author ZPF | * @author ZPF | ||||
@@ -324,4 +324,9 @@ public class Project implements Serializable { | |||||
@ApiModelProperty("省级联审 审批结果") | @ApiModelProperty("省级联审 审批结果") | ||||
private String sjlsResult; | private String sjlsResult; | ||||
@ApiModelProperty("版本号") | |||||
private Integer version; | |||||
@ApiModelProperty("是否是最新版本") | |||||
private Boolean newest; | |||||
} | } |
@@ -322,6 +322,12 @@ public class ProjectDetailVO { | |||||
@ApiModelProperty("省级联审 审批结果") | @ApiModelProperty("省级联审 审批结果") | ||||
private String sjlsResult; | private String sjlsResult; | ||||
@ApiModelProperty("版本号") | |||||
private Integer version; | |||||
@ApiModelProperty("是否是最新版本") | |||||
private Boolean newest; | |||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
private LocalDateTime updateOn; | private LocalDateTime updateOn; | ||||