MCPcopy Create free account
hub / github.com/diyhi/bbs / CommentServiceImpl

Class CommentServiceImpl

src/main/java/cms/service/topic/impl/CommentServiceImpl.java:57–1098  ·  view source on GitHub ↗

评论服务

Source from the content-addressed store, hash-verified

55 * 评论服务
56 */
57@Service
58public class CommentServiceImpl implements CommentService {
59 private static final Logger logger = LogManager.getLogger(CommentServiceImpl.class);
60
61
62 @Resource
63 CommentRepository commentRepository;
64 @Resource
65 SettingRepository settingRepository;
66 @Resource
67 JsonComponent jsonComponent;
68 @Resource
69 TextFilterComponent textFilterComponent;
70 @Resource
71 FileComponent fileComponent;
72 @Resource
73 TagComponent tagComponent;
74 @Resource
75 UserCacheManager userCacheManager;
76 @Resource
77 CommentCacheManager commentCacheManager;
78 @Resource
79 UserRepository userRepository;
80 @Resource
81 TopicComponent topicComponent;
82 @Resource
83 SettingComponent settingComponent;
84 @Resource
85 TopicRepository topicRepository;
86 @Resource
87 CommentComponent commentComponent;
88 @Resource RemindCacheManager remindCacheManager;
89 @Resource
90 RemindRepository remindRepository;
91 @Resource
92 RemindComponent remindComponent;
93 @Resource
94 RemindConfig remindConfig;
95
96 //Html过滤结果
97 private record HtmlFilterResult(HtmlProcessingResult htmlProcessingResult, String formatterMarkdown, String content) {
98 }
99 //允许文件格式
100 private record AllowFormat(List<String> formatList, long fileSize) {
101 }
102
103 /**
104 * 添加评论
105 * @param commentRequest 评论表单
106 * @param request 请求信息
107 */
108 public void addComment(CommentRequest commentRequest, HttpServletRequest request) {
109 if(commentRequest.getTopicId() == null || commentRequest.getTopicId() <=0L){
110 throw new BusinessException(Map.of("topicId", "话题Id不能为空"));
111 }
112
113 // 处理内容过滤和文件路径
114 CommentServiceImpl.HtmlFilterResult htmlFilterResult = processAndFilterContent(request, commentRequest.getContent(), commentRequest.getIsMarkdown(), commentRequest.getMarkdownContent());

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…