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

This commit is contained in:
zhangzq
2025-06-24 16:09:54 +08:00
parent 0dcde5740b
commit 303b7a08c9
15 changed files with 412 additions and 968 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -21,8 +21,6 @@ import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher; import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
import net.dreamlu.mica.ip2region.core.IpInfo; 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.ElAdminProperties;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
@@ -50,13 +48,6 @@ public class StringUtils {
private final static Ip2regionSearcher IP_SEARCHER = SpringContextHolder.getBean(Ip2regionSearcher.class); 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; return null;
} }
//浏览器信息
public static String getBrowser(HttpServletRequest request) { public static String getBrowser(HttpServletRequest request) {
UserAgent.ImmutableUserAgent userAgent = USER_AGENT_ANALYZER.parse(request.getHeader("User-Agent")); return "";
return userAgent.get(UserAgent.AGENT_NAME_VERSION).getValue();
} }
/** /**

View File

@@ -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;
}
}

View File

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

View File

@@ -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);
}
}

View File

@@ -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();
}

View File

@@ -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;
}
}

View File

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

View File

@@ -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.Param;
import org.nl.system.service.param.dao.mapper.SysParamMapper; import org.nl.system.service.param.dao.mapper.SysParamMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

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

View File

@@ -1,30 +1,132 @@
server: server:
port: 8011 port: 8099
# 项目配置 max-http-header-size: 65536
nl: #配置数据源
config: spring:
mysql: datasource:
ip: 192.168.81.251 druid:
port: 3306 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 username: root
password: 123456 password: 123456
database: wms_oulun # 初始连接数
redis: initial-size: 15
ip: 127.0.0.1 # 最小连接数
port: 6379 min-idle: 25
password: null # 最大连接数
database: 1 max-active: 40
oracle: # 是否自动回收超时连接
ip: 172.27.37.66 remove-abandoned: true
port: 1521 # 超时时间(以秒数为单位)
scheme: RTMES remove-abandoned-timeout: 20
username: LMSTELCOM # 获取连接超时时间
password: LMSTELCOM_6463 max-wait: 9000
sqlserver: # 连接有效性检测时间
ip: 10.93.41.2 time-between-eviction-runs-millis: 60000
port: WINCC # 连接在池中最小生存的时间
username: sa min-evictable-idle-time-millis: 300000
password: 123 # 连接在池中最大生存的时间
database: 马钢_RH max-evictable-idle-time-millis: 900000
logging-path: C:\log\wms # 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
dynamic-log-path: C:\log\lms 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

View File

@@ -12,80 +12,6 @@ spring:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
messages: messages:
basename: language/login/login,language/error/error,language/buss/buss,language/task/task 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: freemarker:
check-template-location: false check-template-location: false
jackson: jackson:
@@ -94,61 +20,6 @@ spring:
redis: redis:
repositories: repositories:
enabled: false 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: task:
pool: pool:
# 核心线程池大小 # 核心线程池大小
@@ -236,71 +107,3 @@ mybatis-plus:
db-config: db-config:
id-type: INPUT id-type: INPUT
banner: false 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}