feat: 完善后端架构和service层实现

- 创建完整的entity实体类体系,包括所有业务实体
- 实现BaseEntity基类,统一管理公共字段
- 创建雪花算法ID生成器和自动填充处理器
- 简化所有mapper接口,只继承BaseMapper
- 重构service层,使用LambdaQueryWrapper进行数据库操作
- 创建BasePageRequest分页查询基类
- 完善用户上下文管理和JWT认证
- 新增WebSocket聊天功能和相关控制器
- 更新前端配置和组件,完善用户认证流程
- 同步数据库建表脚本
This commit is contained in:
2025-07-24 00:37:23 +08:00
parent 645036fcd2
commit 880e0e3c88
87 changed files with 8114 additions and 1106 deletions
@@ -0,0 +1,93 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 成就实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("achievement")
public class Achievement extends BaseEntity {
/**
* 成就标题
*/
@TableField("title")
private String title;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 分类
*/
@TableField("category")
private String category;
/**
* 图标
*/
@TableField("icon")
private String icon;
/**
* 稀有度
*/
@TableField("rarity")
private String rarity;
/**
* 条件类型
*/
@TableField("condition_type")
private String conditionType;
/**
* 条件值
*/
@TableField("condition_value")
private String conditionValue;
/**
* 奖励
*/
@TableField("rewards")
private String rewards;
/**
* 解锁时间
*/
@TableField("unlocked_time")
private LocalDateTime unlockedTime;
/**
* 进度
*/
@TableField("progress")
private BigDecimal progress;
/**
* 是否隐藏
*/
@TableField("is_hidden")
private Integer isHidden;
}
@@ -0,0 +1,54 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 评论实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("comment")
public class Comment extends BaseEntity {
/**
* 帖子ID
*/
@TableField("post_id")
private String postId;
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 评论内容
*/
@TableField("content")
private String content;
/**
* 回复的评论ID
*/
@TableField("reply_to_id")
private String replyToId;
/**
* 点赞数
*/
@TableField("likes")
private Integer likes;
}
@@ -0,0 +1,90 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 社区帖子实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("community_post")
public class CommunityPost extends BaseEntity {
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 地点ID
*/
@TableField("location_id")
private String locationId;
/**
* 标题
*/
@TableField("title")
private String title;
/**
* 内容
*/
@TableField("content")
private String content;
/**
* 帖子类型
*/
@TableField("type")
private String type;
/**
* 图片列表
*/
@TableField("images")
private String images;
/**
* 标签
*/
@TableField("tags")
private String tags;
/**
* 点赞数
*/
@TableField("likes")
private Integer likes;
/**
* 浏览数
*/
@TableField("view_count")
private Integer viewCount;
/**
* 评论数
*/
@TableField("comment_count")
private Integer commentCount;
/**
* 是否私密
*/
@TableField("is_private")
private Integer isPrivate;
}
@@ -1,91 +1,191 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 对话实体
*
*
* @author emotion-museum
* @date 2025-07-22
* @date 2025-07-23
*/
public class Conversation {
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("conversation")
public class Conversation extends BaseEntity {
private String id;
/**
* 用户ID (关联user.id)
*/
@TableField("user_id")
private String userId;
/**
* 用户类型: registered-注册用户, guest-访客用户
*/
@TableField("user_type")
private String userType;
/**
* 对话标题
*/
@TableField("title")
private String title;
/**
* 对话类型
*/
@TableField("type")
private String type;
private LocalDateTime startTime;
private LocalDateTime endTime;
private Integer messageCount;
private Integer status;
private String clientIp;
private String userAgent;
/**
* 状态: active-活跃, ended-结束, archived-归档
*/
@TableField("status")
private String conversationStatus;
/**
* Coze对话ID
*/
@TableField("coze_conversation_id")
private String cozeConversationId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private String createBy;
private String updateBy;
private Integer isDeleted;
/**
* 使用的Bot ID
*/
@TableField("bot_id")
private String botId;
/**
* 使用的Workflow ID
*/
@TableField("workflow_id")
private String workflowId;
/**
* 初始消息
*/
@TableField("initial_message")
private String initialMessage;
/**
* 上下文信息
*/
@TableField("context")
private String context;
/**
* 主要情绪
*/
@TableField("primary_emotion")
private String primaryEmotion;
/**
* 情绪强度
*/
@TableField("emotion_intensity")
private BigDecimal emotionIntensity;
/**
* 情绪趋势
*/
@TableField("emotion_trend")
private String emotionTrend;
/**
* 关键词
*/
@TableField("keywords")
private String keywords;
/**
* AI洞察
*/
@TableField("ai_insights")
private String aiInsights;
/**
* 分析置信度
*/
@TableField("confidence")
private BigDecimal confidence;
/**
* 结束时间
*/
@TableField("end_time")
private LocalDateTime endTime;
/**
* 最后活跃时间
*/
@TableField("last_active_time")
private LocalDateTime lastActiveTime;
/**
* 消息数量
*/
@TableField("message_count")
private Integer messageCount;
/**
* 总Token使用量
*/
@TableField("total_tokens")
private Integer totalTokens;
/**
* 总费用
*/
@TableField("total_cost")
private BigDecimal totalCost;
/**
* 客户端IP地址 (支持IPv6)
*/
@TableField("client_ip")
private String clientIp;
/**
* 用户代理信息
*/
@TableField("user_agent")
private String userAgent;
/**
* 对话摘要
*/
@TableField("summary")
private String summary;
/**
* 标签
*/
@TableField("tags")
private String tags;
/**
* 扩展元数据
*/
@TableField("metadata")
private String metadata;
/**
* 备注
*/
@TableField("remarks")
private String remarks;
// 构造函数
public Conversation() {
this.createTime = LocalDateTime.now();
this.updateTime = LocalDateTime.now();
this.status = 1;
this.isDeleted = 0;
this.messageCount = 0;
}
// Getter和Setter方法
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getUserId() { return userId; }
public void setUserId(String userId) { this.userId = userId; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public String getType() { return type; }
public void setType(String type) { this.type = type; }
public LocalDateTime getStartTime() { return startTime; }
public void setStartTime(LocalDateTime startTime) { this.startTime = startTime; }
public LocalDateTime getEndTime() { return endTime; }
public void setEndTime(LocalDateTime endTime) { this.endTime = endTime; }
public Integer getMessageCount() { return messageCount; }
public void setMessageCount(Integer messageCount) { this.messageCount = messageCount; }
public Integer getStatus() { return status; }
public void setStatus(Integer status) { this.status = status; }
public String getClientIp() { return clientIp; }
public void setClientIp(String clientIp) { this.clientIp = clientIp; }
public String getUserAgent() { return userAgent; }
public void setUserAgent(String userAgent) { this.userAgent = userAgent; }
public String getCozeConversationId() { return cozeConversationId; }
public void setCozeConversationId(String cozeConversationId) { this.cozeConversationId = cozeConversationId; }
public LocalDateTime getCreateTime() { return createTime; }
public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
public LocalDateTime getUpdateTime() { return updateTime; }
public void setUpdateTime(LocalDateTime updateTime) { this.updateTime = updateTime; }
public String getCreateBy() { return createBy; }
public void setCreateBy(String createBy) { this.createBy = createBy; }
public String getUpdateBy() { return updateBy; }
public void setUpdateBy(String updateBy) { this.updateBy = updateBy; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
public String getRemarks() { return remarks; }
public void setRemarks(String remarks) { this.remarks = remarks; }
}
@@ -0,0 +1,301 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* Coze API调用记录实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("coze_api_call")
public class CozeApiCall {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* 对话ID
*/
@TableField("conversation_id")
private String conversationId;
/**
* 消息ID
*/
@TableField("message_id")
private String messageId;
/**
* Coze聊天ID
*/
@TableField("coze_chat_id")
private String cozeChatId;
/**
* Coze对话ID
*/
@TableField("coze_conversation_id")
private String cozeConversationId;
/**
* Bot ID
*/
@TableField("bot_id")
private String botId;
/**
* Workflow ID
*/
@TableField("workflow_id")
private String workflowId;
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 请求类型: chat/stream/retrieve/messages
*/
@TableField("request_type")
private String requestType;
/**
* 请求URL
*/
@TableField("request_url")
private String requestUrl;
/**
* 请求体
*/
@TableField("request_body")
private String requestBody;
/**
* 请求头
*/
@TableField("request_headers")
private String requestHeaders;
/**
* 用户输入的消息内容
*/
@TableField("user_message")
private String userMessage;
/**
* 用户消息类型: text/image/file
*/
@TableField("user_message_type")
private String userMessageType;
/**
* AI回复的消息内容
*/
@TableField("ai_reply")
private String aiReply;
/**
* AI回复类型: text/image/file
*/
@TableField("ai_reply_type")
private String aiReplyType;
/**
* HTTP状态码
*/
@TableField("response_status")
private Integer responseStatus;
/**
* 响应体
*/
@TableField("response_body")
private String responseBody;
/**
* 响应头
*/
@TableField("response_headers")
private String responseHeaders;
/**
* 轮询次数
*/
@TableField("poll_count")
private Integer pollCount;
/**
* 轮询开始时间
*/
@TableField("poll_start_time")
private LocalDateTime pollStartTime;
/**
* 轮询结束时间
*/
@TableField("poll_end_time")
private LocalDateTime pollEndTime;
/**
* 最终状态: completed/failed/timeout
*/
@TableField("final_status")
private String finalStatus;
/**
* 调用状态: pending/success/failed/timeout
*/
@TableField("status")
private String status;
/**
* 开始时间
*/
@TableField("start_time")
private LocalDateTime startTime;
/**
* 结束时间
*/
@TableField("end_time")
private LocalDateTime endTime;
/**
* 耗时(毫秒)
*/
@TableField("duration_ms")
private Integer durationMs;
/**
* 输入Token数
*/
@TableField("prompt_tokens")
private Integer promptTokens;
/**
* 输出Token数
*/
@TableField("completion_tokens")
private Integer completionTokens;
/**
* 总Token数
*/
@TableField("total_tokens")
private Integer totalTokens;
/**
* 费用
*/
@TableField("cost")
private BigDecimal cost;
/**
* 函数调用记录
*/
@TableField("function_calls")
private String functionCalls;
/**
* 函数调用结果
*/
@TableField("function_results")
private String functionResults;
/**
* 错误代码
*/
@TableField("error_code")
private String errorCode;
/**
* 错误信息
*/
@TableField("error_message")
private String errorMessage;
/**
* 客户端IP
*/
@TableField("client_ip")
private String clientIp;
/**
* 用户代理
*/
@TableField("user_agent")
private String userAgent;
/**
* 会话ID
*/
@TableField("session_id")
private String sessionId;
/**
* 追踪ID
*/
@TableField("trace_id")
private String traceId;
/**
* 扩展元数据
*/
@TableField("metadata")
private String metadata;
/**
* 创建人ID
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新人ID
*/
@TableField("update_by")
private String updateBy;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
/**
* 是否删除: 0-未删除, 1-已删除
*/
@TableField("is_deleted")
@TableLogic
private Integer isDeleted;
/**
* 备注
*/
@TableField("remarks")
private String remarks;
}
@@ -0,0 +1,99 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 情绪分析实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("emotion_analysis")
public class EmotionAnalysis extends BaseEntity {
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 关联消息ID
*/
@TableField("message_id")
private String messageId;
/**
* 分析文本
*/
@TableField("text")
private String text;
/**
* 主要情绪
*/
@TableField("primary_emotion")
private String primaryEmotion;
/**
* 情绪强度
*/
@TableField("intensity")
private BigDecimal intensity;
/**
* 情绪极性: positive-积极, negative-消极, neutral-中性
*/
@TableField("polarity")
private String polarity;
/**
* 置信度
*/
@TableField("confidence")
private BigDecimal confidence;
/**
* 情绪分布详情
*/
@TableField("emotions")
private String emotions;
/**
* 关键词列表
*/
@TableField("keywords")
private String keywords;
/**
* 建议
*/
@TableField("suggestion")
private String suggestion;
/**
* 分析时间
*/
@TableField("analysis_time")
private LocalDateTime analysisTime;
/**
* 扩展元数据
*/
@TableField("metadata")
private String metadata;
}
@@ -0,0 +1,99 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* 情绪记录实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("emotion_record")
public class EmotionRecord extends BaseEntity {
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 记录日期
*/
@TableField("record_date")
private LocalDate recordDate;
/**
* 情绪类型
*/
@TableField("emotion_type")
private String emotionType;
/**
* 情绪强度
*/
@TableField("intensity")
private BigDecimal intensity;
/**
* 触发因素
*/
@TableField("triggers")
private String triggers;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 标签
*/
@TableField("tags")
private String tags;
/**
* 天气
*/
@TableField("weather")
private String weather;
/**
* 地点
*/
@TableField("location")
private String location;
/**
* 活动
*/
@TableField("activity")
private String activity;
/**
* 相关人物
*/
@TableField("people")
private String people;
/**
* 备注
*/
@TableField("notes")
private String notes;
}
@@ -0,0 +1,93 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 成长课题实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("growth_topic")
public class GrowthTopic extends BaseEntity {
/**
* 课题标题
*/
@TableField("title")
private String title;
/**
* 分类
*/
@TableField("category")
private String category;
/**
* 难度: easy-简单, medium-中等, hard-困难
*/
@TableField("difficulty")
private String difficulty;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 内容
*/
@TableField("content")
private String content;
/**
* 持续天数
*/
@TableField("duration_days")
private Integer durationDays;
/**
* 解锁条件
*/
@TableField("unlock_conditions")
private String unlockConditions;
/**
* 是否解锁
*/
@TableField("is_unlocked")
private Integer isUnlocked;
/**
* 进度百分比
*/
@TableField("progress")
private BigDecimal progress;
/**
* 完成时间
*/
@TableField("completed_time")
private LocalDateTime completedTime;
/**
* 奖励
*/
@TableField("rewards")
private String rewards;
}
@@ -0,0 +1,86 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* 访客用户实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("guest_user")
public class GuestUser extends BaseEntity {
/**
* 访客用户ID (格式: guest_xxx)
*/
@TableField("guest_user_id")
private String guestUserId;
/**
* 客户端IP地址 (支持IPv6)
*/
@TableField("ip_address")
private String ipAddress;
/**
* 用户代理信息
*/
@TableField("user_agent")
private String userAgent;
/**
* 访客昵称
*/
@TableField("nickname")
private String nickname;
/**
* 访客头像
*/
@TableField("avatar")
private String avatar;
/**
* 最后活跃时间
*/
@TableField("last_active_time")
private LocalDateTime lastActiveTime;
/**
* 会话数量
*/
@TableField("conversation_count")
private Integer conversationCount;
/**
* 消息数量
*/
@TableField("message_count")
private Integer messageCount;
/**
* IP地址的地理位置信息
*/
@TableField("location")
private String location;
/**
* 设备信息
*/
@TableField("device_info")
private String deviceInfo;
}
@@ -0,0 +1,99 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 地点标记实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("location_pin")
public class LocationPin extends BaseEntity {
/**
* 地点名称
*/
@TableField("name")
private String name;
/**
* 地点类型
*/
@TableField("type")
private String type;
/**
* 地点分类
*/
@TableField("category")
private String category;
/**
* 纬度
*/
@TableField("latitude")
private BigDecimal latitude;
/**
* 经度
*/
@TableField("longitude")
private BigDecimal longitude;
/**
* 地址
*/
@TableField("address")
private String address;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 创建者
*/
@TableField("created_by")
private String createdBy;
/**
* 点赞数
*/
@TableField("likes")
private Integer likes;
/**
* 访问数
*/
@TableField("visits")
private Integer visits;
/**
* 是否收藏
*/
@TableField("is_bookmarked")
private Integer isBookmarked;
/**
* 最后访问时间
*/
@TableField("last_visit_time")
private LocalDateTime lastVisitTime;
}
@@ -1,108 +1,149 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 消息实体
*
* 消息实体
*
* @author emotion-museum
* @date 2025-07-22
* @date 2025-07-23
*/
public class Message {
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("message")
public class Message extends BaseEntity {
private String id;
/**
* 对话ID
*/
@TableField("conversation_id")
private String conversationId;
private String userId;
/**
* 消息内容
*/
@TableField("content")
private String content;
private String contentType;
private String senderType;
private String senderId;
private String status;
private LocalDateTime sendTime;
private Integer isRead;
private String parentMessageId;
private String cozeRole;
/**
* 消息类型
*/
@TableField("type")
private String type;
/**
* 发送者: user-用户, assistant-AI助手
*/
@TableField("sender")
private String sender;
/**
* 消息时间戳
*/
@TableField("timestamp")
private LocalDateTime timestamp;
/**
* Coze平台的聊天ID
*/
@TableField("coze_chat_id")
private String cozeChatId;
/**
* Coze平台的消息ID
*/
@TableField("coze_message_id")
private String cozeMessageId;
/**
* 消息状态: sending/sent/failed/processing
*/
@TableField("status")
private String status;
/**
* 错误信息
*/
@TableField("error_message")
private String errorMessage;
private Integer retryCount;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private String createBy;
private String updateBy;
private Integer isDeleted;
private String remarks;
// 构造函数
public Message() {
this.createTime = LocalDateTime.now();
this.updateTime = LocalDateTime.now();
this.sendTime = LocalDateTime.now();
this.isDeleted = 0;
this.isRead = 0;
this.retryCount = 0;
}
/**
* 情绪评分
*/
@TableField("emotion_score")
private BigDecimal emotionScore;
// Getter和Setter方法
public String getId() { return id; }
public void setId(String id) { this.id = id; }
/**
* 情绪类型
*/
@TableField("emotion_type")
private String emotionType;
public String getConversationId() { return conversationId; }
public void setConversationId(String conversationId) { this.conversationId = conversationId; }
/**
* 情绪分析置信度
*/
@TableField("emotion_confidence")
private BigDecimal emotionConfidence;
public String getUserId() { return userId; }
public void setUserId(String userId) { this.userId = userId; }
/**
* 输入Token数
*/
@TableField("prompt_tokens")
private Integer promptTokens;
public String getContent() { return content; }
public void setContent(String content) { this.content = content; }
/**
* 输出Token数
*/
@TableField("completion_tokens")
private Integer completionTokens;
public String getContentType() { return contentType; }
public void setContentType(String contentType) { this.contentType = contentType; }
/**
* 总Token数
*/
@TableField("total_tokens")
private Integer totalTokens;
public String getSenderType() { return senderType; }
public void setSenderType(String senderType) { this.senderType = senderType; }
/**
* API调用费用
*/
@TableField("api_cost")
private BigDecimal apiCost;
public String getSenderId() { return senderId; }
public void setSenderId(String senderId) { this.senderId = senderId; }
/**
* 是否已读: 0-未读, 1-已读
*/
@TableField("is_read")
private Integer isRead;
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
/**
* 父消息ID(用于回复链)
*/
@TableField("parent_message_id")
private String parentMessageId;
public LocalDateTime getSendTime() { return sendTime; }
public void setSendTime(LocalDateTime sendTime) { this.sendTime = sendTime; }
/**
* 情绪分析结果
*/
@TableField("emotion_analysis")
private String emotionAnalysis;
public Integer getIsRead() { return isRead; }
public void setIsRead(Integer isRead) { this.isRead = isRead; }
/**
* 扩展元数据
*/
@TableField("metadata")
private String metadata;
public String getParentMessageId() { return parentMessageId; }
public void setParentMessageId(String parentMessageId) { this.parentMessageId = parentMessageId; }
public String getCozeRole() { return cozeRole; }
public void setCozeRole(String cozeRole) { this.cozeRole = cozeRole; }
public String getCozeMessageId() { return cozeMessageId; }
public void setCozeMessageId(String cozeMessageId) { this.cozeMessageId = cozeMessageId; }
public String getErrorMessage() { return errorMessage; }
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
public Integer getRetryCount() { return retryCount; }
public void setRetryCount(Integer retryCount) { this.retryCount = retryCount; }
public LocalDateTime getCreateTime() { return createTime; }
public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
public LocalDateTime getUpdateTime() { return updateTime; }
public void setUpdateTime(LocalDateTime updateTime) { this.updateTime = updateTime; }
public String getCreateBy() { return createBy; }
public void setCreateBy(String createBy) { this.createBy = createBy; }
public String getUpdateBy() { return updateBy; }
public void setUpdateBy(String updateBy) { this.updateBy = updateBy; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
public String getRemarks() { return remarks; }
public void setRemarks(String remarks) { this.remarks = remarks; }
}
@@ -0,0 +1,86 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* 奖励实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("reward")
public class Reward extends BaseEntity {
/**
* 课题ID
*/
@TableField("topic_id")
private String topicId;
/**
* 成就ID
*/
@TableField("achievement_id")
private String achievementId;
/**
* 奖励类型
*/
@TableField("type")
private String type;
/**
* 奖励名称
*/
@TableField("name")
private String name;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 图标
*/
@TableField("icon")
private String icon;
/**
* 稀有度
*/
@TableField("rarity")
private String rarity;
/**
* 奖励值
*/
@TableField("value")
private String value;
/**
* 获得时间
*/
@TableField("earned_time")
private LocalDateTime earnedTime;
/**
* 是否新获得
*/
@TableField("is_new")
private Integer isNew;
}
@@ -1,70 +0,0 @@
package com.emotion.entity;
import java.time.LocalDateTime;
/**
* 简化用户实体(不使用Lombok)
*
* @author emotion-museum
* @date 2025-07-22
*/
public class SimpleUser {
private String id;
private String username;
private String account;
private String password;
private String email;
private String phone;
private String nickname;
private String avatar;
private Integer status;
private LocalDateTime createTime;
private LocalDateTime updateTime;
// 构造函数
public SimpleUser() {}
public SimpleUser(String id, String username, String account) {
this.id = id;
this.username = username;
this.account = account;
this.createTime = LocalDateTime.now();
this.updateTime = LocalDateTime.now();
this.status = 1;
}
// Getter和Setter方法
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getUsername() { return username; }
public void setUsername(String username) { this.username = username; }
public String getAccount() { return account; }
public void setAccount(String account) { this.account = account; }
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getPhone() { return phone; }
public void setPhone(String phone) { this.phone = phone; }
public String getNickname() { return nickname; }
public void setNickname(String nickname) { this.nickname = nickname; }
public String getAvatar() { return avatar; }
public void setAvatar(String avatar) { this.avatar = avatar; }
public Integer getStatus() { return status; }
public void setStatus(Integer status) { this.status = status; }
public LocalDateTime getCreateTime() { return createTime; }
public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
public LocalDateTime getUpdateTime() { return updateTime; }
public void setUpdateTime(LocalDateTime updateTime) { this.updateTime = updateTime; }
}
@@ -0,0 +1,74 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* 课题互动实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("topic_interaction")
public class TopicInteraction extends BaseEntity {
/**
* 课题ID
*/
@TableField("topic_id")
private String topicId;
/**
* 互动类型
*/
@TableField("type")
private String type;
/**
* 内容
*/
@TableField("content")
private String content;
/**
* 用户输入
*/
@TableField("user_input")
private String userInput;
/**
* AI回应
*/
@TableField("ai_response")
private String aiResponse;
/**
* 评分
*/
@TableField("rating")
private Integer rating;
/**
* 反馈
*/
@TableField("feedback")
private String feedback;
/**
* 完成时间
*/
@TableField("completed_time")
private LocalDateTime completedTime;
}
@@ -1,106 +1,162 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 用户实体
*
* 用户实体
*
* @author emotion-museum
* @date 2025-07-22
* @date 2025-07-23
*/
public class User {
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("user")
public class User extends BaseEntity {
private String id;
private String username;
/**
* 账号
*/
@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;
private String nickname;
/**
* 头像URL
*/
@TableField("avatar")
private String avatar;
private Integer gender;
/**
* 昵称
*/
@TableField("nickname")
private String nickname;
/**
* 生日
*/
@TableField("birth_date")
private LocalDate birthDate;
/**
* 所在地
*/
@TableField("location")
private String location;
/**
* 个人简介
*/
@TableField("bio")
private String bio;
/**
* 会员等级
*/
@TableField("member_level")
private String memberLevel;
/**
* 使用天数
*/
@TableField("total_days")
private Integer totalDays;
/**
* 自我感知
*/
@TableField("self_awareness")
private BigDecimal selfAwareness;
/**
* 情绪韧性
*/
@TableField("emotional_resilience")
private BigDecimal emotionalResilience;
/**
* 行动力
*/
@TableField("action_power")
private BigDecimal actionPower;
/**
* 共情力
*/
@TableField("empathy")
private BigDecimal empathy;
/**
* 生活热度
*/
@TableField("life_enthusiasm")
private BigDecimal lifeEnthusiasm;
/**
* 状态: 0-禁用, 1-正常
*/
@TableField("status")
private Integer status;
/**
* 是否已验证: 0-未验证, 1-已验证
*/
@TableField("is_verified")
private Integer isVerified;
private LocalDateTime createTime;
private LocalDateTime updateTime;
/**
* 最后活跃时间
*/
@TableField("last_active_time")
private LocalDateTime lastActiveTime;
private String createBy;
private String updateBy;
private Integer isDeleted;
private String remarks;
// 构造函数
public User() {
this.createTime = LocalDateTime.now();
this.updateTime = LocalDateTime.now();
this.status = 1;
this.isDeleted = 0;
}
/**
* 第三方平台ID
*/
@TableField("third_party_id")
private String thirdPartyId;
// Getter和Setter方法
public String getId() { return id; }
public void setId(String id) { this.id = id; }
/**
* 第三方平台类型
*/
@TableField("third_party_type")
private String thirdPartyType;
public String getUsername() { return username; }
public void setUsername(String username) { this.username = username; }
public String getAccount() { return account; }
public void setAccount(String account) { this.account = account; }
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getPhone() { return phone; }
public void setPhone(String phone) { this.phone = phone; }
public String getNickname() { return nickname; }
public void setNickname(String nickname) { this.nickname = nickname; }
public String getAvatar() { return avatar; }
public void setAvatar(String avatar) { this.avatar = avatar; }
public Integer getGender() { return gender; }
public void setGender(Integer gender) { this.gender = gender; }
public String getBio() { return bio; }
public void setBio(String bio) { this.bio = bio; }
public String getMemberLevel() { return memberLevel; }
public void setMemberLevel(String memberLevel) { this.memberLevel = memberLevel; }
public Integer getTotalDays() { return totalDays; }
public void setTotalDays(Integer totalDays) { this.totalDays = totalDays; }
public Integer getStatus() { return status; }
public void setStatus(Integer status) { this.status = status; }
public Integer getIsVerified() { return isVerified; }
public void setIsVerified(Integer isVerified) { this.isVerified = isVerified; }
public LocalDateTime getCreateTime() { return createTime; }
public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
public LocalDateTime getUpdateTime() { return updateTime; }
public void setUpdateTime(LocalDateTime updateTime) { this.updateTime = updateTime; }
public LocalDateTime getLastActiveTime() { return lastActiveTime; }
public void setLastActiveTime(LocalDateTime lastActiveTime) { this.lastActiveTime = lastActiveTime; }
public String getCreateBy() { return createBy; }
public void setCreateBy(String createBy) { this.createBy = createBy; }
public String getUpdateBy() { return updateBy; }
public void setUpdateBy(String updateBy) { this.updateBy = updateBy; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
public String getRemarks() { return remarks; }
public void setRemarks(String remarks) { this.remarks = remarks; }
}
@@ -0,0 +1,108 @@
package com.emotion.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.emotion.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 用户统计实体类
*
* @author emotion-museum
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("user_stats")
public class UserStats extends BaseEntity {
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 总对话数
*/
@TableField("total_conversations")
private Integer totalConversations;
/**
* 总消息数
*/
@TableField("total_messages")
private Integer totalMessages;
/**
* 总情绪记录数
*/
@TableField("total_emotions_recorded")
private Integer totalEmotionsRecorded;
/**
* 完成的课题数
*/
@TableField("topics_completed")
private Integer topicsCompleted;
/**
* 解锁的成就数
*/
@TableField("achievements_unlocked")
private Integer achievementsUnlocked;
/**
* 总积分
*/
@TableField("total_points")
private Integer totalPoints;
/**
* 连续使用天数
*/
@TableField("consecutive_days")
private Integer consecutiveDays;
/**
* 最大连续天数
*/
@TableField("max_consecutive_days")
private Integer maxConsecutiveDays;
/**
* 访问的地点数
*/
@TableField("locations_visited")
private Integer locationsVisited;
/**
* 创建的帖子数
*/
@TableField("posts_created")
private Integer postsCreated;
/**
* 评论数
*/
@TableField("comments_made")
private Integer commentsMade;
/**
* 收到的点赞数
*/
@TableField("likes_received")
private Integer likesReceived;
/**
* 社交互动数
*/
@TableField("social_interactions")
private Integer socialInteractions;
}