From 9a5c88386ac8af9a24f497a5442cde3ad1ce58d3 Mon Sep 17 00:00:00 2001 From: Join <123456@gmail.com> Date: Wed, 29 Oct 2025 21:39:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=A2=9E=E5=8A=A0=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/application-dev.properties | 343 ++++++++++++++++++ .../test/resources/application-dev.properties | 343 ++++++++++++++++++ .../src/test/resources/application.properties | 122 +++++++ 3 files changed, 808 insertions(+) create mode 100644 cn-universal-web/src/main/resources/application-dev.properties create mode 100644 cn-universal-web/src/test/resources/application-dev.properties create mode 100644 cn-universal-web/src/test/resources/application.properties diff --git a/cn-universal-web/src/main/resources/application-dev.properties b/cn-universal-web/src/main/resources/application-dev.properties new file mode 100644 index 0000000..a695e38 --- /dev/null +++ b/cn-universal-web/src/main/resources/application-dev.properties @@ -0,0 +1,343 @@ +# ================================ +# 协议模块开关配置 +# ================================ +# TCP协议 +tcp.protocol.enabled=false +# UDP协议 +udp.protocol.enabled=false +# CT-AIoT协议 (电信) +ctaiot.protocol.enable=false +# OneNet协议 (移动) +onenet.protocol.enabled=false +# ImouLife协议 (乐橙) +imoulife.protocol.enabled=false +# ================================ +# 其他开关配置 +# ================================ +# 日志分表是否开启 +shard.logMeta.enable=true +# ================================ +# 服务器配置 +# ================================ +server.port=9092 +server.instance.id= +logging.file.path=../logs/cn-universal2/ +# 数据库配置 +# ================================ +spring.datasource.type=com.alibaba.druid.pool.DruidDataSource +spring.datasource.druid.initial-size=8 +spring.datasource.druid.max-wait=10000 +spring.datasource.druid.max-active=8 +spring.datasource.druid.min-evictable-idle-time-millis=300000 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://192.168.31.194:3307/univ?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true&useJDBCCompliantTimezoneShift=true +spring.datasource.username=root +spring.datasource.password= +mybatis.mapper-locations=classpath*:mybatis/**/*.xml +# ================================ +# Redis 配置 +# ================================ +spring.data.redis.database=11 +spring.data.redis.host=192.168.31.194 +spring.data.redis.port=6379 +spring.data.redis.password= +spring.data.redis.timeout=30000 +spring.data.redis.lettuce.pool.max-active=8 +spring.data.redis.lettuce.pool.max-idle=8 +spring.data.redis.lettuce.pool.min-idle=0 +# ================================ +# CTWing AEP 平台配置 +# ================================ +ctaiot.cfg.server=msgpush.ctwing.cn:16651 +ctaiot.cfg.appid=364525 +ctaiot.cfg.appkey= +ctaiot.cfg.appsecret= +ctaiot.cfg.tenantId= +ctaiot.cfg.token=..- +# ================================ +# OneNET 平台配置 +# ================================ +onenet.cfg.broker=tcp://183.0.0.1:8883 +onenet.cfg.userId=198133 +onenet.cfg.accessKey=++mBfw== +onenet.cfg.projectId=eRVx2F +# ================================ +# 乐橙平台配置 +# ================================ +imoulife.cfg.host=https://openapi.lechange.cn +imoulife.cfg.port=443 +imoulife.cfg.ver=1.0 +imoulife.cfg.appid= +imoulife.cfg.appsecret= +# ================================ +# TCP的域名访问 +# ================================ +tcp.protocol.sni.host.out=#productKey.tcp.nexiot.xyz +tcp.protocol.sni.port.out=38883 +# ================================ +# System内置EMQX配置,集群也需要 +# ================================ +mqtt.cfg.desc=MQTT IoT 平台 broker 服务器配置 +mqtt.cfg.enable=true +mqtt.cfg.host=tcp://192.168.31.194: +mqtt.cfg.host.out=tcp://mqtttest.nexiot.xyz:51883 +mqtt.cfg.clientIdPrefix=univ_iot_test +mqtt.cfg.client.username=universal_iot +mqtt.cfg.client.password=Abc@2025 +mqtt.cfg.keepAliveInterval=60 +mqtt.cfg.cleanSession=true +mqtt.cfg.autoReconnect=true +mqtt.cfg.defaultQos=1 +mqtt.cfg.defined.thing=$thing +mqtt.cfg.defined.ota=$ota +#默认开启共享订阅,关闭自行删除`$share/univGroup/` +mqtt.cfg.thing-prefix=$share/univGroup/${mqtt.cfg.defined.thing} +mqtt.cfg.ota-prefix=$share/univGroup/${mqtt.cfg.defined.ota} +mqtt.cfg.defaultTopics={"passthrough":{"description":"透传主题","topics":["${mqtt.cfg.thing-prefix:$thing}/up/+/+"]},"system-level":{"description":"系统级主题","topics":["${mqtt.cfg.ota-prefix:$ota}/report/+/+","${mqtt.cfg.ota-prefix:$ota}/update/+/+"]},"thing-model":{"description":"物模型主题","topics":["${mqtt.cfg.thing-prefix:$thing}/up/property/+/+","${mqtt.cfg.thing-prefix:$thing}/up/event/+/+"]}} +mqtt.cfg.emqx.header.key=universal-emqx +mqtt.cfg.emqx.header.value=d41d8cd98f00b204e9800998ecf8427e +# ================================ +# 云存储配置(阿里云/七牛) +# ================================ +cloud-storage.aliyun.endpoint= +cloud-storage.aliyun.prefix= +cloud-storage.aliyun.access-key-id= +cloud-storage.aliyun.access-key-secret= +cloud-storage.aliyun.bucket-name= +## 七牛云配置 +cloud-storage.qiniu.domain=qiniu.oss.filecoin.ren +cloud-storage.qiniu.prefix=/device/product/ +cloud-storage.qiniu.access-key= +cloud-storage.qiniu.secret-key= +cloud-storage.qiniu.bucket-name= +cloud-storage.qiniu.region=auto +cloud-storage.qiniu.is-https=false +# ================================ +# 设备注册配置 +# ================================ +iot.register.auto.unionId=auto_register +iot.register.auto.latitude=31.081598 +iot.register.auto.longitude=81.314141 +# ================================ +# 设备日志分表配置 +# ================================ +# 日志分表是否开启 +shard.log.enable=true +# 日志分表数量 +shard.log.table.number=24 +# 每个实际节点对应虚拟节点数量 +shard.log.virtual.number=8 +# ================================ +# 日志事件表配置 +# ================================ +# 日志分表数量 +shard.logMeta.table.number=24 +# 每个实际节点对应虚拟节点数量 +shard.logMeta.virtual.number=8 + +# ================================ +# 安全配置 +# ================================ +security.production.enabled=false +security.allowed.ips= +security.allowed.hosts= +security.actuator.enabled=true +security.access.monitor.enabled=false +# ================================ +# 开发工具配置 +# ================================ +spring.devtools.restart.enabled=true +spring.devtools.livereload.enabled=true +# ================================ +# Spring Boot 3.5 + JDK 21 优化配置 +# ================================ +# 虚拟线程配置 +spring.threads.virtual.enabled=true +jdk.virtualThreadScheduler.parallelism=10 +jdk.virtualThreadScheduler.maxPoolSize=100 +# ================================ +# 可观测性配置 +# ================================ +# Actuator 端点 +management.endpoints.web.exposure.include=health,info,metrics,prometheus,env,configprops +management.endpoints.web.base-path=/univ/actuator +management.endpoint.health.show-details=when_authorized +management.endpoint.health.show-components=when_authorized +# 虚拟线程监控 +management.metrics.jvm.threads.virtual.enabled=true +management.metrics.jvm.threads.pools.enabled=true +# ================================ +# 性能优化 +# ================================ +# HTTP/2 支持 +server.http2.enabled=true +# 压缩配置 +server.compression.enabled=true +server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json +server.compression.min-response-size=1024 +# ================================ +# 缓存配置 +# ================================ +# Caffeine 缓存 +spring.cache.type=caffeine +spring.cache.cache-names=device-cache,user-cache,config-cache +spring.cache.caffeine.spec=maximumSize=1000,expireAfterWrite=300s +# 虚拟线程监控日志 +logging.level.jdk.virtual=DEBUG +# 多级缓存配置 +cache.multi-level.enabled=true +# L1 缓存配置(本地缓存 - Caffeine) +cache.multi-level.l1.enabled=true +cache.multi-level.l1.expire-after-write=300 +cache.multi-level.l1.expire-after-access=300 +cache.multi-level.l1.initial-capacity=100 +cache.multi-level.l1.maximum-size=5000 +# L2 缓存配置(分布式缓存 - Redis) +cache.multi-level.l2.enabled=true +cache.multi-level.l2.expire-after-write=3600 +cache.multi-level.l2.key-prefix=mlc: +# 默认配置 +cache.multi-level.defaults.strategy=WRITE_THROUGH +cache.multi-level.defaults.enable-multi-level=true +cache.multi-level.defaults.default-l1-expire=300 +cache.multi-level.defaults.default-l2-expire=3600 +# 支持的第三方平台生命周期 +universal.iot.third.lifecycle.supported={"ctaiot":[]} +# ================================ +# ClickHouse 数据库配置(要配置) +# ================================ +clickhouse.enable=false +clickhouse.address=jdbc:clickhouse://127.0.0.1:8123/univ +clickhouse.username=default +clickhouse.password= +clickhouse.db=univ +clickhouse.socketTimeout=6000 +clickhouse.table.iot_device_log=iot_device_log +clickhouse.table.iot_device_log_metadata=iot_device_log_metadata +# ================================ +# IoTDB 配置 +# ================================ +# 是否启用 IoTDB 存储 +iotdb.enable=false +# IoTDB 服务器地址 +iotdb.host=127.0.0.1 +# IoTDB 服务器端口 +iotdb.port=6667 +# IoTDB 用户名 +iotdb.username=root +# IoTDB 密码 +iotdb.password=root +# 存储组名称(所有设备数据的根路径) +iotdb.storage.group=root.device +# 数据过期时间(TTL),单位:天,0表示永不过期 +iotdb.ttl.days=30 +# 数据压缩算法:UNCOMPRESSED, SNAPPY, GZIP, LZ4, ZSTD +iotdb.compressor=SNAPPY +# 批量插入大小(提升写入性能) +iotdb.batch.size=1000 +# 会话池配置 +iotdb.pool.max-size=10 +iotdb.pool.min-size=2 +iotdb.pool.max-wait=30000 +# ================================ +# 设备影子缓存与落库配置 +# ================================ +shadow.cache.enabled=true +shadow.cache.key-prefix=shadow +# 缓存TTL(秒),默认7天 +shadow.cache.ttl-seconds=604800 +# 是否开启定期落库 +shadow.flush.enabled=true +# 扫描间隔(毫秒),默认5分钟 +shadow.flush.scan-interval-ms=300000 +# 基础落库间隔(毫秒),默认24小时 +shadow.flush.base-interval-ms=600000 +# 抖动比例(0.2 表示±20%),用于错峰 +shadow.flush.jitter-rate=0.2 +# 每次批量处理数量 +shadow.flush.batch-size=1000 +# ZSET与分布式锁配置 +shadow.flush.zset-key=shadow:flush +shadow.flush.lock-key=shadow:flush:lock +# Redisson分布式锁配置(替代原有的TTL配置) +shadow.flush.lock-wait-time=10 +shadow.flush.lock-lease-time=60 +shadow.flush.max-retries=3 +# ================================ +# Redisson 分布式锁配置 +# ================================ +# 运行模式:single(单机), cluster(集群), sentinel(哨兵), master-slave(主从) +redisson.mode=single +# 基础配置 +# 看门狗超时时间(毫秒) +redisson.lock.watchdog-timeout=30000 +# 锁等待时间(毫秒) +redisson.lock.wait-time=100 +# 锁超时时间(毫秒) +redisson.lock.lease-time=30 +# 连接池大小 +redisson.connection-pool.size=8 +# 最小空闲连接数 +redisson.connection-pool.min-idle=0 +# 连接超时时间(毫秒) +redisson.connection.timeout=3000 +# 重试次数 +redisson.connection.retry-attempts=3 +# 重试间隔(毫秒) +redisson.connection.retry-interval=1500 +# ================================ +# 集群模式配置 (redisson.mode=cluster) +# ================================ +# 集群节点列表,逗号分隔 +# redisson.cluster.nodes=192.168.1.10:6379,192.168.1.11:6379,192.168.1.12:6379 +# 集群扫描间隔(毫秒) +redisson.cluster.scan-interval=2000 +# 主节点连接池配置 +redisson.cluster.master-connection-pool-size=64 +redisson.cluster.master-connection-minimum-idle-size=1 +# 从节点连接池配置 +redisson.cluster.slave-connection-pool-size=64 +redisson.cluster.slave-connection-minimum-idle-size=1 +# ================================ +# 哨兵模式配置 (redisson.mode=sentinel) +# ================================ +# 主节点名称 +# redisson.sentinel.master-name=mymaster +# 哨兵节点列表,逗号分隔 +# redisson.sentinel.nodes=192.168.1.10:26379,192.168.1.11:26379,192.168.1.12:26379 +# 哨兵密码(可选) +# redisson.sentinel.password= +# 数据库编号 +redisson.sentinel.database=0 +# ================================ +# 主从模式配置 (redisson.mode=master-slave) +# ================================ +# 主节点地址 +# redisson.master-slave.master-address=192.168.1.10:6379 +# 从节点地址列表,逗号分隔 +# redisson.master-slave.slave-addresses=192.168.1.11:6379,192.168.1.12:6379 +# 数据库编号 +redisson.master-slave.database=0 +# 启用数据桥接模块 +databridge.enabled=true +# 插件启用配置 +databridge.plugins.jdbc.enabled=true +databridge.plugins.kafka.enabled=true +databridge.plugins.mqtt.enabled=true +databridge.plugins.http.enabled=true +# 输入插件配置 +databridge.plugins.jdbc-input.enabled=true +databridge.plugins.kafka-input.enabled=true +databridge.plugins.mqtt-input.enabled=true +databridge.plugins.http-input.enabled=true +# 云平台插件配置 +databridge.plugins.aliyun-iot.enabled=true +databridge.plugins.tencent-iot.enabled=true +databridge.plugins.huawei-iot.enabled=true +databridge.plugins.aliyun-iot-output.enabled=true +databridge.plugins.tencent-iot-output.enabled=true +databridge.plugins.huawei-iot-output.enabled=true +databridge.plugins.aliyun-iot-bidirectional.enabled=true +databridge.plugins.tencent-iot-bidirectional.enabled=true +databridge.plugins.huawei-iot-bidirectional.enabled=true +#logging.level.org.springframework.beans.factory=DEBUG \ No newline at end of file diff --git a/cn-universal-web/src/test/resources/application-dev.properties b/cn-universal-web/src/test/resources/application-dev.properties new file mode 100644 index 0000000..a695e38 --- /dev/null +++ b/cn-universal-web/src/test/resources/application-dev.properties @@ -0,0 +1,343 @@ +# ================================ +# 协议模块开关配置 +# ================================ +# TCP协议 +tcp.protocol.enabled=false +# UDP协议 +udp.protocol.enabled=false +# CT-AIoT协议 (电信) +ctaiot.protocol.enable=false +# OneNet协议 (移动) +onenet.protocol.enabled=false +# ImouLife协议 (乐橙) +imoulife.protocol.enabled=false +# ================================ +# 其他开关配置 +# ================================ +# 日志分表是否开启 +shard.logMeta.enable=true +# ================================ +# 服务器配置 +# ================================ +server.port=9092 +server.instance.id= +logging.file.path=../logs/cn-universal2/ +# 数据库配置 +# ================================ +spring.datasource.type=com.alibaba.druid.pool.DruidDataSource +spring.datasource.druid.initial-size=8 +spring.datasource.druid.max-wait=10000 +spring.datasource.druid.max-active=8 +spring.datasource.druid.min-evictable-idle-time-millis=300000 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://192.168.31.194:3307/univ?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true&useJDBCCompliantTimezoneShift=true +spring.datasource.username=root +spring.datasource.password= +mybatis.mapper-locations=classpath*:mybatis/**/*.xml +# ================================ +# Redis 配置 +# ================================ +spring.data.redis.database=11 +spring.data.redis.host=192.168.31.194 +spring.data.redis.port=6379 +spring.data.redis.password= +spring.data.redis.timeout=30000 +spring.data.redis.lettuce.pool.max-active=8 +spring.data.redis.lettuce.pool.max-idle=8 +spring.data.redis.lettuce.pool.min-idle=0 +# ================================ +# CTWing AEP 平台配置 +# ================================ +ctaiot.cfg.server=msgpush.ctwing.cn:16651 +ctaiot.cfg.appid=364525 +ctaiot.cfg.appkey= +ctaiot.cfg.appsecret= +ctaiot.cfg.tenantId= +ctaiot.cfg.token=..- +# ================================ +# OneNET 平台配置 +# ================================ +onenet.cfg.broker=tcp://183.0.0.1:8883 +onenet.cfg.userId=198133 +onenet.cfg.accessKey=++mBfw== +onenet.cfg.projectId=eRVx2F +# ================================ +# 乐橙平台配置 +# ================================ +imoulife.cfg.host=https://openapi.lechange.cn +imoulife.cfg.port=443 +imoulife.cfg.ver=1.0 +imoulife.cfg.appid= +imoulife.cfg.appsecret= +# ================================ +# TCP的域名访问 +# ================================ +tcp.protocol.sni.host.out=#productKey.tcp.nexiot.xyz +tcp.protocol.sni.port.out=38883 +# ================================ +# System内置EMQX配置,集群也需要 +# ================================ +mqtt.cfg.desc=MQTT IoT 平台 broker 服务器配置 +mqtt.cfg.enable=true +mqtt.cfg.host=tcp://192.168.31.194: +mqtt.cfg.host.out=tcp://mqtttest.nexiot.xyz:51883 +mqtt.cfg.clientIdPrefix=univ_iot_test +mqtt.cfg.client.username=universal_iot +mqtt.cfg.client.password=Abc@2025 +mqtt.cfg.keepAliveInterval=60 +mqtt.cfg.cleanSession=true +mqtt.cfg.autoReconnect=true +mqtt.cfg.defaultQos=1 +mqtt.cfg.defined.thing=$thing +mqtt.cfg.defined.ota=$ota +#默认开启共享订阅,关闭自行删除`$share/univGroup/` +mqtt.cfg.thing-prefix=$share/univGroup/${mqtt.cfg.defined.thing} +mqtt.cfg.ota-prefix=$share/univGroup/${mqtt.cfg.defined.ota} +mqtt.cfg.defaultTopics={"passthrough":{"description":"透传主题","topics":["${mqtt.cfg.thing-prefix:$thing}/up/+/+"]},"system-level":{"description":"系统级主题","topics":["${mqtt.cfg.ota-prefix:$ota}/report/+/+","${mqtt.cfg.ota-prefix:$ota}/update/+/+"]},"thing-model":{"description":"物模型主题","topics":["${mqtt.cfg.thing-prefix:$thing}/up/property/+/+","${mqtt.cfg.thing-prefix:$thing}/up/event/+/+"]}} +mqtt.cfg.emqx.header.key=universal-emqx +mqtt.cfg.emqx.header.value=d41d8cd98f00b204e9800998ecf8427e +# ================================ +# 云存储配置(阿里云/七牛) +# ================================ +cloud-storage.aliyun.endpoint= +cloud-storage.aliyun.prefix= +cloud-storage.aliyun.access-key-id= +cloud-storage.aliyun.access-key-secret= +cloud-storage.aliyun.bucket-name= +## 七牛云配置 +cloud-storage.qiniu.domain=qiniu.oss.filecoin.ren +cloud-storage.qiniu.prefix=/device/product/ +cloud-storage.qiniu.access-key= +cloud-storage.qiniu.secret-key= +cloud-storage.qiniu.bucket-name= +cloud-storage.qiniu.region=auto +cloud-storage.qiniu.is-https=false +# ================================ +# 设备注册配置 +# ================================ +iot.register.auto.unionId=auto_register +iot.register.auto.latitude=31.081598 +iot.register.auto.longitude=81.314141 +# ================================ +# 设备日志分表配置 +# ================================ +# 日志分表是否开启 +shard.log.enable=true +# 日志分表数量 +shard.log.table.number=24 +# 每个实际节点对应虚拟节点数量 +shard.log.virtual.number=8 +# ================================ +# 日志事件表配置 +# ================================ +# 日志分表数量 +shard.logMeta.table.number=24 +# 每个实际节点对应虚拟节点数量 +shard.logMeta.virtual.number=8 + +# ================================ +# 安全配置 +# ================================ +security.production.enabled=false +security.allowed.ips= +security.allowed.hosts= +security.actuator.enabled=true +security.access.monitor.enabled=false +# ================================ +# 开发工具配置 +# ================================ +spring.devtools.restart.enabled=true +spring.devtools.livereload.enabled=true +# ================================ +# Spring Boot 3.5 + JDK 21 优化配置 +# ================================ +# 虚拟线程配置 +spring.threads.virtual.enabled=true +jdk.virtualThreadScheduler.parallelism=10 +jdk.virtualThreadScheduler.maxPoolSize=100 +# ================================ +# 可观测性配置 +# ================================ +# Actuator 端点 +management.endpoints.web.exposure.include=health,info,metrics,prometheus,env,configprops +management.endpoints.web.base-path=/univ/actuator +management.endpoint.health.show-details=when_authorized +management.endpoint.health.show-components=when_authorized +# 虚拟线程监控 +management.metrics.jvm.threads.virtual.enabled=true +management.metrics.jvm.threads.pools.enabled=true +# ================================ +# 性能优化 +# ================================ +# HTTP/2 支持 +server.http2.enabled=true +# 压缩配置 +server.compression.enabled=true +server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json +server.compression.min-response-size=1024 +# ================================ +# 缓存配置 +# ================================ +# Caffeine 缓存 +spring.cache.type=caffeine +spring.cache.cache-names=device-cache,user-cache,config-cache +spring.cache.caffeine.spec=maximumSize=1000,expireAfterWrite=300s +# 虚拟线程监控日志 +logging.level.jdk.virtual=DEBUG +# 多级缓存配置 +cache.multi-level.enabled=true +# L1 缓存配置(本地缓存 - Caffeine) +cache.multi-level.l1.enabled=true +cache.multi-level.l1.expire-after-write=300 +cache.multi-level.l1.expire-after-access=300 +cache.multi-level.l1.initial-capacity=100 +cache.multi-level.l1.maximum-size=5000 +# L2 缓存配置(分布式缓存 - Redis) +cache.multi-level.l2.enabled=true +cache.multi-level.l2.expire-after-write=3600 +cache.multi-level.l2.key-prefix=mlc: +# 默认配置 +cache.multi-level.defaults.strategy=WRITE_THROUGH +cache.multi-level.defaults.enable-multi-level=true +cache.multi-level.defaults.default-l1-expire=300 +cache.multi-level.defaults.default-l2-expire=3600 +# 支持的第三方平台生命周期 +universal.iot.third.lifecycle.supported={"ctaiot":[]} +# ================================ +# ClickHouse 数据库配置(要配置) +# ================================ +clickhouse.enable=false +clickhouse.address=jdbc:clickhouse://127.0.0.1:8123/univ +clickhouse.username=default +clickhouse.password= +clickhouse.db=univ +clickhouse.socketTimeout=6000 +clickhouse.table.iot_device_log=iot_device_log +clickhouse.table.iot_device_log_metadata=iot_device_log_metadata +# ================================ +# IoTDB 配置 +# ================================ +# 是否启用 IoTDB 存储 +iotdb.enable=false +# IoTDB 服务器地址 +iotdb.host=127.0.0.1 +# IoTDB 服务器端口 +iotdb.port=6667 +# IoTDB 用户名 +iotdb.username=root +# IoTDB 密码 +iotdb.password=root +# 存储组名称(所有设备数据的根路径) +iotdb.storage.group=root.device +# 数据过期时间(TTL),单位:天,0表示永不过期 +iotdb.ttl.days=30 +# 数据压缩算法:UNCOMPRESSED, SNAPPY, GZIP, LZ4, ZSTD +iotdb.compressor=SNAPPY +# 批量插入大小(提升写入性能) +iotdb.batch.size=1000 +# 会话池配置 +iotdb.pool.max-size=10 +iotdb.pool.min-size=2 +iotdb.pool.max-wait=30000 +# ================================ +# 设备影子缓存与落库配置 +# ================================ +shadow.cache.enabled=true +shadow.cache.key-prefix=shadow +# 缓存TTL(秒),默认7天 +shadow.cache.ttl-seconds=604800 +# 是否开启定期落库 +shadow.flush.enabled=true +# 扫描间隔(毫秒),默认5分钟 +shadow.flush.scan-interval-ms=300000 +# 基础落库间隔(毫秒),默认24小时 +shadow.flush.base-interval-ms=600000 +# 抖动比例(0.2 表示±20%),用于错峰 +shadow.flush.jitter-rate=0.2 +# 每次批量处理数量 +shadow.flush.batch-size=1000 +# ZSET与分布式锁配置 +shadow.flush.zset-key=shadow:flush +shadow.flush.lock-key=shadow:flush:lock +# Redisson分布式锁配置(替代原有的TTL配置) +shadow.flush.lock-wait-time=10 +shadow.flush.lock-lease-time=60 +shadow.flush.max-retries=3 +# ================================ +# Redisson 分布式锁配置 +# ================================ +# 运行模式:single(单机), cluster(集群), sentinel(哨兵), master-slave(主从) +redisson.mode=single +# 基础配置 +# 看门狗超时时间(毫秒) +redisson.lock.watchdog-timeout=30000 +# 锁等待时间(毫秒) +redisson.lock.wait-time=100 +# 锁超时时间(毫秒) +redisson.lock.lease-time=30 +# 连接池大小 +redisson.connection-pool.size=8 +# 最小空闲连接数 +redisson.connection-pool.min-idle=0 +# 连接超时时间(毫秒) +redisson.connection.timeout=3000 +# 重试次数 +redisson.connection.retry-attempts=3 +# 重试间隔(毫秒) +redisson.connection.retry-interval=1500 +# ================================ +# 集群模式配置 (redisson.mode=cluster) +# ================================ +# 集群节点列表,逗号分隔 +# redisson.cluster.nodes=192.168.1.10:6379,192.168.1.11:6379,192.168.1.12:6379 +# 集群扫描间隔(毫秒) +redisson.cluster.scan-interval=2000 +# 主节点连接池配置 +redisson.cluster.master-connection-pool-size=64 +redisson.cluster.master-connection-minimum-idle-size=1 +# 从节点连接池配置 +redisson.cluster.slave-connection-pool-size=64 +redisson.cluster.slave-connection-minimum-idle-size=1 +# ================================ +# 哨兵模式配置 (redisson.mode=sentinel) +# ================================ +# 主节点名称 +# redisson.sentinel.master-name=mymaster +# 哨兵节点列表,逗号分隔 +# redisson.sentinel.nodes=192.168.1.10:26379,192.168.1.11:26379,192.168.1.12:26379 +# 哨兵密码(可选) +# redisson.sentinel.password= +# 数据库编号 +redisson.sentinel.database=0 +# ================================ +# 主从模式配置 (redisson.mode=master-slave) +# ================================ +# 主节点地址 +# redisson.master-slave.master-address=192.168.1.10:6379 +# 从节点地址列表,逗号分隔 +# redisson.master-slave.slave-addresses=192.168.1.11:6379,192.168.1.12:6379 +# 数据库编号 +redisson.master-slave.database=0 +# 启用数据桥接模块 +databridge.enabled=true +# 插件启用配置 +databridge.plugins.jdbc.enabled=true +databridge.plugins.kafka.enabled=true +databridge.plugins.mqtt.enabled=true +databridge.plugins.http.enabled=true +# 输入插件配置 +databridge.plugins.jdbc-input.enabled=true +databridge.plugins.kafka-input.enabled=true +databridge.plugins.mqtt-input.enabled=true +databridge.plugins.http-input.enabled=true +# 云平台插件配置 +databridge.plugins.aliyun-iot.enabled=true +databridge.plugins.tencent-iot.enabled=true +databridge.plugins.huawei-iot.enabled=true +databridge.plugins.aliyun-iot-output.enabled=true +databridge.plugins.tencent-iot-output.enabled=true +databridge.plugins.huawei-iot-output.enabled=true +databridge.plugins.aliyun-iot-bidirectional.enabled=true +databridge.plugins.tencent-iot-bidirectional.enabled=true +databridge.plugins.huawei-iot-bidirectional.enabled=true +#logging.level.org.springframework.beans.factory=DEBUG \ No newline at end of file diff --git a/cn-universal-web/src/test/resources/application.properties b/cn-universal-web/src/test/resources/application.properties new file mode 100644 index 0000000..5093f99 --- /dev/null +++ b/cn-universal-web/src/test/resources/application.properties @@ -0,0 +1,122 @@ +# ================================ +# Spring Boot 基础配置 +# ================================ +spring.profiles.active=@profileActive@ +# ================================ +# 任务执行器配置 +# ================================ +spring.task.execution.threadNamePrefix=univ-excute- +spring.task.execution.pool.core-size=2 +spring.task.execution.pool.max-size=10 +spring.task.execution.pool.queue-capacity=10 +spring.task.execution.pool.keep-alive=10s +# ================================ +# MyBatis 配置 +# ================================ +mybatis.configuration.map-underscore-to-camel-case=true +# ================================ +# 数据库连接池配置 +# ================================ +druid.mysql.usePingMethod=false +# ================================ +# Spring MVC 配置 +# ================================ +# 启用隐藏方法过滤器(解决上传图片失败问题) +spring.mvc.hiddenmethod.filter.enabled=true +# 文件上传大小限制 +spring.servlet.multipart.max-file-size=10MB +# ================================ +# Quartz 调度器配置 +# ================================ +spring.quartz.scheduler-name=UnivScheduler +spring.quartz.startup-delay=1s +spring.quartz.overwrite-existing-jobs=true +spring.quartz.auto-startup=true +spring.quartz.job-store-type=JDBC +# Quartz 属性配置 +spring.quartz.properties.org.quartz.scheduler.instanceName=UnivScheduler +spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO +spring.quartz.properties.org.quartz.scheduler.batchTriggerAcquisitionMaxCount=5 +# 线程池配置 +spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool +spring.quartz.properties.org.quartz.threadPool.threadCount=20 +spring.quartz.properties.org.quartz.threadPool.threadPriority=5 +# JobStore 配置 +spring.quartz.properties.org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore +spring.quartz.properties.org.quartz.jobStore.isClustered=true +spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=150000 +spring.quartz.properties.org.quartz.jobStore.txIsolationLevelSerializable=false +spring.quartz.properties.org.quartz.jobStore.misfireThreshold=600000 +spring.quartz.properties.org.quartz.jobStore.tablePrefix=qrtz_ +spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true +spring.quartz.properties.org.quartz.jobStore.dataSource=quartzDs +# ================================ +# XSS 防护配置 +# ================================ +# 新版本 XSS 配置 +cn.universal.xss.skipUrl[0]=/iot/weixin/** +cn.universal.xss.skipUrl[1]=/admin/v1/protocol/** +cn.universal.xss.skipUrl[2]=/admin/v1/product/** +cn.universal.xss.skipUrl[3]=/magic/** +cn.universal.xss.skipUrl[4]=/admin/v1/rule/sql/** + + + +# ================================ +# Spring 配置 +# ================================ +spring.main.allow-circular-references=true +# ================================ +# 安全配置 +# ================================ +spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:9091 +# ================================ +# 监控配置 +# ================================ +# 启用虚拟线程监控 +management.endpoints.web.exposure.include=health,info,metrics,prometheus +management.metrics.tags.application=cn-universal +management.prometheus.metrics.export.enabled=true +# ================================ +# Lombok 配置 +# ================================ +lombok.experimental.superBuilder=true +# ================================ +# 日志配置 +# ================================ +# 抑制 commons-logging 警告 +logging.level.org.springframework.jcl=OFF +logging.level.org.apache.commons.logging=OFF +logging.level.org.apache.commons.logging.impl=OFF +# ================================ +# Magic API 插件配置 +# ================================ +# 启用 Magic API +magic-api.enabled=true +# Web 编辑器配置 +magic-api.web=/magic/debug +magic-api.prefix=/magic +# 编辑器配置文件存储位置(classpath 开头时为只读模式) +magic-api.editor-config=classpath:./magic-editor-config.js +# 资源文件存储配置 +magic-api.resource.type=database +magic-api.resource.datasource= +magic-api.resource.prefix=universal +magic-api.resource.tableName=protocol_file +# 备份配置 +magic-api.backup.enable=true +magic-api.backup.datasource= +magic-api.backup.max-history=30 +magic-api.backup.table-name=protocol_file_backup +# ================================ +# RuleGo 规则引擎配置 +# ================================ +# RuleGo API配置 +rulego.web.base-url=http://rule.192886.xyz:81/# +rulego.api.base-url=http://192.168.31.194:9090 +rulego.api.token=${RULEGO_API_TOKEN:2af255ea5618467d914c67a8beeca31d} +# RuleGo同步配置 +rulego.sync.enabled=false +rulego.sync.interval=300000 +rulego.sync.log-cleanup-enabled=true +rulego.sync.log-retention-days=30