@@ -13,27 +13,29 @@ public enum CommonEnum { | |||
/** | |||
* 公共的一些枚举 | |||
*/ | |||
YES(1,"是",1), | |||
NO(0,"否",1), | |||
YES(1, "是", 1), | |||
NO(0, "否", 1), | |||
LS_SBJ(331100,"市本级",2), | |||
LS_LD(331102,"莲都区",2), | |||
LS_QT(331121,"青田县",2), | |||
LS_JY(331122,"缙云县",2), | |||
LS_SC(331123,"遂昌县",2), | |||
LS_SY(331124,"松阳县",2), | |||
LS_YH(331125,"云和县",2), | |||
LS_QY(331126,"庆元县",2), | |||
LS_JN(331127,"景宁畲族自治县",2), | |||
LS_LQ(331181,"龙泉市",2), | |||
LS_KFQ(331199,"开发区",2), | |||
ZWDD(0,"浙政钉",3), | |||
MOBILE(1,"短信",3); | |||
private Integer code; | |||
private String desc; | |||
private Integer groupId; | |||
LS_SBJ(331100, "市本级", 2), | |||
LS_LD(331102, "莲都区", 2), | |||
LS_QT(331121, "青田县", 2), | |||
LS_JY(331122, "缙云县", 2), | |||
LS_SC(331123, "遂昌县", 2), | |||
LS_SY(331124, "松阳县", 2), | |||
LS_YH(331125, "云和县", 2), | |||
LS_QY(331126, "庆元县", 2), | |||
LS_JN(331127, "景宁畲族自治县", 2), | |||
LS_LQ(331181, "龙泉市", 2), | |||
LS_KFQ(331199, "开发区", 2), | |||
ZWDD(0, "浙政钉", 3), | |||
MOBILE(1, "短信", 3); | |||
private final Integer code; | |||
private final String desc; | |||
private final Integer groupId; | |||
public boolean eq(Integer code) { | |||
return this.getCode().equals(code); | |||
} | |||
} |
@@ -34,7 +34,8 @@ public enum ProjectProcessStageEnum { | |||
XC_APPROVAL_PROCESS(9, "信创审批流程"), | |||
SELF_TEST(10, "系统自测审批流程"), | |||
ADAPTION(11, "适配改造审批流程"), | |||
TEST_VALID(12, "测试验证审批流程"); | |||
TEST_VALID(12, "测试验证审批流程"), | |||
COMPLIANCE_REVIEW(13, "合规性审查"); | |||
private final Integer code; | |||
private final String desc; | |||
@@ -1,97 +0,0 @@ | |||
package com.hz.pm.api.common.statemachine.action; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.model.constant.StateMachineConst; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.statemachine.StateContext; | |||
import org.springframework.statemachine.action.Action; | |||
import java.util.List; | |||
import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_DECLARE; | |||
/** | |||
* 项目申报状态机选择分支action类 | |||
* | |||
* @author CMM | |||
* @since 2023/02/07 22:31 | |||
*/ | |||
@Slf4j | |||
public class ProjectDeclareActionChoice implements Action<ProjectStatus, ProjectStateChangeEvent> { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@Override | |||
public void execute(StateContext<ProjectStatus, ProjectStateChangeEvent> stateContext) { | |||
log.info(String.valueOf(stateContext.getTarget().getId())); | |||
ProjectStatus projectStatusEnum = stateContext.getTarget().getId(); | |||
switch (projectStatusEnum) { | |||
case PENDING_PREQUALIFICATION_CHOICE: | |||
preDeclareChoice(stateContext); | |||
break; | |||
case PREQUALIFICATION_WITHDRAW_CHOICE: | |||
preWithDrawChoice(stateContext); | |||
break; | |||
case APPROVED_AFTER_CHOICE: | |||
approvedAfterChoice(stateContext); | |||
break; | |||
default: | |||
throw new IllegalStateException("不支持的项目状态:" + projectStatusEnum); | |||
} | |||
} | |||
private void approvedAfterChoice(StateContext<ProjectStatus, ProjectStateChangeEvent> stateContext) { | |||
Project project = getProject(stateContext); | |||
List<ProjectApplication> projectApplications = getProjectApplication(stateContext); | |||
log.info("立项批复之后,项目的状态为:{}", project.getStatus()); | |||
// 判断 是否有初次创建的应用 | |||
if (CollUtil.isEmpty(projectApplications)) { | |||
project.setStage(ProjectStatus.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatus.TO_BE_PURCHASED.getCode()); | |||
} | |||
final boolean[] isFirstApp = {Boolean.FALSE}; | |||
projectApplications.forEach(app -> { | |||
Integer isFirst = app.getIsFirst(); | |||
if (isFirst.equals(CommonEnum.YES.getCode())) { | |||
isFirstApp[0] = Boolean.TRUE; | |||
} | |||
}); | |||
if (isFirstApp[0]) { | |||
project.setStage(ProjectStatus.NOT_APPROVED.getCode()); | |||
} else { | |||
project.setStage(ProjectStatus.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatus.TO_BE_PURCHASED.getCode()); | |||
} | |||
} | |||
private void preDeclareChoice(StateContext<ProjectStatus, ProjectStateChangeEvent> stateContext) { | |||
Project project = getProject(stateContext); | |||
log.info("预审申报事件之前,项目的状态为:{}", project.getStatus()); | |||
project.setStatus(ProjectStatus.PRE_APPLYING.getCode()); | |||
} | |||
private void preWithDrawChoice(StateContext<ProjectStatus, ProjectStateChangeEvent> stateContext) { | |||
Project project = getProject(stateContext); | |||
log.info("预审中撤回事件之前,项目的状态为:{}", project.getStatus()); | |||
project.setStatus(ProjectStatus.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
private Project getProject(StateContext<ProjectStatus, ProjectStateChangeEvent> stateContext) { | |||
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); | |||
Assert.notNull(project, "项目信息获取失败%s", JSONUtil.toJsonStr(stateContext.getMessage())); | |||
return project; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private List<ProjectApplication> getProjectApplication(StateContext<ProjectStatus, ProjectStateChangeEvent> stateContext) { | |||
return stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); | |||
} | |||
} |
@@ -29,22 +29,24 @@ public class ProjectStateChangeAction { | |||
return project; | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStateChangeEvent> message) { | |||
@OnTransition(source = "TO_BE_DECLARED", target = "ON_COMPLIANCE_REVIEW") | |||
public void PROJECT_APPLICATION_SUBMIT(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.PENDING_PREQUALIFICATION.getCode()); | |||
project.setStage(ProjectStatus.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStateChangeEvent> message) { | |||
@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "COMPLIANCE_REVIEW_FAILED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
project.setStatus(ProjectStatus.COMPLIANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStateChangeEvent> message) { | |||
@OnTransition(source = "COMPLIANCE_REVIEW_FAILED", target = "ON_COMPLIANCE_REVIEW") | |||
public void COMPLIANCE_REVIEW_RESUBMIT(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.TO_BE_DECLARED.getCode()); | |||
project.setStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
@@ -66,43 +68,12 @@ public class ProjectStateChangeAction { | |||
project.setStatus(ProjectStatus.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
@@ -128,13 +99,6 @@ public class ProjectStateChangeAction { | |||
project.setStatus(ProjectStatus.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.PRE_APPLYING.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); | |||
@@ -210,12 +174,6 @@ public class ProjectStateChangeAction { | |||
project.setStatus(ProjectStatus.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
@@ -99,7 +99,7 @@ public class AdaptStateMachineBuilderImpl implements BaseStateMachineBuilder<Pur | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderAdaptStatus, AdaptStateChangeEvent, Purchase>() { | |||
@Override | |||
public void write(StateMachineContext<TenderAdaptStatus, AdaptStateChangeEvent> context, Purchase contextObj) { | |||
log.info("当前项目为:{}", contextObj); | |||
log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); | |||
} | |||
@Override | |||
@@ -1,9 +1,7 @@ | |||
package com.hz.pm.api.common.statemachine.builder.impl; | |||
import com.hz.pm.api.common.statemachine.action.ProjectDeclareActionChoice; | |||
import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -43,7 +41,7 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||
@Override | |||
public StateMachine<ProjectStatus, ProjectStateChangeEvent> build() throws StateMachineException { | |||
StateMachine<ProjectStatus, ProjectStateChangeEvent> stateMachine = build(beanFactory); | |||
log.info("状态机ID:" + stateMachine.getId()); | |||
log.info("状态机ID:{}", stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
@@ -71,22 +69,24 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatus.UNDER_INTERNAL_AUDIT) | |||
.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.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatus.PENDING_PREQUALIFICATION) | |||
.event(ProjectStateChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.source(ProjectStatus.TO_BE_DECLARED) | |||
.target(ProjectStatus.ON_COMPLIANCE_REVIEW) | |||
.event(ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT).and() | |||
.withExternal() | |||
.source(ProjectStatus.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStateChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
.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) | |||
@@ -99,68 +99,6 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||
.event(ProjectStateChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatus.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE) | |||
.first(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new PendingPreQualificationChoiceGuard(), new ProjectDeclareActionChoice()) | |||
.last(ProjectStatus.PRE_APPLYING, new ProjectDeclareActionChoice()).and() | |||
// 省级部门联审通过,从省级部门联审中到省级部门联审成功 | |||
.withExternal() | |||
.source(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) | |||
.target(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStateChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatus.PRE_APPLYING) | |||
.event(ProjectStateChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) | |||
.target(ProjectStatus.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) | |||
.event(ProjectStateChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() | |||
// 省级部门联审中撤回,从省级部门联审中到待预审 | |||
.withExternal() | |||
.source(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) | |||
.target(ProjectStatus.PENDING_PREQUALIFICATION) | |||
.event(ProjectStateChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatus.PRE_APPLYING) | |||
.target(ProjectStatus.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatus.PRE_APPLYING) | |||
.target(ProjectStatus.PREQUALIFICATION_FAILED) | |||
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatus.PRE_APPLYING) | |||
.target(ProjectStatus.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStateChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatus.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, new PendingPreQualificationChoiceGuard() | |||
, new ProjectDeclareActionChoice()) | |||
.last(ProjectStatus.PENDING_PREQUALIFICATION, new ProjectDeclareActionChoice()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatus.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatus.PENDING_PREQUALIFICATION_CHOICE) | |||
.first(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new PendingPreQualificationChoiceGuard(), new ProjectDeclareActionChoice()) | |||
.last(ProjectStatus.PRE_APPLYING, new ProjectDeclareActionChoice()).and() | |||
// 部门联审通过,从部门联审中到年度计划中 | |||
.withExternal() | |||
.source(ProjectStatus.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatus.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
@@ -169,11 +107,6 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||
.source(ProjectStatus.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatus.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatus.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatus.PRE_APPLYING) | |||
.event(ProjectStateChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatus.IN_THE_ANNUAL_PLAN) | |||
@@ -261,7 +194,7 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatus, ProjectStateChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatus, ProjectStateChangeEvent> context, Project contextObj) { | |||
log.info("当前项目为:{}", contextObj); | |||
log.info("当前项目为:{}", contextObj.getProjectCode()); | |||
} | |||
@Override | |||
@@ -99,7 +99,7 @@ public class SelfTestStateMachineBuilderImpl implements BaseStateMachineBuilder< | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderSelfTestStatus, SelfTestStateChangeEvent, Purchase>() { | |||
@Override | |||
public void write(StateMachineContext<TenderSelfTestStatus, SelfTestStateChangeEvent> context, Purchase contextObj) { | |||
log.info("当前项目为:{}", contextObj); | |||
log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); | |||
} | |||
@Override | |||
@@ -126,7 +126,7 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Pu | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderStatus, TenderStateChangeEvent, Purchase>() { | |||
@Override | |||
public void write(StateMachineContext<TenderStatus, TenderStateChangeEvent> context, Purchase contextObj) { | |||
log.info("当前项目为:{}", contextObj); | |||
log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); | |||
} | |||
@Override | |||
@@ -4,7 +4,6 @@ import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder; | |||
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.TenderTestValidStatus; | |||
import com.ningdatech.basic.exception.BizException; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.BeanFactory; | |||
@@ -99,7 +98,7 @@ public class TestValidStateMachineBuilderImpl implements BaseStateMachineBuilder | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderTestValidStatus, TestValidStateChangeEvent, Purchase>() { | |||
@Override | |||
public void write(StateMachineContext<TenderTestValidStatus, TestValidStateChangeEvent> context, Purchase contextObj) { | |||
log.info("当前项目为:{}", contextObj); | |||
log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); | |||
} | |||
@Override | |||
@@ -102,7 +102,7 @@ public class XcfhxStateMachineBuilderImpl implements BaseStateMachineBuilder<Pur | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderXcfhxApplyStatus, XcfhxStateChangeEvent, Purchase>() { | |||
@Override | |||
public void write(StateMachineContext<TenderXcfhxApplyStatus, XcfhxStateChangeEvent> context, Purchase contextObj) { | |||
log.info("当前项目为:{}", contextObj); | |||
log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); | |||
} | |||
@Override | |||
@@ -6,7 +6,7 @@ import lombok.Getter; | |||
/** | |||
* <p> | |||
* ProjectStatusChangeEvent | |||
* 项目状态变更事件 | |||
* </p> | |||
* | |||
* @author WendyYang | |||
@@ -17,13 +17,13 @@ import lombok.Getter; | |||
public enum ProjectStateChangeEvent implements AbstractStateChangeEvent { | |||
/** | |||
* 项目申报暂存(项目状态进入:待申报) | |||
*/ | |||
PROJECT_APPLICATION_HOLD(null, null, null), | |||
/** | |||
* 项目申报提交(项目状态进入:单位内部审核中) | |||
*/ | |||
PROJECT_APPLICATION_SUBMIT(ProjectStatus.TO_BE_DECLARED.getCode(), null, null), | |||
COMPLIANCE_REVIEW_FAILED(null, ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null), | |||
COMPLIANCE_REVIEW_RESUBMIT(ProjectStatus.COMPLIANCE_REVIEW_FAILED.getCode(), null, null), | |||
/** | |||
* 单位内部审核驳回(项目状态进入:单位内部审核不通过) | |||
*/ | |||
@@ -38,35 +38,6 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent { | |||
UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), null, null), | |||
/** | |||
* 预审申报(项目状态进入:待预审选择,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审中;否则项目状态变为:预审中) | |||
*/ | |||
PRELIMINARY_REVIEW_DECLARE(ProjectStatus.PENDING_PREQUALIFICATION.getCode(), null, null), | |||
/** | |||
* 省级部门联审不通过(项目状态变为:省级部门联审不通过) | |||
*/ | |||
PROVINCIAL_DEPARTMENT_REVIEW_REJECT(null, ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), null), | |||
/** | |||
* 省级部门联审通过(项目状态变为:省级联审成功) | |||
*/ | |||
PROVINCIAL_DEPARTMENT_REVIEW_PASS(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), null, null), | |||
/** | |||
* 去到预审(项目状态变为:预审中) | |||
*/ | |||
PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode(), null, null), | |||
/** | |||
* 预审驳回(项目状态变为:预审不通过) | |||
*/ | |||
PRELIMINARY_REVIEW_REJECT(null, ProjectStatus.PRE_APPLYING.getCode(), null), | |||
/** | |||
* 预审不通过重新提交(项目状态变为:待预审选择) | |||
*/ | |||
PRELIMINARY_REVIEW_REJECT_RESUBMIT(ProjectStatus.PREQUALIFICATION_FAILED.getCode(), null, null), | |||
/** | |||
* 预审通过(项目状态变为:部门联审中) | |||
*/ | |||
PRELIMINARY_REVIEW_PASS(ProjectStatus.PRE_APPLYING.getCode(), null, null), | |||
/** | |||
* 部门联审驳回(项目状态变为:部门联审不通过) | |||
*/ | |||
DEPARTMENT_UNITED_REVIEW_REJECT(null, ProjectStatus.DEPARTMENT_JOINT_REVIEW.getCode(), null), | |||
@@ -128,10 +99,6 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent { | |||
*/ | |||
SUBMIT_FIRST_INSPECTED_FILES(ProjectStatus.TO_BE_FIRST_INSPECTED.getCode(), null, null), | |||
/** | |||
* 初验备案(项目状态变为:待终验) | |||
*/ | |||
PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(ProjectStatus.UNDER_CONSTRUCTION.getCode(), null, null), | |||
/** | |||
* 终验申请(项目状态变为:终验审核中) | |||
*/ | |||
FINAL_ACCEPTANCE_APPLICATION(ProjectStatus.ON_PILOT_RUNNING.getCode(), null, null), | |||
@@ -144,20 +111,11 @@ 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()), | |||
/** | |||
* 省级部门联审中时被撤回(项目状态进入:待预审) | |||
*/ | |||
JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(null, null, ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()), | |||
/** | |||
* 预审中时被撤回(项目状态进入:待预审选择,,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审通过;否则项目状态变为:待预审) | |||
*/ | |||
PRE_APPLYING_WITHDRAW(null, null, ProjectStatus.PRE_APPLYING.getCode()), | |||
/** | |||
* 部门联审中时被撤回(项目状态进入:预审中) | |||
*/ | |||
@@ -28,7 +28,7 @@ import com.hz.pm.api.filemanage.model.vo.ProjectFileListVO; | |||
import com.hz.pm.api.filemanage.model.vo.ProjectFileVO; | |||
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; | |||
import com.hz.pm.api.projectdeclared.manage.ConstructionManage; | |||
import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; | |||
import com.hz.pm.api.projectdeclared.manage.DeclaredProjectHelper; | |||
import com.hz.pm.api.projectdeclared.manage.FinalAcceptanceManage; | |||
import com.hz.pm.api.projectdeclared.manage.PurchaseManage; | |||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||
@@ -106,7 +106,7 @@ public class ProjectFileManage { | |||
private final ProjectLibManage projectLibManage; | |||
private final UserInfoHelper userInfoHelper; | |||
private final ProcessModelManage processModelManage; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final ProcessInstanceService processInstanceService; | |||
private final NoticeManage noticeManage; | |||
private final IProjectInstService projectInstService; | |||
@@ -262,13 +262,13 @@ public class ProjectFileManage { | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user)); | |||
params.setUser(declaredProjectHelper.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
// 放入条件判断的项目字段 | |||
// 把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params, project); | |||
declaredProjectHelper.buildCondition(params, project); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMapUserOrgCode(project); | |||
String instanceId = | |||
processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | |||
log.info("申请借阅申报成功 【{}】", instanceId); | |||
@@ -56,7 +56,6 @@ public class IrsProjectManage { | |||
.le(Objects.nonNull(req.getCreateOnMax()), Project::getCreateOn, req.getCreateOnMax()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.gt(Project::getStatus, ProjectStatus.UNDER_CONSTRUCTION.getCode()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getIncludeApplication, CommonEnum.YES.getCode()) | |||
.orderByDesc(Project::getUpdateOn); | |||
@@ -862,7 +862,7 @@ public class MeetingManage { | |||
.eq(Project::getNewest, Boolean.TRUE); | |||
switch (MeetingReviewTypeEnum.getByCode(meetingType)) { | |||
case PRELIMINARY_SCHEME_REVIEW: | |||
buildOptionProjectQuery(query, meetingType, ProjectStatus.PRE_APPLYING); | |||
buildOptionProjectQuery(query, meetingType, null); | |||
break; | |||
case CONSTRUCTION_SCHEME_REVIEW: | |||
buildOptionProjectQuery(query, meetingType, null); | |||
@@ -1,56 +0,0 @@ | |||
package com.hz.pm.api.projectdeclared.controller; | |||
import javax.servlet.http.HttpServletResponse; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.projectdeclared.manage.PrequalificationDeclaredProjectManage; | |||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.hz.pm.api.projectdeclared.model.req.PrequalificationDeclaredListReq; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
/** | |||
* @Classname PrequalificationDeclaredController | |||
* @Description 预审申报 | |||
* @Date 2023/2/12 9:03 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
@Validated | |||
@RestController | |||
@RequestMapping("/api/v1/prequalification") | |||
@Api(value = "Prequalification", tags = "申报管理-预审申报") | |||
@RequiredArgsConstructor | |||
public class PrequalificationDeclaredController { | |||
private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | |||
@ApiOperation(value = "可预审申报项目列表", notes = "可预审申报项目列表") | |||
@GetMapping("/list") | |||
public PageVo<ProjectLibListItemVO> list(@Validated @ModelAttribute PrequalificationDeclaredListReq preReq) { | |||
return prequalificationDeclaredProjectManage.pageInfo(preReq); | |||
} | |||
@ApiOperation(value = "申报预审", notes = "申报预审") | |||
@WebLog("申报预审") | |||
@PostMapping("/start") | |||
public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { | |||
return prequalificationDeclaredProjectManage.startTheProcess(dto); | |||
} | |||
@GetMapping("/export") | |||
@ApiOperation("可预审申报项目列表导出") | |||
@WebLog("可预审申报项目列表导出") | |||
public void exportList(PrequalificationDeclaredListReq preReq, HttpServletResponse response){ | |||
ExcelDownUtil.downXls(response,preReq,prequalificationDeclaredProjectManage::exportList); | |||
} | |||
} |
@@ -32,8 +32,8 @@ import com.hz.pm.api.projectlib.helper.ProjectHelper; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectAnnualPaymentPlan; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
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.enumeration.status.TenderStatus; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.TenderXcfhxApplyStatus; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
@@ -88,7 +88,7 @@ public class ConstructionManage { | |||
private final ProcessModelManage processModelManage; | |||
private final IProjectInstService projectInstService; | |||
private final IPaymentPlanService paymentPlanService; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final IPreInsAcceptancePersonService acceptancePersonService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||
@@ -106,7 +106,6 @@ public class ConstructionManage { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态 | |||
query.eq(Project::getStatus, ProjectStatus.UNDER_CONSTRUCTION.getCode()); | |||
query.isNull(Project::getContractAmount); | |||
query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -151,10 +150,6 @@ public class ConstructionManage { | |||
public PageVo<ProjectContractListVO> projectListPerfect(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态以后的 都是 | |||
query.and(q1 -> q1.gt(Project::getStatus, ProjectStatus.UNDER_CONSTRUCTION.getCode()) | |||
.or(q2 -> q2.eq(Project::getStatus, ProjectStatus.UNDER_CONSTRUCTION.getCode()) | |||
.isNotNull(Project::getContractAmount))); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
@@ -208,7 +203,6 @@ public class ConstructionManage { | |||
public void exportList(HttpServletResponse response, ProjectListReq param) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
query.eq(Project::getStatus, ProjectStatus.UNDER_CONSTRUCTION.getCode()); | |||
query.isNull(Project::getContractAmount); | |||
query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -422,7 +416,6 @@ public class ConstructionManage { | |||
//待采购状态 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatus.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//交货时间 排序 | |||
@@ -576,12 +569,12 @@ public class ConstructionManage { | |||
throw BizException.wrap("找不到信创审批流程配置"); | |||
} | |||
ProcessStartParamsVo processParam = new ProcessStartParamsVo(); | |||
processParam.setUser(defaultDeclaredProjectManage.buildUser(user)); | |||
processParam.setUser(declaredProjectHelper.buildUser(user)); | |||
processParam.setProcessUsers(Collections.emptyMap()); | |||
processParam.setFormData(Collections.emptyMap()); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = projectService.getById(req.getProjectId()); | |||
Map<String, OrgInfoDTO> orgMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processInstanceService.startProcessLs(model, processParam, orgMap); | |||
ProjectInst projectInst = new ProjectInst(); | |||
@@ -50,15 +50,12 @@ import java.util.stream.Collectors; | |||
@Component | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
public class DefaultDeclaredProjectManage { | |||
public class DeclaredProjectHelper { | |||
private final IProjectService projectService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final ProcessModelService processModelService; | |||
private final OrgProcdefService orgProcdefService; | |||
private final IDeclaredStatisticsService statisticsService; | |||
/** |
@@ -29,8 +29,8 @@ import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
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; | |||
@@ -88,7 +88,7 @@ public class DeclaredProjectManage { | |||
private final IProjectDraftService projectDraftService; | |||
private final ProcessInstanceService processService; | |||
private final ProcessModelManage processModelManage; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final NoticeManage noticeManage; | |||
private final UserInfoHelper userInfoHelper; | |||
private final MhUnitCache mhUnitCache; | |||
@@ -103,41 +103,40 @@ public class DeclaredProjectManage { | |||
public synchronized String startTheProcess(DefaultDeclaredDTO req) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS, | |||
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.COMPLIANCE_REVIEW, | |||
user.getMhUnitId()); | |||
if (Objects.isNull(model)) { | |||
throw BizException.wrap("找不到单位流程配置"); | |||
} | |||
ProjectDTO projectInfo = req.getProjectInfo(); | |||
projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setBuildOrgName(user.getMhUnitName()); | |||
ProjectDTO reqProj = req.getProjectInfo(); | |||
reqProj.setBuildOrgCode(user.getMhUnitIdStr()); | |||
reqProj.setBuildOrgName(user.getMhUnitName()); | |||
//项目名称去重 | |||
declaredProjectManage.checkDuplication(projectInfo); | |||
declaredProjectHelper.checkDuplication(reqProj); | |||
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 | |||
declaredProjectManage.checkAmount(projectInfo); | |||
declaredProjectHelper.checkAmount(reqProj); | |||
//写死 是否有主管单位 | |||
projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); | |||
projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
reqProj.setIsHigherSuperOrg(CommonEnum.YES.getCode()); | |||
reqProj.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
//如果主管单位没有 那么主管单位就是自己 | |||
if (CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())) { | |||
projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setSuperOrg(user.getMhUnitName()); | |||
if (CommonEnum.NO.eq(reqProj.getIsSuperOrg())) { | |||
reqProj.setSuperOrgCode(user.getMhUnitIdStr()); | |||
reqProj.setSuperOrg(user.getMhUnitName()); | |||
} | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
if (Objects.nonNull(projectInfo.getId())) { | |||
if (Objects.nonNull(reqProj.getId())) { | |||
//新申报的项目不允许带项目id | |||
projectInfo.setId(null); | |||
reqProj.setId(null); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(declaredProjectManage.buildUser(user)); | |||
params.setUser(declaredProjectHelper.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
@@ -147,20 +146,19 @@ public class DeclaredProjectManage { | |||
}) | |||
); | |||
params.setFormData(req.getFormData()); | |||
//开始申报 | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectInfo, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
BeanUtils.copyProperties(reqProj, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("申报项目成功 【{}】", instanceId); | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
//保存项目相关 | |||
Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo, instanceId, user.getUserId()); | |||
if (Objects.nonNull(projectInfo.getDraftId())) { | |||
Project buildProject = projectLibManage.saveProjectInDeclared(reqProj, instanceId, user.getUserId()); | |||
if (Objects.nonNull(reqProj.getDraftId())) { | |||
//如果是草稿箱提交 删除对应的草稿箱 | |||
projectDraftService.removeById(projectInfo.getDraftId()); | |||
projectDraftService.removeById(reqProj.getDraftId()); | |||
} | |||
//发送给第一个审批人消息 | |||
@@ -174,25 +172,25 @@ public class DeclaredProjectManage { | |||
/** | |||
* 重新提交 启动实例 | |||
* | |||
* @param dto | |||
* @param req | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public synchronized String reStartTheProcess(DefaultDeclaredDTO dto) { | |||
public synchronized String reStartTheProcess(DefaultDeclaredDTO req) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
projectDto.setBuildOrgCode(user.getMhUnitIdStr()); | |||
projectDto.setBuildOrgName(user.getMhUnitName()); | |||
ProjectDTO reqProj = req.getProjectInfo(); | |||
reqProj.setBuildOrgCode(user.getMhUnitIdStr()); | |||
reqProj.setBuildOrgName(user.getMhUnitName()); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(reqProj.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(reqProj.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
//项目名称去重 | |||
if (StringUtils.isNotBlank(projectDto.getProjectName()) && | |||
!projectDto.getProjectName().equals(projectInfo.getProjectName())) { | |||
projectDto.setProjectCode(projectInfo.getProjectCode()); | |||
declaredProjectManage.checkDuplication(projectDto); | |||
if (StringUtils.isNotBlank(reqProj.getProjectName()) && | |||
!reqProj.getProjectName().equals(projectInfo.getProjectName())) { | |||
reqProj.setProjectCode(projectInfo.getProjectCode()); | |||
declaredProjectHelper.checkDuplication(reqProj); | |||
} | |||
//写死 是否有主管单位 | |||
@@ -200,17 +198,17 @@ public class DeclaredProjectManage { | |||
projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
//如果主管单位没有 那么主管单位就是自己 | |||
if (CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())) { | |||
if (CommonEnum.NO.getCode().equals(reqProj.getIsSuperOrg())) { | |||
projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setSuperOrg(user.getMhUnitName()); | |||
projectDto.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectDto.setSuperOrg(user.getMhUnitName()); | |||
reqProj.setSuperOrgCode(user.getMhUnitIdStr()); | |||
reqProj.setSuperOrg(user.getMhUnitName()); | |||
} | |||
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 | |||
declaredProjectManage.checkAmount(projectDto); | |||
declaredProjectHelper.checkAmount(reqProj); | |||
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS, | |||
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.COMPLIANCE_REVIEW, | |||
user.getMhUnitId()); | |||
if (Objects.isNull(model)) { | |||
@@ -218,32 +216,34 @@ public class DeclaredProjectManage { | |||
} | |||
//首先要判断 项目当前状态 是不是 单位内部拒绝 | |||
VUtils.isTrue(!ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode().equals(projectInfo.getStatus()) || | |||
!ProjectStatus.NOT_APPROVED.getCode().equals(projectInfo.getStage())) | |||
VUtils.isTrue(!ProjectStatus.COMPLIANCE_REVIEW_FAILED.eq(projectInfo.getStatus()) || | |||
!ProjectStatus.NOT_APPROVED.eq(projectInfo.getStage())) | |||
.throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(declaredProjectManage.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
ProcessStartParamsVo instParam = new ProcessStartParamsVo(); | |||
instParam.setUser(declaredProjectHelper.buildUser(user)); | |||
instParam.setProcessUsers(Collections.emptyMap()); | |||
//把条件值给放入工作流 | |||
declaredProjectManage.buildCondition(params, dto); | |||
declaredProjectHelper.buildCondition(instParam, req); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectDto, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("重新申报项目成功 【{}】", instanceId); | |||
BeanUtils.copyProperties(reqProj, project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
String instId = processService.startProcessLs(model, instParam, orgModelMap); | |||
log.info("重新申报项目成功 【{}】", instId); | |||
//保存项目相关 | |||
Project buildProject = projectLibManage.saveProjectInDeclared(projectDto, instanceId, user.getUserId()); | |||
Project buildProject = projectLibManage.saveProjectInDeclared(reqProj, instId, | |||
user.getUserId(), ProjectStatus.NOT_APPROVED, ProjectStatus.COMPLIANCE_REVIEW_FAILED, | |||
ProjectProcessStageEnum.COMPLIANCE_REVIEW); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, | |||
noticeManage.sendFirstUser(buildProject, model.getFormName(), instId, | |||
WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
return instanceId; | |||
return instId; | |||
} | |||
public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO req, Integer draftType) { | |||
@@ -370,8 +370,7 @@ public class DeclaredProjectManage { | |||
//如果当前登录是单位管理员 | |||
String mhUnitId = user.getMhUnitIdStr(); | |||
if (user.getIsOrgAdmin()) { | |||
query.and(s1 -> s1.eq(Project::getStatus, ProjectStatus.PREQUALIFICATION_FAILED.getCode()) | |||
.eq(Project::getSuperOrgCode, mhUnitId) | |||
query.and(s1 -> s1.eq(Project::getSuperOrgCode, mhUnitId) | |||
.or(q2 -> q2.eq(Project::getBuildOrgCode, mhUnitId))); | |||
} else { | |||
//否则 只能看到 非预审 并且 | |||
@@ -80,7 +80,7 @@ public class DelayedApplyManage { | |||
private final IProjectService projectService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final ProcessModelManage processModelManage; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final ProcessInstanceService processInstanceService; | |||
private final ProjectLibManage projectLibManage; | |||
private final NoticeManage noticeManage; | |||
@@ -264,13 +264,13 @@ public class DelayedApplyManage { | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user)); | |||
params.setUser(declaredProjectHelper.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params, project); | |||
declaredProjectHelper.buildCondition(params, project); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMapUserOrgCode(project); | |||
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | |||
log.info("延期申请申报成功 【{}】", instanceId); | |||
@@ -79,7 +79,7 @@ public class FinalAcceptanceManage { | |||
private final IPurchaseInstService purchaseInstService; | |||
private final ProcessModelManage processModelManage; | |||
private final ProcessInstanceService processInstanceService; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectManage; | |||
private final IContractService contractService; | |||
private final IProjectAnnualPaymentPlanService projectAnnualPaymentPlanService; | |||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||
@@ -1,337 +0,0 @@ | |||
package com.hz.pm.api.projectdeclared.manage; | |||
import com.alibaba.excel.EasyExcelFactory; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
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.DefaultDeclaredDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.PretrialDeclaredExportDTO; | |||
import com.hz.pm.api.projectdeclared.model.req.PrequalificationDeclaredListReq; | |||
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.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
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.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.staging.service.IProjectStagingService; | |||
import com.hz.pm.api.sys.manage.NoticeManage; | |||
import com.hz.pm.api.sys.manage.ProcessModelManage; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.constant.WorkNoticeConst; | |||
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.NdDateUtils; | |||
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.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.time.LocalDateTime; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname ProqualificationDeclaredProjectManage | |||
* @Description | |||
* @Date 2023/2/13 14:48 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
public class PrequalificationDeclaredProjectManage { | |||
private final IProjectService projectService; | |||
private final ProjectLibManage projectLibManage; | |||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||
private final IProjectStagingService projectStagingService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final ProcessModelManage processModelManage; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final ProcessInstanceService processInstanceService; | |||
private final IProjectInstService projectInstService; | |||
private final NoticeManage noticeManage; | |||
/** | |||
* 提交预审 | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public synchronized String startTheProcess(DefaultDeclaredDTO dto) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getNewProject(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
//要判断 当前操作人 是不是项目主管单位的人 | |||
VUtils.isTrue(Objects.isNull(user.getMhUnitId())) | |||
.throwMessage(String.format("当前登录人没有单位 【%s】", user.getRealName())); | |||
VUtils.isTrue(!user.getMhUnitIdStr().equals(projectInfo.getSuperOrgCode())) | |||
.throwMessage(String.format("只有主管单位 【%s】的人 才能够提交", projectInfo.getSuperOrg())); | |||
//首先要判断 项目当前状态 是不是 待预审 | |||
VUtils.isTrue((!ProjectStatus.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) && | |||
!ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(projectInfo.getStatus())) || | |||
!ProjectStatus.NOT_APPROVED.getCode().equals(projectInfo.getStage())) | |||
.throwMessage("提交失败 该项目不是 待预审状态(省级部门联审成功)或者未立项阶段"); | |||
//使用状态机 进入下一步 看看需不需要走省级审批 放入文件 | |||
if (StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())) { | |||
projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); | |||
} | |||
projectStateMachineUtil.pass(projectInfo); | |||
String instanceId; | |||
//如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) | |||
if (ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS | |||
.getCode().equals(projectInfo.getStatus())) { | |||
//入库暂存表 后续处理 对接外部接口 | |||
projectInfo.setUpdateOn(LocalDateTime.now()); | |||
//保存一下 当前的主管单位发起人 | |||
projectInfo.setPreStartUserId(user.getUserIdStr()); | |||
//当前实例置为空 | |||
projectInfo.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); | |||
if (Boolean.TRUE.equals(projectStagingService.addByProject(projectInfo, "省级部门联审")) | |||
&& projectService.updateById(projectInfo)) { | |||
return "提交省级部门联审成功"; | |||
} | |||
return "提交省级部门联审失败"; | |||
} else if (ProjectStatus.PRE_APPLYING | |||
.getCode().equals(projectInfo.getStatus())) { | |||
//如果是非省级联审的项目 直接提交 预审 | |||
instanceId = directStartProcess(projectInfo, user, dto.getRestart()); | |||
} else { | |||
throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); | |||
} | |||
return "提交预审成功【" + instanceId + "】"; | |||
} | |||
/** | |||
* 重新提交预审 | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String restartTheProcess(DefaultDeclaredDTO dto) { | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
//重新提交 生成新版本号 回到 待预审状态 | |||
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto, null, | |||
ProjectStatus.PENDING_PREQUALIFICATION.getCode(), Boolean.FALSE); | |||
dto.getProjectInfo().setId(project.getId()); | |||
dto.setRestart(Boolean.TRUE); | |||
return startTheProcess(dto); | |||
} | |||
//直接提交预审方法 提取 在省级联审通过的时候 也可以用 | |||
public String directStartProcess(Project projectInfo, UserInfoDetails user, Boolean restart) { | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
Long userId = user.getUserId(); | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params, projectInfo); | |||
ProjectProcessStageEnum instType = ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS; | |||
WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId()); | |||
if (Objects.isNull(model)) { | |||
throw new BusinessException("找不到预审流程配置"); | |||
} | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId, projectInfo); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("提交预审项目成功 【{}】", instanceId); | |||
log.info("restart 【{}】", restart); | |||
//保存预审项目 | |||
if (Boolean.TRUE.equals(restart)) { | |||
//如果是重新提交 不用生成新版本 前面已经生成过了 | |||
preModifyProject(projectInfo, instanceId); | |||
} else { | |||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, | |||
ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); | |||
} | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, | |||
WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
return instanceId; | |||
} | |||
/** | |||
* 提交预审项目 时 更新信息 | |||
* | |||
* @param project | |||
* @param instanceId | |||
*/ | |||
private void preModifyProject(Project project, String instanceId) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setInstCode(instanceId); | |||
projectService.updateById(project); | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
projectInst.setProjectId(project.getId()); | |||
projectInst.setInstCode(instanceId); | |||
projectInst.setInstType(ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); | |||
projectInstService.save(projectInst); | |||
} catch (Exception e) { | |||
log.error("提交预审 项目信息修改 错误 ", e); | |||
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage()); | |||
} | |||
} | |||
/** | |||
* 查询项目库 | |||
* | |||
* @param preReq | |||
* @return | |||
*/ | |||
public PageVo<ProjectLibListItemVO> pageInfo(PrequalificationDeclaredListReq preReq) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
//限定参数 复制bean | |||
ProjectListReq req = new ProjectListReq(); | |||
BeanUtils.copyProperties(preReq, req); | |||
//项目阶段 状态 已定 待预审和省级部门联审成功 | |||
req.setStage(ProjectStatus.NOT_APPROVED.getCode()); | |||
req.setStatusList(Lists.newArrayList(ProjectStatus.PENDING_PREQUALIFICATION.getCode(), | |||
ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
buildPermission(query, user); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
item.setProjectName(w.getProjectName()); | |||
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() && | |||
(ProjectStatus.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) || | |||
ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(item.getStatus())) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
return item; | |||
}); | |||
return PageVo.of(records, total); | |||
} | |||
/** | |||
* build 项目的角色权限到req | |||
* | |||
* @param query | |||
*/ | |||
public void buildPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { | |||
if (user.getIsOrgAdmin()) { | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()) | |||
.or(q2 -> q2.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode()) | |||
.and(s1 -> s1.eq(Project::getStatus, ProjectStatus.PENDING_PREQUALIFICATION.getCode()) | |||
.or(s2 -> s2.eq(Project::getStatus, ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()))) | |||
.eq(Project::getSuperOrgCode, user.getMhUnitIdStr()))); | |||
} else { | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
} | |||
} | |||
public void exportList(HttpServletResponse response, PrequalificationDeclaredListReq preReq) { | |||
ProjectListReq req = new ProjectListReq(); | |||
BeanUtils.copyProperties(preReq, req); | |||
//项目阶段 状态 已定 待预审 | |||
req.setStage(ProjectStatus.NOT_APPROVED.getCode()); | |||
req.setStatusList(Lists.newArrayList(ProjectStatus.PENDING_PREQUALIFICATION.getCode(), | |||
ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//角色权限 | |||
buildPermission(query, user); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
List<Project> records = projectService.list(query); | |||
List<PretrialDeclaredExportDTO> collect = records.stream().map(r -> { | |||
PretrialDeclaredExportDTO exportDTO = new PretrialDeclaredExportDTO(); | |||
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 { | |||
EasyExcelFactory.write(response.getOutputStream(), PretrialDeclaredExportDTO.class) | |||
.autoCloseStream(false) | |||
.registerWriteHandler(ExcelExportStyle.formalStyle()) | |||
.sheet(fileName) | |||
.doWrite(collect); | |||
} catch (IOException e) { | |||
throw new BizException(e); | |||
} | |||
} | |||
} |
@@ -33,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@@ -54,7 +53,7 @@ public class ProjectAdjustmentManage { | |||
private final IProjectService projectService; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final ProjectLibManage projectLibManage; | |||
@@ -77,12 +76,12 @@ public class ProjectAdjustmentManage { | |||
if (StringUtils.isNotBlank(projectDto.getProjectName()) && | |||
!projectDto.getProjectName().equals(projectInfo.getProjectName())) { | |||
projectDto.setProjectCode(projectInfo.getProjectCode()); | |||
defaultDeclaredProjectManage.checkDuplication(projectDto); | |||
declaredProjectHelper.checkDuplication(projectDto); | |||
} | |||
//金额check | |||
if (Objects.nonNull(projectDto.getDeclareAmount())) { | |||
defaultDeclaredProjectManage.checkAmount(projectDto); | |||
declaredProjectHelper.checkAmount(projectDto); | |||
} | |||
//最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 | |||
@@ -92,10 +91,8 @@ public class ProjectAdjustmentManage { | |||
return declaredFunction.apply(dto); | |||
} | |||
private static final List<Integer> PROJECT_STATUS = Arrays.asList( | |||
ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), | |||
ProjectStatus.PREQUALIFICATION_FAILED.getCode(), | |||
ProjectStatus.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
private static final List<Integer> PROJECT_STATUS = Collections.singletonList( | |||
ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
/** | |||
* 项目库 | |||
@@ -122,7 +122,7 @@ public class PurchaseManage { | |||
private final MhUnitCache mhUnitCache; | |||
private final IOperationService operationService; | |||
private final ProcessModelManage processModelManage; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectManage; | |||
private final ProcessInstanceService processInstanceService; | |||
private final TestValidStateMachineUtil testValidStateMachineUtil; | |||
private final SelfTestStateMachineUtil selfTestStateMachineUtil; | |||
@@ -40,9 +40,9 @@ public class ReviewByDeptJointManage { | |||
private final IProjectService projectService; | |||
private final ProcessModelManage processModelManage; | |||
private final ProcessInstanceService processService; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectManage; | |||
private final ProjectLibManage projectLibManage; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final NoticeManage noticeManage; | |||
private final UserInfoHelper userInfoHelper; | |||
@@ -80,10 +80,10 @@ public class ReviewByDeptJointManage { | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params, projectInfo); | |||
declaredProjectHelper.buildCondition(params, projectInfo); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgMap = defaultDeclaredProjectManage.buildOrgModelMap(startUser.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectHelper.buildOrgModelMap(startUser.getUserId(), project); | |||
String instanceId = processService.startProcessLs(model, params, orgMap); | |||
log.info("部门联审申报成功 【{}】", instanceId); | |||
@@ -2,7 +2,6 @@ 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.manage.PrequalificationDeclaredProjectManage; | |||
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; | |||
@@ -25,14 +24,10 @@ public class RestartProcessMapUtil { | |||
private static final Map<Integer, Function<DefaultDeclaredDTO, String>> RESTART_PROCESS_MAP = Maps.newHashMap(); | |||
public RestartProcessMapUtil(DeclaredProjectManage declaredProjectManage, | |||
PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage, | |||
DeclaredRecordManage declaredRecordManage) { | |||
//重新项目申报 | |||
// 重新项目申报 | |||
RESTART_PROCESS_MAP.put(ProjectStatus.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), | |||
declaredProjectManage::reStartTheProcess); | |||
//预审方案 | |||
RESTART_PROCESS_MAP.put(ProjectStatus.PREQUALIFICATION_FAILED.getCode(), | |||
prequalificationDeclaredProjectManage::restartTheProcess); | |||
// 立项备案重新提交 | |||
RESTART_PROCESS_MAP.put(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), | |||
declaredRecordManage::restartDeclaredRecord); | |||
@@ -67,7 +67,7 @@ public class AnnualPlanLibManage { | |||
*/ | |||
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, UNDER_CONSTRUCTION, | |||
PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, | |||
ON_PILOT_RUNNING, ARCHIVED); | |||
public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) { | |||
@@ -8,14 +8,12 @@ import cn.hutool.poi.excel.ExcelUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.TypeReferenceConst; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.utils.DataScopeUtil; | |||
@@ -23,7 +21,7 @@ import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; | |||
import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; | |||
import com.hz.pm.api.external.todo.MHTodoClient; | |||
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum; | |||
import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; | |||
import com.hz.pm.api.projectdeclared.manage.DeclaredProjectHelper; | |||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; | |||
import com.hz.pm.api.projectdeclared.service.IProjectDraftService; | |||
@@ -35,7 +33,6 @@ import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.entity.MhProject; | |||
import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; | |||
@@ -98,7 +95,7 @@ public class DeclaredRecordManage { | |||
private final NoticeManage noticeManage; | |||
private final IProjectDraftService projectDraftService; | |||
private final ProcessModelManage processModelManage; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final ProcessInstanceService processInstanceService; | |||
private final ProjectLibManage projectLibManage; | |||
private final IProjectStatusChangeService projectStatusChangeService; | |||
@@ -289,7 +286,7 @@ public class DeclaredRecordManage { | |||
projectInfo.setBuildOrgName(user.getMhUnitName()); | |||
// 项目名称去重 | |||
defaultDeclaredProjectManage.checkDuplication(projectInfo); | |||
declaredProjectHelper.checkDuplication(projectInfo); | |||
// 写死 是否有主管单位 | |||
projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode()); | |||
@@ -308,7 +305,7 @@ public class DeclaredRecordManage { | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user)); | |||
params.setUser(declaredProjectHelper.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO condition = new ProjectConditionDTO(); | |||
@@ -319,24 +316,21 @@ public class DeclaredRecordManage { | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectInfo, project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("立项备案成功 【{}】", instanceId); | |||
// 如果是重新提交的话 判断下 项目是否存在 | |||
// 保存项目相关 | |||
Project newProj = projectLibManage.saveProjectInDeclared(projectInfo, instanceId, user.getUserId(), | |||
ProjectStatus.NOT_APPROVED, ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING, | |||
ProjectStatus.NOT_APPROVED, ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD, | |||
ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS); | |||
// 保存状态变更 | |||
saveProjectStatusChangeLog(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD, | |||
newProj, ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT); | |||
if (Objects.nonNull(projectInfo.getDraftId())) { | |||
//如果是草稿箱提交 删除对应的草稿箱 | |||
projectDraftService.removeById(projectInfo.getDraftId()); | |||
} | |||
// 申报项目完成后 保存项目编码 | |||
LambdaUpdateWrapper<MhProject> update = Wrappers.lambdaUpdate(MhProject.class) | |||
Wrapper<MhProject> update = Wrappers.lambdaUpdate(MhProject.class) | |||
.set(MhProject::getProjectCode, newProj.getProjectCode()) | |||
.eq(MhProject::getId, projectInfo.getMhProjectId()); | |||
mhProjectService.update(update); | |||
@@ -362,7 +356,7 @@ public class DeclaredRecordManage { | |||
if (StrUtil.isNotBlank(reqProj.getProjectName()) && | |||
!reqProj.getProjectName().equals(oldProj.getProjectName())) { | |||
reqProj.setProjectCode(oldProj.getProjectCode()); | |||
defaultDeclaredProjectManage.checkDuplication(reqProj); | |||
declaredProjectHelper.checkDuplication(reqProj); | |||
} | |||
UnitDTO unit = mhUnitCache.getById(user.getMhUnitId()); | |||
Assert.notNull(unit, "申报单位不存在"); | |||
@@ -373,7 +367,7 @@ public class DeclaredRecordManage { | |||
oldProj.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
//如果主管单位没有 那么主管单位就是自己 | |||
if (CommonEnum.NO.getCode().equals(reqProj.getIsSuperOrg())) { | |||
if (CommonEnum.NO.eq(reqProj.getIsSuperOrg())) { | |||
oldProj.setSuperOrgCode(user.getMhUnitIdStr()); | |||
oldProj.setSuperOrg(user.getMhUnitName()); | |||
reqProj.setSuperOrgCode(user.getMhUnitIdStr()); | |||
@@ -387,51 +381,35 @@ public class DeclaredRecordManage { | |||
throw BizException.wrap("%s不存在", instType.getDesc()); | |||
} | |||
//首先要判断 项目当前状态 是不是 单位内部拒绝 | |||
VUtils.isTrue(!ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.eq(oldProj.getStatus()) || | |||
!ProjectStatus.NOT_APPROVED.eq(oldProj.getStage())) | |||
.throwMessage("提交失败,该项目不是立项备案审核不通过状态或者未立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user)); | |||
params.setUser(declaredProjectHelper.buildUser(user)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params, req); | |||
declaredProjectHelper.buildCondition(params, req); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(reqProj, project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user.getUserId(), project); | |||
String instId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("立项备案成功 【{}】", instId); | |||
//保存项目相关 | |||
Project newProj = projectLibManage.saveProjectInDeclared(reqProj, instId, user.getUserId(), | |||
ProjectStatus.NOT_APPROVED, | |||
ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING, | |||
ProjectStatus.DECLARED_APPROVED_RECORD_FAILED, | |||
instType); | |||
// 保存状态变更 | |||
saveProjectStatusChangeLog(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED, | |||
newProj, ProjectStateChangeEvent.DECLARED_RECORD_RESUBMIT); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirstUser(newProj, model.getFormName(), instId, | |||
WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
return instId; | |||
} | |||
private void saveProjectStatusChangeLog(ProjectStatus beforeStatus, Project project, ProjectStateChangeEvent event) { | |||
ProjectStatusChange change = new ProjectStatusChange(); | |||
change.setAfterStatus(project.getStatus()); | |||
change.setProjectId(project.getId()); | |||
change.setBeforeStatus(beforeStatus.getCode()); | |||
change.setEvent(event.name()); | |||
change.setCreateOn(LocalDateTime.now()); | |||
change.setProjectCode(project.getProjectCode()); | |||
projectStatusChangeService.save(change); | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
public synchronized void initMhProjectToProject() { | |||
Wrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | |||
@@ -51,6 +51,7 @@ import com.hz.pm.api.projectdeclared.service.IOperationService; | |||
import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | |||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | |||
import com.hz.pm.api.projectlib.handle.ProcessProgressHelper; | |||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | |||
@@ -243,8 +244,7 @@ public class ProjectLibManage { | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (finalUser.getIsOrgAdmin() && ProjectStatus.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
if (finalUser.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
@@ -322,8 +322,7 @@ public class ProjectLibManage { | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); | |||
if (user.getIsOrgAdmin() && ProjectStatus.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
if (user.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
@@ -425,8 +424,7 @@ public class ProjectLibManage { | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (user.getIsOrgAdmin() && ProjectStatus.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
if (user.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
@@ -481,8 +479,7 @@ public class ProjectLibManage { | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (user.getIsOrgAdmin() && ProjectStatus.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
if (user.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
@@ -574,8 +571,7 @@ public class ProjectLibManage { | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); | |||
if (user.getIsOrgAdmin() && ProjectStatus.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
if (user.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
@@ -642,11 +638,11 @@ public class ProjectLibManage { | |||
*/ | |||
public ProjectDetailVO getProjectDetail(Long projectId) { | |||
// 查询最新的项目申报信息 | |||
Project projectInfo = projectService.getNewProject(projectId); | |||
if (Objects.isNull(projectInfo)) { | |||
Project project = projectService.getNewProject(projectId); | |||
if (Objects.isNull(project)) { | |||
return null; | |||
} | |||
return getProjectDetailLogic(projectInfo); | |||
return getProjectDetailLogic(project); | |||
} | |||
public ProjectDetailVO getProjectDetail(Project project) { | |||
@@ -655,7 +651,8 @@ public class ProjectLibManage { | |||
public ProjectDetailVO detailProjectCode(String projectCode) { | |||
// 查询最新的项目申报信息 | |||
Project project = projectService.getProjectByCode(projectCode); | |||
Long projectId = ProjectIdCodeCacheUtil.newest(projectCode); | |||
Project project = projectService.getById(projectId); | |||
return project == null ? null : getProjectDetailLogic(project); | |||
} | |||
@@ -814,9 +811,9 @@ public class ProjectLibManage { | |||
/** | |||
* 申报新项目时 保存项目信息和其它相关联的信息 | |||
* | |||
* @param projectDto | |||
* @param instanceId | |||
* @return | |||
* @param projectDto \ | |||
* @param instanceId \ | |||
* @return \ | |||
*/ | |||
public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, Long userId) { | |||
Project project = saveProjectNewVersion(projectDto, instanceId, userId, Boolean.FALSE); | |||
@@ -826,7 +823,7 @@ public class ProjectLibManage { | |||
projectInst.setInstCode(instanceId); | |||
projectInst.setCreateOn(LocalDateTime.now()); | |||
projectInst.setUpdateOn(LocalDateTime.now()); | |||
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||
projectInst.setInstType(ProjectProcessStageEnum.COMPLIANCE_REVIEW.getCode()); | |||
projectInstService.save(projectInst); | |||
return project; | |||
} | |||
@@ -850,7 +847,7 @@ public class ProjectLibManage { | |||
projectInstService.save(projectInst); | |||
return project; | |||
} | |||
/** | |||
* 申报新项目时 保存项目信息和其它相关联的信息 | |||
* | |||
@@ -861,7 +858,7 @@ public class ProjectLibManage { | |||
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||
Long userId, Boolean isContruct) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
return saveProjectNewVersion(projectDto, instanceId, userId, isContruct, ProjectStatus.NOT_APPROVED, ProjectStatus.UNDER_INTERNAL_AUDIT); | |||
return saveProjectNewVersion(projectDto, instanceId, userId, isContruct, ProjectStatus.NOT_APPROVED, ProjectStatus.TO_BE_DECLARED); | |||
} | |||
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||
@@ -883,6 +880,7 @@ public class ProjectLibManage { | |||
project.setSponsor(String.valueOf(userId)); | |||
String projectCode = projectCodeGenUtil.generateProjectCode(projectDto); | |||
project.setProjectCode(projectCode); | |||
projectStateMachineUtil.pass(project); | |||
if (projectService.save(project)) { | |||
saveApplication(projectDto, project, null); | |||
savePaymentPlans(project, projectDto.getPaymentPlanList()); | |||
@@ -1237,7 +1235,6 @@ public class ProjectLibManage { | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.in(Project::getBuildOrgCode, viewUnitIdList) | |||
.or(q2 -> q2.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus, ProjectStatus.PENDING_PREQUALIFICATION.getCode()) | |||
.in(Project::getSuperOrgCode, viewUnitIdList))); | |||
break; | |||
case SUPER_ADMIN: | |||
@@ -32,8 +32,8 @@ import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectAnnualPaymentPlan; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
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.po.ProjectRenewalFundDeclarationPO; | |||
import com.hz.pm.api.projectlib.model.req.ProjectRenewalAuditReq; | |||
import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; | |||
@@ -174,9 +174,7 @@ public class ProjectRenewalFundManage { | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (user.getIsOrgAdmin() && | |||
ProjectStatus.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
if (user.getIsOrgAdmin() && StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
@@ -33,7 +33,8 @@ public enum InstTypeEnum { | |||
APPLY_BORROW(7, "申请借阅审批流程"), | |||
SELF_TEST(10, "系统自测审批流程"), | |||
ADAPTION(11, "适配改造审批流程"), | |||
TEST_VALID(12, "测试验证审批流程"); | |||
TEST_VALID(12, "测试验证审批流程"), | |||
COMPLIANCE_REVIEW(13, "合规性审查"); | |||
private Integer code; | |||
private String desc; | |||
@@ -21,10 +21,10 @@ public enum WarningFlowTypeEnum { | |||
/** | |||
* 预警填报类型枚举 | |||
*/ | |||
UNIT_INNER_AUDIT(1, "预审申报", ProjectStatus.PENDING_PREQUALIFICATION.getCode(),"declareManage/planDeclaration/preExaminationDeclare"), | |||
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,"初验备案", ProjectStatus.UNDER_CONSTRUCTION.getCode(),"declareManage/acceptanceApply/initialInspectionRecord"), | |||
CONSTRUCTION_PLAN_REVIEW(4,"初验备案", null,"declareManage/acceptanceApply/initialInspectionRecord"), | |||
PROJECT_FINAL_INSPECTION(5,"验收申报", ProjectStatus.ON_PILOT_RUNNING.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); | |||
private Integer code; | |||
@@ -21,7 +21,7 @@ public enum WarningOperationTypeEnum { | |||
/** | |||
* 预警实施类型枚举 | |||
*/ | |||
CHUYAN(1, "项目初验", ProjectStatus.UNDER_CONSTRUCTION.getCode(), "declareManage/acceptanceApply/initialInspectionRecord"), | |||
CHUYAN(1, "项目初验", null, "declareManage/acceptanceApply/initialInspectionRecord"), | |||
ZHONGYAN(2, "项目终验", ProjectStatus.ON_PILOT_RUNNING.getCode(), "declareManage/acceptanceApply/finalInspectionDeclare"); | |||
private Integer code; | |||
@@ -20,46 +20,51 @@ import java.util.Optional; | |||
@Getter | |||
@AllArgsConstructor | |||
public enum ProjectStatus implements IStatus<Integer, String> { | |||
/** | |||
* 项目阶段:未立项 | |||
*/ | |||
NOT_APPROVED(10000, "未立项", null), | |||
TO_BE_DECLARED(10015, "待申报", null), | |||
/** | |||
* 合规性审查 | |||
*/ | |||
ON_COMPLIANCE_REVIEW(10030, "合规性审查中", null), | |||
COMPLIANCE_REVIEW_FAILED(10031, "合规性审查不通过", null), | |||
UNDER_INTERNAL_AUDIT(10001, "单位内部审核中", null), | |||
UNDER_INTERNAL_AUDIT_NOT_PASS(10002, "单位内部审核不通过", null), | |||
PENDING_PREQUALIFICATION(10003, "待预审", null), | |||
JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS(10004, "省级部门联审中", null), | |||
JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS(10018, "省级部门联审通过", null), | |||
THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED(10005, "省级部门联审不通过", null), | |||
PRE_APPLYING(10006, "预审中", null), | |||
PREQUALIFICATION_FAILED(10007, "预审不通过", 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), | |||
TO_BE_DECLARED(10015, "待申报", null), | |||
PLAN_TO_BE_DECLARED(10016, "方案待申报", null), | |||
PENDING_PREQUALIFICATION_CHOICE(10017, "待预审选择态", null), | |||
PREQUALIFICATION_WITHDRAW_CHOICE(10019, "预审中撤回选择态", null), | |||
APPROVED_AFTER_CHOICE(10020, "立项批复后选择态", null), | |||
/** | |||
* 信产项目备案 | |||
*/ | |||
DECLARED_APPROVED_TO_BE_RECORD(10022, "待立项备案", null), | |||
DECLARED_APPROVED_RECORD_AUDITING(10023, "立项备案审核中", null), | |||
DECLARED_APPROVED_RECORD_FAILED(10024, "立项备案审核不通过", null), | |||
/** | |||
* 项目阶段:已立项 | |||
*/ | |||
PROJECT_APPROVED(20000, "已立项", null), | |||
TO_BE_PURCHASED(20001, "待采购", GovProjectStatusEnum.APPROVED), | |||
ON_PURCHASING(20007, "采购中", GovProjectStatusEnum.APPROVED), | |||
UNDER_CONSTRUCTION(20002, "建设中", null), | |||
TO_BE_FIRST_INSPECTED(20008, "待上传初验材料", null), | |||
ON_PILOT_RUNNING(20009, "试运行中", null), | |||
ON_FINALLY_INSPECTED(20004, "终验审核中", null), | |||
FINALLY_INSPECTED_FAILED(20005, "终验审核不通过", null), | |||
/** | |||
* 项目阶段:已归档 | |||
*/ | |||
@@ -173,13 +173,6 @@ public class ProcessEndListener { | |||
} | |||
} else { | |||
switch (ProjectStatus.getNoNull(project.getStatus())) { | |||
// 当前项目状态是预审中 | |||
case PRE_APPLYING: | |||
//先修改项目状态 | |||
handlerManage.updatePassProjectStatus(0L, project); | |||
//然后入库暂存库 | |||
projectStagingService.addByProject(project, "暂存入库 待提交部门联审"); | |||
break; | |||
// 当前项目状态是单位内部审核中 | |||
case UNDER_INTERNAL_AUDIT: | |||
// 当前项目状态是部门联审中 | |||
@@ -15,8 +15,10 @@ import com.hz.pm.api.projectdeclared.model.entity.Operation; | |||
import com.hz.pm.api.projectdeclared.service.IOperationService; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||
import com.hz.pm.api.projectlib.model.enumeration.*; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningNoticeTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningOperationTypeEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.manage.EarlyWarningManage; | |||
@@ -145,19 +147,6 @@ public class EarlyWarningInstanceNotStartTask { | |||
//需要发通知的项目 | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if (ProjectStatus.UNDER_CONSTRUCTION.eq(projectStatus)) { | |||
// List<Long> allVersionProjectId = projectService.allVersionProjectIds(p.getProjectCode()); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
// TODO 初验提醒 | |||
/*if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { | |||
if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))) { | |||
return Boolean.FALSE; | |||
} | |||
}*/ | |||
} | |||
List<Integer> noticeTypes = Lists.newArrayList(); | |||
if (Objects.nonNull(time) && Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 | |||
@@ -317,19 +306,6 @@ public class EarlyWarningInstanceNotStartTask { | |||
//需要发通知的项目 | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if (ProjectStatus.UNDER_CONSTRUCTION.eq(projectStatus)) { | |||
// List<Long> allVersionProjectId = projectService.allVersionProjectIds(p.getProjectCode()); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
// 初验提醒 | |||
/*if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { | |||
if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))) { | |||
return Boolean.FALSE; | |||
} | |||
}*/ | |||
} | |||
//判断 实施信息中 初验和终验的时间 | |||
if (!operationMap.containsKey(p.getProjectCode())) { | |||
return Boolean.FALSE; | |||
@@ -190,14 +190,6 @@ public class HandlerManage { | |||
} else { | |||
ProjectStatus projectStatus = ProjectStatus.getNoNull(project.getStatus()); | |||
switch (projectStatus) { | |||
// 当前项目状态是预审中 | |||
case PRE_APPLYING: | |||
//先修改项目状态 | |||
updatePassProjectStatus(userId, project); | |||
//然后入库暂存库 | |||
projectStagingService.addByProject(project, "暂存入库 待提交部门联审"); | |||
break; | |||
// 当前项目状态是部门联审中 | |||
case DEPARTMENT_JOINT_REVIEW: | |||
case UNDER_INTERNAL_AUDIT: | |||
// 立项备案审批 | |||
@@ -433,8 +425,6 @@ public class HandlerManage { | |||
//删除所有项目相关的信息 | |||
deleteProjectRelated(project); | |||
break; | |||
// 当前项目状态是预审中 | |||
case PRE_APPLYING: | |||
// 当前项目状态是部门联审中 | |||
case DEPARTMENT_JOINT_REVIEW: | |||
updateWithdrawProjectStatus(userId, project); | |||
@@ -20,7 +20,7 @@ import com.hz.pm.api.common.model.entity.ExcelExportWriter; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.irs.sign.IRSAPIRequest; | |||
import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; | |||
import com.hz.pm.api.projectdeclared.manage.DeclaredProjectHelper; | |||
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; | |||
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService; | |||
import com.hz.pm.api.projectlib.manage.ProjectLibManage; | |||
@@ -127,7 +127,7 @@ public class TodoCenterManage { | |||
private final IProjectService projectService; | |||
private final ProjectLibManage projectLibManage; | |||
private final ProcessInstanceService processInstanceService; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectHelper declaredProjectHelper; | |||
private final IProjectApplicationService projectApplicationService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final BuildUserUtils buildUserUtils; | |||
@@ -1072,10 +1072,10 @@ public class TodoCenterManage { | |||
//项目名称去重 | |||
if (StringUtils.isNotBlank(projectDto.getProjectName()) && | |||
!projectDto.getProjectName().equals(projectInfo.getProjectName())) { | |||
defaultDeclaredProjectManage.checkDuplication(projectDto); | |||
declaredProjectHelper.checkDuplication(projectDto); | |||
} | |||
projectDto.setProjectCode(projectInfo.getProjectCode()); | |||
defaultDeclaredProjectManage.checkAmount(projectDto); | |||
declaredProjectHelper.checkAmount(projectDto); | |||
//修改项目内容 | |||
if (!modifyProject(projectDto, projectInfo)) { | |||