Browse Source

增加办理渠道枚举类

master
WendyYang 8 months ago
parent
commit
6b629e5f76
3 changed files with 102 additions and 0 deletions
  1. +30
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java
  2. +42
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java
  3. +30
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java

+ 30
- 0
kqapi/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java View File

@@ -0,0 +1,30 @@
package com.ningdatech.kqapi.admin.model.enumerization;

import com.ningdatech.kqapi.common.enumeration.IEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* <p>
* HandleChannelEnum
* </p>
*
* @author WendyYang
* @since 10:09 2024/4/22
*/
@Getter
@AllArgsConstructor
public enum HandleChannelEnum implements IEnum<Integer, String, HandleChannelEnum> {

HANDLE_ON_WINDOW(1, "现场窗口申请"),
HANDLE_ON_NETWORK(2, "全程网办");

private final Integer code;
private final String desc;

@Override
public HandleChannelEnum[] all() {
return values();
}

}

+ 42
- 0
kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.kqapi.common.enumeration;

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

/**
* <p>
* IEnum-通用枚举类接口
* </p>
*
* @author WendyYang
* @since 10:10 2024/4/22
*/
public interface IEnum<C, V, E extends Enum<E> & IEnum<C, V, E>> {

E[] all();

C getCode();

V getDesc();

default boolean eq(C code) {
return getCode().equals(code);
}

default Optional<E> 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);
}

}

+ 30
- 0
kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java View File

@@ -0,0 +1,30 @@
package com.ningdatech.kqapi.common.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* <p>
* ImplSubjectNatureEnum
* </p>
*
* @author WendyYang
* @since 10:39 2024/4/22
*/
@Getter
@AllArgsConstructor
public enum ImplSubjectNatureEnum implements IEnum<Integer, String, ImplSubjectNatureEnum> {

STATUTORY_AUTHORITIES(1, "法定机关"),
THIRD_PARTY_INTERMEDIARIES(2, "第三方中介服务");

private final Integer code;
private final String desc;


@Override
public ImplSubjectNatureEnum[] all() {
return values();
}

}

Loading…
Cancel
Save