feat: 项目初始化及当前全部内容提交

This commit is contained in:
2025-07-15 17:37:50 +08:00
parent ec817067f1
commit e78f192d34
622 changed files with 75174 additions and 383 deletions
@@ -0,0 +1,21 @@
package com.emotionmuseum.stats;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 统计分析服务启动类
*
* @author emotion-museum
* @since 2025-07-12
*/
@SpringBootApplication
@MapperScan("com.emotionmuseum.stats.mapper")
public class StatsApplication {
public static void main(String[] args) {
SpringApplication.run(StatsApplication.class, args);
}
}
@@ -0,0 +1,103 @@
package com.emotionmuseum.stats.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.emotionmuseum.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 用户统计实体
*
* @author emotion-museum
* @since 2025-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@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;
}
@@ -0,0 +1,80 @@
server:
port: 19007
spring:
application:
name: emotion-stats
# 数据源配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: root
password: 123456
# Redis配置
data:
redis:
host: localhost
port: 6379
password:
database: 6
timeout: 10000ms
lettuce:
pool:
max-active: 8
max-wait: -1ms
max-idle: 8
min-idle: 0
# MyBatis Plus配置
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-field: isDeleted
logic-delete-value: 1
logic-not-delete-value: 0
# Nacos配置
spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
namespace:
group: DEFAULT_GROUP
enabled: true
register-enabled: true
heart-beat-interval: 5000
heart-beat-timeout: 15000
ip-delete-timeout: 30000
config:
server-addr: localhost:8848
namespace:
group: DEFAULT_GROUP
file-extension: yml
enabled: false
# 日志配置
logging:
level:
com.emotionmuseum: debug
org.springframework.web: debug
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n"
file:
name: logs/emotion-stats-local.log
# 管理端点配置
management:
endpoints:
web:
exposure:
include: health,info,metrics
endpoint:
health:
show-details: always
@@ -0,0 +1,70 @@
server:
port: 19007
spring:
application:
name: emotion-stats
profiles:
active: dev
cloud:
nacos:
discovery:
server-addr: localhost:8848
namespace: emotion-dev
group: DEFAULT_GROUP
enabled: false
config:
enabled: false
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
type: com.alibaba.druid.pool.DruidDataSource
druid:
initial-size: 5
min-idle: 5
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
redis:
host: localhost
port: 6379
password:
database: 0
timeout: 10000ms
lettuce:
pool:
max-active: 8
max-wait: -1ms
max-idle: 8
min-idle: 0
# 监控配置
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus
endpoint:
health:
show-details: always
metrics:
export:
prometheus:
enabled: true
# 日志配置
logging:
level:
com.emotionmuseum: debug
com.baomidou.mybatisplus: debug
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level [%logger{50}] - %msg%n"