动态详情增加待审核状态判断

This commit is contained in:
tianfeng 2026-02-04 19:36:01 +08:00
parent 0c62d14e2b
commit d3fe3c28ef
4 changed files with 28 additions and 0 deletions

View File

@ -102,6 +102,7 @@ public class DynamicCommentCmdExe {
commentListCO.setContent(dynamicComment.getContent());
commentListCO.setCreateTime(dynamicComment.getCreateTime());
commentListCO.setRootCommentId(Objects.isNull(dynamicComment.getRootCommentId()) ? dynamicComment.getId() : dynamicComment.getRootCommentId());
commentListCO.setReplyCommentId(dynamicComment.getReplyCommentId());
UserProfile userProfile = userProfileMap.get(dynamicComment.getCreateUser());
if (userProfile != null) {

View File

@ -1,6 +1,7 @@
package com.red.circle.other.app.command.dynamic.query;
import com.google.common.collect.Sets;
import com.red.circle.common.business.core.enums.ApprovalStatusEnum;
import com.red.circle.common.business.dto.cmd.IdLongCmd;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
@ -8,9 +9,11 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO;
import com.red.circle.other.app.dto.clientobject.dynamic.DynamicPictureCO;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag;
import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService;
@ -52,6 +55,7 @@ public class DynamicDetailsQryExe {
private final DynamicGiftService dynamicGiftService;
private final UserSubscriptionService userSubscriptionService;
private final UserProfileAppConvertor userProfileAppConvertor;
private final ApprovalDynamicContentService approvalDynamicContentService;
public DynamicListCO execute(IdLongCmd cmd) {
@ -59,6 +63,10 @@ public class DynamicDetailsQryExe {
ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamic);
ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamic.getDel());
ApprovalDynamicContent approvalDynamicContent = approvalDynamicContentService.getByDynamicId(dynamic.getId());
ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, approvalDynamicContent != null &&
ApprovalStatusEnum.NOT_PASS.name().equals(approvalDynamicContent.getApproveStatus()));
UserProfileDTO baseInfo = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(dynamic.getCreateUser()));
ResponseAssert.notNull(CommonErrorCode.NO_SUITABLE_CONTENT, dynamic);

View File

@ -32,4 +32,9 @@ public interface ApprovalDynamicContentService extends BaseService<ApprovalDynam
* @return 待审核动态ID列表
*/
List<Long> listPendingDynamicIds();
/**
* 根据动态id获取审核数据
*/
ApprovalDynamicContent getByDynamicId(Long dynamicId);
}

View File

@ -90,4 +90,18 @@ public class ApprovalDynamicContentServiceImpl extends
.filter(Objects::nonNull)
.toList();
}
@Override
public ApprovalDynamicContent getByDynamicId(Long dynamicId) {
if (Objects.isNull(dynamicId)) {
return null;
}
return query()
.eq(ApprovalDynamicContent::getDynamicId, dynamicId)
.orderByDesc(ApprovalDynamicContent::getCreateTime)
.last(PageConstant.LIMIT_ONE)
.getOne();
}
}