From 7434f0f500cbe0377568d4e8c5b3816894dbf934 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 22 Apr 2024 16:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E9=A1=B9=E8=AF=A6=E6=83=85=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=97=A0=E5=8F=82=E6=9E=84=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/enumerization/HandleChannelEnum.java | 7 +- .../kqapi/admin/model/vo/MatterDetailDTO.java | 7 + .../kqapi/common/enumeration/BoolDisplayEnum.java | 32 ----- .../kqapi/common/enumeration/ExportOptionEnum.java | 157 --------------------- .../ningdatech/kqapi/common/enumeration/IEnum.java | 32 +++-- .../common/enumeration/ImplSubjectNatureEnum.java | 8 +- .../enumeration/ProjectProcessStageEnum.java | 39 ----- .../kqapi/zzsfw/enumeration/ItemTypeEnum.java | 34 ++--- .../kqapi/zzsfw/manage/MatterManage.java | 1 + 9 files changed, 47 insertions(+), 270 deletions(-) delete mode 100644 kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/BoolDisplayEnum.java delete mode 100644 kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/ExportOptionEnum.java delete mode 100644 kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/ProjectProcessStageEnum.java diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java index a450227..f241bcd 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/enumerization/HandleChannelEnum.java @@ -14,7 +14,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum HandleChannelEnum implements IEnum { +public enum HandleChannelEnum implements IEnum { HANDLE_ON_WINDOW(1, "现场窗口申请"), HANDLE_ON_NETWORK(2, "全程网办"); @@ -22,9 +22,4 @@ public enum HandleChannelEnum implements IEnum & IEnum> { - - E[] all(); +public interface IEnum { - C getCode(); + Integer getCode(); - V getDesc(); + String getDesc(); - default boolean eq(C code) { + default boolean eq(Integer code) { return getCode().equals(code); } - default Optional getByCode(C code) { - return Arrays.stream(all()) + static > List all(Class eClass) { + return EnumUtils.getEnumList(eClass); + } + + static & IEnum> Optional getByCode(Class eClass, Integer code) { + return all(eClass).stream() .filter(w -> w.getCode().equals(code)) .findFirst(); } - default E getNoNull(C code) { - return Arrays.stream(all()) + static & IEnum> E getNoNull(Class eClass, Integer code) { + return all(eClass).stream() .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); + static & IEnum> String getDesc(Class eclass, Integer code) { + return getByCode(eclass, code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); } + } diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java index 7242c52..4be932c 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/ImplSubjectNatureEnum.java @@ -13,7 +13,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum ImplSubjectNatureEnum implements IEnum { +public enum ImplSubjectNatureEnum implements IEnum { STATUTORY_AUTHORITIES(1, "法定机关"), THIRD_PARTY_INTERMEDIARIES(2, "第三方中介服务"); @@ -21,10 +21,4 @@ public enum ImplSubjectNatureEnum implements IEnum + * ItemTypeEnum + *

+ * + * @author WendyYang + * @since 15:50 2024/4/22 + */ @Getter @AllArgsConstructor -@NoArgsConstructor -public enum ItemTypeEnum { +public enum ItemTypeEnum implements IEnum { + /** * 事项类型 枚举 */ - GOV(1,"政府服务"), - ADDED(2,"增值服务"), - SPECIAL(3,"特殊服务"); + GOV(1, "政府服务"), + ADDED(2, "增值服务"), + SPECIAL(3, "特殊服务"); - private Integer code; - private String desc; + private final Integer code; + private final String desc; public static ItemTypeEnum match(Integer code) { - if (Objects.isNull(code)) { - return null; - } - for (ItemTypeEnum t : ItemTypeEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; + return IEnum.getByCode(ItemTypeEnum.class, code).orElse(null); } + } diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java index 6bd4a8d..3aca74c 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java @@ -132,6 +132,7 @@ public class MatterManage { public List getDepartments(String zoneName,String windowName) { List matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class) + .select(KqZzsfwMenu::getDepartment,KqZzsfwMenu::getType,KqZzsfwMenu::getWebapplyurl) .eq(StringUtils.isNotBlank(windowName), KqZzsfwMenu::getWindow,windowName) .eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName,zoneName) .orderByAsc(KqZzsfwMenu::getSort));