From c0c50c6d16d889b6dd8bede3f3788330abeb76d1 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Fri, 28 Aug 2020 11:32:40 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=AD=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93token=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application-dev.properties | 11 +++++++---- config/application-local.properties | 2 +- config/application.properties | 2 +- .../dispose/manager/impl/UserAccountManagerImpl.java | 3 ++- .../java/com/dispose/mapper/UserAccountMapper.java | 5 ++--- src/main/resources/mappers/UserAccount.xml | 8 ++------ 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/config/application-dev.properties b/config/application-dev.properties index fa752028..4719bcca 100644 --- a/config/application-dev.properties +++ b/config/application-dev.properties @@ -2,12 +2,14 @@ server.port=9276 # 根据自身环境修改 server.tomcat.basedir=./basedir # 多个项目放在nginx下同个端口,通过该配置区分 -server.servlet.context-path=/phoenix +server.servlet.context-path=/dispose # 配置数据源 -spring.datasource.url=jdbc:mysql://172.28.72.118:33061/phoenix_local?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true +spring.datasource.url=jdbc:mysql://172.28.72.118:33061/dispose_cl?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\ + =convertToNull&useUnicode=true spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username=phoenix spring.datasource.password=Hy@rfph32 + # 配置连接池 spring.datasource.type=org.apache.commons.dbcp2.BasicDataSource spring.datasource.dbcp2.max-total=128 @@ -22,9 +24,10 @@ spring.datasource.dbcp2.connection-properties=characterEncoding=utf8 # 下划线转驼峰 将带有下划线的表字段映射为驼峰格式的实体类属性 #mybatis.configuration.map-underscore-to-camel-case: true mybatis.mapper-locations=classpath*:mappers/*.xml -mybatis.type-aliases-package=com.cmcc.hy.phoenix.entity +mybatis.type-aliases-package=com.dispose.pojo.entity +mybatis.configuration.default-enum-type-handler=com.dispose.common.CommonEnumHandler #config log -logging.config=file:config/logback.xml +logging.config=file:config/logback_debug.xml #config tomcat server.tomcat.max-threads=128 #====custom config,begin with phoenix==== diff --git a/config/application-local.properties b/config/application-local.properties index 0dc7f667..9124debb 100644 --- a/config/application-local.properties +++ b/config/application-local.properties @@ -43,7 +43,7 @@ phoenix.redis.type=redisson-single #jedis config example>redis://:dfu56li_jdo8pd@172.28.72.111:7379/0,多个用逗号分隔 #redisson sentinel config example>redis://172.28.72.104:28379,redis://172.28.72.124:28380,redis://172.28.72.124:28381 #redisson single config example>redis://172.28.72.104:8380 -phoenix.redis-server=redis://172.28.72.104:8380 +#phoenix.redis-server=redis://172.28.72.104:8380 phoenix.redis-redisson-sentinel-master-name=mymaster phoenix.redis-redisson-pwd=cmcc2019 #config request dec switch,true=dec,false=plain do nothing diff --git a/config/application.properties b/config/application.properties index b745d9d5..2cabae4b 100644 --- a/config/application.properties +++ b/config/application.properties @@ -1 +1 @@ -spring.profiles.active=local,dispose \ No newline at end of file +spring.profiles.active=dev,dispose \ No newline at end of file diff --git a/src/main/java/com/dispose/manager/impl/UserAccountManagerImpl.java b/src/main/java/com/dispose/manager/impl/UserAccountManagerImpl.java index 0a24e1f0..92243413 100644 --- a/src/main/java/com/dispose/manager/impl/UserAccountManagerImpl.java +++ b/src/main/java/com/dispose/manager/impl/UserAccountManagerImpl.java @@ -116,7 +116,8 @@ public class UserAccountManagerImpl implements UserAccountManager { // 移除过期的项 userAccountCache.remove(user.getToken()); // 更新token - user.setToken(userAccountMapper.upgradeToken(username, token)); + userAccountMapper.upgradeToken(username, token); + user.setToken(token); // 重新添加到缓存中 userAccountCache.put(token, user); diff --git a/src/main/java/com/dispose/mapper/UserAccountMapper.java b/src/main/java/com/dispose/mapper/UserAccountMapper.java index de6ceabf..f4f697d0 100644 --- a/src/main/java/com/dispose/mapper/UserAccountMapper.java +++ b/src/main/java/com/dispose/mapper/UserAccountMapper.java @@ -95,13 +95,12 @@ public interface UserAccountMapper { String upgradeLastAccessTime(@Param("username") String username); /** - * Upgrade token string. + * Upgrade token. * * @param username the username * @param token the token - * @return the string */ - String upgradeToken(@Param("username") String username, + void upgradeToken(@Param("username") String username, @Param("token") String token); /** diff --git a/src/main/resources/mappers/UserAccount.xml b/src/main/resources/mappers/UserAccount.xml index 6bf82cfc..9564d851 100644 --- a/src/main/resources/mappers/UserAccount.xml +++ b/src/main/resources/mappers/UserAccount.xml @@ -63,16 +63,12 @@ WHERE username = #{username, jdbcType=VARCHAR} - +