给 ADXP 适配器增加用户名和密码配置项
This commit is contained in:
parent
adff8ffb8a
commit
f513cbb228
21
adxp-adapter/.env.example
Normal file
21
adxp-adapter/.env.example
Normal file
@ -0,0 +1,21 @@
|
||||
# ============================================================
|
||||
# ADXP 数据中台环境变量配置模板
|
||||
# 使用说明:
|
||||
# 1. 复制此文件为 .env: cp .env.example .env
|
||||
# 2. 修改 .env 中的配置值
|
||||
# 3. 启动应用时会自动加载 .env 文件中的环境变量
|
||||
# ============================================================
|
||||
|
||||
# ========== ADXP 数据中台配置 ==========
|
||||
ADXP_HOST=localhost
|
||||
ADXP_PORT=7001
|
||||
ADXP_USERNAME=dianxin
|
||||
ADXP_PASSWORD=dianxin@123
|
||||
|
||||
# ============================================================
|
||||
# 注意事项:
|
||||
# 1. 等号两边不要有空格
|
||||
# 2. 字符串值不需要引号
|
||||
# 3. #开头的行为注释
|
||||
# 4. 请勿将 .env 文件提交到Git仓库
|
||||
# ============================================================
|
||||
@ -26,6 +26,12 @@ public class AdxpSdkService {
|
||||
|
||||
@Value("${adxp.port}")
|
||||
private int port;
|
||||
|
||||
@Value("${adxp.username:}")
|
||||
private String defaultUsername;
|
||||
|
||||
@Value("${adxp.password:}")
|
||||
private String defaultPassword;
|
||||
|
||||
// Session 管理: sessionId -> SessionInfo
|
||||
private final Map<String, SessionInfo> sessions = new ConcurrentHashMap<>();
|
||||
@ -62,18 +68,22 @@ public class AdxpSdkService {
|
||||
* 登录数据中台
|
||||
*/
|
||||
public String login(String username, String password) {
|
||||
// 如果未提供用户名或密码,则使用配置文件中的默认值
|
||||
String actualUsername = (username == null || username.isEmpty()) ? defaultUsername : username;
|
||||
String actualPassword = (password == null || password.isEmpty()) ? defaultPassword : password;
|
||||
|
||||
try {
|
||||
log.info("正在登录 ADXP 数据中台: host={}, port={}, username={}", host, port, username);
|
||||
log.info("正在登录 ADXP 数据中台: host={}, port={}, username={}", host, port, actualUsername);
|
||||
|
||||
// 创建 SDK 客户端
|
||||
ADXPClient client = ADXPClientFactory.createWSClient(host, port);
|
||||
|
||||
// 调用登录
|
||||
LoginResult result = client.login(username, password);
|
||||
LoginResult result = client.login(actualUsername, actualPassword);
|
||||
|
||||
// 生成 session ID(即使登录响应解析失败,也创建 session)
|
||||
String sessionId = UUID.randomUUID().toString();
|
||||
sessions.put(sessionId, new SessionInfo(client, username, password));
|
||||
sessions.put(sessionId, new SessionInfo(client, actualUsername, actualPassword));
|
||||
|
||||
if (result == null || !Boolean.TRUE.equals(result.isSuccess())) {
|
||||
String errorMsg = result != null ?
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
adxp:
|
||||
host: ${ADXP_HOST}
|
||||
port: ${ADXP_PORT}
|
||||
username: ${ADXP_USERNAME}
|
||||
password: ${ADXP_PASSWORD}
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
|
||||
@ -10,6 +10,8 @@ adxp:
|
||||
# 使用环境变量或默认值
|
||||
host: ${ADXP_HOST:localhost}
|
||||
port: ${ADXP_PORT:7001}
|
||||
username: ${ADXP_USERNAME:dianxin}
|
||||
password: ${ADXP_PASSWORD:dianxin@123}
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
|
||||
@ -1,5 +1,31 @@
|
||||
# Bug修复详细记录
|
||||
|
||||
## ADXP的Docker容器无法关闭的问题
|
||||
|
||||
### 问题描述
|
||||
|
||||
**现象**:
|
||||
- 在 Ubuntu24.04 系统中部署的 ADXP 的 Docker 容器,启动后无法用 docker compose down 关闭
|
||||
- 错误提示:Error response from daemon: cannot stop container: adxp-adapter: permission denied
|
||||
|
||||
**错误原因**
|
||||
- 由于apparmor软件的行为导致
|
||||
|
||||
**修复方法**
|
||||
|
||||
```sh
|
||||
sudo apt purge --auto-remove apparmor
|
||||
sudo service docker restart
|
||||
docker system prune --all --volumes
|
||||
```
|
||||
|
||||
** 其他可能的方案 **
|
||||
|
||||
```sh
|
||||
sudo systemctl restart docker.socket docker.service
|
||||
sudo docker image rm -f $(sudo docker image ls -q)
|
||||
```
|
||||
|
||||
## 航班进出港通知定时任务不执行问题
|
||||
|
||||
### 问题描述
|
||||
|
||||
@ -1,298 +0,0 @@
|
||||
# 项目相关配置
|
||||
qaup:
|
||||
# 名称
|
||||
name: Qaup
|
||||
# 版本
|
||||
version: 1.0.1
|
||||
# 版权年份
|
||||
copyrightYear: 2025
|
||||
# 文件路径 示例( Windows配置D:/qaup/uploadPath,Linux配置 /home/qaup/uploadPath)
|
||||
profile: ${UPLOAD_PATH:/app/uploadPath}
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8080
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 2000
|
||||
# 使用JDK21虚拟线程,不需要限制线程数
|
||||
threads:
|
||||
# 虚拟线程模式下可以处理更多请求
|
||||
max: 2000
|
||||
# Tomcat启动初始化的线程数
|
||||
min-spare: 50
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.qaup: debug
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码最大错误次数
|
||||
maxRetryCount: 5
|
||||
# 密码锁定时间(默认10分钟)
|
||||
lockTime: 10
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: dev,druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# 重启目录
|
||||
additional-paths: src/main/java
|
||||
# 排除目录
|
||||
exclude: WEB-INF/**
|
||||
jackson:
|
||||
# 日期格式化
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
serialization:
|
||||
# 格式化输出
|
||||
indent_output: false
|
||||
# 忽略无法转换的对象
|
||||
fail_on_empty_beans: false
|
||||
deserialization:
|
||||
# 允许对象忽略json中不存在的属性
|
||||
fail_on_unknown_properties: false
|
||||
# redis 配置
|
||||
data:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# ==================== CollisionAvoidanceSystem 配置整合 ====================
|
||||
|
||||
# Flyway数据库迁移配置
|
||||
flyway:
|
||||
# 启用Flyway
|
||||
enabled: true
|
||||
# 迁移脚本位置
|
||||
locations: classpath:db/migration
|
||||
# 基线迁移设置
|
||||
baseline-on-migrate: true
|
||||
baseline-version: 1.0.0
|
||||
baseline-description: "Initial baseline from existing database"
|
||||
# 迁移验证
|
||||
validate-on-migrate: true
|
||||
# 生产环境禁用clean操作
|
||||
clean-disabled: true
|
||||
# 不允许乱序迁移
|
||||
out-of-order: false
|
||||
# 编码设置
|
||||
encoding: UTF-8
|
||||
# 占位符配置
|
||||
placeholder-replacement: false
|
||||
|
||||
# JPA配置(collision模块空间数据处理)
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none # 使用数据库管理方式
|
||||
show-sql: false
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: false
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
batch_size: 50
|
||||
fetch_size: 50
|
||||
cache:
|
||||
use_second_level_cache: false
|
||||
use_query_cache: false
|
||||
order_inserts: true
|
||||
order_updates: true
|
||||
batch_versioned_data: true
|
||||
generate_statistics: false
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.qaup.system.domain,com.qaup.common.core.domain.entity,com.qaup.generator.domain,com.qaup.quartz.domain,com.qaup.collision.common.model.spatial,com.qaup.collision.datacollector.model.dto,com.qaup.collision.geofence.model.entity
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: postgresql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# SpringDoc 配置
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html # Swagger UI 访问路径
|
||||
url: /v3/api-docs # OpenAPI JSON 文档路径
|
||||
disable-swagger-default-url: true
|
||||
api-docs:
|
||||
path: /v3/api-docs # OpenAPI JSON 文档路径
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
# 数据采集配置(collision模块)
|
||||
data:
|
||||
collector:
|
||||
# 数据采集间隔,单位:毫秒(高频采集保证数据新鲜度)
|
||||
interval: 250
|
||||
# 检测和推送间隔配置
|
||||
detection:
|
||||
# 检测间隔,单位:毫秒(控制围栏检测、冲突检测、违规检测和WebSocket推送频率)
|
||||
interval: 1000
|
||||
# 机场数据源配置
|
||||
airport-api:
|
||||
base-url: http://localhost:8090
|
||||
endpoints:
|
||||
login: /login
|
||||
refresh: /userInfoController/refreshToken
|
||||
aircraft: /openApi/getCurrentFlightPositions
|
||||
vehicle: /openApi/getCurrentVehiclePositions
|
||||
arrival-route: /runwayPathPlanningController/findArrTaxiwayByRunwayAndContactCrossAndSeat
|
||||
departure-route: /runwayPathPlanningController/findDepTaxiwayByRunwayAndContactCrossAndSeat
|
||||
aircraft-status: /aircraftStatusController/getAircraftStatus
|
||||
flight-notification: /openApi/getInboundAndOutboundFlightsNotification
|
||||
|
||||
auth:
|
||||
username: dianxin
|
||||
password: dianxin@123
|
||||
# 无人车厂商数据源配置
|
||||
vehicle-api:
|
||||
base-url: http://localhost:8091
|
||||
endpoints:
|
||||
vehicle-command: /api/VehicleCommandInfo
|
||||
# 通用车辆状态API端点(符合universal_autonomous_vehicle_api规范)
|
||||
universal-status: /api/v1/vehicles/{vehicleId}/status
|
||||
timeout: 1000
|
||||
retry-attempts: 3
|
||||
# 无人车数据持久化配置
|
||||
unmanned-vehicle:
|
||||
persistence:
|
||||
enabled: true
|
||||
batch-size: 50
|
||||
location-retention-days: 90
|
||||
command-retention-days: 365
|
||||
command:
|
||||
timeout: 1000
|
||||
retry-attempts: 3
|
||||
validation:
|
||||
enabled: true
|
||||
strict-mode: false
|
||||
retention:
|
||||
redis-expire-seconds: 60
|
||||
postgresql-days: 30
|
||||
|
||||
# 红绿灯系统配置(collision模块)
|
||||
traffic:
|
||||
light:
|
||||
tcp:
|
||||
# 是否启用TCP服务器
|
||||
enabled: true
|
||||
# TCP监听端口
|
||||
port: 8082
|
||||
# 最大连接数
|
||||
max-connections: 50
|
||||
# 连接超时时间(毫秒)
|
||||
connection-timeout: 30000
|
||||
# 心跳超时时间(分钟)
|
||||
heartbeat-timeout-minutes: 5
|
||||
|
||||
intersection:
|
||||
# 默认路口ID(当信号中没有指定时使用)
|
||||
default-id: "DEFAULT_INTERSECTION"
|
||||
|
||||
processing:
|
||||
# 是否启用统计功能
|
||||
enable-statistics: true
|
||||
# 统计信息输出间隔(毫秒)
|
||||
statistics-interval: 60000
|
||||
# 是否启用调试日志
|
||||
enable-debug-log: false
|
||||
# 信号处理超时时间(毫秒)
|
||||
signal-process-timeout: 5000
|
||||
|
||||
# 坐标系统配置(collision模块)
|
||||
coordinate-system:
|
||||
airport:
|
||||
center-longitude: 120.0834104
|
||||
center-latitude: 36.35406879
|
||||
|
||||
# 性能监控配置(collision模块扩展)
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
metrics:
|
||||
export:
|
||||
simple:
|
||||
enabled: true
|
||||
enable:
|
||||
hikari: true
|
||||
jvm: true
|
||||
jmx:
|
||||
enabled: true
|
||||
@ -111,3 +111,4 @@ data:
|
||||
base-url: http://localhost:8091
|
||||
timeout: 1000
|
||||
retry-attempts: 3
|
||||
|
||||
|
||||
91
qaup-admin/src/main/resources/application-prod copy.yml
Normal file
91
qaup-admin/src/main/resources/application-prod copy.yml
Normal file
@ -0,0 +1,91 @@
|
||||
# ============================================================
|
||||
# QAUP 生产环境配置
|
||||
# 关键配置项支持环境变量覆盖
|
||||
# 使用方式:创建 .env 文件,通过启动脚本加载环境变量
|
||||
# ============================================================
|
||||
|
||||
# 服务器配置
|
||||
server:
|
||||
port: ${SERVER_PORT:8080}
|
||||
servlet:
|
||||
context-path: /
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
accept-count: 1000
|
||||
threads:
|
||||
max: 800
|
||||
min-spare: 100
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# Redis配置(支持环境变量)
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
database: ${REDIS_DATABASE:0}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
min-idle: 0
|
||||
max-idle: 8
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
|
||||
# Redis 内存优化配置(生产环境)
|
||||
redis:
|
||||
# 最大内存限制(生产环境建议1-2GB)
|
||||
max-memory: ${REDIS_MAX_MEMORY:1gb}
|
||||
# 内存淘汰策略
|
||||
max-memory-policy: ${REDIS_MAX_MEMORY_POLICY:volatile-lru}
|
||||
|
||||
# 日志配置(生产环境简洁日志)
|
||||
logging:
|
||||
level:
|
||||
com.qaup: ${LOG_LEVEL_QAUP:info}
|
||||
org.springframework: ${LOG_LEVEL_SPRING:warn}
|
||||
org.hibernate: warn
|
||||
com.alibaba.druid: warn
|
||||
pattern:
|
||||
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n"
|
||||
|
||||
# 数据采集配置(支持环境变量)
|
||||
data:
|
||||
collector:
|
||||
interval: ${DATA_COLLECTOR_INTERVAL:250}
|
||||
detection:
|
||||
interval: ${DATA_DETECTION_INTERVAL:1000}
|
||||
|
||||
# 机场数据源配置(支持环境变量)
|
||||
airport-api:
|
||||
base-url: ${AIRPORT_API_BASE_URL:http://localhost:8090}
|
||||
auth:
|
||||
username: ${AIRPORT_API_USERNAME:dianxin}
|
||||
password: ${AIRPORT_API_PASSWORD:dianxin@123}
|
||||
|
||||
# 无人车厂商数据源配置(支持环境变量)
|
||||
vehicle-api:
|
||||
base-url: ${VEHICLE_API_BASE_URL:http://localhost:8091}
|
||||
timeout: ${VEHICLE_API_TIMEOUT:1000}
|
||||
retry-attempts: ${VEHICLE_API_RETRY:3}
|
||||
|
||||
# ADXP 适配器服务配置(生产环境)
|
||||
adxp-adapter:
|
||||
# 适配器主机地址
|
||||
host: ${ADXP_HOST:localhost}
|
||||
# 适配器端口
|
||||
port: ${ADXP_PORT:8086}
|
||||
# 登录用户名
|
||||
username: ${ADXP_USERNAME}
|
||||
# 登录密码
|
||||
password: ${ADXP_PASSWORD}
|
||||
# 重连延迟(毫秒)
|
||||
reconnect-delay-millis: ${RECONNECT_DELAY_MILLIS:3000}
|
||||
|
||||
# 红绿灯系统配置
|
||||
traffic:
|
||||
light:
|
||||
tcp:
|
||||
enabled: ${TRAFFIC_LIGHT_TCP_ENABLED:true}
|
||||
port: ${TRAFFIC_LIGHT_TCP_PORT:8082}
|
||||
@ -70,9 +70,7 @@ data:
|
||||
timeout: ${VEHICLE_API_TIMEOUT:1000}
|
||||
retry-attempts: ${VEHICLE_API_RETRY:3}
|
||||
|
||||
# ADXP 适配器服务配置(生产环境)
|
||||
data:
|
||||
collector:
|
||||
# ADXP 适配器服务配置(生产环境)
|
||||
adxp-adapter:
|
||||
# 适配器主机地址
|
||||
host: ${ADXP_HOST:localhost}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user