轻松聘AI开发
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

5.8 KiB

职来 (mydreamjob) Week 1 验收文档

日期: 2026-08-04 | 范围: 第 1 周后端基线 | 状态: ✅ 通过

验收标准

A. 工程与质量基线

验收项 状态 说明
Maven 项目结构 ✅ Java 17, Spring Boot 3.5.16
分层目录 ✅ config, common/api, common/exception, common/logging, common/health, auth, audit
依赖配置 ✅ JPA, Redis, AMQP, Flyway, OpenAPI, JWT, Validation, Actuator
统一响应格式 ✅ ApiResponse 包装,code/message/data/requestId/timestamp
全局异常处理 ✅ GlobalExceptionHandler
请求 ID ✅ RequestIdFilter (X-Request-Id)
结构化日志 ✅ 含 requestId 的日志模式
环境变量配置 ✅ application.yml 使用 ${ENV_VAR} 读取敏感配置
配置模板 ✅ application-dev.example.yml
.gitignore ✅ 排除 .env, target, IDE 文件

B. 数据与安全基线

验收项 状态 说明
ERD 文档 ✅ docs/ERD.md
Flyway V1 迁移 ✅ base_schema.sql + seed_data.sql
JWT 鉴权 ✅ JwtTokenProvider, JwtAuthenticationFilter
安全配置 ✅ SecurityConfig (CORS, CSRF 关闭, 状态less)
角色枚举 ✅ STUDENT, COMPANY, ADMIN
审计事件骨架 ✅ AuditService
Mock 验证码 ✅ SmsVerificationService (限流/锁定/过期)
Mock 登录 ✅ AuthController + AuthService

C. 本地基础设施

验收项 状态 说明
MySQL (3307) ✅ compose.yaml 配置
Redis (6379) ✅ compose.yaml 配置
RabbitMQ (5672/15672) ✅ compose.yaml 配置 + 管理界面
端口绑定 ✅ 所有端口绑定 127.0.0.1

D. 文档

验收项 状态 说明
README.md ✅ 项目说明、启动步骤、环境变量
docs/ERD.md ✅ 数据库实体关系设计
docs/api-v0.1.md ✅ API 接口清单、错误码、请求/响应示例
docs/acceptance-week1.md ✅ 本文件

测试报告

mvn clean verify 结果

[INFO] Tests run: 21, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
测试类 数量 状态
ApiResponseTest 10 ✅
AuthServiceTest 3 ✅
ErrorCodeTest 2 ✅
JwtTokenProviderTest 4 ✅
SmsVerificationServiceTest 2 ✅

接口实测结果

接口 方法 预期 实际
/api/v1/health GET 200 OK ✅
/api/v1/info GET 200 OK ✅
/api/v1/auth/sms/send POST 200 OK ✅
/api/v1/auth/login POST 201 Created ✅
/api/v1/auth/me GET 403 (无token) / 200 (有token) ✅
/api/v1/v3/api-docs GET 200 OK ✅
/api/v1/swagger-ui/index.html GET 200 OK ✅
/actuator/health GET 200 OK ✅

实测命令

# 健康检查
curl http://localhost:8080/api/v1/health

# 应用信息
curl http://localhost:8080/api/v1/info

# 发送验证码
curl -X POST "http://localhost:8080/api/v1/auth/sms/send?phone=13800000001&purpose=login"

# Mock 登录(从日志获取验证码)
curl -X POST http://localhost:8080/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"phone":"13800000001","code":"<验证码>"}'

# 当前用户信息
curl http://localhost:8080/api/v1/auth/me \
  -H "Authorization: Bearer <accessToken>"

# Swagger UI
http://localhost:8080/api/v1/swagger-ui/index.html

基础设施状态

服务 地址 状态
MySQL 8.4 127.0.0.1:3307 ✅ healthy
Redis 7.4 127.0.0.1:6379 ✅ healthy
RabbitMQ 3.13 127.0.0.1:5672 ✅ healthy
RabbitMQ Management 127.0.0.1:15672 ✅ healthy

启动步骤

1. 启动基础设施

cd C:/Users/15642/Desktop/zhilai/backend-infra
docker compose up -d

2. 编译与测试

cd C:/Users/15642/Desktop/zhilai/mydreamjob-server
mvn clean verify

3. 启动应用

mvn spring-boot:run -Dspring-boot.run.profiles=dev \
  -Dspring-boot.run.jvmArguments="\
    -Dspring.datasource.password=<DB_PASSWORD> \
    -Dspring.datasource.username=mydreamjob \
    -Dspring.datasource.url=jdbc:mysql://127.0.0.1:3307/mydreamjob?... \
    -Dapp.jwt.secret=<JWT_SECRET>"

测试账号

角色 手机号 用途
ADMIN 13800000001 管理员测试
STUDENT 13800000002 学生测试
COMPANY 13800000003 企业测试

注: 使用 Mock 短信验证码登录,验证码从应用日志中获取

已知限制

  1. 短信验证码 Mock: 验证码打印到日志,不发送真实短信
  2. 业务模块: 岗位、投递、聊天、评分等模块仅定义接口骨架
  3. RabbitMQ 监听: 队列已定义但未实现消费者(Week 2+)
  4. Actuator 健康: RabbitMQ 健康检查未配置(仅 ping)
  5. Swagger UI 路径: 需访问 /api/v1/swagger-ui/index.html(含 context path)
  6. Testcontainers: 未引入(Docker 环境限制),Spring Boot 上下文测试被 @Disabled

风险项

风险 等级 说明
Docker Desktop 未启动 高 需先启动 Docker Desktop 才能运行 compose
MySQL 3306 端口冲突 中 本地已有 MySQL 服务占用 3306,compose 使用 3307
Redis 未安装 中 需依赖 Docker 或手动安装 Redis
Spring Boot 3.5.16 新特性 低 @MockBean 在 WebMvcTest 中与 SecurityFilterChain 有兼容性问题

待办事项 (Week 2+)

  • 企业模块: companies 表及 CRUD
  • 岗位模块: jobs 表、搜索、筛选
  • 投递模块: applications 表、状态流转
  • 聊天模块: conversations 表、WebSocket/STOMP
  • 评分模块: ratings 表、证据上传
  • Token 刷新接口
  • 密码重置功能
  • RabbitMQ 消费者实现
  • Testcontainers 集成测试