add:增加加密作为演示的代码版本;

This commit is contained in:
2026-06-16 09:52:04 +08:00
parent 9c4e0f16ab
commit ee04e1fcf0
16 changed files with 308 additions and 119 deletions

View File

@@ -595,6 +595,32 @@
<mainClass>org.nl.AppRun</mainClass>
</configuration>
</plugin>
<!-- ClassFinal 字节码加密插件 -->
<plugin>
<groupId>com.gitee.lcm742320521</groupId>
<artifactId>classfinal-maven-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<!-- 加密密码,请务必修改为强密码并妥善保管 -->
<password>nl2024</password>
<!-- 需要加密的包名,多个包用逗号分隔,通常为核心业务包 -->
<packages>org.nl</packages>
<!-- 需要加密的配置文件,如 yml/properties -->
<cfgfiles>application.yml,application-dev.yml,application-prod.yml,application-prod2.yml</cfgfiles>
<!-- 排除某些包如实体类、DTO避免加密后影响框架使用 -->
<excludes>org.nl.**.domain.**</excludes>
<!-- 可选绑定机器码使加密后的jar包只能在指定机器上运行 -->
<!-- <code>目标机器的唯一标识码</code> -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>classFinal</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 跳过单元测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@@ -28,7 +28,7 @@ public abstract class AbstractAutoRunnable implements Runnable {
try {
this.before();
//子类该方法是个死循环
this.autoRun();
// this.autoRun();
this.setStopMessage(true_clear);
} catch (Throwable arg5) {
log.warn("", arg5);

View File

@@ -16,7 +16,7 @@ import org.springframework.stereotype.Repository;
public interface DeviceMapper extends CommonMapper<Device> {
String QUERY_DEVICE_SQL = "SELECT d.*, dict.label AS device_type_name, dict2.label AS region_name " +
"FROM " +
"ACS_DEVICE d " +
"acs_device d " +
"LEFT JOIN sys_dict dict ON dict.value = d.device_type " +
"AND dict.`code` = 'device_type' " +
"LEFT JOIN sys_dict dict2 ON dict2.value = d.region " +

View File

@@ -74,46 +74,46 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
@Override
public void autoRun() throws Exception {
for (int i = 0; !OpcStartTag.is_run; ++i) {
log.info("设备执行线程等待opc同步线程...");
Thread.sleep(1000L);
if (i > 60) {
log.info("设备执行线程放弃等待opc同步线程...");
break;
}
}
// for (int i = 0; !OpcStartTag.is_run; ++i) {
// log.info("设备执行线程等待opc同步线程...");
// Thread.sleep(1000L);
// if (i > 60) {
// log.info("设备执行线程放弃等待opc同步线程...");
// break;
// }
// }
//
// Thread.sleep(10000L);
// log.info("设备执行线程开始...");
Thread.sleep(10000L);
log.info("设备执行线程开始...");
while (true) {
Thread.sleep((long) this.loop_time_millions);
List<ExecutableDeviceDriver> deviceDrivers = this.deviceAppService.findDeviceDriver(ExecutableDeviceDriver.class);
Iterator it = deviceDrivers.iterator();
while (it.hasNext()) {
final ExecutableDeviceDriver deviceDriver = (ExecutableDeviceDriver) it.next();
//不包含正在执行的线程,则进行执行
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
BlockedRunable runnable = new BlockedRunable() {
@Override
public void subRun() {
deviceDriver.executeAuto();
}
@Override
public String getCode() {
return deviceDriver.getDeviceCode();
}
};
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
this.runs.put(deviceDriver.getDeviceCode(), runnable);
}
runnable.setIndex(this.runs);
this.executorService.submit(runnable);
}
}
}
// while (false) {
// Thread.sleep((long) this.loop_time_millions);
// List<ExecutableDeviceDriver> deviceDrivers = this.deviceAppService.findDeviceDriver(ExecutableDeviceDriver.class);
//
// Iterator it = deviceDrivers.iterator();
// while (it.hasNext()) {
// final ExecutableDeviceDriver deviceDriver = (ExecutableDeviceDriver) it.next();
// //不包含正在执行的线程,则进行执行
// if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
// BlockedRunable runnable = new BlockedRunable() {
// @Override
// public void subRun() {
// deviceDriver.executeAuto();
// }
//
// @Override
// public String getCode() {
// return deviceDriver.getDeviceCode();
// }
// };
// if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
// this.runs.put(deviceDriver.getDeviceCode(), runnable);
// }
//
// runnable.setIndex(this.runs);
// this.executorService.submit(runnable);
// }
// }
// }
}
}

View File

@@ -30,13 +30,13 @@ public class SocketListenerAutoRun extends AbstractAutoRunnable implements Socke
}
public static void main(String[] args) throws Exception {
SocketListenerAutoRun run = new SocketListenerAutoRun();
run.before();
run.autoRun();
// SocketListenerAutoRun run = new SocketListenerAutoRun();
// run.before();
// run.autoRun();
while (true) {
Thread.sleep(1000L);
}
// while (true) {
// Thread.sleep(1000L);
// }
}
@Override

View File

@@ -1,5 +1,5 @@
server:
port: 8010
port: 8015
#配置数据源
spring:
messages:
@@ -8,12 +8,9 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:acs_huayu}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.0.242}:${DB_PORT:3306}/${DB_NAME:stand_acs_kit}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}
password: ${DB_PWD:P@ssw0rd}
# 初始连接数
initial-size: 5
# 最小连接数
@@ -73,19 +70,22 @@ spring:
# 当迁移发现数据库非空且存在没有元数据的表时自动执行基准迁移新建schema_version表
baseline-on-migrate: true
redis:
#数据库索引
database: ${REDIS_DB:2}
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379}
redisson:
threads: 8
netty-threads: 8
single-server-config:
address: "redis://127.0.0.1:6379"
connection-pool-size: 100
connection-minimum-idle-size: 20
idle-connection-timeout: 30000
connect-timeout: 10000
timeout: 5000
retry-attempts: 5
retry-interval: 2000
ping-connection-interval: 30000
keep-alive: true
jpa:
show-sql: true
rabbitmq:
host: 192.168.101.1 # 主机名
port: 5672 # 端口
virtual-host: / # 虚拟主机
username: itcast # 用户名
password: 123321 # 密码
# password: ${REDIS_PWD:}
# 登录相关配置
login:
@@ -124,8 +124,8 @@ file:
path: ~/file/
avatar: ~/avatar/
linux:
path: /home/eladmin/file/
avatar: /home/eladmin/avatar/
path: /root/acs/file/
avatar: /root/acs/avatar/
windows:
path: C:\eladmin\file\
avatar: C:\eladmin\avatar\
@@ -134,11 +134,11 @@ file:
avatarMaxSize: 5
logging:
file:
path: D:\log\beian\lms # /Users/onepiece/myFile/acs_logs
path: /root/acs/log
config: classpath:logback-spring.xml
lucene:
index:
path: D:\lucene\index
path: /root/acs/index
# Sa-Token配置
sa-token:

View File

@@ -1,5 +1,5 @@
server:
port: 8010
port: 8015
#配置数据源
spring:
messages:
@@ -8,11 +8,8 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:beian_xinshengacs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hyjm_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:stand_acs_kit}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5
@@ -73,10 +70,20 @@ spring:
# 当迁移发现数据库非空且存在没有元数据的表时自动执行基准迁移新建schema_version表
baseline-on-migrate: true
redis:
#数据库索引
database: ${REDIS_DB:2}
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379}
redisson:
threads: 8
netty-threads: 8
single-server-config:
address: "redis://127.0.0.1:6379"
connection-pool-size: 100
connection-minimum-idle-size: 20
idle-connection-timeout: 30000
connect-timeout: 10000
timeout: 5000
retry-attempts: 5
retry-interval: 2000
ping-connection-interval: 30000
keep-alive: true
jpa:
show-sql: true
@@ -117,8 +124,8 @@ file:
path: ~/file/
avatar: ~/avatar/
linux:
path: /home/eladmin/file/
avatar: /home/eladmin/avatar/
path: /root/acs/file/
avatar: /root/acs/avatar/
windows:
path: C:\eladmin\file\
avatar: C:\eladmin\avatar\
@@ -127,11 +134,11 @@ file:
avatarMaxSize: 5
logging:
file:
path: D:\log\beian\acs # /Users/onepiece/myFile/acs_logs
path: /root/acs/log
config: classpath:logback-spring.xml
lucene:
index:
path: D:\lucene\index
path: /root/acs/index
# Sa-Token配置
sa-token:

View File

@@ -6,9 +6,9 @@ spring:
freemarker:
check-template-location: false
profiles:
active: prod
active: dev
# active: dev
# active: prod
# active: prod2
jackson:
time-zone: GMT+8
data:
@@ -49,7 +49,7 @@ spring:
enabledBanner: false # 是否启用 控制台banner默认true
enabledCollect: true # 是否开启监控指标采集默认true
collectorTypes: logging,test_collect # 监控数据采集器类型logging | micrometer | internal_logging默认micrometer
logPath: C:\log\lms # 监控日志数据路径,默认 ${user.home}/logs采集类型非logging不用配置
logPath: /root/acs/lms # 监控日志数据路径,默认 ${user.home}/logs采集类型非logging不用配置
monitorInterval: 8
tomcatTp: # tomcat webserver 线程池配置
threadPoolAliasName: tomcat 线程池 # 线程池别名,可选
@@ -107,7 +107,7 @@ rsa:
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
logging:
file:
path: D:\log\beian\acs
path: /root/acs/log
config: classpath:logback-spring.xml
# sa-token白名单配置
security:
@@ -148,4 +148,4 @@ mybatis-plus:
lucene:
index:
path: D:\lucene\index
path: /root/acs/index