diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptAction.java index 021bb09..b4f423c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptAction.java @@ -3,11 +3,9 @@ package com.hz.pm.api.common.statemachine.action; import cn.hutool.core.lang.Assert; import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuilderImpl; import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent; -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.AdaptStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.messaging.Message; import org.springframework.statemachine.annotation.OnTransition; @@ -34,25 +32,25 @@ public class AdaptAction { @OnTransition(source = "WITHOUT_ADAPT_INFO", target = "ADAPT_INFO_AUDIT") public void SUBMIT_ADAPT_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setAdaptStatus(AdaptStatusEnum.ADAPT_INFO_AUDIT.getCode()); + purchase.setAdaptStatus(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT.getCode()); } @OnTransition(source = "ADAPT_INFO_AUDIT", target = "ADAPT_INFO_PASSED") public void ADAPT_INFO_PASSED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setAdaptStatus(AdaptStatusEnum.ADAPT_INFO_PASSED.getCode()); + purchase.setAdaptStatus(TenderAdaptStatusEnum.ADAPT_INFO_PASSED.getCode()); } @OnTransition(source = "ADAPT_INFO_AUDIT", target = "ADAPT_INFO_FAILED") public void ADAPT_INFO_FAILED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setAdaptStatus(AdaptStatusEnum.ADAPT_INFO_FAILED.getCode()); + purchase.setAdaptStatus(TenderAdaptStatusEnum.ADAPT_INFO_FAILED.getCode()); } @OnTransition(source = "ADAPT_INFO_FAILED", target = "ADAPT_INFO_AUDIT") public void RESUBMIT_ADAPT_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setAdaptStatus(AdaptStatusEnum.ADAPT_INFO_AUDIT.getCode()); + purchase.setAdaptStatus(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT.getCode()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestAction.java index 9c8d195..63d1f01 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestAction.java @@ -3,11 +3,9 @@ package com.hz.pm.api.common.statemachine.action; import cn.hutool.core.lang.Assert; import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuilderImpl; import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; -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.SelfTestStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.messaging.Message; import org.springframework.statemachine.annotation.OnTransition; @@ -34,25 +32,25 @@ public class SelfTestAction { @OnTransition(source = "WITHOUT_SELF_TEST_INFO", target = "TEST_VALID_INFO_AUDIT") public void SUBMIT_SELF_TEST_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setSelfTestStatus(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode()); + purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode()); } @OnTransition(source = "SELF_TEST_INFO_AUDIT", target = "SELF_TEST_INFO_PASSED") public void SELF_TEST_INFO_PASSED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setSelfTestStatus(SelfTestStatusEnum.SELF_TEST_INFO_PASSED.getCode()); + purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_PASSED.getCode()); } @OnTransition(source = "SELF_TEST_INFO_AUDIT", target = "SELF_TEST_INFO_FAILED") public void SELF_TEST_INFO_FAILED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setSelfTestStatus(SelfTestStatusEnum.SELF_TEST_INFO_FAILED.getCode()); + purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_FAILED.getCode()); } @OnTransition(source = "SELF_TEST_INFO_FAILED", target = "TEST_VALID_INFO_AUDIT") public void RESUBMIT_SELF_TEST_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setSelfTestStatus(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode()); + purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidAction.java index d463c67..f1e21bc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidAction.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.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.messaging.Message; import org.springframework.statemachine.annotation.OnTransition; @@ -32,25 +32,25 @@ public class TestValidAction { @OnTransition(source = "WITHOUT_TEST_VALID_INFO", target = "TEST_VALID_INFO_AUDIT") public void SUBMIT_TEST_VALID_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setTestValidStatus(TestValidStatusEnum.TEST_VALID_INFO_AUDIT.getCode()); + purchase.setTestValidStatus(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT.getCode()); } @OnTransition(source = "TEST_VALID_INFO_AUDIT", target = "TEST_VALID_INFO_PASSED") public void TEST_VALID_INFO_PASSED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setTestValidStatus(TestValidStatusEnum.TEST_VALID_INFO_PASSED.getCode()); + purchase.setTestValidStatus(TenderTestValidStatusEnum.TEST_VALID_INFO_PASSED.getCode()); } @OnTransition(source = "TEST_VALID_INFO_AUDIT", target = "TEST_VALID_INFO_FAILED") public void TEST_VALID_INFO_FAILED(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setTestValidStatus(TestValidStatusEnum.TEST_VALID_INFO_FAILED.getCode()); + purchase.setTestValidStatus(TenderTestValidStatusEnum.TEST_VALID_INFO_FAILED.getCode()); } @OnTransition(source = "TEST_VALID_INFO_FAILED", target = "TEST_VALID_INFO_AUDIT") public void RESUBMIT_TEST_VALID_INFO(Message message) { Purchase purchase = getPurchaseInfo(message); - purchase.setTestValidStatus(TestValidStatusEnum.TEST_VALID_INFO_AUDIT.getCode()); + purchase.setTestValidStatus(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT.getCode()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java index cf74e32..0feb877 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java @@ -1,10 +1,8 @@ package com.hz.pm.api.common.statemachine.builder; import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent; -import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.AdaptStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum; import org.springframework.beans.factory.BeanFactory; import org.springframework.statemachine.StateMachine; import org.springframework.statemachine.StateMachineException; @@ -19,14 +17,14 @@ import org.springframework.statemachine.persist.StateMachinePersister; public interface AdaptStateMachineBuilder { - StateMachine build() throws StateMachineException; + StateMachine build() throws StateMachineException; /** * 构建状态机 * * @param beanFactory \ */ - StateMachine build(BeanFactory beanFactory) throws StateMachineException; + StateMachine build(BeanFactory beanFactory) throws StateMachineException; /** * 持久化配置 @@ -34,7 +32,7 @@ public interface AdaptStateMachineBuilder { * @author CMM * @since 2023/02/07 16:22 */ - StateMachinePersister stateMachinePersister(); + StateMachinePersister stateMachinePersister(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java index e24dfd4..061c4ab 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java @@ -1,10 +1,8 @@ package com.hz.pm.api.common.statemachine.builder; import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; -import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.SelfTestStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum; import org.springframework.beans.factory.BeanFactory; import org.springframework.statemachine.StateMachine; import org.springframework.statemachine.StateMachineException; @@ -19,14 +17,14 @@ import org.springframework.statemachine.persist.StateMachinePersister; public interface SelfTestStateMachineBuilder { - StateMachine build() throws StateMachineException; + StateMachine build() throws StateMachineException; /** * 构建状态机 * * @param beanFactory \ */ - StateMachine build(BeanFactory beanFactory) throws StateMachineException; + StateMachine build(BeanFactory beanFactory) throws StateMachineException; /** * 持久化配置 @@ -34,7 +32,7 @@ public interface SelfTestStateMachineBuilder { * @author CMM * @since 2023/02/07 16:22 */ - StateMachinePersister stateMachinePersister(); + StateMachinePersister stateMachinePersister(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java index a7425b6..1def11b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java @@ -2,7 +2,7 @@ package com.hz.pm.api.common.statemachine.builder; import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum; import org.springframework.beans.factory.BeanFactory; import org.springframework.statemachine.StateMachine; import org.springframework.statemachine.StateMachineException; @@ -17,14 +17,14 @@ import org.springframework.statemachine.persist.StateMachinePersister; public interface TestValidStateMachineBuilder { - StateMachine build() throws StateMachineException; + StateMachine build() throws StateMachineException; /** * 构建状态机 * * @param beanFactory \ */ - StateMachine build(BeanFactory beanFactory) throws StateMachineException; + StateMachine build(BeanFactory beanFactory) throws StateMachineException; /** * 持久化配置 @@ -32,7 +32,7 @@ public interface TestValidStateMachineBuilder { * @author CMM * @since 2023/02/07 16:22 */ - StateMachinePersister stateMachinePersister(); + StateMachinePersister stateMachinePersister(); } 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 700e83f..0230c07 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,7 +3,7 @@ package com.hz.pm.api.common.statemachine.builder.impl; import com.hz.pm.api.common.statemachine.builder.AdaptStateMachineBuilder; 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.AdaptStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum; import com.ningdatech.basic.exception.BizException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -41,15 +41,15 @@ public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder { 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) { @@ -57,8 +57,8 @@ public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder { } } - private StateMachine 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) @@ -66,28 +66,28 @@ public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder { builder.configureStates() .withStates() - .initial(AdaptStatusEnum.WITHOUT_ADAPT_INFO) - .states(EnumSet.allOf(AdaptStatusEnum.class)); + .initial(TenderAdaptStatusEnum.WITHOUT_ADAPT_INFO) + .states(EnumSet.allOf(TenderAdaptStatusEnum.class)); builder.configureTransitions() .withExternal() - .source(AdaptStatusEnum.WITHOUT_ADAPT_INFO) - .target(AdaptStatusEnum.ADAPT_INFO_AUDIT) + .source(TenderAdaptStatusEnum.WITHOUT_ADAPT_INFO) + .target(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT) .event(AdaptStateChangeEvent.SUBMIT_ADAPT_INFO) .and() .withExternal() - .source(AdaptStatusEnum.ADAPT_INFO_AUDIT) - .target(AdaptStatusEnum.ADAPT_INFO_PASSED) + .source(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT) + .target(TenderAdaptStatusEnum.ADAPT_INFO_PASSED) .event(AdaptStateChangeEvent.ADAPT_INFO_PASSED) .and() .withExternal() - .source(AdaptStatusEnum.ADAPT_INFO_AUDIT) - .target(AdaptStatusEnum.ADAPT_INFO_FAILED) + .source(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT) + .target(TenderAdaptStatusEnum.ADAPT_INFO_FAILED) .event(AdaptStateChangeEvent.ADAPT_INFO_FAILED) .and() .withExternal() - .source(AdaptStatusEnum.ADAPT_INFO_FAILED) - .target(AdaptStatusEnum.ADAPT_INFO_AUDIT) + .source(TenderAdaptStatusEnum.ADAPT_INFO_FAILED) + .target(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT) .event(AdaptStateChangeEvent.RESUBMIT_ADAPT_INFO) .and(); return builder.build(); @@ -95,16 +95,16 @@ public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder { @Override @Bean(name = "adaptStatePersister") - public StateMachinePersister 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); } @Override - public StateMachineContext read(Purchase contextObj) { - AdaptStatusEnum status = AdaptStatusEnum.get(contextObj.getAdaptStatus()) + public StateMachineContext read(Purchase contextObj) { + TenderAdaptStatusEnum status = TenderAdaptStatusEnum.get(contextObj.getAdaptStatus()) .orElseThrow(() -> BizException.wrap("系统自测状态无效")); return new DefaultStateMachineContext<>(status, null, null, null, null, MACHINE_ID); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java index 95a8eec..793af0c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java @@ -3,7 +3,7 @@ package com.hz.pm.api.common.statemachine.builder.impl; import com.hz.pm.api.common.statemachine.builder.SelfTestStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.SelfTestStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum; import com.ningdatech.basic.exception.BizException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -41,15 +41,15 @@ public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuil 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) { @@ -57,8 +57,8 @@ public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuil } } - private StateMachine 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) @@ -66,28 +66,28 @@ public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuil builder.configureStates() .withStates() - .initial(SelfTestStatusEnum.WITHOUT_SELF_TEST_INFO) - .states(EnumSet.allOf(SelfTestStatusEnum.class)); + .initial(TenderSelfTestStatusEnum.WITHOUT_SELF_TEST_INFO) + .states(EnumSet.allOf(TenderSelfTestStatusEnum.class)); builder.configureTransitions() .withExternal() - .source(SelfTestStatusEnum.WITHOUT_SELF_TEST_INFO) - .target(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT) + .source(TenderSelfTestStatusEnum.WITHOUT_SELF_TEST_INFO) + .target(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT) .event(SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO) .and() .withExternal() - .source(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT) - .target(SelfTestStatusEnum.SELF_TEST_INFO_PASSED) + .source(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT) + .target(TenderSelfTestStatusEnum.SELF_TEST_INFO_PASSED) .event(SelfTestStateChangeEvent.SELF_TEST_PASSED) .and() .withExternal() - .source(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT) - .target(SelfTestStatusEnum.SELF_TEST_INFO_FAILED) + .source(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT) + .target(TenderSelfTestStatusEnum.SELF_TEST_INFO_FAILED) .event(SelfTestStateChangeEvent.SELF_TEST_FAILED) .and() .withExternal() - .source(SelfTestStatusEnum.SELF_TEST_INFO_FAILED) - .target(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT) + .source(TenderSelfTestStatusEnum.SELF_TEST_INFO_FAILED) + .target(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT) .event(SelfTestStateChangeEvent.RESUBMIT_SELF_TEST) .and(); return builder.build(); @@ -95,16 +95,16 @@ public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuil @Override @Bean(name = "selfTestStatePersister") - public StateMachinePersister 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); } @Override - public StateMachineContext read(Purchase contextObj) { - SelfTestStatusEnum status = SelfTestStatusEnum.get(contextObj.getSelfTestStatus()) + public StateMachineContext read(Purchase contextObj) { + TenderSelfTestStatusEnum status = TenderSelfTestStatusEnum.get(contextObj.getSelfTestStatus()) .orElseThrow(() -> BizException.wrap("系统自测状态无效")); return new DefaultStateMachineContext<>(status, null, null, null, null, MACHINE_ID); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java index 03785ee..0f5968c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java @@ -3,7 +3,7 @@ package com.hz.pm.api.common.statemachine.builder.impl; import com.hz.pm.api.common.statemachine.builder.TestValidStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum; import com.ningdatech.basic.exception.BizException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -41,15 +41,15 @@ public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBu 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) { @@ -57,8 +57,8 @@ public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBu } } - private StateMachine 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) @@ -66,28 +66,28 @@ public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBu builder.configureStates() .withStates() - .initial(TestValidStatusEnum.WITHOUT_TEST_VALID_INFO) - .states(EnumSet.allOf(TestValidStatusEnum.class)); + .initial(TenderTestValidStatusEnum.WITHOUT_TEST_VALID_INFO) + .states(EnumSet.allOf(TenderTestValidStatusEnum.class)); builder.configureTransitions() .withExternal() - .source(TestValidStatusEnum.WITHOUT_TEST_VALID_INFO) - .target(TestValidStatusEnum.TEST_VALID_INFO_AUDIT) + .source(TenderTestValidStatusEnum.WITHOUT_TEST_VALID_INFO) + .target(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT) .event(TestValidStateChangeEvent.SUBMIT_TEST_VALID_INFO) .and() .withExternal() - .source(TestValidStatusEnum.TEST_VALID_INFO_AUDIT) - .target(TestValidStatusEnum.TEST_VALID_INFO_PASSED) + .source(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT) + .target(TenderTestValidStatusEnum.TEST_VALID_INFO_PASSED) .event(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED) .and() .withExternal() - .source(TestValidStatusEnum.TEST_VALID_INFO_AUDIT) - .target(TestValidStatusEnum.TEST_VALID_INFO_FAILED) + .source(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT) + .target(TenderTestValidStatusEnum.TEST_VALID_INFO_FAILED) .event(TestValidStateChangeEvent.TEST_VALID_INFO_FAILED) .and() .withExternal() - .source(TestValidStatusEnum.TEST_VALID_INFO_FAILED) - .target(TestValidStatusEnum.TEST_VALID_INFO_AUDIT) + .source(TenderTestValidStatusEnum.TEST_VALID_INFO_FAILED) + .target(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT) .event(TestValidStateChangeEvent.RESUBMIT_TEST_VALID_INFO) .and(); return builder.build(); @@ -95,16 +95,16 @@ public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBu @Override @Bean(name = "testValidStatePersister") - public StateMachinePersister 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); } @Override - public StateMachineContext read(Purchase contextObj) { - TestValidStatusEnum testValidStatus = TestValidStatusEnum.get(contextObj.getTestValidStatus()) + public StateMachineContext read(Purchase contextObj) { + TenderTestValidStatusEnum testValidStatus = TenderTestValidStatusEnum.get(contextObj.getTestValidStatus()) .orElseThrow(() -> BizException.wrap("测试验证状态无效")); return new DefaultStateMachineContext<>(testValidStatus, null, null, null, null, MACHINE_ID); } 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 f3964ba..18ca509 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 @@ -3,7 +3,7 @@ package com.hz.pm.api.common.statemachine.util; import com.hz.pm.api.common.statemachine.builder.AdaptStateMachineBuilder; 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.AdaptStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum; import com.ningdatech.basic.exception.BizException; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; @@ -68,12 +68,12 @@ public class AdaptStateMachineUtil { public void execute(Purchase purchase, AdaptStateChangeEvent event) throws Exception { log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); // 获取TO状态机 - StateMachine stateMachine = adaptStateMachineBuilder.build(); + StateMachine stateMachine = adaptStateMachineBuilder.build(); Message message = MessageBuilder.withPayload(event) .setHeader(PURCHASE, purchase) .build(); //初始化状态机 - StateMachinePersister stateMachinePersister = adaptStateMachineBuilder.stateMachinePersister(); + StateMachinePersister stateMachinePersister = adaptStateMachineBuilder.stateMachinePersister(); stateMachinePersister.restore(stateMachine, purchase); stateMachine.sendEvent(message); log.info("调用状态机后的标段状态为:{}", purchase.getStatus()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java index cb6d007..35eeb6f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java @@ -3,7 +3,7 @@ package com.hz.pm.api.common.statemachine.util; import com.hz.pm.api.common.statemachine.builder.SelfTestStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.SelfTestStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum; import com.ningdatech.basic.exception.BizException; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; @@ -68,12 +68,12 @@ public class SelfTestStateMachineUtil { public void execute(Purchase purchase, SelfTestStateChangeEvent event) throws Exception { log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); // 获取TO状态机 - StateMachine stateMachine = selfTestStateMachineBuilder.build(); + StateMachine stateMachine = selfTestStateMachineBuilder.build(); Message message = MessageBuilder.withPayload(event) .setHeader(PURCHASE, purchase) .build(); //初始化状态机 - StateMachinePersister stateMachinePersister = selfTestStateMachineBuilder.stateMachinePersister(); + StateMachinePersister stateMachinePersister = selfTestStateMachineBuilder.stateMachinePersister(); stateMachinePersister.restore(stateMachine, purchase); stateMachine.sendEvent(message); log.info("调用状态机后的标段状态为:{}", purchase.getStatus()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java index 7d9d856..356d3fa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java @@ -3,7 +3,7 @@ package com.hz.pm.api.common.statemachine.util; import com.hz.pm.api.common.statemachine.builder.TestValidStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum; import com.ningdatech.basic.exception.BizException; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; @@ -68,12 +68,12 @@ public class TestValidStateMachineUtil { public void execute(Purchase purchase, TestValidStateChangeEvent event) throws Exception { log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); // 获取TO状态机 - StateMachine stateMachine = testValidStateMachineBuilder.build(); + StateMachine stateMachine = testValidStateMachineBuilder.build(); Message message = MessageBuilder.withPayload(event) .setHeader(PURCHASE, purchase) .build(); //初始化状态机 - StateMachinePersister stateMachinePersister = testValidStateMachineBuilder.stateMachinePersister(); + StateMachinePersister stateMachinePersister = testValidStateMachineBuilder.stateMachinePersister(); stateMachinePersister.restore(stateMachine, purchase); stateMachine.sendEvent(message); log.info("调用状态机后的标段状态为:{}", purchase.getStatus()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java index 8265d94..2ec018c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java @@ -3,8 +3,9 @@ package com.hz.pm.api.projectdeclared.controller; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.projectdeclared.manage.PurchaseManage; import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; -import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq; +import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; +import com.hz.pm.api.projectdeclared.model.req.TestValidInfoReq; import com.hz.pm.api.projectdeclared.model.req.TestValidListReq; import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; import com.hz.pm.api.projectdeclared.model.vo.TestValidListVO; @@ -79,20 +80,41 @@ public class PurchaseController { @GetMapping("/pageTestValid") @ApiOperation("获取测试验证列表") - public PageVo pageTestValid(TestValidListReq req){ + public PageVo pageTestValid(TestValidListReq req) { return purchaseManage.testValidList(req); } @GetMapping("/pageSelfTest") @ApiOperation("获取系统自测列表") - public PageVo pageSelfTest(TestValidListReq req){ + public PageVo pageSelfTest(TestValidListReq req) { return purchaseManage.selfTestList(req); } @GetMapping("/pageAdaption") @ApiOperation("获取适配改造列表") - public PageVo pageAdaption(TestValidListReq req){ + public PageVo pageAdaption(TestValidListReq req) { return purchaseManage.adaptList(req); } + @ApiOperation("提交测试验证信息") + @WebLog("提交测试验证信息") + @PostMapping("/submitTestValidInfo") + public void submitTestValidInfo(@RequestBody TestValidInfoReq req) { + purchaseManage.submitTestValidInfo(req); + } + + @ApiOperation("提交适配改造信息") + @WebLog("提交适配改造信息") + @PostMapping("/submitAdaptionInfo") + public void submitAdaptionInfo(@RequestBody TestValidInfoReq req) { + purchaseManage.submitAdaptionInfo(req); + } + + @ApiOperation("提交系统自测信息") + @WebLog("提交系统自测信息") + @PostMapping("/submitSelfTestInfo") + public void submitSelfTestInfo(@RequestBody TestValidInfoReq req) { + purchaseManage.submitSelfTestInfo(req); + } + } 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 95a332d..5e6092b 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 @@ -12,10 +12,10 @@ 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.AdaptStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.SelfTestStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum; import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.TestValidStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum; 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; @@ -96,9 +96,9 @@ public class OperationManage { } // 修改标段状态 tenderStateMachineUtil.pass(purchase); - purchase.setSelfTestStatus(SelfTestStatusEnum.WITHOUT_SELF_TEST_INFO.getCode()); - purchase.setTestValidStatus(TestValidStatusEnum.WITHOUT_TEST_VALID_INFO.getCode()); - purchase.setAdaptStatus(AdaptStatusEnum.WITHOUT_ADAPT_INFO.getCode()); + purchase.setSelfTestStatus(TenderSelfTestStatusEnum.WITHOUT_SELF_TEST_INFO.getCode()); + purchase.setTestValidStatus(TenderTestValidStatusEnum.WITHOUT_TEST_VALID_INFO.getCode()); + purchase.setAdaptStatus(TenderAdaptStatusEnum.WITHOUT_ADAPT_INFO.getCode()); purchaseService.updateById(purchase); return curr.getProjectCode(); } 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 2f8278c..0741dbf 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 @@ -8,14 +8,18 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; +import com.hz.pm.api.common.statemachine.util.TestValidStateMachineUtil; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; @@ -27,26 +31,32 @@ import com.hz.pm.api.external.model.dto.MhPurchaseNoticeDTO; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; import com.hz.pm.api.projectdeclared.model.entity.Contract; +import com.hz.pm.api.projectdeclared.model.entity.Operation; import com.hz.pm.api.projectdeclared.model.entity.Purchase; +import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseScopeEnum; import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq; import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq.PurchaseNoticeTenderDTO; import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; +import com.hz.pm.api.projectdeclared.model.req.TestValidInfoReq; import com.hz.pm.api.projectdeclared.model.req.TestValidListReq; import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; import com.hz.pm.api.projectdeclared.model.vo.TestValidListVO; import com.hz.pm.api.projectdeclared.service.IContractService; +import com.hz.pm.api.projectdeclared.service.IOperationService; +import com.hz.pm.api.projectdeclared.service.IPurchaseInstService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.enumeration.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.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.*; 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; +import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; +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; import com.hz.pm.api.user.security.model.UserInfoDetails; @@ -59,6 +69,11 @@ import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.file.entity.File; import com.ningdatech.file.entity.vo.result.FileResultVO; import com.ningdatech.file.service.FileService; +import com.wflow.bean.entity.WflowModels; +import com.wflow.exception.BusinessException; +import com.wflow.workflow.bean.dto.OrgInfoDTO; +import com.wflow.workflow.bean.vo.ProcessStartParamsVo; +import com.wflow.workflow.service.ProcessInstanceService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -95,6 +110,13 @@ public class PurchaseManage { private final MhFileClient mhFileClient; private final FileService fileService; private final MhUnitCache mhUnitCache; + private final IOperationService operationService; + private final ProcessModelManage processModelManage; + private final DefaultDeclaredProjectManage declaredProjectManage; + private final ProcessInstanceService processInstanceService; + private final TestValidStateMachineUtil testValidStateMachineUtil; + private final IPurchaseInstService purchaseInstService; + private final IProjectInstService projectInstService; private boolean buildPurchaseQueryPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { boolean queryState = true; @@ -452,4 +474,119 @@ public class PurchaseManage { return queryData(req, Purchase::getSelfTestStatus); } + @Transactional(rollbackFor = Exception.class) + public synchronized void submitTestValidInfo(TestValidInfoReq req) { + Purchase purchase = purchaseService.getById(req.getBidId()); + if (TenderTestValidStatusEnum.WITHOUT_TEST_VALID_INFO.eq(purchase.getTestValidStatus()) + && TenderTestValidStatusEnum.TEST_VALID_INFO_FAILED.eq(purchase.getTestValidStatus())) { + throw BizException.wrap("该状态下不支持提交测试验证信息"); + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + ProjectProcessStageEnum instType = ProjectProcessStageEnum.TEST_VALID; + WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId()); + if (Objects.isNull(model)) { + throw new BusinessException("找不到测试验证流程配置"); + } + Project project = projectService.getNewProject(purchase.getProjectId()); + ProcessStartParamsVo instParam = new ProcessStartParamsVo(); + instParam.setUser(declaredProjectManage.buildUser(user)); + instParam.setProcessUsers(Collections.emptyMap()); + instParam.setFormData(Collections.emptyMap()); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); + Wrapper update = Wrappers.lambdaUpdate(Operation.class) + .set(Operation::getActualTestValidTime, req.getActualTime()) + .set(Operation::getTestValidFiles, req.getFiles()) + .set(Operation::getTestValidRemark, req.getRemark()) + .eq(Operation::getBidId, req.getBidId()); + testValidStateMachineUtil.pass(purchase); + purchaseService.updateById(purchase); + operationService.update(update); + saveProjectPurchaseInstCode(req.getBidId(), instanceId, project.getId(), instType); + } + + private void saveProjectPurchaseInstCode(Long bidId, + String instanceId, + Long projectId, + ProjectProcessStageEnum instType) { + // 保存标段实列关系 + PurchaseInst purchaseInst = new PurchaseInst(); + purchaseInst.setBidId(bidId); + purchaseInst.setInstCode(instanceId); + purchaseInst.setProjectId(projectId); + purchaseInst.setInstType(instType); + purchaseInstService.save(purchaseInst); + // 保存项目实列关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setInstType(instType); + projectInst.setInstCode(instanceId); + projectInst.setProjectId(projectId); + projectInstService.save(projectInst); + } + + @Transactional(rollbackFor = Exception.class) + public synchronized void submitSelfTestInfo(TestValidInfoReq req) { + Purchase purchase = purchaseService.getById(req.getBidId()); + if (TenderSelfTestStatusEnum.WITHOUT_SELF_TEST_INFO.eq(purchase.getSelfTestStatus()) + && TenderSelfTestStatusEnum.SELF_TEST_INFO_FAILED.eq(purchase.getSelfTestStatus())) { + throw BizException.wrap("该状态下不支持提交系统自测信息"); + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + ProjectProcessStageEnum instType = ProjectProcessStageEnum.SELF_TEST; + WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId()); + if (Objects.isNull(model)) { + throw new BusinessException("找不到系统自测流程配置"); + } + Project project = projectService.getNewProject(purchase.getProjectId()); + ProcessStartParamsVo instParam = new ProcessStartParamsVo(); + instParam.setUser(declaredProjectManage.buildUser(user)); + instParam.setProcessUsers(Collections.emptyMap()); + instParam.setFormData(Collections.emptyMap()); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); + Wrapper update = Wrappers.lambdaUpdate(Operation.class) + .set(Operation::getSelfTestTime, req.getActualTime()) + .set(Operation::getSelfTestFiles, req.getFiles()) + .set(Operation::getSelfTestRemark, req.getRemark()) + .eq(Operation::getBidId, req.getBidId()); + testValidStateMachineUtil.pass(purchase); + purchaseService.updateById(purchase); + operationService.update(update); + saveProjectPurchaseInstCode(req.getBidId(), instanceId, project.getId(), instType); + } + + @Transactional(rollbackFor = Exception.class) + public synchronized void submitAdaptionInfo(TestValidInfoReq req) { + Purchase purchase = purchaseService.getById(req.getBidId()); + if (TenderAdaptStatusEnum.WITHOUT_ADAPT_INFO.eq(purchase.getAdaptStatus()) + && TenderAdaptStatusEnum.ADAPT_INFO_FAILED.eq(purchase.getAdaptStatus())) { + throw BizException.wrap("该状态下不支持提交适配改造信息"); + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + ProjectProcessStageEnum instType = ProjectProcessStageEnum.ADAPTION; + WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId()); + if (Objects.isNull(model)) { + throw new BusinessException("找不到适配改造流程配置"); + } + Project project = projectService.getNewProject(purchase.getProjectId()); + ProcessStartParamsVo instParam = new ProcessStartParamsVo(); + instParam.setUser(declaredProjectManage.buildUser(user)); + instParam.setProcessUsers(Collections.emptyMap()); + instParam.setFormData(Collections.emptyMap()); + // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 + Map orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); + Wrapper update = Wrappers.lambdaUpdate(Operation.class) + .set(Operation::getAdaptationTime, req.getActualTime()) + .set(Operation::getAdaptionFiles, req.getFiles()) + .set(Operation::getAdaptionRemark, req.getRemark()) + .eq(Operation::getBidId, req.getBidId()); + testValidStateMachineUtil.pass(purchase); + purchaseService.updateById(purchase); + operationService.update(update); + saveProjectPurchaseInstCode(req.getBidId(), instanceId, project.getId(), instType); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java index bbb21e7..c4bd54b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java @@ -68,10 +68,31 @@ public class Operation { @ApiModelProperty("适配改造时间") private LocalDateTime adaptationTime; + @ApiModelProperty("实际完成适配改造时间") + private LocalDateTime actualAdaptionTime; + + private String adaptionRemark; + + private String adaptionFiles; + @ApiModelProperty("系统自测时间") private LocalDateTime selfTestTime; + private String selfTestRemark; + + private String selfTestFiles; + + @ApiModelProperty("实际完成系统自测时间") + private LocalDateTime actualSelfTestTime; + @ApiModelProperty("测试验证时间") private LocalDateTime testValidTime; + @ApiModelProperty("实际完成测试验证时间") + private LocalDateTime actualTestValidTime; + + private String testValidRemark; + + private String testValidFiles; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java new file mode 100644 index 0000000..86b5dd3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java @@ -0,0 +1,31 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * TestValidInfoReq + *

+ * + * @author WendyYang + * @since 11:43 2024/3/28 + */ +@Data +public class TestValidInfoReq { + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("实际时间") + private LocalDateTime actualTime; + + @ApiModelProperty("附件") + private String files; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/AdaptStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderAdaptStatusEnum.java similarity index 89% rename from hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/AdaptStatusEnum.java rename to hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderAdaptStatusEnum.java index 7b1fcae..6015b81 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/AdaptStatusEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderAdaptStatusEnum.java @@ -16,7 +16,7 @@ import java.util.Optional; */ @Getter @AllArgsConstructor -public enum AdaptStatusEnum { +public enum TenderAdaptStatusEnum { WITHOUT_ADAPT_INFO(100, "待填写适配改造信息"), ADAPT_INFO_AUDIT(101, "适配改造信息审核中"), @@ -30,7 +30,7 @@ public enum AdaptStatusEnum { return this.code.equals(code); } - public static Optional get(Integer code) { + public static Optional get(Integer code) { return Arrays.stream(values()) .filter(w -> w.getCode().equals(code)) .findFirst(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/SelfTestStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderSelfTestStatusEnum.java similarity index 89% rename from hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/SelfTestStatusEnum.java rename to hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderSelfTestStatusEnum.java index 373f9fc..8ad9273 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/SelfTestStatusEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderSelfTestStatusEnum.java @@ -16,7 +16,7 @@ import java.util.Optional; */ @Getter @AllArgsConstructor -public enum SelfTestStatusEnum { +public enum TenderSelfTestStatusEnum { WITHOUT_SELF_TEST_INFO(100, "待填写系统自测信息"), SELF_TEST_INFO_AUDIT(101, "系统自测信息审核中"), @@ -30,7 +30,7 @@ public enum SelfTestStatusEnum { return this.code.equals(code); } - public static Optional get(Integer code) { + public static Optional get(Integer code) { return Arrays.stream(values()) .filter(w -> w.getCode().equals(code)) .findFirst(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TestValidStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderTestValidStatusEnum.java similarity index 89% rename from hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TestValidStatusEnum.java rename to hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderTestValidStatusEnum.java index 86d843e..e55b11c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TestValidStatusEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderTestValidStatusEnum.java @@ -16,7 +16,7 @@ import java.util.Optional; */ @Getter @AllArgsConstructor -public enum TestValidStatusEnum { +public enum TenderTestValidStatusEnum { WITHOUT_TEST_VALID_INFO(100, "待填写测试验证信息"), TEST_VALID_INFO_AUDIT(101, "测试验证信息审核中"), @@ -30,7 +30,7 @@ public enum TestValidStatusEnum { return this.code.equals(code); } - public static Optional get(Integer code) { + public static Optional get(Integer code) { return Arrays.stream(values()) .filter(w -> w.getCode().equals(code)) .findFirst();