shiro session异常修复中.....

master
星期八 5 years ago
parent 9eed3592aa
commit 602f117364
  1. 6
      README.md
  2. 24
      src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java
  3. 5
      src/main/java/com/lq/cms/web/wechat/WechatRuleController.java
  4. 5
      src/main/java/com/lq/code/util/mybatisPlus/CreateMapperFileUtil.java
  5. 7
      src/main/java/com/lq/dao/WechatRuleMessageDao.java
  6. 2
      src/main/resources/dev/jdbc.properties
  7. 2
      src/main/resources/dev/redis.properties
  8. 67
      src/main/resources/mybatis/mapping/WechatRuleMessageDao.xml
  9. 2
      src/main/resources/pro/jdbc.properties
  10. 2
      src/main/resources/pro/redis.properties
  11. 4
      src/main/resources/spring/spring-shiro.xml
  12. 33
      src/main/resources/test/jdbc.properties
  13. 4
      src/main/resources/test/redis.properties
  14. 3
      src/main/webapp/WEB-INF/views/jsp/cms/sys/user/edit.jsp
  15. 4
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp

@ -21,5 +21,11 @@ ssm 使用说明
3. 自定义实体同步数据库表结构插件(com.lq.code.executor.processor.InstantiationTracingBeanPostProcessor)
4. AdminBaseDao,AdminBaseServer,AdminBaseController.三层类结构的继承。可以实现简单模块基本管理功能。
三层架构理念:
1.数据库表与mapping.xml一一对应。
2.dao层代码密度低,dao层代码尽量通用,以工具类形式使用。便于代码重用
3.service层代码密度高 通过组合复用dao层工具类,实现业务逻辑
4.controller层代码密度低 只负责简单的数据接受和转发。以及页面跳转的控制
1. 项目案例:http://106.12.122.216/ssm/cms/
2. 默认账号/密码:admin/123

@ -1,17 +1,17 @@
package com.lq.cms.service.impl;
import com.lq.cms.emun.StatusTypeEnum;
import com.lq.cms.emun.WechatKeywordMatchinTypeEnum;
import com.lq.cms.service.WechatRuleService;
import com.lq.cms.vo.WechatRuleVo;
import com.lq.code.dao.BaseDao;
import com.lq.code.service.impl.BaseServiceImpl;
import com.lq.code.util.BeanUtil;
import com.lq.dao.WechatKeywordDao;
import com.lq.dao.WechatMessageDao;
import com.lq.dao.WechatRuleDao;
import com.lq.entity.SysUser;
import com.lq.entity.WechatInfo;
import com.lq.entity.WechatKeyword;
import com.lq.entity.WechatRule;
import com.lq.dao.WechatRuleMessageDao;
import com.lq.entity.*;
import com.lq.wechat.mode.message.BaseMessage;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
@ -35,10 +35,26 @@ public class WechatRuleServiceImpl extends BaseServiceImpl<WechatRule> implement
private WechatRuleDao wechatRuleDao;
@Autowired
private WechatKeywordDao wechatKeywordDao;
@Autowired
private WechatRuleMessageDao wechatRuleMessageDao;
@Override
public BaseMessage getByKeyworkdAndWechatInfoId(String keyworkd, WechatInfo wechatInfo) {
List<WechatRule> wechatRuleList = wechatRuleDao.findByWechatInfoIdAndStatus(wechatInfo.getId(),StatusTypeEnum.STATUS_ACTIVITY_YES.getValue());
wechatRuleList.forEach((wechatRule)->{
List<WechatKeyword> wechatKeywordList = wechatKeywordDao.findByWechatRuleIdAndStatus(wechatRule.getId(),StatusTypeEnum.STATUS_ACTIVITY_YES.getValue());
wechatKeywordList.forEach((wechatKeyword)->{
if (WechatKeywordMatchinTypeEnum.KEYWORD_ALL.getValue().equals(wechatKeyword.getMatchinType())){
if (keyworkd.equals(wechatKeyword.getKeyword())){
List<WechatMessage> wechatMessageList = null;
}
}else {
}
});
});
BaseMessage baseMessage = null;
return baseMessage;

@ -10,6 +10,7 @@ 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;
@ -64,6 +65,10 @@ public class WechatRuleController {
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.saveRule(vo);
return ajaxResult;

@ -5,7 +5,9 @@ import com.lq.code.util.sql.AbstractDbBuiler;
import com.lq.code.util.sql.MysqlBuilder;
import com.lq.code.util.sql.SqlUtil;
import com.lq.dao.WechatKeywordDao;
import com.lq.dao.WechatRuleMessageDao;
import com.lq.entity.WechatKeyword;
import com.lq.entity.WechatRuleMessage;
import java.io.File;
import java.io.IOException;
@ -60,7 +62,8 @@ public class CreateMapperFileUtil {
}
public static void main(String[] args) throws IOException {
createXml(WechatKeywordDao.class,WechatKeyword.class,new MysqlBuilder());
AbstractDbBuiler abstractDbBuiler = new MysqlBuilder();
createXml(WechatRuleMessageDao.class, WechatRuleMessage.class,abstractDbBuiler);
}

@ -0,0 +1,7 @@
package com.lq.dao;
import com.lq.code.dao.BaseDao;
import com.lq.entity.WechatRuleMessage;
public interface WechatRuleMessageDao extends BaseDao<WechatRuleMessage> {
}

@ -1,6 +1,6 @@
#--------- jdbc 配置---------
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.31.19: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.19
redis.port=6379
redis.pass=
redis.timeout=-1

@ -0,0 +1,67 @@
<?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="com.lq.dao.WechatRuleMessageDao">
<!-- namespace命名空间,作用是对sql进行分类化管理,理解sql隔离 -->
<!-- 注意:使用mapper代理方法开发 ,namespace有着特殊作用-->
<sql id="column_list">
wechat_rule_id,id,wechat_message_id,status
</sql>
<select id="findOne" resultType="com.lq.entity.WechatRuleMessage" parameterType="long">
SELECT <include refid="column_list"/>
FROM wechat_rule_message
WHERE id=#{id} AND status = 1
</select>
<select id="findAll" resultType="com.lq.entity.WechatRuleMessage">
SELECT <include refid="column_list"/>
FROM wechat_rule_message
WHERE status = 1
</select>
<select id="count" resultType="int">
SELECT count(id)
FROM wechat_rule_message
WHERE status = 1
</select>
<insert id="save" parameterType="com.lq.entity.WechatRuleMessage" useGeneratedKeys="true" keyProperty="id">
<selectKey keyProperty="id" order="AFTER" resultType="Long">
SELECT LAST_INSERT_ID()
</selectKey>
INSERT INTO
wechat_rule_message(wechat_rule_id,id,wechat_message_id,status)
VALUES
(
#{wechatRuleId},#{id},#{wechatMessageId},#{status}
)
</insert>
<update id="update" parameterType="com.lq.entity.WechatRuleMessage">
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>
</trim>
WHERE
id=#{id}
</update>
<update id="delete" parameterType="Long">
UPDATE
wechat_rule_message
SET
status = 0
WHERE
id=#{id}
</update>
</mapper>

@ -1,6 +1,6 @@
#--------- jdbc <EFBFBD><EFBFBD><EFBFBD><EFBFBD>---------
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.31.19: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
#--------<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -------

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

@ -26,11 +26,13 @@
<!-- 配置需要向Cookie中保存数据的配置模版 -->
<bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
<!-- 在Tomcat运行下默认使用的Cookie的名字为JSESSIONID -->
<constructor-arg name="name" value="mldn-session-id"/>
<constructor-arg name="name" value="shiro.session"/>
<!-- 保证该系统不会受到跨域的脚本操作供给 -->
<property name="httpOnly" value="true"/>
<!-- 定义Cookie的过期时间,单位为秒,如果设置为-1表示浏览器关闭,则Cookie消失 -->
<property name="maxAge" value="-1"/>
<property name="path" value="/"/>
</bean>

@ -1,16 +1,25 @@
#--------- jdbc ÅäÖÃ---------
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://127.0.0.1:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.user=root
jdbc.password=mysql
#\u5B9A\u4E49\u521D\u59CB\u8FDE\u63A5\u6570
initialSize=0
#\u5B9A\u4E49\u6700\u5927\u8FDE\u63A5\u6570
maxActive=5
#\u5B9A\u4E49\u6700\u5927\u7A7A\u95F2
maxIdle=5
#\u5B9A\u4E49\u6700\u5C0F\u7A7A\u95F2
minIdle=1
#\u5B9A\u4E49\u6700\u957F\u7B49\u5F85\u65F6\u95F4
maxWait=6000
email.port=Create property
#--------Êý¾Ý¿âÁ¬½Ó³ØÅäÖà -------
durid.pool.initialSize=5
durid.pool.maxActive=5
durid.pool.minIdle=1
durid.pool.maxWait=60000
durid.pool.timeBetweenEvictionRunsMillis=60000
durid.pool.filters=stat
durid.pool.poolPreparedStatements=false
durid.pool.maxPoolPreparedStatementPerConnectionSize=100
durid.pool.minEvictableIdleTimeMillis=300000
durid.pool.validationQuery=SELECT 'X'
durid.pool.testWhileIdle=true
durid.pool.testOnBorrow=false
durid.pool.testOnReturn=false
durid.pool.removeAbandonedTimeout=1800
durid.pool.logAbandoned=true
durid.pool.email.port=Create property

@ -3,7 +3,7 @@ redis.port=6379
redis.pass=
redis.timeout=-1
redis.maxTotal=30
redis.maxTotal=15
redis.maxIdle=10
redis.numTestsPerEvictionRun=1024
redis.timeBetweenEvictionRunsMillis=30000
@ -12,5 +12,5 @@ redis.softMinEvictableIdleTimeMillis=10000
redis.maxWaitMillis=1500
redis.testWhileIdle=true
redis.blockWhenExhausted=false
redis.minIdle=8
redis.minIdle=5
redis.testOnBorrow=true

@ -35,7 +35,6 @@
return url ;
}
</script>
</head>
<body>
<div style="margin:20px 0;"></div>
@ -53,8 +52,6 @@
<td><input class="easyui-textbox" type="password" id="password" data-options="required:true" value="${sysUser.password}"></input></td>
</tr>
</c:if>
<tr>
<td>电子邮箱:</td>
<td><input class="easyui-textbox" type="text" id="email" data-options="multiline:true,required:true" value="${sysUser.email}" ></input></td>

@ -344,7 +344,6 @@
});
$("#subscribe-save").click(function(){
var data = new Object();
var messageContent = $("#subscribe-arce").html();
data.content = messageContent;
@ -356,7 +355,6 @@
if(messageContent.length==0){
layer.msg('回复内容不能为空');
return ;
}
if(messageContent.length>maxInputNum){
layer.msg('字数超出限制,不能提交');
@ -398,7 +396,6 @@
dataType:"json",
success:function(result){
if(result.success==true){
index = layer.open({
type: 1,
btn:['确定','取消'],
@ -665,7 +662,6 @@
}
function showeditText(){
var html = '<div class="input-text-div"><textarea id = "input-text">'+messageText+'</textarea></div>';
return html;
}

Loading…
Cancel
Save