From 402e3031db01d5704b8559458c1b19b2b7a49722 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Sun, 29 Mar 2020 20:41:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=AE=E4=BF=A1=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=A8=A1=E5=9D=97=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../cms/web/wechat/WechatRuleController.java | 24 ++++++++++++++++++- .../java/com/lq/dao/WechatKeywordDao.java | 5 ++++ .../java/com/lq/dao/WechatMessageDao.java | 3 +++ .../util/accessToken/AccessTokenAdapter.java | 5 ++++ .../mybatis/mapping/WechatKeywordDao.xml | 15 ++++++++++++ .../mybatis/mapping/WechatMessageDao.xml | 7 ++++++ .../views/jsp/cms/wechat/rule/index.jsp | 5 +++- 8 files changed, 63 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d8d6385..48fa0be 100644 --- a/pom.xml +++ b/pom.xml @@ -375,7 +375,7 @@ com.alibaba druid - 1.1.9 + 1.1.21 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 c7949fc..6176995 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatRuleController.java @@ -10,7 +10,6 @@ import com.lq.code.entity.AjaxResult; import com.lq.code.util.StringUtil; import com.lq.entity.WechatInfo; import com.lq.entity.WechatKeyword; -import com.lq.entity.WechatMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -74,6 +73,29 @@ public class WechatRuleController { return ajaxResult; } + /** + * 更新回复规则 + * @param vo + * @param keywordListStr + * @param messageListStr + * @return + */ + @ResponseBody + @RequestMapping("/update") + public AjaxResult update(WechatRuleVo vo,String keywordListStr,String messageListStr){ + if (StringUtil.isNotNull(keywordListStr)) { + List wechatKeywordList = JSON.parseArray(keywordListStr, WechatKeyword.class); + vo.setWechatKeywordList(wechatKeywordList); + } + if (StringUtil.isNotNull(messageListStr)){ + List messageIds = JSON.parseArray(messageListStr, Long.class); + vo.setMessageIds(messageIds); + } + wechatRuleService.updateRule(vo); + + return AjaxResult.getSuccessInstance(); + } + @ResponseBody @RequestMapping("/delete") public AjaxResult delete(Long id){ diff --git a/src/main/java/com/lq/dao/WechatKeywordDao.java b/src/main/java/com/lq/dao/WechatKeywordDao.java index e2c6d60..b5f13b5 100644 --- a/src/main/java/com/lq/dao/WechatKeywordDao.java +++ b/src/main/java/com/lq/dao/WechatKeywordDao.java @@ -16,4 +16,9 @@ public interface WechatKeywordDao extends BaseDao{ List findByWechatRuleIdAndStatus(@Param("wechatRuleId") Long wehcatRuleId,@Param("status") Integer status); List findBykeywordAndWechatInfoId(@Param("keyword")String keyword,@Param("wechatInfoId")Long wechatInfoId); + + WechatKeyword getByWechatRuleIdAndKeyWord(@Param("wechatRuleId")Long wechatRuleId,@Param("keyword")String keyword); + + void deleteByWechatRuleId(@Param("wechatRuleId")Long wechatRuleId); + } diff --git a/src/main/java/com/lq/dao/WechatMessageDao.java b/src/main/java/com/lq/dao/WechatMessageDao.java index df491b3..e911d67 100755 --- a/src/main/java/com/lq/dao/WechatMessageDao.java +++ b/src/main/java/com/lq/dao/WechatMessageDao.java @@ -3,10 +3,13 @@ package com.lq.dao; import com.lq.cms.dao.AdminBaseDao; import com.lq.cms.vo.WechatMessageVo; import com.lq.entity.WechatMessage; +import org.apache.ibatis.annotations.Param; import java.util.List; public interface WechatMessageDao extends AdminBaseDao { List findAllByWechatMessageVo(WechatMessageVo wechatMessageVo); + + WechatMessage findByRuleId(@Param("ruleId")Long ruleId); } diff --git a/src/main/java/com/lq/wechat/util/accessToken/AccessTokenAdapter.java b/src/main/java/com/lq/wechat/util/accessToken/AccessTokenAdapter.java index 900fae5..eb13c08 100755 --- a/src/main/java/com/lq/wechat/util/accessToken/AccessTokenAdapter.java +++ b/src/main/java/com/lq/wechat/util/accessToken/AccessTokenAdapter.java @@ -10,5 +10,10 @@ import com.lq.wechat.mode.AccessToken; */ public interface AccessTokenAdapter { + /** + * 获取wehcatToken + * @param accessToken + * @return + */ WechatAccessToken adapter(AccessToken accessToken); } diff --git a/src/main/resources/mybatis/mapping/WechatKeywordDao.xml b/src/main/resources/mybatis/mapping/WechatKeywordDao.xml index 77929a7..9e053fa 100644 --- a/src/main/resources/mybatis/mapping/WechatKeywordDao.xml +++ b/src/main/resources/mybatis/mapping/WechatKeywordDao.xml @@ -76,5 +76,20 @@ ORDER BY create_time DESC + + + + update wechat_keyword + set status = 0 + where wechat_rule_id = #{wechatRuleId} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapping/WechatMessageDao.xml b/src/main/resources/mybatis/mapping/WechatMessageDao.xml index 93840da..e962a41 100644 --- a/src/main/resources/mybatis/mapping/WechatMessageDao.xml +++ b/src/main/resources/mybatis/mapping/WechatMessageDao.xml @@ -89,5 +89,12 @@ + + \ No newline at end of file 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 8125f85..9f8ca6d 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 @@ -155,6 +155,7 @@