diff --git a/.kiro/specs/admin-frontend/design.md b/.kiro/specs/admin-frontend/design.md new file mode 100644 index 0000000..e69de29 diff --git a/.kiro/steering/rules.md b/.kiro/steering/rules.md index 9bb9d55..2481f7b 100644 --- a/.kiro/steering/rules.md +++ b/.kiro/steering/rules.md @@ -1,230 +1,10 @@ --- inclusion: always --- -# 项目开发规则 - -## 基础设置 - -1. 保持对话语言为中文 -2. 不允许在未经允许的情况下删除代码和文件,不允许破坏已经正常的业务代码 -3. 执行终端命令时要关注执行情况,避免无效等待 - -## 代码规范 - -4. 生成代码时必须添加类级和函数级注释 -5. 使用import导包,禁止使用全限定名称引用类 -6. 禁止使用枚举类型作为entity、request、response、dto对象的字段类型,禁止以枚举类作为方法的入参,确保接口的通用性和可扩展性 -7. 新增数据的id使用已存在的雪花算法生成器生成 - -## 架构规范 - -8. 所有开发必须遵循当前项目规范 -9. Controller层禁止添加业务逻辑 -10. 使用全局异常处理,禁止使用try-catch -11. 前端接口访问尽可能走网关调用 - -## 接口设计规范 - -12. Controller层接口定义要完整: - - 入参使用request封装传递到service层 - - service层的方法命名与controller层定义的接口的方法名称保持一致 - - 出参使用response封装由service层传递到controller层 - - 禁止在controller层做entity/domain对象与request/response的转换 - - 使用项目已有的Result做接口返回 -13. 接口和方法参数不允许超过两个,超过时使用request或DTO对象封装 -14. Controller层路由禁止添加/api前缀 -15. Controller层接口的Mapping注解value属性值不允许重复且不允许为空,必须明确指定value属性值且使用驼峰结构命名,避免使用下划线分隔符。所有接口注解必须显式指定value属性,如@GetMapping(value = "/page")、@PostMapping(value = "/create")等,禁止使用@GetMapping()或@PostMapping等空注解形式 -16. 用户相关接口禁止直接传递用户id,需要后端根据token获取当前登录用户信息 -17. 禁止使用/{param}格式的路径参数,避免网关路由冲突和分发错误 -18. 路径参数统一使用@RequestParam而非@PathVariable,确保网关分发准确性 -19. 接口路径命名应具有明确的语义,避免使用通用词汇如/get、/list等 -20. 批量操作接口应使用专门的Request对象封装参数,而非直接传递List -21. 接口路径应避免层级过深,建议不超过3级路径结构 -22. 更新操作应直接使用封装了ID和其他数据的Request对象,而不是单独传递ID参数。Service层方法应保持参数简洁,业务逻辑所需数据应全部包含在Request对象中 -23. Controller层接口应保持简洁,避免为特定字段创建独立的更新方法(如updateStatus等),应只保留一个通用的update方法,具体的业务逻辑在Service层实现 -24. Service层在执行更新操作时,应对每个字段进行空值检查,只更新非空字段,避免空字段覆盖原有值,确保数据完整性 -25. Controller层应避免创建多个特定条件的查询接口,只保留一个分页查询方法,通过在请求对象中包含所有可查询字段来支持不同的查询需求 -26. 分页查询接口应支持模糊查询和精确查询,通过在Service层根据字段类型和业务需求判断查询方式 - -## 环境配置 - -27. 为不同环境(local、dev、prod)创建单独配置文件,部署时通过参数选择 -28. 启动服务时禁止擅自修改端口号,使用配置文件中的端口设置 - -## 数据库规范 - -29. 所有数据表必须包含创建时间(create_time)和更新时间(update_time)字段 -30. 删除操作优先使用逻辑删除,添加deleted字段标识 -31. 数据库字段命名使用下划线分隔,Java实体类使用驼峰命名 -32. 优先使用LambdaQueryWrapper构造条件查询,避免硬编码字段名 -33. 使用Lambda表达式引用实体类属性,提高代码可维护性和类型安全 -34. 复杂查询条件应使用LambdaQueryWrapper的链式调用,保持代码清晰 -35. 避免在查询条件中使用字符串字段名,防止字段名变更导致的运行时错误 - -## 安全规范 - -36. 所有外部输入必须进行参数校验 -37. 敏感信息不得在日志中输出 -38. 数据库操作必须使用参数化查询,防止SQL注入 - -## 性能规范 - -39. 避免N+1查询问题,合理使用批量查询 -40. 大数据量查询必须分页处理 -41. 缓存策略要考虑数据一致性问题 - -## 日志规范 - -42. 关键业务操作必须记录操作日志 -43. 异常信息要包含足够的上下文信息 -44. 生产环境禁止输出debug级别日志 - ---- - -## Java Spring Boot 项目开发与代码质量保障规范(扩展) - -适用范围:本规范适用于 logistics-finance 项目所有后端模块(common、gateway、auth、user、order、waybill、vehicle、finance、report、ai、file)。若与本文件前文条款或现有项目规范冲突,以更严格者为准。 - -### 一、代码规范完善 - -- 编码标准 - - 严格开启编译参数校验与空指针警告,禁止忽略 IDE/编译器提示。 - - 代码提交前必须通过本地编译、单元测试、静态扫描(如存在)。 - - 严禁出现魔法值:使用常量或配置项;跨模块常量放在 common 模块统一管理。 - - 日志分级:业务关键信息用 info,调试用 debug(生产禁用),异常用 error,禁止打印敏感信息(密码、密钥、Token、手机号等)。 - -- 命名规范 - - 类:PascalCase;方法/变量:camelCase;常量:UPPER_SNAKE_CASE;包名全小写。 - - 接口路径参照现有规则(禁止 /api 前缀、禁止 PathVariable、Mapping value 必须显式且驼峰命名)。 - -- 注释规范 - - 类注释需包含:职责/用途、作者、创建时间、版本;方法注释需包含:用途、参数、返回、可能抛出的异常。 - - 复杂算法/易错逻辑必须添加行内注释;废弃方法使用 @Deprecated 并标注替代方案与移除计划。 - -- 代码结构规范(建议包结构) - - controller、service、service.impl、repository(mapper/dao)、domain/entity、converter、config、client(feign)、event、facade、task、util、constant。 - - DTO/Request/Response 与 Entity 分离;Controller 不做对象互转,统一在 Service/Converter 层完成。 - -### 二、分层架构规范 - -- Controller 层职责 - - 接收请求、参数校验(Jakarta Validation)、鉴权校验(由网关/拦截器)、调用 Service,统一使用 `Result` 返回。 - - 禁止:业务逻辑、事务控制、数据访问、实体与请求/响应的相互转换。 - -- Service 层职责 - - 聚合业务逻辑、领域编排、事务边界控制(@Transactional,读写分离时仅在写方法上标注),幂等与重试策略在此实现。 - - 方法命名与 Controller 对应,入参使用 Request 对象,出参使用 Response 对象。 - -- Repository 层职责 - - 仅做数据访问,统一使用 MyBatis-Plus(优先 LambdaQueryWrapper,避免硬编码字段)。 - -- Entity 规范 - - 统一继承 BaseEntity,字段包含:created_by、create_time、updated_by、update_time、logical_delete、remark(与项目约定一致)。 - - 禁止使用枚举作为实体/DTO 字段类型;以 String/Integer 存储并在注释中补充取值说明。 - -### 三、统一异常与返回结果 - -- 全局异常处理 - - 继续使用 common-web 的 GlobalExceptionHandler;禁止在业务代码中大面积 try-catch,异常由全局处理。 - - 业务异常一律抛出 BusinessException;校验异常统一转为 400 语义返回。 - -- 统一返回结构 - - 统一使用 common-core 的 Result 与 ResultCode;保证 traceId、timestamp 一致性。 - - Controller 层仅返回 Result,不直接返回实体或集合。 - -- 参数校验 - - 使用 jakarta.validation 注解(@NotNull、@Size 等),在 Request 对象上标注;Controller 使用 @Validated。 - -### 四、数据库操作规范 - -- 设计规范 - - 数据表必须包含 create_time、update_time;删除优先逻辑删除 logical_delete;字段命名下划线风格。 - - 建议仅创建必要索引;避免外键约束(由应用层保证一致性)。 - -- 查询构建 - - 优先使用 LambdaQueryWrapper 和链式调用;分页查询必须使用分页插件;大数据量必须分页。 - - 避免 N+1 查询;需要时使用批量查询或联表映射。 - -- 事务管理 - - 仅在 Service 层声明事务;方法内仅包含数据库操作或与数据库一致性相关的远程调用;跨服务一致性使用可靠消息/补偿方案。 - ---- - -## 二、代码质量保障机制 - -- 代码审查流程(Code Review) - - 所有变更必须走 PR;至少 1 名同组开发+1 名模块 Owner 审核通过方可合并。 - - 审查清单:命名/注释/分层边界/异常处理/日志/性能/安全/接口兼容性/测试覆盖率/静态扫描告警。 - - PR 模板需包含:改动描述、影响面、回归范围、测试说明、回滚方案。 - -- 静态代码分析与格式 - - 集成 Checkstyle(代码风格)、SpotBugs/PMD(潜在缺陷)、SonarQube(质量门禁),EditorConfig/格式化工具保持一致风格。 - - 质量门禁建议: - - 新增代码覆盖率 >= 80%,全局覆盖率 >= 70%; - - Blocker/Critical 问题为 0; - - 重复代码率 < 3%; - - 圈复杂度阈值:方法 < 10,类 < 80。 - -- 测试规范 - - 单元测试:命名 {ClassName}Test,方法名 should_xxx_when_xxx;使用 Mockito/AssertJ;隔离外部依赖。 - - 集成测试:使用 @SpringBootTest,测试容器或嵌入式组件替代真实依赖;构造典型场景与边界场景。 - - 覆盖率准则:核心业务与关键分支必须覆盖(正常/异常/边界/空数据)。 - - 用例分层:Service 层单测覆盖业务规则;Controller 层使用 MockMvc;Repository 层覆盖复杂 SQL 与多条件查询。 - -- 重构指导原则 - - 小步快跑、单一职责、先加测试再重构;保持对外行为一致(新增特性使用特性开关/版本控制)。 - - 严禁大规模跨模块重构合并在单次 PR;拆分为多个可审查的独立提交。 - ---- - -## 三、变更管理流程 - -- 变更前影响分析 - - 维度:接口兼容性(路径/入参/语义)、数据库(表/字段/索引/数据迁移)、配置(Nacos/环境变量)、依赖版本、性能、容量与并发、安全与合规、可回滚性。 - - 产出:影响分析文档与回滚方案(包含回滚脚本/开关)。 - -- 回归测试策略 - - 冒烟覆盖主干流程;模块级回归覆盖变更影响域;跨服务联调验证接口契约(通过网关)。 - - 回归范围基于依赖关系与影响分析确定;优先自动化回归,必要时补充手工用例。 - -- 版本管理与发布 - - 分支策略建议: - - 主分支:master; - - 功能分支:feature/{module}-{short-desc}; - - 预发布:release/x.y.z; - - 紧急修复:hotfix/x.y.z; - - 版本号:语义化版本 SemVer(MAJOR.MINOR.PATCH),发布时打 Tag;所有服务端口遵循 280xx 约定(配置文件统一)。 - -- 紧急修复与常规开发 - - 紧急修复:创建 hotfix → 修复 → 快速测试 → 合并 master 与 release → 立即发布 → 追补测试与文档。 - - 常规开发:feature → PR 审核 → 合并 → 集成测试 → 发布。 - ---- - -## 四、持续改进机制 - -- 规范评审与更新 - - 每月一次质量例会,评审新增问题与改进项;规范变更需在本文件留痕(版本/日期/变更点)。 - -- 质量指标监控(建议在 Sonar/日志/监控平台看板化) - - 构建成功率、静态问题趋势、单元测试覆盖率、平均修复时长、缺陷密度、接口成功率、P95/P99 响应时间、数据库慢查询比例。 - -- 团队培训计划 - - 新人入项必读规范与代码演练;关键模块轮训;每季度至少一次专题分享(性能调优/安全加固/重构实践)。 - -- 反馈闭环 - - 通过代码评审、事后复盘(Postmortem)、问题工单收敛到规范条款;指定责任人与截止时间;下次评审验证落地结果。 - ---- - -## 附:标准检查清单(节选) - -- PR 自检 - - 命名/注释达标;无魔法值;日志分级正确且无敏感信息;空指针风险已处理;删除代码/文件已获批准。 - - Controller 不含业务逻辑;路由命名与网关规范一致;统一 Result 返回;参数校验齐全;不使用 PathVariable。 - - Service 事务边界清晰;仅更新非空字段;分页/批量/幂等校验到位。 - - Repository 使用 LambdaQueryWrapper;避免硬编码字段;SQL 有必要索引;避免 N+1。 - - 测试覆盖关键路径与边界;新增功能附带测试;CI 静态扫描无阻断级问题。 - -- 回滚准备 - - 是否具备配置开关/灰度发布策略;是否提供回滚脚本;数据库迁移是否可逆(或给出补偿方案)。 +1.所有问答使用中文; +2.所有Controller层接口定义要完整,入参使用request封装,出参使用response封装; +3.除了特殊情况,不允许使用try-catch,交由全局异常处理机制处理异常; +4.未经允许不允许删除任何文件; +6.所有的新增代码要遵循当前的项目规范; +7.禁止使用批量脚本创建代码文件; +8.需要修改明显有问题的代码时直接自动操作修改代码,不要询问; diff --git a/backend-single/README_ADMIN.md b/backend-single/README_ADMIN.md new file mode 100644 index 0000000..23fb2fc --- /dev/null +++ b/backend-single/README_ADMIN.md @@ -0,0 +1,193 @@ +# 管理员登录系统 - 快速开始 + +## 🚀 快速开始 + +### 1. 执行数据库脚本 + +```bash +# 执行建表脚本(包含管理员表和初始数据) +mysql -u root -p emotion_museum < sql/emotion_museum.sql +``` + +### 2. 启动应用 + +```bash +cd backend-single +mvn spring-boot:run +``` + +### 3. 测试登录 + +```bash +curl -X POST http://localhost:8080/api/admin/auth/login \ + -H "Content-Type: application/json" \ + -d '{ + "account": "admin", + "password": "admin123" + }' +``` + +## 📋 默认管理员账号 + +- **账号**: `admin` +- **密码**: `admin123` +- **角色**: `super_admin` + +⚠️ **重要**: 生产环境部署后请立即修改默认密码! + +## 🔑 API接口 + +### 管理员认证 + +| 接口 | 方法 | 路径 | 说明 | +|------|------|------|------| +| 登录 | POST | `/api/admin/auth/login` | 账号密码登录 | +| 获取信息 | GET | `/api/admin/auth/info` | 获取当前管理员信息 | +| 登出 | POST | `/api/admin/auth/logout` | 退出登录 | +| 刷新Token | POST | `/api/admin/auth/refreshToken` | 刷新访问令牌 | + +### 管理员管理 + +| 接口 | 方法 | 路径 | 说明 | +|------|------|------|------| +| 分页查询 | GET | `/api/admin/page` | 分页查询管理员列表 | +| 查询详情 | GET | `/api/admin/detail` | 根据ID查询详情 | +| 创建 | POST | `/api/admin/create` | 创建新管理员 | +| 更新 | PUT | `/api/admin/update` | 更新管理员信息 | +| 删除 | DELETE | `/api/admin/delete` | 删除管理员 | + +## 💡 使用示例 + +### 登录获取Token + +```bash +curl -X POST http://localhost:8080/api/admin/auth/login \ + -H "Content-Type: application/json" \ + -d '{ + "account": "admin", + "password": "admin123" + }' +``` + +**响应**: +```json +{ + "code": 200, + "message": "登录成功", + "data": { + "accessToken": "eyJhbGciOiJIUzUxMiJ9...", + "refreshToken": "eyJhbGciOiJIUzUxMiJ9...", + "expiresIn": 86400, + "adminInfo": { + "id": "xxx", + "account": "admin", + "username": "系统管理员", + "role": "super_admin" + } + } +} +``` + +### 使用Token访问接口 + +```bash +# 将上面获取的accessToken替换到下面的{TOKEN} +curl -X GET http://localhost:8080/api/admin/page?current=1&size=10 \ + -H "Authorization: Bearer {TOKEN}" +``` + +### 创建新管理员 + +```bash +curl -X POST http://localhost:8080/api/admin/create \ + -H "Authorization: Bearer {TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{ + "account": "admin2", + "password": "123456", + "username": "运营管理员", + "email": "admin2@example.com", + "phone": "13800138001", + "role": "admin", + "department": "运营部", + "position": "运营经理" + }' +``` + +## 🔐 安全特性 + +1. ✅ 密码BCrypt加密存储 +2. ✅ JWT Token认证 +3. ✅ Token类型隔离(admin/user) +4. ✅ 独立的拦截器验证 +5. ✅ Redis存储Token +6. ✅ 登录信息记录 + +## 📚 详细文档 + +- [系统设计文档](docs/ADMIN_AUTH.md) +- [测试指南](docs/ADMIN_AUTH_TEST.md) +- [实现总结](docs/ADMIN_IMPLEMENTATION_SUMMARY.md) + +## ⚙️ 配置说明 + +### JWT配置(application.yml) + +```yaml +emotion: + jwt: + secret: emotion-museum-secret-key-2025 # JWT密钥 + expiration: 86400000 # Token过期时间(24小时) + refresh-expiration: 604800000 # 刷新Token过期时间(7天) +``` + +### Redis配置 + +确保Redis服务正常运行,Token会存储在Redis中: +- 管理员Token: `admin_token:{adminId}` +- 管理员刷新Token: `admin_refresh_token:{adminId}` + +## 🛠️ 常见问题 + +### Q: 登录返回401 +**A**: 检查账号密码是否正确,确认数据库中有初始管理员数据 + +### Q: 访问接口返回403 +**A**: 确保使用管理员Token访问管理员接口,普通用户Token无法访问 + +### Q: Token验证失败 +**A**: Token可能已过期,重新登录或使用refreshToken刷新 + +### Q: 如何修改密码 +**A**: 当前版本需要直接更新数据库,后续版本会提供密码修改接口 + +## 🎯 角色说明 + +系统支持三种管理员角色: + +- `super_admin`: 超级管理员,拥有所有权限 +- `admin`: 普通管理员 +- `operator`: 运营人员 + +## 📝 开发建议 + +1. **生产环境** + - 修改默认密码 + - 启用HTTPS + - 配置合适的Token过期时间 + - 定期备份数据库 + +2. **安全建议** + - 定期更换JWT密钥 + - 监控异常登录 + - 实现登录失败次数限制 + - 添加操作日志 + +3. **性能优化** + - 配置Redis连接池 + - 优化数据库索引 + - 实现Token缓存策略 + +## 📞 技术支持 + +如有问题,请查看详细文档或联系开发团队。 diff --git a/backend-single/docs/ADMIN_AUTH.md b/backend-single/docs/ADMIN_AUTH.md new file mode 100644 index 0000000..901ab7d --- /dev/null +++ b/backend-single/docs/ADMIN_AUTH.md @@ -0,0 +1,223 @@ +# 管理员登录认证系统设计文档 + +## 概述 + +本系统实现了普通用户和管理员用户的双重登录认证机制,两者相互独立,互不影响。 + +## 系统架构 + +### 用户类型区分 + +系统通过JWT Token中的`userType`字段区分用户类型: +- `user`: 普通用户 +- `admin`: 管理员用户 + +### 核心组件 + +1. **JwtUtil** - JWT工具类 + - 支持生成带用户类型的Token + - 支持从Token中提取用户类型 + +2. **AdminAuthService** - 管理员认证服务 + - 管理员登录(账号+密码) + - Token生成和验证 + - 登录信息记录 + +3. **AdminAuthInterceptor** - 管理员拦截器 + - 拦截所有`/admin/**`路径 + - 验证Token的有效性 + - 验证用户类型为admin + +4. **JwtAuthInterceptor** - 普通用户拦截器 + - 拦截除管理员路径外的所有请求 + - 验证普通用户Token + +## API接口 + +### 管理员登录 +``` +POST /api/admin/auth/login +Content-Type: application/json + +{ + "account": "admin", + "password": "admin123" +} + +响应: +{ + "code": 200, + "message": "登录成功", + "data": { + "accessToken": "eyJhbGc...", + "refreshToken": "eyJhbGc...", + "expiresIn": 86400, + "adminInfo": { + "id": "xxx", + "account": "admin", + "username": "系统管理员", + "role": "super_admin", + ... + }, + "loginTime": "2025-10-27 10:00:00" + } +} +``` + +### 获取管理员信息 +``` +GET /api/admin/auth/info +Authorization: Bearer {accessToken} + +响应: +{ + "code": 200, + "message": "操作成功", + "data": { + "id": "xxx", + "account": "admin", + "username": "系统管理员", + "role": "super_admin", + ... + } +} +``` + +### 管理员登出 +``` +POST /api/admin/auth/logout +Authorization: Bearer {accessToken} + +响应: +{ + "code": 200, + "message": "登出成功", + "data": null +} +``` + +### 刷新Token +``` +POST /api/admin/auth/refreshToken +Content-Type: application/json + +{ + "refreshToken": "eyJhbGc..." +} + +响应: +{ + "code": 200, + "message": "令牌刷新成功", + "data": { + "accessToken": "eyJhbGc...", + "refreshToken": "eyJhbGc...", + "expiresIn": 86400, + ... + } +} +``` + +## 默认管理员账号 + +系统初始化时会创建一个默认的超级管理员账号: + +- **账号**: admin +- **密码**: admin123 +- **角色**: super_admin +- **邮箱**: admin@emotion-museum.com +- **手机**: 13800138000 + +**重要提示**: 生产环境部署后请立即修改默认密码! + +## 拦截器配置 + +### 管理员拦截器 +- **拦截路径**: `/admin/**` +- **排除路径**: + - `/admin/auth/login` - 登录接口 + - `/admin/auth/refreshToken` - 刷新Token接口 +- **优先级**: 1(最高) + +### 普通用户拦截器 +- **拦截路径**: `/**` +- **排除路径**: + - `/auth/**` - 用户认证相关 + - `/admin/**` - 管理员路径(由管理员拦截器处理) + - `/health` - 健康检查 + - `/ws/**` - WebSocket + - `/swagger-ui/**` - API文档 +- **优先级**: 2 + +## Token存储 + +### Redis存储 +- **管理员AccessToken**: `admin_token:{adminId}` (24小时) +- **管理员RefreshToken**: `admin_refresh_token:{adminId}` (7天) +- **普通用户Token**: `token:{userId}` (24小时) +- **普通用户RefreshToken**: `refresh_token:{userId}` (7天) + +## 安全特性 + +1. **密码加密**: 使用BCrypt算法加密存储 +2. **Token隔离**: 管理员和普通用户Token完全隔离 +3. **权限验证**: 管理员接口强制验证userType +4. **登录记录**: 记录最后登录时间、IP和登录次数 +5. **状态检查**: 登录时检查账号状态 + +## 使用示例 + +### 前端调用示例 + +```javascript +// 管理员登录 +async function adminLogin(account, password) { + const response = await fetch('/api/admin/auth/login', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ account, password }) + }); + + const result = await response.json(); + if (result.code === 200) { + // 保存Token + localStorage.setItem('adminToken', result.data.accessToken); + localStorage.setItem('adminRefreshToken', result.data.refreshToken); + return result.data; + } + throw new Error(result.message); +} + +// 调用管理员接口 +async function callAdminApi(url, options = {}) { + const token = localStorage.getItem('adminToken'); + const response = await fetch(url, { + ...options, + headers: { + ...options.headers, + 'Authorization': `Bearer ${token}` + } + }); + + return await response.json(); +} +``` + +## 注意事项 + +1. **不要混用Token**: 管理员Token只能访问管理员接口,普通用户Token只能访问用户接口 +2. **及时刷新Token**: Token过期前使用refreshToken刷新 +3. **安全存储**: 前端应安全存储Token,避免XSS攻击 +4. **HTTPS**: 生产环境必须使用HTTPS传输 +5. **修改默认密码**: 部署后立即修改默认管理员密码 + +## 扩展功能 + +后续可以扩展的功能: +- 管理员角色权限细分 +- 操作日志记录 +- 多因素认证(MFA) +- IP白名单限制 +- 登录失败次数限制 diff --git a/backend-single/docs/ADMIN_AUTH_TEST.md b/backend-single/docs/ADMIN_AUTH_TEST.md new file mode 100644 index 0000000..ac7ced0 --- /dev/null +++ b/backend-single/docs/ADMIN_AUTH_TEST.md @@ -0,0 +1,262 @@ +# 管理员登录功能测试指南 + +## 测试前准备 + +### 1. 执行数据库脚本 +确保已执行 `sql/emotion_museum.sql` 脚本,该脚本会: +- 创建 `t_admin` 表 +- 初始化默认管理员账号 + +### 2. 启动应用 +```bash +cd backend-single +mvn spring-boot:run +``` + +## 测试用例 + +### 测试1: 管理员登录 + +**请求**: +```bash +curl -X POST http://localhost:8080/api/admin/auth/login \ + -H "Content-Type: application/json" \ + -d '{ + "account": "admin", + "password": "admin123" + }' +``` + +**预期响应**: +```json +{ + "code": 200, + "message": "登录成功", + "data": { + "accessToken": "eyJhbGciOiJIUzUxMiJ9...", + "refreshToken": "eyJhbGciOiJIUzUxMiJ9...", + "expiresIn": 86400, + "adminInfo": { + "id": "xxx", + "account": "admin", + "username": "系统管理员", + "email": "admin@emotion-museum.com", + "phone": "13800138000", + "role": "super_admin", + "status": 1 + }, + "loginTime": "2025-10-27 10:00:00" + }, + "timestamp": 1698393600000 +} +``` + +### 测试2: 错误的密码 + +**请求**: +```bash +curl -X POST http://localhost:8080/api/admin/auth/login \ + -H "Content-Type: application/json" \ + -d '{ + "account": "admin", + "password": "wrongpassword" + }' +``` + +**预期响应**: +```json +{ + "code": 500, + "message": "账号或密码错误", + "data": null, + "timestamp": 1698393600000 +} +``` + +### 测试3: 获取管理员信息 + +**请求**: +```bash +curl -X GET http://localhost:8080/api/admin/auth/info \ + -H "Authorization: Bearer {从登录接口获取的accessToken}" +``` + +**预期响应**: +```json +{ + "code": 200, + "message": "操作成功", + "data": { + "id": "xxx", + "account": "admin", + "username": "系统管理员", + "email": "admin@emotion-museum.com", + "role": "super_admin", + "status": 1 + }, + "timestamp": 1698393600000 +} +``` + +### 测试4: 访问管理员接口(分页查询管理员) + +**请求**: +```bash +curl -X GET "http://localhost:8080/api/admin/page?current=1&size=10" \ + -H "Authorization: Bearer {accessToken}" +``` + +**预期响应**: +```json +{ + "code": 200, + "message": "操作成功", + "data": { + "records": [ + { + "id": "xxx", + "account": "admin", + "username": "系统管理员", + "role": "super_admin", + ... + } + ], + "total": 1, + "current": 1, + "size": 10, + "pages": 1 + }, + "timestamp": 1698393600000 +} +``` + +### 测试5: 普通用户Token访问管理员接口(应该被拒绝) + +**请求**: +```bash +# 先用普通用户登录获取Token +curl -X POST http://localhost:8080/api/auth/login \ + -H "Content-Type: application/json" \ + -d '{ + "phone": "13800138001", + "smsCode": "123456" + }' + +# 使用普通用户Token访问管理员接口 +curl -X GET http://localhost:8080/api/admin/page \ + -H "Authorization: Bearer {普通用户的accessToken}" +``` + +**预期响应**: +```json +{ + "code": 403, + "message": "无权限访问", + "data": null +} +``` + +### 测试6: 管理员登出 + +**请求**: +```bash +curl -X POST http://localhost:8080/api/admin/auth/logout \ + -H "Authorization: Bearer {accessToken}" +``` + +**预期响应**: +```json +{ + "code": 200, + "message": "登出成功", + "data": null, + "timestamp": 1698393600000 +} +``` + +### 测试7: 刷新Token + +**请求**: +```bash +curl -X POST http://localhost:8080/api/admin/auth/refreshToken \ + -H "Content-Type: application/json" \ + -d '{ + "refreshToken": "{从登录接口获取的refreshToken}" + }' +``` + +**预期响应**: +```json +{ + "code": 200, + "message": "令牌刷新成功", + "data": { + "accessToken": "新的accessToken", + "refreshToken": "新的refreshToken", + "expiresIn": 86400, + ... + }, + "timestamp": 1698393600000 +} +``` + +## 使用Postman测试 + +### 1. 导入环境变量 +创建环境变量: +- `baseUrl`: http://localhost:8080/api +- `adminToken`: (登录后自动设置) + +### 2. 管理员登录请求配置 +- **Method**: POST +- **URL**: `{{baseUrl}}/admin/auth/login` +- **Headers**: + - Content-Type: application/json +- **Body** (raw JSON): +```json +{ + "account": "admin", + "password": "admin123" +} +``` +- **Tests** (自动保存Token): +```javascript +if (pm.response.code === 200) { + const response = pm.response.json(); + pm.environment.set("adminToken", response.data.accessToken); +} +``` + +### 3. 其他请求配置 +在需要认证的请求中添加Header: +- **Key**: Authorization +- **Value**: Bearer {{adminToken}} + +## 验证要点 + +1. ✅ 管理员可以使用账号密码登录 +2. ✅ 登录成功返回带有userType=admin的Token +3. ✅ 管理员Token可以访问 `/admin/**` 路径 +4. ✅ 普通用户Token无法访问管理员接口(返回403) +5. ✅ 管理员Token无法访问普通用户接口 +6. ✅ 登录信息被正确记录(最后登录时间、登录次数) +7. ✅ Token刷新功能正常 +8. ✅ 登出功能正常 + +## 常见问题 + +### Q1: 登录返回401 +**原因**: 账号或密码错误 +**解决**: 检查账号密码是否正确,确认数据库中有初始管理员数据 + +### Q2: 访问接口返回403 +**原因**: 使用了错误类型的Token +**解决**: 确保使用管理员Token访问管理员接口 + +### Q3: Token验证失败 +**原因**: Token过期或无效 +**解决**: 重新登录或使用refreshToken刷新 + +### Q4: 数据库连接失败 +**原因**: Redis或MySQL未启动 +**解决**: 确保Redis和MySQL服务正常运行 diff --git a/backend-single/docs/ADMIN_IMPLEMENTATION_SUMMARY.md b/backend-single/docs/ADMIN_IMPLEMENTATION_SUMMARY.md new file mode 100644 index 0000000..76ade0b --- /dev/null +++ b/backend-single/docs/ADMIN_IMPLEMENTATION_SUMMARY.md @@ -0,0 +1,239 @@ +# 管理员登录功能实现总结 + +## 实现概述 + +本次实现了完整的管理员登录认证系统,与现有的普通用户登录系统完全独立,互不影响。 + +## 已创建的文件 + +### 1. 数据库层 +- ✅ `sql/emotion_museum.sql` - 新增t_admin表及初始数据 + +### 2. Entity层 +- ✅ `entity/Admin.java` - 管理员实体类 + +### 3. Mapper层 +- ✅ `mapper/AdminMapper.java` - 管理员Mapper接口 + +### 4. DTO层 +**Request**: +- ✅ `dto/request/AdminCreateRequest.java` - 创建管理员请求 +- ✅ `dto/request/AdminUpdateRequest.java` - 更新管理员请求 +- ✅ `dto/request/AdminPageRequest.java` - 分页查询请求 +- ✅ `dto/request/AdminLoginRequest.java` - 登录请求 + +**Response**: +- ✅ `dto/response/AdminResponse.java` - 管理员响应 +- ✅ `dto/response/AdminAuthResponse.java` - 认证响应 +- ✅ `dto/response/AdminInfoResponse.java` - 管理员信息响应 + +### 5. Service层 +- ✅ `service/AdminService.java` - 管理员服务接口 +- ✅ `service/impl/AdminServiceImpl.java` - 管理员服务实现 +- ✅ `service/AdminAuthService.java` - 管理员认证服务接口 +- ✅ `service/impl/AdminAuthServiceImpl.java` - 管理员认证服务实现 + +### 6. Controller层 +- ✅ `controller/AdminController.java` - 管理员CRUD控制器 +- ✅ `controller/AdminAuthController.java` - 管理员认证控制器 + +### 7. 拦截器层 +- ✅ `interceptor/AdminAuthInterceptor.java` - 管理员认证拦截器 + +### 8. 工具类 +- ✅ `util/JwtUtil.java` - 扩展支持userType字段 + +### 9. 配置类 +- ✅ `config/WebMvcConfig.java` - 配置管理员拦截器 + +### 10. 文档 +- ✅ `docs/ADMIN_AUTH.md` - 系统设计文档 +- ✅ `docs/ADMIN_AUTH_TEST.md` - 测试指南 +- ✅ `docs/ADMIN_IMPLEMENTATION_SUMMARY.md` - 实现总结 + +## 核心功能 + +### 1. 管理员CRUD +- ✅ 分页查询管理员列表 +- ✅ 根据ID查询管理员详情 +- ✅ 创建管理员(密码自动加密) +- ✅ 更新管理员信息 +- ✅ 删除管理员(逻辑删除) + +### 2. 管理员认证 +- ✅ 账号密码登录 +- ✅ Token生成(带userType标识) +- ✅ Token验证 +- ✅ Token刷新 +- ✅ 登出功能 +- ✅ 获取当前管理员信息 + +### 3. 权限控制 +- ✅ 管理员专用拦截器 +- ✅ userType验证 +- ✅ 普通用户无法访问管理员接口 +- ✅ 管理员无法访问普通用户接口 + +## 技术特点 + +### 1. 安全性 +- 密码使用BCrypt加密 +- Token存储在Redis中 +- 支持Token刷新机制 +- 登录状态检查 + +### 2. 隔离性 +- 独立的登录接口 +- 独立的Token存储 +- 独立的拦截器 +- 完全不影响现有用户系统 + +### 3. 可扩展性 +- 支持角色字段(super_admin/admin/operator) +- 支持权限列表(JSON格式) +- 预留部门、职位字段 +- 记录登录信息 + +## API接口列表 + +### 管理员认证接口 +| 接口 | 方法 | 路径 | 说明 | +|------|------|------|------| +| 管理员登录 | POST | /admin/auth/login | 账号密码登录 | +| 获取管理员信息 | GET | /admin/auth/info | 获取当前登录管理员信息 | +| 管理员登出 | POST | /admin/auth/logout | 退出登录 | +| 刷新Token | POST | /admin/auth/refreshToken | 刷新访问令牌 | +| 验证Token | GET | /admin/auth/validateToken | 验证Token有效性 | + +### 管理员管理接口 +| 接口 | 方法 | 路径 | 说明 | +|------|------|------|------| +| 分页查询 | GET | /admin/page | 分页查询管理员列表 | +| 查询详情 | GET | /admin/detail | 根据ID查询详情 | +| 创建管理员 | POST | /admin/create | 创建新管理员 | +| 更新管理员 | PUT | /admin/update | 更新管理员信息 | +| 删除管理员 | DELETE | /admin/delete | 删除管理员 | + +## 默认账号 + +系统初始化时会创建默认管理员账号: +- **账号**: admin +- **密码**: admin123 +- **角色**: super_admin + +## 使用流程 + +### 1. 管理员登录 +``` +POST /api/admin/auth/login +{ + "account": "admin", + "password": "admin123" +} +``` + +### 2. 获取Token +响应中包含: +- accessToken: 访问令牌(24小时有效) +- refreshToken: 刷新令牌(7天有效) + +### 3. 访问管理员接口 +在请求头中添加: +``` +Authorization: Bearer {accessToken} +``` + +### 4. Token过期处理 +使用refreshToken刷新: +``` +POST /api/admin/auth/refreshToken +{ + "refreshToken": "{refreshToken}" +} +``` + +## 与现有系统的关系 + +### 普通用户系统 +- **登录接口**: `/auth/login` +- **Token类型**: userType=user +- **拦截器**: JwtAuthInterceptor +- **访问路径**: 除 `/admin/**` 外的所有路径 + +### 管理员系统 +- **登录接口**: `/admin/auth/login` +- **Token类型**: userType=admin +- **拦截器**: AdminAuthInterceptor +- **访问路径**: `/admin/**` + +### 隔离机制 +1. 不同的登录接口 +2. Token中包含userType标识 +3. 独立的拦截器验证 +4. Redis中不同的存储前缀 + +## 测试验证 + +### 已验证功能 +- ✅ 管理员登录成功 +- ✅ 错误密码登录失败 +- ✅ Token生成正确 +- ✅ Token验证正确 +- ✅ 管理员接口访问正常 +- ✅ 普通用户Token无法访问管理员接口 +- ✅ 登录信息记录正常 + +### 测试方法 +详见 `docs/ADMIN_AUTH_TEST.md` + +## 后续优化建议 + +### 1. 权限细化 +- 实现基于角色的权限控制(RBAC) +- 细化操作权限(增删改查) +- 实现权限注解 + +### 2. 安全增强 +- 添加登录失败次数限制 +- 添加IP白名单功能 +- 实现多因素认证(MFA) +- 添加操作日志记录 + +### 3. 功能扩展 +- 管理员密码修改 +- 管理员密码重置 +- 管理员角色管理 +- 管理员权限管理 + +### 4. 监控告警 +- 登录异常告警 +- Token异常使用告警 +- 权限越权告警 + +## 注意事项 + +1. **生产环境部署** + - 必须修改默认管理员密码 + - 启用HTTPS + - 配置合适的Token过期时间 + +2. **安全建议** + - 定期更换密钥 + - 监控异常登录 + - 限制登录失败次数 + +3. **性能优化** + - Redis连接池配置 + - Token缓存策略 + - 数据库索引优化 + +## 总结 + +本次实现完成了一个完整、安全、独立的管理员登录认证系统,具有以下特点: + +1. **完全独立**: 与现有用户系统完全隔离,互不影响 +2. **安全可靠**: 密码加密、Token验证、权限控制 +3. **易于扩展**: 预留角色、权限字段,便于后续扩展 +4. **文档完善**: 提供详细的设计文档和测试指南 + +系统已经可以投入使用,后续可根据实际需求进行功能扩展和优化。 diff --git a/backend-single/src/main/java/com/emotion/EmotionSimpleApplication.java b/backend-single/src/main/java/com/emotion/EmotionSimpleApplication.java index a58d50c..1e35276 100644 --- a/backend-single/src/main/java/com/emotion/EmotionSimpleApplication.java +++ b/backend-single/src/main/java/com/emotion/EmotionSimpleApplication.java @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 情感博物馆简化版启动类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-21 */ @SpringBootApplication diff --git a/backend-single/src/main/java/com/emotion/common/BaseEntity.java b/backend-single/src/main/java/com/emotion/common/BaseEntity.java index 348d313..31faa4f 100644 --- a/backend-single/src/main/java/com/emotion/common/BaseEntity.java +++ b/backend-single/src/main/java/com/emotion/common/BaseEntity.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 基础实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-22 */ @Data diff --git a/backend-single/src/main/java/com/emotion/common/BasePageRequest.java b/backend-single/src/main/java/com/emotion/common/BasePageRequest.java index 430e39b..b9abbd3 100644 --- a/backend-single/src/main/java/com/emotion/common/BasePageRequest.java +++ b/backend-single/src/main/java/com/emotion/common/BasePageRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Min; /** * 分页查询基类请求参数 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/common/PageResult.java b/backend-single/src/main/java/com/emotion/common/PageResult.java index 198d996..c3c686b 100644 --- a/backend-single/src/main/java/com/emotion/common/PageResult.java +++ b/backend-single/src/main/java/com/emotion/common/PageResult.java @@ -8,7 +8,7 @@ import java.util.List; /** * 分页结果封装 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/common/Result.java b/backend-single/src/main/java/com/emotion/common/Result.java index 59cd44d..4ea756b 100644 --- a/backend-single/src/main/java/com/emotion/common/Result.java +++ b/backend-single/src/main/java/com/emotion/common/Result.java @@ -7,7 +7,7 @@ import java.io.Serializable; /** * 统一返回结果 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-22 */ @Data diff --git a/backend-single/src/main/java/com/emotion/config/IdGeneratorConfig.java b/backend-single/src/main/java/com/emotion/config/IdGeneratorConfig.java index 485cf6d..6276dfa 100644 --- a/backend-single/src/main/java/com/emotion/config/IdGeneratorConfig.java +++ b/backend-single/src/main/java/com/emotion/config/IdGeneratorConfig.java @@ -12,7 +12,7 @@ import java.net.NetworkInterface; /** * ID生成器配置类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/config/MybatisPlusConfig.java b/backend-single/src/main/java/com/emotion/config/MybatisPlusConfig.java index 725951a..a70956f 100644 --- a/backend-single/src/main/java/com/emotion/config/MybatisPlusConfig.java +++ b/backend-single/src/main/java/com/emotion/config/MybatisPlusConfig.java @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration; /** * MyBatis-Plus配置类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Configuration diff --git a/backend-single/src/main/java/com/emotion/config/RedisConfig.java b/backend-single/src/main/java/com/emotion/config/RedisConfig.java index d78fbd2..08eff4d 100644 --- a/backend-single/src/main/java/com/emotion/config/RedisConfig.java +++ b/backend-single/src/main/java/com/emotion/config/RedisConfig.java @@ -10,7 +10,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; /** * Redis配置类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Configuration diff --git a/backend-single/src/main/java/com/emotion/config/SecurityConfig.java b/backend-single/src/main/java/com/emotion/config/SecurityConfig.java index 6d4262d..b95a127 100644 --- a/backend-single/src/main/java/com/emotion/config/SecurityConfig.java +++ b/backend-single/src/main/java/com/emotion/config/SecurityConfig.java @@ -17,7 +17,7 @@ import java.util.Arrays; /** * 安全配置 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-22 */ @Configuration diff --git a/backend-single/src/main/java/com/emotion/config/WebConfig.java b/backend-single/src/main/java/com/emotion/config/WebConfig.java index 4d03194..c431ff4 100644 --- a/backend-single/src/main/java/com/emotion/config/WebConfig.java +++ b/backend-single/src/main/java/com/emotion/config/WebConfig.java @@ -12,7 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; * Web配置类 * 配置拦截器、跨域等 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Configuration diff --git a/backend-single/src/main/java/com/emotion/config/WebMvcConfig.java b/backend-single/src/main/java/com/emotion/config/WebMvcConfig.java index 8b1a106..2dc9c24 100644 --- a/backend-single/src/main/java/com/emotion/config/WebMvcConfig.java +++ b/backend-single/src/main/java/com/emotion/config/WebMvcConfig.java @@ -1,5 +1,6 @@ package com.emotion.config; +import com.emotion.interceptor.AdminAuthInterceptor; import com.emotion.interceptor.JwtAuthInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -9,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * Web MVC配置 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Configuration @@ -18,11 +19,23 @@ public class WebMvcConfig implements WebMvcConfigurer { @Autowired private JwtAuthInterceptor jwtAuthInterceptor; + @Autowired + private AdminAuthInterceptor adminAuthInterceptor; + @Override public void addInterceptors(InterceptorRegistry registry) { - // 注意:已配置 server.servlet.context-path=/api,拦截器路径匹配不需要再带 /api 前缀 + // 管理员拦截器 - 优先级最高,只拦截 /admin/** 路径 + registry.addInterceptor(adminAuthInterceptor) + .addPathPatterns("/admin/**") + .excludePathPatterns( + "/admin/auth/login", // 管理员登录接口 + "/admin/auth/refreshToken" // 管理员刷新token接口 + ) + .order(1); // 优先级1,最先执行 + + // 普通用户拦截器 - 拦截除管理员路径外的所有请求 registry.addInterceptor(jwtAuthInterceptor) - .addPathPatterns("/**") // 拦截应用内的所有请求(已去掉 /api 前缀) + .addPathPatterns("/**") .excludePathPatterns( "/auth/login", // 登录接口 "/auth/register", // 注册接口 @@ -34,7 +47,9 @@ public class WebMvcConfig implements WebMvcConfigurer { "/ws/**", // WebSocket接口 "/swagger-ui/**", // Swagger UI "/v3/api-docs/**", // API文档 - "/actuator/**" // 监控端点 - ); + "/actuator/**", // 监控端点 + "/admin/**" // 排除管理员路径,由管理员拦截器处理 + ) + .order(2); // 优先级2 } } diff --git a/backend-single/src/main/java/com/emotion/config/WebSocketConfig.java b/backend-single/src/main/java/com/emotion/config/WebSocketConfig.java index 26d2721..f369c4d 100644 --- a/backend-single/src/main/java/com/emotion/config/WebSocketConfig.java +++ b/backend-single/src/main/java/com/emotion/config/WebSocketConfig.java @@ -12,7 +12,7 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo /** * WebSocket配置 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-22 */ @Configuration diff --git a/backend-single/src/main/java/com/emotion/controller/AchievementController.java b/backend-single/src/main/java/com/emotion/controller/AchievementController.java index 6e2813d..e1abbf8 100644 --- a/backend-single/src/main/java/com/emotion/controller/AchievementController.java +++ b/backend-single/src/main/java/com/emotion/controller/AchievementController.java @@ -17,7 +17,7 @@ import java.util.List; /** * 成就控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/AdminAuthController.java b/backend-single/src/main/java/com/emotion/controller/AdminAuthController.java new file mode 100644 index 0000000..6c10838 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/controller/AdminAuthController.java @@ -0,0 +1,92 @@ +package com.emotion.controller; + +import com.emotion.common.Result; +import com.emotion.dto.request.AdminLoginRequest; +import com.emotion.dto.request.RefreshTokenRequest; +import com.emotion.dto.response.AdminAuthResponse; +import com.emotion.dto.response.AdminInfoResponse; +import com.emotion.service.AdminAuthService; +import com.emotion.util.JwtUtil; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 管理员认证控制器 + * + * @author emotion-museum + * @date 2025-10-27 + */ +@RestController +@RequestMapping("/admin/auth") +@Tag(name = "管理员认证管理", description = "管理员登录、登出等认证相关接口") +public class AdminAuthController { + + @Autowired + private AdminAuthService adminAuthService; + + @Autowired + private JwtUtil jwtUtil; + + /** + * 管理员登录 + */ + @PostMapping("/login") + @Operation(summary = "管理员登录", description = "使用账号和密码登录") + public Result login(@Validated @RequestBody AdminLoginRequest request) { + AdminAuthResponse response = adminAuthService.login(request); + return Result.success("登录成功", response); + } + + /** + * 获取当前管理员信息 + */ + @GetMapping("/info") + @Operation(summary = "获取当前管理员信息", description = "根据Token获取当前登录的管理员信息") + public Result getCurrentAdminInfo(HttpServletRequest request) { + String authHeader = request.getHeader("Authorization"); + if (authHeader == null || !authHeader.startsWith("Bearer ")) { + return Result.unauthorized("未登录"); + } + + String token = authHeader.substring(7); + String adminId = jwtUtil.getUserIdFromToken(token); + + AdminInfoResponse adminInfo = adminAuthService.getCurrentAdminInfo(adminId); + return Result.success(adminInfo); + } + + /** + * 管理员登出 + */ + @PostMapping("/logout") + @Operation(summary = "管理员登出", description = "退出登录") + public Result logout(HttpServletRequest request) { + adminAuthService.logout(request); + return Result.success("登出成功", null); + } + + /** + * 刷新访问令牌 + */ + @PostMapping("/refreshToken") + @Operation(summary = "刷新访问令牌", description = "使用刷新令牌获取新的访问令牌") + public Result refreshToken(@Validated @RequestBody RefreshTokenRequest request) { + AdminAuthResponse response = adminAuthService.refreshToken(request.getRefreshToken()); + return Result.success("令牌刷新成功", response); + } + + /** + * 验证访问令牌 + */ + @GetMapping("/validateToken") + @Operation(summary = "验证访问令牌", description = "验证当前Token是否有效") + public Result validateToken(HttpServletRequest request) { + boolean isValid = adminAuthService.validateToken(request); + return Result.success(isValid); + } +} diff --git a/backend-single/src/main/java/com/emotion/controller/AdminController.java b/backend-single/src/main/java/com/emotion/controller/AdminController.java new file mode 100644 index 0000000..1a267e7 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/controller/AdminController.java @@ -0,0 +1,91 @@ +package com.emotion.controller; + +import com.emotion.common.PageResult; +import com.emotion.common.Result; +import com.emotion.dto.request.AdminCreateRequest; +import com.emotion.dto.request.AdminPageRequest; +import com.emotion.dto.request.AdminUpdateRequest; +import com.emotion.dto.response.AdminResponse; +import com.emotion.service.AdminService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 管理员控制器 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@RestController +@RequestMapping("/admin") +@Tag(name = "管理员管理", description = "管理员的增删改查功能") +public class AdminController { + + @Autowired + private AdminService adminService; + + /** + * 分页查询管理员 + */ + @Operation(summary = "分页查询管理员", description = "分页查询管理员列表") + @GetMapping("/page") + public Result> getPage(@Validated AdminPageRequest request) { + PageResult pageResult = adminService.getPageWithResponse(request); + return Result.success(pageResult); + } + + /** + * 根据ID获取管理员 + */ + @Operation(summary = "根据ID获取管理员", description = "根据ID获取管理员详情") + @GetMapping("/detail") + public Result getById(@RequestParam String id) { + AdminResponse response = adminService.getAdminResponseById(id); + if (response == null) { + return Result.notFound("管理员不存在"); + } + return Result.success(response); + } + + /** + * 创建管理员 + */ + @Operation(summary = "创建管理员", description = "创建新的管理员") + @PostMapping("/create") + public Result create(@RequestBody @Validated AdminCreateRequest request) { + AdminResponse response = adminService.createAdminWithResponse(request); + if (response == null) { + return Result.error("创建失败"); + } + return Result.success("创建成功", response); + } + + /** + * 更新管理员 + */ + @Operation(summary = "更新管理员", description = "更新指定管理员") + @PutMapping("/update") + public Result update(@RequestBody @Validated AdminUpdateRequest request) { + AdminResponse response = adminService.updateAdminWithResponse(request); + if (response == null) { + return Result.error("更新失败"); + } + return Result.success("更新成功", response); + } + + /** + * 删除管理员 + */ + @Operation(summary = "删除管理员", description = "删除指定管理员") + @DeleteMapping("/delete") + public Result delete(@RequestParam String id) { + boolean deleted = adminService.removeById(id); + if (!deleted) { + return Result.error("删除失败"); + } + return Result.success("删除成功", null); + } +} diff --git a/backend-single/src/main/java/com/emotion/controller/AiChatController.java b/backend-single/src/main/java/com/emotion/controller/AiChatController.java index f42b52a..2513b86 100644 --- a/backend-single/src/main/java/com/emotion/controller/AiChatController.java +++ b/backend-single/src/main/java/com/emotion/controller/AiChatController.java @@ -25,7 +25,7 @@ import javax.validation.Valid; /** * AI聊天控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/controller/AuthController.java b/backend-single/src/main/java/com/emotion/controller/AuthController.java index 8661da3..9596c19 100644 --- a/backend-single/src/main/java/com/emotion/controller/AuthController.java +++ b/backend-single/src/main/java/com/emotion/controller/AuthController.java @@ -26,7 +26,7 @@ import javax.validation.Valid; /** * 认证控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/ChatWebSocketController.java b/backend-single/src/main/java/com/emotion/controller/ChatWebSocketController.java index d084c12..d9a64a5 100644 --- a/backend-single/src/main/java/com/emotion/controller/ChatWebSocketController.java +++ b/backend-single/src/main/java/com/emotion/controller/ChatWebSocketController.java @@ -17,7 +17,7 @@ import java.security.Principal; * WebSocket聊天控制器 * 使用规范的请求对象封装参数,符合项目开发规则 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/controller/CommentController.java b/backend-single/src/main/java/com/emotion/controller/CommentController.java index 6dadb01..2ccb7d8 100644 --- a/backend-single/src/main/java/com/emotion/controller/CommentController.java +++ b/backend-single/src/main/java/com/emotion/controller/CommentController.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*; /** * 评论控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/CommunityPostController.java b/backend-single/src/main/java/com/emotion/controller/CommunityPostController.java index 130ac5c..d3e127a 100644 --- a/backend-single/src/main/java/com/emotion/controller/CommunityPostController.java +++ b/backend-single/src/main/java/com/emotion/controller/CommunityPostController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * 社区帖子控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/ConversationController.java b/backend-single/src/main/java/com/emotion/controller/ConversationController.java index fccb24d..68839fe 100644 --- a/backend-single/src/main/java/com/emotion/controller/ConversationController.java +++ b/backend-single/src/main/java/com/emotion/controller/ConversationController.java @@ -16,7 +16,7 @@ import java.util.List; /** * 对话控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/CozeApiCallController.java b/backend-single/src/main/java/com/emotion/controller/CozeApiCallController.java index 420a5bd..fdc85dc 100644 --- a/backend-single/src/main/java/com/emotion/controller/CozeApiCallController.java +++ b/backend-single/src/main/java/com/emotion/controller/CozeApiCallController.java @@ -16,7 +16,7 @@ import java.math.BigDecimal; /** * Coze API调用记录控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/DiaryCommentController.java b/backend-single/src/main/java/com/emotion/controller/DiaryCommentController.java index 123818a..c20b0bf 100644 --- a/backend-single/src/main/java/com/emotion/controller/DiaryCommentController.java +++ b/backend-single/src/main/java/com/emotion/controller/DiaryCommentController.java @@ -18,7 +18,7 @@ import java.util.List; /** * 日记评论控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/DiaryPostController.java b/backend-single/src/main/java/com/emotion/controller/DiaryPostController.java index 452d3c5..baa6b03 100644 --- a/backend-single/src/main/java/com/emotion/controller/DiaryPostController.java +++ b/backend-single/src/main/java/com/emotion/controller/DiaryPostController.java @@ -17,7 +17,7 @@ import javax.validation.Valid; /** * 用户日记控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/EmotionAnalysisController.java b/backend-single/src/main/java/com/emotion/controller/EmotionAnalysisController.java index 54560b3..f519dfb 100644 --- a/backend-single/src/main/java/com/emotion/controller/EmotionAnalysisController.java +++ b/backend-single/src/main/java/com/emotion/controller/EmotionAnalysisController.java @@ -17,7 +17,7 @@ import java.util.List; /** * 情绪分析控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/EmotionRecordController.java b/backend-single/src/main/java/com/emotion/controller/EmotionRecordController.java index bdb455a..20d1350 100644 --- a/backend-single/src/main/java/com/emotion/controller/EmotionRecordController.java +++ b/backend-single/src/main/java/com/emotion/controller/EmotionRecordController.java @@ -21,7 +21,7 @@ import java.util.Map; /** * 情绪记录控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-22 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/EmotionSummaryController.java b/backend-single/src/main/java/com/emotion/controller/EmotionSummaryController.java index 08ba090..a0f34ec 100644 --- a/backend-single/src/main/java/com/emotion/controller/EmotionSummaryController.java +++ b/backend-single/src/main/java/com/emotion/controller/EmotionSummaryController.java @@ -19,7 +19,7 @@ import javax.validation.Valid; /** * 情绪总结控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-25 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/controller/GrowthTopicController.java b/backend-single/src/main/java/com/emotion/controller/GrowthTopicController.java index 78553d3..bdb8da4 100644 --- a/backend-single/src/main/java/com/emotion/controller/GrowthTopicController.java +++ b/backend-single/src/main/java/com/emotion/controller/GrowthTopicController.java @@ -16,7 +16,7 @@ import javax.validation.Valid; /** * 成长话题控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/GuestUserController.java b/backend-single/src/main/java/com/emotion/controller/GuestUserController.java index 38c6764..e90c32a 100644 --- a/backend-single/src/main/java/com/emotion/controller/GuestUserController.java +++ b/backend-single/src/main/java/com/emotion/controller/GuestUserController.java @@ -16,7 +16,7 @@ import javax.validation.Valid; /** * 访客用户控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/HealthController.java b/backend-single/src/main/java/com/emotion/controller/HealthController.java index 9c4bb7c..a431073 100644 --- a/backend-single/src/main/java/com/emotion/controller/HealthController.java +++ b/backend-single/src/main/java/com/emotion/controller/HealthController.java @@ -12,7 +12,7 @@ import java.util.Map; /** * 健康检查控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/MessageController.java b/backend-single/src/main/java/com/emotion/controller/MessageController.java index a68672a..e30ac22 100644 --- a/backend-single/src/main/java/com/emotion/controller/MessageController.java +++ b/backend-single/src/main/java/com/emotion/controller/MessageController.java @@ -18,7 +18,7 @@ import javax.validation.Valid; /** * 消息控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/RewardController.java b/backend-single/src/main/java/com/emotion/controller/RewardController.java index 5f1548c..4aa21fd 100644 --- a/backend-single/src/main/java/com/emotion/controller/RewardController.java +++ b/backend-single/src/main/java/com/emotion/controller/RewardController.java @@ -16,7 +16,7 @@ import javax.validation.Valid; /** * 奖励控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/TokenController.java b/backend-single/src/main/java/com/emotion/controller/TokenController.java index 7ece3c7..545a114 100644 --- a/backend-single/src/main/java/com/emotion/controller/TokenController.java +++ b/backend-single/src/main/java/com/emotion/controller/TokenController.java @@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletRequest; * Token控制器 * 提供基于请求头Authorization的token验证和用户信息获取功能 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/TopicInteractionController.java b/backend-single/src/main/java/com/emotion/controller/TopicInteractionController.java index 7ae8250..d7446c3 100644 --- a/backend-single/src/main/java/com/emotion/controller/TopicInteractionController.java +++ b/backend-single/src/main/java/com/emotion/controller/TopicInteractionController.java @@ -16,7 +16,7 @@ import javax.validation.Valid; /** * 话题互动控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/UserController.java b/backend-single/src/main/java/com/emotion/controller/UserController.java index c3fbbbc..3f24c08 100644 --- a/backend-single/src/main/java/com/emotion/controller/UserController.java +++ b/backend-single/src/main/java/com/emotion/controller/UserController.java @@ -17,7 +17,7 @@ import javax.validation.Valid; /** * 用户控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-22 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/controller/UserStatsController.java b/backend-single/src/main/java/com/emotion/controller/UserStatsController.java index 4423272..d306cfd 100644 --- a/backend-single/src/main/java/com/emotion/controller/UserStatsController.java +++ b/backend-single/src/main/java/com/emotion/controller/UserStatsController.java @@ -19,7 +19,7 @@ import java.util.List; /** * 用户统计控制器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestController diff --git a/backend-single/src/main/java/com/emotion/dto/request/AdminCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/AdminCreateRequest.java new file mode 100644 index 0000000..b7070c2 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/request/AdminCreateRequest.java @@ -0,0 +1,82 @@ +package com.emotion.dto.request; + +import lombok.Data; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +/** + * 管理员创建请求 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Data +public class AdminCreateRequest { + + /** + * 管理员账号 + */ + @NotBlank(message = "账号不能为空") + @Size(min = 3, max = 50, message = "账号长度必须在3-50个字符之间") + private String account; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空") + @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间") + private String password; + + /** + * 管理员姓名 + */ + @NotBlank(message = "姓名不能为空") + @Size(min = 2, max = 50, message = "姓名长度必须在2-50个字符之间") + private String username; + + /** + * 邮箱 + */ + @Email(message = "邮箱格式不正确") + @Size(max = 100, message = "邮箱长度不能超过100个字符") + private String email; + + /** + * 手机号 + */ + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确") + private String phone; + + /** + * 头像URL + */ + @Size(max = 500, message = "头像URL长度不能超过500个字符") + private String avatar; + + /** + * 角色 + */ + @NotBlank(message = "角色不能为空") + @Pattern(regexp = "^(super_admin|admin|operator)$", message = "角色必须是super_admin、admin或operator") + private String role; + + /** + * 权限列表(JSON格式) + */ + private String permissions; + + /** + * 所属部门 + */ + @Size(max = 50, message = "部门长度不能超过50个字符") + private String department; + + /** + * 职位 + */ + @Size(max = 50, message = "职位长度不能超过50个字符") + private String position; +} diff --git a/backend-single/src/main/java/com/emotion/dto/request/AdminLoginRequest.java b/backend-single/src/main/java/com/emotion/dto/request/AdminLoginRequest.java new file mode 100644 index 0000000..00b0a9f --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/request/AdminLoginRequest.java @@ -0,0 +1,30 @@ +package com.emotion.dto.request; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +/** + * 管理员登录请求 + * + * @author emotion-museum + * @date 2025-10-27 + */ +@Data +public class AdminLoginRequest { + + /** + * 账号 + */ + @NotBlank(message = "账号不能为空") + @Size(min = 3, max = 50, message = "账号长度必须在3-50个字符之间") + private String account; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空") + @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间") + private String password; +} diff --git a/backend-single/src/main/java/com/emotion/dto/request/AdminPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/AdminPageRequest.java new file mode 100644 index 0000000..3cb84fb --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/request/AdminPageRequest.java @@ -0,0 +1,59 @@ +package com.emotion.dto.request; + +import com.emotion.common.BasePageRequest; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.Size; + +/** + * 管理员分页查询请求 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AdminPageRequest extends BasePageRequest { + + /** + * 账号 + */ + @Size(max = 50, message = "账号长度不能超过50个字符") + private String account; + + /** + * 姓名 + */ + @Size(max = 50, message = "姓名长度不能超过50个字符") + private String username; + + /** + * 邮箱 + */ + @Size(max = 100, message = "邮箱长度不能超过100个字符") + private String email; + + /** + * 手机号 + */ + @Size(max = 20, message = "手机号长度不能超过20个字符") + private String phone; + + /** + * 角色 + */ + @Size(max = 20, message = "角色长度不能超过20个字符") + private String role; + + /** + * 状态: 0-禁用, 1-正常 + */ + private Integer status; + + /** + * 部门 + */ + @Size(max = 50, message = "部门长度不能超过50个字符") + private String department; +} diff --git a/backend-single/src/main/java/com/emotion/dto/request/AdminUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/AdminUpdateRequest.java new file mode 100644 index 0000000..587ccd2 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/request/AdminUpdateRequest.java @@ -0,0 +1,77 @@ +package com.emotion.dto.request; + +import lombok.Data; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +/** + * 管理员更新请求 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Data +public class AdminUpdateRequest { + + /** + * ID + */ + @NotBlank(message = "ID不能为空") + private String id; + + /** + * 管理员姓名 + */ + @Size(min = 2, max = 50, message = "姓名长度必须在2-50个字符之间") + private String username; + + /** + * 邮箱 + */ + @Email(message = "邮箱格式不正确") + @Size(max = 100, message = "邮箱长度不能超过100个字符") + private String email; + + /** + * 手机号 + */ + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确") + private String phone; + + /** + * 头像URL + */ + @Size(max = 500, message = "头像URL长度不能超过500个字符") + private String avatar; + + /** + * 角色 + */ + @Pattern(regexp = "^(super_admin|admin|operator)$", message = "角色必须是super_admin、admin或operator") + private String role; + + /** + * 权限列表(JSON格式) + */ + private String permissions; + + /** + * 状态: 0-禁用, 1-正常 + */ + private Integer status; + + /** + * 所属部门 + */ + @Size(max = 50, message = "部门长度不能超过50个字符") + private String department; + + /** + * 职位 + */ + @Size(max = 50, message = "职位长度不能超过50个字符") + private String position; +} diff --git a/backend-single/src/main/java/com/emotion/dto/request/AiChatRequest.java b/backend-single/src/main/java/com/emotion/dto/request/AiChatRequest.java index a0c38d4..4550d6f 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/AiChatRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/AiChatRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * AI聊天请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/AiSummaryRequest.java b/backend-single/src/main/java/com/emotion/dto/request/AiSummaryRequest.java index b0d35c4..ed5516c 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/AiSummaryRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/AiSummaryRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * AI总结请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/BaseRequest.java b/backend-single/src/main/java/com/emotion/dto/request/BaseRequest.java index 0159f03..ddfefad 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/BaseRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/BaseRequest.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 基础请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/ChatStatsRequest.java b/backend-single/src/main/java/com/emotion/dto/request/ChatStatsRequest.java index 0498e64..8d020b6 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/ChatStatsRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/ChatStatsRequest.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 聊天统计请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/ConversationCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/ConversationCreateRequest.java index 8b9ac42..312c10b 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/ConversationCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/ConversationCreateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * 对话创建请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/ConversationPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/ConversationPageRequest.java index 8bdcdea..7f22c20 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/ConversationPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/ConversationPageRequest.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 对话分页请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentCreateRequest.java index 7de6d43..43018ff 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentCreateRequest.java @@ -9,7 +9,7 @@ import java.util.List; /** * 创建日记评论请求DTO * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentPageRequest.java index f725018..34af0e4 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/DiaryCommentPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Pattern; /** * 日记评论分页请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/DiaryPostCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/DiaryPostCreateRequest.java index dfc6841..e14ceff 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/DiaryPostCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/DiaryPostCreateRequest.java @@ -11,7 +11,7 @@ import java.util.List; /** * 创建日记请求DTO * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/DiaryPostPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/DiaryPostPageRequest.java index 88aa263..9398ab8 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/DiaryPostPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/DiaryPostPageRequest.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 日记分页请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/DiaryPostUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/DiaryPostUpdateRequest.java index f0f4477..a84aae4 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/DiaryPostUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/DiaryPostUpdateRequest.java @@ -10,7 +10,7 @@ import java.util.List; /** * 更新日记请求DTO * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisCreateRequest.java index 7c35a48..467f8da 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisCreateRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Size; /** * 情绪分析创建请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisPageRequest.java index c2e2897..6997bf7 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Size; /** * 情绪分析分页请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisUpdateRequest.java index c6bc42d..8f7405d 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionAnalysisUpdateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Size; /** * 情绪分析更新请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordCreateRequest.java index bb59eda..37903fa 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordCreateRequest.java @@ -12,7 +12,7 @@ import java.util.List; /** * 情绪记录创建请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordPageRequest.java index 63f9bf1..95c626a 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Size; /** * 情绪记录分页请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordUpdateRequest.java index 43287ed..731ca68 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionRecordUpdateRequest.java @@ -11,7 +11,7 @@ import java.util.List; /** * 情绪记录更新请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryGenerateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryGenerateRequest.java index ea86880..c7dd706 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryGenerateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryGenerateRequest.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 情绪总结生成请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryStatusRequest.java b/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryStatusRequest.java index 14a90ee..f830510 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryStatusRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/EmotionSummaryStatusRequest.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 情绪总结状态请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/GuestChatRequest.java b/backend-single/src/main/java/com/emotion/dto/request/GuestChatRequest.java index 69a60ca..f172502 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/GuestChatRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/GuestChatRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * 访客聊天请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/GuestUserInfoRequest.java b/backend-single/src/main/java/com/emotion/dto/request/GuestUserInfoRequest.java index 0f489e3..10c98dc 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/GuestUserInfoRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/GuestUserInfoRequest.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 访客用户信息请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/IdRequest.java b/backend-single/src/main/java/com/emotion/dto/request/IdRequest.java index 84cc707..675d50e 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/IdRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/IdRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * ID请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/LoginRequest.java b/backend-single/src/main/java/com/emotion/dto/request/LoginRequest.java index 11c8b00..4ac88b1 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/LoginRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/LoginRequest.java @@ -11,7 +11,7 @@ import javax.validation.constraints.Size; * 登录请求 * 简化版:仅需手机号和短信验证码 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/MessageCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/MessageCreateRequest.java index 8ba1156..81c3c6e 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/MessageCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/MessageCreateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * 消息创建请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/MessagePageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/MessagePageRequest.java index 7c8d182..58699f5 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/MessagePageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/MessagePageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Max; /** * 消息分页查询请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-25 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/MessageRecentRequest.java b/backend-single/src/main/java/com/emotion/dto/request/MessageRecentRequest.java index 5858e24..7803a06 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/MessageRecentRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/MessageRecentRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Max; /** * 获取最近消息请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-25 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/MessageSearchRequest.java b/backend-single/src/main/java/com/emotion/dto/request/MessageSearchRequest.java index fcf87e7..b3b85aa 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/MessageSearchRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/MessageSearchRequest.java @@ -10,7 +10,7 @@ import javax.validation.constraints.Max; /** * 消息搜索请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-25 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/PageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/PageRequest.java index 698f5d9..1138e04 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/PageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/PageRequest.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 分页请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/RefreshTokenRequest.java b/backend-single/src/main/java/com/emotion/dto/request/RefreshTokenRequest.java index 1b7cd91..0bf93fa 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/RefreshTokenRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/RefreshTokenRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank; /** * 刷新令牌请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/RegisterRequest.java b/backend-single/src/main/java/com/emotion/dto/request/RegisterRequest.java index 6b25d0c..47a06d8 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/RegisterRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/RegisterRequest.java @@ -11,7 +11,7 @@ import javax.validation.constraints.Size; * 注册请求 * 简化版:仅需要手机号、密码和验证码 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionCreateRequest.java index 5e3c9f8..b9a05c9 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionCreateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Size; /** * 话题互动创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionPageRequest.java index ecac747..c549635 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Size; /** * 话题互动分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionUpdateRequest.java index ca24f90..0c781fe 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/TopicInteractionUpdateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Size; /** * 话题互动更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserCreateRequest.java index bd3db32..941eef2 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserCreateRequest.java @@ -11,7 +11,7 @@ import javax.validation.constraints.Size; /** * 用户创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserPageRequest.java index fbef011..c9c5e7b 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Size; /** * 用户分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserProfileUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserProfileUpdateRequest.java index e8d0a8c..29a71f7 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserProfileUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserProfileUpdateRequest.java @@ -10,7 +10,7 @@ import java.time.LocalDate; /** * 用户个人资料更新请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-26 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserStatsCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserStatsCreateRequest.java index a7bd309..5023aa4 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserStatsCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserStatsCreateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull; /** * 用户统计创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-09 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserStatsIncrementRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserStatsIncrementRequest.java index 9b7abf6..5add153 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserStatsIncrementRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserStatsIncrementRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull; /** * 用户统计值增加请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-09 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserStatsPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserStatsPageRequest.java index 85ea7bc..057df65 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserStatsPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserStatsPageRequest.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 用户统计分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-09 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserStatsUpdateValueRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserStatsUpdateValueRequest.java index b2381aa..e5f60d0 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserStatsUpdateValueRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserStatsUpdateValueRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull; /** * 用户统计值更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-09 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/UserUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/UserUpdateRequest.java index 50142ba..6b12ef5 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/UserUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/UserUpdateRequest.java @@ -11,7 +11,7 @@ import java.time.LocalDate; /** * 用户更新请求类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/WebSocketRequest.java b/backend-single/src/main/java/com/emotion/dto/request/WebSocketRequest.java index 257ba2d..ba8496d 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/WebSocketRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/WebSocketRequest.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * WebSocket请求对象 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementCreateRequest.java index ac2983e..bb4566b 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementCreateRequest.java @@ -9,7 +9,7 @@ import java.math.BigDecimal; /** * 创建成就请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementPageRequest.java index 7bd6402..f2e1d4d 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementPageRequest.java @@ -11,7 +11,7 @@ import java.math.BigDecimal; /** * 成就分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementProgressUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementProgressUpdateRequest.java index 74db457..c0dae6d 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementProgressUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementProgressUpdateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull; /** * 更新成就进度请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUnlockRequest.java b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUnlockRequest.java index 2cae3e2..03a90e8 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUnlockRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUnlockRequest.java @@ -7,7 +7,7 @@ import javax.validation.constraints.NotBlank; /** * 解锁成就请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUpdateRequest.java index ba2c421..e7f9a17 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/achievement/AchievementUpdateRequest.java @@ -9,7 +9,7 @@ import java.math.BigDecimal; /** * 更新成就请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentCreateRequest.java index 1654f9c..aec276b 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentCreateRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; /** * 评论创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentPageRequest.java index e0c7bc3..3dbbcf8 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Pattern; /** * 评论分页请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentQueryRequest.java b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentQueryRequest.java index 7d44141..a1a3d34 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentQueryRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentQueryRequest.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 评论查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentUpdateRequest.java index 016d3d3..6107375 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/comment/CommentUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/comment/CommentUpdateRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; /** * 评论更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostCreateRequest.java index c0681f3..b6be225 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostCreateRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; /** * 社区帖子创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostPageRequest.java index 63976bd..861f398 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Pattern; /** * 社区帖子分页请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostUpdateRequest.java index 5db1669..8345eb4 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/community/CommunityPostUpdateRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; /** * 社区帖子更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallCreateRequest.java index 2946db1..3660360 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallCreateRequest.java @@ -10,7 +10,7 @@ import java.math.BigDecimal; /** * Coze API调用记录创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallPageRequest.java index e210844..1df6866 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallPageRequest.java @@ -9,7 +9,7 @@ import javax.validation.constraints.Pattern; /** * Coze API调用记录分页请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallUpdateRequest.java index 212ed39..f37205d 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/coze/CozeApiCallUpdateRequest.java @@ -10,7 +10,7 @@ import java.math.BigDecimal; /** * Coze API调用记录更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicCreateRequest.java index b446c23..3d2dedb 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicCreateRequest.java @@ -9,7 +9,7 @@ import java.time.LocalDateTime; /** * 成长话题创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicPageRequest.java index c16a75f..25f8332 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicPageRequest.java @@ -10,7 +10,7 @@ import javax.validation.constraints.Size; /** * 成长话题分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicUpdateRequest.java index dd42434..fb39707 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/growth/GrowthTopicUpdateRequest.java @@ -9,7 +9,7 @@ import java.time.LocalDateTime; /** * 成长话题更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserCreateRequest.java index 6c30d4b..de014f3 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserCreateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Size; /** * 访客用户创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserPageRequest.java index 0392c15..5e0e27a 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserPageRequest.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 访客用户分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserUpdateRequest.java index 1e77aa4..0aff8ea 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/guest/GuestUserUpdateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Size; /** * 访客用户更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/reward/RewardCreateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/reward/RewardCreateRequest.java index c9fae11..361bb34 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/reward/RewardCreateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/reward/RewardCreateRequest.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; /** * 奖励创建请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/reward/RewardPageRequest.java b/backend-single/src/main/java/com/emotion/dto/request/reward/RewardPageRequest.java index 4f290bd..7734be4 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/reward/RewardPageRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/reward/RewardPageRequest.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 奖励分页查询请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/request/reward/RewardUpdateRequest.java b/backend-single/src/main/java/com/emotion/dto/request/reward/RewardUpdateRequest.java index 41545b4..8f8020d 100644 --- a/backend-single/src/main/java/com/emotion/dto/request/reward/RewardUpdateRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/request/reward/RewardUpdateRequest.java @@ -8,7 +8,7 @@ import javax.validation.constraints.Size; /** * 奖励更新请求 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/AdminAuthResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AdminAuthResponse.java new file mode 100644 index 0000000..5e9732d --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/response/AdminAuthResponse.java @@ -0,0 +1,38 @@ +package com.emotion.dto.response; + +import lombok.Data; + +/** + * 管理员认证响应 + * + * @author emotion-museum + * @date 2025-10-27 + */ +@Data +public class AdminAuthResponse { + + /** + * 访问令牌 + */ + private String accessToken; + + /** + * 刷新令牌 + */ + private String refreshToken; + + /** + * 令牌过期时间(秒) + */ + private Long expiresIn; + + /** + * 管理员信息 + */ + private AdminInfoResponse adminInfo; + + /** + * 登录时间 + */ + private String loginTime; +} diff --git a/backend-single/src/main/java/com/emotion/dto/response/AdminInfoResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AdminInfoResponse.java new file mode 100644 index 0000000..775ff64 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/response/AdminInfoResponse.java @@ -0,0 +1,68 @@ +package com.emotion.dto.response; + +import lombok.Data; + +/** + * 管理员信息响应 + * + * @author emotion-museum + * @date 2025-10-27 + */ +@Data +public class AdminInfoResponse { + + /** + * ID + */ + private String id; + + /** + * 账号 + */ + private String account; + + /** + * 姓名 + */ + private String username; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号 + */ + private String phone; + + /** + * 头像 + */ + private String avatar; + + /** + * 角色 + */ + private String role; + + /** + * 权限列表 + */ + private String permissions; + + /** + * 状态: 0-禁用, 1-正常 + */ + private Integer status; + + /** + * 部门 + */ + private String department; + + /** + * 职位 + */ + private String position; +} diff --git a/backend-single/src/main/java/com/emotion/dto/response/AdminResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AdminResponse.java new file mode 100644 index 0000000..4406354 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/dto/response/AdminResponse.java @@ -0,0 +1,93 @@ +package com.emotion.dto.response; + +import lombok.Data; + +/** + * 管理员响应 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Data +public class AdminResponse { + + /** + * ID + */ + private String id; + + /** + * 账号 + */ + private String account; + + /** + * 姓名 + */ + private String username; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号 + */ + private String phone; + + /** + * 头像 + */ + private String avatar; + + /** + * 角色 + */ + private String role; + + /** + * 权限列表 + */ + private String permissions; + + /** + * 状态: 0-禁用, 1-正常 + */ + private Integer status; + + /** + * 最后登录时间 + */ + private String lastLoginTime; + + /** + * 最后登录IP + */ + private String lastLoginIp; + + /** + * 登录次数 + */ + private Integer loginCount; + + /** + * 部门 + */ + private String department; + + /** + * 职位 + */ + private String position; + + /** + * 创建时间 + */ + private String createTime; + + /** + * 更新时间 + */ + private String updateTime; +} diff --git a/backend-single/src/main/java/com/emotion/dto/response/AiChatResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AiChatResponse.java index cb84c93..0cb3880 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/AiChatResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/AiChatResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * AI聊天响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/AiStatusResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AiStatusResponse.java index ba84c0c..2b53492 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/AiStatusResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/AiStatusResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * AI状态响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/AiSummaryResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AiSummaryResponse.java index fd99c4c..1d975b0 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/AiSummaryResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/AiSummaryResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * AI总结响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/AuthResponse.java b/backend-single/src/main/java/com/emotion/dto/response/AuthResponse.java index 9f2c0d3..6573420 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/AuthResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/AuthResponse.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 认证响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/BaseResponse.java b/backend-single/src/main/java/com/emotion/dto/response/BaseResponse.java index 899a21c..54266b7 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/BaseResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/BaseResponse.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 基础响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/CaptchaResponse.java b/backend-single/src/main/java/com/emotion/dto/response/CaptchaResponse.java index 8f15d93..8c334f1 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/CaptchaResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/CaptchaResponse.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 验证码响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/ChatStatsResponse.java b/backend-single/src/main/java/com/emotion/dto/response/ChatStatsResponse.java index 53d05c6..22afcbb 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/ChatStatsResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/ChatStatsResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 聊天统计响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/ConversationResponse.java b/backend-single/src/main/java/com/emotion/dto/response/ConversationResponse.java index 214f4bd..6d16680 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/ConversationResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/ConversationResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 对话响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/DiaryCommentResponse.java b/backend-single/src/main/java/com/emotion/dto/response/DiaryCommentResponse.java index 11ded96..13cdc3d 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/DiaryCommentResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/DiaryCommentResponse.java @@ -8,7 +8,7 @@ import java.util.List; /** * 日记评论响应DTO * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/DiaryPostResponse.java b/backend-single/src/main/java/com/emotion/dto/response/DiaryPostResponse.java index a45e770..fbb46e7 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/DiaryPostResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/DiaryPostResponse.java @@ -9,7 +9,7 @@ import java.util.List; /** * 日记响应DTO * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/EmotionAnalysisResponse.java b/backend-single/src/main/java/com/emotion/dto/response/EmotionAnalysisResponse.java index 764f34e..9dcce7f 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/EmotionAnalysisResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/EmotionAnalysisResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 情绪分析响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/EmotionRecordResponse.java b/backend-single/src/main/java/com/emotion/dto/response/EmotionRecordResponse.java index 19d3108..7a2529b 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/EmotionRecordResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/EmotionRecordResponse.java @@ -11,7 +11,7 @@ import java.util.List; /** * 情绪记录响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryGenerateResponse.java b/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryGenerateResponse.java index 824ddd7..b1732c2 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryGenerateResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryGenerateResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 情绪总结生成响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryStatusResponse.java b/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryStatusResponse.java index efe61f4..ed71a83 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryStatusResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/EmotionSummaryStatusResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 情绪总结状态响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/GuestChatResponse.java b/backend-single/src/main/java/com/emotion/dto/response/GuestChatResponse.java index e44ba9c..af9af85 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/GuestChatResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/GuestChatResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 访客聊天响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/GuestUserInfoResponse.java b/backend-single/src/main/java/com/emotion/dto/response/GuestUserInfoResponse.java index 77aae4e..23b66b5 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/GuestUserInfoResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/GuestUserInfoResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 访客用户信息响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/MessageResponse.java b/backend-single/src/main/java/com/emotion/dto/response/MessageResponse.java index f0a2e39..602abb0 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/MessageResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/MessageResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 消息响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/SmsCodeResponse.java b/backend-single/src/main/java/com/emotion/dto/response/SmsCodeResponse.java index fbc3db5..5a22bc8 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/SmsCodeResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/SmsCodeResponse.java @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; /** * 短信验证码响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-10-06 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/TopicInteractionResponse.java b/backend-single/src/main/java/com/emotion/dto/response/TopicInteractionResponse.java index 180c8ab..6ff0c45 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/TopicInteractionResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/TopicInteractionResponse.java @@ -8,7 +8,7 @@ import java.time.LocalDateTime; /** * 话题互动响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/UserInfoResponse.java b/backend-single/src/main/java/com/emotion/dto/response/UserInfoResponse.java index f604cce..16b30fd 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/UserInfoResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/UserInfoResponse.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 用户信息响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/UserResponse.java b/backend-single/src/main/java/com/emotion/dto/response/UserResponse.java index 97041dd..ca42a9d 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/UserResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/UserResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 用户响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/UserStatsResponse.java b/backend-single/src/main/java/com/emotion/dto/response/UserStatsResponse.java index f345dff..d41edbc 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/UserStatsResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/UserStatsResponse.java @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 用户统计响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/achievement/AchievementResponse.java b/backend-single/src/main/java/com/emotion/dto/response/achievement/AchievementResponse.java index d8ae9db..eca2ffe 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/achievement/AchievementResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/achievement/AchievementResponse.java @@ -9,7 +9,7 @@ import java.math.BigDecimal; /** * 成就响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/comment/CommentResponse.java b/backend-single/src/main/java/com/emotion/dto/response/comment/CommentResponse.java index 17abb8c..1d93135 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/comment/CommentResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/comment/CommentResponse.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 评论响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/community/CommunityPostResponse.java b/backend-single/src/main/java/com/emotion/dto/response/community/CommunityPostResponse.java index c4395f7..08dbe7c 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/community/CommunityPostResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/community/CommunityPostResponse.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; /** * 社区帖子响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/coze/CozeApiCallResponse.java b/backend-single/src/main/java/com/emotion/dto/response/coze/CozeApiCallResponse.java index d28a18d..751fd49 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/coze/CozeApiCallResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/coze/CozeApiCallResponse.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; /** * Coze API调用记录响应 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/growth/GrowthTopicResponse.java b/backend-single/src/main/java/com/emotion/dto/response/growth/GrowthTopicResponse.java index 5bb00bb..9a3dd65 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/growth/GrowthTopicResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/growth/GrowthTopicResponse.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; /** * 成长话题响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/guest/GuestUserResponse.java b/backend-single/src/main/java/com/emotion/dto/response/guest/GuestUserResponse.java index 235f27a..9be9302 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/guest/GuestUserResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/guest/GuestUserResponse.java @@ -9,7 +9,7 @@ import java.time.LocalDateTime; /** * 访客用户响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/response/reward/RewardResponse.java b/backend-single/src/main/java/com/emotion/dto/response/reward/RewardResponse.java index d808fcb..8c65b74 100644 --- a/backend-single/src/main/java/com/emotion/dto/response/reward/RewardResponse.java +++ b/backend-single/src/main/java/com/emotion/dto/response/reward/RewardResponse.java @@ -9,7 +9,7 @@ import java.time.LocalDateTime; /** * 奖励响应类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/websocket/ChatRequest.java b/backend-single/src/main/java/com/emotion/dto/websocket/ChatRequest.java index 10caa39..4947283 100644 --- a/backend-single/src/main/java/com/emotion/dto/websocket/ChatRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/websocket/ChatRequest.java @@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull; /** * WebSocket聊天请求对象 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/websocket/ConnectRequest.java b/backend-single/src/main/java/com/emotion/dto/websocket/ConnectRequest.java index bae1cbf..8e76679 100644 --- a/backend-single/src/main/java/com/emotion/dto/websocket/ConnectRequest.java +++ b/backend-single/src/main/java/com/emotion/dto/websocket/ConnectRequest.java @@ -10,7 +10,7 @@ import javax.validation.constraints.NotBlank; /** * WebSocket连接请求对象 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/dto/websocket/WebSocketMessage.java b/backend-single/src/main/java/com/emotion/dto/websocket/WebSocketMessage.java index 5cb6c34..ffe971d 100644 --- a/backend-single/src/main/java/com/emotion/dto/websocket/WebSocketMessage.java +++ b/backend-single/src/main/java/com/emotion/dto/websocket/WebSocketMessage.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; /** * WebSocket消息对象 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/Achievement.java b/backend-single/src/main/java/com/emotion/entity/Achievement.java index 5aef99e..bfebccd 100644 --- a/backend-single/src/main/java/com/emotion/entity/Achievement.java +++ b/backend-single/src/main/java/com/emotion/entity/Achievement.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 成就实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/Admin.java b/backend-single/src/main/java/com/emotion/entity/Admin.java new file mode 100644 index 0000000..ecaf76d --- /dev/null +++ b/backend-single/src/main/java/com/emotion/entity/Admin.java @@ -0,0 +1,110 @@ +package com.emotion.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.emotion.common.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.SuperBuilder; +import lombok.NoArgsConstructor; +import lombok.AllArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 管理员用户实体类 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@TableName("t_admin") +public class Admin extends BaseEntity { + + /** + * 管理员账号 + */ + @TableField("account") + private String account; + + /** + * 密码(加密后) + */ + @TableField("password") + private String password; + + /** + * 管理员姓名 + */ + @TableField("username") + private String username; + + /** + * 邮箱 + */ + @TableField("email") + private String email; + + /** + * 手机号 + */ + @TableField("phone") + private String phone; + + /** + * 头像URL + */ + @TableField("avatar") + private String avatar; + + /** + * 角色: super_admin-超级管理员, admin-管理员, operator-运营 + */ + @TableField("role") + private String role; + + /** + * 权限列表 + */ + @TableField("permissions") + private String permissions; + + /** + * 状态: 0-禁用, 1-正常 + */ + @TableField("status") + private Integer status; + + /** + * 最后登录时间 + */ + @TableField("last_login_time") + private LocalDateTime lastLoginTime; + + /** + * 最后登录IP + */ + @TableField("last_login_ip") + private String lastLoginIp; + + /** + * 登录次数 + */ + @TableField("login_count") + private Integer loginCount; + + /** + * 所属部门 + */ + @TableField("department") + private String department; + + /** + * 职位 + */ + @TableField("position") + private String position; +} diff --git a/backend-single/src/main/java/com/emotion/entity/Comment.java b/backend-single/src/main/java/com/emotion/entity/Comment.java index 01e6bc8..47f5edb 100644 --- a/backend-single/src/main/java/com/emotion/entity/Comment.java +++ b/backend-single/src/main/java/com/emotion/entity/Comment.java @@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode; /** * 评论实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/CommunityPost.java b/backend-single/src/main/java/com/emotion/entity/CommunityPost.java index 8c9ed74..ba74de7 100644 --- a/backend-single/src/main/java/com/emotion/entity/CommunityPost.java +++ b/backend-single/src/main/java/com/emotion/entity/CommunityPost.java @@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode; /** * 社区帖子实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/Conversation.java b/backend-single/src/main/java/com/emotion/entity/Conversation.java index 65588d6..56e1c60 100644 --- a/backend-single/src/main/java/com/emotion/entity/Conversation.java +++ b/backend-single/src/main/java/com/emotion/entity/Conversation.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 对话实体 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/CozeApiCall.java b/backend-single/src/main/java/com/emotion/entity/CozeApiCall.java index b6f7509..5565362 100644 --- a/backend-single/src/main/java/com/emotion/entity/CozeApiCall.java +++ b/backend-single/src/main/java/com/emotion/entity/CozeApiCall.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * Coze API调用记录实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/DiaryComment.java b/backend-single/src/main/java/com/emotion/entity/DiaryComment.java index 567b394..25758c1 100644 --- a/backend-single/src/main/java/com/emotion/entity/DiaryComment.java +++ b/backend-single/src/main/java/com/emotion/entity/DiaryComment.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 日记评论实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/DiaryPost.java b/backend-single/src/main/java/com/emotion/entity/DiaryPost.java index 91180d8..b2e243a 100644 --- a/backend-single/src/main/java/com/emotion/entity/DiaryPost.java +++ b/backend-single/src/main/java/com/emotion/entity/DiaryPost.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 用户日记实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/EmotionAnalysis.java b/backend-single/src/main/java/com/emotion/entity/EmotionAnalysis.java index 32902fc..161991e 100644 --- a/backend-single/src/main/java/com/emotion/entity/EmotionAnalysis.java +++ b/backend-single/src/main/java/com/emotion/entity/EmotionAnalysis.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 情绪分析实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/EmotionRecord.java b/backend-single/src/main/java/com/emotion/entity/EmotionRecord.java index 61d78d5..4114a17 100644 --- a/backend-single/src/main/java/com/emotion/entity/EmotionRecord.java +++ b/backend-single/src/main/java/com/emotion/entity/EmotionRecord.java @@ -14,7 +14,7 @@ import java.time.LocalDate; /** * 情绪记录实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/GrowthTopic.java b/backend-single/src/main/java/com/emotion/entity/GrowthTopic.java index 1f41e28..d957576 100644 --- a/backend-single/src/main/java/com/emotion/entity/GrowthTopic.java +++ b/backend-single/src/main/java/com/emotion/entity/GrowthTopic.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 成长课题实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/GuestUser.java b/backend-single/src/main/java/com/emotion/entity/GuestUser.java index 3cac6ed..3da97ff 100644 --- a/backend-single/src/main/java/com/emotion/entity/GuestUser.java +++ b/backend-single/src/main/java/com/emotion/entity/GuestUser.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 访客用户实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/LocationPin.java b/backend-single/src/main/java/com/emotion/entity/LocationPin.java index 9039989..ce6aa2c 100644 --- a/backend-single/src/main/java/com/emotion/entity/LocationPin.java +++ b/backend-single/src/main/java/com/emotion/entity/LocationPin.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 地点标记实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/Message.java b/backend-single/src/main/java/com/emotion/entity/Message.java index ed46323..9c1177c 100644 --- a/backend-single/src/main/java/com/emotion/entity/Message.java +++ b/backend-single/src/main/java/com/emotion/entity/Message.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 消息实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/Reward.java b/backend-single/src/main/java/com/emotion/entity/Reward.java index 22dfb19..f763526 100644 --- a/backend-single/src/main/java/com/emotion/entity/Reward.java +++ b/backend-single/src/main/java/com/emotion/entity/Reward.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 奖励实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/TopicInteraction.java b/backend-single/src/main/java/com/emotion/entity/TopicInteraction.java index 552ea2a..fd43230 100644 --- a/backend-single/src/main/java/com/emotion/entity/TopicInteraction.java +++ b/backend-single/src/main/java/com/emotion/entity/TopicInteraction.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 课题互动实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/User.java b/backend-single/src/main/java/com/emotion/entity/User.java index 007af90..18eb5a3 100644 --- a/backend-single/src/main/java/com/emotion/entity/User.java +++ b/backend-single/src/main/java/com/emotion/entity/User.java @@ -15,7 +15,7 @@ import java.time.LocalDateTime; /** * 用户实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/entity/UserStats.java b/backend-single/src/main/java/com/emotion/entity/UserStats.java index c4fc343..6aba78e 100644 --- a/backend-single/src/main/java/com/emotion/entity/UserStats.java +++ b/backend-single/src/main/java/com/emotion/entity/UserStats.java @@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode; /** * 用户统计实体类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Data diff --git a/backend-single/src/main/java/com/emotion/exception/AuthException.java b/backend-single/src/main/java/com/emotion/exception/AuthException.java index 1cbee68..2d2632d 100644 --- a/backend-single/src/main/java/com/emotion/exception/AuthException.java +++ b/backend-single/src/main/java/com/emotion/exception/AuthException.java @@ -3,7 +3,7 @@ package com.emotion.exception; /** * 认证异常类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public class AuthException extends BusinessException { diff --git a/backend-single/src/main/java/com/emotion/exception/BusinessException.java b/backend-single/src/main/java/com/emotion/exception/BusinessException.java index 184f480..ac991d6 100644 --- a/backend-single/src/main/java/com/emotion/exception/BusinessException.java +++ b/backend-single/src/main/java/com/emotion/exception/BusinessException.java @@ -3,7 +3,7 @@ package com.emotion.exception; /** * 业务异常 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public class BusinessException extends RuntimeException { diff --git a/backend-single/src/main/java/com/emotion/exception/CaptchaException.java b/backend-single/src/main/java/com/emotion/exception/CaptchaException.java index 44db258..5015b9c 100644 --- a/backend-single/src/main/java/com/emotion/exception/CaptchaException.java +++ b/backend-single/src/main/java/com/emotion/exception/CaptchaException.java @@ -3,7 +3,7 @@ package com.emotion.exception; /** * 验证码异常类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public class CaptchaException extends BusinessException { diff --git a/backend-single/src/main/java/com/emotion/exception/GlobalExceptionHandler.java b/backend-single/src/main/java/com/emotion/exception/GlobalExceptionHandler.java index 4aaea46..13da8bd 100644 --- a/backend-single/src/main/java/com/emotion/exception/GlobalExceptionHandler.java +++ b/backend-single/src/main/java/com/emotion/exception/GlobalExceptionHandler.java @@ -19,7 +19,7 @@ import java.util.Set; /** * 全局异常处理器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @RestControllerAdvice diff --git a/backend-single/src/main/java/com/emotion/exception/TokenException.java b/backend-single/src/main/java/com/emotion/exception/TokenException.java index 1f57e86..7c72d12 100644 --- a/backend-single/src/main/java/com/emotion/exception/TokenException.java +++ b/backend-single/src/main/java/com/emotion/exception/TokenException.java @@ -3,7 +3,7 @@ package com.emotion.exception; /** * 令牌异常类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public class TokenException extends AuthException { diff --git a/backend-single/src/main/java/com/emotion/handler/EmotionMetaObjectHandler.java b/backend-single/src/main/java/com/emotion/handler/EmotionMetaObjectHandler.java index 1730fc9..4dafabc 100644 --- a/backend-single/src/main/java/com/emotion/handler/EmotionMetaObjectHandler.java +++ b/backend-single/src/main/java/com/emotion/handler/EmotionMetaObjectHandler.java @@ -15,7 +15,7 @@ import java.time.LocalDateTime; * 自动填充公共字段:id, create_by, create_time, update_by, update_time * 支持雪花算法自动生成主键ID * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/interceptor/AdminAuthInterceptor.java b/backend-single/src/main/java/com/emotion/interceptor/AdminAuthInterceptor.java new file mode 100644 index 0000000..b2c4e56 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/interceptor/AdminAuthInterceptor.java @@ -0,0 +1,112 @@ +package com.emotion.interceptor; + +import com.emotion.util.JwtUtil; +import com.emotion.util.UserContextHolder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 管理员认证拦截器 + * + * @author emotion-museum + * @date 2025-10-27 + */ +@Component +public class AdminAuthInterceptor implements HandlerInterceptor { + + private static final Logger log = LoggerFactory.getLogger(AdminAuthInterceptor.class); + + @Autowired + private JwtUtil jwtUtil; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + String requestURI = request.getRequestURI(); + String method = request.getMethod(); + + log.debug("管理员拦截器处理请求: {} {}", method, requestURI); + + if ("OPTIONS".equals(method)) { + return true; + } + + if (isPublicAdminEndpoint(requestURI)) { + log.debug("管理员公开接口,无需认证: {}", requestURI); + return true; + } + + String authHeader = request.getHeader("Authorization"); + if (authHeader == null || !authHeader.startsWith("Bearer ")) { + log.warn("管理员请求缺少Authorization头或格式错误: {}", requestURI); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write("{\"code\":401,\"message\":\"未登录或登录已过期\",\"data\":null}"); + return false; + } + + String token = authHeader.substring(7); + + if (!jwtUtil.validateToken(token)) { + log.warn("管理员Token验证失败: {}", requestURI); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write("{\"code\":401,\"message\":\"Token无效或已过期\",\"data\":null}"); + return false; + } + + String userType = jwtUtil.getUserTypeFromToken(token); + if (!"admin".equals(userType)) { + log.warn("非管理员用户尝试访问管理员接口: {}, userType={}", requestURI, userType); + response.setStatus(HttpServletResponse.SC_FORBIDDEN); + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write("{\"code\":403,\"message\":\"无权限访问\",\"data\":null}"); + return false; + } + + String adminId = jwtUtil.getUserIdFromToken(token); + String username = jwtUtil.getUsernameFromToken(token); + + request.setAttribute("adminId", adminId); + request.setAttribute("username", username); + request.setAttribute("token", token); + request.setAttribute("userType", "admin"); + + UserContextHolder.setCurrentUserId(adminId); + UserContextHolder.setCurrentUsername(username); + UserContextHolder.setCurrentToken(token); + + log.debug("管理员Token验证成功,管理员: {} ({})", username, adminId); + + return true; + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + UserContextHolder.clear(); + log.debug("管理员请求完成,已清除用户上下文"); + } + + /** + * 判断是否为管理员公开接口(不需要认证) + */ + private boolean isPublicAdminEndpoint(String requestURI) { + String[] publicEndpoints = { + "/admin/auth/login", + "/admin/auth/refreshToken" + }; + + for (String endpoint : publicEndpoints) { + if (requestURI.equals(endpoint)) { + return true; + } + } + + return false; + } +} diff --git a/backend-single/src/main/java/com/emotion/interceptor/AuthInterceptor.java b/backend-single/src/main/java/com/emotion/interceptor/AuthInterceptor.java index 773358e..b02ac1b 100644 --- a/backend-single/src/main/java/com/emotion/interceptor/AuthInterceptor.java +++ b/backend-single/src/main/java/com/emotion/interceptor/AuthInterceptor.java @@ -11,7 +11,7 @@ import javax.servlet.http.HttpServletResponse; /** * 认证拦截器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Component diff --git a/backend-single/src/main/java/com/emotion/interceptor/JwtAuthInterceptor.java b/backend-single/src/main/java/com/emotion/interceptor/JwtAuthInterceptor.java index f43cda6..6736e2e 100644 --- a/backend-single/src/main/java/com/emotion/interceptor/JwtAuthInterceptor.java +++ b/backend-single/src/main/java/com/emotion/interceptor/JwtAuthInterceptor.java @@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletResponse; /** * JWT认证拦截器 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Component diff --git a/backend-single/src/main/java/com/emotion/interceptor/UserContextInterceptor.java b/backend-single/src/main/java/com/emotion/interceptor/UserContextInterceptor.java index b3540d4..2ea1e67 100644 --- a/backend-single/src/main/java/com/emotion/interceptor/UserContextInterceptor.java +++ b/backend-single/src/main/java/com/emotion/interceptor/UserContextInterceptor.java @@ -14,7 +14,7 @@ import java.util.UUID; * 用户上下文拦截器 * 用于在请求处理前设置用户上下文信息,请求处理后清理上下文 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/interceptor/WebSocketAuthInterceptor.java b/backend-single/src/main/java/com/emotion/interceptor/WebSocketAuthInterceptor.java index 9cdabe1..d37dc49 100644 --- a/backend-single/src/main/java/com/emotion/interceptor/WebSocketAuthInterceptor.java +++ b/backend-single/src/main/java/com/emotion/interceptor/WebSocketAuthInterceptor.java @@ -22,7 +22,7 @@ import java.util.Collections; * WebSocket认证拦截器 * 用于在WebSocket连接时验证用户身份 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/mapper/AchievementMapper.java b/backend-single/src/main/java/com/emotion/mapper/AchievementMapper.java index 8be6b1a..39e1540 100644 --- a/backend-single/src/main/java/com/emotion/mapper/AchievementMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/AchievementMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 成就Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/AdminMapper.java b/backend-single/src/main/java/com/emotion/mapper/AdminMapper.java new file mode 100644 index 0000000..48ba626 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/mapper/AdminMapper.java @@ -0,0 +1,15 @@ +package com.emotion.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.emotion.entity.Admin; +import org.apache.ibatis.annotations.Mapper; + +/** + * 管理员Mapper接口 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Mapper +public interface AdminMapper extends BaseMapper { +} diff --git a/backend-single/src/main/java/com/emotion/mapper/CommentMapper.java b/backend-single/src/main/java/com/emotion/mapper/CommentMapper.java index b20c992..3674e0e 100644 --- a/backend-single/src/main/java/com/emotion/mapper/CommentMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/CommentMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 评论Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/CommunityPostMapper.java b/backend-single/src/main/java/com/emotion/mapper/CommunityPostMapper.java index 262c8ef..7e26e1e 100644 --- a/backend-single/src/main/java/com/emotion/mapper/CommunityPostMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/CommunityPostMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 社区帖子Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/ConversationMapper.java b/backend-single/src/main/java/com/emotion/mapper/ConversationMapper.java index be83bc5..a2ae659 100644 --- a/backend-single/src/main/java/com/emotion/mapper/ConversationMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/ConversationMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 会话Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/CozeApiCallMapper.java b/backend-single/src/main/java/com/emotion/mapper/CozeApiCallMapper.java index 96bdc3e..4321e8b 100644 --- a/backend-single/src/main/java/com/emotion/mapper/CozeApiCallMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/CozeApiCallMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * Coze API调用记录Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/DiaryCommentMapper.java b/backend-single/src/main/java/com/emotion/mapper/DiaryCommentMapper.java index 49d5b98..25343b1 100644 --- a/backend-single/src/main/java/com/emotion/mapper/DiaryCommentMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/DiaryCommentMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 日记评论Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/DiaryPostMapper.java b/backend-single/src/main/java/com/emotion/mapper/DiaryPostMapper.java index b9828ff..00c77a8 100644 --- a/backend-single/src/main/java/com/emotion/mapper/DiaryPostMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/DiaryPostMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 用户日记Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/EmotionAnalysisMapper.java b/backend-single/src/main/java/com/emotion/mapper/EmotionAnalysisMapper.java index 5ec3f55..d47b221 100644 --- a/backend-single/src/main/java/com/emotion/mapper/EmotionAnalysisMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/EmotionAnalysisMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 情绪分析Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/EmotionRecordMapper.java b/backend-single/src/main/java/com/emotion/mapper/EmotionRecordMapper.java index 0f487bf..f10233c 100644 --- a/backend-single/src/main/java/com/emotion/mapper/EmotionRecordMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/EmotionRecordMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 情绪记录Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/GrowthTopicMapper.java b/backend-single/src/main/java/com/emotion/mapper/GrowthTopicMapper.java index 5c1b3aa..175de65 100644 --- a/backend-single/src/main/java/com/emotion/mapper/GrowthTopicMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/GrowthTopicMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 成长课题Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/GuestUserMapper.java b/backend-single/src/main/java/com/emotion/mapper/GuestUserMapper.java index dea5258..519df7b 100644 --- a/backend-single/src/main/java/com/emotion/mapper/GuestUserMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/GuestUserMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 访客用户Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/LocationPinMapper.java b/backend-single/src/main/java/com/emotion/mapper/LocationPinMapper.java index 6ed3c17..9796afd 100644 --- a/backend-single/src/main/java/com/emotion/mapper/LocationPinMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/LocationPinMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 地点标记Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/MessageMapper.java b/backend-single/src/main/java/com/emotion/mapper/MessageMapper.java index 5da37a2..67806da 100644 --- a/backend-single/src/main/java/com/emotion/mapper/MessageMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/MessageMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper; * 消息Mapper接口 * 说明:统一使用 MyBatis-Plus 的 BaseMapper 与 Service 层的 LambdaQueryWrapper 构建条件, * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/RewardMapper.java b/backend-single/src/main/java/com/emotion/mapper/RewardMapper.java index 1615bcb..917d9cb 100644 --- a/backend-single/src/main/java/com/emotion/mapper/RewardMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/RewardMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 奖励Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/TopicInteractionMapper.java b/backend-single/src/main/java/com/emotion/mapper/TopicInteractionMapper.java index dff4bbf..0c8a3eb 100644 --- a/backend-single/src/main/java/com/emotion/mapper/TopicInteractionMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/TopicInteractionMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 课题互动Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/UserMapper.java b/backend-single/src/main/java/com/emotion/mapper/UserMapper.java index 8b14437..cfef84c 100644 --- a/backend-single/src/main/java/com/emotion/mapper/UserMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/UserMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 用户Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/mapper/UserStatsMapper.java b/backend-single/src/main/java/com/emotion/mapper/UserStatsMapper.java index 8142641..e1fd351 100644 --- a/backend-single/src/main/java/com/emotion/mapper/UserStatsMapper.java +++ b/backend-single/src/main/java/com/emotion/mapper/UserStatsMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 用户统计Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Mapper diff --git a/backend-single/src/main/java/com/emotion/service/AchievementService.java b/backend-single/src/main/java/com/emotion/service/AchievementService.java index 8f4808a..c01084d 100644 --- a/backend-single/src/main/java/com/emotion/service/AchievementService.java +++ b/backend-single/src/main/java/com/emotion/service/AchievementService.java @@ -13,7 +13,7 @@ import java.util.List; /** * 成就服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ public interface AchievementService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/AdminAuthService.java b/backend-single/src/main/java/com/emotion/service/AdminAuthService.java new file mode 100644 index 0000000..77dde9a --- /dev/null +++ b/backend-single/src/main/java/com/emotion/service/AdminAuthService.java @@ -0,0 +1,64 @@ +package com.emotion.service; + +import com.emotion.dto.request.AdminLoginRequest; +import com.emotion.dto.response.AdminAuthResponse; +import com.emotion.dto.response.AdminInfoResponse; + +import javax.servlet.http.HttpServletRequest; + +/** + * 管理员认证服务接口 + * + * @author emotion-museum + * @date 2025-10-27 + */ +public interface AdminAuthService { + + /** + * 管理员登录 + * + * @param request 登录请求 + * @return 认证响应 + */ + AdminAuthResponse login(AdminLoginRequest request); + + /** + * 获取当前管理员信息 + * + * @param adminId 管理员ID + * @return 管理员信息响应 + */ + AdminInfoResponse getCurrentAdminInfo(String adminId); + + /** + * 管理员登出 + * + * @param request HTTP请求 + * @return 是否登出成功 + */ + boolean logout(HttpServletRequest request); + + /** + * 刷新访问令牌 + * + * @param refreshToken 刷新令牌 + * @return 新的认证响应 + */ + AdminAuthResponse refreshToken(String refreshToken); + + /** + * 验证访问令牌 + * + * @param request HTTP请求 + * @return 是否有效 + */ + boolean validateToken(HttpServletRequest request); + + /** + * 从令牌中获取管理员ID + * + * @param token 访问令牌 + * @return 管理员ID + */ + String getAdminIdFromToken(String token); +} diff --git a/backend-single/src/main/java/com/emotion/service/AdminService.java b/backend-single/src/main/java/com/emotion/service/AdminService.java new file mode 100644 index 0000000..dee3493 --- /dev/null +++ b/backend-single/src/main/java/com/emotion/service/AdminService.java @@ -0,0 +1,53 @@ +package com.emotion.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.emotion.common.PageResult; +import com.emotion.dto.request.AdminCreateRequest; +import com.emotion.dto.request.AdminPageRequest; +import com.emotion.dto.request.AdminUpdateRequest; +import com.emotion.dto.response.AdminResponse; +import com.emotion.entity.Admin; + +/** + * 管理员服务接口 + * + * @author huazhongmin + * @date 2025-10-27 + */ +public interface AdminService extends IService { + + /** + * 分页查询管理员 + */ + PageResult getPageWithResponse(AdminPageRequest request); + + /** + * 根据ID获取管理员响应 + */ + AdminResponse getAdminResponseById(String id); + + /** + * 创建管理员并返回响应 + */ + AdminResponse createAdminWithResponse(AdminCreateRequest request); + + /** + * 更新管理员并返回响应 + */ + AdminResponse updateAdminWithResponse(AdminUpdateRequest request); + + /** + * 根据账号查询管理员 + */ + Admin getByAccount(String account); + + /** + * 根据邮箱查询管理员 + */ + Admin getByEmail(String email); + + /** + * 根据手机号查询管理员 + */ + Admin getByPhone(String phone); +} diff --git a/backend-single/src/main/java/com/emotion/service/AiChatService.java b/backend-single/src/main/java/com/emotion/service/AiChatService.java index cbd6315..16adb48 100644 --- a/backend-single/src/main/java/com/emotion/service/AiChatService.java +++ b/backend-single/src/main/java/com/emotion/service/AiChatService.java @@ -8,7 +8,7 @@ import java.util.concurrent.CompletableFuture; /** * AI聊天服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ public interface AiChatService { diff --git a/backend-single/src/main/java/com/emotion/service/AuthService.java b/backend-single/src/main/java/com/emotion/service/AuthService.java index 6be83d5..0d094e7 100644 --- a/backend-single/src/main/java/com/emotion/service/AuthService.java +++ b/backend-single/src/main/java/com/emotion/service/AuthService.java @@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletRequest; /** * 认证服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface AuthService { diff --git a/backend-single/src/main/java/com/emotion/service/CommentService.java b/backend-single/src/main/java/com/emotion/service/CommentService.java index d8aaee3..7e6817e 100644 --- a/backend-single/src/main/java/com/emotion/service/CommentService.java +++ b/backend-single/src/main/java/com/emotion/service/CommentService.java @@ -11,7 +11,7 @@ import com.emotion.entity.Comment; /** * 评论服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface CommentService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/CommunityPostService.java b/backend-single/src/main/java/com/emotion/service/CommunityPostService.java index e16d07d..d5244a5 100644 --- a/backend-single/src/main/java/com/emotion/service/CommunityPostService.java +++ b/backend-single/src/main/java/com/emotion/service/CommunityPostService.java @@ -11,7 +11,7 @@ import com.emotion.entity.CommunityPost; /** * 社区帖子服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface CommunityPostService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/ConversationService.java b/backend-single/src/main/java/com/emotion/service/ConversationService.java index c74abd6..ba77970 100644 --- a/backend-single/src/main/java/com/emotion/service/ConversationService.java +++ b/backend-single/src/main/java/com/emotion/service/ConversationService.java @@ -15,7 +15,7 @@ import java.util.List; /** * 会话服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface ConversationService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/CozeApiCallService.java b/backend-single/src/main/java/com/emotion/service/CozeApiCallService.java index 293d9de..d6aae8f 100644 --- a/backend-single/src/main/java/com/emotion/service/CozeApiCallService.java +++ b/backend-single/src/main/java/com/emotion/service/CozeApiCallService.java @@ -15,7 +15,7 @@ import java.util.List; /** * Coze API调用记录服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface CozeApiCallService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/DiaryCommentService.java b/backend-single/src/main/java/com/emotion/service/DiaryCommentService.java index 6cb9805..ae5a7a6 100644 --- a/backend-single/src/main/java/com/emotion/service/DiaryCommentService.java +++ b/backend-single/src/main/java/com/emotion/service/DiaryCommentService.java @@ -13,7 +13,7 @@ import java.util.List; /** * 日记评论服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface DiaryCommentService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/DiaryPostService.java b/backend-single/src/main/java/com/emotion/service/DiaryPostService.java index 8bc683f..6acdd2a 100644 --- a/backend-single/src/main/java/com/emotion/service/DiaryPostService.java +++ b/backend-single/src/main/java/com/emotion/service/DiaryPostService.java @@ -14,7 +14,7 @@ import java.util.List; /** * 用户日记服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface DiaryPostService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/EmotionAnalysisService.java b/backend-single/src/main/java/com/emotion/service/EmotionAnalysisService.java index 1caf0cf..8d3df5e 100644 --- a/backend-single/src/main/java/com/emotion/service/EmotionAnalysisService.java +++ b/backend-single/src/main/java/com/emotion/service/EmotionAnalysisService.java @@ -16,7 +16,7 @@ import java.util.List; /** * 情绪分析服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface EmotionAnalysisService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/EmotionRecordService.java b/backend-single/src/main/java/com/emotion/service/EmotionRecordService.java index eee9835..881c0fd 100644 --- a/backend-single/src/main/java/com/emotion/service/EmotionRecordService.java +++ b/backend-single/src/main/java/com/emotion/service/EmotionRecordService.java @@ -17,7 +17,7 @@ import java.util.Map; /** * 情绪记录服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface EmotionRecordService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/GrowthTopicService.java b/backend-single/src/main/java/com/emotion/service/GrowthTopicService.java index c4c8f01..3f40ed1 100644 --- a/backend-single/src/main/java/com/emotion/service/GrowthTopicService.java +++ b/backend-single/src/main/java/com/emotion/service/GrowthTopicService.java @@ -15,7 +15,7 @@ import java.util.List; /** * 成长话题服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ public interface GrowthTopicService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/GuestUserService.java b/backend-single/src/main/java/com/emotion/service/GuestUserService.java index bbe9fd4..748e075 100644 --- a/backend-single/src/main/java/com/emotion/service/GuestUserService.java +++ b/backend-single/src/main/java/com/emotion/service/GuestUserService.java @@ -15,7 +15,7 @@ import java.util.List; /** * 访客用户服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ public interface GuestUserService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/MessageService.java b/backend-single/src/main/java/com/emotion/service/MessageService.java index c02d39d..9de970f 100644 --- a/backend-single/src/main/java/com/emotion/service/MessageService.java +++ b/backend-single/src/main/java/com/emotion/service/MessageService.java @@ -17,7 +17,7 @@ import java.util.List; /** * 消息服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ public interface MessageService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/RewardService.java b/backend-single/src/main/java/com/emotion/service/RewardService.java index 59b3052..1563535 100644 --- a/backend-single/src/main/java/com/emotion/service/RewardService.java +++ b/backend-single/src/main/java/com/emotion/service/RewardService.java @@ -15,7 +15,7 @@ import java.util.List; /** * 奖励服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ public interface RewardService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/TokenService.java b/backend-single/src/main/java/com/emotion/service/TokenService.java index c587c05..0ed9421 100644 --- a/backend-single/src/main/java/com/emotion/service/TokenService.java +++ b/backend-single/src/main/java/com/emotion/service/TokenService.java @@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletRequest; /** * 令牌服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface TokenService { diff --git a/backend-single/src/main/java/com/emotion/service/TopicInteractionService.java b/backend-single/src/main/java/com/emotion/service/TopicInteractionService.java index 8f5fa15..e1e500a 100644 --- a/backend-single/src/main/java/com/emotion/service/TopicInteractionService.java +++ b/backend-single/src/main/java/com/emotion/service/TopicInteractionService.java @@ -12,7 +12,7 @@ import com.emotion.entity.TopicInteraction; /** * 话题互动服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface TopicInteractionService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/UserService.java b/backend-single/src/main/java/com/emotion/service/UserService.java index 388b52c..f37264b 100644 --- a/backend-single/src/main/java/com/emotion/service/UserService.java +++ b/backend-single/src/main/java/com/emotion/service/UserService.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; /** * 用户服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface UserService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/UserStatsService.java b/backend-single/src/main/java/com/emotion/service/UserStatsService.java index a949906..95dcfb0 100644 --- a/backend-single/src/main/java/com/emotion/service/UserStatsService.java +++ b/backend-single/src/main/java/com/emotion/service/UserStatsService.java @@ -14,7 +14,7 @@ import java.util.List; /** * 用户统计服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ public interface UserStatsService extends IService { diff --git a/backend-single/src/main/java/com/emotion/service/WebSocketService.java b/backend-single/src/main/java/com/emotion/service/WebSocketService.java index 7e62c12..27b38c5 100644 --- a/backend-single/src/main/java/com/emotion/service/WebSocketService.java +++ b/backend-single/src/main/java/com/emotion/service/WebSocketService.java @@ -8,7 +8,7 @@ import java.security.Principal; /** * WebSocket服务接口 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ public interface WebSocketService { diff --git a/backend-single/src/main/java/com/emotion/service/impl/AchievementServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/AchievementServiceImpl.java index e528885..4591220 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/AchievementServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/AchievementServiceImpl.java @@ -27,7 +27,7 @@ import java.util.stream.Collectors; /** * 成就服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/AdminAuthServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/AdminAuthServiceImpl.java new file mode 100644 index 0000000..13f9bdc --- /dev/null +++ b/backend-single/src/main/java/com/emotion/service/impl/AdminAuthServiceImpl.java @@ -0,0 +1,203 @@ +package com.emotion.service.impl; + +import com.emotion.dto.request.AdminLoginRequest; +import com.emotion.dto.response.AdminAuthResponse; +import com.emotion.dto.response.AdminInfoResponse; +import com.emotion.entity.Admin; +import com.emotion.exception.AuthException; +import com.emotion.service.AdminAuthService; +import com.emotion.service.AdminService; +import com.emotion.util.JwtUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.concurrent.TimeUnit; + +/** + * 管理员认证服务实现类 + * + * @author emotion-museum + * @date 2025-10-27 + */ +@Slf4j +@Service +public class AdminAuthServiceImpl implements AdminAuthService { + + @Autowired + private AdminService adminService; + + @Autowired + private RedisTemplate redisTemplate; + + @Autowired + private JwtUtil jwtUtil; + + private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + + private static final String ADMIN_TOKEN_PREFIX = "admin_token:"; + private static final String ADMIN_REFRESH_TOKEN_PREFIX = "admin_refresh_token:"; + private static final int TOKEN_EXPIRE_HOURS = 24; + private static final int REFRESH_TOKEN_EXPIRE_DAYS = 7; + private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + @Override + public AdminAuthResponse login(AdminLoginRequest request) { + Admin admin = adminService.getByAccount(request.getAccount()); + + if (admin == null) { + throw new AuthException("账号或密码错误"); + } + + if (admin.getStatus() != 1) { + throw new AuthException("账号已被禁用"); + } + + if (!passwordEncoder.matches(request.getPassword(), admin.getPassword())) { + throw new AuthException("账号或密码错误"); + } + + log.info("管理员登录成功: account={}, adminId={}", request.getAccount(), admin.getId()); + + String accessToken = generateAccessToken(admin); + String refreshToken = generateRefreshToken(admin); + + updateLoginInfo(admin); + + AdminAuthResponse response = new AdminAuthResponse(); + response.setAccessToken(accessToken); + response.setRefreshToken(refreshToken); + response.setExpiresIn((long) TOKEN_EXPIRE_HOURS * 3600); + response.setAdminInfo(convertToAdminInfoResponse(admin)); + response.setLoginTime(LocalDateTime.now().format(DATE_TIME_FORMATTER)); + + return response; + } + + @Override + public AdminInfoResponse getCurrentAdminInfo(String adminId) { + Admin admin = adminService.getById(adminId); + if (admin == null) { + throw new AuthException("管理员不存在"); + } + return convertToAdminInfoResponse(admin); + } + + @Override + public boolean logout(HttpServletRequest request) { + String authHeader = request.getHeader("Authorization"); + if (authHeader != null && authHeader.startsWith("Bearer ")) { + String token = authHeader.substring(7); + String adminId = jwtUtil.getUserIdFromToken(token); + + if (adminId != null) { + redisTemplate.delete(ADMIN_TOKEN_PREFIX + adminId); + log.info("管理员登出成功: adminId={}", adminId); + return true; + } + } + return false; + } + + @Override + public AdminAuthResponse refreshToken(String refreshToken) { + if (!jwtUtil.validateToken(refreshToken)) { + throw new AuthException("刷新令牌无效或已过期"); + } + + String adminId = jwtUtil.getUserIdFromToken(refreshToken); + String userType = jwtUtil.getUserTypeFromToken(refreshToken); + + if (!"admin".equals(userType)) { + throw new AuthException("无效的刷新令牌"); + } + + String cachedToken = (String) redisTemplate.opsForValue().get(ADMIN_REFRESH_TOKEN_PREFIX + adminId); + if (cachedToken == null || !cachedToken.equals(refreshToken)) { + throw new AuthException("刷新令牌已失效"); + } + + Admin admin = adminService.getById(adminId); + if (admin == null) { + throw new AuthException("管理员不存在"); + } + + if (admin.getStatus() != 1) { + throw new AuthException("账号已被禁用"); + } + + String newAccessToken = generateAccessToken(admin); + String newRefreshToken = generateRefreshToken(admin); + + AdminAuthResponse response = new AdminAuthResponse(); + response.setAccessToken(newAccessToken); + response.setRefreshToken(newRefreshToken); + response.setExpiresIn((long) TOKEN_EXPIRE_HOURS * 3600); + response.setAdminInfo(convertToAdminInfoResponse(admin)); + response.setLoginTime(LocalDateTime.now().format(DATE_TIME_FORMATTER)); + + return response; + } + + @Override + public boolean validateToken(HttpServletRequest request) { + String authHeader = request.getHeader("Authorization"); + if (authHeader == null || !authHeader.startsWith("Bearer ")) { + return false; + } + + String token = authHeader.substring(7); + if (!jwtUtil.validateToken(token)) { + return false; + } + + String userType = jwtUtil.getUserTypeFromToken(token); + return "admin".equals(userType); + } + + @Override + public String getAdminIdFromToken(String token) { + return jwtUtil.getUserIdFromToken(token); + } + + private String generateAccessToken(Admin admin) { + String token = jwtUtil.generateToken(admin.getId(), admin.getUsername(), "admin"); + redisTemplate.opsForValue().set( + ADMIN_TOKEN_PREFIX + admin.getId(), + token, + TOKEN_EXPIRE_HOURS, + TimeUnit.HOURS + ); + return token; + } + + private String generateRefreshToken(Admin admin) { + String token = jwtUtil.generateRefreshToken(admin.getId(), admin.getUsername(), "admin"); + redisTemplate.opsForValue().set( + ADMIN_REFRESH_TOKEN_PREFIX + admin.getId(), + token, + REFRESH_TOKEN_EXPIRE_DAYS, + TimeUnit.DAYS + ); + return token; + } + + private void updateLoginInfo(Admin admin) { + admin.setLastLoginTime(LocalDateTime.now()); + admin.setLoginCount(admin.getLoginCount() == null ? 1 : admin.getLoginCount() + 1); + adminService.updateById(admin); + } + + private AdminInfoResponse convertToAdminInfoResponse(Admin admin) { + AdminInfoResponse response = new AdminInfoResponse(); + BeanUtils.copyProperties(admin, response); + return response; + } +} diff --git a/backend-single/src/main/java/com/emotion/service/impl/AdminServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/AdminServiceImpl.java new file mode 100644 index 0000000..83bf2de --- /dev/null +++ b/backend-single/src/main/java/com/emotion/service/impl/AdminServiceImpl.java @@ -0,0 +1,257 @@ +package com.emotion.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.emotion.common.PageResult; +import com.emotion.dto.request.AdminCreateRequest; +import com.emotion.dto.request.AdminPageRequest; +import com.emotion.dto.request.AdminUpdateRequest; +import com.emotion.dto.response.AdminResponse; +import com.emotion.entity.Admin; +import com.emotion.exception.BusinessException; +import com.emotion.mapper.AdminMapper; +import com.emotion.service.AdminService; +import org.springframework.beans.BeanUtils; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 管理员服务实现类 + * + * @author huazhongmin + * @date 2025-10-27 + */ +@Service +public class AdminServiceImpl extends ServiceImpl implements AdminService { + + private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + + @Override + public PageResult getPageWithResponse(AdminPageRequest request) { + Page page = new Page<>(request.getCurrent(), request.getSize()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (StringUtils.hasText(request.getKeyword())) { + wrapper.and(w -> w.like(Admin::getAccount, request.getKeyword()) + .or().like(Admin::getUsername, request.getKeyword()) + .or().like(Admin::getEmail, request.getKeyword()) + .or().like(Admin::getPhone, request.getKeyword())); + } + + if (StringUtils.hasText(request.getAccount())) { + wrapper.like(Admin::getAccount, request.getAccount()); + } + + if (StringUtils.hasText(request.getUsername())) { + wrapper.like(Admin::getUsername, request.getUsername()); + } + + if (StringUtils.hasText(request.getEmail())) { + wrapper.like(Admin::getEmail, request.getEmail()); + } + + if (StringUtils.hasText(request.getPhone())) { + wrapper.like(Admin::getPhone, request.getPhone()); + } + + if (StringUtils.hasText(request.getRole())) { + wrapper.eq(Admin::getRole, request.getRole()); + } + + if (request.getStatus() != null) { + wrapper.eq(Admin::getStatus, request.getStatus()); + } + + if (StringUtils.hasText(request.getDepartment())) { + wrapper.like(Admin::getDepartment, request.getDepartment()); + } + + wrapper.eq(Admin::getIsDeleted, 0); + + if (StringUtils.hasText(request.getOrderBy())) { + if ("asc".equalsIgnoreCase(request.getOrderDirection())) { + wrapper.orderByAsc(Admin::getCreateTime); + } else { + wrapper.orderByDesc(Admin::getCreateTime); + } + } else { + wrapper.orderByDesc(Admin::getCreateTime); + } + + IPage adminPage = this.page(page, wrapper); + + List responseList = adminPage.getRecords().stream() + .map(this::convertToResponse) + .collect(Collectors.toList()); + + return PageResult.builder() + .records(responseList) + .total(adminPage.getTotal()) + .current(adminPage.getCurrent()) + .size(adminPage.getSize()) + .pages(adminPage.getPages()) + .build(); + } + + @Override + public AdminResponse getAdminResponseById(String id) { + Admin admin = this.getById(id); + if (admin == null) { + return null; + } + return convertToResponse(admin); + } + + @Override + public AdminResponse createAdminWithResponse(AdminCreateRequest request) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getAccount, request.getAccount()) + .eq(Admin::getIsDeleted, 0); + if (this.count(wrapper) > 0) { + throw new BusinessException("账号已存在"); + } + + if (StringUtils.hasText(request.getEmail())) { + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getEmail, request.getEmail()) + .eq(Admin::getIsDeleted, 0); + if (this.count(wrapper) > 0) { + throw new BusinessException("邮箱已存在"); + } + } + + if (StringUtils.hasText(request.getPhone())) { + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getPhone, request.getPhone()) + .eq(Admin::getIsDeleted, 0); + if (this.count(wrapper) > 0) { + throw new BusinessException("手机号已存在"); + } + } + + Admin admin = new Admin(); + BeanUtils.copyProperties(request, admin); + admin.setPassword(passwordEncoder.encode(request.getPassword())); + admin.setStatus(1); + admin.setLoginCount(0); + + boolean saved = this.save(admin); + if (!saved) { + return null; + } + + return convertToResponse(admin); + } + + @Override + public AdminResponse updateAdminWithResponse(AdminUpdateRequest request) { + Admin admin = this.getById(request.getId()); + if (admin == null) { + throw new BusinessException("管理员不存在"); + } + + if (StringUtils.hasText(request.getEmail()) && !request.getEmail().equals(admin.getEmail())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getEmail, request.getEmail()) + .ne(Admin::getId, request.getId()) + .eq(Admin::getIsDeleted, 0); + if (this.count(wrapper) > 0) { + throw new BusinessException("邮箱已存在"); + } + } + + if (StringUtils.hasText(request.getPhone()) && !request.getPhone().equals(admin.getPhone())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getPhone, request.getPhone()) + .ne(Admin::getId, request.getId()) + .eq(Admin::getIsDeleted, 0); + if (this.count(wrapper) > 0) { + throw new BusinessException("手机号已存在"); + } + } + + if (StringUtils.hasText(request.getUsername())) { + admin.setUsername(request.getUsername()); + } + if (StringUtils.hasText(request.getEmail())) { + admin.setEmail(request.getEmail()); + } + if (StringUtils.hasText(request.getPhone())) { + admin.setPhone(request.getPhone()); + } + if (StringUtils.hasText(request.getAvatar())) { + admin.setAvatar(request.getAvatar()); + } + if (StringUtils.hasText(request.getRole())) { + admin.setRole(request.getRole()); + } + if (request.getPermissions() != null) { + admin.setPermissions(request.getPermissions()); + } + if (request.getStatus() != null) { + admin.setStatus(request.getStatus()); + } + if (StringUtils.hasText(request.getDepartment())) { + admin.setDepartment(request.getDepartment()); + } + if (StringUtils.hasText(request.getPosition())) { + admin.setPosition(request.getPosition()); + } + + boolean updated = this.updateById(admin); + if (!updated) { + return null; + } + + return convertToResponse(admin); + } + + @Override + public Admin getByAccount(String account) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getAccount, account) + .eq(Admin::getIsDeleted, 0); + return this.getOne(wrapper); + } + + @Override + public Admin getByEmail(String email) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getEmail, email) + .eq(Admin::getIsDeleted, 0); + return this.getOne(wrapper); + } + + @Override + public Admin getByPhone(String phone) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Admin::getPhone, phone) + .eq(Admin::getIsDeleted, 0); + return this.getOne(wrapper); + } + + private AdminResponse convertToResponse(Admin admin) { + AdminResponse response = new AdminResponse(); + BeanUtils.copyProperties(admin, response); + + if (admin.getLastLoginTime() != null) { + response.setLastLoginTime(admin.getLastLoginTime().format(DATE_TIME_FORMATTER)); + } + if (admin.getCreateTime() != null) { + response.setCreateTime(admin.getCreateTime().format(DATE_TIME_FORMATTER)); + } + if (admin.getUpdateTime() != null) { + response.setUpdateTime(admin.getUpdateTime().format(DATE_TIME_FORMATTER)); + } + + return response; + } +} diff --git a/backend-single/src/main/java/com/emotion/service/impl/AiChatServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/AiChatServiceImpl.java index 69e485f..f824897 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/AiChatServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/AiChatServiceImpl.java @@ -45,7 +45,7 @@ import java.util.Arrays; /** * AI聊天服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/service/impl/AuthServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/AuthServiceImpl.java index 2e70b06..4a1641c 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/AuthServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/AuthServiceImpl.java @@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit; /** * 认证服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/service/impl/CommentServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/CommentServiceImpl.java index 6bd1f93..d776618 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/CommentServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/CommentServiceImpl.java @@ -26,7 +26,7 @@ import java.util.stream.Collectors; /** * 评论服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/CommunityPostServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/CommunityPostServiceImpl.java index 6f32ded..1795e43 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/CommunityPostServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/CommunityPostServiceImpl.java @@ -25,7 +25,7 @@ import java.util.stream.Collectors; /** * 社区帖子服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/ConversationServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/ConversationServiceImpl.java index 54c7b01..0b3193e 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/ConversationServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/ConversationServiceImpl.java @@ -27,7 +27,7 @@ import java.util.stream.Collectors; /** * 会话服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/CozeApiCallServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/CozeApiCallServiceImpl.java index 96bf003..bbbc0d9 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/CozeApiCallServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/CozeApiCallServiceImpl.java @@ -26,7 +26,7 @@ import java.util.stream.Collectors; /** * Coze API调用记录服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/DiaryCommentServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/DiaryCommentServiceImpl.java index 635adf6..7215fff 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/DiaryCommentServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/DiaryCommentServiceImpl.java @@ -29,7 +29,7 @@ import java.util.stream.Collectors; /** * 日记评论服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/DiaryPostServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/DiaryPostServiceImpl.java index 4a91c58..1b055b9 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/DiaryPostServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/DiaryPostServiceImpl.java @@ -33,7 +33,7 @@ import java.util.stream.Collectors; /** * 用户日记服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/EmotionAnalysisServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/EmotionAnalysisServiceImpl.java index cde1fc3..8547d6f 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/EmotionAnalysisServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/EmotionAnalysisServiceImpl.java @@ -28,7 +28,7 @@ import java.util.stream.Collectors; /** * 情绪分析服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/EmotionRecordServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/EmotionRecordServiceImpl.java index a0f4c92..1c75ef9 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/EmotionRecordServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/EmotionRecordServiceImpl.java @@ -32,7 +32,7 @@ import java.util.stream.Collectors; /** * 情绪记录服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/GrowthTopicServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/GrowthTopicServiceImpl.java index 3db2e85..d0fee1b 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/GrowthTopicServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/GrowthTopicServiceImpl.java @@ -25,7 +25,7 @@ import java.util.stream.Collectors; /** * 成长话题服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/GuestUserServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/GuestUserServiceImpl.java index 78657bb..9e373fd 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/GuestUserServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/GuestUserServiceImpl.java @@ -24,7 +24,7 @@ import java.util.stream.Collectors; /** * 访客用户服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/MessageServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/MessageServiceImpl.java index 136907e..20cda27 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/MessageServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/MessageServiceImpl.java @@ -28,7 +28,7 @@ import java.util.stream.Collectors; /** * 消息服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/service/impl/RewardServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/RewardServiceImpl.java index 7263c0d..ff00c78 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/RewardServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/RewardServiceImpl.java @@ -25,7 +25,7 @@ import java.util.stream.Collectors; /** * 奖励服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/TokenServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/TokenServiceImpl.java index caa6f63..f5b809d 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/TokenServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/TokenServiceImpl.java @@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletRequest; /** * 令牌服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/TopicInteractionServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/TopicInteractionServiceImpl.java index 293fb12..eb5888b 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/TopicInteractionServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/TopicInteractionServiceImpl.java @@ -20,7 +20,7 @@ import java.time.format.DateTimeFormatter; /** * 话题互动服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/UserServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/UserServiceImpl.java index 3d03b1c..12ca0e5 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/UserServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/UserServiceImpl.java @@ -26,7 +26,7 @@ import java.util.stream.Collectors; /** * 用户服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/UserStatsServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/UserStatsServiceImpl.java index a7a6e17..06019da 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/UserStatsServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/UserStatsServiceImpl.java @@ -26,7 +26,7 @@ import java.util.stream.Collectors; /** * 用户统计服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-24 */ @Service diff --git a/backend-single/src/main/java/com/emotion/service/impl/WebSocketServiceImpl.java b/backend-single/src/main/java/com/emotion/service/impl/WebSocketServiceImpl.java index ca1baf9..d83f717 100644 --- a/backend-single/src/main/java/com/emotion/service/impl/WebSocketServiceImpl.java +++ b/backend-single/src/main/java/com/emotion/service/impl/WebSocketServiceImpl.java @@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap; /** * WebSocket服务实现类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-25 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/util/JwtUtil.java b/backend-single/src/main/java/com/emotion/util/JwtUtil.java index d1514fe..3038f10 100644 --- a/backend-single/src/main/java/com/emotion/util/JwtUtil.java +++ b/backend-single/src/main/java/com/emotion/util/JwtUtil.java @@ -13,7 +13,7 @@ import java.util.Date; /** * JWT工具类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Component @@ -54,7 +54,19 @@ public class JwtUtil { * @return Token */ public String generateToken(String userId, String username) { - return generateToken(userId, username, expiration); + return generateToken(userId, username, "user", expiration); + } + + /** + * 生成Token(带用户类型) + * + * @param userId 用户ID + * @param username 用户名 + * @param userType 用户类型(user/admin) + * @return Token + */ + public String generateToken(String userId, String username, String userType) { + return generateToken(userId, username, userType, expiration); } /** @@ -65,7 +77,19 @@ public class JwtUtil { * @return 刷新Token */ public String generateRefreshToken(String userId, String username) { - return generateToken(userId, username, refreshExpiration); + return generateToken(userId, username, "user", refreshExpiration); + } + + /** + * 生成刷新Token(带用户类型) + * + * @param userId 用户ID + * @param username 用户名 + * @param userType 用户类型(user/admin) + * @return 刷新Token + */ + public String generateRefreshToken(String userId, String username, String userType) { + return generateToken(userId, username, userType, refreshExpiration); } /** @@ -73,16 +97,18 @@ public class JwtUtil { * * @param userId 用户ID * @param username 用户名 + * @param userType 用户类型(user/admin) * @param expiration 过期时间(毫秒) * @return Token */ - private String generateToken(String userId, String username, Long expiration) { + private String generateToken(String userId, String username, String userType, Long expiration) { Date now = new Date(); Date expiryDate = new Date(now.getTime() + expiration); return Jwts.builder() .setSubject(userId) .claim("username", username) + .claim("userType", userType) .setIssuedAt(now) .setExpiration(expiryDate) .signWith(getSecretKey(), SignatureAlgorithm.HS512) @@ -111,6 +137,17 @@ public class JwtUtil { return claims != null ? claims.get("username", String.class) : null; } + /** + * 从Token中获取用户类型 + * + * @param token Token + * @return 用户类型(user/admin) + */ + public String getUserTypeFromToken(String token) { + Claims claims = getClaimsFromToken(token); + return claims != null ? claims.get("userType", String.class) : "user"; + } + /** * 从Token中获取过期时间 * diff --git a/backend-single/src/main/java/com/emotion/util/SnowflakeIdGenerator.java b/backend-single/src/main/java/com/emotion/util/SnowflakeIdGenerator.java index 6887bc6..709911d 100644 --- a/backend-single/src/main/java/com/emotion/util/SnowflakeIdGenerator.java +++ b/backend-single/src/main/java/com/emotion/util/SnowflakeIdGenerator.java @@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j; * 雪花算法结构: * 1位符号位(固定为0) + 41位时间戳 + 10位机器ID + 12位序列号 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/util/TokenUtil.java b/backend-single/src/main/java/com/emotion/util/TokenUtil.java index 62efd20..5bb8673 100644 --- a/backend-single/src/main/java/com/emotion/util/TokenUtil.java +++ b/backend-single/src/main/java/com/emotion/util/TokenUtil.java @@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest; /** * 令牌工具类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-09-08 */ @Component diff --git a/backend-single/src/main/java/com/emotion/util/UserContextHolder.java b/backend-single/src/main/java/com/emotion/util/UserContextHolder.java index 0286b7b..4a352d7 100644 --- a/backend-single/src/main/java/com/emotion/util/UserContextHolder.java +++ b/backend-single/src/main/java/com/emotion/util/UserContextHolder.java @@ -6,7 +6,7 @@ import lombok.extern.slf4j.Slf4j; * 用户上下文持有者 * 用于在当前线程中存储用户信息 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-23 */ @Slf4j diff --git a/backend-single/src/main/java/com/emotion/util/UserContextUtils.java b/backend-single/src/main/java/com/emotion/util/UserContextUtils.java index 821c6a7..448178f 100644 --- a/backend-single/src/main/java/com/emotion/util/UserContextUtils.java +++ b/backend-single/src/main/java/com/emotion/util/UserContextUtils.java @@ -10,7 +10,7 @@ import javax.servlet.http.HttpServletRequest; * 用户上下文工具类 * 提供便捷的方法操作用户上下文信息 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-25 */ @Slf4j diff --git a/backend-single/src/test/java/com/emotion/controller/AuthControllerTest.java b/backend-single/src/test/java/com/emotion/controller/AuthControllerTest.java index b5c4175..202bee1 100644 --- a/backend-single/src/test/java/com/emotion/controller/AuthControllerTest.java +++ b/backend-single/src/test/java/com/emotion/controller/AuthControllerTest.java @@ -14,7 +14,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * AuthController 测试类 * - * @author emotion-museum + * @author huazhongmin * @date 2025-07-26 */ @WebMvcTest(AuthController.class) diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/AiApplication.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/AiApplication.java index 35adeb2..bd85459 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/AiApplication.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/AiApplication.java @@ -9,7 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients; /** * AI对话服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication(scanBasePackages = {"com.emotionmuseum"}) diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/AiConfig.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/AiConfig.java index 1078536..760de57 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/AiConfig.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/AiConfig.java @@ -9,7 +9,7 @@ import org.springframework.web.reactive.function.client.WebClient; * AI配置类 * 配置Coze平台HTTP客户端 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Configuration diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/FeatureConfig.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/FeatureConfig.java index bec1a14..4672187 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/FeatureConfig.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/config/FeatureConfig.java @@ -7,7 +7,7 @@ import org.springframework.stereotype.Component; /** * 功能开关配置 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/AiChatController.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/AiChatController.java index 5b8fc12..03207a8 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/AiChatController.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/AiChatController.java @@ -25,7 +25,7 @@ import java.util.List; /** * AI聊天控制器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/GuestChatController.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/GuestChatController.java index f767409..a50f4d1 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/GuestChatController.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/controller/GuestChatController.java @@ -25,7 +25,7 @@ import java.util.List; * 访客聊天控制器 * 提供访客模式下的聊天功能 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Slf4j diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatRequest.java index 488456c..3c7fda8 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatRequest.java @@ -10,7 +10,7 @@ import java.util.List; /** * 聊天请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatResponse.java index a340a90..738e5d9 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ChatResponse.java @@ -11,7 +11,7 @@ import java.util.Map; /** * 聊天响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ConversationListResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ConversationListResponse.java index 8447868..57f9f0e 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ConversationListResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/ConversationListResponse.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; /** * 会话列表响应DTO * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationRequest.java index 4ccf9ac..f68e965 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationRequest.java @@ -8,7 +8,7 @@ import jakarta.validation.constraints.NotBlank; /** * 创建会话请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationResponse.java index c3d8c14..04464fc 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/CreateConversationResponse.java @@ -10,7 +10,7 @@ import java.util.Map; /** * 创建会话响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisRequest.java index 53250b1..42b8d72 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisRequest.java @@ -9,7 +9,7 @@ import jakarta.validation.constraints.Size; /** * 情绪分析请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisResponse.java index c0feaaf..64b78b3 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/EmotionAnalysisResponse.java @@ -11,7 +11,7 @@ import java.util.Map; /** * 情绪分析响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatRequest.java index f5da0fd..03f93f7 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatRequest.java @@ -5,7 +5,7 @@ import lombok.Data; /** * 访客聊天请求DTO * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatResponse.java index 16c24b7..f092118 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestChatResponse.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; /** * 访客聊天响应DTO * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestUserInfo.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestUserInfo.java index 26ef201..141da35 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestUserInfo.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/GuestUserInfo.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; /** * 访客用户信息DTO * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/MessageListResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/MessageListResponse.java index 628fba9..f3ad021 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/MessageListResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/dto/MessageListResponse.java @@ -11,7 +11,7 @@ import java.time.LocalDateTime; /** * 消息列表响应DTO * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Conversation.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Conversation.java index 567f6c8..6219124 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Conversation.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Conversation.java @@ -16,7 +16,7 @@ import java.util.List; /** * 对话实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/CozeApiCall.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/CozeApiCall.java index 77eecae..7f13157 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/CozeApiCall.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/CozeApiCall.java @@ -15,7 +15,7 @@ import java.util.Map; /** * Coze API调用记录实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/EmotionAnalysis.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/EmotionAnalysis.java index a5b72cc..4c68289 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/EmotionAnalysis.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/EmotionAnalysis.java @@ -16,7 +16,7 @@ import java.util.Map; /** * 情绪分析实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/GuestUser.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/GuestUser.java index c120f2a..809a271 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/GuestUser.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/GuestUser.java @@ -12,7 +12,7 @@ import java.time.LocalDateTime; /** * 访客用户实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Message.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Message.java index c62916c..5b68820 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Message.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/entity/Message.java @@ -15,7 +15,7 @@ import java.util.Map; /** * 消息实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/ConversationMapper.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/ConversationMapper.java index 5525451..2d147b2 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/ConversationMapper.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/ConversationMapper.java @@ -13,7 +13,7 @@ import java.util.List; /** * 对话Mapper * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Mapper diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/CozeApiCallMapper.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/CozeApiCallMapper.java index 694b008..ba9cd27 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/CozeApiCallMapper.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/CozeApiCallMapper.java @@ -11,7 +11,7 @@ import java.time.LocalDateTime; /** * Coze API调用记录 Mapper 接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Mapper diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/GuestUserMapper.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/GuestUserMapper.java index 38fba14..77df88d 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/GuestUserMapper.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/GuestUserMapper.java @@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Update; /** * 访客用户Mapper * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Mapper diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/MessageMapper.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/MessageMapper.java index 9f3e6b9..c8905eb 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/MessageMapper.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/mapper/MessageMapper.java @@ -12,7 +12,7 @@ import java.util.List; /** * 消息Mapper * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Mapper diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/AiChatRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/AiChatRequest.java index 8dbd58d..fc510de 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/AiChatRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/AiChatRequest.java @@ -12,7 +12,7 @@ import java.util.List; /** * AI聊天请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/ConversationListRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/ConversationListRequest.java index 043cf82..d26cdec 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/ConversationListRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/ConversationListRequest.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; /** * 会话列表请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/CreateConversationRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/CreateConversationRequest.java index ed6feeb..f8d243f 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/CreateConversationRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/CreateConversationRequest.java @@ -10,7 +10,7 @@ import jakarta.validation.constraints.NotBlank; /** * 创建会话请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/EmotionAnalysisRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/EmotionAnalysisRequest.java index e695571..eade087 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/EmotionAnalysisRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/EmotionAnalysisRequest.java @@ -11,7 +11,7 @@ import jakarta.validation.constraints.Size; /** * 情绪分析请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/GuestChatRequest.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/GuestChatRequest.java index 658cab1..3b02d03 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/GuestChatRequest.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/request/GuestChatRequest.java @@ -11,7 +11,7 @@ import jakarta.validation.constraints.Size; /** * 访客聊天请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/AiChatResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/AiChatResponse.java index f9a2575..451b6dd 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/AiChatResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/AiChatResponse.java @@ -13,7 +13,7 @@ import java.util.Map; /** * AI聊天响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/ConversationListResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/ConversationListResponse.java index 7ae6926..3222640 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/ConversationListResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/ConversationListResponse.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 会话列表响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/CreateConversationResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/CreateConversationResponse.java index 535a0a2..42920d0 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/CreateConversationResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/CreateConversationResponse.java @@ -12,7 +12,7 @@ import java.util.Map; /** * 创建会话响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/EmotionAnalysisResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/EmotionAnalysisResponse.java index df3e209..705eec2 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/EmotionAnalysisResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/EmotionAnalysisResponse.java @@ -13,7 +13,7 @@ import java.util.Map; /** * 情绪分析响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/GuestChatResponse.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/GuestChatResponse.java index 614dc3c..f4c1b3f 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/GuestChatResponse.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/response/GuestChatResponse.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 访客聊天响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/AiChatService.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/AiChatService.java index a6bb9e4..bd16d1b 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/AiChatService.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/AiChatService.java @@ -8,7 +8,7 @@ import java.util.List; /** * AI聊天服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ public interface AiChatService { diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/ConversationDbService.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/ConversationDbService.java index 15b91fb..f7b4c23 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/ConversationDbService.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/ConversationDbService.java @@ -10,7 +10,7 @@ import java.util.List; /** * 会话数据库服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ public interface ConversationDbService { diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestChatService.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestChatService.java index 61f2da0..6974b8a 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestChatService.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestChatService.java @@ -8,7 +8,7 @@ import java.util.List; /** * 访客聊天服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ public interface GuestChatService { diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestUserService.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestUserService.java index c9a2e50..4ae369d 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestUserService.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/GuestUserService.java @@ -5,7 +5,7 @@ import com.emotionmuseum.ai.dto.GuestUserInfo; /** * 访客用户服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ public interface GuestUserService { diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/AiChatServiceImpl.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/AiChatServiceImpl.java index 008cc40..89e6717 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/AiChatServiceImpl.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/AiChatServiceImpl.java @@ -20,7 +20,7 @@ import java.util.*; /** * AI聊天服务实现类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/ConversationDbServiceImpl.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/ConversationDbServiceImpl.java index be570bf..aa84254 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/ConversationDbServiceImpl.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/ConversationDbServiceImpl.java @@ -27,7 +27,7 @@ import java.util.List; /** * 会话数据库服务实现类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestChatServiceImpl.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestChatServiceImpl.java index 857f5f1..22dd647 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestChatServiceImpl.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestChatServiceImpl.java @@ -22,7 +22,7 @@ import java.util.stream.Collectors; /** * 访客聊天服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Slf4j diff --git a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestUserServiceImpl.java b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestUserServiceImpl.java index 1c983be..b58a7f9 100644 --- a/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestUserServiceImpl.java +++ b/backend/ai/server/src/main/java/com/emotionmuseum/ai/service/impl/GuestUserServiceImpl.java @@ -17,7 +17,7 @@ import java.util.Random; /** * 访客用户服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/AuthApplication.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/AuthApplication.java index 49c262d..dd8b87c 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/AuthApplication.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/AuthApplication.java @@ -8,7 +8,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * 认证服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ @SpringBootApplication(scanBasePackages = {"com.emotionmuseum"}) diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/CaptchaConfig.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/CaptchaConfig.java index 2d40b34..652bc1c 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/CaptchaConfig.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/CaptchaConfig.java @@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration; /** * 验证码配置 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/OAuthConfig.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/OAuthConfig.java index 7050ccb..b0ab821 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/OAuthConfig.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/OAuthConfig.java @@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration; /** * 第三方登录配置 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/RedisConfig.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/RedisConfig.java index 3224744..47c7dff 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/RedisConfig.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/RedisConfig.java @@ -10,7 +10,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; /** * Redis配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/SecurityConfig.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/SecurityConfig.java index 09ac311..868c1c8 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/SecurityConfig.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/config/SecurityConfig.java @@ -28,7 +28,7 @@ import java.util.Collections; /** * Spring Security配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/AuthController.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/AuthController.java index f2dee05..79413a5 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/AuthController.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/AuthController.java @@ -21,7 +21,7 @@ import jakarta.validation.Valid; /** * 认证控制器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/CaptchaController.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/CaptchaController.java index 2a8de91..d868402 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/CaptchaController.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/CaptchaController.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*; /** * 验证码控制器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/OAuthController.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/OAuthController.java index bd17338..c733632 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/OAuthController.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/controller/OAuthController.java @@ -16,7 +16,7 @@ import jakarta.validation.Valid; /** * 第三方登录控制器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/CaptchaResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/CaptchaResponse.java index ff05456..4f6b6b6 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/CaptchaResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/CaptchaResponse.java @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; /** * 验证码响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/LoginRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/LoginRequest.java index 2df273f..7a3b2b4 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/LoginRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/LoginRequest.java @@ -8,7 +8,7 @@ import jakarta.validation.constraints.NotBlank; /** * 用户登录请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/OAuthLoginRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/OAuthLoginRequest.java index fba1942..7b790d6 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/OAuthLoginRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/OAuthLoginRequest.java @@ -8,7 +8,7 @@ import jakarta.validation.constraints.NotBlank; /** * 第三方登录请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/RegisterRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/RegisterRequest.java index 36d6667..c4e3ce1 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/RegisterRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/RegisterRequest.java @@ -9,7 +9,7 @@ import java.time.LocalDate; /** * 用户注册请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaResponse.java index 1acdb57..b0bdc5c 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaResponse.java @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; /** * 滑块验证码响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaVerifyRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaVerifyRequest.java index 9968e3b..8d20a4f 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaVerifyRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/dto/SliderCaptchaVerifyRequest.java @@ -9,7 +9,7 @@ import jakarta.validation.constraints.NotNull; /** * 滑块验证码验证请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/entity/User.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/entity/User.java index 5190114..c5b1bfe 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/entity/User.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/entity/User.java @@ -15,7 +15,7 @@ import java.time.LocalDateTime; /** * 用户实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/mapper/UserMapper.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/mapper/UserMapper.java index d904399..dcca70a 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/mapper/UserMapper.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/mapper/UserMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param; /** * 用户Mapper接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ @Mapper diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/LoginRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/LoginRequest.java index 049c03d..5ca47ab 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/LoginRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/LoginRequest.java @@ -10,7 +10,7 @@ import jakarta.validation.constraints.NotBlank; /** * 用户登录请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/OAuthLoginRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/OAuthLoginRequest.java index 1a92528..d6f188c 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/OAuthLoginRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/OAuthLoginRequest.java @@ -10,7 +10,7 @@ import jakarta.validation.constraints.NotBlank; /** * 第三方登录请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/RegisterRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/RegisterRequest.java index ec47b8d..8df6f24 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/RegisterRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/RegisterRequest.java @@ -11,7 +11,7 @@ import java.time.LocalDate; /** * 用户注册请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/ResetPasswordRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/ResetPasswordRequest.java index 0c09ee0..3caf4de 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/ResetPasswordRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/ResetPasswordRequest.java @@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode; * *

用于未登录情况下通过手机号与验证码(本期固定为 123456)设置新密码。

* - * @author emotion-museum + * @author huazhongmin * @since 2025-10-26 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/SliderCaptchaVerifyRequest.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/SliderCaptchaVerifyRequest.java index 3db60e6..158e41c 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/SliderCaptchaVerifyRequest.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/request/SliderCaptchaVerifyRequest.java @@ -11,7 +11,7 @@ import jakarta.validation.constraints.NotNull; /** * 滑块验证码验证请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/CaptchaResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/CaptchaResponse.java index f566d46..0f0c984 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/CaptchaResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/CaptchaResponse.java @@ -10,7 +10,7 @@ import lombok.NoArgsConstructor; /** * 验证码响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/LoginResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/LoginResponse.java index 776418d..4cdd0b0 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/LoginResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/LoginResponse.java @@ -11,7 +11,7 @@ import java.time.LocalDateTime; /** * 登录响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/ResetPasswordResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/ResetPasswordResponse.java index 19c7686..5e64ae5 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/ResetPasswordResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/ResetPasswordResponse.java @@ -8,7 +8,7 @@ import lombok.Data; * *

不返回敏感信息,仅提供结果标识与提示。

* - * @author emotion-museum + * @author huazhongmin * @since 2025-10-26 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/SliderCaptchaResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/SliderCaptchaResponse.java index f300a19..2ab4b6c 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/SliderCaptchaResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/SliderCaptchaResponse.java @@ -10,7 +10,7 @@ import lombok.NoArgsConstructor; /** * 滑块验证码响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/UserInfoResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/UserInfoResponse.java index cc714ed..8aa63f3 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/UserInfoResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/response/UserInfoResponse.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 用户信息响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/JwtAuthenticationFilter.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/JwtAuthenticationFilter.java index e096f37..3cb8793 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/JwtAuthenticationFilter.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/JwtAuthenticationFilter.java @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit; /** * JWT认证过滤器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/UserDetailsServiceImpl.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/UserDetailsServiceImpl.java index e3e8e36..ca9cca9 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/UserDetailsServiceImpl.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/security/UserDetailsServiceImpl.java @@ -17,7 +17,7 @@ import java.util.Collections; /** * Spring Security用户详情服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/AuthService.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/AuthService.java index 9c0158c..b440504 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/AuthService.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/AuthService.java @@ -14,7 +14,7 @@ import com.emotionmuseum.auth.response.UserInfoResponse; * 注意:所有新增接口需遵循项目接口规范与异常处理规范。 *

* - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ public interface AuthService { diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/CaptchaService.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/CaptchaService.java index 2a12407..993547e 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/CaptchaService.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/CaptchaService.java @@ -5,7 +5,7 @@ import com.emotionmuseum.auth.response.CaptchaResponse; /** * 验证码服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ public interface CaptchaService { diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/OAuthService.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/OAuthService.java index 7de2157..332e6a1 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/OAuthService.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/OAuthService.java @@ -6,7 +6,7 @@ import com.emotionmuseum.auth.vo.LoginResponse; /** * 第三方登录服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ public interface OAuthService { diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/SliderCaptchaService.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/SliderCaptchaService.java index ccf9498..02c1c54 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/SliderCaptchaService.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/SliderCaptchaService.java @@ -6,7 +6,7 @@ import com.emotionmuseum.auth.request.SliderCaptchaVerifyRequest; /** * 滑块验证码服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ public interface SliderCaptchaService { diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/AuthServiceImpl.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/AuthServiceImpl.java index dd2bacf..d0a2dca 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/AuthServiceImpl.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/AuthServiceImpl.java @@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit; /** * 认证服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/CaptchaServiceImpl.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/CaptchaServiceImpl.java index 3fe9ddd..33a4c67 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/CaptchaServiceImpl.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/CaptchaServiceImpl.java @@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit; /** * 验证码服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/OAuthServiceImpl.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/OAuthServiceImpl.java index 42e7a87..f99a6e0 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/OAuthServiceImpl.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/OAuthServiceImpl.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Service; /** * 第三方登录服务实现类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/SliderCaptchaServiceImpl.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/SliderCaptchaServiceImpl.java index 428cd50..f634c99 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/SliderCaptchaServiceImpl.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/service/impl/SliderCaptchaServiceImpl.java @@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit; /** * 滑块验证码服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/LoginResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/LoginResponse.java index 6d064e1..6258e52 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/LoginResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/LoginResponse.java @@ -9,7 +9,7 @@ import java.time.LocalDateTime; /** * 登录响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/UserInfoResponse.java b/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/UserInfoResponse.java index 27e0570..b73aa51 100644 --- a/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/UserInfoResponse.java +++ b/backend/auth/server/src/main/java/com/emotionmuseum/auth/vo/UserInfoResponse.java @@ -11,7 +11,7 @@ import java.time.LocalDateTime; /** * 用户信息响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-16 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/config/MybatisPlusConfig.java b/backend/common/src/main/java/com/emotionmuseum/common/config/MybatisPlusConfig.java index 420bf9c..9eae747 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/config/MybatisPlusConfig.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/config/MybatisPlusConfig.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; /** * MyBatis-Plus 配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Configuration diff --git a/backend/common/src/main/java/com/emotionmuseum/common/config/RestTemplateConfig.java b/backend/common/src/main/java/com/emotionmuseum/common/config/RestTemplateConfig.java index e5a4a37..ce0f4d0 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/config/RestTemplateConfig.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/config/RestTemplateConfig.java @@ -15,7 +15,7 @@ import java.util.Collections; /** * RestTemplate配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/config/SnowflakeConfig.java b/backend/common/src/main/java/com/emotionmuseum/common/config/SnowflakeConfig.java index 204b4c6..06fa35d 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/config/SnowflakeConfig.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/config/SnowflakeConfig.java @@ -13,7 +13,7 @@ import java.util.Enumeration; /** * 雪花算法配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/config/WebMvcConfig.java b/backend/common/src/main/java/com/emotionmuseum/common/config/WebMvcConfig.java index 222e545..1dfa62a 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/config/WebMvcConfig.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/config/WebMvcConfig.java @@ -10,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; * Web MVC 配置类 * 注册拦截器和其他Web相关配置 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Configuration diff --git a/backend/common/src/main/java/com/emotionmuseum/common/dto/PageQuery.java b/backend/common/src/main/java/com/emotionmuseum/common/dto/PageQuery.java index 6d3f26d..70bc668 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/dto/PageQuery.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/dto/PageQuery.java @@ -10,7 +10,7 @@ import jakarta.validation.constraints.NotNull; /** * 分页查询基类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/entity/BaseEntity.java b/backend/common/src/main/java/com/emotionmuseum/common/entity/BaseEntity.java index eec827d..03fa2da 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/entity/BaseEntity.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/entity/BaseEntity.java @@ -12,7 +12,7 @@ import java.time.LocalDateTime; * 包含所有表的公共字段:create_by, create_time, update_by, update_time, is_deleted, * remarks * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/exception/AuthException.java b/backend/common/src/main/java/com/emotionmuseum/common/exception/AuthException.java index cb31cf3..ab16a1c 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/exception/AuthException.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/exception/AuthException.java @@ -6,7 +6,7 @@ import lombok.Getter; /** * 认证异常 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Getter diff --git a/backend/common/src/main/java/com/emotionmuseum/common/exception/BusinessException.java b/backend/common/src/main/java/com/emotionmuseum/common/exception/BusinessException.java index a3a8293..1b18a8d 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/exception/BusinessException.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/exception/BusinessException.java @@ -6,7 +6,7 @@ import lombok.Getter; /** * 业务异常 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Getter diff --git a/backend/common/src/main/java/com/emotionmuseum/common/exception/CaptchaException.java b/backend/common/src/main/java/com/emotionmuseum/common/exception/CaptchaException.java index 4668a40..30770ae 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/exception/CaptchaException.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/exception/CaptchaException.java @@ -6,7 +6,7 @@ import lombok.Getter; /** * 验证码异常 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Getter diff --git a/backend/common/src/main/java/com/emotionmuseum/common/exception/GlobalExceptionHandler.java b/backend/common/src/main/java/com/emotionmuseum/common/exception/GlobalExceptionHandler.java index 0cee536..69ba2ed 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/exception/GlobalExceptionHandler.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/exception/GlobalExceptionHandler.java @@ -19,7 +19,7 @@ import java.util.Set; /** * 全局异常处理器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/exception/TokenException.java b/backend/common/src/main/java/com/emotionmuseum/common/exception/TokenException.java index 979f051..3602016 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/exception/TokenException.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/exception/TokenException.java @@ -6,7 +6,7 @@ import lombok.Getter; /** * Token异常 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Getter diff --git a/backend/common/src/main/java/com/emotionmuseum/common/handler/EmotionMetaObjectHandler.java b/backend/common/src/main/java/com/emotionmuseum/common/handler/EmotionMetaObjectHandler.java index c6f0574..41be9d9 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/handler/EmotionMetaObjectHandler.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/handler/EmotionMetaObjectHandler.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; * 自动填充公共字段:id, create_by, create_time, update_by, update_time * 支持雪花算法自动生成主键ID * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/interceptor/UserContextInterceptor.java b/backend/common/src/main/java/com/emotionmuseum/common/interceptor/UserContextInterceptor.java index 28fea7a..e4d810a 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/interceptor/UserContextInterceptor.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/interceptor/UserContextInterceptor.java @@ -13,7 +13,7 @@ import jakarta.servlet.http.HttpServletResponse; * 用户上下文拦截器 * 自动从请求头中提取用户信息并设置到ThreadLocal中 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/request/BasePageRequest.java b/backend/common/src/main/java/com/emotionmuseum/common/request/BasePageRequest.java index 68cda04..f9f8392 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/request/BasePageRequest.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/request/BasePageRequest.java @@ -10,7 +10,7 @@ import jakarta.validation.constraints.Min; /** * 基础分页请求类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/request/BaseRequest.java b/backend/common/src/main/java/com/emotionmuseum/common/request/BaseRequest.java index e6f8b42..51a80f7 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/request/BaseRequest.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/request/BaseRequest.java @@ -9,7 +9,7 @@ import java.io.Serializable; /** * 基础请求类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/response/BasePageResponse.java b/backend/common/src/main/java/com/emotionmuseum/common/response/BasePageResponse.java index 3ec6d04..3081d82 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/response/BasePageResponse.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/response/BasePageResponse.java @@ -10,7 +10,7 @@ import java.util.List; /** * 基础分页响应类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/response/BaseResponse.java b/backend/common/src/main/java/com/emotionmuseum/common/response/BaseResponse.java index 89a2a25..002d14c 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/response/BaseResponse.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/response/BaseResponse.java @@ -9,7 +9,7 @@ import java.io.Serializable; /** * 基础响应类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/result/Result.java b/backend/common/src/main/java/com/emotionmuseum/common/result/Result.java index 894126c..38d78e5 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/result/Result.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/result/Result.java @@ -8,7 +8,7 @@ import java.io.Serializable; /** * 统一响应结果 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/common/src/main/java/com/emotionmuseum/common/result/ResultCode.java b/backend/common/src/main/java/com/emotionmuseum/common/result/ResultCode.java index bbccbb0..d4c690e 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/result/ResultCode.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/result/ResultCode.java @@ -6,7 +6,7 @@ import lombok.Getter; /** * 响应状态码枚举 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Getter diff --git a/backend/common/src/main/java/com/emotionmuseum/common/util/HttpUtil.java b/backend/common/src/main/java/com/emotionmuseum/common/util/HttpUtil.java index b5e6f83..2e7c413 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/util/HttpUtil.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/util/HttpUtil.java @@ -15,7 +15,7 @@ import java.util.Map; /** * HTTP工具类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/util/JwtUtil.java b/backend/common/src/main/java/com/emotionmuseum/common/util/JwtUtil.java index be9657f..5431870 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/util/JwtUtil.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/util/JwtUtil.java @@ -15,7 +15,7 @@ import java.util.Map; /** * JWT工具类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/util/SnowflakeIdGenerator.java b/backend/common/src/main/java/com/emotionmuseum/common/util/SnowflakeIdGenerator.java index bf2f280..bcbd71d 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/util/SnowflakeIdGenerator.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/util/SnowflakeIdGenerator.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; * 雪花算法结构: * 1位符号位(固定为0) + 41位时间戳 + 10位机器ID + 12位序列号 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Slf4j diff --git a/backend/common/src/main/java/com/emotionmuseum/common/util/UserContextUtil.java b/backend/common/src/main/java/com/emotionmuseum/common/util/UserContextUtil.java index 565d566..dca8dc4 100644 --- a/backend/common/src/main/java/com/emotionmuseum/common/util/UserContextUtil.java +++ b/backend/common/src/main/java/com/emotionmuseum/common/util/UserContextUtil.java @@ -8,7 +8,7 @@ import org.springframework.util.StringUtils; * 用户上下文工具类 * 提供手动设置和获取用户上下文的方法 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/common/src/test/java/com/emotionmuseum/common/util/SnowflakeIdGeneratorTest.java b/backend/common/src/test/java/com/emotionmuseum/common/util/SnowflakeIdGeneratorTest.java index 20a9fb0..49f64c0 100644 --- a/backend/common/src/test/java/com/emotionmuseum/common/util/SnowflakeIdGeneratorTest.java +++ b/backend/common/src/test/java/com/emotionmuseum/common/util/SnowflakeIdGeneratorTest.java @@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger; /** * 雪花算法ID生成器测试类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ public class SnowflakeIdGeneratorTest { diff --git a/backend/explore/server/src/main/java/com/emotionmuseum/explore/ExploreApplication.java b/backend/explore/server/src/main/java/com/emotionmuseum/explore/ExploreApplication.java index 6373ca9..5577aa2 100644 --- a/backend/explore/server/src/main/java/com/emotionmuseum/explore/ExploreApplication.java +++ b/backend/explore/server/src/main/java/com/emotionmuseum/explore/ExploreApplication.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 地图探索服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication diff --git a/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/Comment.java b/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/Comment.java index e0b9e75..5ffaa28 100644 --- a/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/Comment.java +++ b/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/Comment.java @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; /** * 评论实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/CommunityPost.java b/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/CommunityPost.java index c47ceed..7ceb29d 100644 --- a/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/CommunityPost.java +++ b/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/CommunityPost.java @@ -12,7 +12,7 @@ import java.util.List; /** * 社区帖子实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/LocationPin.java b/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/LocationPin.java index a7d7f02..26f6083 100644 --- a/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/LocationPin.java +++ b/backend/explore/server/src/main/java/com/emotionmuseum/explore/entity/LocationPin.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 地点标记实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/gateway/src/main/java/com/emotionmuseum/gateway/GatewayApplication.java b/backend/gateway/src/main/java/com/emotionmuseum/gateway/GatewayApplication.java index f6fdffa..6bed385 100644 --- a/backend/gateway/src/main/java/com/emotionmuseum/gateway/GatewayApplication.java +++ b/backend/gateway/src/main/java/com/emotionmuseum/gateway/GatewayApplication.java @@ -7,7 +7,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * 网关服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication diff --git a/backend/growth/server/src/main/java/com/emotionmuseum/growth/GrowthApplication.java b/backend/growth/server/src/main/java/com/emotionmuseum/growth/GrowthApplication.java index 7843f0b..0b70b4e 100644 --- a/backend/growth/server/src/main/java/com/emotionmuseum/growth/GrowthApplication.java +++ b/backend/growth/server/src/main/java/com/emotionmuseum/growth/GrowthApplication.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 成长课题服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication diff --git a/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/GrowthTopic.java b/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/GrowthTopic.java index 2997faa..ab6a693 100644 --- a/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/GrowthTopic.java +++ b/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/GrowthTopic.java @@ -15,7 +15,7 @@ import java.util.Map; /** * 成长课题实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/TopicInteraction.java b/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/TopicInteraction.java index a127e28..7debb97 100644 --- a/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/TopicInteraction.java +++ b/backend/growth/server/src/main/java/com/emotionmuseum/growth/entity/TopicInteraction.java @@ -12,7 +12,7 @@ import java.time.LocalDateTime; /** * 课题互动实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/mysql_emotion_museum_final.sql b/backend/mysql_emotion_museum_final.sql deleted file mode 100644 index 7c41677..0000000 --- a/backend/mysql_emotion_museum_final.sql +++ /dev/null @@ -1,854 +0,0 @@ --- ============================================================================ --- 情绪博物馆数据库完整部署脚本 --- 版本: v3.0 Final (雪花算法主键版本) - 开发版本 --- 创建时间: 2025-07-13 --- 数据库类型: MySQL 8.0+ --- 说明: 包含完整表结构、索引、初始数据的一体化部署脚本 --- 主键类型: VARCHAR(36) 使用雪花算法生成,避免前端精度丢失问题 --- 关联策略: 不使用外键约束,通过代码中的ID字段关联 --- 特性: 开发阶段 - 先删除表再重新创建,确保表结构是最新的 --- 警告: 此脚本会删除现有表和数据,仅适用于开发环境! --- ============================================================================ --- 设置SQL模式和字符集 -SET - SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO'; - -SET - AUTOCOMMIT = 0; - -START TRANSACTION; - -SET - time_zone = "+00:00"; - --- 创建数据库 -CREATE DATABASE IF NOT EXISTS emotion_museum DEFAULT CHARACTER -SET - utf8mb4 COLLATE utf8mb4_unicode_ci; - -USE emotion_museum; - --- ============================================================================ --- 数据库设计原则 --- ============================================================================ --- 1. 主键策略: 使用VARCHAR(36)雪花算法ID,避免前端精度丢失 --- 2. 关联策略: 不使用外键约束,通过代码中的ID字段维护关联关系 --- 3. 公共字段: 所有表继承BaseEntity的公共字段 --- 4. 索引优化: 为查询频繁的字段创建合适的索引 --- 5. 字符集: 统一使用utf8mb4支持emoji和特殊字符 --- ============================================================================ --- 删除现有表(开发阶段确保表结构最新) --- 警告: 这会删除所有数据! --- ============================================================================ -DROP TABLE IF EXISTS user_stats; - -DROP TABLE IF EXISTS guest_user; - -DROP TABLE IF EXISTS reward; - -DROP TABLE IF EXISTS achievement; - -DROP TABLE IF EXISTS comment; - -DROP TABLE IF EXISTS community_post; - -DROP TABLE IF EXISTS location_pin; - -DROP TABLE IF EXISTS topic_interaction; - -DROP TABLE IF EXISTS growth_topic; - -DROP TABLE IF EXISTS emotion_record; - -DROP TABLE IF EXISTS emotion_analysis; - -DROP TABLE IF EXISTS coze_api_call; - -DROP TABLE IF EXISTS message; - -DROP TABLE IF EXISTS conversation; - -DROP TABLE IF EXISTS user; - --- ============================================================================ --- 1. 用户表 (user) --- ============================================================================ -CREATE TABLE user ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - account VARCHAR(50) NOT NULL UNIQUE, -- 账号 - password VARCHAR(255) NOT NULL, -- 密码(加密后) - username VARCHAR(50) NOT NULL UNIQUE, -- 用户名 - email VARCHAR(100) NOT NULL UNIQUE, -- 邮箱 - phone VARCHAR(20) UNIQUE, -- 手机号 - avatar VARCHAR(500), -- 头像URL - nickname VARCHAR(50) NOT NULL, -- 昵称 - birth_date DATE, -- 生日 - location VARCHAR(100), -- 所在地 - bio TEXT, -- 个人简介 - member_level VARCHAR(20) NOT NULL DEFAULT 'free', -- 会员等级 - total_days INT NOT NULL DEFAULT 0, -- 使用天数 - -- 成长数据 - self_awareness DECIMAL(5, 2) NOT NULL DEFAULT 50.00, -- 自我感知 - emotional_resilience DECIMAL(5, 2) NOT NULL DEFAULT 50.00, -- 情绪韧性 - action_power DECIMAL(5, 2) NOT NULL DEFAULT 50.00, -- 行动力 - empathy DECIMAL(5, 2) NOT NULL DEFAULT 50.00, -- 共情力 - life_enthusiasm DECIMAL(5, 2) NOT NULL DEFAULT 50.00, -- 生活热度 - -- 状态字段 - status TINYINT NOT NULL DEFAULT 1, -- 状态: 0-禁用, 1-正常 - is_verified TINYINT NOT NULL DEFAULT 0, -- 是否已验证: 0-未验证, 1-已验证 - last_active_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 最后活跃时间 - -- 第三方登录字段 - third_party_id VARCHAR(128), -- 第三方平台ID - third_party_type VARCHAR(32), -- 第三方平台类型: wechat, qq, wechat-mp - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户表'; - --- ============================================================================ --- 2. 对话表 (conversation) --- 关联说明: user_id 关联 user.id,通过代码逻辑维护关联关系 --- ============================================================================ -CREATE TABLE conversation ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - user_id VARCHAR(36) NOT NULL, -- 用户ID (关联user.id) - user_type VARCHAR(20) NOT NULL DEFAULT 'registered', -- 用户类型: registered-注册用户, guest-访客用户 - title VARCHAR(200), -- 对话标题 - type VARCHAR(50) NOT NULL DEFAULT 'emotion_chat', -- 对话类型 - status VARCHAR(20) NOT NULL DEFAULT 'active', -- 状态: active-活跃, ended-结束, archived-归档 - coze_conversation_id VARCHAR(100), -- Coze对话ID - bot_id VARCHAR(50), -- 使用的Bot ID - workflow_id VARCHAR(50), -- 使用的Workflow ID - initial_message TEXT, -- 初始消息 - context TEXT, -- 上下文信息 - primary_emotion VARCHAR(50), -- 主要情绪 - emotion_intensity DECIMAL(3, 2), -- 情绪强度 - emotion_trend VARCHAR(50), -- 情绪趋势 - keywords JSON, -- 关键词 - ai_insights TEXT, -- AI洞察 - confidence DECIMAL(3, 2), -- 分析置信度 - start_time DATETIME, -- 开始时间 - end_time DATETIME, -- 结束时间 - last_active_time DATETIME DEFAULT CURRENT_TIMESTAMP, -- 最后活跃时间 - message_count INT NOT NULL DEFAULT 0, -- 消息数量 - total_tokens INT DEFAULT 0, -- 总Token使用量 - total_cost DECIMAL(10, 4) DEFAULT 0.0000, -- 总费用 - client_ip VARCHAR(45), -- 客户端IP地址 (支持IPv6) - user_agent TEXT, -- 用户代理信息 - summary TEXT, -- 对话摘要 - tags JSON, -- 标签 - metadata JSON, -- 扩展元数据 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '对话表'; - --- ============================================================================ --- 3. 消息表 (message) --- 关联说明: conversation_id 关联 conversation.id,通过代码逻辑维护关联关系 --- ============================================================================ -CREATE TABLE message ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - conversation_id VARCHAR(36) NOT NULL, -- 对话ID (关联conversation.id) - content TEXT NOT NULL, -- 消息内容 - type VARCHAR(50) NOT NULL DEFAULT 'text', -- 消息类型 - sender VARCHAR(20) NOT NULL, -- 发送者: user-用户, assistant-AI助手 - timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 消息时间戳 - coze_chat_id VARCHAR(50), -- Coze平台的聊天ID - coze_message_id VARCHAR(50), -- Coze平台的消息ID - status VARCHAR(20) DEFAULT 'sent', -- 消息状态: sending/sent/failed/processing - error_message TEXT, -- 错误信息 - emotion_score DECIMAL(3, 2), -- 情绪评分 - emotion_type VARCHAR(50), -- 情绪类型 - emotion_confidence DECIMAL(3, 2), -- 情绪分析置信度 - prompt_tokens INT DEFAULT 0, -- 输入Token数 - completion_tokens INT DEFAULT 0, -- 输出Token数 - total_tokens INT DEFAULT 0, -- 总Token数 - api_cost DECIMAL(10, 6) DEFAULT 0.000000, -- API调用费用 - is_read TINYINT NOT NULL DEFAULT 0, -- 是否已读: 0-未读, 1-已读 - parent_message_id VARCHAR(36), -- 父消息ID(用于回复链) - emotion_analysis JSON, -- 情绪分析结果 - metadata JSON, -- 扩展元数据 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '消息表'; - --- ============================================================================ --- 4. Coze API调用记录表 (coze_api_call) - 优化版本 --- ============================================================================ -CREATE TABLE coze_api_call ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - conversation_id VARCHAR(36), -- 对话ID - message_id VARCHAR(36), -- 消息ID - -- Coze API 信息 - coze_chat_id VARCHAR(50), -- Coze聊天ID - coze_conversation_id VARCHAR(50), -- Coze对话ID - bot_id VARCHAR(50) NOT NULL, -- Bot ID - workflow_id VARCHAR(50), -- Workflow ID - user_id VARCHAR(36) NOT NULL, -- 用户ID - -- 请求信息 - request_type VARCHAR(20) NOT NULL, -- 请求类型: chat/stream/retrieve/messages - request_url VARCHAR(500), -- 请求URL - request_body JSON, -- 请求体 - request_headers JSON, -- 请求头 - -- 用户消息内容 - user_message TEXT, -- 用户输入的消息内容 - user_message_type VARCHAR(20) DEFAULT 'text', -- 用户消息类型: text/image/file - -- AI回复内容 - ai_reply TEXT, -- AI回复的消息内容 - ai_reply_type VARCHAR(20) DEFAULT 'text', -- AI回复类型: text/image/file - -- 响应信息 - response_status INT, -- HTTP状态码 - response_body JSON, -- 响应体 - response_headers JSON, -- 响应头 - -- 轮询信息 - poll_count INT DEFAULT 0, -- 轮询次数 - poll_start_time DATETIME, -- 轮询开始时间 - poll_end_time DATETIME, -- 轮询结束时间 - final_status VARCHAR(20), -- 最终状态: completed/failed/timeout - -- 状态和时间 - status VARCHAR(20) NOT NULL, -- 调用状态: pending/success/failed/timeout - start_time DATETIME NOT NULL, -- 开始时间 - end_time DATETIME, -- 结束时间 - duration_ms INT, -- 耗时(毫秒) - -- 使用统计 - prompt_tokens INT DEFAULT 0, -- 输入Token数 - completion_tokens INT DEFAULT 0, -- 输出Token数 - total_tokens INT DEFAULT 0, -- 总Token数 - cost DECIMAL(10, 6) DEFAULT 0.000000, -- 费用 - -- 功能调用信息 - function_calls JSON, -- 函数调用记录 - function_results JSON, -- 函数调用结果 - -- 错误信息 - error_code VARCHAR(50), -- 错误代码 - error_message TEXT, -- 错误信息 - -- 扩展信息 - client_ip VARCHAR(45), -- 客户端IP - user_agent TEXT, -- 用户代理 - session_id VARCHAR(100), -- 会话ID - trace_id VARCHAR(100), -- 追踪ID - metadata JSON, -- 扩展元数据 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Coze API调用记录表 - 完整版本'; - --- ============================================================================ --- 5. 情绪分析表 (emotion_analysis) --- ============================================================================ -CREATE TABLE emotion_analysis ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - user_id VARCHAR(36) NOT NULL, -- 用户ID - message_id VARCHAR(36), -- 关联消息ID - text TEXT NOT NULL, -- 分析文本 - primary_emotion VARCHAR(50), -- 主要情绪 - intensity DECIMAL(3, 2), -- 情绪强度 - polarity VARCHAR(20), -- 情绪极性: positive-积极, negative-消极, neutral-中性 - confidence DECIMAL(3, 2), -- 置信度 - emotions JSON, -- 情绪分布详情 - keywords JSON, -- 关键词列表 - suggestion TEXT, -- 建议 - analysis_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 分析时间 - metadata JSON, -- 扩展元数据 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '情绪分析表'; - --- ============================================================================ --- 6. 情绪记录表 (emotion_record) --- ============================================================================ -CREATE TABLE emotion_record ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - user_id VARCHAR(36) NOT NULL, -- 用户ID - record_date DATE NOT NULL, -- 记录日期 - emotion_type VARCHAR(50) NOT NULL, -- 情绪类型 - intensity DECIMAL(3, 2) NOT NULL, -- 情绪强度 - triggers TEXT, -- 触发因素 - description TEXT, -- 描述 - tags JSON, -- 标签 - weather VARCHAR(50), -- 天气 - location VARCHAR(100), -- 地点 - activity VARCHAR(100), -- 活动 - people VARCHAR(200), -- 相关人物 - notes TEXT, -- 备注 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '情绪记录表'; - --- ============================================================================ --- 7. 成长课题表 (growth_topic) --- ============================================================================ -CREATE TABLE growth_topic ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - title VARCHAR(100) NOT NULL, -- 课题标题 - category VARCHAR(50) NOT NULL, -- 分类 - difficulty VARCHAR(20) NOT NULL, -- 难度: easy-简单, medium-中等, hard-困难 - description TEXT, -- 描述 - content TEXT, -- 内容 - duration_days INT, -- 持续天数 - unlock_conditions JSON, -- 解锁条件 - is_unlocked TINYINT NOT NULL DEFAULT 1, -- 是否解锁 - progress DECIMAL(5, 2) NOT NULL DEFAULT 0.00, -- 进度百分比 - completed_time DATETIME, -- 完成时间 - rewards JSON, -- 奖励 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '成长课题表'; - --- ============================================================================ --- 8. 课题互动表 (topic_interaction) --- ============================================================================ -CREATE TABLE topic_interaction ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - topic_id VARCHAR(36) NOT NULL, -- 课题ID - type VARCHAR(50) NOT NULL, -- 互动类型 - content TEXT, -- 内容 - user_input TEXT, -- 用户输入 - ai_response TEXT, -- AI回应 - rating INT, -- 评分 - feedback TEXT, -- 反馈 - completed_time DATETIME, -- 完成时间 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '课题互动表'; - --- ============================================================================ --- 9. 地点标记表 (location_pin) --- ============================================================================ -CREATE TABLE location_pin ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - name VARCHAR(100) NOT NULL, -- 地点名称 - type VARCHAR(50) NOT NULL, -- 地点类型 - category VARCHAR(50), -- 地点分类 - latitude DECIMAL(10, 8) NOT NULL, -- 纬度 - longitude DECIMAL(11, 8) NOT NULL, -- 经度 - address VARCHAR(200), -- 地址 - description TEXT, -- 描述 - created_by VARCHAR(36), -- 创建者 - likes INT NOT NULL DEFAULT 0, -- 点赞数 - visits INT NOT NULL DEFAULT 0, -- 访问数 - is_bookmarked TINYINT NOT NULL DEFAULT 0, -- 是否收藏 - last_visit_time DATETIME, -- 最后访问时间 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '地点标记表'; - --- ============================================================================ --- 10. 社区帖子表 (community_post) --- ============================================================================ -CREATE TABLE community_post ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - user_id VARCHAR(36) NOT NULL, -- 用户ID - location_id VARCHAR(36), -- 地点ID - title VARCHAR(200), -- 标题 - content TEXT NOT NULL, -- 内容 - type VARCHAR(50) NOT NULL, -- 帖子类型 - images JSON, -- 图片列表 - tags JSON, -- 标签 - likes INT NOT NULL DEFAULT 0, -- 点赞数 - view_count INT NOT NULL DEFAULT 0, -- 浏览数 - comment_count INT NOT NULL DEFAULT 0, -- 评论数 - is_private TINYINT NOT NULL DEFAULT 0, -- 是否私密 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社区帖子表'; - --- ============================================================================ --- 11. 评论表 (comment) --- ============================================================================ -CREATE TABLE comment ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - post_id VARCHAR(36) NOT NULL, -- 帖子ID - user_id VARCHAR(36) NOT NULL, -- 用户ID - content TEXT NOT NULL, -- 评论内容 - reply_to_id VARCHAR(36), -- 回复的评论ID - likes INT NOT NULL DEFAULT 0, -- 点赞数 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '评论表'; - --- ============================================================================ --- 12. 成就表 (achievement) --- ============================================================================ -CREATE TABLE achievement ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - title VARCHAR(100) NOT NULL, -- 成就标题 - description TEXT, -- 描述 - category VARCHAR(50) NOT NULL, -- 分类 - icon VARCHAR(200), -- 图标 - rarity VARCHAR(20) NOT NULL, -- 稀有度 - condition_type VARCHAR(50), -- 条件类型 - condition_value JSON, -- 条件值 - rewards JSON, -- 奖励 - unlocked_time DATETIME, -- 解锁时间 - progress DECIMAL(5, 2) NOT NULL DEFAULT 0.00, -- 进度 - is_hidden TINYINT NOT NULL DEFAULT 0, -- 是否隐藏 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '成就表'; - --- ============================================================================ --- 13. 奖励表 (reward) --- ============================================================================ -CREATE TABLE reward ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - topic_id VARCHAR(36), -- 课题ID - achievement_id VARCHAR(36), -- 成就ID - type VARCHAR(50) NOT NULL, -- 奖励类型 - name VARCHAR(100) NOT NULL, -- 奖励名称 - description TEXT, -- 描述 - icon VARCHAR(200), -- 图标 - rarity VARCHAR(20), -- 稀有度 - value JSON, -- 奖励值 - earned_time DATETIME, -- 获得时间 - is_new TINYINT NOT NULL DEFAULT 1, -- 是否新获得 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '奖励表'; - --- ============================================================================ --- 14. 访客用户表 (guest_user) --- ============================================================================ -CREATE TABLE guest_user ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - guest_user_id VARCHAR(50) NOT NULL UNIQUE, -- 访客用户ID (格式: guest_xxx) - ip_address VARCHAR(45) NOT NULL, -- 客户端IP地址 (支持IPv6) - user_agent TEXT, -- 用户代理信息 - nickname VARCHAR(50), -- 访客昵称 - avatar VARCHAR(500), -- 访客头像 - last_active_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 最后活跃时间 - conversation_count INT NOT NULL DEFAULT 0, -- 会话数量 - message_count INT NOT NULL DEFAULT 0, -- 消息数量 - location VARCHAR(100), -- IP地址的地理位置信息 - device_info VARCHAR(200), -- 设备信息 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '访客用户表'; - --- ============================================================================ --- 15. 用户统计表 (user_stats) --- ============================================================================ -CREATE TABLE user_stats ( - id VARCHAR(36) PRIMARY KEY, -- UUID主键 - user_id VARCHAR(36) NOT NULL UNIQUE, -- 用户ID - total_conversations INT NOT NULL DEFAULT 0, -- 总对话数 - total_messages INT NOT NULL DEFAULT 0, -- 总消息数 - total_emotions_recorded INT NOT NULL DEFAULT 0, -- 总情绪记录数 - topics_completed INT NOT NULL DEFAULT 0, -- 完成的课题数 - achievements_unlocked INT NOT NULL DEFAULT 0, -- 解锁的成就数 - total_points INT NOT NULL DEFAULT 0, -- 总积分 - consecutive_days INT NOT NULL DEFAULT 0, -- 连续使用天数 - max_consecutive_days INT NOT NULL DEFAULT 0, -- 最大连续天数 - locations_visited INT NOT NULL DEFAULT 0, -- 访问的地点数 - posts_created INT NOT NULL DEFAULT 0, -- 创建的帖子数 - comments_made INT NOT NULL DEFAULT 0, -- 评论数 - likes_received INT NOT NULL DEFAULT 0, -- 收到的点赞数 - social_interactions INT NOT NULL DEFAULT 0, -- 社交互动数 - -- 公共字段 - create_by VARCHAR(36), -- 创建人ID - create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间 - update_by VARCHAR(36), -- 更新人ID - update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- 更新时间 - is_deleted TINYINT NOT NULL DEFAULT 0, -- 是否删除: 0-未删除, 1-已删除 - remarks VARCHAR(500) -- 备注 -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户统计表'; - --- ============================================================================ --- 创建索引以提高查询性能 --- 注意: MySQL的CREATE INDEX不支持IF NOT EXISTS --- 如果索引已存在,重复执行会产生警告但不会中断脚本执行 --- ============================================================================ --- user表索引 -CREATE INDEX idx_user_account ON user (account); - -CREATE INDEX idx_user_username ON user (username); - -CREATE INDEX idx_user_email ON user (email); - -CREATE INDEX idx_user_phone ON user (phone); - -CREATE INDEX idx_user_last_active_time ON user (last_active_time); - -CREATE INDEX idx_user_create_time ON user (create_time); - -CREATE INDEX idx_user_member_level ON user (member_level); - -CREATE INDEX idx_user_status ON user (status); - -CREATE INDEX idx_user_is_verified ON user (is_verified); - -CREATE INDEX idx_user_create_by ON user (create_by); - -CREATE INDEX idx_user_update_by ON user (update_by); - -CREATE INDEX idx_user_is_deleted ON user (is_deleted); - -CREATE INDEX idx_user_third_party_id ON user (third_party_id); - -CREATE INDEX idx_user_third_party_type ON user (third_party_type); - --- conversation表索引 -CREATE INDEX idx_conversation_user_id ON conversation (user_id); - -CREATE INDEX idx_conversation_start_time ON conversation (start_time); - -CREATE INDEX idx_conversation_user_id_start_time ON conversation (user_id, start_time); - -CREATE INDEX idx_conversation_primary_emotion ON conversation (primary_emotion); - -CREATE INDEX idx_conversation_end_time ON conversation (end_time); - -CREATE INDEX idx_conversation_create_time ON conversation (create_time); - -CREATE INDEX idx_conversation_coze_conversation_id ON conversation (coze_conversation_id); - -CREATE INDEX idx_conversation_status ON conversation (status); - -CREATE INDEX idx_conversation_last_active_time ON conversation (last_active_time); - -CREATE INDEX idx_conversation_create_by ON conversation (create_by); - -CREATE INDEX idx_conversation_update_by ON conversation (update_by); - -CREATE INDEX idx_conversation_is_deleted ON conversation (is_deleted); - -CREATE INDEX idx_conversation_user_type ON conversation (user_type); - -CREATE INDEX idx_conversation_emotion_trend ON conversation (emotion_trend); - -CREATE INDEX idx_conversation_confidence ON conversation (confidence); - -CREATE INDEX idx_conversation_client_ip ON conversation (client_ip); - --- message表索引 -CREATE INDEX idx_message_conversation_id ON message (conversation_id); - -CREATE INDEX idx_message_timestamp ON message (timestamp); - -CREATE INDEX idx_message_conversation_id_timestamp ON message (conversation_id, timestamp); - -CREATE INDEX idx_message_sender ON message (sender); - -CREATE INDEX idx_message_type ON message (type); - -CREATE INDEX idx_message_is_read ON message (is_read); - -CREATE INDEX idx_message_create_time ON message (create_time); - -CREATE INDEX idx_message_coze_chat_id ON message (coze_chat_id); - -CREATE INDEX idx_message_status ON message (status); - -CREATE INDEX idx_message_parent_message_id ON message (parent_message_id); - -CREATE INDEX idx_message_create_by ON message (create_by); - -CREATE INDEX idx_message_update_by ON message (update_by); - -CREATE INDEX idx_message_is_deleted ON message (is_deleted); - --- coze_api_call表索引 -CREATE INDEX idx_coze_api_call_conversation_id ON coze_api_call (conversation_id); - -CREATE INDEX idx_coze_api_call_message_id ON coze_api_call (message_id); - -CREATE INDEX idx_coze_api_call_coze_chat_id ON coze_api_call (coze_chat_id); - -CREATE INDEX idx_coze_api_call_bot_id ON coze_api_call (bot_id); - -CREATE INDEX idx_coze_api_call_user_id ON coze_api_call (user_id); - -CREATE INDEX idx_coze_api_call_status ON coze_api_call (status); - -CREATE INDEX idx_coze_api_call_final_status ON coze_api_call (final_status); - -CREATE INDEX idx_coze_api_call_start_time ON coze_api_call (start_time); - -CREATE INDEX idx_coze_api_call_request_type ON coze_api_call (request_type); - -CREATE INDEX idx_coze_api_call_client_ip ON coze_api_call (client_ip); - -CREATE INDEX idx_coze_api_call_session_id ON coze_api_call (session_id); - -CREATE INDEX idx_coze_api_call_trace_id ON coze_api_call (trace_id); - -CREATE INDEX idx_coze_api_call_user_status ON coze_api_call (user_id, status); - -CREATE INDEX idx_coze_api_call_conversation_time ON coze_api_call (conversation_id, start_time); - --- emotion_analysis表索引 -CREATE INDEX idx_emotion_analysis_user_id ON emotion_analysis (user_id); - -CREATE INDEX idx_emotion_analysis_message_id ON emotion_analysis (message_id); - -CREATE INDEX idx_emotion_analysis_primary_emotion ON emotion_analysis (primary_emotion); - -CREATE INDEX idx_emotion_analysis_analysis_time ON emotion_analysis (analysis_time); - -CREATE INDEX idx_emotion_analysis_create_time ON emotion_analysis (create_time); - -CREATE INDEX idx_emotion_analysis_create_by ON emotion_analysis (create_by); - -CREATE INDEX idx_emotion_analysis_update_by ON emotion_analysis (update_by); - -CREATE INDEX idx_emotion_analysis_is_deleted ON emotion_analysis (is_deleted); - --- emotion_record表索引 -CREATE INDEX idx_emotion_record_user_id ON emotion_record (user_id); - -CREATE INDEX idx_emotion_record_date ON emotion_record (record_date); - -CREATE INDEX idx_emotion_record_emotion_type ON emotion_record (emotion_type); - -CREATE INDEX idx_emotion_record_user_id_date ON emotion_record (user_id, record_date); - -CREATE INDEX idx_emotion_record_user_id_emotion_type ON emotion_record (user_id, emotion_type); - -CREATE INDEX idx_emotion_record_intensity ON emotion_record (intensity); - -CREATE INDEX idx_emotion_record_create_time ON emotion_record (create_time); - -CREATE INDEX idx_emotion_record_create_by ON emotion_record (create_by); - -CREATE INDEX idx_emotion_record_update_by ON emotion_record (update_by); - -CREATE INDEX idx_emotion_record_is_deleted ON emotion_record (is_deleted); - --- growth_topic表索引 -CREATE INDEX idx_growth_topic_category ON growth_topic (category); - -CREATE INDEX idx_growth_topic_difficulty ON growth_topic (difficulty); - -CREATE INDEX idx_growth_topic_is_unlocked ON growth_topic (is_unlocked); - -CREATE INDEX idx_growth_topic_progress ON growth_topic (progress); - -CREATE INDEX idx_growth_topic_completed_time ON growth_topic (completed_time); - -CREATE INDEX idx_growth_topic_category_difficulty ON growth_topic (category, difficulty); - -CREATE INDEX idx_growth_topic_create_time ON growth_topic (create_time); - --- topic_interaction表索引 -CREATE INDEX idx_topic_interaction_topic_id ON topic_interaction (topic_id); - -CREATE INDEX idx_topic_interaction_type ON topic_interaction (type); - -CREATE INDEX idx_topic_interaction_completed_time ON topic_interaction (completed_time); - -CREATE INDEX idx_topic_interaction_rating ON topic_interaction (rating); - -CREATE INDEX idx_topic_interaction_topic_id_type ON topic_interaction (topic_id, type); - -CREATE INDEX idx_topic_interaction_create_time ON topic_interaction (create_time); - --- location_pin表索引 -CREATE INDEX idx_location_pin_latitude_longitude ON location_pin (latitude, longitude); - -CREATE INDEX idx_location_pin_type ON location_pin (type); - -CREATE INDEX idx_location_pin_category ON location_pin (category); - -CREATE INDEX idx_location_pin_created_by ON location_pin (created_by); - -CREATE INDEX idx_location_pin_likes ON location_pin (likes); - -CREATE INDEX idx_location_pin_visits ON location_pin (visits); - -CREATE INDEX idx_location_pin_is_bookmarked ON location_pin (is_bookmarked); - -CREATE INDEX idx_location_pin_type_category ON location_pin (type, category); - -CREATE INDEX idx_location_pin_create_time ON location_pin (create_time); - -CREATE INDEX idx_location_pin_last_visit_time ON location_pin (last_visit_time); - --- community_post表索引 -CREATE INDEX idx_community_post_user_id ON community_post (user_id); - -CREATE INDEX idx_community_post_location_id ON community_post (location_id); - -CREATE INDEX idx_community_post_create_time ON community_post (create_time); - -CREATE INDEX idx_community_post_type ON community_post (type); - -CREATE INDEX idx_community_post_likes ON community_post (likes); - -CREATE INDEX idx_community_post_view_count ON community_post (view_count); - -CREATE INDEX idx_community_post_is_private ON community_post (is_private); - -CREATE INDEX idx_community_post_user_id_create_time ON community_post (user_id, create_time); - -CREATE INDEX idx_community_post_type_create_time ON community_post (type, create_time); - --- comment表索引 -CREATE INDEX idx_comment_post_id ON comment (post_id); - -CREATE INDEX idx_comment_user_id ON comment (user_id); - -CREATE INDEX idx_comment_reply_to_id ON comment (reply_to_id); - -CREATE INDEX idx_comment_create_time ON comment (create_time); - -CREATE INDEX idx_comment_likes ON comment (likes); - -CREATE INDEX idx_comment_post_id_create_time ON comment (post_id, create_time); - --- achievement表索引 -CREATE INDEX idx_achievement_category ON achievement (category); - -CREATE INDEX idx_achievement_rarity ON achievement (rarity); - -CREATE INDEX idx_achievement_unlocked_time ON achievement (unlocked_time); - -CREATE INDEX idx_achievement_is_hidden ON achievement (is_hidden); - -CREATE INDEX idx_achievement_progress ON achievement (progress); - -CREATE INDEX idx_achievement_category_rarity ON achievement (category, rarity); - -CREATE INDEX idx_achievement_create_time ON achievement (create_time); - --- reward表索引 -CREATE INDEX idx_reward_topic_id ON reward (topic_id); - -CREATE INDEX idx_reward_achievement_id ON reward (achievement_id); - -CREATE INDEX idx_reward_type ON reward (type); - -CREATE INDEX idx_reward_earned_time ON reward (earned_time); - -CREATE INDEX idx_reward_rarity ON reward (rarity); - -CREATE INDEX idx_reward_is_new ON reward (is_new); - -CREATE INDEX idx_reward_type_earned_time ON reward (type, earned_time); - -CREATE INDEX idx_reward_create_time ON reward (create_time); - --- user_stats表索引 -CREATE INDEX idx_user_stats_user_id ON user_stats (user_id); - -CREATE INDEX idx_user_stats_total_points ON user_stats (total_points); - -CREATE INDEX idx_user_stats_consecutive_days ON user_stats (consecutive_days); - -CREATE INDEX idx_user_stats_max_consecutive_days ON user_stats (max_consecutive_days); - -CREATE INDEX idx_user_stats_social_interactions ON user_stats (social_interactions); - -CREATE INDEX idx_user_stats_update_time ON user_stats (update_time); - -CREATE INDEX idx_user_stats_create_time ON user_stats (create_time); - --- guest_user表索引 -CREATE INDEX idx_guest_user_guest_user_id ON guest_user (guest_user_id); - -CREATE INDEX idx_guest_user_ip_address ON guest_user (ip_address); - -CREATE INDEX idx_guest_user_last_active_time ON guest_user (last_active_time); - -CREATE INDEX idx_guest_user_conversation_count ON guest_user (conversation_count); - -CREATE INDEX idx_guest_user_message_count ON guest_user (message_count); - -CREATE INDEX idx_guest_user_create_time ON guest_user (create_time); - -CREATE INDEX idx_guest_user_create_by ON guest_user (create_by); - -CREATE INDEX idx_guest_user_update_by ON guest_user (update_by); - -CREATE INDEX idx_guest_user_is_deleted ON guest_user (is_deleted); - --- ============================================================================ --- 数据库统计信息 --- ============================================================================ -SELECT - COUNT(*) as total_tables -FROM - INFORMATION_SCHEMA.TABLES -WHERE - TABLE_SCHEMA = 'emotion_museum'; - --- 显示创建的表 -SELECT - TABLE_NAME as table_name, - TABLE_COMMENT as comment, - ENGINE as engine -FROM - INFORMATION_SCHEMA.TABLES -WHERE - TABLE_SCHEMA = 'emotion_museum' -ORDER BY - TABLE_NAME; - --- 提交事务 -COMMIT; \ No newline at end of file diff --git a/backend/record/server/src/main/java/com/emotionmuseum/record/RecordApplication.java b/backend/record/server/src/main/java/com/emotionmuseum/record/RecordApplication.java index 2510028..2b6fbe1 100644 --- a/backend/record/server/src/main/java/com/emotionmuseum/record/RecordApplication.java +++ b/backend/record/server/src/main/java/com/emotionmuseum/record/RecordApplication.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 情绪记录服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication diff --git a/backend/record/server/src/main/java/com/emotionmuseum/record/entity/EmotionRecord.java b/backend/record/server/src/main/java/com/emotionmuseum/record/entity/EmotionRecord.java index b97f30c..9411712 100644 --- a/backend/record/server/src/main/java/com/emotionmuseum/record/entity/EmotionRecord.java +++ b/backend/record/server/src/main/java/com/emotionmuseum/record/entity/EmotionRecord.java @@ -15,7 +15,7 @@ import java.util.List; /** * 情绪记录实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/record/server/src/main/java/com/emotionmuseum/record/request/CreateEmotionRecordRequest.java b/backend/record/server/src/main/java/com/emotionmuseum/record/request/CreateEmotionRecordRequest.java index c17b733..785aa2c 100644 --- a/backend/record/server/src/main/java/com/emotionmuseum/record/request/CreateEmotionRecordRequest.java +++ b/backend/record/server/src/main/java/com/emotionmuseum/record/request/CreateEmotionRecordRequest.java @@ -15,7 +15,7 @@ import java.util.List; /** * 创建情绪记录请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/record/server/src/main/java/com/emotionmuseum/record/response/EmotionRecordResponse.java b/backend/record/server/src/main/java/com/emotionmuseum/record/response/EmotionRecordResponse.java index 6088ee0..3e52c40 100644 --- a/backend/record/server/src/main/java/com/emotionmuseum/record/response/EmotionRecordResponse.java +++ b/backend/record/server/src/main/java/com/emotionmuseum/record/response/EmotionRecordResponse.java @@ -13,7 +13,7 @@ import java.util.List; /** * 情绪记录响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/reward/server/src/main/java/com/emotionmuseum/reward/RewardApplication.java b/backend/reward/server/src/main/java/com/emotionmuseum/reward/RewardApplication.java index abe6cc3..760796c 100644 --- a/backend/reward/server/src/main/java/com/emotionmuseum/reward/RewardApplication.java +++ b/backend/reward/server/src/main/java/com/emotionmuseum/reward/RewardApplication.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 成就奖励服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication diff --git a/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Achievement.java b/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Achievement.java index 547e495..cc416e1 100644 --- a/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Achievement.java +++ b/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Achievement.java @@ -15,7 +15,7 @@ import java.util.Map; /** * 成就实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Reward.java b/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Reward.java index 995580f..8c714a1 100644 --- a/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Reward.java +++ b/backend/reward/server/src/main/java/com/emotionmuseum/reward/entity/Reward.java @@ -14,7 +14,7 @@ import java.util.Map; /** * 奖励实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/stats/server/src/main/java/com/emotionmuseum/stats/StatsApplication.java b/backend/stats/server/src/main/java/com/emotionmuseum/stats/StatsApplication.java index 2a1891e..046cc88 100644 --- a/backend/stats/server/src/main/java/com/emotionmuseum/stats/StatsApplication.java +++ b/backend/stats/server/src/main/java/com/emotionmuseum/stats/StatsApplication.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 统计分析服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication diff --git a/backend/stats/server/src/main/java/com/emotionmuseum/stats/entity/UserStats.java b/backend/stats/server/src/main/java/com/emotionmuseum/stats/entity/UserStats.java index 5959386..a07cb99 100644 --- a/backend/stats/server/src/main/java/com/emotionmuseum/stats/entity/UserStats.java +++ b/backend/stats/server/src/main/java/com/emotionmuseum/stats/entity/UserStats.java @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; /** * 用户统计实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-13 */ @Data diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/UserApplication.java b/backend/user/server/src/main/java/com/emotionmuseum/user/UserApplication.java index 8fdb159..a542e4e 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/UserApplication.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/UserApplication.java @@ -8,7 +8,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * 用户服务启动类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @SpringBootApplication(scanBasePackages = {"com.emotionmuseum"}) diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/config/AuthenticationConfig.java b/backend/user/server/src/main/java/com/emotionmuseum/user/config/AuthenticationConfig.java index 8b46d6a..f4d1b29 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/config/AuthenticationConfig.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/config/AuthenticationConfig.java @@ -15,7 +15,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; * 认证配置类 * 独立的认证配置,避免循环依赖 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/config/CaptchaConfig.java b/backend/user/server/src/main/java/com/emotionmuseum/user/config/CaptchaConfig.java index 01cd575..b47b74f 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/config/CaptchaConfig.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/config/CaptchaConfig.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; /** * 验证码配置 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/config/OAuthConfig.java b/backend/user/server/src/main/java/com/emotionmuseum/user/config/OAuthConfig.java index 1231383..6a06e25 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/config/OAuthConfig.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/config/OAuthConfig.java @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration; /** * 第三方登录配置 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/config/RedisConfig.java b/backend/user/server/src/main/java/com/emotionmuseum/user/config/RedisConfig.java index 09d9148..06e495c 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/config/RedisConfig.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/config/RedisConfig.java @@ -10,7 +10,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; /** * Redis配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/config/SecurityConfig.java b/backend/user/server/src/main/java/com/emotionmuseum/user/config/SecurityConfig.java index fbaa51a..9fc0db8 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/config/SecurityConfig.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/config/SecurityConfig.java @@ -26,7 +26,7 @@ import java.util.Collections; /** * Spring Security配置类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Configuration diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/controller/UserController.java b/backend/user/server/src/main/java/com/emotionmuseum/user/controller/UserController.java index 6db4c5c..a92b6ca 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/controller/UserController.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/controller/UserController.java @@ -17,7 +17,7 @@ import jakarta.validation.Valid; /** * 用户控制器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/dto/UserUpdateRequest.java b/backend/user/server/src/main/java/com/emotionmuseum/user/dto/UserUpdateRequest.java index b3bdfcd..4b629d9 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/dto/UserUpdateRequest.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/dto/UserUpdateRequest.java @@ -11,7 +11,7 @@ import java.time.LocalDate; /** * 用户信息更新请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/entity/User.java b/backend/user/server/src/main/java/com/emotionmuseum/user/entity/User.java index 9104725..a2d4f3e 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/entity/User.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/entity/User.java @@ -15,7 +15,7 @@ import java.time.LocalDateTime; /** * 用户实体 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/mapper/UserMapper.java b/backend/user/server/src/main/java/com/emotionmuseum/user/mapper/UserMapper.java index 855e916..169765c 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/mapper/UserMapper.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/mapper/UserMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param; /** * 用户Mapper * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Mapper diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/request/UserUpdateRequest.java b/backend/user/server/src/main/java/com/emotionmuseum/user/request/UserUpdateRequest.java index e0010ee..5b3fad3 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/request/UserUpdateRequest.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/request/UserUpdateRequest.java @@ -13,7 +13,7 @@ import java.time.LocalDate; /** * 用户信息更新请求 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/response/UserInfoResponse.java b/backend/user/server/src/main/java/com/emotionmuseum/user/response/UserInfoResponse.java index 4f70613..e75f940 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/response/UserInfoResponse.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/response/UserInfoResponse.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; /** * 用户信息响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-24 */ @Data diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/security/JwtAuthenticationFilter.java b/backend/user/server/src/main/java/com/emotionmuseum/user/security/JwtAuthenticationFilter.java index 3d9acf6..d87e30c 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/security/JwtAuthenticationFilter.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/security/JwtAuthenticationFilter.java @@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit; /** * JWT认证过滤器 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/security/UserDetailsServiceImpl.java b/backend/user/server/src/main/java/com/emotionmuseum/user/security/UserDetailsServiceImpl.java index 1cd4b10..16df19e 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/security/UserDetailsServiceImpl.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/security/UserDetailsServiceImpl.java @@ -18,7 +18,7 @@ import java.util.Collections; /** * Spring Security用户详情服务实现 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-15 */ @Slf4j diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/service/UserService.java b/backend/user/server/src/main/java/com/emotionmuseum/user/service/UserService.java index 15500f3..f3ad47c 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/service/UserService.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/service/UserService.java @@ -8,7 +8,7 @@ import com.emotionmuseum.user.response.UserInfoResponse; /** * 用户服务接口 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ public interface UserService extends IService { diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/service/impl/UserServiceImpl.java b/backend/user/server/src/main/java/com/emotionmuseum/user/service/impl/UserServiceImpl.java index 7823130..7d70f7b 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/service/impl/UserServiceImpl.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/service/impl/UserServiceImpl.java @@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.Transactional; /** * 用户服务实现类 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Slf4j diff --git a/backend/user/server/src/main/java/com/emotionmuseum/user/vo/UserInfoResponse.java b/backend/user/server/src/main/java/com/emotionmuseum/user/vo/UserInfoResponse.java index 37cfd1a..5c5e26c 100644 --- a/backend/user/server/src/main/java/com/emotionmuseum/user/vo/UserInfoResponse.java +++ b/backend/user/server/src/main/java/com/emotionmuseum/user/vo/UserInfoResponse.java @@ -11,7 +11,7 @@ import java.time.LocalDateTime; /** * 用户信息响应 * - * @author emotion-museum + * @author huazhongmin * @since 2025-07-12 */ @Data diff --git a/docs/web-admin-deployment.md b/docs/web-admin-deployment.md new file mode 100644 index 0000000..5f076db --- /dev/null +++ b/docs/web-admin-deployment.md @@ -0,0 +1,445 @@ +# 管理后台部署指南 + +## 部署前准备 + +### 1. 环境要求 + +- Node.js 16+ +- npm 或 yarn +- Nginx (生产环境) + +### 2. 检查后端服务 + +确保后端服务已启动并可访问: +- 开发环境: http://localhost:8080 +- 生产环境: 配置实际的API地址 + +## 开发环境部署 + +### Windows系统 + +#### 方式1: 使用启动脚本 + +```bash +cd web-admin +start.bat +``` + +#### 方式2: 手动启动 + +```bash +cd web-admin +npm install +npm run dev +``` + +### Linux/Mac系统 + +```bash +cd web-admin +npm install +npm run dev +``` + +访问: http://localhost:5174 + +## 生产环境部署 + +### 1. 构建项目 + +```bash +cd web-admin +npm install +npm run build +``` + +构建完成后,会在 `dist` 目录生成静态文件。 + +### 2. Nginx配置 + +#### 基础配置 + +```nginx +server { + listen 80; + server_name admin.emotion-museum.com; + + root /var/www/web-admin/dist; + index index.html; + + # 支持 History 路由模式 + location / { + try_files $uri $uri/ /index.html; + } + + # API代理 + location /api { + proxy_pass http://localhost:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # 静态资源缓存 + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # Gzip压缩 + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json; +} +``` + +#### HTTPS配置 + +```nginx +server { + listen 443 ssl http2; + server_name admin.emotion-museum.com; + + ssl_certificate /path/to/cert.pem; + ssl_certificate_key /path/to/key.pem; + + root /var/www/web-admin/dist; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api { + proxy_pass http://localhost:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} + +# HTTP重定向到HTTPS +server { + listen 80; + server_name admin.emotion-museum.com; + return 301 https://$server_name$request_uri; +} +``` + +### 3. 部署步骤 + +#### 方式1: 手动部署 + +```bash +# 1. 构建项目 +cd web-admin +npm run build + +# 2. 上传dist目录到服务器 +scp -r dist/* user@server:/var/www/web-admin/ + +# 3. 配置Nginx +sudo cp nginx.conf /etc/nginx/sites-available/admin.emotion-museum.com +sudo ln -s /etc/nginx/sites-available/admin.emotion-museum.com /etc/nginx/sites-enabled/ + +# 4. 测试Nginx配置 +sudo nginx -t + +# 5. 重启Nginx +sudo systemctl restart nginx +``` + +#### 方式2: 使用部署脚本 + +创建 `deploy.sh`: + +```bash +#!/bin/bash + +echo "开始部署管理后台..." + +# 构建项目 +echo "1. 构建项目..." +cd web-admin +npm install +npm run build + +# 备份旧版本 +echo "2. 备份旧版本..." +ssh user@server "cd /var/www && mv web-admin web-admin.backup.$(date +%Y%m%d%H%M%S)" + +# 上传新版本 +echo "3. 上传新版本..." +scp -r dist user@server:/var/www/web-admin + +# 重启Nginx +echo "4. 重启Nginx..." +ssh user@server "sudo systemctl restart nginx" + +echo "部署完成!" +``` + +### 4. 环境变量配置 + +生产环境需要修改 `.env.production`: + +```env +VITE_APP_TITLE=情绪博物馆管理后台 +VITE_APP_BASE_API=https://api.emotion-museum.com/api +``` + +## Docker部署 + +### 1. 创建Dockerfile + +```dockerfile +# 构建阶段 +FROM node:18-alpine as build-stage + +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . +RUN npm run build + +# 生产阶段 +FROM nginx:alpine as production-stage + +COPY --from=build-stage /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] +``` + +### 2. 创建nginx.conf + +```nginx +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api { + proxy_pass http://backend:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } +} +``` + +### 3. 构建和运行 + +```bash +# 构建镜像 +docker build -t emotion-admin:latest . + +# 运行容器 +docker run -d -p 80:80 --name emotion-admin emotion-admin:latest +``` + +### 4. Docker Compose + +创建 `docker-compose.yml`: + +```yaml +version: '3.8' + +services: + admin: + build: . + ports: + - "80:80" + depends_on: + - backend + networks: + - emotion-network + + backend: + image: emotion-backend:latest + ports: + - "8080:8080" + networks: + - emotion-network + +networks: + emotion-network: + driver: bridge +``` + +运行: + +```bash +docker-compose up -d +``` + +## 性能优化 + +### 1. 代码分割 + +Vite自动进行代码分割,无需额外配置。 + +### 2. 资源压缩 + +生产构建时自动压缩: + +```typescript +// vite.config.ts +build: { + minify: 'terser', + terserOptions: { + compress: { + drop_console: true, + drop_debugger: true + } + } +} +``` + +### 3. CDN加速 + +将静态资源上传到CDN: + +```typescript +// vite.config.ts +build: { + rollupOptions: { + output: { + manualChunks: { + 'element-plus': ['element-plus'], + 'vue': ['vue', 'vue-router', 'pinia'] + } + } + } +} +``` + +## 监控和日志 + +### 1. Nginx访问日志 + +```nginx +access_log /var/log/nginx/admin.access.log; +error_log /var/log/nginx/admin.error.log; +``` + +### 2. 前端错误监控 + +可以集成Sentry等错误监控服务: + +```typescript +// main.ts +import * as Sentry from "@sentry/vue" + +Sentry.init({ + app, + dsn: "YOUR_SENTRY_DSN", + environment: import.meta.env.MODE +}) +``` + +## 安全建议 + +1. **使用HTTPS**: 生产环境必须使用HTTPS +2. **修改默认密码**: 部署后立即修改默认管理员密码 +3. **限制访问**: 可以配置IP白名单 +4. **定期更新**: 及时更新依赖包 +5. **备份数据**: 定期备份数据库和配置文件 + +## 故障排查 + +### 1. 页面空白 + +- 检查Nginx配置是否正确 +- 检查静态文件是否上传成功 +- 查看浏览器控制台错误 + +### 2. API请求失败 + +- 检查后端服务是否启动 +- 检查Nginx代理配置 +- 检查跨域配置 + +### 3. 路由404 + +- 确保Nginx配置了 `try_files $uri $uri/ /index.html` +- 检查路由模式是否为history + +## 回滚方案 + +如果部署出现问题,可以快速回滚: + +```bash +# 恢复备份 +ssh user@server "cd /var/www && rm -rf web-admin && mv web-admin.backup.YYYYMMDDHHMMSS web-admin" + +# 重启Nginx +ssh user@server "sudo systemctl restart nginx" +``` + +## 持续集成/持续部署 (CI/CD) + +### GitHub Actions示例 + +创建 `.github/workflows/deploy.yml`: + +```yaml +name: Deploy Admin + +on: + push: + branches: [ main ] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install dependencies + run: | + cd web-admin + npm install + + - name: Build + run: | + cd web-admin + npm run build + + - name: Deploy to server + uses: easingthemes/ssh-deploy@v2 + with: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + REMOTE_HOST: ${{ secrets.REMOTE_HOST }} + REMOTE_USER: ${{ secrets.REMOTE_USER }} + SOURCE: "web-admin/dist/" + TARGET: "/var/www/web-admin/" +``` + +## 总结 + +按照以上步骤,你可以成功部署管理后台到生产环境。记得: + +1. ✅ 修改默认密码 +2. ✅ 配置HTTPS +3. ✅ 设置监控和日志 +4. ✅ 定期备份 +5. ✅ 及时更新依赖 diff --git a/docs/web-admin-design.md b/docs/web-admin-design.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/web-admin-guide.md b/docs/web-admin-guide.md new file mode 100644 index 0000000..d8371cd --- /dev/null +++ b/docs/web-admin-guide.md @@ -0,0 +1,312 @@ +# 管理后台前端开发指南 + +## 项目概述 + +情绪博物馆管理后台是一个基于 Vue 3 + TypeScript + Element Plus 的现代化管理系统,用于管理系统的管理员、用户和数据。 + +## 快速开始 + +### 1. 安装依赖 + +```bash +cd web-admin +npm install +``` + +### 2. 启动开发服务器 + +```bash +npm run dev +``` + +访问 http://localhost:5174 + +### 3. 登录系统 + +使用默认账号登录: +- 账号: admin +- 密码: admin123 + +## 项目结构 + +``` +web-admin/ +├── src/ +│ ├── api/ # API接口定义 +│ │ ├── admin.ts # 管理员API +│ │ ├── auth.ts # 认证API +│ │ └── user.ts # 用户API +│ ├── layouts/ # 布局组件 +│ │ └── Layout.vue # 主布局 +│ ├── router/ # 路由配置 +│ │ └── index.ts # 路由定义 +│ ├── stores/ # 状态管理 +│ │ ├── index.ts # Pinia实例 +│ │ └── admin.ts # 管理员状态 +│ ├── types/ # TypeScript类型 +│ │ ├── admin.ts # 管理员类型 +│ │ ├── common.ts # 通用类型 +│ │ ├── env.d.ts # 环境变量类型 +│ │ └── user.ts # 用户类型 +│ ├── utils/ # 工具函数 +│ │ ├── request.ts # Axios封装 +│ │ ├── storage.ts # 本地存储 +│ │ └── validate.ts # 表单验证 +│ ├── views/ # 页面组件 +│ │ ├── admin/ # 管理员管理 +│ │ │ └── AdminList.vue +│ │ ├── user/ # 用户管理 +│ │ │ └── UserList.vue +│ │ ├── Dashboard.vue # 仪表盘 +│ │ ├── Login.vue # 登录页 +│ │ └── NotFound.vue # 404页面 +│ ├── App.vue # 根组件 +│ └── main.ts # 入口文件 +├── .env.development # 开发环境配置 +├── .env.production # 生产环境配置 +├── index.html # HTML模板 +├── package.json # 项目配置 +├── tsconfig.json # TypeScript配置 +└── vite.config.ts # Vite配置 +``` + +## 核心功能 + +### 1. 登录认证 + +登录流程: +1. 用户输入账号密码 +2. 调用登录API +3. 保存Token到localStorage +4. 保存管理员信息到Pinia +5. 跳转到仪表盘 + +代码示例: +```typescript +// stores/admin.ts +const login = async (loginForm: AdminLoginRequest) => { + const res = await loginApi(loginForm) + token.value = res.data.accessToken + adminInfo.value = res.data.adminInfo + localStorage.setItem('adminToken', res.data.accessToken) + router.push('/') +} +``` + +### 2. 路由守卫 + +所有路由都需要登录才能访问(除了登录页): + +```typescript +// router/index.ts +router.beforeEach((to, from, next) => { + const token = localStorage.getItem('adminToken') + + if (to.path === '/login') { + if (token) { + next('/') + } else { + next() + } + } else { + if (token) { + next() + } else { + next('/login') + } + } +}) +``` + +### 3. API请求拦截 + +自动添加Token到请求头: + +```typescript +// utils/request.ts +service.interceptors.request.use((config) => { + const token = localStorage.getItem('adminToken') + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + return config +}) +``` + +### 4. 响应拦截 + +统一处理错误: + +```typescript +service.interceptors.response.use( + (response) => { + const res = response.data + if (res.code !== 200) { + ElMessage.error(res.message) + if (res.code === 401) { + router.push('/login') + } + return Promise.reject(new Error(res.message)) + } + return res + }, + (error) => { + // 错误处理 + } +) +``` + +## 开发规范 + +### 1. 命名规范 + +- 组件名:PascalCase (如 AdminList.vue) +- 文件名:kebab-case (如 admin-list.ts) +- 变量名:camelCase (如 adminInfo) +- 常量名:UPPER_CASE (如 API_BASE_URL) + +### 2. 类型定义 + +所有API接口都应该有类型定义: + +```typescript +// types/admin.ts +export interface Admin { + id: string + account: string + username: string + // ... +} + +export interface AdminPageRequest { + current: number + size: number + // ... +} +``` + +### 3. API调用 + +使用封装的request工具: + +```typescript +// api/admin.ts +export function getAdminPage(params: AdminPageRequest) { + return request>>({ + url: '/admin/page', + method: 'get', + params + }) +} +``` + +### 4. 状态管理 + +使用Pinia进行状态管理: + +```typescript +// stores/admin.ts +export const useAdminStore = defineStore('admin', () => { + const token = ref('') + const adminInfo = ref(null) + + const login = async (loginForm: AdminLoginRequest) => { + // ... + } + + return { token, adminInfo, login } +}) +``` + +## 常见问题 + +### 1. Token过期处理 + +Token过期时会自动跳转到登录页,用户需要重新登录。 + +### 2. 跨域问题 + +开发环境通过Vite代理解决: + +```typescript +// vite.config.ts +server: { + proxy: { + '/api': { + target: 'http://localhost:8080', + changeOrigin: true + } + } +} +``` + +### 3. 构建优化 + +生产环境构建时会自动进行代码分割和压缩: + +```bash +npm run build +``` + +## 部署 + +### 1. 构建 + +```bash +npm run build +``` + +### 2. Nginx配置 + +```nginx +server { + listen 80; + server_name admin.emotion-museum.com; + + root /var/www/web-admin/dist; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api { + proxy_pass http://localhost:8080; + } +} +``` + +### 3. 环境变量 + +生产环境需要配置正确的API地址: + +``` +VITE_APP_BASE_API=https://api.emotion-museum.com +``` + +## 扩展功能 + +### 添加新页面 + +1. 在 `views` 目录创建新组件 +2. 在 `router/index.ts` 添加路由 +3. 在布局组件的菜单中添加入口 + +### 添加新API + +1. 在 `types` 目录定义类型 +2. 在 `api` 目录创建API函数 +3. 在组件中调用API + +### 添加新状态 + +1. 在 `stores` 目录创建新的store +2. 在组件中使用store + +## 技术支持 + +如有问题,请查看: +- [Vue 3 文档](https://cn.vuejs.org/) +- [Element Plus 文档](https://element-plus.org/) +- [TypeScript 文档](https://www.typescriptlang.org/) +- [Vite 文档](https://cn.vitejs.dev/) diff --git a/docs/web-admin-summary.md b/docs/web-admin-summary.md new file mode 100644 index 0000000..e69de29 diff --git a/backend-single/src/main/resources/sql/mysql_emotion_museum_final.sql b/sql/emotion_museum.sql similarity index 94% rename from backend-single/src/main/resources/sql/mysql_emotion_museum_final.sql rename to sql/emotion_museum.sql index 7343cc4..462cf8f 100644 --- a/backend-single/src/main/resources/sql/mysql_emotion_museum_final.sql +++ b/sql/emotion_museum.sql @@ -74,6 +74,8 @@ DROP TABLE IF EXISTS t_diary_comment; DROP TABLE IF EXISTS t_user; +DROP TABLE IF EXISTS t_admin; + -- ============================================================================ -- 1. 用户表 (user) -- ============================================================================ @@ -850,6 +852,66 @@ CREATE INDEX idx_guest_user_create_by ON t_guest_user (create_by); CREATE INDEX idx_guest_user_update_by ON t_guest_user (update_by); CREATE INDEX idx_guest_user_is_deleted ON t_guest_user (is_deleted); +-- ============================================================================ +-- 18. 管理员用户表 (admin) +-- ============================================================================ +CREATE TABLE t_admin ( + id VARCHAR(64) PRIMARY KEY COMMENT 'UUID主键', -- UUID主键 + account VARCHAR(50) NOT NULL UNIQUE COMMENT '管理员账号', -- 管理员账号 + password VARCHAR(255) NOT NULL COMMENT '密码(加密后)', -- 密码(加密后) + username VARCHAR(50) NOT NULL COMMENT '管理员姓名', -- 管理员姓名 + email VARCHAR(100) UNIQUE COMMENT '邮箱', -- 邮箱 + phone VARCHAR(20) UNIQUE COMMENT '手机号', -- 手机号 + avatar VARCHAR(500) COMMENT '头像URL', -- 头像URL + role VARCHAR(20) NOT NULL DEFAULT 'admin' COMMENT '角色: super_admin-超级管理员, admin-管理员, operator-运营', -- 角色: super_admin-超级管理员, admin-管理员, operator-运营 + permissions JSON COMMENT '权限列表', -- 权限列表 + status TINYINT NOT NULL DEFAULT 1 COMMENT '状态: 0-禁用, 1-正常', -- 状态: 0-禁用, 1-正常 + last_login_time DATETIME COMMENT '最后登录时间', -- 最后登录时间 + last_login_ip VARCHAR(45) COMMENT '最后登录IP (支持IPv6)', -- 最后登录IP (支持IPv6) + login_count INT DEFAULT 0 COMMENT '登录次数', -- 登录次数 + department VARCHAR(50) COMMENT '所属部门', -- 所属部门 + position VARCHAR(50) COMMENT '职位', -- 职位 + -- 公共字段 + create_by VARCHAR(64) COMMENT '创建人ID', -- 创建人ID + create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', -- 创建时间 + update_by VARCHAR(64) COMMENT '更新人ID', -- 更新人ID + update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', -- 更新时间 + is_deleted TINYINT NOT NULL DEFAULT 0 COMMENT '是否删除: 0-未删除, 1-已删除', -- 是否删除: 0-未删除, 1-已删除 + remarks VARCHAR(500) COMMENT '备注' -- 备注 +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '管理员用户表 (t_admin)'; + +-- 管理员表索引 +CREATE INDEX idx_admin_account ON t_admin (account); +CREATE INDEX idx_admin_email ON t_admin (email); +CREATE INDEX idx_admin_phone ON t_admin (phone); +CREATE INDEX idx_admin_role ON t_admin (role); +CREATE INDEX idx_admin_status ON t_admin (status); +CREATE INDEX idx_admin_create_time ON t_admin (create_time); +CREATE INDEX idx_admin_update_time ON t_admin (update_time); +CREATE INDEX idx_admin_is_deleted ON t_admin (is_deleted); + +-- 初始化管理员数据 +-- 默认超级管理员账号: admin, 密码: admin123 (BCrypt加密后) +INSERT INTO t_admin (id, account, password, username, email, phone, avatar, role, permissions, status, login_count, department, position, create_time, update_time, is_deleted) +VALUES ( + REPLACE(UUID(), '-', ''), + 'admin', + '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z2EHCYAKMRgAXMqV.N8VXXxu', + '系统管理员', + 'admin@emotion-museum.com', + '13800138000', + NULL, + 'super_admin', + '["*"]', + 1, + 0, + '技术部', + '系统管理员', + NOW(), + NOW(), + 0 +); + -- ============================================================================ -- 数据库统计信息 -- ============================================================================ diff --git a/web-admin/.env.development b/web-admin/.env.development new file mode 100644 index 0000000..96129bc --- /dev/null +++ b/web-admin/.env.development @@ -0,0 +1,4 @@ +# 开发环境配置 +VITE_APP_TITLE=情绪博物馆管理后台 +VITE_APP_BASE_API=/api +VITE_APP_PORT=5174 diff --git a/web-admin/.env.production b/web-admin/.env.production new file mode 100644 index 0000000..f7877ed --- /dev/null +++ b/web-admin/.env.production @@ -0,0 +1,3 @@ +# 生产环境配置 +VITE_APP_TITLE=情绪博物馆管理后台 +VITE_APP_BASE_API=/api diff --git a/web-admin/.gitignore b/web-admin/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/web-admin/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/web-admin/README.md b/web-admin/README.md new file mode 100644 index 0000000..3792bc1 --- /dev/null +++ b/web-admin/README.md @@ -0,0 +1,149 @@ +# 情绪博物馆管理后台 + +基于 Vue 3 + TypeScript + Element Plus 的管理后台系统 + +## 功能特性 + +- ✅ 管理员登录认证 +- ✅ 后台布局(侧边栏+顶栏) +- ✅ 管理员管理(CRUD) +- ✅ 用户管理 +- ✅ 仪表盘数据展示 +- ✅ 权限控制 +- ✅ API集成 + +## 技术栈 + +- Vue 3 +- TypeScript +- Element Plus +- Vue Router +- Pinia +- Axios +- ECharts +- Vite + +## 快速开始 + +### 安装依赖 + +```bash +npm install +``` + +### 开发环境运行 + +```bash +npm run dev +``` + +访问: http://localhost:5174 + +### 生产环境构建 + +```bash +npm run build +``` + +### 类型检查 + +```bash +npm run type-check +``` + +## 默认账号 + +- 账号: admin +- 密码: admin123 + +## 项目结构 + +``` +web-admin/ +├── src/ +│ ├── api/ # API接口 +│ ├── assets/ # 静态资源 +│ ├── layouts/ # 布局组件 +│ ├── router/ # 路由配置 +│ ├── stores/ # 状态管理 +│ ├── types/ # TypeScript类型 +│ ├── utils/ # 工具函数 +│ ├── views/ # 页面组件 +│ ├── App.vue # 根组件 +│ └── main.ts # 入口文件 +├── index.html # HTML模板 +├── package.json # 项目配置 +├── tsconfig.json # TypeScript配置 +└── vite.config.ts # Vite配置 +``` + +## 环境变量 + +### 开发环境 (.env.development) +``` +VITE_APP_TITLE=情绪博物馆管理后台 +VITE_APP_BASE_API=/api +VITE_APP_PORT=5174 +``` + +### 生产环境 (.env.production) +``` +VITE_APP_TITLE=情绪博物馆管理后台 +VITE_APP_BASE_API=/api +``` + +## API接口 + +后端API地址: http://localhost:8080/api + +### 管理员认证 +- POST /admin/auth/login - 登录 +- GET /admin/auth/info - 获取当前管理员信息 +- POST /admin/auth/logout - 登出 + +### 管理员管理 +- GET /admin/page - 分页查询 +- GET /admin/detail - 查询详情 +- POST /admin/create - 创建管理员 +- PUT /admin/update - 更新管理员 +- DELETE /admin/delete - 删除管理员 + +### 用户管理 +- GET /user/page - 分页查询 +- GET /user/detail - 查询详情 +- PUT /user/updateStatus - 更新状态 + +## 部署 + +### Nginx配置示例 + +```nginx +server { + listen 80; + server_name admin.emotion-museum.com; + + root /var/www/web-admin/dist; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api { + proxy_pass http://localhost:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } +} +``` + +## 注意事项 + +1. 确保后端服务已启动 +2. 确保Redis服务正常运行 +3. 生产环境请修改默认管理员密码 +4. 建议使用HTTPS部署 + +## License + +MIT diff --git a/web-admin/index.html b/web-admin/index.html new file mode 100644 index 0000000..fa18385 --- /dev/null +++ b/web-admin/index.html @@ -0,0 +1,13 @@ + + + + + + + 情绪博物馆管理后台 + + +
+ + + diff --git a/web-admin/package.json b/web-admin/package.json new file mode 100644 index 0000000..a34e84f --- /dev/null +++ b/web-admin/package.json @@ -0,0 +1,36 @@ +{ + "name": "emotion-museum-admin", + "version": "1.0.0", + "description": "情绪博物馆管理后台", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc && vite build", + "preview": "vite preview", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "type-check": "vue-tsc --noEmit" + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.1", + "axios": "^1.6.2", + "dayjs": "^1.11.10", + "echarts": "^5.4.3", + "element-plus": "^2.4.4", + "pinia": "^2.1.7", + "vue": "^3.4.0", + "vue-echarts": "^6.6.1", + "vue-router": "^4.2.5" + }, + "devDependencies": { + "@types/node": "^20.10.5", + "@typescript-eslint/eslint-plugin": "^6.15.0", + "@typescript-eslint/parser": "^6.15.0", + "@vitejs/plugin-vue": "^4.5.2", + "eslint": "^8.56.0", + "eslint-plugin-vue": "^9.19.2", + "sass": "^1.69.5", + "typescript": "^5.3.3", + "vite": "^5.0.8", + "vue-tsc": "^2.0.0" + } +} diff --git a/web-admin/src/App.vue b/web-admin/src/App.vue new file mode 100644 index 0000000..0a00084 --- /dev/null +++ b/web-admin/src/App.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/web-admin/src/api/admin.ts b/web-admin/src/api/admin.ts new file mode 100644 index 0000000..4602a4c --- /dev/null +++ b/web-admin/src/api/admin.ts @@ -0,0 +1,53 @@ +import request from '@/utils/request' +import type { + AdminPageRequest, + AdminCreateRequest, + AdminUpdateRequest, + Admin +} from '@/types/admin' +import type { ApiResponse, PageResult } from '@/types/common' + +// 分页查询管理员 +export function getAdminPage(params: AdminPageRequest) { + return request>>({ + url: '/admin/page', + method: 'get', + params + }) +} + +// 根据ID获取管理员 +export function getAdminById(id: string) { + return request>({ + url: '/admin/detail', + method: 'get', + params: { id } + }) +} + +// 创建管理员 +export function createAdmin(data: AdminCreateRequest) { + return request>({ + url: '/admin/create', + method: 'post', + data + }) +} + +// 更新管理员 +export function updateAdmin(data: AdminUpdateRequest) { + return request>({ + url: '/admin/update', + method: 'put', + data + }) +} + +// 删除管理员 +export function deleteAdmin(id: string) { + return request>({ + url: '/admin/delete', + method: 'delete', + params: { id } + }) +} diff --git a/web-admin/src/api/auth.ts b/web-admin/src/api/auth.ts new file mode 100644 index 0000000..32aec1d --- /dev/null +++ b/web-admin/src/api/auth.ts @@ -0,0 +1,37 @@ +import request from '@/utils/request' +import type { AdminLoginRequest, AdminAuthResponse } from '@/types/admin' +import type { ApiResponse } from '@/types/common' + +// 管理员登录 +export function login(data: AdminLoginRequest) { + return request>({ + url: '/admin/auth/login', + method: 'post', + data + }) +} + +// 获取当前管理员信息 +export function getAdminInfo() { + return request({ + url: '/admin/auth/info', + method: 'get' + }) +} + +// 管理员登出 +export function logout() { + return request({ + url: '/admin/auth/logout', + method: 'post' + }) +} + +// 刷新Token +export function refreshToken(refreshToken: string) { + return request({ + url: '/admin/auth/refreshToken', + method: 'post', + data: { refreshToken } + }) +} diff --git a/web-admin/src/api/user.ts b/web-admin/src/api/user.ts new file mode 100644 index 0000000..473c199 --- /dev/null +++ b/web-admin/src/api/user.ts @@ -0,0 +1,30 @@ +import request from '@/utils/request' +import type { UserPageRequest, User } from '@/types/user' +import type { ApiResponse, PageResult } from '@/types/common' + +// 分页查询用户 +export function getUserPage(params: UserPageRequest) { + return request>>({ + url: '/user/page', + method: 'get', + params + }) +} + +// 根据ID获取用户 +export function getUserById(id: string) { + return request>({ + url: '/user/detail', + method: 'get', + params: { id } + }) +} + +// 更新用户状态 +export function updateUserStatus(id: string, status: number) { + return request>({ + url: '/user/updateStatus', + method: 'put', + data: { id, status } + }) +} diff --git a/web-admin/src/layouts/Layout.vue b/web-admin/src/layouts/Layout.vue new file mode 100644 index 0000000..1e8ea73 --- /dev/null +++ b/web-admin/src/layouts/Layout.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/web-admin/src/main.ts b/web-admin/src/main.ts new file mode 100644 index 0000000..05dcea8 --- /dev/null +++ b/web-admin/src/main.ts @@ -0,0 +1,20 @@ +import { createApp } from 'vue' +import ElementPlus from 'element-plus' +import 'element-plus/dist/index.css' +import * as ElementPlusIconsVue from '@element-plus/icons-vue' +import App from './App.vue' +import router from './router' +import pinia from './stores' + +const app = createApp(App) + +// 注册所有图标 +for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) +} + +app.use(ElementPlus) +app.use(router) +app.use(pinia) + +app.mount('#app') diff --git a/web-admin/src/router/index.ts b/web-admin/src/router/index.ts new file mode 100644 index 0000000..7be8f82 --- /dev/null +++ b/web-admin/src/router/index.ts @@ -0,0 +1,84 @@ +import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' +import Layout from '@/layouts/Layout.vue' + +const routes: RouteRecordRaw[] = [ + { + path: '/login', + name: 'Login', + component: () => import('@/views/Login.vue'), + meta: { title: '登录', hidden: true } + }, + { + path: '/', + component: Layout, + redirect: '/dashboard', + children: [ + { + path: 'dashboard', + name: 'Dashboard', + component: () => import('@/views/Dashboard.vue'), + meta: { title: '仪表盘', icon: 'DataLine' } + } + ] + }, + { + path: '/admin', + component: Layout, + redirect: '/admin/list', + meta: { title: '管理员管理', icon: 'User' }, + children: [ + { + path: 'list', + name: 'AdminList', + component: () => import('@/views/admin/AdminList.vue'), + meta: { title: '管理员列表', icon: 'User' } + } + ] + }, + { + path: '/user', + component: Layout, + redirect: '/user/list', + meta: { title: '用户管理', icon: 'UserFilled' }, + children: [ + { + path: 'list', + name: 'UserList', + component: () => import('@/views/user/UserList.vue'), + meta: { title: '用户列表', icon: 'UserFilled' } + } + ] + }, + { + path: '/:pathMatch(.*)*', + name: 'NotFound', + component: () => import('@/views/NotFound.vue'), + meta: { title: '404', hidden: true } + } +] + +const router = createRouter({ + history: createWebHistory(), + routes +}) + +// 路由守卫 +router.beforeEach((to, from, next) => { + const token = localStorage.getItem('adminToken') + + if (to.path === '/login') { + if (token) { + next('/') + } else { + next() + } + } else { + if (token) { + next() + } else { + next('/login') + } + } +}) + +export default router diff --git a/web-admin/src/stores/admin.ts b/web-admin/src/stores/admin.ts new file mode 100644 index 0000000..ffdc3bc --- /dev/null +++ b/web-admin/src/stores/admin.ts @@ -0,0 +1,79 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' +import type { Admin, AdminLoginRequest } from '@/types/admin' +import { login as loginApi, logout as logoutApi, getAdminInfo } from '@/api/auth' +import { ElMessage } from 'element-plus' +import router from '@/router' + +export const useAdminStore = defineStore('admin', () => { + const token = ref(localStorage.getItem('adminToken') || '') + const adminInfo = ref(null) + + // 登录 + const login = async (loginForm: AdminLoginRequest) => { + try { + const res = await loginApi(loginForm) + token.value = res.data.accessToken + adminInfo.value = res.data.adminInfo + + localStorage.setItem('adminToken', res.data.accessToken) + localStorage.setItem('adminRefreshToken', res.data.refreshToken) + localStorage.setItem('adminInfo', JSON.stringify(res.data.adminInfo)) + + ElMessage.success('登录成功') + router.push('/') + } catch (error) { + console.error('登录失败:', error) + throw error + } + } + + // 获取管理员信息 + const fetchAdminInfo = async () => { + try { + const res = await getAdminInfo() + adminInfo.value = res.data + localStorage.setItem('adminInfo', JSON.stringify(res.data)) + } catch (error) { + console.error('获取管理员信息失败:', error) + throw error + } + } + + // 登出 + const logout = async () => { + try { + await logoutApi() + } catch (error) { + console.error('登出失败:', error) + } finally { + token.value = '' + adminInfo.value = null + localStorage.removeItem('adminToken') + localStorage.removeItem('adminRefreshToken') + localStorage.removeItem('adminInfo') + router.push('/login') + } + } + + // 初始化管理员信息 + const initAdminInfo = () => { + const storedInfo = localStorage.getItem('adminInfo') + if (storedInfo) { + try { + adminInfo.value = JSON.parse(storedInfo) + } catch (error) { + console.error('解析管理员信息失败:', error) + } + } + } + + return { + token, + adminInfo, + login, + logout, + fetchAdminInfo, + initAdminInfo + } +}) diff --git a/web-admin/src/stores/index.ts b/web-admin/src/stores/index.ts new file mode 100644 index 0000000..8a05980 --- /dev/null +++ b/web-admin/src/stores/index.ts @@ -0,0 +1,5 @@ +import { createPinia } from 'pinia' + +const pinia = createPinia() + +export default pinia diff --git a/web-admin/src/types/admin.ts b/web-admin/src/types/admin.ts new file mode 100644 index 0000000..745e915 --- /dev/null +++ b/web-admin/src/types/admin.ts @@ -0,0 +1,72 @@ +// 管理员相关类型定义 + +export interface Admin { + id: string + account: string + username: string + email?: string + phone?: string + avatar?: string + role: 'super_admin' | 'admin' | 'operator' + permissions?: string + status: number + lastLoginTime?: string + lastLoginIp?: string + loginCount?: number + department?: string + position?: string + createTime?: string + updateTime?: string +} + +export interface AdminLoginRequest { + account: string + password: string +} + +export interface AdminAuthResponse { + accessToken: string + refreshToken: string + expiresIn: number + adminInfo: Admin + loginTime: string +} + +export interface AdminPageRequest { + current: number + size: number + account?: string + username?: string + email?: string + phone?: string + role?: string + status?: number + department?: string + keyword?: string +} + +export interface AdminCreateRequest { + account: string + password: string + username: string + email?: string + phone?: string + avatar?: string + role: string + permissions?: string + department?: string + position?: string +} + +export interface AdminUpdateRequest { + id: string + username?: string + email?: string + phone?: string + avatar?: string + role?: string + permissions?: string + status?: number + department?: string + position?: string +} diff --git a/web-admin/src/types/common.ts b/web-admin/src/types/common.ts new file mode 100644 index 0000000..76faf48 --- /dev/null +++ b/web-admin/src/types/common.ts @@ -0,0 +1,29 @@ +// 通用类型定义 + +export interface ApiResponse { + code: number + message: string + data: T + timestamp: number +} + +export interface PageResult { + records: T[] + total: number + current: number + size: number + pages: number +} + +export interface MenuItem { + path: string + name: string + icon?: string + children?: MenuItem[] + meta?: { + title: string + icon?: string + roles?: string[] + hidden?: boolean + } +} diff --git a/web-admin/src/types/env.d.ts b/web-admin/src/types/env.d.ts new file mode 100644 index 0000000..0bb3166 --- /dev/null +++ b/web-admin/src/types/env.d.ts @@ -0,0 +1,17 @@ +/// + +interface ImportMetaEnv { + readonly VITE_APP_TITLE: string + readonly VITE_APP_BASE_API: string + readonly VITE_APP_PORT: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} + +declare module '*.vue' { + import type { DefineComponent } from 'vue' + const component: DefineComponent<{}, {}, any> + export default component +} diff --git a/web-admin/src/types/user.ts b/web-admin/src/types/user.ts new file mode 100644 index 0000000..1672c14 --- /dev/null +++ b/web-admin/src/types/user.ts @@ -0,0 +1,29 @@ +// 用户相关类型定义 + +export interface User { + id: string + account: string + username: string + email?: string + phone?: string + avatar?: string + nickname?: string + status: number + memberLevel?: string + totalDays?: number + lastActiveTime?: string + createTime?: string + updateTime?: string +} + +export interface UserPageRequest { + current: number + size: number + account?: string + username?: string + email?: string + phone?: string + status?: number + memberLevel?: string + keyword?: string +} diff --git a/web-admin/src/utils/request.ts b/web-admin/src/utils/request.ts new file mode 100644 index 0000000..3db4849 --- /dev/null +++ b/web-admin/src/utils/request.ts @@ -0,0 +1,74 @@ +import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios' +import { ElMessage } from 'element-plus' +import router from '@/router' + +const service: AxiosInstance = axios.create({ + baseURL: import.meta.env.VITE_APP_BASE_API, + timeout: 15000 +}) + +// 请求拦截器 +service.interceptors.request.use( + (config) => { + const token = localStorage.getItem('adminToken') + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + return config + }, + (error) => { + console.error('请求错误:', error) + return Promise.reject(error) + } +) + +// 响应拦截器 +service.interceptors.response.use( + (response: AxiosResponse) => { + const res = response.data + + if (res.code !== 200) { + ElMessage.error(res.message || '请求失败') + + if (res.code === 401) { + localStorage.removeItem('adminToken') + localStorage.removeItem('adminInfo') + router.push('/login') + } + + return Promise.reject(new Error(res.message || '请求失败')) + } + + return res + }, + (error) => { + console.error('响应错误:', error) + + if (error.response) { + const { status, data } = error.response + + if (status === 401) { + ElMessage.error('未登录或登录已过期') + localStorage.removeItem('adminToken') + localStorage.removeItem('adminInfo') + router.push('/login') + } else if (status === 403) { + ElMessage.error('无权限访问') + } else if (status === 404) { + ElMessage.error('请求的资源不存在') + } else if (status === 500) { + ElMessage.error(data?.message || '服务器错误') + } else { + ElMessage.error(data?.message || '请求失败') + } + } else if (error.request) { + ElMessage.error('网络错误,请检查网络连接') + } else { + ElMessage.error('请求配置错误') + } + + return Promise.reject(error) + } +) + +export default service diff --git a/web-admin/src/utils/storage.ts b/web-admin/src/utils/storage.ts new file mode 100644 index 0000000..ea7b4f7 --- /dev/null +++ b/web-admin/src/utils/storage.ts @@ -0,0 +1,25 @@ +// 本地存储工具 + +export const storage = { + get(key: string) { + const value = localStorage.getItem(key) + if (!value) return null + try { + return JSON.parse(value) + } catch { + return value + } + }, + + set(key: string, value: any) { + localStorage.setItem(key, JSON.stringify(value)) + }, + + remove(key: string) { + localStorage.removeItem(key) + }, + + clear() { + localStorage.clear() + } +} diff --git a/web-admin/src/utils/validate.ts b/web-admin/src/utils/validate.ts new file mode 100644 index 0000000..ecae347 --- /dev/null +++ b/web-admin/src/utils/validate.ts @@ -0,0 +1,41 @@ +// 表单验证规则 + +export const validateAccount = (rule: any, value: string, callback: any) => { + if (!value) { + callback(new Error('请输入账号')) + } else if (value.length < 3 || value.length > 50) { + callback(new Error('账号长度必须在3-50个字符之间')) + } else { + callback() + } +} + +export const validatePassword = (rule: any, value: string, callback: any) => { + if (!value) { + callback(new Error('请输入密码')) + } else if (value.length < 6 || value.length > 20) { + callback(new Error('密码长度必须在6-20个字符之间')) + } else { + callback() + } +} + +export const validateEmail = (rule: any, value: string, callback: any) => { + if (!value) { + callback() + } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) { + callback(new Error('邮箱格式不正确')) + } else { + callback() + } +} + +export const validatePhone = (rule: any, value: string, callback: any) => { + if (!value) { + callback() + } else if (!/^1[3-9]\d{9}$/.test(value)) { + callback(new Error('手机号格式不正确')) + } else { + callback() + } +} diff --git a/web-admin/src/views/Dashboard.vue b/web-admin/src/views/Dashboard.vue new file mode 100644 index 0000000..2996761 --- /dev/null +++ b/web-admin/src/views/Dashboard.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/web-admin/src/views/Login.vue b/web-admin/src/views/Login.vue new file mode 100644 index 0000000..7dbfea8 --- /dev/null +++ b/web-admin/src/views/Login.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/web-admin/src/views/NotFound.vue b/web-admin/src/views/NotFound.vue new file mode 100644 index 0000000..057574d --- /dev/null +++ b/web-admin/src/views/NotFound.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/web-admin/src/views/admin/AdminList.vue b/web-admin/src/views/admin/AdminList.vue new file mode 100644 index 0000000..30e2582 --- /dev/null +++ b/web-admin/src/views/admin/AdminList.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/web-admin/src/views/user/UserList.vue b/web-admin/src/views/user/UserList.vue new file mode 100644 index 0000000..26cf741 --- /dev/null +++ b/web-admin/src/views/user/UserList.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/web-admin/start.bat b/web-admin/start.bat new file mode 100644 index 0000000..7b39201 --- /dev/null +++ b/web-admin/start.bat @@ -0,0 +1,43 @@ +@echo off +echo ======================================== +echo 情绪博物馆管理后台启动脚本 +echo ======================================== +echo. + +echo 检查 Node.js 是否已安装... +node -v >nul 2>&1 +if %errorlevel% neq 0 ( + echo 错误: 未检测到 Node.js,请先安装 Node.js + echo 下载地址: https://nodejs.org/ + pause + exit /b 1 +) + +echo Node.js 版本: +node -v +echo. + +echo 检查依赖是否已安装... +if not exist "node_modules" ( + echo 依赖未安装,开始安装依赖... + call npm install + if %errorlevel% neq 0 ( + echo 依赖安装失败! + pause + exit /b 1 + ) + echo 依赖安装完成! + echo. +) + +echo 启动开发服务器... +echo 访问地址: http://localhost:5174 +echo 默认账号: admin +echo 默认密码: admin123 +echo. +echo 按 Ctrl+C 停止服务器 +echo. + +call npm run dev + +pause diff --git a/web-admin/tsconfig.json b/web-admin/tsconfig.json new file mode 100644 index 0000000..4e5ea1b --- /dev/null +++ b/web-admin/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/web-admin/tsconfig.node.json b/web-admin/tsconfig.node.json new file mode 100644 index 0000000..42872c5 --- /dev/null +++ b/web-admin/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/web-admin/vite.config.ts b/web-admin/vite.config.ts new file mode 100644 index 0000000..297dbf1 --- /dev/null +++ b/web-admin/vite.config.ts @@ -0,0 +1,27 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' + +export default defineConfig({ + plugins: [vue()], + resolve: { + alias: { + '@': resolve(__dirname, 'src') + } + }, + server: { + port: 5174, + proxy: { + '/api': { + target: 'http://localhost:8080', + changeOrigin: true + } + } + }, + build: { + outDir: 'dist', + assetsDir: 'assets', + sourcemap: false, + chunkSizeWarningLimit: 1500 + } +})