From afe2ba8ff2a648a8ca9137c3542903abb155fc5b Mon Sep 17 00:00:00 2001 From: qi_liang Date: Thu, 16 May 2019 15:35:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=96=B9=E5=BC=8F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lq/cms/emun/WechatRuleReplyTypeEnum.java | 66 +++++++++++++++++++ .../cms/web/wechat/WechatRuleController.java | 3 + .../views/jsp/cms/wechat/rule/index.jsp | 4 +- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/lq/cms/emun/WechatRuleReplyTypeEnum.java diff --git a/src/main/java/com/lq/cms/emun/WechatRuleReplyTypeEnum.java b/src/main/java/com/lq/cms/emun/WechatRuleReplyTypeEnum.java new file mode 100644 index 0000000..033827d --- /dev/null +++ b/src/main/java/com/lq/cms/emun/WechatRuleReplyTypeEnum.java @@ -0,0 +1,66 @@ +package com.lq.cms.emun; + +import javax.persistence.criteria.CriteriaBuilder; +import java.util.HashMap; +import java.util.Map; + +/** + * @Author: qi + * @Description: + * @Date: Create in 3:14 PM 2019/5/16 + */ +public enum WechatRuleReplyTypeEnum { + REPLY_ALL(1,"全回复"), + REPLY_RANDOM(2,"随机回复") + ; + + WechatRuleReplyTypeEnum(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 enumMap = new HashMap(); + + static { + WechatRuleReplyTypeEnum[] wechatRuleReplyTypeEnums = WechatRuleReplyTypeEnum.values(); + for (WechatRuleReplyTypeEnum wechatRuleReplyTypeEnum:wechatRuleReplyTypeEnums) { + enumMap.put(wechatRuleReplyTypeEnum.value, wechatRuleReplyTypeEnum.desc); + } + } + + //判断是否存在值 + public static boolean hasValue(String value){ + + return enumMap.containsKey(value); + } + + public static String getDesc(Integer value){ + + return enumMap.get(value); + } + + public static Map getEnumMap(){ + + return enumMap; + } +} diff --git a/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java b/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java index c67b67a..a3daa09 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java @@ -2,6 +2,7 @@ package com.lq.cms.web.wechat; import com.alibaba.fastjson.JSON; import com.lq.cms.emun.WechatKeywordMatchinTypeEnum; +import com.lq.cms.emun.WechatRuleReplyTypeEnum; import com.lq.cms.service.WechatInfoService; import com.lq.cms.vo.WechatRuleVo; import com.lq.code.entity.AjaxResult; @@ -37,6 +38,8 @@ public class WechatRuleController { } Map wechatKeywordMatchinTypeMap = WechatKeywordMatchinTypeEnum.getEnumMap(); modelAndView.addObject("wechatKeywordMatchinTypeMap",wechatKeywordMatchinTypeMap); + Map wehcatRuleReplyTypeMap = WechatRuleReplyTypeEnum.getEnumMap(); + modelAndView.addObject("wehcatRuleReplyTypeMap",wehcatRuleReplyTypeMap); modelAndView.setViewName("cms/wechat/rule/index"); return modelAndView; } diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp index e660e73..b4e5055 100755 --- a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp @@ -138,7 +138,9 @@
- 全回复 随机回复 + + ${wehcatRuleReplyType.value} +