From 56b10268a5fc5eba880ba1f136caf25a49416bf9 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 16 Apr 2024 10:05:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=B3=E6=8A=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/ProjectStateChangeAction.java | 99 +---- .../impl/ProjectStateMachineBuilderImpl.java | 65 ++- .../event/ProjectStateChangeEvent.java | 53 +-- .../dashboard/controller/StatisticsController.java | 9 - .../api/dashboard/manage/FundStatisticsManage.java | 460 --------------------- .../hz/pm/api/meeting/manage/MeetingManage.java | 2 +- .../controller/ConstructionPlanController.java | 55 --- .../controller/DeclaredProjectController.java | 6 +- .../controller/ProjectAdjustmentController.java | 60 --- .../controller/ReviewChecklistController.java | 60 --- .../manage/ConstructionPlanManage.java | 189 --------- .../manage/DeclaredProjectManage.java | 20 +- .../manage/ProjectAdjustmentManage.java | 158 ------- .../manage/ReviewByDeptJointManage.java | 98 ----- .../manage/ReviewChecklistManage.java | 424 ------------------- .../utils/RestartProcessMapUtil.java | 40 -- .../ProjectRenewalFundDeclarationController.java | 29 +- .../handle/stage/ProjectApprovalHandle.java | 6 +- .../api/projectlib/manage/AnnualPlanLibManage.java | 11 +- .../manage/ProjectRenewalFundManage.java | 80 ---- .../model/enumeration/WarningFlowTypeEnum.java | 12 +- .../model/enumeration/status/ProjectStatus.java | 18 +- .../api/scheduler/listener/ProcessEndListener.java | 11 +- .../com/hz/pm/api/sys/manage/NoticeManage.java | 46 +-- .../hz/pm/api/todocenter/manage/HandlerManage.java | 6 +- .../hz/pm/api/sys/project/ProjectStateTest.java | 56 --- 26 files changed, 117 insertions(+), 1956 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java delete mode 100644 hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java index 4f97125..b2176d9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java @@ -49,90 +49,29 @@ public class ProjectStateChangeAction { project.setStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode()); } - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + @OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "ON_PROJECT_REVIEW") + public void COMPLIANCE_REVIEW_PASS(Message message) { Project project = getProject(message); - project.setStatus(ProjectStatus.UNDER_INTERNAL_AUDIT.getCode()); + project.setStatus(ProjectStatus.ON_PROJECT_REVIEW.getCode()); } - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { + @OnTransition(source = "ON_PROJECT_REVIEW", target = "PROJECT_REVIEW_FAILED") + public void PROJECT_REVIEW_FAILED(Message message) { Project project = getProject(message); - project.setStatus(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE.getCode()); + project.setStatus(ProjectStatus.PROJECT_REVIEW_FAILED.getCode()); } - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + @OnTransition(source = "ON_PROJECT_REVIEW", target = "ON_ANNUAL_PLAN") + public void PROJECT_REVIEW_PASS(Message message) { Project project = getProject(message); - project.setStatus(ProjectStatus.UNDER_INTERNAL_AUDIT.getCode()); + project.setStatus(ProjectStatus.ON_ANNUAL_PLAN.getCode()); } - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { + @OnTransition(source = "ON_ANNUAL_PLAN", target = "DECLARED_APPROVED_TO_BE_RECORD") + public void ANNUAL_PLAN_PASS(Message message) { Project project = getProject(message); - project.setStatus(ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.PLAN_TO_BE_DECLARED.getCode()); + project.setStatus(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode()); } //================================================================================================================== @@ -174,20 +113,6 @@ public class ProjectStateChangeAction { project.setStatus(ProjectStatus.TO_BE_PURCHASED.getCode()); } - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = getProject(message); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatus.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatus.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = getProject(message); - project.setStatus(ProjectStatus.TO_BE_PURCHASED.getCode()); - } - @OnTransition(source = "TO_BE_PURCHASED", target = "ON_PURCHASING") public void SUBMIT_PURCHASE_NOTICE(Message message) { Project project = getProject(message); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java index d166618..452240c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java @@ -70,75 +70,64 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder

{ - //选择的年份去计算的数据 - yearCompleteAmount(res, year); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - //近三年 - threeYearsCompleteAmount(res); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - //所有年 用于算累积 - allYearsCompleteAmount(res); - }, ForkJoinPool.commonPool()) - ).join(); - - return res; - } - - /** - * 计算 所有年的 - * - * @param res - */ - private void allYearsCompleteAmount(FundStatisticsVO res) { - //1.申报项目 和 归集项目 - //申报项目 - List allProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .in(Project::getProjectYear, years)); - - //项目归集 - List allApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjSetYear, years)); - - List allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - - List allBaseInfos; - List allApplies = Lists.newArrayList(); - List allApproves = Lists.newArrayList(); - List allProcures = Lists.newArrayList(); - - if (CollUtil.isNotEmpty(allProjIds)) { - allBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId, allProjIds)); - if (CollUtil.isNotEmpty(allBaseInfos)) { - List allBaseProjIds = allBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - allApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId, allBaseProjIds)); - allApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId, allBaseProjIds)); - allProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId, allBaseProjIds)); - } - } - - //2.4 累积 核减 - res.setAccumulatedDeductionTotalAmount(completeDeductionAmount(allProjects, allApplies, - allApproves, allProcures)); - } - - /** - * 计算核减资金的方法 - * - * @param projects - * @param applies - * @param approves - * @param procures - * @return - */ - private BigDecimal completeDeductionAmount(List projects, - List applies, List approves, - List procures) { - //首先完成年度计划 并且未注销的项目 - List normalProjects = projects.stream().filter(p -> { - if (Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatus.BE_SUSPENDED.getCode()) > 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - //计划核减 - FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(normalProjects, applies, approves); - //批复核减 - FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(normalProjects, approves, planHejian.getApproval()); - //合同核减 - FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(normalProjects, procures, approvalHejian.getApproval()); - - return planHejian.getDiff().add(approvalHejian.getDiff()).add(contractHejian.getDiff()); - } - - //计算 计划阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computePlanHeJian(List projects, List applies, - List approves) { - FundStatisticsVO.HeJianAmount heJianAmount = new FundStatisticsVO.HeJianAmount(); - - //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) - final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; - projects.stream().map(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); - final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; - applies.stream().map(g -> Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); - BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); - heJianAmount.setApprove(declaredAmountApproveTotal); - - //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) - final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; - projects.stream().map(p -> Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); - final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; - approves.stream().map(p -> Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); - BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); - heJianAmount.setApproval(approvalAmountApproveTotal); - //申报的差额 - BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); - heJianAmount.setDiff(subtractApprove); - return heJianAmount; - } - - //计算 批复阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computeApprovalHeJian(List projects, List approves, - BigDecimal approvalAmountApproveTotal) { - FundStatisticsVO.HeJianAmount approvalHejian = new FundStatisticsVO.HeJianAmount(); - approvalHejian.setApprove(approvalAmountApproveTotal); - //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) - final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; - projects.stream().map(p -> Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); - final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; - approves.stream().map(p -> Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); - BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); - approvalHejian.setApproval(approvalAmountApprovalTotal); - //批复的差额 - BigDecimal subtractApproval = approvalAmountApproveTotal.subtract(approvalAmountApprovalTotal); - approvalHejian.setDiff(subtractApproval); - return approvalHejian; - } - - //计算 合同阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computeContractHeJian(List projects, List procures, - BigDecimal approvalAmountApprovalTotal) { - FundStatisticsVO.HeJianAmount contractHejian = new FundStatisticsVO.HeJianAmount(); - contractHejian.setApprove(approvalAmountApprovalTotal); - //合同的批复金额(申报项目:成交金额 项目归集:成交金额) - final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; - projects.stream().map(p -> Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); - final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; - procures.stream().map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? p.getBaseProjPurchaseAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); - BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); - contractHejian.setApproval(approvalAmountContractTotal); - //合同的差额 - BigDecimal subtractContract = approvalAmountApprovalTotal.subtract(approvalAmountContractTotal); - contractHejian.setDiff(subtractContract); - return contractHejian; - } - - /** - * 近三年 - * - * @param res - */ - private void threeYearsCompleteAmount(FundStatisticsVO res) { - //申报项目 - List threeYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .in(Project::getProjectYear, threeYears)); - //项目归集 - List threeYearsApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjSetYear, threeYears)); - List threeYearsProjIds = threeYearsApplieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - List threeYearsBaseInfos = Lists.newArrayList(); - List threeYearsApplies = Lists.newArrayList(); - List threeYearsApproves = Lists.newArrayList(); - List threeYearsProcures = Lists.newArrayList(); - - if (CollUtil.isNotEmpty(threeYearsProjIds)) { - threeYearsBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId, threeYearsProjIds)); - if (CollUtil.isNotEmpty(threeYearsBaseInfos)) { - List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - threeYearsApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId, threeYearsBaseProjIds)); - threeYearsApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId, threeYearsBaseProjIds)); - threeYearsProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId, threeYearsBaseProjIds)); - } - } - - //2.4 近三年 核减 - res.setThreeYearsDeductionTotalAmount(completeDeductionAmount(threeYearsProjects, threeYearsApplies, - threeYearsApproves, threeYearsProcures)); - - //安全起见 再排序下 - Arrays.sort(threeYears); - - List threeYearsDeduction = Lists.newArrayList(); - for (Integer year : threeYears) { - FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData(); - //申报项目 - List thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getProjectYear, year)); - //项目归集 - List thisYearApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjSetYear, year)); - List thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - List thisYearBaseInfos; - List thisYearApplies = Lists.newArrayList(); - List thisYearApproves = Lists.newArrayList(); - List thisYearProcures = Lists.newArrayList(); - - if (CollUtil.isNotEmpty(thisYearProjIds)) { - thisYearBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId, threeYearsProjIds)); - if (CollUtil.isNotEmpty(thisYearBaseInfos)) { - List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - thisYearApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId, threeYearsBaseProjIds)); - thisYearApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId, threeYearsBaseProjIds)); - thisYearProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId, threeYearsBaseProjIds)); - } - } - amountData.setName(year.toString()); - amountData.setAmount(completeDeductionAmount(thisYearsProjects, thisYearApplies, - thisYearApproves, thisYearProcures)); - threeYearsDeduction.add(amountData); - } - res.setThreeYearsDeduction(threeYearsDeduction); - } - - /** - * 选择年份去计算 - * - * @param res - */ - private void yearCompleteAmount(FundStatisticsVO res, Integer year) { - //申报项目 - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE) - .eq(Objects.nonNull(year), Project::getProjectYear, year) - .in(Objects.isNull(year), Project::getProjectYear, years)); - //项目归集 - List applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(Objects.nonNull(year), GovBizProjectApply::getBaseProjSetYear, year) - .in(Objects.isNull(year), GovBizProjectApply::getBaseProjSetYear, years)); - List yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) - .collect(Collectors.toList()); - List baseInfos = Lists.newArrayList(); - List applies = Lists.newArrayList(); - List approves = Lists.newArrayList(); - List procures = Lists.newArrayList(); - if (CollUtil.isNotEmpty(yearProjIds)) { - baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId, yearProjIds)); - if (CollUtil.isNotEmpty(baseInfos)) { - List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId, baseProjIds)); - approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId, baseProjIds)); - procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId, baseProjIds)); - } - } - //2 - //2.1 总申请金额 - final BigDecimal[] declaredTotalAmount = {BigDecimal.ZERO}; - projects.stream() - .map(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> declaredTotalAmount[0] = b); - final BigDecimal[] declaredTotalAmountGov = {BigDecimal.ZERO}; - applies.stream() - .map(a -> Objects.nonNull(a.getBaseProjTotalAmount()) ? a.getBaseProjTotalAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> declaredTotalAmountGov[0] = b); - res.setDeclaredTotalAmount(declaredTotalAmount[0].add(declaredTotalAmountGov[0])); - //2.2 总批复金额 - final BigDecimal[] approvalTotalAmount = {BigDecimal.ZERO}; - projects.stream() - .map(p -> Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalTotalAmount[0] = b); - final BigDecimal[] approvalTotalAmountGov = {BigDecimal.ZERO}; - approves.stream() - .map(a -> Objects.nonNull(a.getBaseExpertTotalMoney()) ? a.getBaseExpertTotalMoney() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> approvalTotalAmountGov[0] = b); - res.setApprovalTotalAmount(approvalTotalAmount[0].add(approvalTotalAmountGov[0])); - //2.3 总合同金额 - final BigDecimal[] contractTotalAmount = {BigDecimal.ZERO}; - projects.stream() - .map(p -> Objects.nonNull(p.getContractAmount()) ? p.getContractAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> contractTotalAmount[0] = b); - final BigDecimal[] contractTotalAmountGov = {BigDecimal.ZERO}; - procures.stream() - .map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? p.getBaseProjPurchaseAmount() : BigDecimal.ZERO) - .reduce(BigDecimal::add).ifPresent(b -> contractTotalAmountGov[0] = b); - res.setApprovalTotalAmount(contractTotalAmount[0].add(contractTotalAmountGov[0])); - - //计划核减 - FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(projects, applies, approves); - //批复核减 - FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(projects, approves, planHejian.getApproval()); - //合同核减 - FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(projects, procures, approvalHejian.getApproval()); - res.setPlanDeduction(planHejian); - res.setApprovalDeduction(approvalHejian); - res.setContractDeduction(contractHejian); - - //部门TOP10 - res.setDepartmentTop10(computeTop10(projects, baseInfos, applies, approves, procures)); - } - - /** - * 计算 部门TOP10 - * - * @param projects - * @param applies - * @param approves - * @param procures - * @return - */ - private List computeTop10(List projects, List baseInfos, - List applies, List approves, - List procures) { - //申报项目颗粒度 - Map> groupProjectMap = projects.stream() - .filter(p -> StringUtils.isNotBlank(p.getBuildOrgCode())) - .collect(Collectors.groupingBy(Project::getBuildOrgCode)); - List projectAmounts = Lists.newArrayList(); - for (Map.Entry> entry : groupProjectMap.entrySet()) { - FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData(); - List ps = entry.getValue(); - if (CollUtil.isNotEmpty(ps)) { - orgAmount.setName(ps.get(0).getBuildOrgName()); - } - orgAmount.setAmount(completeDeductionAmount(entry.getValue(), - Collections.emptyList(), Collections.emptyList(), - Collections.emptyList())); - projectAmounts.add(orgAmount); - } - - //项目归集颗粒度 - Map> groupGovMap = baseInfos.stream() - .filter(b -> StringUtils.isNotBlank(b.getBaseBuildDeprtDing())) - .collect(Collectors.groupingBy(GovBizProjectBaseinfo::getBaseBuildDeprtDing)); - List govAmounts = Lists.newArrayList(); - for (Map.Entry> entry : groupGovMap.entrySet()) { - FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData(); - List bs = entry.getValue(); - List baseProjIds = Lists.newArrayList(); - if (CollUtil.isNotEmpty(bs)) { - govAmount.setName(bs.get(0).getBaseBuildDeprt()); - baseProjIds = bs.stream().map(GovBizProjectBaseinfo::getBaseProjId) - .collect(Collectors.toList()); - } - - List finalBaseProjIds = baseProjIds; - List appliesThis = applies.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) - && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); - List approvesThis = approves.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) - && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); - List procuresThis = procures.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) - && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); - govAmount.setAmount(completeDeductionAmount(Collections.emptyList(), - appliesThis, approvesThis, procuresThis)); - govAmounts.add(govAmount); - } - - //求出TOP10 - return Stream.concat(projectAmounts.stream(), govAmounts.stream()) - .collect(Collectors.toMap(FundStatisticsVO.AmountData::getName, Function.identity(), - (v1, v2) -> { - v1.setAmount(v1.getAmount().add(v2.getAmount())); - return v1; - })).values().stream() - .sorted(Comparator.comparing(FundStatisticsVO.AmountData::getAmount).reversed()) - .limit(10).collect(Collectors.toList()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index ee4ba24..a4ecb0a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -871,7 +871,7 @@ public class MeetingManage { buildOptionProjectQuery(query, meetingType, ProjectStatus.ON_FINALLY_INSPECTED); break; case DEPT_JOIN_REVIEW: - buildOptionProjectQuery(query, meetingType, ProjectStatus.DEPARTMENT_JOINT_REVIEW); + buildOptionProjectQuery(query, meetingType, null); break; case FAIRNESS_REVIEW: break; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java deleted file mode 100644 index c3fc974..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.hz.pm.api.projectdeclared.controller; - -import com.hz.pm.api.common.util.ExcelDownUtil; -import com.hz.pm.api.projectdeclared.manage.ConstructionPlanManage; -import com.hz.pm.api.projectdeclared.model.dto.ContructionSuggestionsDTO; -import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; - -/** - * @Classname ConstructionPlanController - * @Description 建设方案申报 - * @Date 2023/2/13 9:53 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/construction") -@Api(tags = "申报管理-建设方案申报") -@RequiredArgsConstructor -public class ConstructionPlanController { - - private final ConstructionPlanManage constructionPlanManage; - - @ApiOperation(value = "可申报建设方案项目列表", notes = "可申报建设方案项目列表") - @GetMapping("/list") - public PageVo list(@Validated @ModelAttribute ConstrctionPlanListReq planReq) { - return constructionPlanManage.projectLibList(planReq); - } - - @GetMapping("/export") - @ApiOperation("可申报建设方案项目列表导出") - @WebLog("可申报建设方案项目列表导出") - public void exportList(ConstrctionPlanListReq planReq, HttpServletResponse response) { - ExcelDownUtil.downXls(response, planReq, constructionPlanManage::exportList); - } - - @ApiOperation(value = "建设方案专家建议", notes = "建设方案专家建议") - @WebLog("建设方案专家建议") - @PostMapping("/construction-suggestions") - public String constructionSuggestions(@Validated @RequestBody ContructionSuggestionsDTO dto) { - constructionPlanManage.constructionSuggestions(dto); - return "专家建设方案建议保存成功"; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java index 1da752f..7281479 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java @@ -2,7 +2,6 @@ package com.hz.pm.api.projectdeclared.controller; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; -import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectListParamDTO; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; @@ -36,9 +35,8 @@ import javax.servlet.http.HttpServletResponse; @Api(value = "DeclaredProject", tags = "申报管理-申报项目") @RequiredArgsConstructor public class DeclaredProjectController { - private final DeclaredProjectManage declaredProjectManage; - private final ProjectAdjustmentManage projectAdjustmentManage; + private final DeclaredProjectManage declaredProjectManage; @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") @GetMapping("/list") @@ -90,7 +88,7 @@ public class DeclaredProjectController { @WebLog("重新申报项目") @PostMapping("/restart") public String reStartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - return projectAdjustmentManage.adjustment(dto); + return declaredProjectManage.reStartTheProcess(dto); } @GetMapping("/export") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java deleted file mode 100644 index 0c99307..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hz.pm.api.projectdeclared.controller; - -import cn.hutool.core.io.FileUtil; -import com.hz.pm.api.common.util.ExcelDownUtil; -import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage; -import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.hz.pm.api.projectdeclared.model.req.AdjustmentListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.util.Comparator; -import java.util.List; - -/** - * @Classname ConstructionPlanController - * @Description 建设方案申报 - * @Date 2023/2/13 9:53 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/project/adjustment") -@Api(value = "ProjectAdjustment", tags = "申报管理-项目内容调整") -@RequiredArgsConstructor -public class ProjectAdjustmentController { - - private final ProjectAdjustmentManage projectAdjustmentManage; - - @ApiOperation(value = "可做项目内容调整的列表", notes = "可做项目内容调整的列表") - @GetMapping("/list") - public PageVo list(@Validated @ModelAttribute AdjustmentListReq preReq) { - return projectAdjustmentManage.projectLibList(preReq); - } - - @ApiOperation(value = "项目内容调整", notes = "项目内容调整") - @WebLog("项目内容调整") - @PostMapping - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - String instanceId = projectAdjustmentManage.adjustment(dto); - return "项目内容调整并且重新申报 【" + instanceId + "】 成功"; - } - - @GetMapping("/export") - @ApiOperation("项目内容调整列表导出") - @WebLog("项目内容调整列表导出") - public void exportList(AdjustmentListReq preReq, HttpServletResponse response){ - ExcelDownUtil.downXls(response,preReq,projectAdjustmentManage::exportList); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java deleted file mode 100644 index a0c9ddb..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hz.pm.api.projectdeclared.controller; - -import com.hz.pm.api.projectdeclared.manage.ReviewChecklistManage; -import com.hz.pm.api.projectdeclared.model.dto.ReviewChecklistApproveDTO; -import com.hz.pm.api.projectlib.model.req.ProjectListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectReviewCheckListItemVO; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.wflow.bean.dto.FormsReviewChecklistDto; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * @Classname ReviewChecklistController - * @Description - * @Date 2023/11/7 17:00 - * @Author PoffyZhang - */ -@Slf4j -@Validated -@RestController -@RequestMapping("/api/v1/review-checklist") -@Api(value = "Review-Checklist", tags = "审查清单") -@RequiredArgsConstructor -public class ReviewChecklistController { - - private final ReviewChecklistManage reviewChecklistManage; - - @ApiOperation(value = "建设方案后审查清单", notes = "建设方案后审查清单") - @GetMapping("/list") - public PageVo list(@ModelAttribute ProjectListReq req) { - return reviewChecklistManage.projectLibList(req); - } - - @ApiOperation(value = "审查清单审核", notes = "审查清单审核") - @PostMapping("/approve") - @WebLog("审查清单审核") - public String approve(@RequestBody List dtos) { - return reviewChecklistManage.approve(dtos); - } - - @ApiOperation(value = "查看某个项目的意见汇总", notes = "查看某个项目的意见汇总") - @GetMapping("/summary-list/{projectCode}") - public List summaryList(@PathVariable String projectCode) { - return reviewChecklistManage.summaryList(projectCode); - } - - @ApiOperation(value = "意见汇总提交", notes = "意见汇总提交") - @PostMapping("/summary/{projectCode}") - @WebLog("意见汇总提交") - public String summary(@PathVariable String projectCode) { - return reviewChecklistManage.summary(projectCode); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java deleted file mode 100644 index f0a78aa..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.hz.pm.api.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.alibaba.excel.EasyExcel; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.CommonConst; -import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; -import com.hz.pm.api.common.util.ExcelDownUtil; -import com.hz.pm.api.common.util.ExcelExportStyle; -import com.hz.pm.api.projectdeclared.model.dto.ConstructionPlanExportDTO; -import com.hz.pm.api.projectdeclared.model.dto.ContructionSuggestionsDTO; -import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; -import com.hz.pm.api.projectdeclared.service.IConstructionSuggestionsService; -import com.hz.pm.api.projectlib.helper.ProjectHelper; -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.ProjectInst; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import com.hz.pm.api.projectlib.model.req.ProjectListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import com.hz.pm.api.projectlib.service.IProjectInstService; -import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.util.LoginUserUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.NdDateUtils; -import com.wflow.exception.BusinessException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname DeclaredProjectManage - * @Description - * @Date 2023/2/1 14:48 - * @Author PoffyZhang - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ConstructionPlanManage { - - private final IProjectService projectService; - private final ProjectStateMachineUtil projectStateMachineUtil; - private final IProjectInstService projectInstService; - private final ProjectLibManage projectLibManage; - private final IConstructionSuggestionsService constructionSuggestionsService; - - /** - * 提交建设方案项目 时 更新信息 - * - * @param project - * @param instanceId - */ - private void modifyProject(Project project, String instanceId, String constructionPlanFile) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - project.setUpdateOn(LocalDateTime.now()); - project.setInstCode(instanceId); - project.setConstructionPlanFile(constructionPlanFile); - //调用状态机 进入下一个通过状态 - projectStateMachineUtil.pass(project); - projectService.updateById(project); - - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setInstType(InstTypeEnum.CONSTRUCTION_PLAN_REVIEW); - projectInstService.save(projectInst); - } catch (Exception e) { - log.error("提交建设方案 项目信息修改 错误 ", e); - throw new BusinessException("提交建设方案 项目信息修改 错误 :" + e.getMessage()); - } - } - - /** - * 查项目 - * - * @param planReq - * @return - */ - public PageVo projectLibList(ConstrctionPlanListReq planReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(planReq, req); - //项目阶段 状态 已定 方案待申报 - req.setStage(ProjectStatus.NOT_APPROVED.getCode()); - req.setStatus(ProjectStatus.PLAN_TO_BE_DECLARED.getCode()); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - // 放入用户的单位 - req.setBuildOrgCode(user.getMhUnitIdStr()); - return projectLibManage.projectLibList(req); - } - - public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(planReq, req); - //项目阶段 状态 已定 方案待申报 - req.setStage(ProjectStatus.NOT_APPROVED.getCode()); - req.setStatus(ProjectStatus.PLAN_TO_BE_DECLARED.getCode()); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - //放入用户的单位 - req.setBuildOrgCode(user.getMhUnitIdStr()); - req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); - req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - Page page = projectService.page(req.page(), query); - List records = page.getRecords(); - - - List collect = records.stream().map(r -> { - ConstructionPlanExportDTO exportDTO = new ConstructionPlanExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - return exportDTO; - }).collect(Collectors.toList()); - for (int i = 0; i < collect.size(); i++) { - collect.get(i).setSerialNumber(i + 1); - } - String fileName = "建设方案申报项目列表"; - ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new BizException(e); - } - } - - /** - * 专家建设方案建议 暂存 等流程成功后 保存到项目 - * - * @param dto \ - */ - public void constructionSuggestions(ContructionSuggestionsDTO dto) { - String instanceId = dto.getInstanceId(); - - Project project = projectService.getProjectByCode(dto.getProjectCode()); - if (Objects.isNull(project)) { - throw new BizException("该项目不存在!"); - } - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .eq(ProjectInst::getProjectId, project.getId()) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(projectInst)) { - throw new BizException("该流程的项目关联信息不存在!"); - } - - if (!InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(projectInst.getInstType())) { - throw new BizException("此流程不是建设方案流程 保存失败!"); - } - - ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto, ProjectConstructionSuggestions.class); - ProjectConstructionSuggestions pcs = constructionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) - .eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode()) - .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) - .last(BizConst.LIMIT_1)); - if (Objects.nonNull(pcs)) { - saveEntity.setId(pcs.getId()); - } - saveEntity.setInstanceId(instanceId); - constructionSuggestionsService.saveOrUpdate(saveEntity); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 78043ce..7dd0300 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -177,14 +177,14 @@ public class DeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public synchronized String reStartTheProcess(DefaultDeclaredDTO req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); ProjectDTO reqProj = req.getProjectInfo(); + Assert.notNull(reqProj.getId(), "提交失败,缺少项目ID!"); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); reqProj.setBuildOrgCode(user.getMhUnitIdStr()); reqProj.setBuildOrgName(user.getMhUnitName()); - VUtils.isTrue(Objects.isNull(reqProj.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(reqProj.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + Assert.notNull(projectInfo, "提交失败 此项目不存在!"); //项目名称去重 if (StringUtils.isNotBlank(reqProj.getProjectName()) && @@ -198,7 +198,7 @@ public class DeclaredProjectManage { projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); //如果主管单位没有 那么主管单位就是自己 - if (CommonEnum.NO.getCode().equals(reqProj.getIsSuperOrg())) { + if (CommonEnum.NO.eq(reqProj.getIsSuperOrg())) { projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); projectInfo.setSuperOrg(user.getMhUnitName()); reqProj.setSuperOrgCode(user.getMhUnitIdStr()); @@ -216,8 +216,7 @@ public class DeclaredProjectManage { } //首先要判断 项目当前状态 是不是 单位内部拒绝 - VUtils.isTrue(!ProjectStatus.COMPLIANCE_REVIEW_FAILED.eq(projectInfo.getStatus()) || - !ProjectStatus.NOT_APPROVED.eq(projectInfo.getStage())) + VUtils.isTrue(!ProjectStatus.COMPLIANCE_REVIEW_FAILED.eq(projectInfo.getStatus())) .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); ProcessStartParamsVo instParam = new ProcessStartParamsVo(); @@ -232,15 +231,15 @@ public class DeclaredProjectManage { BeanUtils.copyProperties(reqProj, project); Map orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); String instId = processService.startProcessLs(model, instParam, orgModelMap); - log.info("重新申报项目成功 【{}】", instId); + log.info("重新申报项目成功:{} ==> {}", project.getProjectCode(), instId); //保存项目相关 - Project buildProject = projectLibManage.saveProjectInDeclared(reqProj, instId, + Project newProj = projectLibManage.saveProjectInDeclared(reqProj, instId, user.getUserId(), ProjectStatus.NOT_APPROVED, ProjectStatus.COMPLIANCE_REVIEW_FAILED, ProjectProcessStageEnum.COMPLIANCE_REVIEW); //发送给第一个审批人消息 - noticeManage.sendFirstUser(buildProject, model.getFormName(), instId, + noticeManage.sendFirstUser(newProj, model.getFormName(), instId, WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instId; @@ -286,7 +285,8 @@ public class DeclaredProjectManage { vo.setPaymentPlanList(JSONUtil.toList(draft.getPaymentPlans(), ProjectPaymentPlanDTO.class)); } if (StrUtil.isNotBlank(draft.getDynamicForm())) { - vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(), Map.class)); + vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(), new TypeReference>() { + })); } if (StrUtil.isNotBlank(draft.getGovSystemReplaceInfos())) { vo.setSystemReplaceInfos(JSONUtil.toList(draft.getGovSystemReplaceInfos(), GovSystemReplaceInfoDTO.class)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java deleted file mode 100644 index c8cb7f3..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.hz.pm.api.projectdeclared.manage; - -import com.alibaba.excel.EasyExcel; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.util.ExcelDownUtil; -import com.hz.pm.api.common.util.ExcelExportStyle; -import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.hz.pm.api.projectdeclared.model.dto.ProjectAdjustmentExportDTO; -import com.hz.pm.api.projectdeclared.model.req.AdjustmentListReq; -import com.hz.pm.api.projectdeclared.utils.RestartProcessMapUtil; -import com.hz.pm.api.projectlib.helper.ProjectHelper; -import com.hz.pm.api.projectlib.manage.ProjectLibManage; -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.enumeration.ProjectTypeNewEnum; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import com.hz.pm.api.projectlib.model.req.ProjectListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.user.security.model.UserFullInfoDTO; -import com.hz.pm.api.user.util.LoginUserUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.NdDateUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @Classname ProjectAdjustmentManage - * @Description 项目内容调整 - * @Date 2023/2/1 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ProjectAdjustmentManage { - - private final IProjectService projectService; - - private final DeclaredProjectHelper declaredProjectHelper; - - private final ProjectLibManage projectLibManage; - - private final UserInfoHelper userInfoHelper; - - /** - * 项目内容调整 - * - * @param dto - * @return - */ - @Transactional(rollbackFor = Exception.class) - public String adjustment(DefaultDeclaredDTO dto) { - ProjectDTO projectDto = dto.getProjectInfo(); - Project projectInfo = projectService.getById(projectDto.getId()); - - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); - - //项目名称去重 - if (StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())) { - projectDto.setProjectCode(projectInfo.getProjectCode()); - declaredProjectHelper.checkDuplication(projectDto); - } - - //金额check - if (Objects.nonNull(projectDto.getDeclareAmount())) { - declaredProjectHelper.checkAmount(projectDto); - } - - //最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 - Function declaredFunction = - RestartProcessMapUtil.getRestartFunction(projectInfo.getStatus()); - VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!"); - return declaredFunction.apply(dto); - } - - private static final List PROJECT_STATUS = Collections.singletonList( - ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - - /** - * 项目库 - * - * @param preReq - * @return - */ - public PageVo projectLibList(AdjustmentListReq preReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq, req); - //项目阶段 状态 已定 方案待申报 - req.setStageList(Collections.singletonList(ProjectStatus.NOT_APPROVED.getCode())); - //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(PROJECT_STATUS); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - req.setBuildOrgCode(user.getMhUnitIdStr()); - return projectLibManage.projectLibList(req); - } - - public void exportList(HttpServletResponse response, AdjustmentListReq preReq) { - //限定参数 复制bean - ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq, req); - //项目阶段 状态 已定 方案待申报 - req.setStageList(Collections.singletonList(ProjectStatus.NOT_APPROVED.getCode())); - //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(PROJECT_STATUS); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - req.setBuildOrgCode(user.getMhUnitIdStr()); - - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - List records = projectService.list(query); - - AtomicInteger serialNumber = new AtomicInteger(0); - List collect = records.stream().map(r -> { - ProjectAdjustmentExportDTO exportDTO = new ProjectAdjustmentExportDTO(); - BeanUtils.copyProperties(r, exportDTO); - exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); - exportDTO.setStatusName(ProjectStatus.getDesc(r.getStatus())); - String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); - exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); - return exportDTO; - }).collect(Collectors.toList()); - String fileName = "项目内容调整列表"; - ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ProjectAdjustmentExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new BizException(e); - } - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java deleted file mode 100644 index 9f4c681..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.hz.pm.api.projectdeclared.manage; - -import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; -import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.projectlib.manage.ProjectLibManage; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.staging.enums.MsgTypeEnum; -import com.hz.pm.api.sys.manage.NoticeManage; -import com.hz.pm.api.sys.manage.ProcessModelManage; -import com.hz.pm.api.todocenter.constant.WorkNoticeConst; -import com.hz.pm.api.user.security.model.UserFullInfoDTO; -import com.ningdatech.basic.function.VUtils; -import com.wflow.bean.entity.WflowModels; -import com.wflow.exception.BusinessException; -import com.wflow.workflow.bean.dto.OrgInfoDTO; -import com.wflow.workflow.bean.vo.ProcessStartParamsVo; -import com.wflow.workflow.service.ProcessInstanceService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collections; -import java.util.Map; -import java.util.Objects; - -/** - * @Classname ReviewByDeptJointManage - * @Description 部门联审 - * @Date 2023/2/17 14:48 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ReviewByDeptJointManage { - - private final IProjectService projectService; - private final ProcessModelManage processModelManage; - private final ProcessInstanceService processService; - private final DeclaredProjectHelper declaredProjectManage; - private final ProjectLibManage projectLibManage; - private final DeclaredProjectHelper declaredProjectHelper; - private final NoticeManage noticeManage; - private final UserInfoHelper userInfoHelper; - - /** - * 部门联审 - * - * @param project - * @return - */ - @Transactional(rollbackFor = Exception.class) - public Boolean startTheProcess(Project project) { - //这里是任务发起的 所以用项目发起人 - UserFullInfoDTO startUser = userInfoHelper.getUserFullInfo(project.getSponsor()); - VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); - Project projectInfo = projectService.getNewProject(project.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - - WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS, - startUser.getMhUnitId()); - - if (Objects.isNull(model)) { - throw new BusinessException("找不到部门联审申报流程配置"); - } - //要判断 项目当前状态 是不是 部门联审 - VUtils.isTrue(!ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) || - !ProjectStatus.NOT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); - - // 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人 - VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())).throwMessage("提交失败 项目信息 缺少项目发起人!"); - - ProcessStartParamsVo params = new ProcessStartParamsVo(); - //发起人的信息 - params.setUser(declaredProjectManage.buildUser(startUser)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 - declaredProjectHelper.buildCondition(params, projectInfo); - - // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgMap = declaredProjectHelper.buildOrgModelMap(startUser.getUserId(), project); - String instanceId = processService.startProcessLs(model, params, orgMap); - log.info("部门联审申报成功 【{}】", instanceId); - - //保存项目信息 - projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); - - //发送给第一个审批人消息 - noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - return Boolean.TRUE; - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java deleted file mode 100644 index 71d1e20..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ /dev/null @@ -1,424 +0,0 @@ -package com.hz.pm.api.projectdeclared.manage; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.NumberUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Assert; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.datascope.model.DataScopeDTO; -import com.hz.pm.api.datascope.utils.DataScopeUtil; -import com.hz.pm.api.projectdeclared.contant.DeclaredProjectConst; -import com.hz.pm.api.projectdeclared.model.dto.ReviewChecklistApproveDTO; -import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; -import com.hz.pm.api.projectdeclared.service.IReviewChecklistApproveService; -import com.hz.pm.api.projectlib.helper.ProjectHelper; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import com.hz.pm.api.projectlib.model.req.ProjectListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectReviewCheckListItemVO; -import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.user.security.model.UserFullInfoDTO; -import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.util.LoginUserUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.StrPool; -import com.wflow.bean.dto.FormsReviewChecklistDto; -import com.wflow.bean.dto.ReviewChecklistModuleDto; -import com.wflow.enums.ReviewChecklistResultEnum; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname ReviewChecklistManage - * @Description - * @Date 2023/11/7 17:04 - * @Author PoffyZhang - */ -@Component -@Slf4j -@RequiredArgsConstructor -public class ReviewChecklistManage { - - @Value("${spring.profiles.active}") - private String active; - - private final IProjectService projectService; - - private final IReviewChecklistApproveService reviewChecklistApproveService; - - private final UserInfoHelper userInfoHelper; - - public PageVo projectLibList(ProjectListReq req) { - LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //项目查最新 - query.eq(Project::getNewest, Boolean.TRUE); - //建设方案提交后的状态 - query.ge(Project::getStatus, null) - .ne(Project::getStatus, ProjectStatus.PLAN_TO_BE_DECLARED.getCode()); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - buildReviewCheckPermission(query, user); - - Page page = projectService.page(req.page(), query); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - List projectCodes = page.getRecords().stream().map(Project::getProjectCode) - .collect(Collectors.toList()); - //求出 审查了的 信息 - List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .in(ReviewChecklistApprove::getProjectCode, projectCodes)); - Map> approveMap = - approves.stream().collect(Collectors.groupingBy(ReviewChecklistApprove::getProjectCode)); - - List reviewHumans; - // TODO - if (BizConst.DEV.equals(active)) { - reviewHumans = new ArrayList<>(); - } else { - reviewHumans = new ArrayList<>(); - } - Map userMap; - if (!reviewHumans.isEmpty()) { - List users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans); - userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername); - } else { - userMap = Collections.emptyMap(); - } - - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setApprovedAmount(w.getApprovalAmount()); - // item.setAnnualPlanAmount(w.getAnnualPlanAmount()); - // 审查人员情况 - item.setVerifiedHumans(computeVerify(item, approveMap.get(w.getProjectCode()), userMap, user)); - item.setReviewCheckFinish(w.getReviewCheckFinish()); - return item; - }); - return PageVo.of(records, page.getTotal()); - } - - private String computeVerify(ProjectReviewCheckListItemVO item, List reviewChecklistApproves, - Map userMap, UserInfoDetails user) { - List reviewHumans; - if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; - } else { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - - int maxNums = reviewHumans.size(); - Integer finishNums = 0; - Set computeHumanSet = new HashSet<>(reviewHumans); - if (CollUtil.isEmpty(reviewChecklistApproves)) { - item.setReviewCheckNotApprove(convertUser(userMap, computeHumanSet)); - return finishNums + StrPool.SLASH + maxNums; - } - for (ReviewChecklistApprove approve : reviewChecklistApproves) { - if (StringUtils.isNotBlank(approve.getCreateByCode()) || - computeHumanSet.contains(approve.getCreateByCode())) { - if (StringUtils.isNotBlank(user.getEmployeeCode()) && - user.getEmployeeCode().equals(approve.getCreateByCode())) { - item.setApproved(Boolean.TRUE); - } - if (computeHumanSet.remove(approve.getCreateByCode())) { - //说明 有指定人 审核过 - finishNums++; - } - } - } - item.setReviewCheckNotApprove(convertUser(userMap, computeHumanSet)); - - return finishNums + StrPool.SLASH + maxNums; - } - - private String convertUser(Map userMap, Set computeHumanSet) { - if (CollUtil.isEmpty(userMap) || CollUtil.isEmpty(computeHumanSet)) { - return StringUtils.EMPTY; - } - return computeHumanSet.stream() - .filter(NumberUtil::isNumber) - .map(w -> userMap.get(Long.parseLong(w))) - .collect(Collectors.joining(StrPool.COMMA)); - } - - public UserFullInfoDTO buildReviewCheckPermission(LambdaQueryWrapper query, UserInfoDetails user) { - UserFullInfoDTO userDto = BeanUtil.copyProperties(user, UserFullInfoDTO.class); - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(userDto); - if (!currentUserDataScope.isPresent()) { - log.warn("没有取到权限信息 当前查询 没有权限条件"); - query.eq(Project::getId, 0L); - return userDto; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 看不了 - query.eq(Project::getId, 0L); - break; - case COMPANY_MANAGER: - case VISITOR: - case DASHBOARD: - //单位管理员 看 - query.eq(Project::getId, 0L); - break; - case SUPER_ADMIN: - //超级管理员 可以看 - break; - case REGION_MANAGER: - //区域管理员 可以看 - break; - default: - //没有权限的话 就让它查不到 - query.eq(Project::getId, 0L); - break; - } - return userDto; - } - - /** - * 去审批 - * - * @param dtos \ - * @return \ - */ - public String approve(List dtos) { - if (CollUtil.isEmpty(dtos)) { - throw new BizException("传入数据不能为空!"); - } - ReviewChecklistApproveDTO reviewChecklistApproveFirst = dtos.get(0); - String projectCode = reviewChecklistApproveFirst.getProjectCode(); - - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - Long userId = user.getUserId(); - String employeeCode = user.getEmployeeCode(); - String username = user.getUsername(); - List reviewHumans; - ; - if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; - } else { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - - if (StringUtils.isBlank(employeeCode) || !reviewHumans.contains(employeeCode)) { - throw new BizException("当前操作员 不是七大审查人之一!"); - } - - VUtils.isTrue(reviewChecklistApproveService.count(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .eq(ReviewChecklistApprove::getProjectCode, projectCode) - .eq(ReviewChecklistApprove::getCreateByCode, employeeCode)) > 0) - .throwMessage("此项目 当前审查员 已经审批过 请不要重复审批"); - - for (ReviewChecklistApproveDTO dto : dtos) { - ReviewChecklistApprove saveEntity = new ReviewChecklistApprove(); - saveEntity.setCreateBy(username); - saveEntity.setCreateById(userId); - saveEntity.setCreateByCode(employeeCode); - saveEntity.setTitle(dto.getTitle()); - saveEntity.setContent(dto.getContent()); - saveEntity.setSubTitle(dto.getSubTitle()); - saveEntity.setCorrPageNum(dto.getCorrPageNum()); - saveEntity.setRejectionSituation(dto.getRejectionSituation()); - saveEntity.setResponseSituation(dto.getResponseSituation()); - saveEntity.setReviewComments(dto.getReviewComments()); - saveEntity.setReviewResult(dto.getReviewResult()); - saveEntity.setProjectCode(dto.getProjectCode()); - reviewChecklistApproveService.save(saveEntity); - } - - return BizConst.OP_SUCCESS; - } - - /** - * 查看待意见汇总 列表 - * - * @param projectCode - * @return - */ - public List summaryList(String projectCode) { - List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .eq(ReviewChecklistApprove::getProjectCode, projectCode) - .orderByAsc(ReviewChecklistApprove::getCreateOn)); - if (CollUtil.isEmpty(approves)) { - return Collections.emptyList(); - } - - //做成map - Map> groupTitleMap = approves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); - //去重标题 - Set titleSet = Sets.newHashSet(); - List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())) - .collect(Collectors.toList()); - - return dupTitle.stream() - .map(r -> { - FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); - vo.setTitle(r.getTitle()); - if (groupTitleMap.containsKey(r.getTitle())) { - List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); - vo.setModules(convertModules(reviewChecklistApproves)); - } - return vo; - }) - .collect(Collectors.toList()); - } - - public String summary(String projectCode) { - // 修改到 项目里去 - Project project = projectService.getProjectByCode(projectCode); - Assert.notNull(project, "项目不存在"); - Assert.isFalse(Boolean.TRUE.equals(project.getReviewCheckFinish()), "项目的审查清单已经合并过了!"); - - List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) - .eq(ReviewChecklistApprove::getProjectCode, projectCode) - .orderByAsc(ReviewChecklistApprove::getCreateOn)); - if (CollUtil.isEmpty(approves)) { - throw new BizException("该项目 未被七大审查人 审批!"); - } - - List reviewHumans; - if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; - } else { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - Set computeHumanSet = new HashSet<>(reviewHumans); - for (ReviewChecklistApprove approve : approves) { - computeHumanSet.remove(approve.getCreateByCode()); - } - if (CollUtil.isNotEmpty(computeHumanSet)) { - throw new BizException("此项目的审查清单 未被七大审核人 审批完!"); - } - - //做成map 并且还要 未通过的 - Map> groupTitleMap = approves.stream() - .filter(r -> Objects.nonNull(r.getReviewResult()) && Lists.newArrayList( - ReviewChecklistResultEnum.NOT_PASS.getCode(), ReviewChecklistResultEnum.ONE_VOTE_VETO.getCode()) - .contains(r.getReviewResult())) - .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); - //去重子标题 - Set titleSet = Sets.newHashSet(); - List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())).collect(Collectors.toList()); - - List res = dupTitle.stream() - .map(r -> { - FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); - vo.setTitle(r.getTitle()); - if (groupTitleMap.containsKey(r.getTitle())) { - List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); - vo.setModules(convertModulesFinal(reviewChecklistApproves)); - } - return vo; - }) - .collect(Collectors.toList()); - //修改 并且 已经合并 - project.setReviewChecklist(JSON.toJSONString(res)); - project.setReviewCheckFinish(Boolean.TRUE); - projectService.updateById(project); - - return BizConst.OP_SUCCESS; - } - - private List convertModules(List reviewChecklistApproves) { - //做成map - Map> groupSubTitleMap = reviewChecklistApproves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); - //去重子标题 - Set subSubTitleSet = Sets.newHashSet(); - List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) - .collect(Collectors.toList()); - return dupSubTitle.stream() - .map(r -> { - ReviewChecklistModuleDto vo = new ReviewChecklistModuleDto(); - vo.setSubTitle(r.getSubTitle()); - vo.setContent(r.getContent()); - vo.setReviewComments(r.getReviewComments()); - vo.setRejectionSituation(r.getRejectionSituation()); - vo.setResponseSituation(r.getResponseSituation()); - vo.setCorrPageNum(r.getCorrPageNum()); - if (groupSubTitleMap.containsKey(r.getSubTitle())) { - List approves = groupSubTitleMap.get(r.getSubTitle()); - StringBuilder reviewCommentsSb = new StringBuilder(); - for (ReviewChecklistApprove approve : approves) { - ReviewChecklistResultEnum match = ReviewChecklistResultEnum.match(approve.getReviewResult()); - reviewCommentsSb.append(approve.getCreateBy()) - .append(StrPool.COLON).append(Objects.nonNull(match) ? match.getDesc() : StringUtils.EMPTY) - .append(StringUtils.isNotBlank(approve.getReviewComments()) ? StrPool.COMMA + approve.getReviewComments() : StringUtils.EMPTY) - .append("\n"); - } - vo.setReviewComments(reviewCommentsSb.toString()); - } - return vo; - }).collect(Collectors.toList()); - } - - private List convertModulesFinal(List reviewChecklistApproves) { - //做成map - Map> groupSubTitleMap = reviewChecklistApproves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); - //去重子标题 - Set subSubTitleSet = Sets.newHashSet(); - List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) - .collect(Collectors.toList()); - return dupSubTitle.stream() - .map(r -> { - ReviewChecklistModuleDto vo = new ReviewChecklistModuleDto(); - vo.setSubTitle(r.getSubTitle()); - vo.setContent(r.getContent()); - vo.setReviewComments(r.getReviewComments()); - vo.setRejectionSituation(r.getRejectionSituation()); - vo.setResponseSituation(r.getResponseSituation()); - vo.setCorrPageNum(r.getCorrPageNum()); - if (groupSubTitleMap.containsKey(r.getSubTitle())) { - List approves = groupSubTitleMap.get(r.getSubTitle()); - StringBuilder reviewCommentsSb = new StringBuilder(); - if (CollUtil.isEmpty(approves)) { - vo.setReviewComments("通过"); - } else { - Integer index = 1; - for (ReviewChecklistApprove approve : approves) { - ReviewChecklistResultEnum match = ReviewChecklistResultEnum.match(approve.getReviewResult()); - reviewCommentsSb.append(index).append(StrPool.DOT).append(Objects.nonNull(match) ? match.getDesc() : StringUtils.EMPTY).append(StringUtils.isNotBlank(approve.getReviewComments()) ? StrPool.COMMA + approve.getReviewComments() : StringUtils.EMPTY).append("\n"); - index++; - } - vo.setReviewComments(reviewCommentsSb.toString()); - } - } - return vo; - }) - .collect(Collectors.toList()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java deleted file mode 100644 index 971dbfc..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.hz.pm.api.projectdeclared.utils; - -import com.google.common.collect.Maps; -import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; -import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.hz.pm.api.projectlib.manage.DeclaredRecordManage; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import org.springframework.stereotype.Component; - -import java.util.Map; -import java.util.function.Function; - -/** - *

- * RestartProcessMapUtil - 项目调整 重新提交时的 事件函数MAP - *

- * - * @author PoffyZhang - * @since 2023/2/15 11:19 - */ -@Component -public class RestartProcessMapUtil { - - private static final Map> RESTART_PROCESS_MAP = Maps.newHashMap(); - - public RestartProcessMapUtil(DeclaredProjectManage declaredProjectManage, - DeclaredRecordManage declaredRecordManage) { - // 重新项目申报 - RESTART_PROCESS_MAP.put(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - declaredProjectManage::reStartTheProcess); - // 立项备案重新提交 - RESTART_PROCESS_MAP.put(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), - declaredRecordManage::restartDeclaredRecord); - } - - public static Function getRestartFunction(Integer status) { - return RESTART_PROCESS_MAP.get(status); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java index e6b3f14..f42cae8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java @@ -1,18 +1,17 @@ package com.hz.pm.api.projectlib.controller; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.projectlib.manage.ProjectRenewalFundManage; import com.hz.pm.api.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; import com.hz.pm.api.projectlib.model.req.ProjectRenewalAuditReq; import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.projectlib.model.vo.ProjectRenewalFundDeclarationVO; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -42,55 +41,49 @@ public class ProjectRenewalFundDeclarationController { @ApiOperation("项目续建资金库") public PageVo list(ProjectRenewalListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectRenewalFundManage.list(req,user); - } - - @GetMapping("/project-list") - @ApiOperation("项目续建资金库能关联的项目列表") - public PageVo projectlist(ProjectRenewalListReq req) { - return projectRenewalFundManage.projectList(req); + return projectRenewalFundManage.list(req, user); } @GetMapping("/{id}") @ApiOperation("项目续建资金详情") @WebLog("项目续建资金详情") - public ProjectRenewalFundDeclarationVO detail (@PathVariable Long id){ + public ProjectRenewalFundDeclarationVO detail(@PathVariable Long id) { return projectRenewalFundManage.detail(id); } @PostMapping("/declared") @ApiOperation("项目续建资金申请") @WebLog("项目续建资金申请") - public Long declared (@Validated @RequestBody ProjectRenewalFundDeclarationDTO dto){ + public Long declared(@Validated @RequestBody ProjectRenewalFundDeclarationDTO dto) { return projectRenewalFundManage.declared(dto); } @PostMapping("/audit") @ApiOperation("续建项目审核") @WebLog("续建项目审核") - public Long audit(@Validated @RequestBody ProjectRenewalAuditReq param){ + public Long audit(@Validated @RequestBody ProjectRenewalAuditReq param) { return projectRenewalFundManage.audit(param); } @DeleteMapping("/delete/{projectRenewalId}") @ApiOperation("续建项目删除") @WebLog("续建项目删除") - public Long delete(@PathVariable("projectRenewalId") Long projectRenewalId){ + public Long delete(@PathVariable("projectRenewalId") Long projectRenewalId) { return projectRenewalFundManage.delete(projectRenewalId); } @GetMapping("/export") @ApiOperation("项目库续建项目列表导出") @WebLog("项目库续建项目列表导出") - public void exportList(ProjectRenewalListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportList); + public void exportList(ProjectRenewalListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, projectRenewalFundManage::exportList); } @GetMapping("/exportRenewalDeclare") @ApiOperation("申报管理续建项目资金申报列表导出") @WebLog("申报管理续建项目资金申报列表导出") - public void exportRenewalDeclareList(ProjectRenewalListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportRenewalDeclareList); + public void exportRenewalDeclareList(ProjectRenewalListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, projectRenewalFundManage::exportRenewalDeclareList); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java index 2b07e70..04489e9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java @@ -53,14 +53,12 @@ public class ProjectApprovalHandle extends AbstractProcessHandle { Project project = ctx.getProject(); Integer status = project.getStatus(); // 项目状态为待立项批复之前的状态 - if (status == null || (status < ProjectStatus.TO_BE_APPROVED.getCode() - && status < ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode())) { + if (status == null || (status < ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode())) { detail.setStepStatus(StepStatusEnum.NOT_START); } else { List projectIds = projectService.allVersionProjectIds(project.getProjectCode()); // 当前项目状态为待立项批复 - if (ProjectStatus.TO_BE_APPROVED.eq(status) - || ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.eq(status) + if (ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.eq(status) || ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.eq(status)) { // 根据建设方案评审通过的时间获取 final List events = Arrays.asList( diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index c1dd72a..8105a8d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -22,7 +22,6 @@ import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq; import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; import com.hz.pm.api.projectlib.service.IProjectApplicationService; -import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.user.helper.MhUnitCache; @@ -60,15 +59,13 @@ public class AnnualPlanLibManage { private final IProjectApplicationService applicationService; private final ProjectStateMachineUtil stateMachine; private final UserInfoHelper userInfoHelper; - private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; /** * 年度计划查询状态 */ private static final List ANNUAL_PLAN_LIST_STATUS = - Arrays.asList(IN_THE_ANNUAL_PLAN, TO_BE_APPROVED, TO_BE_DECLARED, - PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, - ON_PILOT_RUNNING, ARCHIVED); + Arrays.asList(ON_ANNUAL_PLAN, TO_BE_DECLARED, + PROJECT_APPROVED, TO_BE_PURCHASED, ON_PILOT_RUNNING, ARCHIVED); public PageVo annulPlanLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -103,7 +100,7 @@ public class AnnualPlanLibManage { item.setBuildOrg(w.getBuildOrgName()); item.setCreateOn(w.getCreateOn()); item.setApprovalAmount(w.getApprovalAmount()); - item.setIsStartDeclaredProject(!IN_THE_ANNUAL_PLAN.eq(w.getStatus())); + item.setIsStartDeclaredProject(!ON_ANNUAL_PLAN.eq(w.getStatus())); result.getRecords().add(item); }); return result; @@ -113,7 +110,7 @@ public class AnnualPlanLibManage { public void startProjectDeclared(StartProjectDeclareReq req) { List projects = projectService.listByIds(req.getProjectIds()); projects.forEach(w -> { - if (!IN_THE_ANNUAL_PLAN.eq(w.getStatus())) { + if (!ON_ANNUAL_PLAN.eq(w.getStatus())) { throw BizException.wrap("开启方案申报失败"); } }); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 74d9ce0..e6b33e6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -119,86 +119,6 @@ public class ProjectRenewalFundManage { return PageVo.of(records, total); } - public PageVo projectList(ProjectRenewalListReq req) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - LambdaQueryWrapper query = ProjectRenewFundHelper.projectQuery(req); - //项目查最新 - query.eq(Project::getNewest, Boolean.TRUE); - //自己单位 - query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); - //立项批复后 都可以 - query.gt(Project::getStatus, ProjectStatus.APPROVED_AFTER_CHOICE.getCode()); - Page page = projectService.page(req.page(), query); - if (CollUtil.isEmpty(page.getRecords())) { - return PageVo.empty(); - } - - Set projectCodes = new HashSet<>(); - List projectIds = new ArrayList<>(); - for (Project project : page.getRecords()) { - projectIds.add(project.getId()); - projectCodes.add(project.getProjectCode()); - } - - Map> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); - - Map> renewalMap; - if (CollUtil.isNotEmpty(projectCodes)) { - Wrapper prfQuery = Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear); - List renewalDeclarations = projectRenewalFundDeclarationService.list(prfQuery); - renewalMap = CollUtils.group(renewalDeclarations, ProjectRenewalFundDeclaration::getProjectId); - } else { - renewalMap = Collections.emptyMap(); - } - - Map> finalRenewalMap = renewalMap; - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (user.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) - && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { - item.setCanPreDeclared(Boolean.TRUE); - } - item.setApprovedAmount(w.getApprovalAmount()); - List paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); - BigDecimal totalAnnualPaymentAmount = paymentPlans.stream() - .map(ProjectAnnualPaymentPlan::getAnnualPlanAmount) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); - - item.setAnnualPlanAmount(totalAnnualPaymentAmount); - item.setPrePlanProjectId(w.getPrePlanProjectId()); - if (finalRenewalMap.containsKey(item.getId())) { - List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(totalAnnualPaymentAmount, prfs)); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccumulate(w, totalAnnualPaymentAmount, prfs)); - } else { - item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccumulate(w, totalAnnualPaymentAmount, Collections.emptyList())); - } - return item; - }); - return PageVo.of(records, page.getTotal()); - } - /** * @param id * @author ZPF diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/WarningFlowTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/WarningFlowTypeEnum.java index 9e873fc..808063e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/WarningFlowTypeEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/WarningFlowTypeEnum.java @@ -9,8 +9,8 @@ import org.apache.commons.lang3.StringUtils; import java.util.Objects; /** - * * 预警填报类型枚举 + * * @author CMM * @since 2023/02/24 16:14 */ @@ -21,11 +21,11 @@ public enum WarningFlowTypeEnum { /** * 预警填报类型枚举 */ - UNIT_INNER_AUDIT(1, "预审申报", null,"declareManage/planDeclaration/preExaminationDeclare"), - PRELIMINARY_PREVIEW(2, "建设方案申报", ProjectStatus.PLAN_TO_BE_DECLARED.getCode(),"declareManage/constructionPlanDeclare"), - DEPT_UNITED_REVIEW(3,"采购结果备案", ProjectStatus.TO_BE_PURCHASED.getCode(),"declareManage/procurementRecord/purchaseResults"), - CONSTRUCTION_PLAN_REVIEW(4,"初验备案", null,"declareManage/acceptanceApply/initialInspectionRecord"), - PROJECT_FINAL_INSPECTION(5,"验收申报", ProjectStatus.ON_PILOT_RUNNING.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); + UNIT_INNER_AUDIT(1, "预审申报", null, "declareManage/planDeclaration/preExaminationDeclare"), + PRELIMINARY_PREVIEW(2, "建设方案申报", null, "declareManage/constructionPlanDeclare"), + DEPT_UNITED_REVIEW(3, "采购结果备案", ProjectStatus.TO_BE_PURCHASED.getCode(), "declareManage/procurementRecord/purchaseResults"), + CONSTRUCTION_PLAN_REVIEW(4, "初验备案", null, "declareManage/acceptanceApply/initialInspectionRecord"), + PROJECT_FINAL_INSPECTION(5, "验收申报", ProjectStatus.ON_PILOT_RUNNING.getCode(), "declareManage/acceptanceApply/finalInspectionDeclare"); private Integer code; private String desc; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java index 4ba6102..11e4327 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java @@ -33,17 +33,13 @@ public enum ProjectStatus implements IStatus { ON_COMPLIANCE_REVIEW(10030, "合规性审查中", null), COMPLIANCE_REVIEW_FAILED(10031, "合规性审查不通过", null), - UNDER_INTERNAL_AUDIT(10001, "单位内部审核中", null), - UNDER_INTERNAL_AUDIT_NOT_PASS(10002, "单位内部审核不通过", null), - DEPARTMENT_JOINT_REVIEW(10008, "部门联审中", null), - DEPARTMENT_JOINT_REVIEW_FAILED(10009, "部门联审不通过", null), - IN_THE_ANNUAL_PLAN(10010, "年度计划中", null), - BE_SUSPENDED(10011, "被暂缓", null), - TO_BE_APPROVED(10014, "待立项批复", GovProjectStatusEnum.PENDING), - PLAN_TO_BE_DECLARED(10016, "方案待申报", null), - PENDING_PREQUALIFICATION_CHOICE(10017, "待预审选择态", null), - PREQUALIFICATION_WITHDRAW_CHOICE(10019, "预审中撤回选择态", null), - APPROVED_AFTER_CHOICE(10020, "立项批复后选择态", null), + /** + * 项目评审 + */ + ON_PROJECT_REVIEW(10040, "项目评审中", null), + PROJECT_REVIEW_FAILED(10041, "项目评审不通过", null), + + ON_ANNUAL_PLAN(10010, "年度计划中", null), /** * 信产项目备案 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java index ea9bd6f..e7081e8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -51,18 +51,13 @@ import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.PASS_MSG_TEMPLAT @Component @RequiredArgsConstructor public class ProcessEndListener { + private final TaskService taskService; private final HistoryService historyService; private final IProjectInstService projectInstService; - private final IProjectService projectService; - private final ProcessInstanceService processInstanceService; - private final HandlerManage handlerManage; - - private final IProjectStagingService projectStagingService; - private final NoticeManage noticeManage; @Value("${spring.profiles.active}") @@ -172,7 +167,7 @@ public class ProcessEndListener { throw BizException.wrap("传入实例类型错误:%s ", instTypeEnum); } } else { - switch (ProjectStatus.getNoNull(project.getStatus())) { + /*switch (ProjectStatus.getNoNull(project.getStatus())) { // 当前项目状态是单位内部审核中 case UNDER_INTERNAL_AUDIT: // 当前项目状态是部门联审中 @@ -181,7 +176,7 @@ public class ProcessEndListener { break; default: throw BizException.wrap("传入项目状态错误:%s", project.getStatus()); - } + }*/ } //发送消息 noticeManage.sendNotice(Long.parseLong(instance.getStartUserId()), project, instance.getProcessDefinitionName(), diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index 37e7524..49703c0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -43,16 +43,13 @@ import com.ningdatech.file.entity.vo.result.AttachFileVo; import com.ningdatech.file.service.FileService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.flowable.engine.RuntimeService; import org.flowable.engine.runtime.ActivityInstance; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.AUDIT_WORK_TITLE; @@ -72,19 +69,11 @@ public class NoticeManage { private final INoticeService noticeService; private final FileService fileService; - private final IUserInfoService userInfoService; - private final IDingEmployeeInfoService dingEmployeeInfoService; - private final IDingOrganizationService dingOrganizationService; - private final INotifyService notifyService; - - private final INdWorkNoticeStagingService workNoticeStagingService; - private final RuntimeService runtimeService; - private final UserInfoHelper userInfoHelper; @Transactional(rollbackFor = Exception.class) @@ -262,9 +251,9 @@ public class NoticeManage { /** * 装配项目审核工作通知 * - * @param userId - * @param project - * @param msg + * @param userId \ + * @param project \ + * @param msg \ */ public Notify assemblyAuditNotify(Long userId, Project project, String msg) { Notify notify = new Notify(); @@ -284,12 +273,12 @@ public class NoticeManage { /** * 找寻第一个审核人 去发消息 * - * @param project - * @param formName - * @param template - * @param msgTypeEnum + * @param project \ + * @param formName \ + * @param template \ + * @param msgType \ */ - public void sendFirstUser(Project project, String formName, String instanceId, String template, MsgTypeEnum msgTypeEnum) { + public void sendFirstUser(Project project, String formName, String instanceId, String template, MsgTypeEnum msgType) { try { List activityInstances = runtimeService.createActivityInstanceQuery() .processInstanceId(instanceId) @@ -297,17 +286,22 @@ public class NoticeManage { .orderByActivityInstanceStartTime() .asc() .list(); - + Set assignees = new HashSet<>(); for (ActivityInstance activityInstance : activityInstances) { - if (StringUtils.isNotBlank(activityInstance.getAssignee())) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(activityInstance.getAssignee())); - sendNotice(user.getUserId(), project, formName, template, msgTypeEnum); + if (StrUtil.isNotBlank(activityInstance.getAssignee())) { + assignees.add(Long.valueOf(activityInstance.getAssignee())); } } + if (assignees.isEmpty()) { + return; + } + List users = userInfoHelper.listUserFullInfoByUserIds(assignees); + for (UserFullInfoDTO user : users) { + sendNotice(user.getUserId(), project, formName, template, msgType); + } } catch (Exception e) { - log.error("发送消息失败 :" + e); + log.error("发送消息失败:{}", project.getProjectCode(), e); } - } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index 80a78e4..745ab16 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -190,8 +190,6 @@ public class HandlerManage { } else { ProjectStatus projectStatus = ProjectStatus.getNoNull(project.getStatus()); switch (projectStatus) { - case DEPARTMENT_JOINT_REVIEW: - case UNDER_INTERNAL_AUDIT: // 立项备案审批 case DECLARED_APPROVED_RECORD_AUDITING: updatePassProjectStatus(userId, project); @@ -413,7 +411,7 @@ public class HandlerManage { * 发起人 撤回逻辑 */ public void rootWithDraw(Project project) { - Long userId = LoginUserUtil.getUserId(); + /*Long userId = LoginUserUtil.getUserId(); // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 switch (ProjectStatus.getNoNull(project.getStatus())) { // 当前项目状态是单位内部审核中 @@ -431,7 +429,7 @@ public class HandlerManage { break; default: throw new IllegalStateException("Unexpected value: " + project.getStatus()); - } + }*/ } // 保存到草稿箱中 diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java deleted file mode 100644 index a9ab69b..0000000 --- a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.hz.pm.api.sys.project; - -import cn.hutool.core.date.StopWatch; -import com.alibaba.fastjson.JSON; -import com.hz.pm.api.AppTests; -import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.service.IProjectService; -import org.junit.Test; - -import javax.annotation.Resource; - -/** - * @Classname ProjectStateTest - * @Description - * @Date 2023/2/8 11:12 - * @Author PoffyZhang - */ -public class ProjectStateTest extends AppTests { - - @Resource - private ProjectStateMachineUtil projectStateMachineUtil; - - @Resource - private IProjectService projectService; - - @Test - public void execute() throws Exception { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - System.out.println("调用状态机开始"); - - Project project = new Project(); - project.setInstCode("1"); - project.setId(1L); - project.setStage(ProjectStatus.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatus.PENDING_PREQUALIFICATION.getCode()); - //调用状态机 进入下一个通过状态 - projectStateMachineUtil.pass(project); - - stopWatch.stop(); - System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); - } - - @Test - public void getProject() { - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - - Project project = projectService.getById(1); - - stopWatch.stop(); - System.out.println("project :" + JSON.toJSONString(project)); - } -}