From 1066f909ab0ed9eb810bce5272aad0eb1f038a01 Mon Sep 17 00:00:00 2001 From: ah-max150 Date: Wed, 5 Aug 2026 23:58:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Emongodb=E5=92=8Crabbi?= =?UTF-8?q?tmq=E4=BE=9D=E8=B5=96=E5=92=8C=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- ecom-dmb-backend/README.md | 6 +++++- ecom-dmb-backend/pom.xml | 10 ++++++++++ .../src/main/resources/application-dev.yml | 6 ++++++ .../src/main/resources/application-pre.yml | 6 ++++++ .../src/main/resources/application-prod.yml | 6 ++++++ .../src/main/resources/application-test.yml | 6 ++++++ .../src/main/resources/application.yml | 16 ++++++++++++++++ 8 files changed, 56 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 94f7cc88..ff5d9b47 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,7 +15,7 @@ ## 后端(ecom-dmb-backend) - 构建 `./mvnw clean package -DskipTests`,运行 `./mvnw spring-boot:run`(默认 dev profile) -- 运行依赖环境变量:`DB_URL` / `DB_USERNAME` / `DB_PASSWORD` / `REDIS_HOST` / `REDIS_PASSWORD` / `JWT_SECRET`,见 README.md 与 `application-{profile}.yml` +- 运行依赖环境变量:`DB_URL` / `DB_USERNAME` / `DB_PASSWORD` / `REDIS_HOST` / `REDIS_PASSWORD` / `JWT_SECRET`,见 README.md 与 `application-{profile}.yml`;MongoDB / RabbitMQ 连接见各 profile(与 MySQL 同机,账号 `qinghua`) - **拼多多 POP SDK 来自本地文件仓库 `libs/repo`(pom.xml 的 project-local repository,未入库)**:不要删除或清理;全新 clone 缺少它无法编译,需从别处恢复 - 测试 `./mvnw test`,单个 `./mvnw test -Dtest=RoleAspectTest` - 架构设计文档在 `docs/`(订单统计读模型、权限控制、时间格式等),改动相关模块前先读 diff --git a/ecom-dmb-backend/README.md b/ecom-dmb-backend/README.md index 8a33b01d..d917f164 100644 --- a/ecom-dmb-backend/README.md +++ b/ecom-dmb-backend/README.md @@ -6,7 +6,9 @@ - Java 17 + Spring Boot 3.2 - MyBatis-Plus + MySQL -- Redis(消息队列 + 缓存) +- Redis(导入任务队列 + 缓存) +- MongoDB(BI 聚合统计) +- RabbitMQ(业务消息队列) - JWT 认证(HS512) - Knife4j API 文档 - Lombok + MapStruct @@ -16,6 +18,8 @@ - JDK 17+ - MySQL 8.0+ - Redis 6.0+ +- MongoDB 6.0+ +- RabbitMQ 3.12+ - Maven 3.9+ ## 快速启动 diff --git a/ecom-dmb-backend/pom.xml b/ecom-dmb-backend/pom.xml index e5bf9281..53a95b09 100644 --- a/ecom-dmb-backend/pom.xml +++ b/ecom-dmb-backend/pom.xml @@ -141,6 +141,16 @@ org.apache.commons commons-pool2 + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + + org.springframework.boot + spring-boot-starter-amqp + com.fasterxml.jackson.core diff --git a/ecom-dmb-backend/src/main/resources/application-dev.yml b/ecom-dmb-backend/src/main/resources/application-dev.yml index b1157d6f..936f3e51 100644 --- a/ecom-dmb-backend/src/main/resources/application-dev.yml +++ b/ecom-dmb-backend/src/main/resources/application-dev.yml @@ -14,6 +14,12 @@ spring: port: 6379 password: redis_qinghua database: 2 + mongodb: + uri: mongodb://qinghua:mongo_qinghua@192.168.3.100:27017/ecom_dmb_dev + rabbitmq: + host: 192.168.3.100 + username: qinghua + password: rabbitmq_qinghua jwt: secret: your-secret-key-here-must-be-at-least-64-bytes-long-for-hs512-algorithm-security diff --git a/ecom-dmb-backend/src/main/resources/application-pre.yml b/ecom-dmb-backend/src/main/resources/application-pre.yml index d4049ac5..c545dafb 100644 --- a/ecom-dmb-backend/src/main/resources/application-pre.yml +++ b/ecom-dmb-backend/src/main/resources/application-pre.yml @@ -16,6 +16,12 @@ spring: port: 6379 password: redis_qinghua database: 0 + mongodb: + uri: mongodb://qinghua:mongo_qinghua@192.168.3.100:27017/ecom_dmb_staging + rabbitmq: + host: 192.168.3.100 + username: qinghua + password: rabbitmq_qinghua jwt: secret: staging-jwt-secret-key-must-be-at-least-64-bytes-long-for-hs512-algorithm diff --git a/ecom-dmb-backend/src/main/resources/application-prod.yml b/ecom-dmb-backend/src/main/resources/application-prod.yml index 9ad26ec4..be563d55 100644 --- a/ecom-dmb-backend/src/main/resources/application-prod.yml +++ b/ecom-dmb-backend/src/main/resources/application-prod.yml @@ -17,6 +17,12 @@ spring: port: 6379 password: redis_qinghua database: 0 + mongodb: + uri: mongodb://qinghua:mongo_qinghua@192.168.3.100:27017/ecom_dmb + rabbitmq: + host: 192.168.3.100 + username: qinghua + password: rabbitmq_qinghua jwt: secret: prod-jwt-secret-key-must-be-at-least-64-bytes-long-for-hs512-algorithm-security diff --git a/ecom-dmb-backend/src/main/resources/application-test.yml b/ecom-dmb-backend/src/main/resources/application-test.yml index 134aaabd..58413c1c 100644 --- a/ecom-dmb-backend/src/main/resources/application-test.yml +++ b/ecom-dmb-backend/src/main/resources/application-test.yml @@ -14,6 +14,12 @@ spring: port: 6379 password: redis_qinghua database: 3 + mongodb: + uri: mongodb://qinghua:mongo_qinghua@192.168.3.100:27017/ecom_dmb_test + rabbitmq: + host: 192.168.3.100 + username: qinghua + password: rabbitmq_qinghua jwt: secret: test-jwt-secret-key-must-be-at-least-64-bytes-long-for-hs512-algorithm diff --git a/ecom-dmb-backend/src/main/resources/application.yml b/ecom-dmb-backend/src/main/resources/application.yml index 7d6b6406..a84f9c45 100644 --- a/ecom-dmb-backend/src/main/resources/application.yml +++ b/ecom-dmb-backend/src/main/resources/application.yml @@ -33,6 +33,22 @@ spring: max-idle: 8 min-idle: 0 max-wait: -1ms + mongodb: + # host/uri 见各环境;这里只放公共行为 + auto-index-creation: false + rabbitmq: + # host/账号见各环境 + port: 5672 + virtual-host: / + publisher-confirm-type: correlated + publisher-returns: true + template: + mandatory: true + listener: + simple: + acknowledge-mode: auto + prefetch: 10 + default-requeue-rejected: false # 订单统计读模型(汇总表已删,待重构前关闭写入与 miss 补算)