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 @@