feat(REQ-4418) - 测试枚举转 Unknown
This commit is contained in:
parent
c387eee91b
commit
6c79770796
@ -1,16 +1,26 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 新版配置下的发起人自选的范围限定枚举
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2025-08-13 15:13
|
||||
*/
|
||||
@Getter
|
||||
public enum InitiatorSpecifiedRangeEnum {
|
||||
self_and_children_in_project("self_and_children_in_project", "项目内本组织及其下属组织所有成员"),
|
||||
self_in_project("self_in_project", "项目内本组织所有成员"),
|
||||
in_project("in_project", "项目内所有成员"),
|
||||
in_ent("in_ent", "企业内所有成员"),
|
||||
@JsonEnumDefaultValue
|
||||
unknown("unknown", "未知"),
|
||||
;
|
||||
private final String type;
|
||||
private final String desc;
|
||||
@ -20,11 +30,19 @@ public enum InitiatorSpecifiedRangeEnum {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
@JsonCreator
|
||||
public static InitiatorSpecifiedRangeEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return unknown;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getType().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(unknown);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 模型业务类型枚举
|
||||
@ -9,10 +13,13 @@ import java.util.Objects;
|
||||
* @author wangli
|
||||
* @since 2025-03-26 11:49
|
||||
*/
|
||||
@Getter
|
||||
public enum ModelBizTypeEnum {
|
||||
|
||||
SIGN("SIGN", "签署业务"),
|
||||
FLOWABLE("FLOWABLE", "审批业务"),
|
||||
@JsonEnumDefaultValue
|
||||
UNKNOWN("UNKNOWN", "未知"),
|
||||
;
|
||||
private final String type;
|
||||
private final String desc;
|
||||
@ -22,18 +29,23 @@ public enum ModelBizTypeEnum {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
public static ModelBizTypeEnum valueOfType(String type) {
|
||||
return fromValue(type);
|
||||
}
|
||||
|
||||
public static ModelBizTypeEnum valueOfType(String type) {
|
||||
return Arrays.stream(ModelBizTypeEnum.values())
|
||||
.filter(i -> Objects.equals(i.getType(), type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
@JsonCreator
|
||||
public static ModelBizTypeEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getType().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,32 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 顺序操作枚举
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2025-03-31 16:35
|
||||
*/
|
||||
@Getter
|
||||
public enum OrderEnum {
|
||||
|
||||
UP, DOWN
|
||||
UP, DOWN,
|
||||
@JsonEnumDefaultValue
|
||||
UNKNOWN;
|
||||
|
||||
@JsonCreator
|
||||
public static OrderEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.name().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,18 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 打印字段的类型枚举
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2025-01-16 18:19
|
||||
*/
|
||||
@Getter
|
||||
public enum PrintFieldCategoryEnum {
|
||||
|
||||
// 表单变量
|
||||
@ -15,5 +22,19 @@ public enum PrintFieldCategoryEnum {
|
||||
// 电子签名变量
|
||||
signature,
|
||||
// 签署业务自定义变量
|
||||
sign
|
||||
sign,
|
||||
@JsonEnumDefaultValue
|
||||
unknown,
|
||||
;
|
||||
|
||||
@JsonCreator
|
||||
public static PrintFieldCategoryEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return unknown;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.name().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(unknown);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 签署确认节点的审批人层级范围限制
|
||||
@ -9,6 +13,7 @@ import java.util.Objects;
|
||||
* @author wangli
|
||||
* @since 2025-03-26 14:30
|
||||
*/
|
||||
@Getter
|
||||
public enum SignApproverOrgLimitEnum {
|
||||
LV_0("LV_0", "当前组织", 0),
|
||||
LV_1("LV_1", "上1级组织", 1),
|
||||
@ -18,13 +23,11 @@ public enum SignApproverOrgLimitEnum {
|
||||
LV_5("LV_5", "上5级组织", 5),
|
||||
LV_ALL("LV_ALL", "所有组织", -1),
|
||||
LV_TOP("LV_TOP", "顶层组织", Integer.MAX_VALUE),
|
||||
UNKNOWN("UNKNOWN", "未知层级", null)
|
||||
;
|
||||
@JsonEnumDefaultValue
|
||||
UNKNOWN("UNKNOWN", "未知层级", null);
|
||||
|
||||
private final String type;
|
||||
|
||||
private final String desc;
|
||||
|
||||
private final Integer code;
|
||||
|
||||
SignApproverOrgLimitEnum(String type, String desc, Integer code) {
|
||||
@ -33,22 +36,23 @@ public enum SignApproverOrgLimitEnum {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static SignApproverOrgLimitEnum valueOfType(String type) {
|
||||
return Arrays.stream(SignApproverOrgLimitEnum.values())
|
||||
.filter(i -> Objects.equals(i.getType(), type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
return fromValue(type);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static SignApproverOrgLimitEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getType().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -9,12 +14,13 @@ import java.util.Objects;
|
||||
* @author wangli
|
||||
* @since 2025-03-26 14:30
|
||||
*/
|
||||
@Getter
|
||||
public enum SignApproverRoleLimitEnum {
|
||||
LEADER("LEADER", "负责人"),
|
||||
;
|
||||
@JsonEnumDefaultValue
|
||||
UNKNOWN("UNKNOWN", "未知");
|
||||
|
||||
private final String type;
|
||||
|
||||
private final String desc;
|
||||
|
||||
SignApproverRoleLimitEnum(String type, String desc) {
|
||||
@ -22,18 +28,26 @@ public enum SignApproverRoleLimitEnum {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static SignApproverRoleLimitEnum valueOfType(String type) {
|
||||
return Arrays.stream(SignApproverRoleLimitEnum.values())
|
||||
.filter(i -> Objects.equals(i.getType(), type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static SignApproverRoleLimitEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getType().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 时间查询方向
|
||||
* <p>
|
||||
@ -9,8 +15,22 @@ package cn.axzo.workflow.common.enums;
|
||||
* @author wangli
|
||||
* @since 2024-09-29 09:56
|
||||
*/
|
||||
@Getter
|
||||
public enum TimeQueryDirection {
|
||||
BEFORE,
|
||||
AFTER,
|
||||
@JsonEnumDefaultValue
|
||||
UNKNOWN,
|
||||
;
|
||||
|
||||
@JsonCreator
|
||||
public static TimeQueryDirection fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.name().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +1,45 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 模版上变量字段类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
public enum VarTypeEnum {
|
||||
|
||||
TEXT("text", "文本"),
|
||||
PICTURE("picture", "图片"),
|
||||
@JsonEnumDefaultValue
|
||||
UNKNOWN("unknown", "未知"),
|
||||
;
|
||||
|
||||
PICTURE("picture", "图片");
|
||||
private final String type;
|
||||
private final String desc;
|
||||
|
||||
private String type;
|
||||
private String desc;
|
||||
VarTypeEnum(String type, String desc) {
|
||||
this.type = type;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static VarTypeEnum fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getType().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -10,7 +11,6 @@ import java.util.Arrays;
|
||||
* @date 2023/11/21
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WorkspaceType {
|
||||
|
||||
/**
|
||||
@ -21,15 +21,32 @@ public enum WorkspaceType {
|
||||
PROJECT(2, "项目"),
|
||||
GOVERNMENT(3, "政务监管平台"),
|
||||
OMS(6, "oms工作台"),
|
||||
@JsonEnumDefaultValue
|
||||
UN_KNOW(0, "未知"),
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
WorkspaceType(Integer code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static WorkspaceType getType(Integer code) {
|
||||
return Arrays.stream(values()).filter(it -> it.getCode().equals(code))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static WorkspaceType fromValue(String value) {
|
||||
if (value == null) {
|
||||
return UN_KNOW;
|
||||
}
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getCode().toString().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(UN_KNOW);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ import cn.axzo.workflow.server.common.util.ShellUtil;
|
||||
import cn.axzo.workflow.server.xxljob.EsIndexOperationJobHandler;
|
||||
import cn.axzo.workflow.server.xxljob.SpecifyProcessInstanceSyncEsJobHandler;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
@ -290,7 +291,7 @@ public class TestController {
|
||||
}*/
|
||||
|
||||
@GetMapping("log")
|
||||
public String log(@RequestParam String keyword, @RequestParam(required = false) Date date, @RequestParam(required = false) String grepKeyword) throws Exception {
|
||||
public String log(@RequestParam String keyword, @RequestParam(required = false) String date, @RequestParam(required = false) String grepKeyword) throws Exception {
|
||||
if (!StringUtils.hasText(keyword)) {
|
||||
return "命令不能为空";
|
||||
}
|
||||
@ -298,7 +299,7 @@ public class TestController {
|
||||
if (StringUtils.hasText(s)) {
|
||||
return s;
|
||||
}
|
||||
return ShellUtil.grepLog(profile, keyword, Objects.isNull(date) ? new Date() : date, grepKeyword);
|
||||
return ShellUtil.grepLog(profile, keyword, StringUtils.hasText(date) ? DateUtil.parseDate(date) : new Date(), grepKeyword);
|
||||
}
|
||||
|
||||
@GetMapping("form")
|
||||
|
||||
@ -30,4 +30,5 @@ public class StarterFeignClientConfiguration {
|
||||
public static class WorkflowManageServiceClient {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import cn.axzo.workflow.starter.mq.check.ImplementationReadyChecker;
|
||||
import cn.axzo.workflow.starter.mq.monitor.WorkflowEngineStarterDefaultMQMonitor;
|
||||
import cn.axzo.workflow.starter.mq.monitor.console.WorkflowEngineStarterMQMonitorController;
|
||||
import cn.axzo.workflow.starter.selector.MetaFeignClientEnableSelector;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.rocketmq.client.exception.MQClientException;
|
||||
import org.apache.rocketmq.common.MixAll;
|
||||
@ -37,7 +38,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -161,4 +164,9 @@ public class WorkflowEngineStarterAutoConfiguration {
|
||||
return new ImplementationReadyChecker();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "enumUnknownCustomizer")
|
||||
public Jackson2ObjectMapperBuilderCustomizer enumUnKnowCustomizer() {
|
||||
return builder -> builder.featuresToEnable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user