Procházet zdrojové kódy

项目申报修改

tags/24080901
WendyYang před 8 měsíci
rodič
revize
56b10268a5
26 změnil soubory, kde provedl 117 přidání a 1956 odebrání
  1. +12
    -87
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java
  2. +27
    -38
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java
  3. +10
    -43
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java
  4. +0
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java
  5. +0
    -460
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java
  7. +0
    -55
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java
  8. +2
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java
  9. +0
    -60
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java
  10. +0
    -60
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java
  11. +0
    -189
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java
  12. +10
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  13. +0
    -158
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java
  14. +0
    -98
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java
  15. +0
    -424
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java
  16. +0
    -40
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java
  17. +11
    -18
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java
  18. +2
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java
  19. +4
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java
  20. +0
    -80
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java
  21. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/WarningFlowTypeEnum.java
  22. +7
    -11
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
  23. +3
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java
  24. +20
    -26
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java
  25. +2
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java
  26. +0
    -56
      hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java

+ 12
- 87
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java Zobrazit soubor

@@ -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<ProjectStateChangeEvent> message) {
@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "ON_PROJECT_REVIEW")
public void COMPLIANCE_REVIEW_PASS(Message<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> message) {
@OnTransition(source = "ON_PROJECT_REVIEW", target = "PROJECT_REVIEW_FAILED")
public void PROJECT_REVIEW_FAILED(Message<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> message) {
@OnTransition(source = "ON_PROJECT_REVIEW", target = "ON_ANNUAL_PLAN")
public void PROJECT_REVIEW_PASS(Message<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> message) {
@OnTransition(source = "ON_ANNUAL_PLAN", target = "DECLARED_APPROVED_TO_BE_RECORD")
public void ANNUAL_PLAN_PASS(Message<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> 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<ProjectStateChangeEvent> message) {
Project project = getProject(message);


+ 27
- 38
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java Zobrazit soubor

@@ -70,75 +70,64 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P
builder.configureStates()
.withStates()
.initial(ProjectStatus.TO_BE_DECLARED)
.choice(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatus.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatus.class));

builder.configureTransitions()
// 项目立项
.withExternal()
.source(ProjectStatus.TO_BE_DECLARED)
.target(ProjectStatus.ON_COMPLIANCE_REVIEW)
.event(ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT).and()
// 项目立项重新提交
.withExternal()
.source(ProjectStatus.COMPLIANCE_REVIEW_FAILED)
.target(ProjectStatus.ON_COMPLIANCE_REVIEW)
.event(ProjectStateChangeEvent.COMPLIANCE_REVIEW_RESUBMIT).and()
// 合规性审查不通过
.withExternal()
.source(ProjectStatus.ON_COMPLIANCE_REVIEW)
.target(ProjectStatus.COMPLIANCE_REVIEW_FAILED)
.event(ProjectStateChangeEvent.COMPLIANCE_REVIEW_FAILED).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatus.UNDER_INTERNAL_AUDIT)
.target(ProjectStatus.TO_BE_DECLARED)
.event(ProjectStateChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatus.UNDER_INTERNAL_AUDIT)
.event(ProjectStateChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()
// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatus.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatus.IN_THE_ANNUAL_PLAN)
.event(ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatus.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatus.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatus.IN_THE_ANNUAL_PLAN)
.target(ProjectStatus.PLAN_TO_BE_DECLARED)
.event(ProjectStateChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatus.IN_THE_ANNUAL_PLAN)
.target(ProjectStatus.BE_SUSPENDED)
.event(ProjectStateChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
// 合规性审查通过
.withExternal()
.source(ProjectStatus.ON_COMPLIANCE_REVIEW)
.target(ProjectStatus.ON_PROJECT_REVIEW)
.event(ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS).and()
// 项目评审不通过
.withExternal()
.source(ProjectStatus.ON_PROJECT_REVIEW)
.target(ProjectStatus.PROJECT_REVIEW_FAILED)
.event(ProjectStateChangeEvent.PROJECT_REVIEW_FAILED).and()
// 项目评审通过
.withExternal()
.source(ProjectStatus.ON_PROJECT_REVIEW)
.target(ProjectStatus.ON_ANNUAL_PLAN)
.event(ProjectStateChangeEvent.PROJECT_REVIEW_PASS).and()
// 年度计划通过
.withExternal()
.source(ProjectStatus.ON_ANNUAL_PLAN)
.target(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD)
.event(ProjectStateChangeEvent.ANNUAL_PLAN_PASS).and()
// 提交立项备案
.withExternal()
.source(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD)
.target(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING)
.event(ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT).and()
// 立项备案重新提交
.withExternal()
.source(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED)
.target(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING)
.event(ProjectStateChangeEvent.DECLARED_RECORD_RESUBMIT).and()
// 立项备案审核通过
.withExternal()
.source(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING)
.target(ProjectStatus.TO_BE_PURCHASED)
.event(ProjectStateChangeEvent.DECLARED_RECORD_PASS).and()
// 立项备案审核不通过
.withExternal()
.source(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING)
.target(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED)
.event(ProjectStateChangeEvent.DECLARED_RECORD_FAILED).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatus.TO_BE_APPROVED)
.target(ProjectStatus.TO_BE_PURCHASED)
.event(ProjectStateChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatus.TO_BE_PURCHASED)


+ 10
- 43
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java Zobrazit soubor

@@ -24,39 +24,20 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent {
COMPLIANCE_REVIEW_FAILED(null, ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null),

COMPLIANCE_REVIEW_RESUBMIT(ProjectStatus.COMPLIANCE_REVIEW_FAILED.getCode(), null, null),
/**
* 单位内部审核驳回(项目状态进入:单位内部审核不通过)
*/
UNDER_INTERNAL_REJECT(null, ProjectStatus.UNDER_INTERNAL_AUDIT.getCode(), null),
/**
* 单位内部审核通过(项目状态进入:待预审)
*/
UNDER_INTERNAL_PASS(ProjectStatus.UNDER_INTERNAL_AUDIT.getCode(), null, null),
/**
* 单位内部审核不通过重新提交(项目状态进入:单位内部审核中)
*/
UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), null, null),

/**
* 部门联审驳回(项目状态变为:部门联审不通过)
*/
DEPARTMENT_UNITED_REVIEW_REJECT(null, ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode(), null),
/**
* 部门联审通过(项目状态变为:年度计划中)
*/
DEPARTMENT_UNITED_REVIEW_PASS(ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode(), null, null),
/**
* 年度计划暂缓(项目状态变为:被暂缓)
*/
ANNUAL_PLAN_SUSPEND(null, ProjectStatus.IN_THE_ANNUAL_PLAN.getCode(), null),
COMPLIANCE_REVIEW_PASS(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null, null),

PROJECT_REVIEW_FAILED(null, ProjectStatus.ON_PROJECT_REVIEW.getCode(), null),

PROJECT_REVIEW_PASS(ProjectStatus.ON_PROJECT_REVIEW.getCode(), null, null),

ANNUAL_PLAN_PASS(ProjectStatus.ON_ANNUAL_PLAN.getCode(), null, null),

/**
* 年度计划项目开启方案申报(项目状态变为:方案待申报)
*/
ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(ProjectStatus.IN_THE_ANNUAL_PLAN.getCode(), null, null),
/**
* 申报方案(项目状态变为:方案评审中)
*/
DECLARE_PLAN(ProjectStatus.PLAN_TO_BE_DECLARED.getCode(), null, null),
ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(ProjectStatus.ON_ANNUAL_PLAN.getCode(), null, null),

/**
* 立项备案提交
*/
@@ -80,11 +61,6 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent {
//==================================================================================================================

/**
* 立项批复(项目状态变为:已立项-待采购)
*/
PROJECT_APPROVAL(ProjectStatus.TO_BE_APPROVED.getCode(), null, null),

/**
* 发布采购公告
*/
SUBMIT_PURCHASE_NOTICE(ProjectStatus.TO_BE_PURCHASED.getCode(), null, null),
@@ -112,15 +88,6 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent {
FINAL_ACCEPTANCE_PASS(ProjectStatus.ON_FINALLY_INSPECTED.getCode(), null, null),

/**
* 单位内部审核中时被撤回(项目状态进入:待申报)
*/
UNDER_INTERNAL_WITHDRAW(null, null, ProjectStatus.UNDER_INTERNAL_AUDIT.getCode()),

/**
* 部门联审中时被撤回(项目状态进入:预审中)
*/
DEPARTMENT_JOINT_REVIEW_WITHDRAW(null, null, ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode()),
/**
* 终验审核中时被撤回(项目状态进入:待终验)
*/
FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(null, null, ProjectStatus.ON_FINALLY_INSPECTED.getCode()),


+ 0
- 9
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java Zobrazit soubor

@@ -1,7 +1,6 @@
package com.hz.pm.api.dashboard.controller;

import com.hz.pm.api.dashboard.manage.ExpertStatisticsManage;
import com.hz.pm.api.dashboard.manage.FundStatisticsManage;
import com.hz.pm.api.dashboard.manage.ProjectCostStatisticsManage;
import com.hz.pm.api.dashboard.model.vo.CostStatisticsVO;
import com.hz.pm.api.dashboard.model.vo.ExpertStatisticsVO;
@@ -27,18 +26,10 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "统计")
public class StatisticsController {

private final FundStatisticsManage fundStatisticsManage;
private final ExpertStatisticsManage expertStatisticsManage;
private final ProjectCostStatisticsManage costStatisticsManage;

@DataScopeQueryCheck
@GetMapping("/fund")
@ApiOperation("项目资金统计")
public FundStatisticsVO fund(@RequestParam(required = false) Integer year) {
return fundStatisticsManage.statistics(year);
}

@DataScopeQueryCheck
@GetMapping("/expert")
@ApiOperation("专家统计")
public ExpertStatisticsVO expert(@RequestParam(required = false) Integer year) {


+ 0
- 460
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java Zobrazit soubor

@@ -1,460 +0,0 @@
package com.hz.pm.api.dashboard.manage;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.dashboard.model.vo.FundStatisticsVO;
import com.hz.pm.api.gov.model.entity.GovBizProjectApply;
import com.hz.pm.api.gov.model.entity.GovBizProjectApprove;
import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo;
import com.hz.pm.api.gov.model.entity.GovBizProjectProcure;
import com.hz.pm.api.gov.service.IGovBizProjectApplyService;
import com.hz.pm.api.gov.service.IGovBizProjectApproveService;
import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService;
import com.hz.pm.api.gov.service.IGovBizProjectProcureService;
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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* @Classname FundStatisticsManage
* @Description
* @Date 2023/11/24 17:44
* @Author PoffyZhang
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class FundStatisticsManage {
private final IProjectService projectService;

private final IGovBizProjectBaseinfoService baseinfoService;

private final IGovBizProjectApplyService applyService;

private final IGovBizProjectApproveService approveService;

private final IGovBizProjectProcureService procureService;

private Integer[] years = new Integer[]{2021, 2022, 2023, 2024, 2025};

private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear() - 2,
LocalDateTime.now().getYear() - 1, LocalDateTime.now().getYear()};

/**
* 项目统计
*
* @param year
* @return
*/
public FundStatisticsVO statistics(Integer year) {
FundStatisticsVO res = new FundStatisticsVO();

CompletableFuture.allOf(
CompletableFuture.runAsync(() -> {
//选择的年份去计算的数据
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<Project> allProjects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.in(Project::getProjectYear, years));

//项目归集
List<GovBizProjectApply> allApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class)
.in(GovBizProjectApply::getBaseProjSetYear, years));

List<String> allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId)
.collect(Collectors.toList());

List<GovBizProjectBaseinfo> allBaseInfos;
List<GovBizProjectApply> allApplies = Lists.newArrayList();
List<GovBizProjectApprove> allApproves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<Project> projects,
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectProcure> procures) {
//首先完成年度计划 并且未注销的项目
List<Project> 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<Project> projects, List<GovBizProjectApply> applies,
List<GovBizProjectApprove> 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<Project> projects, List<GovBizProjectApprove> 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<Project> projects, List<GovBizProjectProcure> 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<Project> threeYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.in(Project::getProjectYear, threeYears));
//项目归集
List<GovBizProjectApply> threeYearsApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class)
.in(GovBizProjectApply::getBaseProjSetYear, threeYears));
List<String> threeYearsProjIds = threeYearsApplieYears.stream().map(GovBizProjectApply::getBaseProjId)
.collect(Collectors.toList());
List<GovBizProjectBaseinfo> threeYearsBaseInfos = Lists.newArrayList();
List<GovBizProjectApply> threeYearsApplies = Lists.newArrayList();
List<GovBizProjectApprove> threeYearsApproves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<FundStatisticsVO.AmountData> threeYearsDeduction = Lists.newArrayList();
for (Integer year : threeYears) {
FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData();
//申报项目
List<Project> thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getProjectYear, year));
//项目归集
List<GovBizProjectApply> thisYearApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjSetYear, year));
List<String> thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId)
.collect(Collectors.toList());
List<GovBizProjectBaseinfo> thisYearBaseInfos;
List<GovBizProjectApply> thisYearApplies = Lists.newArrayList();
List<GovBizProjectApprove> thisYearApproves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<Project> 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<GovBizProjectApply> applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(Objects.nonNull(year), GovBizProjectApply::getBaseProjSetYear, year)
.in(Objects.isNull(year), GovBizProjectApply::getBaseProjSetYear, years));
List<String> yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId)
.collect(Collectors.toList());
List<GovBizProjectBaseinfo> baseInfos = Lists.newArrayList();
List<GovBizProjectApply> applies = Lists.newArrayList();
List<GovBizProjectApprove> approves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<FundStatisticsVO.AmountData> computeTop10(List<Project> projects, List<GovBizProjectBaseinfo> baseInfos,
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectProcure> procures) {
//申报项目颗粒度
Map<String, List<Project>> groupProjectMap = projects.stream()
.filter(p -> StringUtils.isNotBlank(p.getBuildOrgCode()))
.collect(Collectors.groupingBy(Project::getBuildOrgCode));
List<FundStatisticsVO.AmountData> projectAmounts = Lists.newArrayList();
for (Map.Entry<String, List<Project>> entry : groupProjectMap.entrySet()) {
FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData();
List<Project> 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<String, List<GovBizProjectBaseinfo>> groupGovMap = baseInfos.stream()
.filter(b -> StringUtils.isNotBlank(b.getBaseBuildDeprtDing()))
.collect(Collectors.groupingBy(GovBizProjectBaseinfo::getBaseBuildDeprtDing));
List<FundStatisticsVO.AmountData> govAmounts = Lists.newArrayList();
for (Map.Entry<String, List<GovBizProjectBaseinfo>> entry : groupGovMap.entrySet()) {
FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData();
List<GovBizProjectBaseinfo> bs = entry.getValue();
List<String> baseProjIds = Lists.newArrayList();
if (CollUtil.isNotEmpty(bs)) {
govAmount.setName(bs.get(0).getBaseBuildDeprt());
baseProjIds = bs.stream().map(GovBizProjectBaseinfo::getBaseProjId)
.collect(Collectors.toList());
}

List<String> finalBaseProjIds = baseProjIds;
List<GovBizProjectApply> appliesThis = applies.stream().filter(a -> Objects.nonNull(a.getBaseProjId())
&& finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList());
List<GovBizProjectApprove> approvesThis = approves.stream().filter(a -> Objects.nonNull(a.getBaseProjId())
&& finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList());
List<GovBizProjectProcure> 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());
}
}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java Zobrazit soubor

@@ -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;


+ 0
- 55
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java Zobrazit soubor

@@ -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<ProjectLibListItemVO> 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 "专家建设方案建议保存成功";
}
}

+ 2
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java Zobrazit soubor

@@ -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")


+ 0
- 60
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ProjectAdjustmentController.java Zobrazit soubor

@@ -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<ProjectLibListItemVO> 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);
}

}

+ 0
- 60
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ReviewChecklistController.java Zobrazit soubor

@@ -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<ProjectReviewCheckListItemVO> list(@ModelAttribute ProjectListReq req) {
return reviewChecklistManage.projectLibList(req);
}

@ApiOperation(value = "审查清单审核", notes = "审查清单审核")
@PostMapping("/approve")
@WebLog("审查清单审核")
public String approve(@RequestBody List<ReviewChecklistApproveDTO> dtos) {
return reviewChecklistManage.approve(dtos);
}

@ApiOperation(value = "查看某个项目的意见汇总", notes = "查看某个项目的意见汇总")
@GetMapping("/summary-list/{projectCode}")
public List<FormsReviewChecklistDto> 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);
}
}

+ 0
- 189
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java Zobrazit soubor

@@ -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<ProjectLibListItemVO> 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<Project> query = ProjectHelper.projectQuery(req);
Page<Project> page = projectService.page(req.page(), query);
List<Project> records = page.getRecords();


List<ConstructionPlanExportDTO> 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);
}

}

+ 10
- 10
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java Zobrazit soubor

@@ -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<String, OrgInfoDTO> 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<Map<String, Object>>() {
}));
}
if (StrUtil.isNotBlank(draft.getGovSystemReplaceInfos())) {
vo.setSystemReplaceInfos(JSONUtil.toList(draft.getGovSystemReplaceInfos(), GovSystemReplaceInfoDTO.class));


+ 0
- 158
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java Zobrazit soubor

@@ -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<DefaultDeclaredDTO, String> declaredFunction =
RestartProcessMapUtil.getRestartFunction(projectInfo.getStatus());
VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!");
return declaredFunction.apply(dto);
}

private static final List<Integer> PROJECT_STATUS = Collections.singletonList(
ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());

/**
* 项目库
*
* @param preReq
* @return
*/
public PageVo<ProjectLibListItemVO> 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<Project> query = ProjectHelper.projectQuery(req);
List<Project> records = projectService.list(query);

AtomicInteger serialNumber = new AtomicInteger(0);
List<ProjectAdjustmentExportDTO> 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);
}
}
}

+ 0
- 98
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java Zobrazit soubor

@@ -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<String, OrgInfoDTO> 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;
}

}

+ 0
- 424
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java Zobrazit soubor

@@ -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<ProjectReviewCheckListItemVO> projectLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> 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<Project> page = projectService.page(req.page(), query);
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}

List<String> projectCodes = page.getRecords().stream().map(Project::getProjectCode)
.collect(Collectors.toList());
//求出 审查了的 信息
List<ReviewChecklistApprove> approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class)
.in(ReviewChecklistApprove::getProjectCode, projectCodes));
Map<String, List<ReviewChecklistApprove>> approveMap =
approves.stream().collect(Collectors.groupingBy(ReviewChecklistApprove::getProjectCode));

List<Long> reviewHumans;
// TODO
if (BizConst.DEV.equals(active)) {
reviewHumans = new ArrayList<>();
} else {
reviewHumans = new ArrayList<>();
}
Map<Long, String> userMap;
if (!reviewHumans.isEmpty()) {
List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans);
userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername);
} else {
userMap = Collections.emptyMap();
}

List<ProjectReviewCheckListItemVO> 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<ReviewChecklistApprove> reviewChecklistApproves,
Map<Long, String> userMap, UserInfoDetails user) {
List<String> 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<String> 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<Long, String> userMap, Set<String> 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<Project> query, UserInfoDetails user) {
UserFullInfoDTO userDto = BeanUtil.copyProperties(user, UserFullInfoDTO.class);
Optional<DataScopeDTO> 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<ReviewChecklistApproveDTO> 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<String> 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<FormsReviewChecklistDto> summaryList(String projectCode) {
List<ReviewChecklistApprove> approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class)
.eq(ReviewChecklistApprove::getProjectCode, projectCode)
.orderByAsc(ReviewChecklistApprove::getCreateOn));
if (CollUtil.isEmpty(approves)) {
return Collections.emptyList();
}

//做成map
Map<String, List<ReviewChecklistApprove>> groupTitleMap = approves.stream()
.collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle));
//去重标题
Set<String> titleSet = Sets.newHashSet();
List<ReviewChecklistApprove> 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<ReviewChecklistApprove> 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<ReviewChecklistApprove> approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class)
.eq(ReviewChecklistApprove::getProjectCode, projectCode)
.orderByAsc(ReviewChecklistApprove::getCreateOn));
if (CollUtil.isEmpty(approves)) {
throw new BizException("该项目 未被七大审查人 审批!");
}

List<String> reviewHumans;
if (BizConst.DEV.equals(active)) {
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD;
} else {
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD;
}
Set<String> computeHumanSet = new HashSet<>(reviewHumans);
for (ReviewChecklistApprove approve : approves) {
computeHumanSet.remove(approve.getCreateByCode());
}
if (CollUtil.isNotEmpty(computeHumanSet)) {
throw new BizException("此项目的审查清单 未被七大审核人 审批完!");
}

//做成map 并且还要 未通过的
Map<String, List<ReviewChecklistApprove>> 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<String> titleSet = Sets.newHashSet();
List<ReviewChecklistApprove> dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())).collect(Collectors.toList());

List<FormsReviewChecklistDto> res = dupTitle.stream()
.map(r -> {
FormsReviewChecklistDto vo = new FormsReviewChecklistDto();
vo.setTitle(r.getTitle());
if (groupTitleMap.containsKey(r.getTitle())) {
List<ReviewChecklistApprove> 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<ReviewChecklistModuleDto> convertModules(List<ReviewChecklistApprove> reviewChecklistApproves) {
//做成map
Map<String, List<ReviewChecklistApprove>> groupSubTitleMap = reviewChecklistApproves.stream()
.collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle));
//去重子标题
Set<String> subSubTitleSet = Sets.newHashSet();
List<ReviewChecklistApprove> 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<ReviewChecklistApprove> 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<ReviewChecklistModuleDto> convertModulesFinal(List<ReviewChecklistApprove> reviewChecklistApproves) {
//做成map
Map<String, List<ReviewChecklistApprove>> groupSubTitleMap = reviewChecklistApproves.stream()
.collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle));
//去重子标题
Set<String> subSubTitleSet = Sets.newHashSet();
List<ReviewChecklistApprove> 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<ReviewChecklistApprove> 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());
}
}

+ 0
- 40
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java Zobrazit soubor

@@ -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;

/**
* <p>
* RestartProcessMapUtil - 项目调整 重新提交时的 事件函数MAP
* </p>
*
* @author PoffyZhang
* @since 2023/2/15 11:19
*/
@Component
public class RestartProcessMapUtil {

private static final Map<Integer, Function<DefaultDeclaredDTO, String>> 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<DefaultDeclaredDTO, String> getRestartFunction(Integer status) {
return RESTART_PROCESS_MAP.get(status);
}

}

+ 11
- 18
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java Zobrazit soubor

@@ -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<ProjectRenewalFundDeclarationVO> list(ProjectRenewalListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
return projectRenewalFundManage.list(req,user);
}

@GetMapping("/project-list")
@ApiOperation("项目续建资金库能关联的项目列表")
public PageVo<ProjectLibListItemVO> 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);
}

}

+ 2
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java Zobrazit soubor

@@ -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<Long> 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<ProjectStateChangeEvent> events = Arrays.asList(


+ 4
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java Zobrazit soubor

@@ -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<ProjectStatus> 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<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> 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<Project> 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("开启方案申报失败");
}
});


+ 0
- 80
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java Zobrazit soubor

@@ -119,86 +119,6 @@ public class ProjectRenewalFundManage {
return PageVo.of(records, total);
}

public PageVo<ProjectLibListItemVO> projectList(ProjectRenewalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
LambdaQueryWrapper<Project> 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<Project> page = projectService.page(req.page(), query);
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}

Set<String> projectCodes = new HashSet<>();
List<Long> projectIds = new ArrayList<>();
for (Project project : page.getRecords()) {
projectIds.add(project.getId());
projectCodes.add(project.getProjectCode());
}

Map<Long, List<ProjectAnnualPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds);

Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap;
if (CollUtil.isNotEmpty(projectCodes)) {
Wrapper<ProjectRenewalFundDeclaration> prfQuery = Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear);
List<ProjectRenewalFundDeclaration> renewalDeclarations = projectRenewalFundDeclarationService.list(prfQuery);
renewalMap = CollUtils.group(renewalDeclarations, ProjectRenewalFundDeclaration::getProjectId);
} else {
renewalMap = Collections.emptyMap();
}

Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap;
List<ProjectLibListItemVO> 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<ProjectAnnualPaymentPlan> 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<ProjectRenewalFundDeclaration> 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


+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/WarningFlowTypeEnum.java Zobrazit soubor

@@ -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;


+ 7
- 11
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java Zobrazit soubor

@@ -33,17 +33,13 @@ public enum ProjectStatus implements IStatus<Integer, String> {
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),

/**
* 信产项目备案


+ 3
- 8
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java Zobrazit soubor

@@ -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(),


+ 20
- 26
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java Zobrazit soubor

@@ -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<ActivityInstance> activityInstances = runtimeService.createActivityInstanceQuery()
.processInstanceId(instanceId)
@@ -297,17 +286,22 @@ public class NoticeManage {
.orderByActivityInstanceStartTime()
.asc()
.list();
Set<Long> 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<UserFullInfoDTO> 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);
}

}

/**


+ 2
- 4
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java Zobrazit soubor

@@ -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());
}
}*/
}

// 保存到草稿箱中


+ 0
- 56
hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java Zobrazit soubor

@@ -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));
}
}

Načítá se…
Zrušit
Uložit