From c539233b35fd7509740940a3b162ddbc31469f53 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Sun, 25 Feb 2024 11:07:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=B4=E5=BA=A6=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enumeration/ProjectProcessStageEnum.java | 1 + .../common/statemachine/action/TenderAction.java | 142 +++++++++++ .../builder/TenderStateMachineBuilder.java | 36 +++ .../impl/TenderStateMachineBuilderImpl.java | 152 ++++++++++++ .../event/TenderStatusChangeEvent.java | 102 ++++++++ .../factory/ProjectDeclareGuardFactory.java | 4 +- .../statemachine/util/TenderStateMachineUtil.java | 107 +++++++++ .../api/filemanage/manage/ProjectFileManage.java | 7 +- .../pm/api/filemanage/model/vo/ProjectFileVO.java | 2 +- .../controller/ConstructionController.java | 20 +- .../controller/FinalAcceptanceController.java | 6 +- .../projectdeclared/manage/ConstructionManage.java | 262 ++++++++++----------- .../manage/DeclaredProjectManage.java | 25 +- .../manage/FinalAcceptanceManage.java | 52 ++-- .../projectdeclared/mapper/PurchaseInstMapper.java | 17 ++ .../projectdeclared/model/dto/PreInsSaveDTO.java | 18 +- .../model/entity/PreInsAcceptancePerson.java | 17 +- .../api/projectdeclared/model/entity/Purchase.java | 26 ++ .../projectdeclared/model/entity/PurchaseInst.java | 45 ++++ .../model/req/SubmitFinallyInspectedReq.java | 37 +++ .../projectdeclared/model/req/XcfhxApplyReq.java | 35 +++ .../pm/api/projectdeclared/model/vo/PreInsVO.java | 3 +- .../projectdeclared/model/vo/ProjectDraftVO.java | 4 + .../service/IPreInsAcceptancePersonService.java | 21 +- .../service/IPurchaseInstService.java | 15 ++ .../service/impl/PurchaseInstServiceImpl.java | 19 ++ .../projectlib/manage/DeclaredRecordManage.java | 1 + .../pm/api/projectlib/manage/ProjectLibManage.java | 29 +-- .../model/dto/ProjectPaymentPlanDTO.java | 1 - .../hz/pm/api/projectlib/model/entity/Project.java | 10 - .../model/enumeration/TenderStatusEnum.java | 22 +- .../api/projectlib/model/vo/ProjectDetailVO.java | 5 + .../scheduler/task/CockpitStatsStatisticsTask.java | 8 +- .../task/EarlyWarningInstanceNotStartTask.java | 10 +- 34 files changed, 990 insertions(+), 271 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderAction.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TenderStateMachineBuilder.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStatusChangeEvent.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TenderStateMachineUtil.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseInstMapper.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PurchaseInst.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitFinallyInspectedReq.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/XcfhxApplyReq.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseInstServiceImpl.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java index ee1657e..1a6d2ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/enumeration/ProjectProcessStageEnum.java @@ -26,6 +26,7 @@ public enum ProjectProcessStageEnum { DEPARTMENT_JOINT_APPROVAL_PROCESS(3, "部门联合审批流程"), CONSTRUCTION_PROJECT_APPROVAL_PROCESS(4, "建设方案审批流程"), PROJECT_RECORD_APPROVAL_PROCESS(8, "立项备案审批流程"), + XC_APPROVAL_PROCESS(9, "信创审批流程"), ACCEPTANCE_DECLARATION_APPROVAL_PROCESS(5, "验收申报审批流程"), APPLY_DELAY(6, "申请延期审批流程"), APPLY_BORROW(7, "申请借阅审批流程"); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderAction.java new file mode 100644 index 0000000..2c00798 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderAction.java @@ -0,0 +1,142 @@ +package com.hz.pm.api.common.statemachine.action; + +import cn.hutool.core.lang.Assert; +import com.hz.pm.api.common.statemachine.builder.impl.TenderStateMachineBuilderImpl; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + *

+ * 标段状态机action集合类 + *

+ * + * @author WendyYang + * @since 17:08 2024/2/24 + */ +@Slf4j +@WithStateMachine(id = TenderStateMachineBuilderImpl.MACHINE_ID) +public class TenderAction { + + private Purchase getPurchaseInfo(Message message) { + Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE); + Assert.notNull(purchase, "未获取到需要状态变更的标段信息"); + return purchase; + } + + /** + * 填写采购信息 + * + * @param message \ + */ + @OnTransition(source = "TO_BE_SUBMIT_PURCHASE_INFO", target = "TO_BE_SUBMIT_CONSTRUCTION_INFO") + public void SUBMIT_PURCHASE_INFO(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO.getTenderStatus()); + } + + /** + * 填写合同信息 + * + * @param message \ + */ + @OnTransition(source = "TO_BE_SUBMIT_CONSTRUCTION_INFO", target = "TO_BE_SUBMIT_OPERATION_PLAN") + public void SUBMIT_CONSTRUCTION_INFO(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN.getTenderStatus()); + } + + /** + * 填写实施计划 + * + * @param message \ + */ + @OnTransition(source = "TO_BE_SUBMIT_OPERATION_PLAN", target = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO") + public void SUBMIT_OPERATION_PLAN(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getTenderStatus()); + } + + /** + * 上传初验材料 + * + * @param message \ + */ + @OnTransition(source = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO", target = "TO_BE_SUBMIT_XCFHX_APPLY") + public void SUBMIT_FIRST_INSPECTED_FILES(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.getTenderStatus()); + } + + /** + * 信创符合性申请 + * + * @param message \ + */ + @OnTransition(source = "TO_BE_SUBMIT_XCFHX_APPLY", target = "ON_XCFHX_APPLY") + public void SUBMIT_XCFHX_APPLY(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.ON_XCFHX_APPLY.getTenderStatus()); + } + + /** + * 信创符合性申请通过 + * + * @param message \ + */ + @OnTransition(source = "ON_XCFHX_APPLY", target = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY") + public void XCFHX_APPLY_PASSED(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.getTenderStatus()); + } + + /** + * 信创符合性申请失败 + * + * @param message \ + */ + @OnTransition(source = "ON_XCFHX_APPLY", target = "XCFHX_APPLY_FAILED") + public void XCFHX_APPLY_FAILED(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.XCFHX_APPLY_FAILED.getTenderStatus()); + } + + /** + * 终验申报 + * + * @param message \ + */ + @OnTransition(source = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY", target = "ON_FINALLY_INSPECTED_APPLY") + public void SUBMIT_FINALLY_INSPECTED(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY.getTenderStatus()); + } + + /** + * 终验申报通过 + * + * @param message \ + */ + @OnTransition(source = "ON_FINALLY_INSPECTED_APPLY", target = "FINALLY_INSPECTED_PASSED") + public void FINALLY_INSPECTED_PASSED(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.FINALLY_INSPECTED_PASSED.getTenderStatus()); + } + + /** + * 终验申报拒绝 + * + * @param message \ + */ + @OnTransition(source = "ON_FINALLY_INSPECTED_APPLY", target = "FINALLY_INSPECTED_FAILED") + public void FINALLY_INSPECTED_FAILED(Message message) { + Purchase purchase = getPurchaseInfo(message); + purchase.setStatus(TenderStatusEnum.FINALLY_INSPECTED_FAILED.getTenderStatus()); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TenderStateMachineBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TenderStateMachineBuilder.java new file mode 100644 index 0000000..d550b87 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TenderStateMachineBuilder.java @@ -0,0 +1,36 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineException; +import org.springframework.statemachine.persist.StateMachinePersister; + +/** + * 项目申报状态机 + * + * @author CMM + * @since 2023/02/07 15:56 + */ +public interface TenderStateMachineBuilder { + + StateMachine build() throws StateMachineException; + + /** + * 构建状态机 + * + * @param beanFactory \ + */ + StateMachine build(BeanFactory beanFactory) throws StateMachineException; + + /** + * 持久化配置 + * + * @author CMM + * @since 2023/02/07 16:22 + */ + StateMachinePersister stateMachinePersister(); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java new file mode 100644 index 0000000..40c4d2e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java @@ -0,0 +1,152 @@ +package com.hz.pm.api.common.statemachine.builder.impl; + +import com.hz.pm.api.common.statemachine.builder.TenderStateMachineBuilder; +import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachineException; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + *

+ * 标段状态机 + *

+ * + * @author WendyYang + * @since 16:38 2024/2/24 + */ +@Slf4j +@Component +@EnableStateMachine(name = TenderStateMachineBuilderImpl.MACHINE_ID) +@RequiredArgsConstructor +public class TenderStateMachineBuilderImpl implements TenderStateMachineBuilder { + + public static final String MACHINE_ID = "tenderStateMachine"; + + private final BeanFactory beanFactory; + + @Override + public StateMachine build() throws StateMachineException { + StateMachine stateMachine = build(beanFactory); + log.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + + @Override + public StateMachine build(BeanFactory beanFactory) throws StateMachineException { + try { + return buildStateMachine(beanFactory); + } catch (Exception e) { + throw new StateMachineException("状态机构件失败", e); + } + } + + private StateMachine buildStateMachine(BeanFactory factory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINE_ID) + .beanFactory(factory); + + builder.configureStates() + .withStates() + .initial(TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO) + .states(EnumSet.allOf(TenderStatusEnum.class)); + + builder.configureTransitions() + // 填写采购信息 + .withExternal() + .source(TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO) + .target(TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO) + .event(TenderStatusChangeEvent.SUBMIT_PURCHASE_INFO) + .and() + // 填写合同信息 + .withExternal() + .source(TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO) + .target(TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN) + .event(TenderStatusChangeEvent.SUBMIT_CONSTRUCTION_INFO) + .and() + // 填写实施计划 + .withExternal() + .source(TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN) + .target(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) + .event(TenderStatusChangeEvent.SUBMIT_OPERATION_PLAN) + .and() + // 上传初验材料 + .withExternal() + .source(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) + .target(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY) + .event(TenderStatusChangeEvent.SUBMIT_FIRST_INSPECTED_FILES) + .and() + // 信创符合性申请 + .withExternal() + .source(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY) + .target(TenderStatusEnum.ON_XCFHX_APPLY) + .event(TenderStatusChangeEvent.SUBMIT_XCFHX_APPLY) + .and() + // 信创符合性申请通过 + .withExternal() + .source(TenderStatusEnum.ON_XCFHX_APPLY) + .target(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY) + .event(TenderStatusChangeEvent.XCFHX_APPLY_PASSED) + .and() + // 信创符合性申请失败 + .withExternal() + .source(TenderStatusEnum.ON_XCFHX_APPLY) + .target(TenderStatusEnum.XCFHX_APPLY_FAILED) + .event(TenderStatusChangeEvent.XCFHX_APPLY_FAILED) + .and() + // 终验申报 + .withExternal() + .source(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY) + .target(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) + .event(TenderStatusChangeEvent.SUBMIT_FINALLY_INSPECTED) + .and() + // 终验申报通过 + .withExternal() + .source(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) + .target(TenderStatusEnum.FINALLY_INSPECTED_PASSED) + .event(TenderStatusChangeEvent.FINALLY_INSPECTED_PASSED) + .and() + // 终验申报拒绝 + .withExternal() + .source(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) + .target(TenderStatusEnum.FINALLY_INSPECTED_FAILED) + .event(TenderStatusChangeEvent.FINALLY_INSPECTED_FAILED) + .and(); + return builder.build(); + } + + @Override + @Bean(name = "tenderStatePersister") + public StateMachinePersister stateMachinePersister() { + return new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Purchase contextObj) { + log.info("当前项目为:{}", contextObj); + } + + @Override + public StateMachineContext read(Purchase contextObj) { + return new DefaultStateMachineContext<>(TenderStatusEnum.getByStatus(contextObj.getStatus()), + null, null, null, null, MACHINE_ID); + } + }); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStatusChangeEvent.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStatusChangeEvent.java new file mode 100644 index 0000000..3aa3369 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStatusChangeEvent.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.common.statemachine.event; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Objects; + +/** + *

+ * TenderStatusChangeEvent + *

+ * + * @author WendyYang + * @since 00:14 2024/2/24 + */ +@Getter +@AllArgsConstructor +public enum TenderStatusChangeEvent { + + /** + * 填写采购信息 + */ + SUBMIT_PURCHASE_INFO(101, null, null), + /** + * 填写合同信息 + */ + SUBMIT_CONSTRUCTION_INFO(102, null, null), + /** + * 填写实施计划 + */ + SUBMIT_OPERATION_PLAN(103, null, null), + /** + * 上传初验材料 + */ + SUBMIT_FIRST_INSPECTED_FILES(201, null, null), + /** + * 信创符合性申请 + */ + SUBMIT_XCFHX_APPLY(301, null, null), + /** + * 信创符合性申请通过 + */ + XCFHX_APPLY_PASSED(302, null, null), + /** + * 信创符合性申请不通过 + */ + XCFHX_APPLY_FAILED(null, 303, null), + /** + * 终验申报 + */ + SUBMIT_FINALLY_INSPECTED(401, null, null), + /** + * 终验申报通过 + */ + FINALLY_INSPECTED_PASSED(501, null, null), + /** + * 终验申报拒绝 + */ + FINALLY_INSPECTED_FAILED(null, 502, null); + + + private final Integer passStatusCode; + private final Integer rejectStatusCode; + private final Integer withdrawStatusCode; + + public static TenderStatusChangeEvent getPassValueByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (TenderStatusChangeEvent t : TenderStatusChangeEvent.values()) { + if (code.equals(t.getPassStatusCode())) { + return t; + } + } + return null; + } + + public static TenderStatusChangeEvent getRejectValueByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (TenderStatusChangeEvent t : TenderStatusChangeEvent.values()) { + if (code.equals(t.getRejectStatusCode())) { + return t; + } + } + return null; + } + + public static TenderStatusChangeEvent getWithdrawValueByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (TenderStatusChangeEvent t : TenderStatusChangeEvent.values()) { + if (code.equals(t.getWithdrawStatusCode())) { + return t; + } + } + return null; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java index ee03737..b6fcb2e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -11,9 +11,11 @@ import org.springframework.statemachine.guard.Guard; * @author CMM * @since 2023/02/07 16:18 */ - public class ProjectDeclareGuardFactory { + private ProjectDeclareGuardFactory() { + } + public static class PendingPreQualificationChoiceGuard implements Guard { @Override public boolean evaluate(StateContext context) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TenderStateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TenderStateMachineUtil.java new file mode 100644 index 0000000..a65ae20 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TenderStateMachineUtil.java @@ -0,0 +1,107 @@ +package com.hz.pm.api.common.statemachine.util; + +import com.hz.pm.api.common.statemachine.builder.TenderStateMachineBuilder; +import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; +import com.ningdatech.basic.exception.BizException; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +/** + *

+ * 标段状态机工具类 + *

+ * + * @author WendyYang + * @since 17:06 2024/2/24 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class TenderStateMachineUtil { + + public static final String PURCHASE = "purchaseInfo"; + + //================================================================================================================== + + private final TenderStateMachineBuilder tenderStateMachineBuilder; + + //通过审核 + public void pass(Purchase purchase) { + try { + execute(purchase, getPassEvent(purchase.getStatus())); + } catch (Exception e) { + log.info("状态机 通过失败 :{}", e.getMessage()); + throw new BusinessException("状态机 通过失败: " + e); + } + } + + //拒绝 + public void reject(Purchase purchase) { + try { + execute(purchase, getRejectEvent(purchase.getStatus())); + } catch (Exception e) { + log.info("状态机 拒绝失败 :{}", e.getMessage()); + throw new BusinessException("状态机 拒绝失败: " + e); + } + } + + //撤回 + public void withDraw(Purchase purchase) { + try { + execute(purchase, getWithdrawEvent(purchase.getStatus())); + } catch (Exception e) { + log.info("状态机 撤回失败 :{}", e.getMessage()); + throw new BusinessException("状态机 撤回失败: " + e); + } + } + + public void execute(Purchase purchase, TenderStatusChangeEvent event) throws Exception { + log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); + // 获取TO状态机 + StateMachine stateMachine = tenderStateMachineBuilder.build(); + Message message = MessageBuilder.withPayload(event) + .setHeader(PURCHASE, purchase) + .build(); + //初始化状态机 + StateMachinePersister stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister(); + stateMachinePersister.restore(stateMachine, purchase); + stateMachine.sendEvent(message); + log.info("调用状态机后的标段状态为:{}", purchase.getStatus()); + } + + + public TenderStatusChangeEvent getPassEvent(Integer status) { + TenderStatusChangeEvent event = TenderStatusChangeEvent.getPassValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的通过操作!"); + } + return event; + } + + public TenderStatusChangeEvent getRejectEvent(Integer status) { + TenderStatusChangeEvent event = TenderStatusChangeEvent.getRejectValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的驳回操作!"); + } + return event; + } + + public TenderStatusChangeEvent getWithdrawEvent(Integer status) { + TenderStatusChangeEvent event = TenderStatusChangeEvent.getWithdrawValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的撤回操作!"); + } + return event; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index 4b150a5..c6b64c6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -231,7 +231,7 @@ public class ProjectFileManage { ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode); List purchaseVos = purchaseManage.detailByProjectId(projectId); List contractVos = constructionManage.detailContractByProjectId(projectId); - PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId); + List preInsVo = constructionManage.detailPreInsByProjectId(projectId); FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId); projectFileVo.setProjectDetailVo(projectDetailVo); @@ -450,10 +450,11 @@ public class ProjectFileManage { List contractFileIdList = getFileIdList(attachment); fileIdList.addAll(contractFileIdList); } + // TODO // 初验备案阶段 // 获取初验材料 - String preliminaryInspectionMaterials = project.getPreliminaryInspectionMaterials(); - getInspectionMaterials(fileIdList, preliminaryInspectionMaterials); + // String preliminaryInspectionMaterials = project.getPreliminaryInspectionMaterials(); + // getInspectionMaterials(fileIdList, preliminaryInspectionMaterials); // 终验申报阶段 // 获取终验材料 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java index 77b1c5a..526d3ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java @@ -39,7 +39,7 @@ public class ProjectFileVO { private List contractVos; @ApiModelProperty("初验登记详情") - private PreInsVO preInsVo; + private List preInsVo; @ApiModelProperty("终验信息详情") private FinalAcceptanceVO finalAcceptanceVo; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java index 9a2fa6c..e6c097d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java @@ -5,6 +5,7 @@ import com.hz.pm.api.projectdeclared.manage.ConstructionManage; import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSupplementDTO; import com.hz.pm.api.projectdeclared.model.dto.PreInsSaveDTO; import com.hz.pm.api.projectdeclared.model.req.SubmitConstructionReq; +import com.hz.pm.api.projectdeclared.model.req.XcfhxApplyReq; import com.hz.pm.api.projectdeclared.model.vo.ContractVO; import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; import com.hz.pm.api.projectdeclared.model.vo.ProjectContractListVO; @@ -13,6 +14,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -91,14 +93,22 @@ public class ConstructionController { @ApiOperation(value = "初验备案的详情-通过项目ID", notes = "初验备案的详情-通过项目ID") @GetMapping("/pre-ins/detail/{projectId}") - public PreInsVO detailPreInsByProjectId(@PathVariable Long projectId) { + public List detailPreInsByProjectId(@PathVariable Long projectId) { return constructionManage.detailPreInsByProjectId(projectId); } - @ApiOperation(value = "填写初验信息", notes = "填写初验信息") - @WebLog("填写初验信息") + @ApiOperation(value = "上传初验材料") + @WebLog("上传初验材料") @PostMapping("/submit-pre-ins") - public String submitPreIns(@Validated @RequestBody PreInsSaveDTO dto) { - return constructionManage.submitPreIns(dto); + public void submitPreIns(@Validated @RequestBody PreInsSaveDTO dto) { + constructionManage.submitFirstInspectedFiles(dto); } + + @ApiOperation("信创符合性申请") + @WebLog("信创符合性申请") + @PostMapping("/submitXcfhxApply") + public void submitXcfhxApply(@RequestBody XcfhxApplyReq req){ + constructionManage.submitXcfhxApply(req); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java index 29a3e3e..d4b006c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java @@ -1,5 +1,7 @@ package com.hz.pm.api.projectdeclared.controller; +import com.hz.pm.api.projectdeclared.model.req.SubmitConstructionReq; +import com.hz.pm.api.projectdeclared.model.req.SubmitFinallyInspectedReq; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.common.util.ExcelDownUtil; @@ -55,8 +57,8 @@ public class FinalAcceptanceController { @ApiOperation(value = "终验申报", notes = "终验申报") @WebLog("终验申报") @PostMapping("/start-process") - public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { - String instanceId = finalAcceptanceManage.startProcess(dto); + public String startTheProcess(@Validated @RequestBody SubmitFinallyInspectedReq req) { + String instanceId = finalAcceptanceManage.startProcess(req); return "终验申报 【" + instanceId + "】 成功"; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index ddfd563..d74cb4f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -7,33 +7,36 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.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.model.constant.BizConst; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; +import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; import com.hz.pm.api.common.util.DecimalUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; -import com.hz.pm.api.projectdeclared.model.dto.ContractSaveDTO; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSupplementDTO; import com.hz.pm.api.projectdeclared.model.dto.PreInsSaveDTO; -import com.hz.pm.api.projectdeclared.model.entity.Contract; -import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; -import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; -import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.model.entity.*; import com.hz.pm.api.projectdeclared.model.req.SubmitConstructionReq; -import com.hz.pm.api.projectdeclared.model.vo.*; -import com.hz.pm.api.projectdeclared.service.IContractService; -import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; -import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; -import com.hz.pm.api.projectdeclared.service.IPurchaseService; +import com.hz.pm.api.projectdeclared.model.req.XcfhxApplyReq; +import com.hz.pm.api.projectdeclared.model.vo.ContractVO; +import com.hz.pm.api.projectdeclared.model.vo.PreInsAcceptancePersonVO; +import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; +import com.hz.pm.api.projectdeclared.model.vo.ProjectContractListVO; +import com.hz.pm.api.projectdeclared.service.*; 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.ProjectInst; import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; 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.IProjectPaymentPlanService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserFullInfoDTO; @@ -44,16 +47,19 @@ 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.workflow.bean.dto.OrgInfoDTO; +import com.wflow.workflow.bean.vo.ProcessStartParamsVo; +import com.wflow.workflow.service.ProcessInstanceService; +import com.wflow.workflow.service.ProcessModelService; 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.math.BigDecimal; -import java.math.RoundingMode; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; @@ -75,15 +81,17 @@ public class ConstructionManage { private final UserInfoHelper userInfoHelper; private final IPurchaseService purchaseService; - + private final IPurchaseInstService purchaseInstService; private final IContractService contractService; - + private final ProcessModelService processModelService; + private final IProjectInstService projectInstService; private final IPaymentPlanService paymentPlanService; - + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final IPreInsAcceptancePersonService acceptancePersonService; - + private final ProcessInstanceService processInstanceService; private final StateMachineUtil stateMachineUtil; private final IProjectPaymentPlanService projectPaymentPlanService; + private final TenderStateMachineUtil tenderStateMachineUtil; /** * 待采购的-项目列表 @@ -263,79 +271,6 @@ public class ConstructionManage { return BeanUtil.copyToList(contracts, ContractVO.class); } - /** - * 填写合同信息 - * - * @param dto \ - * @return \ - * @deprecated 弃用 - */ - @Deprecated - @Transactional(rollbackFor = Exception.class) - public String submitContract(ContractSaveDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - Long projectId = dto.getProjectId(); - VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); - Project project = projectService.getNewProject(dto.getProjectId()); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 采购结果备案 - VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); - - Contract contractEntity = new Contract(); - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .eq(Contract::getProjectId, projectId) - .last(BizConst.LIMIT_1)); - - BeanUtil.copyProperties(dto, contractEntity); - if (Objects.isNull(contract)) { - contractEntity.setCreateOn(LocalDateTime.now()); - contractEntity.setCreateBy(user.getUserIdStr()); - } else { - contractEntity.setId(contract.getId()); - } - contractEntity.setProjectId(projectId); - contractEntity.setProjectCode(project.getProjectCode()); - if (contractService.saveOrUpdate(contractEntity) && (Objects.nonNull(dto.getPayments()))) { - //先删除 - paymentPlanService.remove(Wrappers.lambdaQuery(PaymentPlan.class) - .eq(PaymentPlan::getProjectId, projectId)); - if (CollUtil.isNotEmpty(dto.getPayments())) { - List payments = dto.getPayments().stream().map(d -> { - PaymentPlan plan = BeanUtil.copyProperties(d, PaymentPlan.class); - plan.setProjectId(projectId); - plan.setProjectCode(project.getProjectCode()); - plan.setCreateOn(LocalDateTime.now()); - plan.setUpdateOn(LocalDateTime.now()); - plan.setCreateBy(user.getUserIdStr()); - plan.setUpdateBy(user.getUserIdStr()); - return plan; - }).collect(Collectors.toList()); - - paymentPlanService.saveBatch(payments); - } - - } - - //判断下 如果和初验都完成了 才进入下一阶段 - if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { - //进入到下一状态 - stateMachineUtil.pass(project); - } - project.setUpdateOn(LocalDateTime.now()); - if (Objects.nonNull(dto.getDeliveryTime())) { - project.setDeliveryTime(dto.getDeliveryTime()); - } - if (Objects.nonNull(dto.getTotalAmount())) { - project.setContractAmount(dto.getTotalAmount()); - } - projectService.updateById(project); - - return "填写成功"; - } - @Transactional(rollbackFor = Exception.class) public String submitPurchaseContract(SubmitConstructionReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); @@ -512,19 +447,25 @@ public class ConstructionManage { * @param projectId * @return */ - public PreInsVO detailPreInsByProjectId(Long projectId) { - Project project = projectService.getById(projectId); - PreInsVO vo = new PreInsVO(); - vo.setProjectId(projectId); - vo.setPreliminaryInspectionMaterials(project.getPreliminaryInspectionMaterials()); - vo.setIsCompletedLogCollection(project.getIsCompletedLogCollection()); - vo.setActualPerformanceIndicators(project.getActualPerformanceIndicators()); - LambdaQueryWrapper query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .eq(PreInsAcceptancePerson::getProjectId, projectId) - .orderByAsc(PreInsAcceptancePerson::getCreateOn); - List acceptancePersons = acceptancePersonService.list(query); - vo.setAcceptancePersons(convertPersons(acceptancePersons)); - return vo; + public List detailPreInsByProjectId(Long projectId) { + List purchases = purchaseService.listByProjectId(projectId); + List bidIds = CollUtils.fieldList(purchases, Purchase::getId); + Map> personMap = acceptancePersonService.listByBidIds(bidIds); + return purchases.stream() + .filter(w -> StrUtils.isNotBlank(w.getActualPerformanceIndicators())) + .map(w -> { + PreInsVO vo = new PreInsVO(); + vo.setBidId(w.getId()); + vo.setProjectId(w.getProjectId()); + vo.setPreliminaryInspectionMaterials(w.getPreliminaryInspectionMaterials()); + vo.setIsCompletedLogCollection(w.getIsCompletedLogCollection()); + vo.setActualPerformanceIndicators(w.getActualPerformanceIndicators()); + List persons = personMap.get(w.getId()); + if (persons != null) { + vo.setAcceptancePersons(convertPersons(persons)); + } + return vo; + }).collect(Collectors.toList()); } private List convertPersons(List acceptancePersons) { @@ -536,56 +477,97 @@ public class ConstructionManage { .collect(Collectors.toList()); } - /** - * 填写初验信息 - * - * @param dto - * @return - */ - public String submitPreIns(PreInsSaveDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - Long projectId = dto.getProjectId(); - VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); - Project project = projectService.getNewProject(dto.getProjectId()); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - - //首先要判断 项目当前状态 是不是 采购结果备案 - VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); - + @Transactional(rollbackFor = Exception.class) + public void submitFirstInspectedFiles(PreInsSaveDTO req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Purchase purchase = purchaseService.getById(req.getBidId()); + if (!TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(purchase.getStatus())) { + throw BizException.wrap("该标段无法上传初验材料"); + } + LocalDateTime now = LocalDateTime.now(); //初验人员 - if (Objects.nonNull(dto.getAcceptancePersons())) { + if (Objects.nonNull(req.getAcceptancePersons())) { //先删除 - acceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .eq(PreInsAcceptancePerson::getProjectId, projectId)); - if (CollUtil.isNotEmpty(dto.getAcceptancePersons())) { - List persons = dto.getAcceptancePersons().stream().map(d -> { - PreInsAcceptancePerson person = BeanUtil.copyProperties(d, PreInsAcceptancePerson.class); - person.setProjectId(projectId); - person.setCreateOn(LocalDateTime.now()); - person.setUpdateOn(LocalDateTime.now()); + acceptancePersonService.removeByBidId(req.getBidId()); + if (CollUtil.isNotEmpty(req.getAcceptancePersons())) { + List persons = req.getAcceptancePersons().stream().map(d -> { + PreInsAcceptancePerson person = new PreInsAcceptancePerson(); + BeanUtil.copyProperties(d, person); + person.setBidId(req.getBidId()); + person.setProjectId(req.getProjectId()); + person.setCreateOn(now); + person.setUpdateOn(now); person.setCreateBy(user.getUserIdStr()); person.setUpdateBy(user.getMhUnitIdStr()); return person; }).collect(Collectors.toList()); - acceptancePersonService.saveBatch(persons); } } - - //判断下 如果和初验都完成了 才进入下一阶段 - if (Objects.nonNull(project.getDeliveryTime())) { - //进入到下一状态 + tenderStateMachineUtil.pass(purchase); + purchase.setUpdateOn(now); + purchase.setPreliminaryInspectionMaterials(req.getPreliminaryInspectionMaterials()); + purchase.setIsCompletedLogCollection(req.getIsCompletedLogCollection()); + purchase.setActualPerformanceIndicators(req.getActualPerformanceIndicators()); + purchaseService.updateById(purchase); + // 判断是否所有标段都上传了初验材料 + List purchases = purchaseService.listByProjectId(req.getProjectId()); + boolean finishedPreInst = purchases.stream().noneMatch(w -> TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(w.getStatus())); + if (finishedPreInst) { + Project project = projectService.getById(req.getProjectId()); stateMachineUtil.pass(project); + projectService.updateById(project); } - project.setUpdateOn(LocalDateTime.now()); - project.setPreliminaryInspectionMaterials(dto.getPreliminaryInspectionMaterials()); - project.setIsCompletedLogCollection(dto.getIsCompletedLogCollection()); - project.setActualPerformanceIndicators(dto.getActualPerformanceIndicators()); - projectService.updateById(project); - return "填写成功"; + } + + @Transactional(rollbackFor = Exception.class) + public void submitXcfhxApply(XcfhxApplyReq req) { + Purchase purchase = purchaseService.getById(req.getBidId()); + if (!TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.eq(purchase.getStatus())) { + throw BizException.wrap("该标段不支持提交信创符合性申请"); + } + + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.XC_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + throw BizException.wrap("找不到信创审批流程配置"); + } + ProcessStartParamsVo processParam = new ProcessStartParamsVo(); + processParam.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); + processParam.setProcessUsers(Collections.emptyMap()); + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Project project = projectService.getById(req.getProjectId()); + Map orgMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processInstanceService.startProcessLs(model, processParam, orgMap); + + ProjectInst projectInst = new ProjectInst(); + projectInst.setInstCode(instanceId); + projectInst.setInstType(ProjectProcessStageEnum.XC_APPROVAL_PROCESS.getCode()); + projectInst.setProjectId(req.getProjectId()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setCreatOn(projectInst.getUpdateOn()); + projectInstService.save(projectInst); + log.info("信创审查提交成功 【{}】", instanceId); + + purchase.setXcfhxApplyFiles(req.getXcfhxApplyFiles()); + purchase.setMatchXcfhx(req.getMatchXcfhx()); + purchase.setXcfhxApplyRemark(req.getXcfhxApplyRemark()); + purchase.setXcfhxReportFiles(req.getXcfhxReportFiles()); + tenderStateMachineUtil.pass(purchase); + purchaseService.updateById(purchase); + + PurchaseInst purchaseInst = new PurchaseInst(); + purchaseInst.setBidId(purchase.getId()); + purchaseInst.setInstCode(instanceId); + purchaseInst.setInstType(ProjectProcessStageEnum.XC_APPROVAL_PROCESS.getCode()); + purchaseInst.setProjectId(req.getProjectId()); + purchaseInst.setUpdateOn(LocalDateTime.now()); + purchaseInst.setCreatOn(projectInst.getUpdateOn()); + purchaseInstService.save(purchaseInst); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 96cf9ef..45d8c6f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -14,18 +14,11 @@ import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; -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.ningdatech.basic.util.StrPool; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.gov.manage.GovProjectCollectionManage; @@ -35,13 +28,14 @@ import com.hz.pm.api.projectdeclared.model.dto.*; import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO; import com.hz.pm.api.projectdeclared.service.IProjectDraftService; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; 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.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.ProjectStatusEnum; +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.IProjectService; @@ -51,6 +45,12 @@ 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.ningdatech.basic.util.StrPool; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.dto.OrgInfoDTO; @@ -313,12 +313,13 @@ public class DeclaredProjectManage { * @return \ */ public Long saveToDraft(ProjectDraftSaveDTO dto, Integer draftType) { - Long userId = LoginUserUtil.getUserId(); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long userId = user.getUserId(); ProjectDTO projectInfo = dto.getProjectInfo(); ProjectDraft draft = new ProjectDraft(); BeanUtils.copyProperties(projectInfo, draft); + draft.setId(projectInfo.getDraftId()); //写死 是否有主管单位 draft.setIsHigherSuperOrg(CommonEnum.YES.getCode()); draft.setIsSuperOrg(CommonEnum.YES.getCode()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java index 25ddd12..0a2058f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -13,7 +13,11 @@ import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.model.req.SubmitFinallyInspectedReq; import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; +import com.hz.pm.api.projectdeclared.service.IPurchaseInstService; +import com.hz.pm.api.projectdeclared.service.IPurchaseService; 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; @@ -21,11 +25,13 @@ import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.manage.NoticeManage; 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; @@ -69,15 +75,12 @@ public class FinalAcceptanceManage { private final IProjectService projectService; private final UserInfoHelper userInfoHelper; - + private final IPurchaseService purchaseService; + private final IPurchaseInstService purchaseInstService; private final ProcessModelService processModelService; - private final ProcessInstanceService processInstanceService; - private final DefaultDeclaredProjectManage declaredProjectManage; - private final NoticeManage noticeManage; - private final ProjectLibManage projectLibManage; /** @@ -193,53 +196,34 @@ public class FinalAcceptanceManage { /** * 开启流程 * - * @param dto + * @param req * @return */ - public String startProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - 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(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); + public String startProcess(SubmitFinallyInspectedReq req) { - String regionCode = projectInfo.getAreaCode(); + Purchase purchase = purchaseService.getById(req.getBidId()); + if (!TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.eq(purchase.getStatus())) { + throw BizException.wrap("该标段不支持终验申报"); + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); + throw new BusinessException("找不到验收申报流程配置"); } - - //首先要判断 项目当前状态 是不是 方案待申报 - VUtils.isTrue((!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(projectInfo.getStatus()) && - !ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode().equals(projectInfo.getStatus())) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) - .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); + Project project = projectService.getNewProject(req.getProjectId()); ProcessStartParamsVo params = new ProcessStartParamsVo(); params.setUser(declaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 - declaredProjectManage.buildCondition(params, projectInfo); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), projectInfo); + Map orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); log.info("终验方案项目申报成功 【{}】", instanceId); - - //保存终验项目 - //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo, instanceId, projectDto, - InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(), Boolean.FALSE); - //发送给第一个审批人消息 - noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, PASS_MSG_TEMPLATE, PROJECT_REVIEW); - return instanceId; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseInstMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseInstMapper.java new file mode 100644 index 0000000..291377f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/PurchaseInstMapper.java @@ -0,0 +1,17 @@ +package com.hz.pm.api.projectdeclared.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Poffy + * @since 2023-02-13 + */ +public interface PurchaseInstMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java index 0e0dd37..4b85793 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java @@ -1,6 +1,5 @@ package com.hz.pm.api.projectdeclared.model.dto; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -9,21 +8,23 @@ import javax.validation.constraints.NotNull; import java.util.List; /** - * @Classname PreInsSaveDTO - * @Description - * @Date 2023/5/30 15:35 - * @Author PoffyZhang + *

+ * 标段初验材料参数类 + *

+ * + * @author WendyYang + * @since 20:42 2024/2/24 */ @Data -@ApiModel(value = "PreInsSaveDTO", description = "") public class PreInsSaveDTO { - private static final long serialVersionUID = 1L; - @ApiModelProperty("项目ID") @NotNull(message = "项目ID不能为空") private Long projectId; + @ApiModelProperty("标段ID") + private Long bidId; + @ApiModelProperty("初验材料") @NotBlank(message = "请提交初验材料") private String preliminaryInspectionMaterials; @@ -36,4 +37,5 @@ public class PreInsSaveDTO { @ApiModelProperty("实际成效指标") private String actualPerformanceIndicators; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java index 68394a9..2045aff 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java @@ -10,18 +10,18 @@ import lombok.Data; import java.time.LocalDateTime; /** - * @Classname PreInsAcceptancePerson - * @Description 初验人员 - * @Date 2023/5/30 15:35 - * @Author PoffyZhang + *

+ * 初验人员 + *

+ * + * @author WendyYang + * @since 20:57 2024/2/24 */ @Data @TableName("nd_pre_ins_acceptance_person") -@ApiModel(value = "PreInsAcceptancePerson", description = "") +@ApiModel(value = "PreInsAcceptancePerson") public class PreInsAcceptancePerson { - private static final long serialVersionUID = 1L; - @ApiModelProperty("主键") @TableId(type = IdType.AUTO) private Long id; @@ -41,6 +41,9 @@ public class PreInsAcceptancePerson { @ApiModelProperty("项目ID") private Long projectId; + @ApiModelProperty("标段ID") + private Long bidId; + @ApiModelProperty("人员名称") private String personName; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java index 03d6f3b..b4ef654 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java @@ -3,6 +3,7 @@ package com.hz.pm.api.projectdeclared.model.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.hz.pm.api.common.compare.Compare; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -98,4 +99,29 @@ public class Purchase { @ApiModelProperty("投标截止时间") private LocalDateTime bidEndTime; + private Integer status; + + @ApiModelProperty("初验材料") + private String preliminaryInspectionMaterials; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; + + @ApiModelProperty("是否符合信创符合性要求") + private Boolean matchXcfhx; + + @ApiModelProperty("信创符合性申请备注") + private String xcfhxApplyRemark; + + @ApiModelProperty("信创符合性申请其他附件") + private String xcfhxApplyFiles; + + @ApiModelProperty("信创报告") + private String xcfhxReportFiles; + + + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PurchaseInst.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PurchaseInst.java new file mode 100644 index 0000000..28f86ad --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PurchaseInst.java @@ -0,0 +1,45 @@ +package com.hz.pm.api.projectdeclared.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * PurchaseInst + *

+ * + * @author WendyYang + * @since 23:06 2024/2/24 + */ +@Data +@TableName("nd_purchase_inst") +public class PurchaseInst { + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("实例ID") + private String instCode; + + @ApiModelProperty("实例类型 1单位内部审批流程 2项目预审审批流程 3部门联合审批流程 4建设方案审批流程 5验收申报审批流程") + private Integer instType; + + @ApiModelProperty("创建时间") + private LocalDateTime creatOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitFinallyInspectedReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitFinallyInspectedReq.java new file mode 100644 index 0000000..84d662d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitFinallyInspectedReq.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * 标段终验材料参数类 + *

+ * + * @author WendyYang + * @since 20:42 2024/2/24 + */ +@Data +public class SubmitFinallyInspectedReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("终验材料") + @NotBlank(message = "请提交初验材料") + private String inspectionMaterials; + + @ApiModelProperty("是否完成日志数据归集") + private Boolean isCompletedLogCollection; + + @ApiModelProperty("实际成效指标") + private String actualPerformanceIndicators; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/XcfhxApplyReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/XcfhxApplyReq.java new file mode 100644 index 0000000..7b5b25e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/XcfhxApplyReq.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 信创符合性申请参数类 + *

+ * + * @author WendyYang + * @since 21:13 2024/2/24 + */ +@Data +public class XcfhxApplyReq { + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("是否符合信创符合性要求") + private Boolean matchXcfhx; + + @ApiModelProperty("备注") + private String xcfhxApplyRemark; + + @ApiModelProperty("其他附件") + private String xcfhxApplyFiles; + + @ApiModelProperty("信创报告") + private String xcfhxReportFiles; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java index 316dd59..b23e904 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java @@ -16,7 +16,8 @@ import java.util.List; @ApiModel(value = "PreInsVO", description = "初验备案详情") public class PreInsVO { - private static final long serialVersionUID = 1L; + @ApiModelProperty("标段ID") + private Long bidId; @ApiModelProperty("项目ID") private Long projectId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java index b2d80ed..e7a9011 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/ProjectDraftVO.java @@ -378,4 +378,8 @@ public class ProjectDraftVO implements Serializable { @ApiModelProperty("草稿箱类型:1 项目申报、2 立项备案") private Integer draftType; + + @ApiModelProperty("可研批复文件") + private String baseResearchReportApprovalFile; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java index 07b8b7f..455f574 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPreInsAcceptancePersonService.java @@ -1,11 +1,18 @@ package com.hz.pm.api.projectdeclared.service; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.IService; import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; +import com.ningdatech.basic.util.CollUtils; + +import java.util.Collection; +import java.util.List; +import java.util.Map; /** *

- * 服务类 + * 服务类 *

* * @author zpf @@ -13,4 +20,16 @@ import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson; */ public interface IPreInsAcceptancePersonService extends IService { + default void removeByBidId(Long bidId) { + Wrapper query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + .eq(PreInsAcceptancePerson::getBidId, bidId); + remove(query); + } + + default Map> listByBidIds(Collection bidIds) { + Wrapper query = Wrappers.lambdaQuery(PreInsAcceptancePerson.class) + .in(PreInsAcceptancePerson::getBidId, bidIds); + return CollUtils.group(list(query), PreInsAcceptancePerson::getBidId); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java new file mode 100644 index 0000000..69e0cd2 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; + +/** + *

+ * IPurchaseInstService + *

+ * + * @author WendyYang + * @since 00:12 2024/2/25 + */ +public interface IPurchaseInstService extends IService { +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseInstServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseInstServiceImpl.java new file mode 100644 index 0000000..d17c3ce --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/PurchaseInstServiceImpl.java @@ -0,0 +1,19 @@ +package com.hz.pm.api.projectdeclared.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hz.pm.api.projectdeclared.mapper.PurchaseInstMapper; +import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; +import com.hz.pm.api.projectdeclared.service.IPurchaseInstService; +import org.springframework.stereotype.Service; + +/** + *

+ * IPurchaseInstServiceImpl + *

+ * + * @author WendyYang + * @since 00:13 2024/2/25 + */ +@Service +public class PurchaseInstServiceImpl extends ServiceImpl implements IPurchaseInstService { +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java index e15037d..ed25794 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java @@ -120,6 +120,7 @@ public class DeclaredRecordManage { item.setStatus(project.getStatus()); item.setStage(project.getStage()); } + item.setDeclaredUnit(w.getUnitName()); item.setProjectCode(w.getProjectCode()); item.setProjectName(w.getProjectName()); item.setDeclaredAmount(w.getTotalMoney()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 31871be..25df54e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -695,6 +695,9 @@ public class ProjectLibManage { List contracts = constructionManage.detailContractByProjectId(projectInfo.getId()); vo.setContract(contracts); + List paymentPlans = projectPaymentPlanService.listByProjectId(projectInfo.getId()); + vo.setAnnualPaymentPlans(BeanUtil.copyToList(paymentPlans, ProjectPaymentPlanDTO.class)); + //查询实施信息 Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) .in(Operation::getProjectId, allVersionProjectId) @@ -730,32 +733,6 @@ public class ProjectLibManage { //查询终验信息 vo.setFinalIrsApps(applicationHandler.generateIrsApp(projectInfo.getProjectCode())); - //查询年度投资金额 要是已验收的项目 - if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { - List paymentPlans = projectPaymentPlanService.listByProjectId(projectInfo.getId()); - BigDecimal totalAnnualAmount = paymentPlans.stream() - .map(ProjectPaymentPlan::getAnnualPlanAmount) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); - List annualAmounts = Lists.newArrayList(); - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(projectInfo.getProjectYear()) - .annualAmount(totalAnnualAmount) - .build()); - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .build())) - ); - vo.setAnnualAccumulateAmountList(annualAmounts); - } // 处理文件名 List fileIdList = new ArrayList<>(); BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java index c2699c3..00dff96 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java @@ -1,6 +1,5 @@ package com.hz.pm.api.projectlib.model.dto; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java index fa7949b..154b047 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java @@ -451,10 +451,6 @@ public class Project implements Serializable { @ApiModelProperty("交货时间") private LocalDateTime deliveryTime; - @ApiModelProperty("初验材料") - @Compare("初验材料") - private String preliminaryInspectionMaterials; - @ApiModelProperty("终验材料") @Compare("终验材料") private String finalAcceptanceMaterials; @@ -517,12 +513,6 @@ public class Project implements Serializable { @ApiModelProperty("其他附件") private String baseProjOtherFile; - @ApiModelProperty("是否完成日志数据归集") - private Boolean isCompletedLogCollection; - - @ApiModelProperty("实际成效指标") - private String actualPerformanceIndicators; - @ApiModelProperty("建议项目总投资") private BigDecimal proposeTotalInvest; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderStatusEnum.java index a299508..b9275eb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderStatusEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderStatusEnum.java @@ -19,17 +19,17 @@ import java.util.Optional; @AllArgsConstructor public enum TenderStatusEnum { - DTXCGXX(ProjectStatusEnum.ON_PURCHASING, 101, "待填写采购信息"), - DTXHTXX(ProjectStatusEnum.ON_PURCHASING, 102, "待填写合同信息"), - DTXSSJH(ProjectStatusEnum.ON_PURCHASING, 103, "待填写实施计划"), - DSCCYCL(ProjectStatusEnum.TO_BE_FIRST_INSPECTED, 201, "待上传初验材料"), - DXCFHXSQ(ProjectStatusEnum.ON_FIRST_INSPECTED, 301, "待信创符合性申请"), - XCFHXSQZ(ProjectStatusEnum.ON_FIRST_INSPECTED, 302, "信创符合性申请中"), - XCFHXSQSB(ProjectStatusEnum.ON_FIRST_INSPECTED, 303, "信创符合性申请不通过"), - DZYSB(ProjectStatusEnum.ON_FIRST_INSPECTED, 401, "待终验申报"), - ZYSQZ(ProjectStatusEnum.ON_FINALLY_INSPECTED, 501, "终验申报中"), - ZYSQSB(ProjectStatusEnum.ON_FINALLY_INSPECTED, 502, "终验申报不同过"), - ZYWC(ProjectStatusEnum.ACCEPTED, 601, "终验完成"); + TO_BE_SUBMIT_PURCHASE_INFO(ProjectStatusEnum.ON_PURCHASING, 101, "待填写采购信息"), + TO_BE_SUBMIT_CONSTRUCTION_INFO(ProjectStatusEnum.ON_PURCHASING, 102, "待填写合同信息"), + TO_BE_SUBMIT_OPERATION_PLAN(ProjectStatusEnum.ON_PURCHASING, 103, "待填写实施计划"), + TO_BE_SUBMIT_FIRST_INSPECTED_INFO(ProjectStatusEnum.TO_BE_FIRST_INSPECTED, 201, "待上传初验材料"), + TO_BE_SUBMIT_XCFHX_APPLY(ProjectStatusEnum.ON_FIRST_INSPECTED, 301, "待信创符合性申请"), + ON_XCFHX_APPLY(ProjectStatusEnum.ON_FIRST_INSPECTED, 302, "信创符合性申请中"), + XCFHX_APPLY_FAILED(ProjectStatusEnum.ON_FIRST_INSPECTED, 303, "信创符合性申请不通过"), + TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY(ProjectStatusEnum.ON_FIRST_INSPECTED, 401, "待终验申报"), + ON_FINALLY_INSPECTED_APPLY(ProjectStatusEnum.ON_FINALLY_INSPECTED, 501, "终验申报中"), + FINALLY_INSPECTED_FAILED(ProjectStatusEnum.ON_FINALLY_INSPECTED, 502, "终验申报不同过"), + FINALLY_INSPECTED_PASSED(ProjectStatusEnum.ACCEPTED, 601, "终验完成"); private final ProjectStatusEnum projectStatus; private final Integer tenderStatus; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java index a5349aa..0b6362d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java @@ -4,6 +4,7 @@ import cn.hutool.json.JSONNull; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; +import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; import com.ningdatech.basic.util.NdDateUtils; import com.hz.pm.api.common.compare.Compare; import com.hz.pm.api.common.util.BizUtils; @@ -565,4 +566,8 @@ public class ProjectDetailVO { @ApiModelProperty("立项依据证明材料") private String baseProjBasisFile; + + @ApiModelProperty("年度支付计划") + private List annualPaymentPlans; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java index efdb176..c8bfecb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java @@ -577,8 +577,8 @@ public class CockpitStatsStatisticsTask { (p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 && p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) < 0) || //如果在建设中 那么初验材料为空代表 初验未完成 - (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && - StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))) { + (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) /*&& + StringUtils.isBlank(p.getPreliminaryInspectionMaterials())*/)) { return Boolean.TRUE; } return Boolean.FALSE; @@ -598,8 +598,8 @@ public class CockpitStatsStatisticsTask { p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) > 0 && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0 || //如果在建设中 那么初验材料不为空代表 初验完成 - (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && - StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))) { + (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) /*&& + StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())*/)) { return Boolean.TRUE; } return Boolean.FALSE; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java index 1f6bcd7..d580876 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -151,12 +151,13 @@ public class EarlyWarningInstanceNotStartTask { if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { List allVersionProjectId = projectService.getAllVersionProjectId(p); //如果合同信息提交过了 才是 待初验状态 - if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { + // TODO 初验提醒 + /*if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) .in(Contract::getProjectId, allVersionProjectId))) { return Boolean.FALSE; } - } + }*/ } List noticeTypes = Lists.newArrayList(); @@ -326,12 +327,13 @@ public class EarlyWarningInstanceNotStartTask { if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { List allVersionProjectId = projectService.getAllVersionProjectId(p); //如果合同信息提交过了 才是 待初验状态 - if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { + // 初验提醒 + /*if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) .in(Contract::getProjectId, allVersionProjectId))) { return Boolean.FALSE; } - } + }*/ } //判断 实施信息中 初验和终验的时间