feat(creator): 内容审核返回创作者与分集信息
This commit is contained in:
1 parent
9b2833dfd3
commit
2fee329002
3 files changed
+120
-1
No files matched your search
+7
@@ -61,6 +61,13 @@ public class DramaService {
|
|||||||
.like(StringUtils.hasText(req.getKeyword()), Drama::getTitle, req.getKeyword())
|
.like(StringUtils.hasText(req.getKeyword()), Drama::getTitle, req.getKeyword())
|
||||||
.eq(StringUtils.hasText(req.getStatus()), Drama::getStatus, req.getStatus())
|
.eq(StringUtils.hasText(req.getStatus()), Drama::getStatus, req.getStatus())
|
||||||
.eq(req.getIsHot() != null, Drama::getIsHot, Boolean.TRUE.equals(req.getIsHot()) ? 1 : 0);
|
.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()) {
|
if (!dramaTypes.isEmpty()) {
|
||||||
DramaMultiTagSupport.applyDramaTypeTokens(wrapper, dramaTypes);
|
DramaMultiTagSupport.applyDramaTypeTokens(wrapper, dramaTypes);
|
||||||
}
|
}
|
||||||
|
|||||||
+37
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/** 创作者内容提交与审核流转,对应 content_submission 表。 */
|
/** 创作者内容提交与审核流转,对应 content_submission 表。 */
|
||||||
@Data
|
@Data
|
||||||
@@ -38,4 +39,40 @@ public class ContentSubmission {
|
|||||||
|
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Integer deleted;
|
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<EpisodePreview> episodePreviews;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class EpisodePreview {
|
||||||
|
private Long id;
|
||||||
|
private Integer epNo;
|
||||||
|
private String title;
|
||||||
|
private Integer durationSec;
|
||||||
|
private String coverUrl;
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+76
-1
@@ -9,12 +9,15 @@ import com.fruitshorts.common.exception.ErrorCode;
|
|||||||
import com.fruitshorts.common.exception.ServiceException;
|
import com.fruitshorts.common.exception.ServiceException;
|
||||||
import com.fruitshorts.common.pojo.PageResult;
|
import com.fruitshorts.common.pojo.PageResult;
|
||||||
import com.fruitshorts.content.dal.entity.Drama;
|
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.enums.ContentStatus;
|
||||||
import com.fruitshorts.content.service.DramaService;
|
import com.fruitshorts.content.service.DramaService;
|
||||||
import com.fruitshorts.content.service.EpisodeService;
|
import com.fruitshorts.content.service.EpisodeService;
|
||||||
import com.fruitshorts.creator.dal.entity.ContentSubmission;
|
import com.fruitshorts.creator.dal.entity.ContentSubmission;
|
||||||
import com.fruitshorts.creator.dal.entity.Creator;
|
import com.fruitshorts.creator.dal.entity.Creator;
|
||||||
import com.fruitshorts.creator.dal.mapper.ContentSubmissionMapper;
|
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.SubmissionAuditReqVO;
|
||||||
import com.fruitshorts.creator.vo.SubmissionQueryReqVO;
|
import com.fruitshorts.creator.vo.SubmissionQueryReqVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -24,8 +27,10 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/** 创作者内容提交:后台检索、审核,通过后按 type 落到短剧状态机。 */
|
/** 创作者内容提交:后台检索、审核,通过后按 type 落到短剧状态机。 */
|
||||||
@Service
|
@Service
|
||||||
@@ -50,8 +55,10 @@ public class ContentSubmissionService {
|
|||||||
public static final Set<String> PENDING = Set.of(STATUS_SUBMITTED, STATUS_REVIEWING);
|
public static final Set<String> PENDING = Set.of(STATUS_SUBMITTED, STATUS_REVIEWING);
|
||||||
|
|
||||||
private final ContentSubmissionMapper submissionMapper;
|
private final ContentSubmissionMapper submissionMapper;
|
||||||
|
private final CreatorMapper creatorMapper;
|
||||||
private final DramaService dramaService;
|
private final DramaService dramaService;
|
||||||
private final EpisodeService episodeService;
|
private final EpisodeService episodeService;
|
||||||
|
private final DramaEpisodeMapper dramaEpisodeMapper;
|
||||||
|
|
||||||
public PageResult<ContentSubmission> page(SubmissionQueryReqVO req) {
|
public PageResult<ContentSubmission> page(SubmissionQueryReqVO req) {
|
||||||
Page<ContentSubmission> page = new Page<>(req.getSafePageIndex(), req.getSafePageSize());
|
Page<ContentSubmission> 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.getStatus()), ContentSubmission::getStatus, req.getStatus())
|
||||||
.eq(StringUtils.hasText(req.getType()), ContentSubmission::getType, req.getType())
|
.eq(StringUtils.hasText(req.getType()), ContentSubmission::getType, req.getType())
|
||||||
.orderByDesc(ContentSubmission::getId));
|
.orderByDesc(ContentSubmission::getId));
|
||||||
return new PageResult<>(result.getTotal(), result.getRecords());
|
List<ContentSubmission> rows = result.getRecords();
|
||||||
|
enrichForList(rows);
|
||||||
|
return new PageResult<>(result.getTotal(), rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentSubmission getExisting(Long id) {
|
public ContentSubmission getExisting(Long id) {
|
||||||
@@ -70,9 +79,67 @@ public class ContentSubmissionService {
|
|||||||
if (submission == null) {
|
if (submission == null) {
|
||||||
throw new ServiceException(ErrorCode.DATA_NOT_FOUND, "内容提交记录不存在");
|
throw new ServiceException(ErrorCode.DATA_NOT_FOUND, "内容提交记录不存在");
|
||||||
}
|
}
|
||||||
|
enrichForList(List.of(submission));
|
||||||
|
enrichEpisodes(submission);
|
||||||
return submission;
|
return submission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 列表/详情共用的回填:创作者信息 + 短剧预览(标题/封面/简介/题材/集数)。 */
|
||||||
|
private void enrichForList(List<ContentSubmission> rows) {
|
||||||
|
if (rows == null || rows.isEmpty()) return;
|
||||||
|
Set<Long> creatorIds = rows.stream().map(ContentSubmission::getCreatorId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||||
|
if (!creatorIds.isEmpty()) {
|
||||||
|
List<Creator> creators = creatorMapper.selectBatchIds(creatorIds);
|
||||||
|
Map<Long, Creator> 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<Long> dramaIds = rows.stream().map(ContentSubmission::getDramaId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||||
|
if (!dramaIds.isEmpty()) {
|
||||||
|
List<Drama> dramas = dramaService.listByIds(List.copyOf(dramaIds));
|
||||||
|
Map<Long, Drama> 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<DramaEpisode> eps = dramaEpisodeMapper.selectList(
|
||||||
|
Wrappers.<DramaEpisode>lambdaQuery()
|
||||||
|
.eq(DramaEpisode::getDramaId, submission.getDramaId())
|
||||||
|
.orderByAsc(DramaEpisode::getEpNo));
|
||||||
|
List<ContentSubmission.EpisodePreview> 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.<ContentSubmission>lambdaQuery()
|
||||||
|
.eq(ContentSubmission::getDramaId, dramaId));
|
||||||
|
}
|
||||||
|
|
||||||
/** 审核:通过 / 驳回 / 撤回。 */
|
/** 审核:通过 / 驳回 / 撤回。 */
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ContentSubmission audit(Long id, SubmissionAuditReqVO req, Long operatorId, String operatorName) {
|
public ContentSubmission audit(Long id, SubmissionAuditReqVO req, Long operatorId, String operatorName) {
|
||||||
|
|||||||
Reference in new issue
Block a user