From 5c2fcf5e344cee879ce27c0e71d1740c0f6840c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Sat, 20 Dec 2025 14:24:10 +0800 Subject: [PATCH] Initial commit for tuoheng-airport-ddd --- .gitignore | 45 +++ pom.xml | 311 ++++++++++++++++++ .../tuoheng/airport/AirportApplication.java | 29 ++ src/main/resources/application-dev.yml | 28 ++ src/main/resources/application-prod.yml | 28 ++ src/main/resources/application.yml | 195 +++++++++++ 6 files changed, 636 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/com/tuoheng/airport/AirportApplication.java create mode 100644 src/main/resources/application-dev.yml create mode 100644 src/main/resources/application-prod.yml create mode 100644 src/main/resources/application.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd2fbec --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +### Logs ### +logs/ +*.log + +### Temp Files ### +*.tmp +*.bak +*.swp +*~.nib diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..1d059d2 --- /dev/null +++ b/pom.xml @@ -0,0 +1,311 @@ + + + 4.0.0 + + + com.tuoheng.hxf + parent + 0.0.1-SNAPSHOT + + + tuoheng-airport-ddd + jar + + Tuoheng Airport DDD + 拓恒无人机场系统 - DDD四层架构单体应用 + + + + 3.5.5 + + + 8.0.33 + 1.2.20 + + + 2.4.0 + + + 2.0.43 + + + 32.1.3-jre + + + 1.7.0 + + + 3.3.2 + + + 5.5.13.3 + + + 1.19.0 + + + 1.5.2 + + + 1.5.9 + + + 3.17.1 + 2.0.24 + 3.1.2 + + + 8.5.7 + + + 3.6.8 + + + 0.12.3 + + + 1.13.0 + 3.3.1 + + + + + + com.tuoheng.hxf + tuoheng-common + ${project.version} + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + + + mysql + mysql-connector-java + ${mysql.version} + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.integration + spring-integration-mqtt + + + + + org.springframework.cloud + spring-cloud-starter-consul-discovery + + + + + com.xuxueli + xxl-job-core + ${xxl-job.version} + + + + + org.apache.skywalking + apm-toolkit-trace + + + + + org.projectlombok + lombok + true + + + + + com.alibaba.fastjson2 + fastjson2 + ${fastjson2.version} + + + + + com.google.guava + guava + ${guava.version} + + + + + org.springdoc + springdoc-openapi-ui + ${springdoc-openapi.version} + + + + + com.alibaba + easyexcel + ${easyexcel.version} + + + + + com.itextpdf + itextpdf + ${itext.version} + + + + + org.locationtech.jts + jts-core + ${jts.version} + + + + + org.jgrapht + jgrapht-core + ${jgrapht.version} + + + + + org.bytedeco + javacv-platform + ${javacv.version} + + + + + com.aliyun.oss + aliyun-sdk-oss + ${aliyun-oss.version} + + + + + com.aliyun + dysmsapi20170525 + ${aliyun-sms.version} + + + + + com.aliyun + aliyun-java-sdk-sts + ${aliyun-sts.version} + + + + + io.minio + minio + ${minio.version} + + + + + cn.jpush.api + jpush-client + ${jpush.version} + + + + + io.jsonwebtoken + jjwt-api + ${jjwt.version} + + + io.jsonwebtoken + jjwt-impl + ${jjwt.version} + runtime + + + io.jsonwebtoken + jjwt-jackson + ${jjwt.version} + runtime + + + + + org.apache.shiro + shiro-spring-boot-web-starter + ${shiro.version} + + + + + org.crazycake + shiro-redis + ${shiro-redis.version} + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/src/main/java/com/tuoheng/airport/AirportApplication.java b/src/main/java/com/tuoheng/airport/AirportApplication.java new file mode 100644 index 0000000..704e267 --- /dev/null +++ b/src/main/java/com/tuoheng/airport/AirportApplication.java @@ -0,0 +1,29 @@ +package com.tuoheng.airport; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; + +/** + * 拓恒无人机场系统启动类 + * + * @author Tuoheng Team + * @date 2024-01-01 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableAsync +@EnableScheduling +@MapperScan("com.tuoheng.airport.*.infrastructure.persistence.mapper") +public class AirportApplication { + + public static void main(String[] args) { + SpringApplication.run(AirportApplication.class, args); + System.out.println("========================================"); + System.out.println("拓恒无人机场系统启动成功!"); + System.out.println("========================================"); + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..a214c6d --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,28 @@ +server: + port: 8080 + +spring: + # 数据源配置 - 开发环境 + datasource: + url: jdbc:mysql://localhost:3306/tuoheng_airport_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false + username: root + password: root + + # Redis配置 - 开发环境 + redis: + host: localhost + port: 6379 + password: + database: 0 + + # Kafka配置 - 开发环境 + kafka: + bootstrap-servers: localhost:9092 + +# 日志配置 - 开发环境 +logging: + level: + root: INFO + com.tuoheng.airport: DEBUG + org.springframework.web: DEBUG + org.mybatis: DEBUG diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..b9f34b1 --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,28 @@ +server: + port: 8080 + +spring: + # 数据源配置 - 生产环境 + datasource: + url: jdbc:mysql://prod-mysql-server:3306/tuoheng_airport?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=true + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + + # Redis配置 - 生产环境 + redis: + host: prod-redis-server + port: 6379 + password: ${REDIS_PASSWORD} + database: 0 + + # Kafka配置 - 生产环境 + kafka: + bootstrap-servers: prod-kafka-server:9092 + +# 日志配置 - 生产环境 +logging: + level: + root: WARN + com.tuoheng.airport: INFO + org.springframework.web: WARN + org.mybatis: WARN diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..df15925 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,195 @@ +server: + port: 8080 + servlet: + context-path: /api + +spring: + application: + name: tuoheng-airport-ddd + + profiles: + active: dev + + # 数据源配置 + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/tuoheng_airport?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false + username: root + password: password + type: com.alibaba.druid.pool.DruidDataSource + druid: + initial-size: 5 + min-idle: 5 + max-active: 20 + max-wait: 60000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat,wall + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + + # Redis配置 + redis: + host: localhost + port: 6379 + password: + database: 0 + timeout: 3000 + lettuce: + pool: + max-active: 8 + max-wait: -1 + max-idle: 8 + min-idle: 0 + + # Kafka配置 + kafka: + bootstrap-servers: localhost:9092 + producer: + key-serializer: org.apache.kafka.common.serialization.StringSerializer + value-serializer: org.apache.kafka.common.serialization.StringSerializer + acks: all + retries: 3 + consumer: + group-id: ${spring.application.name} + key-deserializer: org.apache.kafka.common.serialization.StringDeserializer + value-deserializer: org.apache.kafka.common.serialization.StringDeserializer + auto-offset-reset: latest + enable-auto-commit: true + + # Consul配置 + cloud: + consul: + host: localhost + port: 8500 + discovery: + service-name: ${spring.application.name} + health-check-path: /actuator/health + health-check-interval: 10s + instance-id: ${spring.application.name}:${server.port} + +# MyBatis Plus配置 +mybatis-plus: + mapper-locations: classpath*:/mapper/**/*.xml + type-aliases-package: com.tuoheng.airport.*.infrastructure.persistence.entity + global-config: + db-config: + id-type: auto + logic-delete-field: mark + logic-delete-value: 1 + logic-not-delete-value: 0 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +# MQTT配置 +mqtt: + dji: + broker-url: tcp://localhost:1883 + client-id: tuoheng-dji-client + username: admin + password: admin + default-qos: 1 + timeout: 30 + keepalive: 60 + lx: + broker-url: tcp://localhost:1883 + client-id: tuoheng-lx-client + username: admin + password: admin + default-qos: 1 + timeout: 30 + keepalive: 60 + +# XXL-Job配置 +xxl: + job: + admin: + addresses: http://localhost:8888/xxl-job-admin + executor: + appname: ${spring.application.name} + ip: + port: 9999 + logpath: /data/applogs/xxl-job/jobhandler + logretentiondays: 30 + accessToken: + +# 阿里云OSS配置 +aliyun: + oss: + endpoint: https://oss-cn-hangzhou.aliyuncs.com + access-key-id: your-access-key-id + access-key-secret: your-access-key-secret + bucket-name: tuoheng-airport + sms: + access-key-id: your-access-key-id + access-key-secret: your-access-key-secret + sign-name: 拓恒科技 + template-code: SMS_123456789 + sts: + access-key-id: your-access-key-id + access-key-secret: your-access-key-secret + role-arn: acs:ram::your-account-id:role/your-role-name + role-session-name: tuoheng-session + +# MinIO配置 +minio: + endpoint: http://localhost:9000 + access-key: minioadmin + secret-key: minioadmin + bucket-name: tuoheng-airport + +# JPush配置 +jpush: + app-key: your-app-key + master-secret: your-master-secret + +# JWT配置 +jwt: + secret: tuoheng-airport-secret-key-2024 + expiration: 86400000 + header: Authorization + token-prefix: Bearer + +# Swagger配置 +swagger: + enabled: true + title: 拓恒无人机场系统API文档 + description: 基于DDD四层架构的无人机场管理系统 + version: 1.0.0 + base-package: com.tuoheng.airport + contact: + name: Tuoheng Team + email: support@tuoheng.com + url: https://www.tuoheng.com + +# 日志配置 +logging: + level: + root: INFO + com.tuoheng.airport: DEBUG + org.springframework.web: INFO + org.mybatis: DEBUG + pattern: + console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n' + file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n' + file: + name: logs/tuoheng-airport.log + max-size: 100MB + max-history: 30 + +# Actuator配置 +management: + endpoints: + web: + exposure: + include: '*' + endpoint: + health: + show-details: always