新增多个模块和功能,包括用户评论、帖子、WebSocket通信优化及日志配置,更新文档和部署脚本,提升项目整体性能和可维护性。

This commit is contained in:
2025-08-22 17:28:05 +08:00
parent 420d4afc3c
commit 890c60bcb3
236 changed files with 0 additions and 0 deletions
@@ -0,0 +1,21 @@
package com.emotionmuseum.explore;
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.explore.mapper")
public class ExploreApplication {
public static void main(String[] args) {
SpringApplication.run(ExploreApplication.class, args);
}
}
@@ -0,0 +1,49 @@
package com.emotionmuseum.explore.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("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,88 @@
package com.emotionmuseum.explore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.emotionmuseum.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 社区帖子实体
*
* @author emotion-museum
* @since 2025-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "community_post", autoResultMap = true)
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(value = "images", typeHandler = JacksonTypeHandler.class)
private List<String> images;
/**
* 标签
*/
@TableField(value = "tags", typeHandler = JacksonTypeHandler.class)
private List<String> tags;
/**
* 点赞数
*/
@TableField("likes")
private Integer likes;
/**
* 浏览数
*/
@TableField("view_count")
private Integer viewCount;
/**
* 评论数
*/
@TableField("comment_count")
private Integer commentCount;
/**
* 是否私密: 0-公开, 1-私密
*/
@TableField("is_private")
private Integer isPrivate;
}
@@ -0,0 +1,96 @@
package com.emotionmuseum.explore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.emotionmuseum.common.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 地点标记实体
*
* @author emotion-museum
* @since 2025-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@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;
/**
* 是否收藏: 0-未收藏, 1-已收藏
*/
@TableField("is_bookmarked")
private Integer isBookmarked;
/**
* 最后访问时间
*/
@TableField("last_visit_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime lastVisitTime;
}
@@ -0,0 +1,55 @@
# 本地开发环境配置
spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
namespace:
group: DEFAULT_GROUP
enabled: true
username: nacos
password: Peanut2817*#
metadata:
version: 1.0.0
zone: local
register-enabled: true
ephemeral: true
cluster-name: DEFAULT
service: ${spring.application.name}
weight: 1
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
username: nacos
password: Peanut2817*#
# 数据源配置
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: 0
# 日志配置
logging:
level:
com.emotionmuseum: debug
com.baomidou.mybatisplus: debug
com.alibaba.nacos: info
file:
name: logs/emotion-explore-local.log
@@ -0,0 +1,55 @@
# 生产环境配置
spring:
cloud:
nacos:
discovery:
server-addr: 47.111.10.27:8848
namespace: prod
group: DEFAULT_GROUP
enabled: true
username: nacos
password: EmotionMuseum2025
metadata:
version: 1.0.0
zone: prod
register-enabled: true
ephemeral: true
cluster-name: DEFAULT
service: ${spring.application.name}
weight: 1
heart-beat-interval: 5000
heart-beat-timeout: 15000
ip-delete-timeout: 30000
config:
server-addr: 47.111.10.27:8848
namespace: prod
group: DEFAULT_GROUP
file-extension: yml
enabled: false
username: nacos
password: EmotionMuseum2025
# 数据源配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://47.111.10.27:3306/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: root
password: EmotionMuseum2025*#
# Redis配置
data:
redis:
host: 47.111.10.27
port: 6379
password: EmotionMuseum2025*#
database: 0
# 日志配置
logging:
level:
com.emotionmuseum: warn
com.baomidou.mybatisplus: warn
com.alibaba.nacos: error
file:
name: logs/emotion-explore-prod.log
@@ -0,0 +1,55 @@
# 测试环境配置
spring:
cloud:
nacos:
discovery:
server-addr: 47.111.10.27:8848
namespace: test
group: DEFAULT_GROUP
enabled: true
username: nacos
password: EmotionMuseum2025
metadata:
version: 1.0.0
zone: test
register-enabled: true
ephemeral: true
cluster-name: DEFAULT
service: ${spring.application.name}
weight: 1
heart-beat-interval: 5000
heart-beat-timeout: 15000
ip-delete-timeout: 30000
config:
server-addr: 47.111.10.27:8848
namespace: test
group: DEFAULT_GROUP
file-extension: yml
enabled: false
username: nacos
password: EmotionMuseum2025
# 数据源配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://47.111.10.27:3306/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: root
password: EmotionMuseum2025*#
# Redis配置
data:
redis:
host: 47.111.10.27
port: 6379
password: EmotionMuseum2025*#
database: 0
# 日志配置
logging:
level:
com.emotionmuseum: info
com.baomidou.mybatisplus: info
com.alibaba.nacos: warn
file:
name: logs/emotion-explore-test.log
@@ -0,0 +1,73 @@
server:
port: 19005
spring:
application:
name: emotion-explore
profiles:
active: dev
cloud:
nacos:
discovery:
server-addr: 47.111.10.27: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:
data:
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:
file:
path: /data/logs/emotion-museum/explore
level:
com.emotionmuseum: debug
com.baomidou.mybatisplus: debug
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level [%logger{50}] - %msg%n"