我的回复 图片处理
This commit is contained in:
parent
6ded4a43e3
commit
11c3f6218e
@ -83,8 +83,6 @@ public class DynamicCommentCmdExe {
|
|||||||
|
|
||||||
|
|
||||||
//content 设置为图片url
|
//content 设置为图片url
|
||||||
cmd.setContent(dynamicPictureService.getFirstNormalPic(dynamicContent.getId()));
|
|
||||||
|
|
||||||
if (Objects.isNull(cmd.getToUserId())) {
|
if (Objects.isNull(cmd.getToUserId())) {
|
||||||
cmd.setToUserId(dynamicContent.getCreateUser());
|
cmd.setToUserId(dynamicContent.getCreateUser());
|
||||||
saveDynamicMessage(cmd, DynamicMessageEnum.COMMENT_DYNAMIC);
|
saveDynamicMessage(cmd, DynamicMessageEnum.COMMENT_DYNAMIC);
|
||||||
|
|||||||
@ -61,7 +61,6 @@ public class DynamicCommentLikeCmdExe {
|
|||||||
// 保存点赞评论消息
|
// 保存点赞评论消息
|
||||||
saveDynamicMessage(cmd, DynamicMessageEnum.LIKE_COMMENT);
|
saveDynamicMessage(cmd, DynamicMessageEnum.LIKE_COMMENT);
|
||||||
|
|
||||||
dynamicCommon.sendMsg(cmd.getToUserId());
|
|
||||||
return getIncrQuantity(cmd);
|
return getIncrQuantity(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ 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.DynamicContentService;
|
||||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService;
|
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.infra.database.rds.service.dynamic.DynamicMessageService;
|
||||||
|
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService;
|
||||||
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
||||||
import com.red.circle.tool.core.date.TimestampUtils;
|
import com.red.circle.tool.core.date.TimestampUtils;
|
||||||
import com.red.circle.tool.core.num.NumUtils;
|
import com.red.circle.tool.core.num.NumUtils;
|
||||||
@ -38,6 +39,7 @@ public class DynamicLikeCmdExe {
|
|||||||
private final DynamicContentService dynamicContentService;
|
private final DynamicContentService dynamicContentService;
|
||||||
private final DynamicPopularService dynamicPopularService;
|
private final DynamicPopularService dynamicPopularService;
|
||||||
private final DynamicMessageService dynamicMessageService;
|
private final DynamicMessageService dynamicMessageService;
|
||||||
|
private final DynamicPictureService dynamicPictureService;
|
||||||
|
|
||||||
public Long execute(DynamicLikeCmd cmd) {
|
public Long execute(DynamicLikeCmd cmd) {
|
||||||
|
|
||||||
@ -110,6 +112,7 @@ public class DynamicLikeCmdExe {
|
|||||||
DynamicMessage message = new DynamicMessage();
|
DynamicMessage message = new DynamicMessage();
|
||||||
message.setId(IdWorkerUtils.getId());
|
message.setId(IdWorkerUtils.getId());
|
||||||
message.setDynamicContentId(cmd.getDynamicId());
|
message.setDynamicContentId(cmd.getDynamicId());
|
||||||
|
message.setContent(dynamicPictureService.getFirstNormalPic(cmd.getDynamicId()));
|
||||||
message.setType(type.name());
|
message.setType(type.name());
|
||||||
message.setToUserId(content.getCreateUser());
|
message.setToUserId(content.getCreateUser());
|
||||||
message.setCreateTime(TimestampUtils.now());
|
message.setCreateTime(TimestampUtils.now());
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package com.red.circle.other.app.command.dynamic.query;
|
package com.red.circle.other.app.command.dynamic.query;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
import com.red.circle.common.business.enums.DynamicMessageEnum;
|
import com.red.circle.common.business.enums.DynamicMessageEnum;
|
||||||
import com.red.circle.framework.dto.PageResult;
|
import com.red.circle.framework.dto.PageResult;
|
||||||
import com.red.circle.other.app.dto.clientobject.dynamic.DynamicMessageListCO;
|
import com.red.circle.other.app.dto.clientobject.dynamic.DynamicMessageListCO;
|
||||||
|
import com.red.circle.other.app.dto.clientobject.dynamic.MessageItemCO;
|
||||||
import com.red.circle.other.app.dto.cmd.dynamic.DynamicLimitCmd;
|
import com.red.circle.other.app.dto.cmd.dynamic.DynamicLimitCmd;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||||
import com.red.circle.other.domain.model.user.UserProfile;
|
import com.red.circle.other.domain.model.user.UserProfile;
|
||||||
@ -12,7 +15,7 @@ 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.DynamicContentService;
|
||||||
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService;
|
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -59,9 +62,10 @@ public class DynamicMessageQryExe {
|
|||||||
messageCO.setType(message.getType());
|
messageCO.setType(message.getType());
|
||||||
messageCO.setUserId(message.getCreateUser());
|
messageCO.setUserId(message.getCreateUser());
|
||||||
messageCO.setCreateTime(message.getCreateTime());
|
messageCO.setCreateTime(message.getCreateTime());
|
||||||
messageCO.setMessageContent(message.getContent());
|
|
||||||
messageCO.setDynamicId(message.getDynamicContentId());
|
messageCO.setDynamicId(message.getDynamicContentId());
|
||||||
messageCO.setDynamicContent(dynamicContent.getContent());
|
messageCO.setDynamicContent(dynamicContent.getContent());
|
||||||
|
// 处理messageContent 和 giftCount
|
||||||
|
parseMessageContent(messageCO, message);
|
||||||
|
|
||||||
if (DynamicMessageEnum.isReportRelated(message.getType())) {
|
if (DynamicMessageEnum.isReportRelated(message.getType())) {
|
||||||
return messageCO;
|
return messageCO;
|
||||||
@ -81,6 +85,26 @@ public class DynamicMessageQryExe {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void parseMessageContent(DynamicMessageListCO co, DynamicMessage message) {
|
||||||
|
if (message == null || co == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(message.getContent())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DynamicMessageEnum.DYNAMIC_GIFT.name().equals(message.getType())) {
|
||||||
|
co.setMessageContent(message.getContent());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
MessageItemCO messageItemCO = JSON.parseObject(message.getContent(), MessageItemCO.class);
|
||||||
|
co.setMessageContent(messageItemCO.getMessageContent());
|
||||||
|
co.setGiftCount(messageItemCO.getGiftCount());
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Map<Long, DynamicContent> getContentMap(PageResult<DynamicMessage> messages) {
|
private Map<Long, DynamicContent> getContentMap(PageResult<DynamicMessage> messages) {
|
||||||
return dynamicContentService
|
return dynamicContentService
|
||||||
.mapByIds(messages.getRecords().stream().map(DynamicMessage::getDynamicContentId).collect(
|
.mapByIds(messages.getRecords().stream().map(DynamicMessage::getDynamicContentId).collect(
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.red.circle.mq.rocket.business.producer.TaskMqMessage;
|
|||||||
import com.red.circle.mq.rocket.business.producer.UserMqMessageService;
|
import com.red.circle.mq.rocket.business.producer.UserMqMessageService;
|
||||||
import com.red.circle.other.app.common.game.GameIndoorTeamPkCommon;
|
import com.red.circle.other.app.common.game.GameIndoorTeamPkCommon;
|
||||||
import com.red.circle.other.app.common.gift.GameLuckyGiftCommon;
|
import com.red.circle.other.app.common.gift.GameLuckyGiftCommon;
|
||||||
|
import com.red.circle.other.app.dto.clientobject.dynamic.MessageItemCO;
|
||||||
import com.red.circle.other.app.dto.clientobject.game.GameRoomPkUserCO;
|
import com.red.circle.other.app.dto.clientobject.game.GameRoomPkUserCO;
|
||||||
import com.red.circle.other.app.dto.cmd.SpinsTaskProgressUpdateCmd;
|
import com.red.circle.other.app.dto.cmd.SpinsTaskProgressUpdateCmd;
|
||||||
import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeCmd;
|
import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeCmd;
|
||||||
@ -765,7 +766,7 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
|
|
||||||
// 保存消息
|
// 保存消息
|
||||||
DynamicMessage message = new DynamicMessage();
|
DynamicMessage message = new DynamicMessage();
|
||||||
message.setContent(giftUrl);
|
message.setContent(buildContent(giftUrl, giftValue.getQuantity()));
|
||||||
message.setDynamicContentId(Long.parseLong(runningWater.getDynamicContentId()));
|
message.setDynamicContentId(Long.parseLong(runningWater.getDynamicContentId()));
|
||||||
message.setToUserId( dynamicContent.getCreateUser());
|
message.setToUserId( dynamicContent.getCreateUser());
|
||||||
message.setCreateUser(runningWater.getUserId());
|
message.setCreateUser(runningWater.getUserId());
|
||||||
@ -776,6 +777,13 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildContent(String giftUrl, Integer quantity) {
|
||||||
|
MessageItemCO messageItemCO = new MessageItemCO();
|
||||||
|
messageItemCO.setGiftCount(quantity);
|
||||||
|
messageItemCO.setMessageContent(giftUrl);
|
||||||
|
return JSON.toJSONString(messageItemCO);
|
||||||
|
}
|
||||||
|
|
||||||
private void saveDynamicMessage(DynamicMessage message, DynamicMessageEnum type) {
|
private void saveDynamicMessage(DynamicMessage message, DynamicMessageEnum type) {
|
||||||
message.setId(IdWorkerUtils.getId());
|
message.setId(IdWorkerUtils.getId());
|
||||||
message.setType(type.name());
|
message.setType(type.name());
|
||||||
|
|||||||
@ -67,6 +67,11 @@ public class DynamicMessageListCO extends ClientObject {
|
|||||||
*/
|
*/
|
||||||
private String messageContent;
|
private String messageContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物数量
|
||||||
|
*/
|
||||||
|
private Integer giftCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态内容.
|
* 动态内容.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.red.circle.other.app.dto.clientobject.dynamic;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageItemCO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息内容.
|
||||||
|
*/
|
||||||
|
private String messageContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物数量
|
||||||
|
*/
|
||||||
|
private Integer giftCount;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user