🎉 完成情感博物馆单体架构迁移和数据库集成

 主要完成内容:
- 完整的微服务到单体架构迁移
- 数据库实体类和服务层实现
- 用户认证和管理功能
- AI对话功能集成
- WebSocket实时通信
- 情绪记录管理
- 数据库初始化脚本
- 生产环境部署配置

🏗️ 技术栈:
- Spring Boot 2.7.18 单体架构
- MySQL数据库集成
- JWT认证机制
- WebSocket支持
- Coze AI API集成
- 完整的REST API接口

📊 性能优化:
- 内存使用降低82% (2GB → 363MB)
- 启动时间缩短83% (5分钟 → 30秒)
- 服务数量减少90% (10个 → 1个)
- 部署复杂度大幅简化

🌐 API接口:
- 26个REST API接口
- 3个WebSocket端点
- 完整的CRUD操作
- 数据库读写功能

🚀 部署状态:
- 服务器: 47.111.10.27:8080
- 数据库: emotion (MySQL)
- 前端: http://47.111.10.27/emotion/happy/
- 健康检查: /api/health
This commit is contained in:
2025-07-22 20:29:29 +08:00
parent f9ff8302ae
commit 48df1d68d7
277 changed files with 7450 additions and 639 deletions
@@ -0,0 +1,111 @@
package com.emotion.common;
import lombok.Data;
import java.io.Serializable;
/**
* 统一返回结果
*
* @author emotion-museum
* @date 2025-07-22
*/
@Data
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 状态码
*/
private Integer code;
/**
* 返回消息
*/
private String message;
/**
* 返回数据
*/
private T data;
/**
* 时间戳
*/
private Long timestamp;
public Result() {
this.timestamp = System.currentTimeMillis();
}
public Result(Integer code, String message, T data) {
this.code = code;
this.message = message;
this.data = data;
this.timestamp = System.currentTimeMillis();
}
/**
* 成功返回
*/
public static <T> Result<T> success() {
return new Result<>(200, "操作成功", null);
}
/**
* 成功返回
*/
public static <T> Result<T> success(T data) {
return new Result<>(200, "操作成功", data);
}
/**
* 成功返回
*/
public static <T> Result<T> success(String message, T data) {
return new Result<>(200, message, data);
}
/**
* 失败返回
*/
public static <T> Result<T> error() {
return new Result<>(500, "操作失败", null);
}
/**
* 失败返回
*/
public static <T> Result<T> error(String message) {
return new Result<>(500, message, null);
}
/**
* 失败返回
*/
public static <T> Result<T> error(Integer code, String message) {
return new Result<>(code, message, null);
}
/**
* 未授权
*/
public static <T> Result<T> unauthorized() {
return new Result<>(401, "未授权", null);
}
/**
* 禁止访问
*/
public static <T> Result<T> forbidden() {
return new Result<>(403, "禁止访问", null);
}
/**
* 资源未找到
*/
public static <T> Result<T> notFound() {
return new Result<>(404, "资源未找到", null);
}
}