新增微信公众号规则绑定消息功能

master
星期八 5 years ago
parent 0c4e8411f1
commit a6af5c621e
  1. 2
      src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java
  2. 1
      src/main/java/com/lq/code/interceptor/shiro/ShiroRealm.java
  3. 7
      src/main/java/com/lq/dao/WechatRuleMessageDao.java
  4. 2
      src/main/java/com/lq/entity/SysPermission.java
  5. 23
      src/main/java/com/lq/entity/WechatInfoSetting.java
  6. 12
      src/main/java/com/lq/entity/WechatRuleMessage.java
  7. 2
      src/main/resources/dev/jdbc.properties
  8. 2
      src/main/resources/dev/redis.properties
  9. 24
      src/main/resources/mybatis/mapping/WechatRuleMessageDao.xml
  10. 32
      src/main/resources/mybatis/mapping/说明.txt
  11. 2
      src/main/resources/pro/jdbc.properties
  12. 2
      src/main/resources/pro/redis.properties
  13. 10
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp

@ -48,7 +48,7 @@ public class InstantiationTracingBeanPostProcessor implements ApplicationListene
AbstractDbBuiler dbBuiler = new MysqlBuilder();
// String sql = dbBuiler.automaticUpdateDbNew(queueDto);
String sql = dbBuiler.automaticUpdateDb(set);
// JdbcUtils.createTable(sql);
JdbcUtils.createTable(sql);
System.out.println("=========实体同步数据结构===========");
System.out.println(System.currentTimeMillis()-startTime);
}

@ -24,7 +24,6 @@ import java.util.List;
*/
public class ShiroRealm extends AuthorizingRealm {
@Autowired
private SysUserService sysUserService;
@Autowired

@ -2,6 +2,13 @@ package com.lq.dao;
import com.lq.code.dao.BaseDao;
import com.lq.entity.WechatRuleMessage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WechatRuleMessageDao extends BaseDao<WechatRuleMessage> {
WechatRuleMessage getByRuleIdAndMessageId(@Param("ruleId")Long ruleId,@Param("messageId")Long messageId);
List<WechatRuleMessage> findByWechatRuleId(@Param("wechatRuleId")Long wechatRuleId);
}

@ -14,7 +14,7 @@ public class SysPermission extends IdEntity{
/**
* 权限类型
*/
private int permissionType;
private Integer permissionType;
/**·
* 权限键值
*/

@ -0,0 +1,23 @@
package com.lq.entity;
import com.lq.code.entity.IdEntity;
/**
* 微信公众号设置表
*/
public class WechatInfoSetting extends IdEntity {
/**
* 微信公众号ID
*/
private Long wechatInfoId;
public Long getWechatInfoId() {
return wechatInfoId;
}
public void setWechatInfoId(Long wechatInfoId) {
this.wechatInfoId = wechatInfoId;
}
}

@ -19,6 +19,10 @@ public class WechatRuleMessage extends IdEntity {
* 微信公众号消息ID
*/
private Long wechatMessageId;
/**
* 创建时间
*/
private Date createTime;
public Long getWechatRuleId() {
return wechatRuleId;
@ -35,4 +39,12 @@ public class WechatRuleMessage extends IdEntity {
public void setWechatMessageId(Long wechatMessageId) {
this.wechatMessageId = wechatMessageId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -1,6 +1,6 @@
#--------- jdbc 配置---------
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.url=jdbc:mysql://192.168.31.110:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.user=root
jdbc.password=mysql
#--------数据库连接池配置 -------

@ -1,4 +1,4 @@
redis.host=127.0.0.1
redis.host=192.168.31.110
redis.port=6379
redis.pass=
redis.timeout=-1

@ -6,7 +6,7 @@
<!-- 注意:使用mapper代理方法开发 ,namespace有着特殊作用-->
<sql id="column_list">
wechat_rule_id,id,wechat_message_id,status
wechat_rule_id,id,wechat_message_id,status,create_time
</sql>
<select id="findOne" resultType="com.lq.entity.WechatRuleMessage" parameterType="long">
@ -33,10 +33,10 @@
SELECT LAST_INSERT_ID()
</selectKey>
INSERT INTO
wechat_rule_message(wechat_rule_id,id,wechat_message_id,status)
wechat_rule_message(wechat_rule_id,id,wechat_message_id,status,create_time)
VALUES
(
#{wechatRuleId},#{id},#{wechatMessageId},#{status}
#{wechatRuleId},#{id},#{wechatMessageId},#{status},#{createTime}
)
</insert>
@ -45,11 +45,11 @@
UPDATE
wechat_rule_message
<trim prefix="set" suffixOverrides=",">
<if test="wechatRuleId!=null">wechat_rule_id=#{wechatRuleId},</if>
<if test="id!=null">id=#{id},</if>
<if test="wechatMessageId!=null">wechat_message_id=#{wechatMessageId},</if>
<if test="status!=null">status=#{status},</if>
<if test="createTime!=null">createTime=#{create_time}</if>
</trim>
WHERE
id=#{id}
@ -64,4 +64,20 @@
id=#{id}
</update>
<select id="getByRuleIdAndMessageId" resultType="com.lq.entity.WechatRuleMessage" parameterType="Long">
SELECT <include refid="column_list"/>
FROM wechat_rule_message
WHERE status = 1
AND wechat_message_id = #{messageId}
AND wechat_rule_id = #{ruleId}
</select>
<select id="findByWechatRuleId" resultType="com.lq.entity.WechatRuleMessage" parameterType="Long">
SELECT <include refid="column_list"/>
FROM wechat_rule_message
WHERE status = 1
AND wechat_rule_id = #{wechatRuleId}
</select>
</mapper>

@ -1,32 +0,0 @@
1.数据库表与mapping.xml一一对应。
2.dao层代码密度低,dao层代码尽量通用,以工具类形式使用。便于代码重用
3.service 通过组合复用dao层工具类,实现业务逻辑
4.controller 只负责简单的数据接受和转发。以及页面跳转的控制
mapping xml 文件模板
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="类名">
<!-- namespace命名空间,作用是对sql进行分类化管理,理解sql隔离 -->
<!-- 注意:使用mapper代理方法开发 ,namespace有着特殊作用-->
<select id="方法名" resultType="类名">
SELECT * FROM `表明`
</select>
<insert id="save" parameterType="类名" useGeneratedKeys="true" keyProperty="id">
<selectKey keyProperty="id" order="AFTER" resultType="long">
SELECT LAST_INSERT_ID()
</selectKey>
INSERT INTO
VALUES
</insert>
</mapper>

@ -1,6 +1,6 @@
#--------- jdbc <EFBFBD><EFBFBD><EFBFBD><EFBFBD>---------
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.31.110:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.url=jdbc:mysql://192.168.31.19:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.user=root
jdbc.password=mysql
#--------<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -------

@ -1,4 +1,4 @@
redis.host=192.168.31.110
redis.host=192.168.31.19
redis.port=6379
redis.pass=
redis.timeout=-1

@ -275,11 +275,12 @@
var messageList = new Array();
messageSet.forEach(function (element, sameElement, set) {
console.log(element);
messageList.push(element);
});
messageSet.clear();
data.messaegListStr = JSON.stringify(messageList);
data.messageListStr = JSON.stringify(messageList);
data.keywordListStr = JSON.stringify(keywordObjeList);
data.replyType = $("input[name='replyType']:checked").val();
data.messageText = messageText;
@ -395,21 +396,21 @@
async:false,
dataType:"json",
success:function(result){
console.log(result);
if(result.success==true){
index = layer.open({
type: 1,
btn:['确定','取消'],
btn1:function(index,layero){
messageSet = bufferSet;
console.log(messageSet);
layer.close(index);
},
skin: 'layui-layer-rim', //加上边框
area: ['90%', '80%'], //宽高
btnAlign: 'c',
content: appendAlertHtml(result.data),
});
}else{
layer.msg('数据加载失败');
}
@ -628,6 +629,7 @@
}
function appendAlertHtml(data){
console.log(data);
var isShow ;
var wechatMessageList = data.wechatMessageVoList;
var html = '<div class="alert"><div class="left-navigation"><p>图文('+data.wechatMessageCount+')</p></div>';
@ -668,6 +670,7 @@
function onMessaegRow(obj){
var messageid = parseInt($(obj).find('input').val());
console.log(messageid);
if ($(obj).find('.chekc-Div').css('display') == 'none') {
$(obj).find('.chekc-Div').show();
bufferSet.add(messageid);
@ -675,6 +678,7 @@
$(obj).find('.chekc-Div').hide();
bufferSet.delete(messageid);
}
console.log(bufferSet);
}
</script>
</html>

Loading…
Cancel
Save