diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java new file mode 100644 index 0000000..a450227 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java @@ -0,0 +1,30 @@ +package com.ningdatech.kqapi.admin.model.enumerization; + +import com.ningdatech.kqapi.common.enumeration.IEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * HandleChannelEnum + *

+ * + * @author WendyYang + * @since 10:09 2024/4/22 + */ +@Getter +@AllArgsConstructor +public enum HandleChannelEnum implements IEnum { + + HANDLE_ON_WINDOW(1, "现场窗口申请"), + HANDLE_ON_NETWORK(2, "全程网办"); + + private final Integer code; + private final String desc; + + @Override + public HandleChannelEnum[] all() { + return values(); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java new file mode 100644 index 0000000..93354ee --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java @@ -0,0 +1,42 @@ +package com.ningdatech.kqapi.common.enumeration; + +import java.util.Arrays; +import java.util.Optional; + +/** + *

+ * IEnum-通用枚举类接口 + *

+ * + * @author WendyYang + * @since 10:10 2024/4/22 + */ +public interface IEnum & IEnum> { + + E[] all(); + + C getCode(); + + V getDesc(); + + default boolean eq(C code) { + return getCode().equals(code); + } + + default Optional getByCode(C code) { + return Arrays.stream(all()) + .filter(w -> w.getCode().equals(code)) + .findFirst(); + } + + default E getNoNull(C code) { + return Arrays.stream(all()) + .filter(w -> w.getCode().equals(code)).findFirst() + .orElseThrow(() -> new IllegalArgumentException("编码对应枚举值不存在")); + } + + default V getDesc(C code) { + return getByCode(code).flatMap(w -> Optional.of(w.getDesc())).orElse(null); + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java new file mode 100644 index 0000000..7242c52 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java @@ -0,0 +1,30 @@ +package com.ningdatech.kqapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * ImplSubjectNatureEnum + *

+ * + * @author WendyYang + * @since 10:39 2024/4/22 + */ +@Getter +@AllArgsConstructor +public enum ImplSubjectNatureEnum implements IEnum { + + STATUTORY_AUTHORITIES(1, "法定机关"), + THIRD_PARTY_INTERMEDIARIES(2, "第三方中介服务"); + + private final Integer code; + private final String desc; + + + @Override + public ImplSubjectNatureEnum[] all() { + return values(); + } + +}