ソースを参照

增加审批流程

tags/24080901
WendyYang 7ヶ月前
コミット
d872f5adca
20個のファイルの変更329行の追加126行の削除
  1. +5
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptAction.java
  2. +5
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestAction.java
  3. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidAction.java
  4. +4
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java
  5. +4
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java
  6. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java
  7. +21
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java
  8. +21
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java
  9. +21
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java
  10. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java
  11. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java
  12. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java
  13. +26
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java
  14. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java
  15. +140
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  16. +21
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java
  17. +31
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java
  18. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderAdaptStatusEnum.java
  19. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderSelfTestStatusEnum.java
  20. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderTestValidStatusEnum.java

+ 5
- 7
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<AdaptStateChangeEvent> 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<AdaptStateChangeEvent> 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<AdaptStateChangeEvent> 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<AdaptStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setAdaptStatus(AdaptStatusEnum.ADAPT_INFO_AUDIT.getCode());
purchase.setAdaptStatus(TenderAdaptStatusEnum.ADAPT_INFO_AUDIT.getCode());
}

}

+ 5
- 7
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<SelfTestStateChangeEvent> 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<SelfTestStateChangeEvent> 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<SelfTestStateChangeEvent> 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<SelfTestStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setSelfTestStatus(SelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode());
purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode());
}

}

+ 5
- 5
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<TestValidStateChangeEvent> 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<TestValidStateChangeEvent> 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<TestValidStateChangeEvent> 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<TestValidStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setTestValidStatus(TestValidStatusEnum.TEST_VALID_INFO_AUDIT.getCode());
purchase.setTestValidStatus(TenderTestValidStatusEnum.TEST_VALID_INFO_AUDIT.getCode());
}

}

+ 4
- 6
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<AdaptStatusEnum, AdaptStateChangeEvent> build() throws StateMachineException;
StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<AdaptStatusEnum, AdaptStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;
StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
@@ -34,7 +32,7 @@ public interface AdaptStateMachineBuilder {
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<AdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister();
StateMachinePersister<TenderAdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister();


}

+ 4
- 6
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<SelfTestStatusEnum, SelfTestStateChangeEvent> build() throws StateMachineException;
StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<SelfTestStatusEnum, SelfTestStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;
StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
@@ -34,7 +32,7 @@ public interface SelfTestStateMachineBuilder {
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<SelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister();
StateMachinePersister<TenderSelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister();


}

+ 4
- 4
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<TestValidStatusEnum, TestValidStateChangeEvent> build() throws StateMachineException;
StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<TestValidStatusEnum, TestValidStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;
StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
@@ -32,7 +32,7 @@ public interface TestValidStateMachineBuilder {
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<TestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister();
StateMachinePersister<TenderTestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister();


}

+ 21
- 21
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<AdaptStatusEnum, AdaptStateChangeEvent> build() throws StateMachineException {
StateMachine<AdaptStatusEnum, AdaptStateChangeEvent> stateMachine = build(beanFactory);
public StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> build() throws StateMachineException {
StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> stateMachine = build(beanFactory);
log.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}

@Override
public StateMachine<AdaptStatusEnum, AdaptStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
public StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
@@ -57,8 +57,8 @@ public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder {
}
}

private StateMachine<AdaptStatusEnum, AdaptStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<AdaptStatusEnum, AdaptStateChangeEvent> builder = StateMachineBuilder.builder();
private StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TenderAdaptStatusEnum, AdaptStateChangeEvent> 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<AdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<AdaptStatusEnum, AdaptStateChangeEvent, Purchase>() {
public StateMachinePersister<TenderAdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderAdaptStatusEnum, AdaptStateChangeEvent, Purchase>() {
@Override
public void write(StateMachineContext<AdaptStatusEnum, AdaptStateChangeEvent> context, Purchase contextObj) {
public void write(StateMachineContext<TenderAdaptStatusEnum, AdaptStateChangeEvent> context, Purchase contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<AdaptStatusEnum, AdaptStateChangeEvent> read(Purchase contextObj) {
AdaptStatusEnum status = AdaptStatusEnum.get(contextObj.getAdaptStatus())
public StateMachineContext<TenderAdaptStatusEnum, AdaptStateChangeEvent> read(Purchase contextObj) {
TenderAdaptStatusEnum status = TenderAdaptStatusEnum.get(contextObj.getAdaptStatus())
.orElseThrow(() -> BizException.wrap("系统自测状态无效"));
return new DefaultStateMachineContext<>(status, null, null, null, null, MACHINE_ID);
}


+ 21
- 21
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<SelfTestStatusEnum, SelfTestStateChangeEvent> build() throws StateMachineException {
StateMachine<SelfTestStatusEnum, SelfTestStateChangeEvent> stateMachine = build(beanFactory);
public StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> build() throws StateMachineException {
StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> stateMachine = build(beanFactory);
log.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}

@Override
public StateMachine<SelfTestStatusEnum, SelfTestStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
public StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
@@ -57,8 +57,8 @@ public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuil
}
}

private StateMachine<SelfTestStatusEnum, SelfTestStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<SelfTestStatusEnum, SelfTestStateChangeEvent> builder = StateMachineBuilder.builder();
private StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> 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<SelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<SelfTestStatusEnum, SelfTestStateChangeEvent, Purchase>() {
public StateMachinePersister<TenderSelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderSelfTestStatusEnum, SelfTestStateChangeEvent, Purchase>() {
@Override
public void write(StateMachineContext<SelfTestStatusEnum, SelfTestStateChangeEvent> context, Purchase contextObj) {
public void write(StateMachineContext<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> context, Purchase contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<SelfTestStatusEnum, SelfTestStateChangeEvent> read(Purchase contextObj) {
SelfTestStatusEnum status = SelfTestStatusEnum.get(contextObj.getSelfTestStatus())
public StateMachineContext<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> read(Purchase contextObj) {
TenderSelfTestStatusEnum status = TenderSelfTestStatusEnum.get(contextObj.getSelfTestStatus())
.orElseThrow(() -> BizException.wrap("系统自测状态无效"));
return new DefaultStateMachineContext<>(status, null, null, null, null, MACHINE_ID);
}


+ 21
- 21
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<TestValidStatusEnum, TestValidStateChangeEvent> build() throws StateMachineException {
StateMachine<TestValidStatusEnum, TestValidStateChangeEvent> stateMachine = build(beanFactory);
public StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> build() throws StateMachineException {
StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> stateMachine = build(beanFactory);
log.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}

@Override
public StateMachine<TestValidStatusEnum, TestValidStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
public StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
@@ -57,8 +57,8 @@ public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBu
}
}

private StateMachine<TestValidStatusEnum, TestValidStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TestValidStatusEnum, TestValidStateChangeEvent> builder = StateMachineBuilder.builder();
private StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TenderTestValidStatusEnum, TestValidStateChangeEvent> 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<TestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TestValidStatusEnum, TestValidStateChangeEvent, Purchase>() {
public StateMachinePersister<TenderTestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderTestValidStatusEnum, TestValidStateChangeEvent, Purchase>() {
@Override
public void write(StateMachineContext<TestValidStatusEnum, TestValidStateChangeEvent> context, Purchase contextObj) {
public void write(StateMachineContext<TenderTestValidStatusEnum, TestValidStateChangeEvent> context, Purchase contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<TestValidStatusEnum, TestValidStateChangeEvent> read(Purchase contextObj) {
TestValidStatusEnum testValidStatus = TestValidStatusEnum.get(contextObj.getTestValidStatus())
public StateMachineContext<TenderTestValidStatusEnum, TestValidStateChangeEvent> read(Purchase contextObj) {
TenderTestValidStatusEnum testValidStatus = TenderTestValidStatusEnum.get(contextObj.getTestValidStatus())
.orElseThrow(() -> BizException.wrap("测试验证状态无效"));
return new DefaultStateMachineContext<>(testValidStatus, null, null, null, null, MACHINE_ID);
}


+ 3
- 3
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<AdaptStatusEnum, AdaptStateChangeEvent> stateMachine = adaptStateMachineBuilder.build();
StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> stateMachine = adaptStateMachineBuilder.build();
Message<AdaptStateChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PURCHASE, purchase)
.build();
//初始化状态机
StateMachinePersister<AdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister = adaptStateMachineBuilder.stateMachinePersister();
StateMachinePersister<TenderAdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister = adaptStateMachineBuilder.stateMachinePersister();
stateMachinePersister.restore(stateMachine, purchase);
stateMachine.sendEvent(message);
log.info("调用状态机后的标段状态为:{}", purchase.getStatus());


+ 3
- 3
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<SelfTestStatusEnum, SelfTestStateChangeEvent> stateMachine = selfTestStateMachineBuilder.build();
StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> stateMachine = selfTestStateMachineBuilder.build();
Message<SelfTestStateChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PURCHASE, purchase)
.build();
//初始化状态机
StateMachinePersister<SelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister = selfTestStateMachineBuilder.stateMachinePersister();
StateMachinePersister<TenderSelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister = selfTestStateMachineBuilder.stateMachinePersister();
stateMachinePersister.restore(stateMachine, purchase);
stateMachine.sendEvent(message);
log.info("调用状态机后的标段状态为:{}", purchase.getStatus());


+ 3
- 3
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<TestValidStatusEnum, TestValidStateChangeEvent> stateMachine = testValidStateMachineBuilder.build();
StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> stateMachine = testValidStateMachineBuilder.build();
Message<TestValidStateChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PURCHASE, purchase)
.build();
//初始化状态机
StateMachinePersister<TestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister = testValidStateMachineBuilder.stateMachinePersister();
StateMachinePersister<TenderTestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister = testValidStateMachineBuilder.stateMachinePersister();
stateMachinePersister.restore(stateMachine, purchase);
stateMachine.sendEvent(message);
log.info("调用状态机后的标段状态为:{}", purchase.getStatus());


+ 26
- 4
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<TestValidListVO> pageTestValid(TestValidListReq req){
public PageVo<TestValidListVO> pageTestValid(TestValidListReq req) {
return purchaseManage.testValidList(req);
}

@GetMapping("/pageSelfTest")
@ApiOperation("获取系统自测列表")
public PageVo<TestValidListVO> pageSelfTest(TestValidListReq req){
public PageVo<TestValidListVO> pageSelfTest(TestValidListReq req) {
return purchaseManage.selfTestList(req);
}

@GetMapping("/pageAdaption")
@ApiOperation("获取适配改造列表")
public PageVo<TestValidListVO> pageAdaption(TestValidListReq req){
public PageVo<TestValidListVO> 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);
}

}

+ 6
- 6
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();
}


+ 140
- 3
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<Purchase> 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<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project);
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap);
Wrapper<Operation> 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<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project);
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap);
Wrapper<Operation> 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<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project);
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap);
Wrapper<Operation> 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);
}

}

+ 21
- 0
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;

}

+ 31
- 0
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;

/**
* <p>
* TestValidInfoReq
* </p>
*
* @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;

}

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/AdaptStatusEnum.java → 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<AdaptStatusEnum> get(Integer code) {
public static Optional<TenderAdaptStatusEnum> get(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst();

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/SelfTestStatusEnum.java → 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<SelfTestStatusEnum> get(Integer code) {
public static Optional<TenderSelfTestStatusEnum> get(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst();

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TestValidStatusEnum.java → 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<TestValidStatusEnum> get(Integer code) {
public static Optional<TenderTestValidStatusEnum> get(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst();

読み込み中…
キャンセル
保存