Merge branch 'master' of http://121.40.234.130:8899/wangs/niuDiXiYa3
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package org.nl.wms.autotask;
|
package org.nl.autotask;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
package org.nl.modules.security.satoken;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.nl.modules.mnt.websocket.MsgType;
|
|
||||||
import org.nl.modules.mnt.websocket.SocketMsg;
|
|
||||||
import org.nl.modules.mnt.websocket.WebSocketServer;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.connection.Message;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
|
||||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: lyd
|
|
||||||
* @description:
|
|
||||||
* @Date: 2022/10/8
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class TokenKeyExpirationListener extends KeyExpirationEventMessageListener {
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
public TokenKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
|
|
||||||
super(listenerContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(Message message, byte[] pattern) {
|
|
||||||
// 监听过期的key
|
|
||||||
String expireKey = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
||||||
//获取key原本的value 获取不到 是null
|
|
||||||
String expireKeyValue = redisTemplate.opsForValue().get("my-satoken");
|
|
||||||
//我是根据tokenvalues作为主键ID的
|
|
||||||
String[] split = expireKey.split(":");
|
|
||||||
String s = split[split.length - 1];
|
|
||||||
try {
|
|
||||||
WebSocketServer.sendInfo(new SocketMsg("token会话过期!", MsgType.INFO), "exp-token");
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
log.info("expireKey---"+expireKey);
|
|
||||||
log.info("expireKeyValue---"+expireKeyValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<contextName>nlAdmin</contextName>
|
<contextName>nlAdmin</contextName>
|
||||||
<property name="log.charset" value="utf-8"/>
|
<property name="log.charset" value="utf-8"/>
|
||||||
<property name="log.pattern"
|
<property name="log.pattern"
|
||||||
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
|
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
|
||||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
<springProperty scope="context" name="lokiUrl" source="loki.url"/>
|
<springProperty scope="context" name="lokiUrl" source="loki.url"/>
|
||||||
<springProperty scope="context" name="systemName" source="loki.systemName"/>
|
<springProperty scope="context" name="systemName" source="loki.systemName"/>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = {
|
|||||||
/**
|
/**
|
||||||
* @description token key
|
* @description token key
|
||||||
*/
|
*/
|
||||||
TokenKey: 'EL-ADMIN-TOEKN',
|
TokenKey: 'NL-ACS-TOEKN',
|
||||||
/**
|
/**
|
||||||
* @description 请求超时时间,毫秒(默认2分钟)
|
* @description 请求超时时间,毫秒(默认2分钟)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
package org.nl.modules.security.satoken;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
|
||||||
import org.nl.modules.mnt.websocket.MsgType;
|
|
||||||
import org.nl.modules.mnt.websocket.SocketMsg;
|
|
||||||
import org.nl.modules.mnt.websocket.WebSocketServer;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.connection.Message;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
|
||||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: lyd
|
|
||||||
* @description: redis过期key监听器
|
|
||||||
* @Date: 2022/10/8
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class TokenKeyExpirationListener extends KeyExpirationEventMessageListener {
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
public TokenKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
|
|
||||||
super(listenerContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(Message message, byte[] pattern) {
|
|
||||||
String expireKeyValue = redisTemplate.opsForValue().get("my-satoken");
|
|
||||||
try {
|
|
||||||
if (ObjectUtil.isEmpty(expireKeyValue))
|
|
||||||
WebSocketServer.sendInfo(new SocketMsg("token会话过期!", MsgType.INFO), "exp-token");
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -97,7 +97,7 @@ public class AutoCreateTask {
|
|||||||
taskList.forEach(item -> {
|
taskList.forEach(item -> {
|
||||||
JSONObject taskObj = new JSONObject();
|
JSONObject taskObj = new JSONObject();
|
||||||
taskObj.put("task_id", item.getTask_id());
|
taskObj.put("task_id", item.getTask_id());
|
||||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
// taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||||
taskObj.put("remark", "下发失败:" + message);
|
taskObj.put("remark", "下发失败:" + message);
|
||||||
taskObj.put("update_time", DateUtil.now());
|
taskObj.put("update_time", DateUtil.now());
|
||||||
taskTab.update(taskObj);
|
taskTab.update(taskObj);
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.16.1.25}:${DB_PORT:3306}/${DB_NAME:whxr_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:ndxy3_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:whxr_root}
|
password: ${DB_PWD:P@ssw0rd}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
# 最小连接数
|
# 最小连接数
|
||||||
@@ -54,7 +54,7 @@ spring:
|
|||||||
redis:
|
redis:
|
||||||
#数据库索引
|
#数据库索引
|
||||||
database: ${REDIS_DB:15}
|
database: ${REDIS_DB:15}
|
||||||
host: ${REDIS_HOST:10.16.1.25}
|
host: ${REDIS_HOST:127.0.0.1}
|
||||||
port: ${REDIS_PORT:6379}
|
port: ${REDIS_PORT:6379}
|
||||||
password: ${REDIS_PWD:}
|
password: ${REDIS_PWD:}
|
||||||
#连接超时时间
|
#连接超时时间
|
||||||
@@ -137,3 +137,28 @@ logging:
|
|||||||
file:
|
file:
|
||||||
path: /app/jar/logs
|
path: /app/jar/logs
|
||||||
config: classpath:logback-spring.xml
|
config: classpath:logback-spring.xml
|
||||||
|
|
||||||
|
# Sa-Token配置
|
||||||
|
sa-token:
|
||||||
|
# token 名称 (同时也是cookie名称)
|
||||||
|
token-name: Authorization
|
||||||
|
# token 有效期,单位s 默认30天, -1代表永不过期
|
||||||
|
timeout: 2592000
|
||||||
|
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||||
|
activity-timeout: -1
|
||||||
|
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||||
|
is-concurrent: true
|
||||||
|
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||||
|
is-share: false
|
||||||
|
# token风格
|
||||||
|
token-style: random-128
|
||||||
|
# 是否输出操作日志
|
||||||
|
is-log: false
|
||||||
|
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
|
||||||
|
# token 前缀
|
||||||
|
token-prefix: Bearer
|
||||||
|
|
||||||
|
loki:
|
||||||
|
url: http://localhost:3100/loki/api/v1
|
||||||
|
systemName: lms
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<contextName>nlAdmin</contextName>
|
<contextName>nlAdmin</contextName>
|
||||||
<property name="log.charset" value="utf-8"/>
|
<property name="log.charset" value="utf-8"/>
|
||||||
<property name="log.pattern"
|
<property name="log.pattern"
|
||||||
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
|
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
|
||||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
<springProperty scope="context" name="lokiUrl" source="loki.url"/>
|
<springProperty scope="context" name="lokiUrl" source="loki.url"/>
|
||||||
<springProperty scope="context" name="systemName" source="loki.systemName"/>
|
<springProperty scope="context" name="systemName" source="loki.systemName"/>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = {
|
|||||||
/**
|
/**
|
||||||
* @description token key
|
* @description token key
|
||||||
*/
|
*/
|
||||||
TokenKey: 'EL-ADMIN-TOEKN',
|
TokenKey: 'NL-LMS-TOEKN',
|
||||||
/**
|
/**
|
||||||
* @description 请求超时时间,毫秒(默认2分钟)
|
* @description 请求超时时间,毫秒(默认2分钟)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user