@@ -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<TenderStateChangeEvent> 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<TenderStateChangeEvent> 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<TenderStateChangeEvent> 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<TenderStateChangeEvent> 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<TenderStateChangeEvent> 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<TenderStateChangeEvent> 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<TenderStateChangeEvent> 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<TenderStateChangeEvent> message) { | |||
Purchase purchase = getPurchaseInfo(message); | |||
purchase.setStatus(TenderStatus.FINALLY_INSPECTED_FAILED.getCode()); | |||
purchase.setStatus(TenderMainStatus.FINALLY_INSPECTED_FAILED.getCode()); | |||
} | |||
} |
@@ -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<TestValidStateChangeEvent> 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()); | |||
} | |||
@@ -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; | |||
@@ -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.*; | |||
/** | |||
* <p> | |||
@@ -35,22 +39,22 @@ import java.util.EnumSet; | |||
@Component | |||
@EnableStateMachine(name = TenderStateMachineBuilderImpl.MACHINE_ID) | |||
@RequiredArgsConstructor | |||
public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, TenderStateChangeEvent, TenderStatus> { | |||
public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, TenderStateChangeEvent, ITenderStatus> { | |||
public static final String MACHINE_ID = "tenderStateMachine"; | |||
private final BeanFactory beanFactory; | |||
@Override | |||
public StateMachine<TenderStatus, TenderStateChangeEvent> build() throws StateMachineException { | |||
StateMachine<TenderStatus, TenderStateChangeEvent> stateMachine = build(beanFactory); | |||
public StateMachine<ITenderStatus, TenderStateChangeEvent> build() throws StateMachineException { | |||
StateMachine<ITenderStatus, TenderStateChangeEvent> stateMachine = build(beanFactory); | |||
log.info("状态机ID:{}", stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
@Override | |||
public StateMachine<TenderStatus, TenderStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException { | |||
public StateMachine<ITenderStatus, TenderStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException { | |||
try { | |||
return buildStateMachine(beanFactory); | |||
} catch (Exception e) { | |||
@@ -58,28 +62,30 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Pu | |||
} | |||
} | |||
private StateMachine<TenderStatus, TenderStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception { | |||
StateMachineBuilder.Builder<TenderStatus, TenderStateChangeEvent> builder = StateMachineBuilder.builder(); | |||
private StateMachine<ITenderStatus, TenderStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception { | |||
StateMachineBuilder.Builder<ITenderStatus, TenderStateChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINE_ID) | |||
.beanFactory(factory); | |||
List<ITenderStatus> 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<Pu | |||
.and() | |||
// 填写实施计划 | |||
.withExternal() | |||
.source(TenderStatus.TO_BE_SUBMIT_OPERATION_PLAN) | |||
.target(TenderStatus.WITHOUT_ADAPT_INFO) | |||
.source(TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN) | |||
.target(TenderAdaptStatus.WITHOUT_ADAPT_INFO) | |||
.event(TenderStateChangeEvent.SUBMIT_OPERATION_PLAN) | |||
.and() | |||
.withExternal() | |||
.source(TenderStatus.WAIT_ORG_CONFIRM) | |||
.target(TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) | |||
.source(TenderMainStatus.WAIT_ORG_CONFIRM) | |||
.target(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) | |||
.event(TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM) | |||
.and() | |||
// 上传初验材料 | |||
.withExternal() | |||
.source(TenderStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) | |||
.target(TenderStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY) | |||
.source(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO) | |||
.target(TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY) | |||
.event(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES) | |||
.and() | |||
// 终验申报 | |||
.withExternal() | |||
.source(TenderStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY) | |||
.target(TenderStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.source(TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY) | |||
.target(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.event(TenderStateChangeEvent.SUBMIT_FINALLY_INSPECTED) | |||
.and() | |||
// 终验申报重新提交 | |||
.withExternal() | |||
.source(TenderStatus.FINALLY_INSPECTED_FAILED) | |||
.target(TenderStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.source(TenderMainStatus.FINALLY_INSPECTED_FAILED) | |||
.target(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.event(TenderStateChangeEvent.RESUBMIT_FINALLY_INSPECTED) | |||
.and() | |||
// 终验申报通过 | |||
.withExternal() | |||
.source(TenderStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.target(TenderStatus.FINALLY_INSPECTED_PASSED) | |||
.source(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.target(TenderMainStatus.FINALLY_INSPECTED_PASSED) | |||
.event(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED) | |||
.and() | |||
// 终验申报拒绝 | |||
.withExternal() | |||
.source(TenderStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.target(TenderStatus.FINALLY_INSPECTED_FAILED) | |||
.source(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY) | |||
.target(TenderMainStatus.FINALLY_INSPECTED_FAILED) | |||
.event(TenderStateChangeEvent.FINALLY_INSPECTED_FAILED) | |||
.and(); | |||
return builder.build(); | |||
@@ -132,16 +138,16 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Pu | |||
@Override | |||
@Bean(name = "tenderStatePersister") | |||
public StateMachinePersister<TenderStatus, TenderStateChangeEvent, Purchase> stateMachinePersister() { | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderStatus, TenderStateChangeEvent, Purchase>() { | |||
public StateMachinePersister<ITenderStatus, TenderStateChangeEvent, Purchase> stateMachinePersister() { | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<ITenderStatus, TenderStateChangeEvent, Purchase>() { | |||
@Override | |||
public void write(StateMachineContext<TenderStatus, TenderStateChangeEvent> context, Purchase contextObj) { | |||
public void write(StateMachineContext<ITenderStatus, TenderStateChangeEvent> context, Purchase contextObj) { | |||
log.info("当前项目为:{} ==> {}", contextObj.getProjectId(), contextObj.getId()); | |||
} | |||
@Override | |||
public StateMachineContext<TenderStatus, TenderStateChangeEvent> read(Purchase contextObj) { | |||
return new DefaultStateMachineContext<>(TenderStatus.getNoNull(contextObj.getStatus()), | |||
public StateMachineContext<ITenderStatus, TenderStateChangeEvent> read(Purchase contextObj) { | |||
return new DefaultStateMachineContext<>(TenderMainStatus.getNoNull(contextObj.getStatus()), | |||
null, null, null, null, MACHINE_ID); | |||
} | |||
}); | |||
@@ -34,7 +34,7 @@ public interface AbstractStateMachineUtil<O, E extends Enum<E> & 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("状态机通过失败"); | |||
} | |||
} | |||
@@ -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; | |||
@@ -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<Purchase | |||
change.setProjectId(purchase.getProjectId()); | |||
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId())); | |||
change.setCreateOn(LocalDateTime.now()); | |||
StateMachine<TenderStatus, TenderStateChangeEvent> stateMachine = tenderStateMachineBuilder.build(); | |||
StateMachine<ITenderStatus, TenderStateChangeEvent> stateMachine = tenderStateMachineBuilder.build(); | |||
Message<TenderStateChangeEvent> message = MessageBuilder.withPayload(event) | |||
.setHeader(PURCHASE, purchase) | |||
.build(); | |||
//初始化状态机 | |||
StateMachinePersister<TenderStatus, TenderStateChangeEvent, Purchase> stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister(); | |||
StateMachinePersister<ITenderStatus, TenderStateChangeEvent, Purchase> stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister(); | |||
stateMachinePersister.restore(stateMachine, purchase); | |||
stateMachine.sendEvent(message); | |||
change.setAfterStatus(purchase.getStatus()); | |||
@@ -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<TenderStatus> PRE_INSPECTED_PURCHASE_STATUS; | |||
private static final List<TenderMainStatus> 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(); | |||
@@ -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<TenderStatus> FINAL_INSPECTED_TENDER_STATUS; | |||
private static final List<TenderMainStatus> 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<Long, Purchase> 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()); | |||
@@ -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<Purchase> purchases = purchaseService.listByProjectId(req.getProjectId()); | |||
Map<Long, Purchase> 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()) | |||
@@ -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<Long> projectIds = CollUtils.fieldList(page.getRecords(), Project::getId); | |||
List<Purchase> purchases = purchaseService.listByProjectIds(projectIds); | |||
Map<Long, List<Purchase>> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId); | |||
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds); | |||
Map<Long, BigDecimal> contractAmountMap = contractService.listContractAmountByProjectIds(projectIds); | |||
List<ProjectLibListItemVO> 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<Purchase> records = page.getRecords(); | |||
List<Long> projectIds = CollUtils.fieldList(records, Purchase::getProjectId); | |||
List<Project> projects = projectService.listByIds(projectIds); | |||
Wrapper<Project> 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<Project> projects = projectService.list(projectQuery); | |||
Map<Long, Project> projectMap = CollUtils.listToMap(projects, Project::getId); | |||
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds); | |||
List<PurchaseAdaptionListVO> 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()); | |||
@@ -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<Contract> { | |||
return CollUtils.listToMap(list(query), Contract::getBidId); | |||
} | |||
default Map<Long, BigDecimal> listContractAmountByProjectIds(Collection<Long> projectIds) { | |||
LambdaQueryWrapper<Contract> query = Wrappers.lambdaQuery(Contract.class) | |||
.select(Contract::getBidId, Contract::getTotalAmount) | |||
.in(Contract::getProjectId, projectIds); | |||
return CollUtils.listToMap(list(query), Contract::getBidId, Contract::getTotalAmount); | |||
} | |||
} |
@@ -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<Purchase> { | |||
.orderByAsc(Purchase::getId)); | |||
} | |||
default Set<Long> listProjectIdByStatus(Collection<TenderStatus> status) { | |||
default Set<Long> listProjectIdByStatus(Collection<TenderMainStatus> status) { | |||
if (CollUtil.isEmpty(status)) { | |||
return Collections.emptySet(); | |||
} | |||
List<Integer> statusCodes = status.stream() | |||
.map(TenderStatus::getCode) | |||
.map(TenderMainStatus::getCode) | |||
.collect(Collectors.toList()); | |||
LambdaQueryWrapper<Purchase> query = Wrappers.lambdaQuery(Purchase.class) | |||
.select(Purchase::getProjectId) | |||
@@ -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() | |||
@@ -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<Long, PurchaseVO> 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; | |||
}); | |||
//查询合同备案 | |||
@@ -0,0 +1,15 @@ | |||
package com.hz.pm.api.projectlib.model.enumeration.status; | |||
/** | |||
* <p> | |||
* ITenderStatus | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 20:54 2024/8/19 | |||
*/ | |||
public interface ITenderStatus extends IStatus<Integer, String> { | |||
ProjectStatus getProjectStatus(); | |||
} |
@@ -18,13 +18,14 @@ import java.util.Optional; | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
public enum TenderAdaptStatus implements IStatus<Integer, String> { | |||
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; | |||
@@ -6,7 +6,11 @@ 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; | |||
/** | |||
* <p> | |||
@@ -18,12 +22,11 @@ import java.util.Optional; | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
public enum TenderStatus implements IStatus<Integer, String> { | |||
public enum TenderMainStatus implements ITenderStatus { | |||
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, "待终验申报"), | |||
@@ -39,18 +42,29 @@ public enum TenderStatus implements IStatus<Integer, String> { | |||
private final String desc; | |||
private static Optional<TenderStatus> get(Integer tenderStatus) { | |||
return Arrays.stream(values()) | |||
.filter(w -> w.eq(tenderStatus)) | |||
.findFirst(); | |||
private static Optional<ITenderStatus> get(Integer status) { | |||
return Optional.ofNullable(TENDER_STATUS_MAP.get(status)); | |||
} | |||
public static TenderStatus getNoNull(Integer tenderStatus) { | |||
return get(tenderStatus).orElseThrow(() -> BizException.wrap("无效的标段状态:%s", tenderStatus)); | |||
public static ITenderStatus getNoNull(Integer status) { | |||
return get(status).orElseThrow(() -> BizException.wrap("无效的标段状态:%s", status)); | |||
} | |||
public static String getDescByStatus(Integer tenderStatus) { | |||
return get(tenderStatus).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); | |||
public static String getDesc(Integer status) { | |||
return get(status).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); | |||
} | |||
private static final Map<Integer, ITenderStatus> TENDER_STATUS_MAP; | |||
static { | |||
List<ITenderStatus> mainStatusList = Arrays.asList(TenderMainStatus.values()); | |||
List<ITenderStatus> adaptStatusList = Arrays.asList(TenderAdaptStatus.values()); | |||
List<ITenderStatus> selfTestStatusList = Arrays.asList(TenderSelfTestStatus.values()); | |||
List<ITenderStatus> testValidStatusList = Arrays.asList(TenderTestValidStatus.values()); | |||
TENDER_STATUS_MAP = Stream.of(mainStatusList, adaptStatusList, selfTestStatusList, testValidStatusList) | |||
.flatMap(List::stream) | |||
.collect(Collectors.toMap(IStatus::getCode, w -> w)); | |||
} | |||
} |
@@ -18,13 +18,14 @@ import java.util.Optional; | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
public enum TenderSelfTestStatus implements IStatus<Integer, String> { | |||
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; | |||
@@ -18,13 +18,14 @@ import java.util.Optional; | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
public enum TenderTestValidStatus implements IStatus<Integer, String> { | |||
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; | |||