更新微信回复模块相关功能

master
星期八 5 years ago
parent 684423793b
commit 402e3031db
  1. 2
      pom.xml
  2. 24
      src/main/java/com/lq/cms/web/wechat/WechatRuleController.java
  3. 5
      src/main/java/com/lq/dao/WechatKeywordDao.java
  4. 3
      src/main/java/com/lq/dao/WechatMessageDao.java
  5. 5
      src/main/java/com/lq/wechat/util/accessToken/AccessTokenAdapter.java
  6. 15
      src/main/resources/mybatis/mapping/WechatKeywordDao.xml
  7. 7
      src/main/resources/mybatis/mapping/WechatMessageDao.xml
  8. 5
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp

@ -375,7 +375,7 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>1.1.9</version> <version>1.1.21</version>
</dependency> </dependency>
<!-- shiro spring 整合 ,作用:权限管理 --> <!-- shiro spring 整合 ,作用:权限管理 -->
<!-- shiro 核心架包 --> <!-- shiro 核心架包 -->

@ -10,7 +10,6 @@ import com.lq.code.entity.AjaxResult;
import com.lq.code.util.StringUtil; import com.lq.code.util.StringUtil;
import com.lq.entity.WechatInfo; import com.lq.entity.WechatInfo;
import com.lq.entity.WechatKeyword; import com.lq.entity.WechatKeyword;
import com.lq.entity.WechatMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -74,6 +73,29 @@ public class WechatRuleController {
return ajaxResult; 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<WechatKeyword> wechatKeywordList = JSON.parseArray(keywordListStr, WechatKeyword.class);
vo.setWechatKeywordList(wechatKeywordList);
}
if (StringUtil.isNotNull(messageListStr)){
List<Long> messageIds = JSON.parseArray(messageListStr, Long.class);
vo.setMessageIds(messageIds);
}
wechatRuleService.updateRule(vo);
return AjaxResult.getSuccessInstance();
}
@ResponseBody @ResponseBody
@RequestMapping("/delete") @RequestMapping("/delete")
public AjaxResult delete(Long id){ public AjaxResult delete(Long id){

@ -16,4 +16,9 @@ public interface WechatKeywordDao extends BaseDao<WechatKeyword>{
List<WechatKeyword> findByWechatRuleIdAndStatus(@Param("wechatRuleId") Long wehcatRuleId,@Param("status") Integer status); List<WechatKeyword> findByWechatRuleIdAndStatus(@Param("wechatRuleId") Long wehcatRuleId,@Param("status") Integer status);
List<WechatKeyword> findBykeywordAndWechatInfoId(@Param("keyword")String keyword,@Param("wechatInfoId")Long wechatInfoId); List<WechatKeyword> 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);
} }

@ -3,10 +3,13 @@ package com.lq.dao;
import com.lq.cms.dao.AdminBaseDao; import com.lq.cms.dao.AdminBaseDao;
import com.lq.cms.vo.WechatMessageVo; import com.lq.cms.vo.WechatMessageVo;
import com.lq.entity.WechatMessage; import com.lq.entity.WechatMessage;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface WechatMessageDao extends AdminBaseDao<WechatMessage,WechatMessageVo> { public interface WechatMessageDao extends AdminBaseDao<WechatMessage,WechatMessageVo> {
List<WechatMessage> findAllByWechatMessageVo(WechatMessageVo wechatMessageVo); List<WechatMessage> findAllByWechatMessageVo(WechatMessageVo wechatMessageVo);
WechatMessage findByRuleId(@Param("ruleId")Long ruleId);
} }

@ -10,5 +10,10 @@ import com.lq.wechat.mode.AccessToken;
*/ */
public interface AccessTokenAdapter { public interface AccessTokenAdapter {
/**
* 获取wehcatToken
* @param accessToken
* @return
*/
WechatAccessToken adapter(AccessToken accessToken); WechatAccessToken adapter(AccessToken accessToken);
} }

@ -76,5 +76,20 @@
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="getByWechatRuleIdAndKeyWord" resultType="WechatKeyword">
SELECT <include refid="column_list"/>
FROM wechat_keyword
WHERE
wechat_rule_id = #{wechatRuleId}
AND
keyword=#{keyword}
</select>
<delete id="deleteByWechatRuleId">
update wechat_keyword
set status = 0
where wechat_rule_id = #{wechatRuleId}
</delete>
</mapper> </mapper>

@ -89,5 +89,12 @@
</select> </select>
<select id="findByRuleId" resultType="WechatMessage">
select wm.* from wechat_message wm
left join wechat_rule_message wrm ON wm.id = wrm.wechat_message_id
where wrm.wechat_rule_id = #{ruleId}
LIMIT 1
</select>
</mapper> </mapper>

@ -155,6 +155,7 @@
<script type="text/javascript" src="${ctx}/resources/plugins/layer/layer.js"></script> <script type="text/javascript" src="${ctx}/resources/plugins/layer/layer.js"></script>
<script type="text/javascript" href="${ctx}/resources/cms/wechat/wechat.js"></script> <script type="text/javascript" href="${ctx}/resources/cms/wechat/wechat.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var postUrl = '${ctx}/cms/wechat/rule/save';
var isCheck = ${wechatInfo.openReply==1}; var isCheck = ${wechatInfo.openReply==1};
var addkeywordRowHtml = $("#keyword").html(); var addkeywordRowHtml = $("#keyword").html();
var wechatInfoId = '${wechatInfo.id}'; var wechatInfoId = '${wechatInfo.id}';
@ -238,6 +239,7 @@
} }
}); });
$("#button4").click(function(){ $("#button4").click(function(){
postUrl = '${ctx}/cms/wechat/rule/save';
if(isCheck){ if(isCheck){
showContent(4); showContent(4);
} }
@ -287,7 +289,7 @@
data.wechatInfoId = wechatInfoId; data.wechatInfoId = wechatInfoId;
$.ajax({ $.ajax({
type:"post", type:"post",
url:"${ctx}/cms/wechat/rule/save", url:postUrl,
traditional:true, traditional:true,
data:data, data:data,
dataType:"json", dataType:"json",
@ -523,6 +525,7 @@
function showeditRule(wechatRuleId) { function showeditRule(wechatRuleId) {
clearEdit(); clearEdit();
postUrl = '${ctx}/cms/wechat/rule/update'
var data = new Object(); var data = new Object();
data.wechatRuleId = wechatRuleId; data.wechatRuleId = wechatRuleId;
$.ajax({ $.ajax({

Loading…
Cancel
Save