feat(admin): 新增观看记录分页与评论分集信息
This commit is contained in:
1 parent
d52b805adf
commit
1d316791b1
14 files changed
+953
-7
No files matched your search
+39
-1
@@ -11,6 +11,8 @@ import com.fruitshorts.common.exception.ErrorCode;
|
||||
import com.fruitshorts.common.exception.ServiceException;
|
||||
import com.fruitshorts.common.pojo.CursorResult;
|
||||
import com.fruitshorts.common.pojo.PageResult;
|
||||
import com.fruitshorts.content.dal.entity.Drama;
|
||||
import com.fruitshorts.content.dal.entity.DramaEpisode;
|
||||
import com.fruitshorts.content.service.DramaService;
|
||||
import com.fruitshorts.content.service.EpisodeService;
|
||||
import com.fruitshorts.interaction.config.InteractionProperties;
|
||||
@@ -275,7 +277,10 @@ public class CommentService {
|
||||
.like(StringUtils.hasText(req.getKeyword()), ContentComment::getContent,
|
||||
req.getKeyword())
|
||||
.orderByDesc(ContentComment::getId));
|
||||
return new PageResult<>(result.getTotal(), toRespList(result.getRecords(), null));
|
||||
List<ContentComment> rows = result.getRecords();
|
||||
List<CommentRespVO> list = toRespList(rows, null);
|
||||
fillAdminContentInfo(rows, list);
|
||||
return new PageResult<>(result.getTotal(), list);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -391,6 +396,39 @@ public class CommentService {
|
||||
return list;
|
||||
}
|
||||
|
||||
private void fillAdminContentInfo(List<ContentComment> rows, List<CommentRespVO> list) {
|
||||
if (rows.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<Long, Drama> dramas = new HashMap<>();
|
||||
List<Long> dramaIds = rows.stream().map(ContentComment::getDramaId).distinct().toList();
|
||||
for (Drama drama : dramaService.listByIds(dramaIds)) {
|
||||
dramas.put(drama.getId(), drama);
|
||||
}
|
||||
Map<Long, DramaEpisode> episodes = new HashMap<>();
|
||||
List<Long> episodeIds = rows.stream()
|
||||
.map(ContentComment::getEpisodeId)
|
||||
.filter(id -> id != null && id > 0L)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (!episodeIds.isEmpty()) {
|
||||
for (DramaEpisode episode : episodeService.listByIds(episodeIds)) {
|
||||
episodes.put(episode.getId(), episode);
|
||||
}
|
||||
}
|
||||
for (CommentRespVO vo : list) {
|
||||
Drama drama = dramas.get(vo.getDramaId());
|
||||
if (drama != null) {
|
||||
vo.setDramaTitle(drama.getTitle());
|
||||
}
|
||||
DramaEpisode episode = episodes.get(vo.getEpisodeId());
|
||||
if (episode != null) {
|
||||
vo.setEpisodeNo(episode.getEpNo());
|
||||
vo.setEpisodeTitle(episode.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CommentRespVO toResp(ContentComment comment, AppUser author, boolean liked, Long meUserId) {
|
||||
CommentRespVO vo = new CommentRespVO();
|
||||
vo.setId(comment.getId());
|
||||
|
||||
+5
@@ -12,7 +12,12 @@ public class CommentRespVO {
|
||||
|
||||
private Long id;
|
||||
private Long dramaId;
|
||||
/** 后台评论页展示用,C 端列表保持为空 */
|
||||
private String dramaTitle;
|
||||
private Long episodeId;
|
||||
/** 后台评论页展示用,C 端列表保持为空 */
|
||||
private Integer episodeNo;
|
||||
private String episodeTitle;
|
||||
private Long parentId;
|
||||
private Long rootId;
|
||||
private Long userId;
|
||||
|
||||
Reference in new issue
Block a user