新增微信公众号枚举类

master
星期八 6 years ago
parent d5827b85c2
commit 2a643b85ae
  1. 66
      src/main/java/com/lq/cms/emun/WechatAccessTokenTypeEnum.java
  2. 66
      src/main/java/com/lq/cms/emun/WechatInfoTypeEnum.java

@ -0,0 +1,66 @@
package com.lq.cms.emun;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: qi
* @Description: 微信公众号令牌类型
* @Date: Create in 10:13 PM 2019/3/16
*/
public enum WechatAccessTokenTypeEnum {
CURRENCY(1,"普通令牌"),
PAGE_AUTHORIZATION(2,"页面授权")
;
WechatAccessTokenTypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
private Integer value;
private String desc;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
private static Map<Integer,String> enumMap = new HashMap<>(WechatAccessTokenTypeEnum.values().length);
static {
WechatAccessTokenTypeEnum[] wechatAccessTokenTypeEnums = WechatAccessTokenTypeEnum.values();
for (WechatAccessTokenTypeEnum wechatAccessTokenTypeEnum:wechatAccessTokenTypeEnums){
enumMap.put(wechatAccessTokenTypeEnum.value,wechatAccessTokenTypeEnum.desc);
}
}
public static boolean hasValue(int value){
return enumMap.containsKey(value);
}
public static Map<Integer, String> getEnumMap(){
return enumMap;
}
public static String getDesc(int value){
return enumMap.get(value);
}
}

@ -0,0 +1,66 @@
package com.lq.cms.emun;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: qi
* @Description: 微信公众号类型枚举
* @Date: Create in 9:44 AM 2019/3/15
*/
public enum WechatInfoTypeEnum {
SUBSCRIBE(1,"订阅号"),
SERVICE(2,"服务号"),
ENTERPRISE(3,"企业号")
;
WechatInfoTypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
private Integer value;
private String desc;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
private static Map<Integer,String> enumMap = new HashMap<>(WechatInfoTypeEnum.values().length);
static {
WechatInfoTypeEnum[] wechatInfoTypeEnums = WechatInfoTypeEnum.values();
for (WechatInfoTypeEnum wechatInfoTypeEnum:wechatInfoTypeEnums){
enumMap.put(wechatInfoTypeEnum.value,wechatInfoTypeEnum.desc);
}
}
public static boolean hasValue(int value){
return enumMap.containsKey(value);
}
public static Map<Integer, String> getEnumMap(){
return enumMap;
}
public static String getDesc(int value){
return enumMap.get(value);
}
}
Loading…
Cancel
Save