动态消息类型处理
This commit is contained in:
parent
6e6272bffc
commit
b1cbd6b81f
@ -29,6 +29,11 @@ public enum DynamicMessageEnum {
|
||||
*/
|
||||
LIKE_COMMENT,
|
||||
|
||||
/**
|
||||
* 动态礼物
|
||||
*/
|
||||
DYNAMIC_GIFT,
|
||||
|
||||
/**
|
||||
* 驳回举报.
|
||||
*/
|
||||
|
||||
@ -82,10 +82,12 @@ public class DynamicCommentCmdExe {
|
||||
//评论不属于自己的动态,发送消息
|
||||
if (Objects.isNull(cmd.getToUserId())) {
|
||||
cmd.setToUserId(dynamicContent.getCreateUser());
|
||||
saveDynamicMessage(cmd, DynamicMessageEnum.COMMENT_DYNAMIC);
|
||||
} else {
|
||||
//发送消息给动态被回复人
|
||||
saveDynamicMessage(cmd, DynamicMessageEnum.REPLY_COMMENT);
|
||||
}
|
||||
|
||||
//发送消息给动态被回复人
|
||||
saveDynamicMessage(cmd, DynamicMessageEnum.REPLY_COMMENT);
|
||||
return convert(dynamicComment, userProfileMap);
|
||||
}
|
||||
|
||||
|
||||
@ -2,14 +2,17 @@ package com.red.circle.other.app.command.dynamic;
|
||||
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||
import com.red.circle.common.business.enums.DynamicMessageEnum;
|
||||
import com.red.circle.other.app.common.room.DynamicCommon;
|
||||
import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeCmd;
|
||||
import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicCommentLike;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentLikeService;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService;
|
||||
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
||||
import com.red.circle.tool.core.date.TimestampUtils;
|
||||
import com.red.circle.tool.core.num.NumUtils;
|
||||
@ -35,6 +38,7 @@ public class DynamicCommentLikeCmdExe {
|
||||
private final DynamicContentService dynamicContentService;
|
||||
private final DynamicPopularService dynamicPopularService;
|
||||
private final DynamicCommentLikeService dynamicCommentLikeService;
|
||||
private final DynamicMessageService dynamicMessageService;
|
||||
|
||||
public Long execute(DynamicLikeCmd cmd) {
|
||||
|
||||
@ -52,6 +56,9 @@ public class DynamicCommentLikeCmdExe {
|
||||
//热门权重
|
||||
updateScore(cmd, content, 1);
|
||||
|
||||
// 保存点赞评论消息
|
||||
saveDynamicMessage(cmd, DynamicMessageEnum.LIKE_COMMENT);
|
||||
|
||||
dynamicCommon.sendMsg(cmd.getToUserId());
|
||||
return getIncrQuantity(cmd);
|
||||
}
|
||||
@ -119,5 +126,16 @@ public class DynamicCommentLikeCmdExe {
|
||||
.exist(cmd.getDynamicId(), cmd.getCommentId(), cmd.getReqUserId());
|
||||
}
|
||||
|
||||
private void saveDynamicMessage(DynamicLikeCmd cmd, DynamicMessageEnum type) {
|
||||
DynamicMessage message = new DynamicMessage();
|
||||
message.setId(IdWorkerUtils.getId());
|
||||
message.setDynamicContentId(cmd.getDynamicId());
|
||||
message.setDynamicCommentId(cmd.getCommentId());
|
||||
message.setType(type.name());
|
||||
message.setToUserId(cmd.getToUserId());
|
||||
message.setCreateTime(TimestampUtils.now());
|
||||
message.setCreateUser(cmd.getReqUserId());
|
||||
dynamicMessageService.save(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
package com.red.circle.other.app.command.dynamic;
|
||||
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.common.business.enums.DynamicMessageEnum;
|
||||
import com.red.circle.other.app.common.room.DynamicCommon;
|
||||
import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeCmd;
|
||||
import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicLike;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService;
|
||||
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
||||
import com.red.circle.tool.core.date.TimestampUtils;
|
||||
import com.red.circle.tool.core.num.NumUtils;
|
||||
@ -34,6 +37,7 @@ public class DynamicLikeCmdExe {
|
||||
private final DynamicCacheService dynamicCacheService;
|
||||
private final DynamicContentService dynamicContentService;
|
||||
private final DynamicPopularService dynamicPopularService;
|
||||
private final DynamicMessageService dynamicMessageService;
|
||||
|
||||
public Long execute(DynamicLikeCmd cmd) {
|
||||
|
||||
@ -55,6 +59,9 @@ public class DynamicLikeCmdExe {
|
||||
dynamicPopularService.updateScore(content.getId(), dynamicCacheService.getLikeScore(),
|
||||
cmd.getReqSysOrigin().getOrigin(), content.getRegion());
|
||||
|
||||
// 保存点赞动态消息
|
||||
saveDynamicMessage(cmd, content, DynamicMessageEnum.LIKE_DYNAMIC);
|
||||
|
||||
dynamicCommon.sendMsg(content.getCreateUser());
|
||||
return quantity;
|
||||
}
|
||||
@ -99,5 +106,15 @@ public class DynamicLikeCmdExe {
|
||||
return dynamicLikeService.exist(cmd.getDynamicId(), cmd.getReqUserId());
|
||||
}
|
||||
|
||||
private void saveDynamicMessage(DynamicLikeCmd cmd, DynamicContent content, DynamicMessageEnum type) {
|
||||
DynamicMessage message = new DynamicMessage();
|
||||
message.setId(IdWorkerUtils.getId());
|
||||
message.setDynamicContentId(cmd.getDynamicId());
|
||||
message.setType(type.name());
|
||||
message.setToUserId(content.getCreateUser());
|
||||
message.setCreateTime(TimestampUtils.now());
|
||||
message.setCreateUser(cmd.getReqUserId());
|
||||
dynamicMessageService.save(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class DynamicMessageQryExe {
|
||||
}
|
||||
|
||||
private PageResult<DynamicMessage> getMessages(DynamicLimitCmd cmd) {
|
||||
return dynamicMessageService.pageByTimeDesc(cmd.getPageReq(), cmd.getReqUserId());
|
||||
return dynamicMessageService.pageByTimeDesc(cmd.getPageReq(), cmd.getReqUserId(), cmd.getDynamicMessageEnums());
|
||||
}
|
||||
|
||||
private Set<Long> getUserIds(PageResult<DynamicMessage> messages) {
|
||||
|
||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.red.circle.common.business.core.enums.GameStateEnum;
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
import com.red.circle.common.business.enums.DynamicMessageEnum;
|
||||
import com.red.circle.component.redis.service.RedisService;
|
||||
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
|
||||
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd;
|
||||
@ -43,6 +44,8 @@ import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManager
|
||||
import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService;
|
||||
import com.red.circle.other.infra.database.mongo.service.user.count.UserGuardCountService;
|
||||
import com.red.circle.other.infra.database.mongo.service.user.count.WeekFriendshipCardCountService;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent;
|
||||
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage;
|
||||
import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord;
|
||||
import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkRecord;
|
||||
import com.red.circle.other.infra.database.rds.entity.user.user.ConfessionChance;
|
||||
@ -52,6 +55,7 @@ import com.red.circle.other.infra.database.rds.entity.user.user.CpValue;
|
||||
import com.red.circle.other.infra.database.rds.entity.user.user.FriendshipCard;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService;
|
||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService;
|
||||
import com.red.circle.other.infra.database.rds.service.game.GameRoomPkIntegralRecordService;
|
||||
import com.red.circle.other.infra.database.rds.service.game.GameRoomPkRecordService;
|
||||
import com.red.circle.other.infra.database.rds.service.live.RoomContributionBalanceService;
|
||||
@ -135,6 +139,7 @@ public class GiftCountStrategy implements GiftStrategy {
|
||||
private final RedisService redisService;
|
||||
private final DynamicContentService dynamicContentService;
|
||||
private final DynamicGiftService dynamicGiftService;
|
||||
private final DynamicMessageService dynamicMessageService;
|
||||
private static final List<String> inRegionCodes = List.of("IN", "PK", "BD");
|
||||
private final UserRegionCacheService userRegionCacheService;
|
||||
|
||||
@ -729,7 +734,7 @@ public class GiftCountStrategy implements GiftStrategy {
|
||||
}
|
||||
|
||||
// 验证动态是否存在
|
||||
com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent dynamicContent =
|
||||
DynamicContent dynamicContent =
|
||||
dynamicContentService.getById(runningWater.getDynamicContentId());
|
||||
|
||||
if (dynamicContent == null || Boolean.TRUE.equals(dynamicContent.getDel())) {
|
||||
@ -757,6 +762,13 @@ public class GiftCountStrategy implements GiftStrategy {
|
||||
giftValue.getUnitPrice()
|
||||
);
|
||||
|
||||
dynamicMessageService.save(
|
||||
runningWater.getGiftId() + " * " + giftValue.getQuantity(),
|
||||
Long.parseLong(runningWater.getDynamicContentId()),
|
||||
dynamicContent.getCreateUser(),
|
||||
DynamicMessageEnum.DYNAMIC_GIFT
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理动态礼物失败", e);
|
||||
}
|
||||
|
||||
@ -2,9 +2,12 @@ package com.red.circle.other.app.dto.cmd.dynamic;
|
||||
|
||||
import com.red.circle.common.business.dto.PageReq;
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.common.business.enums.DynamicMessageEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 动态-内容分页.
|
||||
*
|
||||
@ -20,4 +23,6 @@ public class DynamicLimitCmd extends AppExtCommand {
|
||||
*/
|
||||
private PageReq pageReq;
|
||||
|
||||
private List<DynamicMessageEnum> dynamicMessageEnums;
|
||||
|
||||
}
|
||||
|
||||
@ -39,6 +39,12 @@ public class DynamicMessage extends TimestampBaseEntity {
|
||||
@TableField("dynamic_content_id")
|
||||
private Long dynamicContentId;
|
||||
|
||||
/**
|
||||
* 动态评论ID
|
||||
*/
|
||||
@TableField("dynamic_comment_id")
|
||||
private Long dynamicCommentId;
|
||||
|
||||
/**
|
||||
* 内容.
|
||||
*/
|
||||
|
||||
@ -46,7 +46,7 @@ public interface DynamicMessageService extends BaseService<DynamicMessage> {
|
||||
* @param pageNumber 第几页
|
||||
* @param toUserId 被评价人或点赞ID
|
||||
*/
|
||||
PageResult<DynamicMessage> pageByTimeDesc(PageQuery pageQuery, Long toUserId);
|
||||
PageResult<DynamicMessage> pageByTimeDesc(PageQuery pageQuery, Long toUserId, List<DynamicMessageEnum> dynamicMessageEnums);
|
||||
|
||||
/**
|
||||
* 我的消息列表统计
|
||||
|
||||
@ -11,12 +11,8 @@ import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageSer
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.date.TimestampUtils;
|
||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -93,11 +89,13 @@ public class DynamicMessageServiceImpl extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DynamicMessage> pageByTimeDesc(PageQuery pageQuery, Long toUserId) {
|
||||
public PageResult<DynamicMessage> pageByTimeDesc(PageQuery pageQuery, Long toUserId, List<DynamicMessageEnum> dynamicMessageEnums) {
|
||||
|
||||
return query()
|
||||
.eq(DynamicMessage::getToUserId, toUserId)
|
||||
.eq(DynamicMessage::getDel, Boolean.FALSE)
|
||||
.in(dynamicMessageEnums != null, DynamicMessage::getType,
|
||||
dynamicMessageEnums != null ? dynamicMessageEnums.stream().map(Enum::name).toList() : Collections.emptyList())
|
||||
.orderByDesc(DynamicMessage::getCreateTime)
|
||||
.page(pageQuery);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user