Browse Source

init:项目初始化删除无用依赖

master
zhangzq 1 month ago
parent
commit
303b7a08c9
  1. 147
      nladmin-system/nlsso-server/pom.xml
  2. 9
      nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java
  3. 210
      nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ScpClientUtil.java
  4. 276
      nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/DesUtil.java
  5. 14
      nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/StringUtils.java
  6. 41
      nladmin-system/nlsso-server/src/main/java/org/nl/config/redis/RedisConvert.java
  7. 60
      nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadMonitorCollector.java
  8. 46
      nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/monitor/MonitorController.java
  9. 31
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/monitor/MonitorService.java
  10. 189
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/monitor/impl/MonitorServiceImpl.java
  11. 4
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/ISysParamService.java
  12. 1
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java
  13. 3
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/redis/impl/RedisServiceImpl.java
  14. 156
      nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml
  15. 197
      nladmin-system/nlsso-server/src/main/resources/config/application.yml

147
nladmin-system/nlsso-server/pom.xml

@ -32,44 +32,12 @@
</properties>
<dependencies>
<!--flywaydb-->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.dromara.dynamictp</groupId>
<artifactId>dynamic-tp-spring-boot-starter-adapter-webserver</artifactId>
<version>1.1.6.1</version>
</dependency>
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>tlog-all-spring-boot-starter</artifactId>
<version>1.5.0</version>
</dependency>
<!-- 控制台高亮-->
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.17.1</version>
</dependency>
<!--sqlserver-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.4.0.jre8</version>
<scope>runtime</scope>
</dependency>
<!--ORACLE-->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.4</version>
</dependency>
<!-- dynamic-datasource -->
<dependency>
<groupId>com.baomidou</groupId>
@ -120,6 +88,11 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.reflections</groupId>-->
<!-- <artifactId>reflections</artifactId>-->
<!-- <version>0.9.10</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
@ -130,12 +103,6 @@
<artifactId>mybatis-plus-generator</artifactId>
<version>3.4.0</version>
</dependency>
<!--Spring boot 安全框架-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
<!-- Sa-Token 权限认证 安全框架, 在线文档:http://sa-token.dev33.cn/ -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
@ -157,7 +124,6 @@
<artifactId>sa-token-dao-redis</artifactId>
<version>1.31.0</version>
</dependency>
<!-- Sa-Token插件:权限缓存与业务缓存分离 -->
<dependency>
<groupId>cn.dev33</groupId>
@ -165,19 +131,16 @@
<version>1.33.0</version>
</dependency>
<!-- spring boot 缓存 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<!--Spring boot Redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--spring boot 集成redis所需common-pool2-->
<dependency>
<groupId>org.apache.commons</groupId>
@ -188,21 +151,12 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!--监控sql日志-->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>${log4jdbc.version}</version>
</dependency>
<!--Mysql依赖包-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- druid数据源驱动 -->
<dependency>
<groupId>com.alibaba</groupId>
@ -214,19 +168,12 @@
<artifactId>mica-ip2region</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.lionsoul</groupId>
<artifactId>ip2region</artifactId>
<version>1.7.2</version>
</dependency>
<!--lombok插件-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>com.alibaba</groupId>
@ -248,11 +195,6 @@
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.0</version>
</dependency>
<!-- fastjson -->
<dependency>
@ -260,19 +202,6 @@
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!--mapStruct依赖-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
@ -285,14 +214,6 @@
<artifactId>easy-captcha</artifactId>
<version>1.6.2</version>
</dependency>
<!-- 解析客户端操作系统、浏览器信息 -->
<dependency>
<groupId>nl.basjes.parse.useragent</groupId>
<artifactId>yauaa</artifactId>
<version>5.23</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
@ -304,33 +225,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.21</version>
</dependency>
<!--WQL-->
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12.1</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.2</version>
</dependency>
<!--接口限流-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
@ -347,26 +241,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>${configuration.version}</version>
</dependency>
<!-- ****************** -->
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-starter-redis</artifactId>
<version>2.7.3</version>
</dependency>
<!-- jetcache2.7.x版本需要额外添加该依赖-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.3.1</version>
</dependency>
<!-- https://www.jianshu.com/p/e40d111c7bfc?utm_source=oschina-app 热部署 https://zhuanlan.zhihu.com/p/63381268-->
@ -392,32 +272,17 @@
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version>
</dependency>
<!-- quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>
<!-- linux的管理 -->
<dependency>
<groupId>ch.ethz.ganymed</groupId>
<artifactId>ganymed-ssh2</artifactId>
<version>build210</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
@ -439,7 +304,6 @@
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<!-- Lucence核心包 -->
<dependency>
<groupId>org.apache.lucene</groupId>
@ -480,7 +344,6 @@
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.16.4</version>
</dependency>
</dependencies>

9
nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java

@ -1,9 +1,9 @@
package org.nl;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
//import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
//import com.alicp.jetcache.anno.config.EnableMethodCache;
//import org.dromara.dynamictp.core.spring.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan;
import org.nl.config.SpringContextHolder;
import org.springframework.boot.ApplicationArguments;
@ -24,14 +24,11 @@ import org.springframework.web.bind.annotation.RestController;
*/
@EnableAsync
@RestController
@EnableDynamicTp
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})
@ServletComponentScan
@EnableTransactionManagement
@EnableMethodCache(basePackages = "org.nl")
@EnableCreateCacheAnnotation
@MapperScan("org.nl.**.mapper")
public class AppRun implements ApplicationRunner {

210
nladmin-system/nlsso-server/src/main/java/org/nl/common/mnt/util/ScpClientUtil.java

@ -1,105 +1,105 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.common.mnt.util;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.SCPClient;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* 远程执行linux命令
* @author: ZhangHouYing
* @date: 2019-08-10 10:06
*/
public class ScpClientUtil {
static private Map<String,ScpClientUtil> instance = Maps.newHashMap();
static synchronized public ScpClientUtil getInstance(String ip, int port, String username, String password) {
if (instance.get(ip) == null) {
instance.put(ip, new ScpClientUtil(ip, port, username, password));
}
return instance.get(ip);
}
public ScpClientUtil(String ip, int port, String username, String password) {
this.ip = ip;
this.port = port;
this.username = username;
this.password = password;
}
public void getFile(String remoteFile, String localTargetDirectory) {
Connection conn = new Connection(ip, port);
try {
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(username, password);
if (!isAuthenticated) {
System.err.println("authentication failed");
}
SCPClient client = new SCPClient(conn);
client.get(remoteFile, localTargetDirectory);
} catch (IOException ex) {
Logger.getLogger(SCPClient.class.getName()).log(Level.SEVERE, null, ex);
}finally{
conn.close();
}
}
public void putFile(String localFile, String remoteTargetDirectory) {
putFile(localFile, null, remoteTargetDirectory);
}
public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory) {
putFile(localFile, remoteFileName, remoteTargetDirectory,null);
}
public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory, String mode) {
Connection conn = new Connection(ip, port);
try {
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(username, password);
if (!isAuthenticated) {
System.err.println("authentication failed");
}
SCPClient client = new SCPClient(conn);
if ((mode == null) || (mode.length() == 0)) {
mode = "0600";
}
if (remoteFileName == null) {
client.put(localFile, remoteTargetDirectory);
} else {
client.put(localFile, remoteFileName, remoteTargetDirectory, mode);
}
} catch (IOException ex) {
Logger.getLogger(ScpClientUtil.class.getName()).log(Level.SEVERE, null, ex);
}finally{
conn.close();
}
}
private String ip;
private int port;
private String username;
private String password;
}
///*
// * Copyright 2019-2020 Zheng Jie
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//package org.nl.common.mnt.util;
//
//import ch.ethz.ssh2.Connection;
//import ch.ethz.ssh2.SCPClient;
//import com.google.common.collect.Maps;
//
//import java.io.IOException;
//import java.util.Map;
//import java.util.logging.Level;
//import java.util.logging.Logger;
//
///**
// * 远程执行linux命令
// * @author: ZhangHouYing
// * @date: 2019-08-10 10:06
// */
//public class ScpClientUtil {
//
// static private Map<String,ScpClientUtil> instance = Maps.newHashMap();
//
// static synchronized public ScpClientUtil getInstance(String ip, int port, String username, String password) {
// if (instance.get(ip) == null) {
// instance.put(ip, new ScpClientUtil(ip, port, username, password));
// }
// return instance.get(ip);
// }
//
// public ScpClientUtil(String ip, int port, String username, String password) {
// this.ip = ip;
// this.port = port;
// this.username = username;
// this.password = password;
// }
//
// public void getFile(String remoteFile, String localTargetDirectory) {
// Connection conn = new Connection(ip, port);
// try {
// conn.connect();
// boolean isAuthenticated = conn.authenticateWithPassword(username, password);
// if (!isAuthenticated) {
// System.err.println("authentication failed");
// }
// SCPClient client = new SCPClient(conn);
// client.get(remoteFile, localTargetDirectory);
// } catch (IOException ex) {
// Logger.getLogger(SCPClient.class.getName()).log(Level.SEVERE, null, ex);
// }finally{
// conn.close();
// }
// }
//
// public void putFile(String localFile, String remoteTargetDirectory) {
// putFile(localFile, null, remoteTargetDirectory);
// }
//
// public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory) {
// putFile(localFile, remoteFileName, remoteTargetDirectory,null);
// }
//
// public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory, String mode) {
// Connection conn = new Connection(ip, port);
// try {
// conn.connect();
// boolean isAuthenticated = conn.authenticateWithPassword(username, password);
// if (!isAuthenticated) {
// System.err.println("authentication failed");
// }
// SCPClient client = new SCPClient(conn);
// if ((mode == null) || (mode.length() == 0)) {
// mode = "0600";
// }
// if (remoteFileName == null) {
// client.put(localFile, remoteTargetDirectory);
// } else {
// client.put(localFile, remoteFileName, remoteTargetDirectory, mode);
// }
// } catch (IOException ex) {
// Logger.getLogger(ScpClientUtil.class.getName()).log(Level.SEVERE, null, ex);
// }finally{
// conn.close();
// }
// }
//
// private String ip;
// private int port;
// private String username;
// private String password;
//
//
//}

276
nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/DesUtil.java

@ -1,138 +1,138 @@
package org.nl.common.utils;
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.io.IOException;
import java.security.SecureRandom;
/**
* <p>
* Des加密解密算法工具类
* </p>
*
* @author lyd
* @since 2023-05-03
*/
public class DesUtil {
/**
* 加密算法是des
*/
private static final String ALGORITHM = "DES";
/**
* 转换格式
*/
private static final String TRANSFORMATION = "DES/CBC/PKCS5Padding";
/**
* 加密
*
* @param src 数据源
* @param key 密钥长度必须是8的倍数
* @return 返回加密后的数据
* @throws Exception 出错
*/
public static byte[] encrypt(byte[] src, byte[] key) throws Exception {
// DES算法要求有一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密匙数据建立 DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 建立一个密匙工厂,然后用它把DESKeySpec转换成
// 一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance(TRANSFORMATION);
// 用密匙原始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, securekey, new IvParameterSpec(key));
// 现在,获取数据并加密
// 正式执行加密操作
return cipher.doFinal(src);
}
/**
* 解密
*
* @param src 数据源
* @param key 密钥长度必须是8的倍数
* @return 返回解密后的原始数据
* @throws Exception 出错
*/
public static byte[] decrypt(byte[] src, byte[] key) throws Exception {
// DES算法要求有一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密匙数据建立一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 建立一个密匙工厂,然后用它把DESKeySpec对象转换成
// 一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance(TRANSFORMATION);
// 用密匙原始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, securekey, new IvParameterSpec(key));
// 现在,获取数据并解密
// 正式执行解密操作
return cipher.doFinal(src);
}
/**
* Description 根据键值进行加密
*
* @param data
* @param key 加密键byte数组
* @return
* @throws Exception
*/
public static String encrypt(String data, String key) throws Exception {
byte[] bt = encrypt(data.getBytes("UTF-8"), key.getBytes("UTF-8"));
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(bt);
//return new String(Base64.encodeBase64(bt), "UTF-8");
}
/**
* Description 根据键值进行解密
*
* @param data
* @param key 加密键byte数组
* @return
* @throws IOException
* @throws Exception
*/
public static String decrypt(String data, String key) throws Exception {
if (data == null)
return null;
BASE64Decoder decoder = new BASE64Decoder();
byte[] buf = decoder.decodeBuffer(data);
byte[] bt = decrypt(buf, key.getBytes("UTF-8"));
return new String(bt, "UTF-8");
}
public static void main(String[] args) throws Exception {
//uL8fXioyU2M=
String key = "11111111";
String pp = encrypt("123456", key);
System.out.println("加密:" + pp);
String mm2 = decrypt(pp, key);
System.out.println("解密:" + mm2);
}
}
//package org.nl.common.utils;
//
////
//// Source code recreated from a .class file by IntelliJ IDEA
//// (powered by FernFlower decompiler)
////
//
//
//import sun.misc.BASE64Decoder;
//import sun.misc.BASE64Encoder;
//
//import javax.crypto.Cipher;
//import javax.crypto.SecretKey;
//import javax.crypto.SecretKeyFactory;
//import javax.crypto.spec.DESKeySpec;
//import javax.crypto.spec.IvParameterSpec;
//import java.io.IOException;
//import java.security.SecureRandom;
//
///**
// * <p>
// * Des加密解密算法工具类
// * </p>
// *
// * @author lyd
// * @since 2023-05-03
// */
//public class DesUtil {
// /**
// * 加密算法是des
// */
// private static final String ALGORITHM = "DES";
// /**
// * 转换格式
// */
// private static final String TRANSFORMATION = "DES/CBC/PKCS5Padding";
//
// /**
// * 加密
// *
// * @param src 数据源
// * @param key 密钥,长度必须是8的倍数
// * @return 返回加密后的数据
// * @throws Exception 出错
// */
// public static byte[] encrypt(byte[] src, byte[] key) throws Exception {
// // DES算法要求有一个可信任的随机数源
// SecureRandom sr = new SecureRandom();
// // 从原始密匙数据建立 DESKeySpec对象
// DESKeySpec dks = new DESKeySpec(key);
// // 建立一个密匙工厂,然后用它把DESKeySpec转换成
// // 一个SecretKey对象
// SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
// SecretKey securekey = keyFactory.generateSecret(dks);
// // Cipher对象实际完成加密操作
// Cipher cipher = Cipher.getInstance(TRANSFORMATION);
// // 用密匙原始化Cipher对象
// cipher.init(Cipher.ENCRYPT_MODE, securekey, new IvParameterSpec(key));
// // 现在,获取数据并加密
// // 正式执行加密操作
// return cipher.doFinal(src);
// }
//
// /**
// * 解密
// *
// * @param src 数据源
// * @param key 密钥,长度必须是8的倍数
// * @return 返回解密后的原始数据
// * @throws Exception 出错
// */
// public static byte[] decrypt(byte[] src, byte[] key) throws Exception {
// // DES算法要求有一个可信任的随机数源
// SecureRandom sr = new SecureRandom();
// // 从原始密匙数据建立一个DESKeySpec对象
// DESKeySpec dks = new DESKeySpec(key);
// // 建立一个密匙工厂,然后用它把DESKeySpec对象转换成
// // 一个SecretKey对象
// SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
// SecretKey securekey = keyFactory.generateSecret(dks);
// // Cipher对象实际完成解密操作
// Cipher cipher = Cipher.getInstance(TRANSFORMATION);
// // 用密匙原始化Cipher对象
// cipher.init(Cipher.DECRYPT_MODE, securekey, new IvParameterSpec(key));
// // 现在,获取数据并解密
// // 正式执行解密操作
// return cipher.doFinal(src);
// }
//
// /**
// * Description 根据键值进行加密
// *
// * @param data
// * @param key 加密键byte数组
// * @return
// * @throws Exception
// */
// public static String encrypt(String data, String key) throws Exception {
// byte[] bt = encrypt(data.getBytes("UTF-8"), key.getBytes("UTF-8"));
//
// BASE64Encoder encoder = new BASE64Encoder();
// return encoder.encode(bt);
//
// //return new String(Base64.encodeBase64(bt), "UTF-8");
// }
//
// /**
// * Description 根据键值进行解密
// *
// * @param data
// * @param key 加密键byte数组
// * @return
// * @throws IOException
// * @throws Exception
// */
// public static String decrypt(String data, String key) throws Exception {
// if (data == null)
// return null;
// BASE64Decoder decoder = new BASE64Decoder();
// byte[] buf = decoder.decodeBuffer(data);
//
// byte[] bt = decrypt(buf, key.getBytes("UTF-8"));
// return new String(bt, "UTF-8");
// }
//
//
// public static void main(String[] args) throws Exception {
// //uL8fXioyU2M=
// String key = "11111111";
// String pp = encrypt("123456", key);
// System.out.println("加密:" + pp);
//
// String mm2 = decrypt(pp, key);
// System.out.println("解密:" + mm2);
//
// }
//
//}

14
nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/StringUtils.java

@ -21,8 +21,6 @@ import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
import net.dreamlu.mica.ip2region.core.IpInfo;
import nl.basjes.parse.useragent.UserAgent;
import nl.basjes.parse.useragent.UserAgentAnalyzer;
import org.nl.config.ElAdminProperties;
import org.nl.config.SpringContextHolder;
@ -50,13 +48,6 @@ public class StringUtils {
private final static Ip2regionSearcher IP_SEARCHER = SpringContextHolder.getBean(Ip2regionSearcher.class);
private static final UserAgentAnalyzer USER_AGENT_ANALYZER = UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.withCache(10000)
.withField(UserAgent.AGENT_NAME_VERSION)
.build();
/**
* 驼峰命名法工具
*
@ -209,10 +200,9 @@ public class StringUtils {
return null;
}
//浏览器信息
public static String getBrowser(HttpServletRequest request) {
UserAgent.ImmutableUserAgent userAgent = USER_AGENT_ANALYZER.parse(request.getHeader("User-Agent"));
return userAgent.get(UserAgent.AGENT_NAME_VERSION).getValue();
return "";
}
/**

41
nladmin-system/nlsso-server/src/main/java/org/nl/config/redis/RedisConvert.java

@ -1,41 +0,0 @@
package org.nl.config.redis;
import cn.hutool.core.util.StrUtil;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import org.nl.system.service.redis.vo.RedisMonitorRespVO;
import java.util.ArrayList;
import java.util.Properties;
/**
* @Author: lyd
* @Description: redis---Spring Boot 对象转换 MapStruct
* @Date: 2022-08-04
*/
@Mapper
public interface RedisConvert {
RedisConvert INSTANCE = Mappers.getMapper(RedisConvert.class);
/**
* 创建
* @param info
* @param dbSize
* @param commandStats
* @return RedisMonitorRespVO
*/
default RedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) {
RedisMonitorRespVO respVO = RedisMonitorRespVO.builder().info(info).dbSize(dbSize)
.commandStats(new ArrayList<>(commandStats.size())).build();
commandStats.forEach((key, value) -> {
respVO.getCommandStats().add(RedisMonitorRespVO.CommandStat.builder()
.command(StrUtil.subAfter((String) key, "cmdstat_", false))
.calls(Integer.valueOf(StrUtil.subBetween((String) value, "calls=", ",")))
.usec(Long.valueOf(StrUtil.subBetween((String) value, "usec=", ",")))
.build());
});
return respVO;
}
}

60
nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadMonitorCollector.java

@ -1,30 +1,30 @@
package org.nl.config.thread;
import lombok.extern.slf4j.Slf4j;
import org.dromara.dynamictp.common.entity.ThreadPoolStats;
import org.dromara.dynamictp.core.monitor.collector.AbstractCollector;
/**
* @Author: lyd
* @Description: 线程监控
* @Date: 2023/12/25
*/
@Slf4j
public class ThreadMonitorCollector extends AbstractCollector {
public static ThreadPoolStats TOMCAT_THREAD;
public static ThreadPoolStats EL_THREAD;
@Override
public void collect(ThreadPoolStats threadPoolStats) {
if ("tomcatTp".equals(threadPoolStats.getPoolName())) {
ThreadMonitorCollector.TOMCAT_THREAD = threadPoolStats;
} else {
ThreadMonitorCollector.EL_THREAD = threadPoolStats;
}
log.info("线程池数据:{}", threadPoolStats);
}
@Override
public String type() {
return "test_collect";
}
}
//package org.nl.config.thread;
//
//import lombok.extern.slf4j.Slf4j;
//import org.dromara.dynamictp.common.entity.ThreadPoolStats;
//import org.dromara.dynamictp.core.monitor.collector.AbstractCollector;
//
///**
// * @Author: lyd
// * @Description: 线程监控
// * @Date: 2023/12/25
// */
//@Slf4j
//public class ThreadMonitorCollector extends AbstractCollector {
// public static ThreadPoolStats TOMCAT_THREAD;
// public static ThreadPoolStats EL_THREAD;
// @Override
// public void collect(ThreadPoolStats threadPoolStats) {
// if ("tomcatTp".equals(threadPoolStats.getPoolName())) {
// ThreadMonitorCollector.TOMCAT_THREAD = threadPoolStats;
// } else {
// ThreadMonitorCollector.EL_THREAD = threadPoolStats;
// }
// log.info("线程池数据:{}", threadPoolStats);
// }
//
// @Override
// public String type() {
// return "test_collect";
// }
//}

46
nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/monitor/MonitorController.java

@ -1,46 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.system.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.nl.system.service.monitor.MonitorService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Zheng Jie
* @date 2020-05-02
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/monitor")
public class MonitorController {
private final MonitorService serverService;
@GetMapping
@SaCheckPermission("monitor:list")
public ResponseEntity<Object> query() {
return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK);
}
}

31
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/monitor/MonitorService.java

@ -1,31 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.system.service.monitor;
import java.util.Map;
/**
* @author Zheng Jie
* @date 2020-05-02
*/
public interface MonitorService {
/**
* 查询数据分页
* @return Map<String,Object>
*/
Map<String,Object> getServers();
}

189
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/monitor/impl/MonitorServiceImpl.java

@ -1,189 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.system.service.monitor.impl;
import cn.hutool.core.date.BetweenFormatter;
import cn.hutool.core.date.DateUtil;
import org.nl.common.utils.ElAdminConstant;
import org.nl.common.utils.FileUtil;
import org.nl.common.utils.StringUtils;
import org.nl.system.service.monitor.MonitorService;
import org.springframework.stereotype.Service;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.hardware.VirtualMemory;
import oshi.software.os.FileSystem;
import oshi.software.os.OSFileStore;
import oshi.software.os.OperatingSystem;
import oshi.util.FormatUtil;
import oshi.util.Util;
import java.lang.management.ManagementFactory;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author Zheng Jie
* @date 2020-05-02
*/
@Service
public class MonitorServiceImpl implements MonitorService {
private final DecimalFormat df = new DecimalFormat("0.00");
@Override
public Map<String,Object> getServers(){
Map<String, Object> resultMap = new LinkedHashMap<>(8);
try {
SystemInfo si = new SystemInfo();
OperatingSystem os = si.getOperatingSystem();
HardwareAbstractionLayer hal = si.getHardware();
// 系统信息
resultMap.put("sys", getSystemInfo(os));
// cpu 信息
resultMap.put("cpu", getCpuInfo(hal.getProcessor()));
// 内存信息
resultMap.put("memory", getMemoryInfo(hal.getMemory()));
// 交换区信息
resultMap.put("swap", getSwapInfo(hal.getMemory()));
// 磁盘
resultMap.put("disk", getDiskInfo(os));
resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss"));
} catch (Exception e) {
e.printStackTrace();
}
return resultMap;
}
/**
* 获取磁盘信息
* @return /
*/
private Map<String,Object> getDiskInfo(OperatingSystem os) {
Map<String,Object> diskInfo = new LinkedHashMap<>();
FileSystem fileSystem = os.getFileSystem();
List<OSFileStore> fsArray = fileSystem.getFileStores();
String osName = System.getProperty("os.name");
long available = 0, total = 0;
for (OSFileStore fs : fsArray){
// windows 需要将所有磁盘分区累加,linux 和 mac 直接累加会出现磁盘重复的问题,待修复
if(osName.toLowerCase().startsWith(ElAdminConstant.WIN)) {
available += fs.getUsableSpace();
total += fs.getTotalSpace();
} else {
available = fs.getUsableSpace();
total = fs.getTotalSpace();
break;
}
}
long used = total - available;
diskInfo.put("total", total > 0 ? FileUtil.getSize(total) : "?");
diskInfo.put("available", FileUtil.getSize(available));
diskInfo.put("used", FileUtil.getSize(used));
diskInfo.put("usageRate", df.format(used/(double)total * 100));
return diskInfo;
}
/**
* 获取交换区信息
* @param memory /
* @return /
*/
private Map<String,Object> getSwapInfo(GlobalMemory memory) {
Map<String,Object> swapInfo = new LinkedHashMap<>();
VirtualMemory virtualMemory = memory.getVirtualMemory();
long total = virtualMemory.getSwapTotal();
long used = virtualMemory.getSwapUsed();
swapInfo.put("total", FormatUtil.formatBytes(total));
swapInfo.put("used", FormatUtil.formatBytes(used));
swapInfo.put("available", FormatUtil.formatBytes(total - used));
if(used == 0){
swapInfo.put("usageRate", 0);
} else {
swapInfo.put("usageRate", df.format(used/(double)total * 100));
}
return swapInfo;
}
/**
* 获取内存信息
* @param memory /
* @return /
*/
private Map<String,Object> getMemoryInfo(GlobalMemory memory) {
Map<String,Object> memoryInfo = new LinkedHashMap<>();
memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal()));
memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable()));
memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable()));
memoryInfo.put("usageRate", df.format((memory.getTotal() - memory.getAvailable())/(double)memory.getTotal() * 100));
return memoryInfo;
}
/**
* 获取Cpu相关信息
* @param processor /
* @return /
*/
private Map<String,Object> getCpuInfo(CentralProcessor processor) {
Map<String,Object> cpuInfo = new LinkedHashMap<>();
cpuInfo.put("name", processor.getProcessorIdentifier().getName());
cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU");
cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心");
cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount());
cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU");
// CPU信息
long[] prevTicks = processor.getSystemCpuLoadTicks();
// 等待1秒...
Util.sleep(1000);
long[] ticks = processor.getSystemCpuLoadTicks();
long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
long totalCpu = user + nice + sys + idle + iowait + irq + softirq + steal;
cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu));
cpuInfo.put("idle", df.format(100d * idle / totalCpu));
return cpuInfo;
}
/**
* 获取系统相关信息,系统运行天数系统IP
* @param os /
* @return /
*/
private Map<String,Object> getSystemInfo(OperatingSystem os){
Map<String,Object> systemInfo = new LinkedHashMap<>();
// jvm 运行时间
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
Date date = new Date(time);
// 计算项目运行时间 5.4.3:BetweenFormater, 5.7.14改名为BetweenFormatter
String formatBetween = DateUtil.formatBetween(date, new Date(), BetweenFormatter.Level.HOUR);
// 系统信息
systemInfo.put("os", os.toString());
systemInfo.put("day", formatBetween);
systemInfo.put("ip", StringUtils.getLocalIp());
return systemInfo;
}
}

4
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/ISysParamService.java

@ -1,8 +1,6 @@
package org.nl.system.service.param;
import com.alicp.jetcache.anno.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.system.service.param.dao.Param;
@ -42,7 +40,6 @@ public interface ISysParamService extends IService<Param> {
*
* @param param
*/
@CacheUpdate(name = "paramDataCode.", key = "#param.code", value = "#param")
void update(Param param);
/**
@ -58,6 +55,5 @@ public interface ISysParamService extends IService<Param> {
* @param code
* @return Param
*/
@Cached(name = "paramDataCode.", key = "#code", expire = 3600, cacheType = CacheType.REMOTE)
Param findByCode(String code);
}

1
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java

@ -18,6 +18,7 @@ import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.dao.Param;
import org.nl.system.service.param.dao.mapper.SysParamMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

3
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/redis/impl/RedisServiceImpl.java

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.system.service.redis.RedisService;
import org.nl.config.redis.RedisConvert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.connection.RedisServerCommands;
@ -40,7 +39,7 @@ public class RedisServiceImpl implements RedisService {
// 拼接结果返回
// 转成实体
JSONObject json = new JSONObject();
json.put("info", RedisConvert.INSTANCE.build(info, dbSize, commandStats));
json.put("info",json);
return json;
}

156
nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -1,30 +1,132 @@
server:
port: 8011
# 项目配置
nl:
config:
mysql:
ip: 192.168.81.251
port: 3306
port: 8099
max-http-header-size: 65536
#配置数据源
spring:
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://${DB_HOST:192.168.8.218}:${DB_PORT:3306}/${DB_NAME:wms}?serverTimxezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
url: jdbc:mysql://192.168.81.251:3306/wms_oulun?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: root
password: 123456
database: wms_oulun
redis:
ip: 127.0.0.1
port: 6379
password: null
database: 1
oracle:
ip: 172.27.37.66
port: 1521
scheme: RTMES
username: LMSTELCOM
password: LMSTELCOM_6463
sqlserver:
ip: 10.93.41.2
port: WINCC
username: sa
password: 123
database: 马钢_RH
logging-path: C:\log\wms
dynamic-log-path: C:\log\lms
# 初始连接数
initial-size: 15
# 最小连接数
min-idle: 25
# 最大连接数
max-active: 40
# 是否自动回收超时连接
remove-abandoned: true
# 超时时间(以秒数为单位)
remove-abandoned-timeout: 20
# 获取连接超时时间
max-wait: 9000
# 连接有效性检测时间
time-between-eviction-runs-millis: 60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis: 900000
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
test-while-idle: true
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
test-on-borrow: true
# 是否在归还到池中前进行检验
test-on-return: false
# 检测连接是否有效
validation-query: select 1
# 配置监控统计
webStatFilter:
enabled: true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
reset-enable: false
filters:
DruidFilter,stat
redis:
#数据库索引
database: ${REDIS_DB:1}
#host: ${REDIS_HOST:127.0.0.1}
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:}
#连接超时时间
timeout: 5000
redisson:
config: |
threads: 4
nettyThreads: 4
singleServerConfig:
connectionMinimumIdleSize: 8
connectionPoolSize: 8
address: redis://127.0.0.1:6379
idleConnectionTimeout: 10000
timeout: 3000
# 登录相关配置
login:
# 登录缓存
cache-enable: true
# 是否限制单用户登录
single-login: false
# 验证码
login-code:
# 验证码类型配置 查看 LoginProperties 类
code-type: arithmetic
# 登录图形验证码有效时间/分钟
expiration: 2
# 验证码高度
width: 111
# 验证码宽度
heigth: 36
# 内容长度
length: 2
# 字体名称,为空则使用默认字体
font-name:
# 字体大小
font-size: 25
#jwt
jwt:
header: Authorization
# 令牌前缀
token-start-with: Bearer
# 必须使用最少88位的Base64对该令牌进行编码
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
token-validity-in-seconds: 14400000
# 在线用户key
online-key: online-token-
# 验证码
code-key: code-key-
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
detect: 1800000
# 续期时间范围,默认1小时,单位毫秒
renew: 3600000
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:
is-read-cookie: false
is-print: false
lucene:
index:
path: D:\lms\lucene\index

197
nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -12,80 +12,6 @@ spring:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
messages:
basename: language/login/login,language/error/error,language/buss/buss,language/task/task
datasource:
druid:
initial-size: 5 #初始化时建立物理连接的个数
min-idle: 15 #最小连接池数量
maxActive: 30 #最大连接池数量
maxWait: 3000 #获取连接时最大等待时间,单位毫秒
#申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
test-while-idle: true
time-between-eviction-runs-millis: 300000 #既作为检测的间隔时间又作为test-while-idle执行的依据
min-evictable-idle-time-millis: 900000 #销毁线程时检测当前连接的最后活动时间和当前时间差大于该值时,关闭当前连接
#用来检测连接是否有效的sql
#mysql中为 select 'x'
#oracle中为 select 1 from dual
validation-query: SELECT 'x'
test-on-borrow: true #申请连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
test-on-return: false #归还连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
exception-sorter: true #当数据库抛出不可恢复的异常时,抛弃该连接
pool-prepared-statements: true #是否缓存preparedStatement,mysql5.5+建议开启
max-pool-prepared-statement-per-connection-size: 20 #当值大于20时poolPreparedStatements会自动修改为true
#通过connectProperties属性来打开mergeSql功能;慢SQL记录
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
use-global-data-source-stat: true #合并多个DruidDataSource的监控数据
#filters通过别名的方式配置扩展插件,常用的插件有:
#监控统计用的filter:stat 日志用的filter:log4j 防御sql注入的filter:wall
filter:
stat:
enabled: true
# 记录慢SQL
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
#设置访问druid监控页面的拦截路径及账号和密码,默认没有
stat-view-servlet:
enabled: true
url-pattern: /druid/*
login-username: admin
login-password: admin
dynamic:
primary: mysql
datasource:
mysql:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:${nl.config.mysql.ip}}:${DB_PORT:${nl.config.mysql.port}}/${DB_NAME:${nl.config.mysql.database}}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: ${DB_USER:${nl.config.mysql.username}}
password: ${DB_PWD:${nl.config.mysql.password}}
type: com.alibaba.druid.pool.DruidDataSource
oracle:
driver-class-name: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@${nl.config.oracle.ip}:${nl.config.oracle.port}:${nl.config.oracle.scheme}
username: ${DB_USER:${nl.config.oracle.username}}
password: ${DB_PWD:${nl.config.oracle.password}}
type: com.alibaba.druid.pool.DruidDataSource
sqlserver:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://${nl.config.sqlserver.ip}\${nl.config.sqlserver.port};DatabaseName=${nl.config.sqlserver.database}
username: ${DB_USER:${nl.config.sqlserver.username}}
password: ${DB_PWD:${nl.config.sqlserver.password}}
type: com.alibaba.druid.pool.DruidDataSource
flyway:
#开启
enabled: true
#当迁移时发现目标schema非空,而且带有没有元数据的表时,是否自动执行基准迁移,默认false.
baseline-on-migrate: true
# 检测迁移脚本的路径是否存在,如不存在,则抛出异常
check-location: true
#sql脚本位置
locations: classpath:db/migration
#是否允许无序的迁移,默认false
out-of-order: false
#编码
encoding: UTF-8
freemarker:
check-template-location: false
jackson:
@ -94,61 +20,6 @@ spring:
redis:
repositories:
enabled: false
redis:
# 数据库索引
host: ${REDIS_HOST:${nl.config.redis.ip}}
port: ${REDIS_PORT:${nl.config.redis.port}}
password: ${REDIS_PWD:${nl.config.redis.password}}
redisson:
config: |
threads: 4
nettyThreads: 4
singleServerConfig:
database: 3
connectionMinimumIdleSize: 8
connectionPoolSize: 8
address: redis://127.0.0.1:6379
idleConnectionTimeout: 10000
timeout: 3000
dynamic:
tp:
enabled: true # 是否启用 dynamictp,默认true
enabledBanner: false # 是否启用 控制台banner,默认true
enabledCollect: true # 是否开启监控指标采集,默认true
collectorTypes: logging,test_collect # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer
logPath: ${nl.config.dynamic-log-path} # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置
monitorInterval: 8
tomcatTp: # tomcat webserver 线程池配置
threadPoolAliasName: tomcat 线程池 # 线程池别名,可选
corePoolSize: 100
maximumPoolSize: 200
keepAliveTime: 60
runTimeout: 10000
queueTimeout: 100
notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警)
- type: change
enabled: true
- type: capacity # 队列容量使用率,报警项类型,查看源码 NotifyTypeEnum枚举类
enabled: true
threshold: 80 # 报警阈值,默认70,意思是队列使用率达到70%告警
interval: 120 # 报警间隔(单位:s),默认120
- type: liveness # 线程池活性
enabled: true
threshold: 80 # 报警阈值,默认 70,意思是活性达到70%告警
- type: reject # 触发任务拒绝告警
enabled: true
threshold: 100 # 默认阈值10
- type: run_timeout # 任务执行超时告警
enabled: true
threshold: 100 # 默认阈值10
- type: queue_timeout # 任务排队超时告警
enabled: true
threshold: 100 # 默认阈值10
task:
pool:
# 核心线程池大小
@ -236,71 +107,3 @@ mybatis-plus:
db-config:
id-type: INPUT
banner: false
# 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
sso:
# Ticket有效期 (单位: 秒),默认五分钟
ticket-timeout: 300
# 所有允许的授权回调地址
allow-url: "*"
# 是否打开单点注销功能
is-slo: true
# ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开)
# 是否打开模式三
isHttp: true
# 接口调用秘钥(用于SSO模式三的单点注销功能)
secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor
# ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明)
is-read-cookie: true
is-print: false
# 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口
token-session-check-login: false
alone-redis:
# Redis数据库索引(默认为0)
database: ${nl.config.redis.database}
# Redis服务器地址
host: ${nl.config.redis.ip}
# Redis服务器连接端口
port: ${nl.config.redis.port}
# Redis服务器连接密码(默认为空)
password:
# 连接超时时间
timeout: 10s
jetcache:
statIntervalMinutes: 15
areaInCacheName: false
local:
default:
type: linkedhashmap
keyConvertor: fastjson
remote:
default:
type: redis
keyConvertor: fastjson2
broadcastChannel: projectA
valueEncoder: java
valueDecoder: java
poolConfig:
minIdle: 5
maxIdle: 20
maxTotal: 50
host: ${nl.config.redis.ip}
port: ${nl.config.redis.port}

Loading…
Cancel
Save