@@ -115,7 +115,7 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||||
// 项目评审通过 | // 项目评审通过 | ||||
.withExternal() | .withExternal() | ||||
.source(ProjectStatus.ON_EXPERT_REVIEW) | .source(ProjectStatus.ON_EXPERT_REVIEW) | ||||
.target(ProjectStatus.WITHOUT_EXPERT_REVIEW) | |||||
.target(ProjectStatus.WITHOUT_PROJECT_REVIEW) | |||||
.event(ProjectStateChangeEvent.EXPERT_REVIEW_PASS).and() | .event(ProjectStateChangeEvent.EXPERT_REVIEW_PASS).and() | ||||
// 提交项目评审 | // 提交项目评审 | ||||
.withExternal() | .withExternal() | ||||
@@ -56,7 +56,7 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent { | |||||
/** | /** | ||||
* @see ProjectStateChangeAction#EXPERT_REVIEW_PASS(Message) | * @see ProjectStateChangeAction#EXPERT_REVIEW_PASS(Message) | ||||
*/ | */ | ||||
EXPERT_REVIEW_PASS(ProjectStatus.ON_PROJECT_REVIEW.getCode(), null, null), | |||||
EXPERT_REVIEW_PASS(ProjectStatus.ON_EXPERT_REVIEW.getCode(), null, null), | |||||
/** | /** | ||||
* @see ProjectStateChangeAction#PROJECT_REVIEW_SUBMIT(Message) | * @see ProjectStateChangeAction#PROJECT_REVIEW_SUBMIT(Message) | ||||
@@ -1120,10 +1120,8 @@ public class MeetingManage { | |||||
if (!Boolean.TRUE.equals(meeting.getIsInnerProject())) { | if (!Boolean.TRUE.equals(meeting.getIsInnerProject())) { | ||||
throw ReturnException.wrap("此会议未关联项目"); | throw ReturnException.wrap("此会议未关联项目"); | ||||
} | } | ||||
MeetingInnerProject mip = BeanUtil.copyProperties(req, MeetingInnerProject.class); | |||||
if (mip.getReviewResult() != null) { | |||||
throw ReturnException.wrap("会议结果已上传"); | |||||
} | |||||
MeetingInnerProject mip = meetingInnerProjectService.getById(req.getMeetingProjectId()); | |||||
BeanUtil.copyProperties(req, mip); | |||||
mip.setId(req.getMeetingProjectId()); | mip.setId(req.getMeetingProjectId()); | ||||
Project project = projectService.getById(mip.getProjectId()); | Project project = projectService.getById(mip.getProjectId()); | ||||
if (req.getReviewResult() == 1) { | if (req.getReviewResult() == 1) { | ||||
@@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.controller; | |||||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | ||||
import com.hz.pm.api.projectdeclared.manage.ProjectReviewManage; | import com.hz.pm.api.projectdeclared.manage.ProjectReviewManage; | ||||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||||
import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | ||||
import com.hz.pm.api.projectdeclared.model.vo.ReviewProgressStatisticsVO; | import com.hz.pm.api.projectdeclared.model.vo.ReviewProgressStatisticsVO; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
@@ -35,7 +36,7 @@ public class ProjectReviewController { | |||||
@ApiOperation("提交项目评审申请") | @ApiOperation("提交项目评审申请") | ||||
@PostMapping(value = {"/submit", "resubmit"}) | @PostMapping(value = {"/submit", "resubmit"}) | ||||
@WebLog("提交项目评审申请") | @WebLog("提交项目评审申请") | ||||
public void projectReviewApply(@RequestBody ProjectReviewApplyReq req) { | |||||
public void projectReviewApply(@RequestBody DefaultDeclaredDTO req) { | |||||
projectReviewManage.projectReviewApply(req); | projectReviewManage.projectReviewApply(req); | ||||
} | } | ||||
@@ -18,11 +18,13 @@ import com.hz.pm.api.datascope.utils.DataScopeUtil; | |||||
import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; | import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; | ||||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | ||||
import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; | import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; | ||||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||||
import com.hz.pm.api.projectdeclared.model.entity.ProjectReview; | import com.hz.pm.api.projectdeclared.model.entity.ProjectReview; | ||||
import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | |||||
import com.hz.pm.api.projectdeclared.model.vo.ReviewProgressStatisticsVO; | import com.hz.pm.api.projectdeclared.model.vo.ReviewProgressStatisticsVO; | ||||
import com.hz.pm.api.projectdeclared.service.IProjectReviewService; | import com.hz.pm.api.projectdeclared.service.IProjectReviewService; | ||||
import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | ||||
import com.hz.pm.api.projectlib.helper.ProjectSaveHelper; | |||||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | import com.hz.pm.api.projectlib.model.entity.ProjectInst; | ||||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | ||||
@@ -45,6 +47,7 @@ import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | |||||
import com.wflow.workflow.service.ProcessInstanceService; | import com.wflow.workflow.service.ProcessInstanceService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -74,10 +77,13 @@ public class ProjectReviewManage { | |||||
private final MhUnitCache mhUnitCache; | private final MhUnitCache mhUnitCache; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IMeetingInnerProjectService meetingInnerProjectService; | private final IMeetingInnerProjectService meetingInnerProjectService; | ||||
private final ProjectSaveHelper projectSaveHelper; | |||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public synchronized void projectReviewApply(ProjectReviewApplyReq req) { | |||||
Project project = projectService.getById(req.getProjectId()); | |||||
public synchronized void projectReviewApply(DefaultDeclaredDTO req) { | |||||
ProjectDTO reqProj = req.getProjectInfo(); | |||||
Project project = projectService.getById(reqProj.getId()); | |||||
if (!ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(project.getStatus()) | if (!ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(project.getStatus()) | ||||
&& !ProjectStatus.PROJECT_REVIEW_FAILED.eq(project.getStatus())) { | && !ProjectStatus.PROJECT_REVIEW_FAILED.eq(project.getStatus())) { | ||||
throw BizException.wrap("该项目不允许申请项目评审"); | throw BizException.wrap("该项目不允许申请项目评审"); | ||||
@@ -95,24 +101,21 @@ public class ProjectReviewManage { | |||||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user, project); | Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user, project); | ||||
String instanceId = processInstanceService.startProcessLs(model, processParam, orgMap); | String instanceId = processInstanceService.startProcessLs(model, processParam, orgMap); | ||||
BeanUtils.copyProperties(reqProj, project); | |||||
projectStateMachineUtil.pass(project); | |||||
if (projectService.save(project)) { | |||||
projectSaveHelper.saveApplication(reqProj, project, null); | |||||
projectSaveHelper.savePaymentPlans(project, reqProj.getPaymentPlanList()); | |||||
projectSaveHelper.saveGovSystemReplaceInfos(project.getId(), project.getProjectCode(), reqProj.getSystemReplaceInfos()); | |||||
} | |||||
ProjectInst projectInst = new ProjectInst(); | ProjectInst projectInst = new ProjectInst(); | ||||
projectInst.setInstCode(instanceId); | projectInst.setInstCode(instanceId); | ||||
projectInst.setInstType(ProjectProcessType.PROJECT_REVIEW); | projectInst.setInstType(ProjectProcessType.PROJECT_REVIEW); | ||||
projectInst.setProjectId(req.getProjectId()); | |||||
projectInst.setProjectId(reqProj.getId()); | |||||
projectInstService.save(projectInst); | projectInstService.save(projectInst); | ||||
projectStateMachineUtil.pass(project); | projectStateMachineUtil.pass(project); | ||||
projectService.updateById(project); | projectService.updateById(project); | ||||
ProjectReview projReview = projectReviewService.getOne(Wrappers | |||||
.lambdaQuery(ProjectReview.class) | |||||
.eq(ProjectReview::getProjectId, req.getProjectId()) | |||||
.orderByDesc(ProjectReview::getId) | |||||
.last(BizConst.LIMIT_1)); | |||||
if (projReview == null) { | |||||
projReview = new ProjectReview(); | |||||
projReview.setProjectCode(project.getProjectCode()); | |||||
} | |||||
BeanUtil.copyProperties(req, projReview); | |||||
projectReviewService.saveOrUpdate(projReview); | |||||
log.info("项目评审提交成功 【{}】", instanceId); | log.info("项目评审提交成功 【{}】", instanceId); | ||||
} | } | ||||
@@ -12,17 +12,12 @@ import com.hz.pm.api.common.model.constant.BizConst; | |||||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | ||||
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; | import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; | ||||
import com.hz.pm.api.common.util.BizUtils; | import com.hz.pm.api.common.util.BizUtils; | ||||
import com.hz.pm.api.projectdeclared.model.entity.ProjectChangeHistory; | |||||
import com.hz.pm.api.projectdeclared.model.dto.*; | import com.hz.pm.api.projectdeclared.model.dto.*; | ||||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||||
import com.hz.pm.api.projectdeclared.model.entity.Operation; | |||||
import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; | |||||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||||
import com.hz.pm.api.projectdeclared.model.entity.*; | |||||
import com.hz.pm.api.projectdeclared.model.vo.PreInsAcceptancePersonVO; | import com.hz.pm.api.projectdeclared.model.vo.PreInsAcceptancePersonVO; | ||||
import com.hz.pm.api.projectdeclared.service.*; | import com.hz.pm.api.projectdeclared.service.*; | ||||
import com.hz.pm.api.projectdeclared.utils.ProjectDetailDiffUtil.FieldDiff; | import com.hz.pm.api.projectdeclared.utils.ProjectDetailDiffUtil.FieldDiff; | ||||
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | ||||
import com.hz.pm.api.projectlib.manage.ProjectLibManage; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.enumeration.status.*; | import com.hz.pm.api.projectlib.model.enumeration.status.*; | ||||
@@ -59,7 +54,7 @@ public class ProjectChangeStopHelper { | |||||
private final IOperationService operationService; | private final IOperationService operationService; | ||||
private final IContractService contractService; | private final IContractService contractService; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final ProjectLibManage projectLibManage; | |||||
private final ProjectSaveHelper projectSaveHelper; | |||||
/** | /** | ||||
* 根据状态变更记录重置项目、标段状态 | * 根据状态变更记录重置项目、标段状态 | ||||
@@ -230,7 +225,7 @@ public class ProjectChangeStopHelper { | |||||
FieldDiff systemReplaceInfos = CollUtil.findOne(projectDiffs, | FieldDiff systemReplaceInfos = CollUtil.findOne(projectDiffs, | ||||
w -> w.getFieldName().equals(EditProjectDTO.SYSTEM_REPLACE_INFOS)); | w -> w.getFieldName().equals(EditProjectDTO.SYSTEM_REPLACE_INFOS)); | ||||
if (systemReplaceInfos != null) { | if (systemReplaceInfos != null) { | ||||
projectLibManage.saveGovSystemReplaceInfos(projectDetail.getId(), | |||||
projectSaveHelper.saveGovSystemReplaceInfos(projectDetail.getId(), | |||||
projectCode, projectDetail.getSystemReplaceInfos()); | projectCode, projectDetail.getSystemReplaceInfos()); | ||||
} | } | ||||
UpdateWrapper<Project> wrapper = buildWrapper(projectDiffs, Project.class); | UpdateWrapper<Project> wrapper = buildWrapper(projectDiffs, Project.class); | ||||
@@ -0,0 +1,168 @@ | |||||
package com.hz.pm.api.projectlib.helper; | |||||
import cn.hutool.core.bean.BeanUtil; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import cn.hutool.core.util.ArrayUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||||
import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; | |||||
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | |||||
import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; | |||||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | |||||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | |||||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||||
import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | |||||
import com.hz.pm.api.projectlib.model.entity.ProjectAnnualPaymentPlan; | |||||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||||
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService; | |||||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||||
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService; | |||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||||
import com.hz.pm.api.user.util.LoginUserUtil; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.stereotype.Component; | |||||
import java.time.LocalDateTime; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* <p> | |||||
* ProjectSaveHelper | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 16:12 2024/9/26 | |||||
*/ | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class ProjectSaveHelper { | |||||
private final IProjectApplicationService projectApplicationService; | |||||
private final IProjectGovSystemReplaceInfosService projectGovSystemReplaceInfosService; | |||||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||||
private final IProjectAnnualPaymentPlanService projectAnnualPaymentPlanService; | |||||
public void savePaymentPlans(Project project, List<ProjectPaymentPlanDTO> paymentPlans) { | |||||
if (CollUtil.isEmpty(paymentPlans)) { | |||||
return; | |||||
} | |||||
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; | |||||
projectAnnualPaymentPlanService.remove(project.getProjectCode(), version); | |||||
List<ProjectAnnualPaymentPlan> plans = paymentPlans.stream().map(w -> { | |||||
ProjectAnnualPaymentPlan plan = BeanUtil.copyProperties(w, ProjectAnnualPaymentPlan.class); | |||||
plan.setProjectCode(project.getProjectCode()); | |||||
plan.setProjectVersion(version); | |||||
return plan; | |||||
}).collect(Collectors.toList()); | |||||
projectAnnualPaymentPlanService.saveBatch(plans); | |||||
} | |||||
public void saveApplication(Project project, Project oldProject, Boolean isConstruct) { | |||||
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) | |||||
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); | |||||
if (CollUtil.isNotEmpty(apps)) { | |||||
apps.forEach(app -> { | |||||
Long oldAppId = app.getId(); | |||||
app.setProjectVersion(project.getVersion()); | |||||
app.setProjectId(project.getId()); | |||||
app.setId(null); | |||||
if (Objects.nonNull(isConstruct)) { | |||||
app.setIsConstruct(isConstruct); | |||||
} | |||||
projectApplicationService.save(app); | |||||
//核心业务 | |||||
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||||
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); | |||||
if (CollUtil.isNotEmpty(cores)) { | |||||
cores.forEach(c -> { | |||||
c.setId(null); | |||||
c.setApplicationId(app.getId()); | |||||
projectCoreBusinessIndicatorsService.save(c); | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
public void saveApplication(ProjectDTO projectDto, Project project, Boolean isConstruct) { | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
//保存项目应用 | |||||
boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; | |||||
//删除当前版本的app 一般情况是没有 保险起见 | |||||
projectApplicationService.remove(project.getProjectCode(), version); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
projectDto.getApplicationList().forEach(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setId(null); | |||||
projectApplication.setProjectId(project.getId()); | |||||
projectApplication.setProjectCode(project.getProjectCode()); | |||||
projectApplication.setBuildOrgCode(project.getBuildOrgCode()); | |||||
projectApplication.setBuildOrgName(project.getBuildOrgName()); | |||||
projectApplication.setProjectVersion(version); | |||||
projectApplication.setIsConstruct(isConstruct); | |||||
if (StringUtils.isNotBlank(application.getRelatedExistsApplication())) { | |||||
projectApplication.setApplicationName(null); | |||||
} | |||||
boolean result = projectApplicationService.save(projectApplication); | |||||
// 保存应用关联的核心业务 | |||||
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList(); | |||||
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; | |||||
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)) { | |||||
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { | |||||
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); | |||||
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); | |||||
projectCoreBusinessIndicators.setId(null); | |||||
projectCoreBusinessIndicators.setApplicationId(projectApplication.getId()); | |||||
projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now()); | |||||
projectCoreBusinessIndicators.setCreateBy(user.getUsername()); | |||||
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
public void saveGovSystemReplaceInfos(Long projectId, | |||||
String projectCode, | |||||
List<GovSystemReplaceInfoDTO> systemReplaceInfos) { | |||||
Wrapper<ProjectGovSystemReplaceInfos> delQuery = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||||
.eq(ProjectGovSystemReplaceInfos::getProjectCode, projectCode); | |||||
projectGovSystemReplaceInfosService.remove(delQuery); | |||||
if (CollUtil.isEmpty(systemReplaceInfos)) { | |||||
return; | |||||
} | |||||
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>(); | |||||
for (int i = 0; i < systemReplaceInfos.size(); i++) { | |||||
GovSystemReplaceInfoDTO curr = systemReplaceInfos.get(i); | |||||
for (int i1 = 0; i1 < curr.getSourceSystemNames().size(); i1++) { | |||||
ProjectGovSystemReplaceInfos replaceInfo = new ProjectGovSystemReplaceInfos(); | |||||
replaceInfo.setProjectId(projectId); | |||||
replaceInfo.setProjectCode(projectCode); | |||||
replaceInfo.setReplaceType(curr.getReplaceType()); | |||||
replaceInfo.setSourceSystem(curr.getSourceSystemNames().get(i1)); | |||||
replaceInfo.setTargetSystem(curr.getTargetSystemName()); | |||||
replaceInfo.setBatchNo(i + 1); | |||||
if (ArrayUtil.isNotEmpty(curr.getSourceSystemIds())) { | |||||
replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1)); | |||||
} | |||||
replaceInfos.add(replaceInfo); | |||||
} | |||||
} | |||||
projectGovSystemReplaceInfosService.saveBatch(replaceInfos); | |||||
} | |||||
} |
@@ -18,7 +18,9 @@ import com.hz.pm.api.common.compare.CompareUtils; | |||||
import com.hz.pm.api.common.enumeration.CommonEnum; | import com.hz.pm.api.common.enumeration.CommonEnum; | ||||
import com.hz.pm.api.common.enumeration.ProjectProcessType; | import com.hz.pm.api.common.enumeration.ProjectProcessType; | ||||
import com.hz.pm.api.common.helper.UserInfoHelper; | import com.hz.pm.api.common.helper.UserInfoHelper; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | |||||
import com.hz.pm.api.common.model.constant.CommonConst; | import com.hz.pm.api.common.model.constant.CommonConst; | ||||
import com.hz.pm.api.common.model.constant.ExistsSqlConst; | |||||
import com.hz.pm.api.common.model.entity.ExcelExportWriter; | import com.hz.pm.api.common.model.entity.ExcelExportWriter; | ||||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | ||||
import com.hz.pm.api.common.util.BizUtils; | import com.hz.pm.api.common.util.BizUtils; | ||||
@@ -31,7 +33,9 @@ import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum; | |||||
import com.hz.pm.api.expert.service.IExpertReviewService; | import com.hz.pm.api.expert.service.IExpertReviewService; | ||||
import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; | import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; | ||||
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; | import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; | ||||
import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; | |||||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | ||||
import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; | |||||
import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; | import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; | ||||
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | ||||
import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; | import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; | ||||
@@ -55,6 +59,7 @@ import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | ||||
import com.hz.pm.api.projectlib.handle.ProcessProgressHelper; | import com.hz.pm.api.projectlib.handle.ProcessProgressHelper; | ||||
import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | ||||
import com.hz.pm.api.projectlib.helper.ProjectSaveHelper; | |||||
import com.hz.pm.api.projectlib.model.constant.ProjectConstant; | import com.hz.pm.api.projectlib.model.constant.ProjectConstant; | ||||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | ||||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | ||||
@@ -112,6 +117,7 @@ import java.util.stream.Collectors; | |||||
@Slf4j | @Slf4j | ||||
public class ProjectLibManage { | public class ProjectLibManage { | ||||
private final ProjectSaveHelper projectSaveHelper; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | ||||
@@ -140,6 +146,7 @@ public class ProjectLibManage { | |||||
private final IMhProjectSchemaTargetDataService projectSchemaTargetDataService; | private final IMhProjectSchemaTargetDataService projectSchemaTargetDataService; | ||||
private final IMhProjectService mhProjectService; | private final IMhProjectService mhProjectService; | ||||
private final ProjectReviewManage projectReviewManage; | private final ProjectReviewManage projectReviewManage; | ||||
private final IMeetingInnerProjectService meetingInnerProjectService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(req); | ||||
@@ -785,8 +792,13 @@ public class ProjectLibManage { | |||||
} | } | ||||
// 评审详情 | // 评审详情 | ||||
ProjectReviewResultDTO projectReviewDetail = projectReviewManage.projectReviewDetail(project.getId()); | |||||
retProjectDetail.setReviewDetail(projectReviewDetail); | |||||
Wrapper<MeetingInnerProject> mipQuery = Wrappers.lambdaQuery(MeetingInnerProject.class) | |||||
.eq(MeetingInnerProject::getProjectCode, project.getProjectCode()) | |||||
.notExists(ExistsSqlConst.MEETING_INNER_PROJECT_EXISTS_MEETING + "and m.status != 3") | |||||
.orderByDesc(MeetingInnerProject::getId) | |||||
.last(BizConst.LIMIT_1); | |||||
MeetingInnerProject mip = meetingInnerProjectService.getOne(mipQuery); | |||||
retProjectDetail.setReviewDetail(BeanUtil.copyProperties(mip, ProjectReviewResultDTO.class)); | |||||
return retProjectDetail; | return retProjectDetail; | ||||
} | } | ||||
@@ -867,9 +879,9 @@ public class ProjectLibManage { | |||||
project.setNewest(Boolean.TRUE); | project.setNewest(Boolean.TRUE); | ||||
projectStateMachineUtil.pass(project); | projectStateMachineUtil.pass(project); | ||||
if (projectService.save(project)) { | if (projectService.save(project)) { | ||||
saveApplication(projectDto, project, null); | |||||
savePaymentPlans(project, projectDto.getPaymentPlanList()); | |||||
saveGovSystemReplaceInfos(project.getId(), project.getProjectCode(), projectDto.getSystemReplaceInfos()); | |||||
projectSaveHelper.saveApplication(projectDto, project, null); | |||||
projectSaveHelper.savePaymentPlans(project, projectDto.getPaymentPlanList()); | |||||
projectSaveHelper.saveGovSystemReplaceInfos(project.getId(), project.getProjectCode(), projectDto.getSystemReplaceInfos()); | |||||
} | } | ||||
} else { | } else { | ||||
//否则是重新提交的 新生成一个新版本的项目 | //否则是重新提交的 新生成一个新版本的项目 | ||||
@@ -887,20 +899,6 @@ public class ProjectLibManage { | |||||
} | } | ||||
} | } | ||||
private void savePaymentPlans(Project project, List<ProjectPaymentPlanDTO> paymentPlans) { | |||||
if (CollUtil.isEmpty(paymentPlans)) { | |||||
return; | |||||
} | |||||
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; | |||||
projectAnnualPaymentPlanService.remove(project.getProjectCode(), version); | |||||
List<ProjectAnnualPaymentPlan> plans = paymentPlans.stream().map(w -> { | |||||
ProjectAnnualPaymentPlan plan = BeanUtil.copyProperties(w, ProjectAnnualPaymentPlan.class); | |||||
plan.setProjectCode(project.getProjectCode()); | |||||
plan.setProjectVersion(version); | |||||
return plan; | |||||
}).collect(Collectors.toList()); | |||||
projectAnnualPaymentPlanService.saveBatch(plans); | |||||
} | |||||
/** | /** | ||||
* 在其它项目阶段 保存项目信息和其它相关联的信息 | * 在其它项目阶段 保存项目信息和其它相关联的信息 | ||||
@@ -940,40 +938,12 @@ public class ProjectLibManage { | |||||
oldProj.setIsBackReject(Boolean.TRUE); | oldProj.setIsBackReject(Boolean.TRUE); | ||||
projectService.updateById(oldProj); | projectService.updateById(oldProj); | ||||
projectService.reverseNewest(newProj.getProjectCode(), newProj.getId()); | projectService.reverseNewest(newProj.getProjectCode(), newProj.getId()); | ||||
saveApplication(reqProj, newProj, isConstruct); | |||||
savePaymentPlans(newProj, reqProj.getPaymentPlanList()); | |||||
saveGovSystemReplaceInfos(newProj.getId(), newProj.getProjectCode(), reqProj.getSystemReplaceInfos()); | |||||
projectSaveHelper.saveApplication(reqProj, newProj, isConstruct); | |||||
projectSaveHelper.savePaymentPlans(newProj, reqProj.getPaymentPlanList()); | |||||
projectSaveHelper.saveGovSystemReplaceInfos(newProj.getId(), newProj.getProjectCode(), reqProj.getSystemReplaceInfos()); | |||||
return newProj; | return newProj; | ||||
} | } | ||||
public void saveGovSystemReplaceInfos(Long projectId, | |||||
String projectCode, | |||||
List<GovSystemReplaceInfoDTO> systemReplaceInfos) { | |||||
Wrapper<ProjectGovSystemReplaceInfos> delQuery = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||||
.eq(ProjectGovSystemReplaceInfos::getProjectCode, projectCode); | |||||
projectGovSystemReplaceInfosService.remove(delQuery); | |||||
if (CollUtil.isEmpty(systemReplaceInfos)) { | |||||
return; | |||||
} | |||||
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>(); | |||||
for (int i = 0; i < systemReplaceInfos.size(); i++) { | |||||
GovSystemReplaceInfoDTO curr = systemReplaceInfos.get(i); | |||||
for (int i1 = 0; i1 < curr.getSourceSystemNames().size(); i1++) { | |||||
ProjectGovSystemReplaceInfos replaceInfo = new ProjectGovSystemReplaceInfos(); | |||||
replaceInfo.setProjectId(projectId); | |||||
replaceInfo.setProjectCode(projectCode); | |||||
replaceInfo.setReplaceType(curr.getReplaceType()); | |||||
replaceInfo.setSourceSystem(curr.getSourceSystemNames().get(i1)); | |||||
replaceInfo.setTargetSystem(curr.getTargetSystemName()); | |||||
replaceInfo.setBatchNo(i + 1); | |||||
if (ArrayUtil.isNotEmpty(curr.getSourceSystemIds())) { | |||||
replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1)); | |||||
} | |||||
replaceInfos.add(replaceInfo); | |||||
} | |||||
} | |||||
projectGovSystemReplaceInfosService.saveBatch(replaceInfos); | |||||
} | |||||
public Project saveProjectWithVersionAndStatus(ProjectDTO projectDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { | public Project saveProjectWithVersionAndStatus(ProjectDTO projectDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { | ||||
Project oldProject = projectService.getNoNull(projectDto.getId()); | Project oldProject = projectService.getNoNull(projectDto.getId()); | ||||
@@ -1000,7 +970,7 @@ public class ProjectLibManage { | |||||
if (projectService.save(project)) { | if (projectService.save(project)) { | ||||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | projectService.reverseNewest(project.getProjectCode(), project.getId()); | ||||
saveApplication(projectDto, project, isConstruct); | |||||
projectSaveHelper.saveApplication(projectDto, project, isConstruct); | |||||
} | } | ||||
return project; | return project; | ||||
@@ -1031,7 +1001,7 @@ public class ProjectLibManage { | |||||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | projectService.reverseNewest(project.getProjectCode(), project.getId()); | ||||
//app | //app | ||||
saveApplication(projectDto, project, isConstruct); | |||||
projectSaveHelper.saveApplication(projectDto, project, isConstruct); | |||||
} | } | ||||
return project; | return project; | ||||
@@ -1055,10 +1025,8 @@ public class ProjectLibManage { | |||||
projectInst.setInstCode(instanceId); | projectInst.setInstCode(instanceId); | ||||
projectInst.setInstType(instType); | projectInst.setInstType(instType); | ||||
projectInstService.save(projectInst); | projectInstService.save(projectInst); | ||||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | projectService.reverseNewest(project.getProjectCode(), project.getId()); | ||||
saveApplication(project, oldProject, null); | |||||
projectSaveHelper.saveApplication(project, oldProject, null); | |||||
} | } | ||||
return project; | return project; | ||||
@@ -1096,7 +1064,7 @@ public class ProjectLibManage { | |||||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | projectService.reverseNewest(project.getProjectCode(), project.getId()); | ||||
//APP | //APP | ||||
saveApplication(project, oldProject, Boolean.TRUE); | |||||
projectSaveHelper.saveApplication(project, oldProject, Boolean.TRUE); | |||||
} | } | ||||
return project; | return project; | ||||
@@ -1127,10 +1095,8 @@ public class ProjectLibManage { | |||||
projectInst.setInstCode(instanceId); | projectInst.setInstCode(instanceId); | ||||
projectInst.setInstType(instType); | projectInst.setInstType(instType); | ||||
projectInstService.save(projectInst); | projectInstService.save(projectInst); | ||||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | projectService.reverseNewest(project.getProjectCode(), project.getId()); | ||||
saveApplication(project, oldProject, Boolean.TRUE); | |||||
projectSaveHelper.saveApplication(project, oldProject, Boolean.TRUE); | |||||
} | } | ||||
return project; | return project; | ||||
} | } | ||||
@@ -1464,75 +1430,5 @@ public class ProjectLibManage { | |||||
return res; | return res; | ||||
} | } | ||||
public void saveApplication(Project project, Project oldProject, Boolean isConstruct) { | |||||
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) | |||||
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); | |||||
if (CollUtil.isNotEmpty(apps)) { | |||||
apps.forEach(app -> { | |||||
Long oldAppId = app.getId(); | |||||
app.setProjectVersion(project.getVersion()); | |||||
app.setProjectId(project.getId()); | |||||
app.setId(null); | |||||
if (Objects.nonNull(isConstruct)) { | |||||
app.setIsConstruct(isConstruct); | |||||
} | |||||
projectApplicationService.save(app); | |||||
//核心业务 | |||||
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||||
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); | |||||
if (CollUtil.isNotEmpty(cores)) { | |||||
cores.forEach(c -> { | |||||
c.setId(null); | |||||
c.setApplicationId(app.getId()); | |||||
projectCoreBusinessIndicatorsService.save(c); | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
private void saveApplication(ProjectDTO projectDto, Project project, Boolean isConstruct) { | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
//保存项目应用 | |||||
boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; | |||||
//删除当前版本的app 一般情况是没有 保险起见 | |||||
projectApplicationService.remove(project.getProjectCode(), version); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
projectDto.getApplicationList().forEach(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setId(null); | |||||
projectApplication.setProjectId(project.getId()); | |||||
projectApplication.setProjectCode(project.getProjectCode()); | |||||
projectApplication.setBuildOrgCode(project.getBuildOrgCode()); | |||||
projectApplication.setBuildOrgName(project.getBuildOrgName()); | |||||
projectApplication.setProjectVersion(version); | |||||
projectApplication.setIsConstruct(isConstruct); | |||||
if (StringUtils.isNotBlank(application.getRelatedExistsApplication())) { | |||||
projectApplication.setApplicationName(null); | |||||
} | |||||
boolean result = projectApplicationService.save(projectApplication); | |||||
// 保存应用关联的核心业务 | |||||
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList(); | |||||
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; | |||||
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)) { | |||||
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { | |||||
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); | |||||
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); | |||||
projectCoreBusinessIndicators.setId(null); | |||||
projectCoreBusinessIndicators.setApplicationId(projectApplication.getId()); | |||||
projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now()); | |||||
projectCoreBusinessIndicators.setCreateBy(user.getUsername()); | |||||
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
} | } |