From 2fee329002e53be0ad8b9ec8917bddb03e188314 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Mon, 9 Nov 2026 10:32:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(creator):=20=E5=86=85=E5=AE=B9=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E8=BF=94=E5=9B=9E=E5=88=9B=E4=BD=9C=E8=80=85=E4=B8=8E?= =?UTF-8?q?=E5=88=86=E9=9B=86=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/service/DramaService.java | 7 ++ .../creator/dal/entity/ContentSubmission.java | 37 +++++++++ .../service/ContentSubmissionService.java | 77 ++++++++++++++++++- 3 files changed, 120 insertions(+), 1 deletion(-) diff --git a/fruitshorts-module-content/src/main/java/com/fruitshorts/content/service/DramaService.java b/fruitshorts-module-content/src/main/java/com/fruitshorts/content/service/DramaService.java index a43aaf4..cad239c 100644 --- a/fruitshorts-module-content/src/main/java/com/fruitshorts/content/service/DramaService.java +++ b/fruitshorts-module-content/src/main/java/com/fruitshorts/content/service/DramaService.java @@ -61,6 +61,13 @@ public class DramaService { .like(StringUtils.hasText(req.getKeyword()), Drama::getTitle, req.getKeyword()) .eq(StringUtils.hasText(req.getStatus()), Drama::getStatus, req.getStatus()) .eq(req.getIsHot() != null, Drama::getIsHot, Boolean.TRUE.equals(req.getIsHot()) ? 1 : 0); + // admin 短剧管理默认隐藏创作者发的、尚在审核中/被驳回的剧——审核通过后才自动进入; + // admin 自己建的(creator_id IS NULL)不受影响;手动选了状态时也放行。 + if (!StringUtils.hasText(req.getStatus())) { + wrapper.and(w -> w.isNull(Drama::getCreatorId) + .or() + .notIn(Drama::getStatus, List.of("reviewing", "rejected"))); + } if (!dramaTypes.isEmpty()) { DramaMultiTagSupport.applyDramaTypeTokens(wrapper, dramaTypes); } diff --git a/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/dal/entity/ContentSubmission.java b/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/dal/entity/ContentSubmission.java index ac40eda..3f63a69 100644 --- a/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/dal/entity/ContentSubmission.java +++ b/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/dal/entity/ContentSubmission.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.time.LocalDateTime; +import java.util.List; /** 创作者内容提交与审核流转,对应 content_submission 表。 */ @Data @@ -38,4 +39,40 @@ public class ContentSubmission { @TableLogic private Integer deleted; + + /** 非持久化:后台列表接口附加的创作者展示信息 */ + @TableField(exist = false) + private String creatorName; + @TableField(exist = false) + private String creatorCode; + @TableField(exist = false) + private String creatorMobile; + + /** 非持久化:后台列表/详情接口附加的短剧预览 */ + @TableField(exist = false) + private String dramaTitle; + @TableField(exist = false) + private String dramaCover; + @TableField(exist = false) + private String dramaDescription; + @TableField(exist = false) + private String dramaGenre; + @TableField(exist = false) + private String dramaLanguage; + @TableField(exist = false) + private Integer dramaTotalEpisodes; + + /** 非持久化:后台详情接口附加的分集预览(审核弹窗展示) */ + @TableField(exist = false) + private List episodePreviews; + + @Data + public static class EpisodePreview { + private Long id; + private Integer epNo; + private String title; + private Integer durationSec; + private String coverUrl; + private String status; + } } diff --git a/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/service/ContentSubmissionService.java b/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/service/ContentSubmissionService.java index 9cfea88..1be458a 100644 --- a/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/service/ContentSubmissionService.java +++ b/fruitshorts-module-creator/src/main/java/com/fruitshorts/creator/service/ContentSubmissionService.java @@ -9,12 +9,15 @@ import com.fruitshorts.common.exception.ErrorCode; import com.fruitshorts.common.exception.ServiceException; import com.fruitshorts.common.pojo.PageResult; import com.fruitshorts.content.dal.entity.Drama; +import com.fruitshorts.content.dal.entity.DramaEpisode; +import com.fruitshorts.content.dal.mapper.DramaEpisodeMapper; import com.fruitshorts.content.enums.ContentStatus; import com.fruitshorts.content.service.DramaService; import com.fruitshorts.content.service.EpisodeService; import com.fruitshorts.creator.dal.entity.ContentSubmission; import com.fruitshorts.creator.dal.entity.Creator; import com.fruitshorts.creator.dal.mapper.ContentSubmissionMapper; +import com.fruitshorts.creator.dal.mapper.CreatorMapper; import com.fruitshorts.creator.vo.SubmissionAuditReqVO; import com.fruitshorts.creator.vo.SubmissionQueryReqVO; import lombok.RequiredArgsConstructor; @@ -24,8 +27,10 @@ import org.springframework.util.StringUtils; import java.time.LocalDateTime; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.stream.Collectors; /** 创作者内容提交:后台检索、审核,通过后按 type 落到短剧状态机。 */ @Service @@ -50,8 +55,10 @@ public class ContentSubmissionService { public static final Set PENDING = Set.of(STATUS_SUBMITTED, STATUS_REVIEWING); private final ContentSubmissionMapper submissionMapper; + private final CreatorMapper creatorMapper; private final DramaService dramaService; private final EpisodeService episodeService; + private final DramaEpisodeMapper dramaEpisodeMapper; public PageResult page(SubmissionQueryReqVO req) { Page page = new Page<>(req.getSafePageIndex(), req.getSafePageSize()); @@ -62,7 +69,9 @@ public class ContentSubmissionService { .eq(StringUtils.hasText(req.getStatus()), ContentSubmission::getStatus, req.getStatus()) .eq(StringUtils.hasText(req.getType()), ContentSubmission::getType, req.getType()) .orderByDesc(ContentSubmission::getId)); - return new PageResult<>(result.getTotal(), result.getRecords()); + List rows = result.getRecords(); + enrichForList(rows); + return new PageResult<>(result.getTotal(), rows); } public ContentSubmission getExisting(Long id) { @@ -70,9 +79,67 @@ public class ContentSubmissionService { if (submission == null) { throw new ServiceException(ErrorCode.DATA_NOT_FOUND, "内容提交记录不存在"); } + enrichForList(List.of(submission)); + enrichEpisodes(submission); return submission; } + /** 列表/详情共用的回填:创作者信息 + 短剧预览(标题/封面/简介/题材/集数)。 */ + private void enrichForList(List rows) { + if (rows == null || rows.isEmpty()) return; + Set creatorIds = rows.stream().map(ContentSubmission::getCreatorId).filter(Objects::nonNull).collect(Collectors.toSet()); + if (!creatorIds.isEmpty()) { + List creators = creatorMapper.selectBatchIds(creatorIds); + Map byId = new java.util.HashMap<>(); + creators.forEach(c -> byId.put(c.getId(), c)); + rows.forEach(s -> { + Creator c = byId.get(s.getCreatorId()); + if (c != null) { + s.setCreatorName(c.getName()); + s.setCreatorCode(c.getCode()); + s.setCreatorMobile(c.getContactMobile()); + } + }); + } + Set dramaIds = rows.stream().map(ContentSubmission::getDramaId).filter(Objects::nonNull).collect(Collectors.toSet()); + if (!dramaIds.isEmpty()) { + List dramas = dramaService.listByIds(List.copyOf(dramaIds)); + Map byDrama = new java.util.HashMap<>(); + dramas.forEach(d -> byDrama.put(d.getId(), d)); + rows.forEach(s -> { + Drama d = byDrama.get(s.getDramaId()); + if (d != null) { + s.setDramaTitle(d.getTitle()); + s.setDramaCover(d.getCoverUrl()); + s.setDramaDescription(d.getSynopsis()); + s.setDramaGenre(d.getGenre()); + s.setDramaLanguage(d.getLanguage()); + s.setDramaTotalEpisodes(d.getTotalEpisodes()); + } + }); + } + } + + /** 详情接口额外回填分集预览列表,供审核弹窗展示。 */ + private void enrichEpisodes(ContentSubmission submission) { + if (submission.getDramaId() == null) return; + List eps = dramaEpisodeMapper.selectList( + Wrappers.lambdaQuery() + .eq(DramaEpisode::getDramaId, submission.getDramaId()) + .orderByAsc(DramaEpisode::getEpNo)); + List previews = eps.stream().map(e -> { + ContentSubmission.EpisodePreview p = new ContentSubmission.EpisodePreview(); + p.setId(e.getId()); + p.setEpNo(e.getEpNo()); + p.setTitle(e.getTitle()); + p.setDurationSec(e.getDurationSec()); + p.setCoverUrl(e.getCoverUrl()); + p.setStatus(e.getStatus()); + return p; + }).toList(); + submission.setEpisodePreviews(previews); + } + /** * 创作者提交内容。 * @@ -205,6 +272,14 @@ public class ContentSubmissionService { } } + /** 按剧清掉所有提交记录(删剧时用)。 */ + @Transactional(rollbackFor = Exception.class) + public void deleteByDrama(Long dramaId) { + if (dramaId == null) return; + submissionMapper.delete(Wrappers.lambdaQuery() + .eq(ContentSubmission::getDramaId, dramaId)); + } + /** 审核:通过 / 驳回 / 撤回。 */ @Transactional(rollbackFor = Exception.class) public ContentSubmission audit(Long id, SubmissionAuditReqVO req, Long operatorId, String operatorName) {