diff --git a/acs/nladmin-system/src/main/java/org/nl/autotask/CleanLog.java b/acs/nladmin-system/src/main/java/org/nl/autotask/CleanLog.java index 3d82c43..2a08302 100644 --- a/acs/nladmin-system/src/main/java/org/nl/autotask/CleanLog.java +++ b/acs/nladmin-system/src/main/java/org/nl/autotask/CleanLog.java @@ -1,4 +1,4 @@ -package org.nl.wms.autotask; +package org.nl.autotask; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java b/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java deleted file mode 100644 index 7737724..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java +++ /dev/null @@ -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); - } - -} diff --git a/acs/nladmin-ui/src/settings.js b/acs/nladmin-ui/src/settings.js index 1d46e5e..91fbaf4 100644 --- a/acs/nladmin-ui/src/settings.js +++ b/acs/nladmin-ui/src/settings.js @@ -40,7 +40,7 @@ module.exports = { /** * @description token key */ - TokenKey: 'EL-ADMIN-TOEKN', + TokenKey: 'NL-ACS-TOEKN', /** * @description 请求超时时间,毫秒(默认2分钟) */ diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java b/lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java deleted file mode 100644 index 7c256bd..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java +++ /dev/null @@ -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); - } - } - -} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java index a057372..db45d9e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java @@ -97,7 +97,7 @@ public class AutoCreateTask { taskList.forEach(item -> { JSONObject taskObj = new JSONObject(); 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("update_time", DateUtil.now()); taskTab.update(taskObj); diff --git a/lms/nladmin-system/src/main/resources/config/application-prod.yml b/lms/nladmin-system/src/main/resources/config/application-prod.yml index ecf4775..e03c00e 100644 --- a/lms/nladmin-system/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/src/main/resources/config/application-prod.yml @@ -6,9 +6,9 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource 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} - password: ${DB_PWD:whxr_root} + password: ${DB_PWD:P@ssw0rd} # 初始连接数 initial-size: 5 # 最小连接数 @@ -54,7 +54,7 @@ spring: redis: #数据库索引 database: ${REDIS_DB:15} - host: ${REDIS_HOST:10.16.1.25} + host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} #连接超时时间 @@ -137,3 +137,28 @@ logging: file: path: /app/jar/logs 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 + diff --git a/lms/nladmin-ui/src/settings.js b/lms/nladmin-ui/src/settings.js index 1d46e5e..860639a 100644 --- a/lms/nladmin-ui/src/settings.js +++ b/lms/nladmin-ui/src/settings.js @@ -40,7 +40,7 @@ module.exports = { /** * @description token key */ - TokenKey: 'EL-ADMIN-TOEKN', + TokenKey: 'NL-LMS-TOEKN', /** * @description 请求超时时间,毫秒(默认2分钟) */