1
This commit is contained in:
89
src/main/java/cn/van/business/enums/GroupType.java
Normal file
89
src/main/java/cn/van/business/enums/GroupType.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package cn.van.business.enums;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @version 1.0
|
||||
* @create 2023/12/19 0019 上午 10:27
|
||||
* @description:
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public enum GroupType implements IEnum {
|
||||
|
||||
/**
|
||||
* 类型,1管理群,2评论群,3线报来源群,4线报推送群
|
||||
* */
|
||||
MANAGEMENT(1, "管理群"),
|
||||
COMMENT(2, "评论群"),
|
||||
LINE_REPORT_SOURCE(3, "线报来源群"),
|
||||
LINE_REPORT_PUSH(4, "线报推送群");
|
||||
private final int key;
|
||||
|
||||
private final String name;
|
||||
|
||||
GroupType(int key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static GroupType get(int key) {
|
||||
for (GroupType e : GroupType.values()) {
|
||||
if (e.getKey() == key) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getName(Integer key) {
|
||||
//if (Object.isNotEmpty(key)) {
|
||||
GroupType[] items = GroupType.values();
|
||||
for (GroupType item : items) {
|
||||
if (item.getKey() == key) {
|
||||
return item.getName();
|
||||
}
|
||||
}
|
||||
//}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Map<String, String> getKeyVlue() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
GroupType[] items = GroupType.values();
|
||||
for (GroupType item : items) {
|
||||
map.put(item.getKey() + "", item.getName());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> getSelectItems() {
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
GroupType[] items = GroupType.values();
|
||||
for (GroupType item : items) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("label", item.getName());
|
||||
map.put("value", item.getKey());
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Map;
|
||||
* @create 2023/12/19 0019 下午 02:31
|
||||
* @description:
|
||||
*/
|
||||
public enum MsgTypeEnum implements IEnum {
|
||||
public enum MsgType implements IEnum {
|
||||
/**
|
||||
msgType :
|
||||
1|文本 3|图片 34|语音
|
||||
@@ -38,13 +38,13 @@ public enum MsgTypeEnum implements IEnum {
|
||||
|
||||
private final String name;
|
||||
|
||||
MsgTypeEnum(int key, String name) {
|
||||
MsgType(int key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static String getName(Integer key) {
|
||||
for (MsgTypeEnum msgTypeEnum : MsgTypeEnum.values()) {
|
||||
for (MsgType msgTypeEnum : MsgType.values()) {
|
||||
if (msgTypeEnum.key == key) {
|
||||
return msgTypeEnum.name;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public enum MsgTypeEnum implements IEnum {
|
||||
|
||||
public static Map<String, String> getKeyVlue() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (MsgTypeEnum msgTypeEnum : MsgTypeEnum.values()) {
|
||||
for (MsgType msgTypeEnum : MsgType.values()) {
|
||||
map.put(msgTypeEnum.key + "", msgTypeEnum.name);
|
||||
}
|
||||
return map;
|
||||
@@ -62,7 +62,7 @@ public enum MsgTypeEnum implements IEnum {
|
||||
|
||||
public static List<Map<String, Object>> getSelectItems() {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (MsgTypeEnum msgTypeEnum : MsgTypeEnum.values()) {
|
||||
for (MsgType msgTypeEnum : MsgType.values()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("key", msgTypeEnum.key);
|
||||
map.put("value", msgTypeEnum.name);
|
||||
@@ -71,8 +71,8 @@ public enum MsgTypeEnum implements IEnum {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static MsgTypeEnum get(int key) {
|
||||
for (MsgTypeEnum msgTypeEnum : MsgTypeEnum.values()) {
|
||||
public static MsgType get(int key) {
|
||||
for (MsgType msgTypeEnum : MsgType.values()) {
|
||||
if (msgTypeEnum.key == key) {
|
||||
return msgTypeEnum;
|
||||
}
|
||||
Reference in New Issue
Block a user