Преглед на файлове

项目状态优化

tags/24080901
WendyYang преди 9 месеца
родител
ревизия
fdffa6ac8e
променени са 11 файла, в които са добавени 38 реда и са изтрити 22 реда
  1. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java
  2. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java
  3. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java
  4. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java
  5. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/XcfhxStateMachineBuilderImpl.java
  6. +1
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
  7. +6
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderAdaptStatus.java
  8. +6
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderSelfTestStatus.java
  9. +8
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderStatus.java
  10. +6
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderTestValidStatus.java
  11. +6
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderXcfhxApplyStatus.java

+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java Целия файл

@@ -104,8 +104,7 @@ public class AdaptStateMachineBuilderImpl implements BaseStateMachineBuilder<Pur

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


+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java Целия файл

@@ -104,8 +104,7 @@ public class SelfTestStateMachineBuilderImpl implements BaseStateMachineBuilder<

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


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java Целия файл

@@ -131,7 +131,7 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Pu

@Override
public StateMachineContext<TenderStatus, TenderStateChangeEvent> read(Purchase contextObj) {
return new DefaultStateMachineContext<>(TenderStatus.getByStatus(contextObj.getStatus()),
return new DefaultStateMachineContext<>(TenderStatus.getNoNull(contextObj.getStatus()),
null, null, null, null, MACHINE_ID);
}
});


+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java Целия файл

@@ -104,8 +104,7 @@ public class TestValidStateMachineBuilderImpl implements BaseStateMachineBuilder

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


+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/XcfhxStateMachineBuilderImpl.java Целия файл

@@ -107,8 +107,7 @@ public class XcfhxStateMachineBuilderImpl implements BaseStateMachineBuilder<Pur

@Override
public StateMachineContext<TenderXcfhxApplyStatus, XcfhxStateChangeEvent> read(Purchase contextObj) {
TenderXcfhxApplyStatus status = TenderXcfhxApplyStatus.get(contextObj.getXcfhxApplyStatus())
.orElseThrow(() -> BizException.wrap("信创符合性申请状态无效"));
TenderXcfhxApplyStatus status = TenderXcfhxApplyStatus.getNoNull(contextObj.getXcfhxApplyStatus());
return new DefaultStateMachineContext<>(status, null, null, null, null, MACHINE_ID);
}
});


+ 1
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java Целия файл

@@ -5,10 +5,8 @@ import com.hz.pm.api.gov.enumeration.GovProjectStatusEnum;
import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

/**
@@ -79,7 +77,7 @@ public enum ProjectStatus implements IStatus<Integer, String> {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}

public static Optional<ProjectStatus> get(Integer code) {
private static Optional<ProjectStatus> get(Integer code) {
return Arrays.stream(values()).filter(w -> w.getCode().equals(code)).findFirst();
}



+ 6
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderAdaptStatus.java Целия файл

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectlib.model.enumeration.status;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@@ -27,10 +28,14 @@ public enum TenderAdaptStatus implements IStatus<Integer, String> {
private final Integer code;
private final String desc;

public static Optional<TenderAdaptStatus> get(Integer code) {
private static Optional<TenderAdaptStatus> get(Integer code) {
return Arrays.stream(values()).filter(w -> w.eq(code)).findFirst();
}

public static TenderAdaptStatus getNoNull(Integer code) {
return get(code).orElseThrow(() -> BizException.wrap("无效的适配改造状态:%s", code));
}

public static String getDesc(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}


+ 6
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderSelfTestStatus.java Целия файл

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectlib.model.enumeration.status;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@@ -27,12 +28,16 @@ public enum TenderSelfTestStatus implements IStatus<Integer, String> {
private final Integer code;
private final String desc;

public static Optional<TenderSelfTestStatus> get(Integer code) {
private static Optional<TenderSelfTestStatus> get(Integer code) {
return Arrays.stream(values())
.filter(w -> w.eq(code))
.findFirst();
}

public static TenderSelfTestStatus getNoNull(Integer code) {
return get(code).orElseThrow(() -> BizException.wrap("无效的系统自测状态:%s", code));
}

public static String getDesc(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}


+ 8
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderStatus.java Целия файл

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectlib.model.enumeration.status;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@@ -33,17 +34,18 @@ public enum TenderStatus implements IStatus<Integer, String> {
private final String desc;


public static TenderStatus getByStatus(Integer tenderStatus) {
private static Optional<TenderStatus> get(Integer tenderStatus) {
return Arrays.stream(values())
.filter(w -> w.eq(tenderStatus))
.findFirst()
.orElse(null);
.findFirst();
}

public static TenderStatus getNoNull(Integer tenderStatus) {
return get(tenderStatus).orElseThrow(() -> BizException.wrap("无效的标段状态:%s", tenderStatus));
}

public static String getDescByStatus(Integer tenderStatus) {
return Optional.ofNullable(getByStatus(tenderStatus))
.flatMap(w -> Optional.of(w.getDesc()))
.orElse(StrUtil.EMPTY);
return get(tenderStatus).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}

}

+ 6
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderTestValidStatus.java Целия файл

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectlib.model.enumeration.status;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@@ -27,10 +28,14 @@ public enum TenderTestValidStatus implements IStatus<Integer, String> {
private final Integer code;
private final String desc;

public static Optional<TenderTestValidStatus> get(Integer code) {
private static Optional<TenderTestValidStatus> get(Integer code) {
return Arrays.stream(values()).filter(w -> w.eq(code)).findFirst();
}

public static TenderTestValidStatus getNoNull(Integer code) {
return get(code).orElseThrow(() -> BizException.wrap("无效的测试验证状态:%s", code));
}

public static String getDesc(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}


+ 6
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderXcfhxApplyStatus.java Целия файл

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectlib.model.enumeration.status;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@@ -27,10 +28,14 @@ public enum TenderXcfhxApplyStatus implements IStatus<Integer, String> {
private final Integer code;
private final String desc;

public static Optional<TenderXcfhxApplyStatus> get(Integer code) {
private static Optional<TenderXcfhxApplyStatus> get(Integer code) {
return Arrays.stream(values()).filter(w -> w.eq(code)).findFirst();
}

public static TenderXcfhxApplyStatus getNoNull(Integer code) {
return get(code).orElseThrow(() -> BizException.wrap("无效的信创符合性审查状态:%s",code));
}

public static String getDesc(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}


Loading…
Отказ
Запис