From ed2fdd107c87d46ad2197fd3a6d14ca84a799d7c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 19 Aug 2024 22:18:24 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E7=8A=B6=E6=80=81=E6=9C=BA?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/TenderStateChangeAction.java | 18 +++--- .../action/TestValidStateChangeAction.java | 4 +- .../builder/impl/AdaptStateMachineBuilderImpl.java | 1 + .../impl/TenderStateMachineBuilderImpl.java | 74 ++++++++++++---------- .../util/AbstractStateMachineUtil.java | 2 +- .../statemachine/util/AdaptStateMachineUtil.java | 1 + .../statemachine/util/TenderStateMachineUtil.java | 6 +- .../projectdeclared/manage/ConstructionManage.java | 10 +-- .../manage/FinalAcceptanceManage.java | 16 ++--- .../projectdeclared/manage/OperationManage.java | 5 +- .../api/projectdeclared/manage/PurchaseManage.java | 37 +++++------ .../projectdeclared/service/IContractService.java | 8 +++ .../projectdeclared/service/IPurchaseService.java | 10 +-- .../projectlib/helper/ProjectChangeStopHelper.java | 8 +-- .../pm/api/projectlib/manage/ProjectLibManage.java | 5 +- .../model/enumeration/status/ITenderStatus.java | 15 +++++ .../enumeration/status/TenderAdaptStatus.java | 11 ++-- .../model/enumeration/status/TenderMainStatus.java | 70 ++++++++++++++++++++ .../enumeration/status/TenderSelfTestStatus.java | 11 ++-- .../model/enumeration/status/TenderStatus.java | 56 ---------------- .../enumeration/status/TenderTestValidStatus.java | 11 ++-- 21 files changed, 208 insertions(+), 171 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ITenderStatus.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderMainStatus.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderStatus.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java index 8718119..5511d8f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java @@ -6,7 +6,7 @@ import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; 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.status.TenderAdaptStatus; -import com.hz.pm.api.projectlib.model.enumeration.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import lombok.extern.slf4j.Slf4j; import org.springframework.messaging.Message; import org.springframework.statemachine.annotation.OnTransition; @@ -39,7 +39,7 @@ public class TenderStateChangeAction { public void SUBMIT_PURCHASE_CONSTRUCTION_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); purchase.setAdaptStatus(TenderAdaptStatus.WITHOUT_ADAPT_INFO.getCode()); - purchase.setStatus(TenderStatus.TO_BE_SUBMIT_OPERATION_PLAN.getCode()); + purchase.setStatus(TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN.getCode()); } /** @@ -50,7 +50,7 @@ public class TenderStateChangeAction { @OnTransition(source = "TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO", target = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO") public void SUBMIT_PURCHASE_CONSTRUCTION_INFO_SKIP_TO_FINAL_INSPECT(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getCode()); + purchase.setStatus(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getCode()); } /** @@ -61,7 +61,7 @@ public class TenderStateChangeAction { @OnTransition(source = "WAIT_ORG_CONFIRM", target = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO") public void SUBMIT_PURCHASE_ORG_CONFIRM(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getCode()); + purchase.setStatus(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getCode()); } /** @@ -84,7 +84,7 @@ public class TenderStateChangeAction { @OnTransition(source = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO", target = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY") public void SUBMIT_FIRST_INSPECTED_FILES(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.getCode()); + purchase.setStatus(TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.getCode()); } /** @@ -95,7 +95,7 @@ public class TenderStateChangeAction { @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(TenderStatus.ON_FINALLY_INSPECTED_APPLY.getCode()); + purchase.setStatus(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY.getCode()); } /** @@ -106,7 +106,7 @@ public class TenderStateChangeAction { @OnTransition(source = "FINALLY_INSPECTED_FAILED", target = "ON_FINALLY_INSPECTED_APPLY") public void RESUBMIT_FINALLY_INSPECTED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.ON_FINALLY_INSPECTED_APPLY.getCode()); + purchase.setStatus(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY.getCode()); } /** @@ -117,7 +117,7 @@ public class TenderStateChangeAction { @OnTransition(source = "ON_FINALLY_INSPECTED_APPLY", target = "FINALLY_INSPECTED_PASSED") public void FINALLY_INSPECTED_PASSED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.FINALLY_INSPECTED_PASSED.getCode()); + purchase.setStatus(TenderMainStatus.FINALLY_INSPECTED_PASSED.getCode()); } /** @@ -128,7 +128,7 @@ public class TenderStateChangeAction { @OnTransition(source = "ON_FINALLY_INSPECTED_APPLY", target = "FINALLY_INSPECTED_FAILED") public void FINALLY_INSPECTED_FAILED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.FINALLY_INSPECTED_FAILED.getCode()); + purchase.setStatus(TenderMainStatus.FINALLY_INSPECTED_FAILED.getCode()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java index 0f6c73a..cc96a8a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java @@ -5,7 +5,7 @@ import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuild import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; 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.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import com.hz.pm.api.projectlib.model.enumeration.status.TenderTestValidStatus; import lombok.extern.slf4j.Slf4j; import org.springframework.messaging.Message; @@ -40,7 +40,7 @@ public class TestValidStateChangeAction { @OnTransition(source = "TEST_VALID_INFO_AUDIT", target = "TEST_VALID_INFO_PASSED") public void TEST_VALID_INFO_PASSED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setStatus(TenderStatus.WAIT_ORG_CONFIRM.getCode()); + purchase.setStatus(TenderMainStatus.WAIT_ORG_CONFIRM.getCode()); purchase.setTestValidStatus(TenderTestValidStatus.TEST_VALID_INFO_PASSED.getCode()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java index bd54065..e6f6928 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java @@ -3,6 +3,7 @@ package com.hz.pm.api.common.statemachine.builder.impl; import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectlib.model.enumeration.status.ITenderStatus; import com.hz.pm.api.projectlib.model.enumeration.status.TenderAdaptStatus; import com.ningdatech.basic.exception.BizException; import lombok.RequiredArgsConstructor; 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 index a5073f9..c17a9ca 100644 --- 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 @@ -1,11 +1,15 @@ package com.hz.pm.api.common.statemachine.builder.impl; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.util.EnumUtil; import com.hz.pm.api.common.statemachine.action.TenderStateChangeAction; import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.model.enumerization.BidTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.ITenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderAdaptStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.BeanFactory; @@ -21,7 +25,7 @@ import org.springframework.statemachine.persist.StateMachinePersister; import org.springframework.statemachine.support.DefaultStateMachineContext; import org.springframework.stereotype.Component; -import java.util.EnumSet; +import java.util.*; /** *

@@ -35,22 +39,22 @@ import java.util.EnumSet; @Component @EnableStateMachine(name = TenderStateMachineBuilderImpl.MACHINE_ID) @RequiredArgsConstructor -public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder { +public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder { public static final String MACHINE_ID = "tenderStateMachine"; private final BeanFactory beanFactory; @Override - public StateMachine build() throws StateMachineException { - StateMachine stateMachine = build(beanFactory); + 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 { + public StateMachine build(BeanFactory beanFactory) throws StateMachineException { try { return buildStateMachine(beanFactory); } catch (Exception e) { @@ -58,28 +62,30 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder buildStateMachine(BeanFactory factory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + private StateMachine buildStateMachine(BeanFactory factory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); builder.configureConfiguration() .withConfiguration() .machineId(MACHINE_ID) .beanFactory(factory); + List states = ListUtil.toList(TenderMainStatus.values()); + states.add(TenderAdaptStatus.WITHOUT_ADAPT_INFO); + builder.configureStates() .withStates() - .initial(TenderStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO) - .states(EnumSet.allOf(TenderStatus.class)); - + .initial(TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO) + .states(new HashSet<>(states)); builder.configureTransitions() // 填写采购&合同信息 .withExternal() - .source(TenderStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO) - .target(TenderStatus.TO_BE_SUBMIT_OPERATION_PLAN) + .source(TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO) + .target(TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN) .event(TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO) .and() .withExternal() - .source(TenderStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO) - .target(TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) + .source(TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO) + .target(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) .event(TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO) .guard(ctx -> { Purchase purchase = TenderStateChangeAction.getPurchaseInfo(ctx.getMessage()); @@ -88,43 +94,43 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder stateMachinePersister() { - return new DefaultStateMachinePersister<>(new StateMachinePersist() { + public StateMachinePersister stateMachinePersister() { + return new DefaultStateMachinePersister<>(new StateMachinePersist() { @Override - public void write(StateMachineContext context, Purchase contextObj) { + public void write(StateMachineContext context, Purchase contextObj) { log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); } @Override - public StateMachineContext read(Purchase contextObj) { - return new DefaultStateMachineContext<>(TenderStatus.getNoNull(contextObj.getStatus()), + public StateMachineContext read(Purchase contextObj) { + return new DefaultStateMachineContext<>(TenderMainStatus.getNoNull(contextObj.getStatus()), null, null, null, null, MACHINE_ID); } }); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AbstractStateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AbstractStateMachineUtil.java index c51b278..f64afc1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AbstractStateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AbstractStateMachineUtil.java @@ -34,7 +34,7 @@ public interface AbstractStateMachineUtil & AbstractStateCh try { execute(obj, AbstractStateChangeEvent.getPassEvent(eventClass(), statusFunction().apply(obj))); } catch (Exception e) { - LoggerFactory.getLogger(this.getClass()).info("状态机 通过失败 :{}", e.getMessage()); + LoggerFactory.getLogger(this.getClass()).info("状态机 通过失败", e); throw BizException.wrap("状态机通过失败"); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java index 86903b4..a74f381 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java @@ -5,6 +5,7 @@ import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.status.ITenderStatus; import com.hz.pm.api.projectlib.model.enumeration.status.TenderAdaptStatus; import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; import lombok.RequiredArgsConstructor; 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 index cdf4a3a..b429652 100644 --- 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 @@ -5,7 +5,7 @@ import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; -import com.hz.pm.api.projectlib.model.enumeration.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.ITenderStatus; import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -54,12 +54,12 @@ public class TenderStateMachineUtil implements AbstractStateMachineUtil stateMachine = tenderStateMachineBuilder.build(); + StateMachine stateMachine = tenderStateMachineBuilder.build(); Message message = MessageBuilder.withPayload(event) .setHeader(PURCHASE, purchase) .build(); //初始化状态机 - StateMachinePersister stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister(); + StateMachinePersister stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister(); stateMachinePersister.restore(stateMachine, purchase); stateMachine.sendEvent(message); change.setAfterStatus(purchase.getStatus()); 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 dc3079f..1e080f4 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 @@ -34,7 +34,7 @@ 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.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.TenderMainStatus; import com.hz.pm.api.projectlib.model.enumeration.status.TenderXcfhxApplyStatus; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; @@ -286,11 +286,11 @@ public class ConstructionManage { return BeanUtil.copyToList(contracts, ContractVO.class); } - private static final List PRE_INSPECTED_PURCHASE_STATUS; + private static final List PRE_INSPECTED_PURCHASE_STATUS; static { PRE_INSPECTED_PURCHASE_STATUS = new ArrayList<>(); - PRE_INSPECTED_PURCHASE_STATUS.add(TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO); + PRE_INSPECTED_PURCHASE_STATUS.add(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO); } /** @@ -359,7 +359,7 @@ public class ConstructionManage { tender.setBidName(x.getBidName()); tender.setBidId(x.getId()); tender.setBidStatus(x.getStatus()); - tender.setBidStatusName(TenderStatus.getDescByStatus(x.getStatus())); + tender.setBidStatusName(TenderMainStatus.getDesc(x.getStatus())); Contract contract = contractMap.get(x.getId()); if (contract != null) { tender.setConstructionAmount(contract.getTotalAmount()); @@ -476,7 +476,7 @@ public class ConstructionManage { public synchronized void submitFirstInspectedFiles(PreInsSaveDTO req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Purchase purchase = purchaseService.getById(req.getBidId()); - if (!TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(purchase.getStatus())) { + if (!TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(purchase.getStatus())) { throw BizException.wrap("该标段无法上传初验材料"); } LocalDateTime now = LocalDateTime.now(); 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 e75319b..4ef58a6 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 @@ -28,7 +28,7 @@ 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.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO; @@ -85,13 +85,13 @@ public class FinalAcceptanceManage { //================================================================================================================== - private static final List FINAL_INSPECTED_TENDER_STATUS; + private static final List FINAL_INSPECTED_TENDER_STATUS; static { FINAL_INSPECTED_TENDER_STATUS = new ArrayList<>(); - FINAL_INSPECTED_TENDER_STATUS.add(TenderStatus.FINALLY_INSPECTED_FAILED); - FINAL_INSPECTED_TENDER_STATUS.add(TenderStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY); - FINAL_INSPECTED_TENDER_STATUS.add(TenderStatus.ON_FINALLY_INSPECTED_APPLY); + FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.FINALLY_INSPECTED_FAILED); + FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY); + FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY); } @@ -162,7 +162,7 @@ public class FinalAcceptanceManage { tender.setBidName(x.getBidName()); tender.setBidId(x.getId()); tender.setBidStatus(x.getStatus()); - tender.setBidStatusName(TenderStatus.getDescByStatus(x.getStatus())); + tender.setBidStatusName(TenderMainStatus.getDesc(x.getStatus())); Contract contract = contractMap.get(x.getId()); if (contract != null) { tender.setConstructionAmount(contract.getTotalAmount()); @@ -257,8 +257,8 @@ public class FinalAcceptanceManage { Map purchaseMap = CollUtils.listToMap(purchases, Purchase::getId); Purchase purchase = purchaseMap.get(req.getBidId()); Assert.notNull(purchase, "当前标段不存在"); - if (!TenderStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.eq(purchase.getStatus()) - && !TenderStatus.FINALLY_INSPECTED_FAILED.eq(purchase.getStatus())) { + if (!TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.eq(purchase.getStatus()) + && !TenderMainStatus.FINALLY_INSPECTED_FAILED.eq(purchase.getStatus())) { throw BizException.wrap("该标段不支持终验申报"); } Project project = projectService.getNewProject(req.getProjectId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java index 37978bc..de09a3c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java @@ -1,7 +1,6 @@ package com.hz.pm.api.projectdeclared.manage; import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; @@ -13,7 +12,7 @@ import com.hz.pm.api.projectdeclared.model.vo.OperationVO; import com.hz.pm.api.projectdeclared.service.IOperationService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.enumeration.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; @@ -75,7 +74,7 @@ public class OperationManage { List purchases = purchaseService.listByProjectId(req.getProjectId()); Map purchaseMap = CollUtils.listToMap(purchases, Purchase::getId); Purchase purchase = purchaseMap.get(req.getBidId()); - if (!TenderStatus.TO_BE_SUBMIT_OPERATION_PLAN.eq(purchase.getStatus())) { + if (!TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN.eq(purchase.getStatus())) { throw BizException.wrap("该标段不支持填写实施计划"); } Operation operation = operationService.getByBidId(req.getBidId()) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index d1a6e25..b3050ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -41,7 +41,6 @@ import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; import com.hz.pm.api.projectdeclared.model.vo.XcfhxApplyListVO; import com.hz.pm.api.projectdeclared.model.vo.XinchuangVO; import com.hz.pm.api.projectdeclared.service.*; -import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; @@ -52,7 +51,6 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; import com.hz.pm.api.sys.manage.ProcessModelManage; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.security.model.UserFullInfoDTO; @@ -122,10 +120,7 @@ public class PurchaseManage { private final IPurchaseInstService purchaseInstService; private final IProjectInstService projectInstService; private final EnvironmentUtil environmentUtil; - private final IPurchaseStatusChangeService purchaseStatusChangeService; - private final IXinchuangService xinchuangService; - private final MhXchxFileHelper mhXchxFileHelper; /** @@ -158,7 +153,7 @@ public class PurchaseManage { List projectIds = CollUtils.fieldList(page.getRecords(), Project::getId); List purchases = purchaseService.listByProjectIds(projectIds); Map> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId); - Map contractMap = contractService.listByProjectIds(projectIds); + Map contractAmountMap = contractService.listContractAmountByProjectIds(projectIds); List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -184,11 +179,8 @@ public class PurchaseManage { tender.setBidName(x.getBidName()); tender.setBidId(x.getId()); tender.setBidStatus(x.getStatus()); - tender.setBidStatusName(TenderStatus.getDescByStatus(x.getStatus())); - Contract contract = contractMap.get(x.getId()); - if (contract != null) { - tender.setConstructionAmount(contract.getTotalAmount()); - } + tender.setBidStatusName(TenderMainStatus.getDesc(x.getStatus())); + tender.setConstructionAmount(contractAmountMap.get(x.getId())); return tender; })); } @@ -359,7 +351,7 @@ public class PurchaseManage { if (purchase.getId() == null) { purchase.setCreateBy(user.getUserIdStr()); } - purchase.setStatus(TenderStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.getCode()); + purchase.setStatus(TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.getCode()); purchase.setXcfhxApplyStatus(TenderXcfhxApplyStatus.TO_BE_SUBMIT_XCFHX_APPLY.getCode()); if (Boolean.TRUE.equals(mhPurchaseNoticeOpen) && Boolean.TRUE.equals(w.getPublishMhNotice())) { notices.add(buildPurchaseNotice(w, user)); @@ -421,7 +413,7 @@ public class PurchaseManage { @Transactional(rollbackFor = Exception.class) public synchronized void submitPurchaseRecord(SubmitPurchaseContractRecordReq req) { Purchase purchase = purchaseService.getById(req.getBidId()); - if (!TenderStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(purchase.getStatus())) { + if (!TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(purchase.getStatus())) { throw BizException.wrap("该标段无法进行采购&合同信息备案"); } // 保存采购信息 @@ -498,21 +490,24 @@ public class PurchaseManage { } List records = page.getRecords(); List projectIds = CollUtils.fieldList(records, Purchase::getProjectId); - List projects = projectService.listByIds(projectIds); + Wrapper projectQuery = Wrappers.lambdaQuery(Project.class) + .select(Project::getId, Project::getProjectCode, Project::getProjectName, Project::getStatus, + Project::getBuildOrgName, Project::getBuildOrgCode, Project::getUnitStrip) + .in(Project::getId, projectIds); + List projects = projectService.list(projectQuery); Map projectMap = CollUtils.listToMap(projects, Project::getId); Map contractMap = contractService.listByProjectIds(projectIds); List data = records.stream().map(w -> { PurchaseAdaptionListVO adaption = new PurchaseAdaptionListVO(); adaption.setBidId(w.getId()); + adaption.setStatus(w.getStatus()); + adaption.setBizName(w.getBidName()); + adaption.setProjectId(w.getProjectId()); Project project = projectMap.get(w.getProjectId()); adaption.setProjectName(project.getProjectName()); - adaption.setStatus(w.getStatus()); adaption.setBuildOrg(project.getBuildOrgName()); adaption.setProjectStatus(project.getStatus()); - adaption.setBizName(w.getBidName()); - adaption.setProjectId(w.getProjectId()); - String projectCode = ProjectIdCodeCacheUtil.get(w.getProjectId()); - adaption.setProjectCode(projectCode); + adaption.setProjectCode(project.getProjectCode()); adaption.setUnitStripName(MhUnitStripEnum.getVal(project.getUnitStrip())); Contract contract = contractMap.get(w.getId()); if (contract != null) { @@ -801,7 +796,7 @@ public class PurchaseManage { @Transactional(rollbackFor = Exception.class) public synchronized void purchaseOrgConfirm(PurchaseOrgConfirmReq req) { Purchase purchase = purchaseService.getById(req.getBidId()); - if (!TenderStatus.WAIT_ORG_CONFIRM.eq(purchase.getStatus())) { + if (!TenderMainStatus.WAIT_ORG_CONFIRM.eq(purchase.getStatus())) { throw BizException.wrap("该标段不支持单位确认"); } tenderStateMachineUtil.pass(purchase); @@ -814,7 +809,7 @@ public class PurchaseManage { if (!BidTypeEnum.BUILD_APP.eq(w.getBidType())) { return true; } - return TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(w.getStatus()); + return TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(w.getStatus()); }); if (changeProjectStatus) { Project project = projectService.getNewestNoNull(purchase.getProjectId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java index bb9fdef..626f6cd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IContractService.java @@ -7,6 +7,7 @@ import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.projectdeclared.model.entity.Contract; import com.ningdatech.basic.util.CollUtils; +import java.math.BigDecimal; import java.util.Collection; import java.util.Map; import java.util.Optional; @@ -40,4 +41,11 @@ public interface IContractService extends IService { return CollUtils.listToMap(list(query), Contract::getBidId); } + default Map listContractAmountByProjectIds(Collection projectIds) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Contract.class) + .select(Contract::getBidId, Contract::getTotalAmount) + .in(Contract::getProjectId, projectIds); + return CollUtils.listToMap(list(query), Contract::getBidId, Contract::getTotalAmount); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java index 350fe02..e115f5c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java @@ -4,16 +4,12 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.api.common.util.BizUtils; -import com.hz.pm.api.datascope.model.DataScopeDTO; -import com.hz.pm.api.datascope.utils.DataScopeUtil; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.model.req.XcfhxListReq; import com.hz.pm.api.projectdeclared.model.vo.XcfhxApplyListVO; -import com.hz.pm.api.projectlib.model.enumeration.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.ningdatech.basic.util.CollUtils; -import lombok.extern.slf4j.Slf4j; import java.util.*; import java.util.stream.Collectors; @@ -40,12 +36,12 @@ public interface IPurchaseService extends IService { .orderByAsc(Purchase::getId)); } - default Set listProjectIdByStatus(Collection status) { + default Set listProjectIdByStatus(Collection status) { if (CollUtil.isEmpty(status)) { return Collections.emptySet(); } List statusCodes = status.stream() - .map(TenderStatus::getCode) + .map(TenderMainStatus::getCode) .collect(Collectors.toList()); LambdaQueryWrapper query = Wrappers.lambdaQuery(Purchase.class) .select(Purchase::getProjectId) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java index 93687c3..e065469 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java @@ -87,17 +87,17 @@ public class ProjectChangeStopHelper { beforeEvent = null; tenderBeforeEvent = null; ProjectStatus status; - TenderStatus tenderStatus; + TenderMainStatus tenderStatus; if (event.equals(ProjectStateChangeEvent.STOPPED_APPLY_SUBMIT)) { status = ProjectStatus.ON_STOPPED_APPLY; - tenderStatus = TenderStatus.ON_STOPPED_APPLY; + tenderStatus = TenderMainStatus.ON_STOPPED_APPLY; project.setStoppedStatus(buildBizStatus(event).getCode()); } else if (event.equals(ProjectStateChangeEvent.CHANGE_APPLY_SUBMIT)) { status = ProjectStatus.ON_CHANGE_APPLY; - tenderStatus = TenderStatus.ON_CHANGE_APPLY; + tenderStatus = TenderMainStatus.ON_CHANGE_APPLY; } else { status = ProjectStatus.STOPPED_PASSED; - tenderStatus = TenderStatus.STOPPED_PASSED; + tenderStatus = TenderMainStatus.STOPPED_PASSED; project.setStoppedStatus(buildBizStatus(event).getCode()); } ProjectStatusChange projectStatusChange = ProjectStatusChange.builder() 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 e6b1f17..292a578 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 @@ -27,7 +27,6 @@ import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.utils.DataScopeUtil; import com.hz.pm.api.expert.model.entity.ExpertReview; import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum; -import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; import com.hz.pm.api.expert.service.IExpertReviewService; import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; @@ -63,7 +62,7 @@ import com.hz.pm.api.projectlib.model.entity.*; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; 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.status.TenderStatus; +import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus; import com.hz.pm.api.projectlib.model.po.ProjectPO; import com.hz.pm.api.projectlib.model.req.ProjectApplicationListReq; import com.hz.pm.api.projectlib.model.req.ProjectListReq; @@ -725,7 +724,7 @@ public class ProjectLibManage { if (!purchases.isEmpty()) { Map purchaseMap = CollUtils.listToMap(purchases, Purchase::getId, w -> { PurchaseVO purchase = BeanUtil.copyProperties(w, PurchaseVO.class); - purchase.setStatusName(TenderStatus.getDescByStatus(w.getStatus())); + purchase.setStatusName(TenderMainStatus.getDesc(w.getStatus())); return purchase; }); //查询合同备案 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ITenderStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ITenderStatus.java new file mode 100644 index 0000000..d52764d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ITenderStatus.java @@ -0,0 +1,15 @@ +package com.hz.pm.api.projectlib.model.enumeration.status; + +/** + *

+ * ITenderStatus + *

+ * + * @author WendyYang + * @since 20:54 2024/8/19 + */ +public interface ITenderStatus extends IStatus { + + ProjectStatus getProjectStatus(); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderAdaptStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderAdaptStatus.java index 8906c9e..abcf791 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderAdaptStatus.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderAdaptStatus.java @@ -18,13 +18,14 @@ import java.util.Optional; */ @Getter @AllArgsConstructor -public enum TenderAdaptStatus implements IStatus { +public enum TenderAdaptStatus implements ITenderStatus { - WITHOUT_ADAPT_INFO(2100, "待上传开工文件"), - ADAPT_INFO_AUDIT(2101, "开工文件审核中"), - ADAPT_INFO_FAILED(2102, "开工文件审核失败"), - ADAPT_INFO_PASSED(2103, "开工文件审核通过"); + WITHOUT_ADAPT_INFO(null, 2100, "待上传开工文件"), + ADAPT_INFO_AUDIT(null, 2101, "开工文件审核中"), + ADAPT_INFO_FAILED(null, 2102, "开工文件审核失败"), + ADAPT_INFO_PASSED(null, 2103, "开工文件审核通过"); + private final ProjectStatus projectStatus; private final Integer code; private final String desc; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderMainStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderMainStatus.java new file mode 100644 index 0000000..bd00969 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderMainStatus.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.projectlib.model.enumeration.status; + +import cn.hutool.core.util.StrUtil; +import com.ningdatech.basic.exception.BizException; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + *

+ * 标段状态 + *

+ * + * @author WendyYang + * @since 15:49 2024/2/23 + */ +@Getter +@AllArgsConstructor +public enum TenderMainStatus implements ITenderStatus { + + TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO(ProjectStatus.ON_PURCHASING, 101, "待填写采购&合同信息"), + TO_BE_SUBMIT_OPERATION_PLAN(ProjectStatus.ON_ADAPTING, 103, "待填写实施计划"), + // 衔接状态 + WAIT_ORG_CONFIRM(ProjectStatus.ON_ADAPTING, 104, "待单位确认"), + TO_BE_SUBMIT_FIRST_INSPECTED_INFO(ProjectStatus.TO_BE_FIRST_INSPECTED, 201, "待上传初验材料"), + TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY(ProjectStatus.ON_PILOT_RUNNING, 401, "待终验申报"), + ON_FINALLY_INSPECTED_APPLY(ProjectStatus.ON_FINALLY_INSPECTED, 501, "终验申报中"), + FINALLY_INSPECTED_FAILED(ProjectStatus.ON_FINALLY_INSPECTED, 502, "终验申报不通过"), + FINALLY_INSPECTED_PASSED(ProjectStatus.ACCEPTED, 601, "终验完成"), + ON_CHANGE_APPLY(ProjectStatus.ON_CHANGE_APPLY, 701, "项目变更中"), + ON_STOPPED_APPLY(ProjectStatus.ON_STOPPED_APPLY, 901, "项目终止审核中"), + STOPPED_PASSED(ProjectStatus.STOPPED, 902, "项目终止"); + + private final ProjectStatus projectStatus; + private final Integer code; + private final String desc; + + + private static Optional get(Integer status) { + return Optional.ofNullable(TENDER_STATUS_MAP.get(status)); + } + + public static ITenderStatus getNoNull(Integer status) { + return get(status).orElseThrow(() -> BizException.wrap("无效的标段状态:%s", status)); + } + + public static String getDesc(Integer status) { + return get(status).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); + } + + private static final Map TENDER_STATUS_MAP; + + static { + List mainStatusList = Arrays.asList(TenderMainStatus.values()); + List adaptStatusList = Arrays.asList(TenderAdaptStatus.values()); + List selfTestStatusList = Arrays.asList(TenderSelfTestStatus.values()); + List testValidStatusList = Arrays.asList(TenderTestValidStatus.values()); + TENDER_STATUS_MAP = Stream.of(mainStatusList, adaptStatusList, selfTestStatusList, testValidStatusList) + .flatMap(List::stream) + .collect(Collectors.toMap(IStatus::getCode, w -> w)); + + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderSelfTestStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderSelfTestStatus.java index 71e385b..3e8c4d5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderSelfTestStatus.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderSelfTestStatus.java @@ -18,13 +18,14 @@ import java.util.Optional; */ @Getter @AllArgsConstructor -public enum TenderSelfTestStatus implements IStatus { +public enum TenderSelfTestStatus implements ITenderStatus { - WITHOUT_SELF_TEST_INFO(1100, "待填写系统自测信息"), - SELF_TEST_INFO_AUDIT(1101, "系统自测信息审核中"), - SELF_TEST_INFO_FAILED(1102, "系统自测信息审核失败"), - SELF_TEST_INFO_PASSED(1103, "系统自测信息审核通过"); + WITHOUT_SELF_TEST_INFO(null, 1100, "待填写系统自测信息"), + SELF_TEST_INFO_AUDIT(null, 1101, "系统自测信息审核中"), + SELF_TEST_INFO_FAILED(null, 1102, "系统自测信息审核失败"), + SELF_TEST_INFO_PASSED(null, 1103, "系统自测信息审核通过"); + private final ProjectStatus projectStatus; private final Integer code; private final String desc; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderStatus.java deleted file mode 100644 index 63d3a93..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderStatus.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.hz.pm.api.projectlib.model.enumeration.status; - -import cn.hutool.core.util.StrUtil; -import com.ningdatech.basic.exception.BizException; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; -import java.util.Optional; - -/** - *

- * 标段状态 - *

- * - * @author WendyYang - * @since 15:49 2024/2/23 - */ -@Getter -@AllArgsConstructor -public enum TenderStatus implements IStatus { - - TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO(ProjectStatus.ON_PURCHASING, 101, "待填写采购&合同信息"), - TO_BE_SUBMIT_OPERATION_PLAN(ProjectStatus.ON_ADAPTING, 103, "待填写实施计划"), - // 衔接状态 - WITHOUT_ADAPT_INFO(ProjectStatus.ON_ADAPTING, TenderAdaptStatus.WITHOUT_ADAPT_INFO.getCode(), "待填写适配改造信息"), - WAIT_ORG_CONFIRM(ProjectStatus.ON_ADAPTING, 104, "待单位确认"), - TO_BE_SUBMIT_FIRST_INSPECTED_INFO(ProjectStatus.TO_BE_FIRST_INSPECTED, 201, "待上传初验材料"), - TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY(ProjectStatus.ON_PILOT_RUNNING, 401, "待终验申报"), - ON_FINALLY_INSPECTED_APPLY(ProjectStatus.ON_FINALLY_INSPECTED, 501, "终验申报中"), - FINALLY_INSPECTED_FAILED(ProjectStatus.ON_FINALLY_INSPECTED, 502, "终验申报不通过"), - FINALLY_INSPECTED_PASSED(ProjectStatus.ACCEPTED, 601, "终验完成"), - ON_CHANGE_APPLY(ProjectStatus.ON_CHANGE_APPLY, 701, "项目变更中"), - ON_STOPPED_APPLY(ProjectStatus.ON_STOPPED_APPLY, 901, "项目终止审核中"), - STOPPED_PASSED(ProjectStatus.STOPPED, 902, "项目终止"); - - private final ProjectStatus projectStatus; - private final Integer code; - private final String desc; - - - private static Optional get(Integer tenderStatus) { - return Arrays.stream(values()) - .filter(w -> w.eq(tenderStatus)) - .findFirst(); - } - - public static TenderStatus getNoNull(Integer tenderStatus) { - return get(tenderStatus).orElseThrow(() -> BizException.wrap("无效的标段状态:%s", tenderStatus)); - } - - public static String getDescByStatus(Integer tenderStatus) { - return get(tenderStatus).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderTestValidStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderTestValidStatus.java index 914a65e..12b3be1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderTestValidStatus.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderTestValidStatus.java @@ -18,13 +18,14 @@ import java.util.Optional; */ @Getter @AllArgsConstructor -public enum TenderTestValidStatus implements IStatus { +public enum TenderTestValidStatus implements ITenderStatus { - WITHOUT_TEST_VALID_INFO(3100, "待填写测试验证信息"), - TEST_VALID_INFO_AUDIT(3101, "测试验证信息审核中"), - TEST_VALID_INFO_FAILED(3102, "测试验证信息审核失败"), - TEST_VALID_INFO_PASSED(3103, "测试验证信息审核通过"); + WITHOUT_TEST_VALID_INFO(null, 3100, "待填写测试验证信息"), + TEST_VALID_INFO_AUDIT(null, 3101, "测试验证信息审核中"), + TEST_VALID_INFO_FAILED(null, 3102, "测试验证信息审核失败"), + TEST_VALID_INFO_PASSED(null, 3103, "测试验证信息审核通过"); + private final ProjectStatus projectStatus; private final Integer code; private final String desc;