修改部分功能

master
星期八 6 years ago
parent 9f0bc5779b
commit ae297ff272
  1. 61
      src/main/java/com/lq/cms/emun/WechatKeywordMatchinTypeEnum.java
  2. 8
      src/main/java/com/lq/cms/mode/ZtreeItem.java
  3. 97
      src/main/java/com/lq/cms/vo/WechatRuleVo.java
  4. 1
      src/main/java/com/lq/cms/web/LoginController.java
  5. 10
      src/main/java/com/lq/cms/web/wechat/WechatInfoController.java
  6. 33
      src/main/java/com/lq/cms/web/wechat/WechatRuleController.java
  7. 1
      src/main/java/com/lq/dao/SysUserRoleDao.java
  8. 3
      src/main/java/com/lq/dao/WechatMessageDao.java
  9. 7
      src/main/java/com/lq/entity/WechatKeyword.java
  10. 1
      src/main/java/com/lq/wechat/web/WechatController.java
  11. 1
      src/main/webapp/WEB-INF/views/jsp/cms/sys/log/index.jsp
  12. 23
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp

@ -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<Integer,String> 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<Integer, String> getEnumMap(){
return enumMap;
}
public static String getDesc(int value){
return enumMap.get(value);
}
}

@ -12,7 +12,6 @@ public class ZtreeItem extends ZtreeComposite{
public List<ZtreeComposite> children=new ArrayList<>();
private String iconCls;
private String state;
private Map<String,Object> attributes;
public String getIconCls() {
return iconCls;
@ -31,13 +30,6 @@ public class ZtreeItem extends ZtreeComposite{
}
public Map<String, Object> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}
public List<ZtreeComposite> getChildren() {
return children;

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

@ -48,7 +48,6 @@ public class LoginController extends BaseController{
@RequestMapping(value = {"/index",""})
public String toLogin(){
return "cms/login";
}

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

@ -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<Integer,String> 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<WechatKeyword> wechatKeywordList = JSON.parseArray(keywordListStr,WechatKeyword.class);
BeanUtil.copyNotNull(wechatRule,vo);
return ajaxResult;
}
}

@ -12,7 +12,6 @@ import java.util.Map;
*/
public interface SysUserRoleDao extends BaseDao<SysUserRole> {
Long save(SysUserRole sysUserRole);
List<SysUserRole> findByUserIdAndRoleId(Map<String, Object> params);

@ -9,7 +9,4 @@ import java.util.List;
public interface WechatMessageDao extends AdminBaseDao<WechatMessage,WechatMessageVo> {
List<WechatMessageVo> findListPage(WechatMessageVo vo);
int count(WechatMessageVo vo);
}

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

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

@ -11,7 +11,6 @@
<script type="text/javascript" src="${ctx}/resources/code/easyui/jquery.easyui.min.1.2.2.js"></script>
<script type="text/javascript">
$(function() {// 初始化内容
$("#dataList").datagrid({
url:'list',
pagination :"true",

@ -85,7 +85,8 @@
<div class="receive_message_content">
<ul class="weui-desktop-msg-sender__tabs">
<li class="li contetn3-li-click" onclick="subscribeShow('text',this)" ><a class="li-title">文字</a></li>
<!-- <li class="li" onclick="subscribeShow('imager',this)" > <a class="li-title">图片</a></li> -->
<li class="li" onclick="subscribeShow('imager',this)" > <a class="li-title">图片</a></li>
<li class="li" onclick="subscribeShow('imager',this)" > <a class="li-title">图文</a></li>
</ul>
<!-- 文字 输入div -->
<div class="text-input" id="subscribeTextInput">
@ -117,7 +118,12 @@
<label class="lable_title keyword-cotent-title">关键词</label>
<div class="keyword-content" id="keyword">
<div class="keyword-content-row">
<select class="keyword-select"><option value="COMPLETELY">全匹配</option><option value="CONTAIN">半匹配</option></select><input type="text" class="keyword-input" placeholder="请输入关键字" />
<select class="keyword-select">
<c:forEach var="wechatKeywordMatchinType" items="${wechatKeywordMatchinTypeMap}" >
<option value="${wechatKeywordMatchinType.key}">${wechatKeywordMatchinType.value}</option>
</c:forEach>
</select>
<input type="text" class="keyword-input" placeholder="请输入关键字" />
<button class="keyword-add" onclick="addkeyword()"><a href="#" class="keyword-add-title" >十</a></button>
<button class="keyword-del" onclick="delkeyword(this)"><a href="#" class="keyword-del-title">一</a></button>
</div>
@ -202,8 +208,6 @@
});
function showButton(obj){
$(".click").removeClass("click");
$(obj).addClass("click");
@ -215,10 +219,8 @@
if(isCheck){
showContent(1);
}
messageSet.clear();
});
$("#button2").click(function(){
showButton(this);
@ -256,7 +258,6 @@
var keywordContent = $(obj).find('.keyword-input').val();
var wechatKeyWord = new Object();
if(keywordContent.length==0||keywordContent==''){
isNull = true;
return ;
}
@ -284,7 +285,7 @@
data.wechatInfoId = wechatInfoId;
$.ajax({
type:"post",
url:"${ctx}/admin/wechat/saveWechatRule.htm",
url:"${ctx}/cms/wechat/rule/save",
traditional:true,
data:data,
dataType:"json",
@ -403,10 +404,8 @@
btn1:function(index,layero){
messageSet = bufferSet;
layer.close(index);
},
skin: 'layui-layer-rim', //加上边框
area: ['90%', '80%'], //宽高
btnAlign: 'c',
@ -421,11 +420,7 @@
},
});
//页面层
});
//添加文字回复

Loading…
Cancel
Save