diff --git a/src/main/java/com/lq/cms/emun/WechatKeywordMatchinTypeEnum.java b/src/main/java/com/lq/cms/emun/WechatKeywordMatchinTypeEnum.java new file mode 100644 index 0000000..49179f9 --- /dev/null +++ b/src/main/java/com/lq/cms/emun/WechatKeywordMatchinTypeEnum.java @@ -0,0 +1,61 @@ +package com.lq.cms.emun; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author: qi + * @Description: + * @Date: Create in 3:04 PM 2019/5/14 + */ +public enum WechatKeywordMatchinTypeEnum { + KEYWORD_ALL(1,"全匹配"), + KEYWORD_SECTION(2,"半匹配") + ; + WechatKeywordMatchinTypeEnum(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<>(WechatInfoTypeEnum.values().length); + + static { + WechatKeywordMatchinTypeEnum[] wechatKeywordMatchinTypeEnums = WechatKeywordMatchinTypeEnum.values(); + for (WechatKeywordMatchinTypeEnum wechatKeywordMatchinTypeEnum:wechatKeywordMatchinTypeEnums){ + enumMap.put(wechatKeywordMatchinTypeEnum.value,wechatKeywordMatchinTypeEnum.desc); + } + } + + public static boolean hasValue(int value){ + + return enumMap.containsKey(value); + } + + public static Map getEnumMap(){ + + return enumMap; + } + + public static String getDesc(int value){ + + return enumMap.get(value); + } +} diff --git a/src/main/java/com/lq/cms/mode/ZtreeItem.java b/src/main/java/com/lq/cms/mode/ZtreeItem.java index d53c4f1..5a9b6a7 100755 --- a/src/main/java/com/lq/cms/mode/ZtreeItem.java +++ b/src/main/java/com/lq/cms/mode/ZtreeItem.java @@ -12,7 +12,6 @@ public class ZtreeItem extends ZtreeComposite{ public List children=new ArrayList<>(); private String iconCls; private String state; - private Map attributes; public String getIconCls() { return iconCls; @@ -31,13 +30,6 @@ public class ZtreeItem extends ZtreeComposite{ } - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } public List getChildren() { return children; diff --git a/src/main/java/com/lq/cms/vo/WechatRuleVo.java b/src/main/java/com/lq/cms/vo/WechatRuleVo.java new file mode 100644 index 0000000..c4fbe69 --- /dev/null +++ b/src/main/java/com/lq/cms/vo/WechatRuleVo.java @@ -0,0 +1,97 @@ +package com.lq.cms.vo; + +import java.util.Date; + +/** + * @Author: qi + * @Description: + * @Date: Create in 5:05 PM 2019/5/13 + */ +public class WechatRuleVo { + + /** + * 规则名称 + */ + private String ruleName; + /** + * 创建时间 + */ + private Date createTime; + /** + * 创建用户 + */ + private Long createUserId; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 更新用户 + */ + private Long updateUserId; + /** + * 关联微信公众号ID + */ + private Long wechatInfoId; + + /** + * 回复类型(全回复,随机回复) + */ + private Integer replyType ; + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Long getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(Long createUserId) { + this.createUserId = createUserId; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Long getUpdateUserId() { + return updateUserId; + } + + public void setUpdateUserId(Long updateUserId) { + this.updateUserId = updateUserId; + } + + public Long getWechatInfoId() { + return wechatInfoId; + } + + public void setWechatInfoId(Long wechatInfoId) { + this.wechatInfoId = wechatInfoId; + } + + public Integer getReplyType() { + return replyType; + } + + public void setReplyType(Integer replyType) { + this.replyType = replyType; + } +} diff --git a/src/main/java/com/lq/cms/web/LoginController.java b/src/main/java/com/lq/cms/web/LoginController.java index 97591d4..3222b32 100755 --- a/src/main/java/com/lq/cms/web/LoginController.java +++ b/src/main/java/com/lq/cms/web/LoginController.java @@ -48,7 +48,6 @@ public class LoginController extends BaseController{ @RequestMapping(value = {"/index",""}) public String toLogin(){ - return "cms/login"; } diff --git a/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java b/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java index 50ddf3e..68023b1 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java @@ -1,9 +1,6 @@ package com.lq.cms.web.wechat; -import com.lq.cms.emun.StatusTypeEnum; -import com.lq.cms.emun.WechatInfoCertificationTypeEnum; -import com.lq.cms.emun.WechatInfoEncodingTypeEnum; -import com.lq.cms.emun.WechatInfoTypeEnum; +import com.lq.cms.emun.*; import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.service.WechatInfoService; import com.lq.cms.vo.WechatInfoVo; @@ -75,10 +72,15 @@ public class WechatInfoController { @RequestMapping("/save") public Object save(WechatInfoVo vo){ Date nowTime = new Date(); + Subject subject= SecurityUtils.getSubject(); + SysUser loginUser=(SysUser) subject.getPrincipal(); AjaxResult ajaxResult = new AjaxResult(); WechatInfo wechatInfo = new WechatInfo(); BeanUtils.copyProperties(vo,wechatInfo); wechatInfo.setCreateTime(nowTime); + wechatInfo.setCreateUserId(loginUser.getId()); + //公众号新增默认关闭回复 + wechatInfo.setOpenReply(WechatInfoOpenReplyTypeEnum.OPEN_ON.getValue()); wechatInfo.setStatus(StatusTypeEnum.STATUS_ACTIVITY_YES.getValue()); wechatInfoService.save(wechatInfo); return ajaxResult; 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 6a1e847..c67b67a 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java @@ -1,12 +1,23 @@ package com.lq.cms.web.wechat; +import com.alibaba.fastjson.JSON; +import com.lq.cms.emun.WechatKeywordMatchinTypeEnum; import com.lq.cms.service.WechatInfoService; +import com.lq.cms.vo.WechatRuleVo; +import com.lq.code.entity.AjaxResult; +import com.lq.code.util.BeanUtil; import com.lq.entity.WechatInfo; +import com.lq.entity.WechatKeyword; +import com.lq.entity.WechatRule; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; +import java.util.List; +import java.util.Map; + /** * 微信公众号消息回复 * Created by qi_liang on 2018/5/30. @@ -24,11 +35,31 @@ public class WechatRuleController { WechatInfo wechatInfo = wechatInfoService.findOne(wechatInfoId); modelAndView.addObject("wechatInfo",wechatInfo); } - + Map wechatKeywordMatchinTypeMap = WechatKeywordMatchinTypeEnum.getEnumMap(); + modelAndView.addObject("wechatKeywordMatchinTypeMap",wechatKeywordMatchinTypeMap); modelAndView.setViewName("cms/wechat/rule/index"); return modelAndView; } + /** + * 保存消息回复规则 + * @param vo + * @param keywordListStr 关键字集合(json字符串) + * @param messageListStr 消息集合(json字符串) + * @param wechatInfoId 微信公众号详情ID + * @return + */ + @ResponseBody + @RequestMapping("/save") + public Object save(WechatRuleVo vo,String keywordListStr,String messageListStr,Long wechatInfoId){ + AjaxResult ajaxResult = new AjaxResult(); + WechatRule wechatRule = new WechatRule(); + List wechatKeywordList = JSON.parseArray(keywordListStr,WechatKeyword.class); + BeanUtil.copyNotNull(wechatRule,vo); + + return ajaxResult; + } + } diff --git a/src/main/java/com/lq/dao/SysUserRoleDao.java b/src/main/java/com/lq/dao/SysUserRoleDao.java index 5169aac..21e7139 100755 --- a/src/main/java/com/lq/dao/SysUserRoleDao.java +++ b/src/main/java/com/lq/dao/SysUserRoleDao.java @@ -12,7 +12,6 @@ import java.util.Map; */ public interface SysUserRoleDao extends BaseDao { - Long save(SysUserRole sysUserRole); List findByUserIdAndRoleId(Map params); diff --git a/src/main/java/com/lq/dao/WechatMessageDao.java b/src/main/java/com/lq/dao/WechatMessageDao.java index dd3a9c0..2933af8 100755 --- a/src/main/java/com/lq/dao/WechatMessageDao.java +++ b/src/main/java/com/lq/dao/WechatMessageDao.java @@ -9,7 +9,4 @@ import java.util.List; public interface WechatMessageDao extends AdminBaseDao { - List findListPage(WechatMessageVo vo); - - int count(WechatMessageVo vo); } diff --git a/src/main/java/com/lq/entity/WechatKeyword.java b/src/main/java/com/lq/entity/WechatKeyword.java index 3eb97a9..fd898fe 100755 --- a/src/main/java/com/lq/entity/WechatKeyword.java +++ b/src/main/java/com/lq/entity/WechatKeyword.java @@ -15,8 +15,9 @@ public class WechatKeyword extends IdEntity { private String keyword; /** * 匹配类型 + * @Link WechatKeywordMatchinTypeEnum */ - private String matchinType; + private Integer matchinType; /** * 创建时间 */ @@ -38,11 +39,11 @@ public class WechatKeyword extends IdEntity { this.keyword = keyword; } - public String getMatchinType() { + public Integer getMatchinType() { return matchinType; } - public void setMatchinType(String matchinType) { + public void setMatchinType(Integer matchinType) { this.matchinType = matchinType; } diff --git a/src/main/java/com/lq/wechat/web/WechatController.java b/src/main/java/com/lq/wechat/web/WechatController.java index 8e5d53e..bdd4591 100755 --- a/src/main/java/com/lq/wechat/web/WechatController.java +++ b/src/main/java/com/lq/wechat/web/WechatController.java @@ -90,6 +90,7 @@ public class WechatController extends BaseController { text.setMsgType(ConstantSet.MESSAGE_TYPE_TEXT); text.setCreateTime(System.currentTimeMillis()); + switch (msgType) { case ConstantSet.MESSAGE_TYPE_TEXT: String content = map.get(WECHAT_CONTENT_KEY); diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/sys/log/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/sys/log/index.jsp index 70a1a6b..8595d6c 100755 --- a/src/main/webapp/WEB-INF/views/jsp/cms/sys/log/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/sys/log/index.jsp @@ -11,7 +11,6 @@