fix: 撤销审核回到待审队列并对齐前后端
Made-with: Cursor
This commit is contained in:
parent
922cf83dfe
commit
af54ee645f
@ -2,8 +2,10 @@ package com.competition.modules.pub.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.competition.common.enums.ErrorCode;
|
||||||
import com.competition.common.exception.BusinessException;
|
import com.competition.common.exception.BusinessException;
|
||||||
import com.competition.common.result.PageResult;
|
import com.competition.common.result.PageResult;
|
||||||
import com.competition.modules.sys.entity.SysUser;
|
import com.competition.modules.sys.entity.SysUser;
|
||||||
@ -179,7 +181,7 @@ public class PublicContentReviewService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤回审核
|
* 撤回审核:已通过/已拒绝 → 待审核,重新进入审核队列(对齐设计文档,与下架 takedown 区分)
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void revoke(Long id, Long operatorId) {
|
public void revoke(Long id, Long operatorId) {
|
||||||
@ -187,9 +189,22 @@ public class PublicContentReviewService {
|
|||||||
if (work == null) {
|
if (work == null) {
|
||||||
throw new BusinessException(404, "作品不存在");
|
throw new BusinessException(404, "作品不存在");
|
||||||
}
|
}
|
||||||
work.setStatus(WorkPublishStatus.UNPUBLISHED.getValue());
|
String current = work.getStatus();
|
||||||
work.setModifyTime(LocalDateTime.now());
|
if (!WorkPublishStatus.PUBLISHED.getValue().equals(current)
|
||||||
ugcWorkMapper.updateById(work);
|
&& !WorkPublishStatus.REJECTED.getValue().equals(current)) {
|
||||||
|
throw BusinessException.of(ErrorCode.BAD_REQUEST, "当前状态不允许撤销审核");
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<UgcWork> uw = new LambdaUpdateWrapper<>();
|
||||||
|
uw.eq(UgcWork::getId, id)
|
||||||
|
.set(UgcWork::getStatus, WorkPublishStatus.PENDING_REVIEW.getValue())
|
||||||
|
.set(UgcWork::getReviewTime, null)
|
||||||
|
.set(UgcWork::getReviewerId, null)
|
||||||
|
.set(UgcWork::getReviewNote, null)
|
||||||
|
.set(UgcWork::getModifyTime, LocalDateTime.now());
|
||||||
|
if (WorkPublishStatus.PUBLISHED.getValue().equals(current)) {
|
||||||
|
uw.set(UgcWork::getPublishTime, null);
|
||||||
|
}
|
||||||
|
ugcWorkMapper.update(null, uw);
|
||||||
createLog(id, "revoke", null, null, operatorId);
|
createLog(id, "revoke", null, null, operatorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -242,8 +242,8 @@ const statsItems = computed(() => [
|
|||||||
{ key: 'rejected', label: '今日拒绝', count: stats.value.todayRejected, icon: CloseCircleOutlined, color: '#ef4444', bgColor: 'rgba(239,68,68,0.1)' },
|
{ key: 'rejected', label: '今日拒绝', count: stats.value.todayRejected, icon: CloseCircleOutlined, color: '#ef4444', bgColor: 'rgba(239,68,68,0.1)' },
|
||||||
])
|
])
|
||||||
|
|
||||||
const statusColor: Record<string, string> = { pending_review: 'orange', processing: 'blue', published: 'green', rejected: 'red', taken_down: 'default', draft: 'default' }
|
const statusColor: Record<string, string> = { pending_review: 'orange', processing: 'blue', published: 'green', rejected: 'red', taken_down: 'default', unpublished: 'purple', draft: 'default' }
|
||||||
const statusText: Record<string, string> = { pending_review: '待审核', processing: '生成中', published: '已通过', rejected: '已拒绝', taken_down: '已下架', draft: '草稿' }
|
const statusText: Record<string, string> = { pending_review: '待审核', processing: '生成中', published: '已通过', rejected: '已拒绝', taken_down: '已下架', unpublished: '未发布', draft: '草稿' }
|
||||||
const logActionText: Record<string, string> = { approve: '审核通过', reject: '审核拒绝', takedown: '下架', restore: '恢复', revoke: '撤销审核' }
|
const logActionText: Record<string, string> = { approve: '审核通过', reject: '审核拒绝', takedown: '下架', restore: '恢复', revoke: '撤销审核' }
|
||||||
const logActionColor: Record<string, string> = { approve: 'green', reject: 'red', takedown: 'gray', restore: 'blue', revoke: 'orange' }
|
const logActionColor: Record<string, string> = { approve: 'green', reject: 'red', takedown: 'gray', restore: 'blue', revoke: 'orange' }
|
||||||
const formatDate = (d: string) => d ? dayjs(d).format('YYYY-MM-DD HH:mm') : '-'
|
const formatDate = (d: string) => d ? dayjs(d).format('YYYY-MM-DD HH:mm') : '-'
|
||||||
@ -441,6 +441,10 @@ const handleRevoke = (id: number) => {
|
|||||||
try {
|
try {
|
||||||
await request.post(`/content-review/works/${id}/revoke`)
|
await request.post(`/content-review/works/${id}/revoke`)
|
||||||
message.success('已撤销')
|
message.success('已撤销')
|
||||||
|
// 切到待审核便于立刻看到重新入队的作品
|
||||||
|
searchStatus.value = 'pending_review'
|
||||||
|
activeFilter.value = 'pending_review'
|
||||||
|
pagination.current = 1
|
||||||
fetchList(); fetchStats()
|
fetchList(); fetchStats()
|
||||||
// 如果在详情里撤销,刷新详情
|
// 如果在详情里撤销,刷新详情
|
||||||
if (detailVisible.value && detailData.value?.id === id) {
|
if (detailVisible.value && detailData.value?.id === id) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user