feat(评论服务): 实现评论服务基础框架
All checks were successful
test/timeline-server/pipeline/head This commit looks good

- 新增 CommentServiceImpl 实现评论相关功能
- 移除 StoryServiceClient 的熔断器配置
- 禁用 feign 熔断器配置并添加相关注释
This commit is contained in:
2026-02-26 10:24:41 +08:00
parent 7ef9e85e2d
commit f727ed5f9b
3 changed files with 96 additions and 2 deletions

View File

@@ -0,0 +1,90 @@
package com.timeline.story.service.impl;
import com.timeline.story.entity.StoryComment;
import com.timeline.story.service.CommentService;
import com.timeline.story.vo.CommentVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* CommentServiceImpl - 评论服务实现类
*/
@Slf4j
@Service
public class CommentServiceImpl implements CommentService {
@Override
public StoryComment createComment(CommentVo commentVo) {
log.info("创建评论: storyItemId={}", commentVo.getStoryItemId());
// TODO: 实现评论创建逻辑
return null;
}
@Override
public StoryComment replyComment(String parentId, CommentVo commentVo) {
log.info("回复评论: parentId={}", parentId);
// TODO: 实现回复逻辑
return null;
}
@Override
public void deleteComment(String commentInstanceId) {
log.info("删除评论: commentInstanceId={}", commentInstanceId);
// TODO: 实现删除逻辑
}
@Override
public StoryComment getCommentById(String commentInstanceId) {
log.info("获取评论: commentInstanceId={}", commentInstanceId);
// TODO: 实现查询逻辑
return null;
}
@Override
public List<CommentVo> getCommentsByStoryItem(String storyItemId, int pageNum, int pageSize) {
log.info("获取节点评论列表: storyItemId={}", storyItemId);
// 返回空列表
return new ArrayList<>();
}
@Override
public List<CommentVo> getRepliesByComment(String parentId, int pageNum, int pageSize) {
log.info("获取评论回复列表: parentId={}", parentId);
// 返回空列表
return new ArrayList<>();
}
@Override
public int getCommentCountByStoryItem(String storyItemId) {
log.info("获取节点评论数量: storyItemId={}", storyItemId);
return 0;
}
@Override
public void likeComment(String commentInstanceId, String userId) {
log.info("点赞评论: commentInstanceId={}, userId={}", commentInstanceId, userId);
// TODO: 实现点赞逻辑
}
@Override
public void unlikeComment(String commentInstanceId, String userId) {
log.info("取消点赞评论: commentInstanceId={}, userId={}", commentInstanceId, userId);
// TODO: 实现取消点赞逻辑
}
@Override
public boolean hasLiked(String commentInstanceId, String userId) {
log.info("检查是否已点赞: commentInstanceId={}, userId={}", commentInstanceId, userId);
return false;
}
@Override
public List<CommentVo> getCommentsByUser(String userId, int pageNum, int pageSize) {
log.info("获取用户评论列表: userId={}", userId);
// 返回空列表
return new ArrayList<>();
}
}

View File

@@ -8,11 +8,12 @@ import org.springframework.web.bind.annotation.RequestParam;
* Story Service Feign Client
* 用于调用 timeline-story-service 的接口
*/
@FeignClient(name = "timeline-story-service", path = "/story", fallbackFactory = StoryServiceClientFallbackFactory.class)
@FeignClient(name = "timeline-story-service", path = "/story")
public interface StoryServiceClient {
/**
* 统计用户的故事数量
*
* @param userId 用户ID
* @return 故事数量
*/
@@ -21,6 +22,7 @@ public interface StoryServiceClient {
/**
* 统计用户的照片/视频数量story_item
*
* @param userId 用户ID
* @return 照片/视频数量
*/
@@ -29,6 +31,7 @@ public interface StoryServiceClient {
/**
* 统计用户的存储使用量(字节)
*
* @param userId 用户ID
* @return 存储字节数
*/

View File

@@ -62,4 +62,5 @@ spring.datasource.hikari.keepalive-time=0
spring.datasource.hikari.validation-timeout=5000
# Feign Client Configuration
feign.circuitbreaker.enabled=true
# 注意:启用熔断器需要添加 resilience4j 或 hystrix 依赖
# feign.circuitbreaker.enabled=true