新增发送通知2

This commit is contained in:
tianfeng 2025-12-05 18:14:51 +08:00
parent a2492c66b5
commit 9eaacf2f60

View File

@ -1,5 +1,6 @@
package com.red.circle.other.infra.common.props; package com.red.circle.other.infra.common.props;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.red.circle.common.business.core.enums.ReceiptType; import com.red.circle.common.business.core.enums.ReceiptType;
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
@ -27,9 +28,11 @@ import com.red.circle.other.infra.database.cache.service.other.EmojiCacheService
import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting; import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.rds.entity.badge.BadgeBackpack; import com.red.circle.other.infra.database.rds.entity.badge.BadgeBackpack;
import com.red.circle.other.infra.database.rds.entity.badge.BadgePictureConfig;
import com.red.circle.other.infra.database.rds.entity.props.PropsSendLog; import com.red.circle.other.infra.database.rds.entity.props.PropsSendLog;
import com.red.circle.other.infra.database.rds.entity.props.PropsSourceRecord; import com.red.circle.other.infra.database.rds.entity.props.PropsSourceRecord;
import com.red.circle.other.infra.database.rds.service.badge.BadgeBackpackService; import com.red.circle.other.infra.database.rds.service.badge.BadgeBackpackService;
import com.red.circle.other.infra.database.rds.service.badge.BadgePictureConfigService;
import com.red.circle.other.infra.database.rds.service.badge.RoomBadgeBackpackService; import com.red.circle.other.infra.database.rds.service.badge.RoomBadgeBackpackService;
import com.red.circle.other.infra.database.rds.service.emoji.EmojiBagService; import com.red.circle.other.infra.database.rds.service.emoji.EmojiBagService;
import com.red.circle.other.infra.database.rds.service.gift.GiftBackpackService; import com.red.circle.other.infra.database.rds.service.gift.GiftBackpackService;
@ -40,6 +43,7 @@ import com.red.circle.other.infra.database.rds.service.props.PropsVipActualEquit
import com.red.circle.other.infra.database.rds.service.user.user.ConsumptionLevelService; import com.red.circle.other.infra.database.rds.service.user.user.ConsumptionLevelService;
import com.red.circle.other.infra.utils.I18nUtils; import com.red.circle.other.infra.utils.I18nUtils;
import com.red.circle.other.inner.asserts.OtherErrorCode; import com.red.circle.other.inner.asserts.OtherErrorCode;
import com.red.circle.other.inner.enums.material.BadgeConfigTypeEnum;
import com.red.circle.other.inner.enums.material.NobleVipEnum; import com.red.circle.other.inner.enums.material.NobleVipEnum;
import com.red.circle.other.inner.enums.material.PropsCommodityType; import com.red.circle.other.inner.enums.material.PropsCommodityType;
import com.red.circle.other.inner.model.cmd.material.PrizeDescribe; import com.red.circle.other.inner.model.cmd.material.PrizeDescribe;
@ -98,6 +102,7 @@ public class PropsSendCommon {
private final PropCouponGateway propCouponGateway; private final PropCouponGateway propCouponGateway;
private final OfficialNoticeClient officialNoticeClient; private final OfficialNoticeClient officialNoticeClient;
private final UserRegionGateway userRegionGateway; private final UserRegionGateway userRegionGateway;
private final BadgePictureConfigService badgePictureConfigService;
/** /**
* 发送奖励. * 发送奖励.
@ -251,11 +256,25 @@ public class PropsSendCommon {
propsSendLog.setCreateTime(TimestampUtils.now()); propsSendLog.setCreateTime(TimestampUtils.now());
propsSendLog.setUpdateTime(TimestampUtils.now()); propsSendLog.setUpdateTime(TimestampUtils.now());
try { try {
String url = null;
Long propsId = DataTypeUtils.toLong(conf.getContent());
PropsSourceRecord props = propsSourceRecordService.getPropsById(propsId);
if (props != null) {
url = props.getCover();
}
Map<String, Object> map = new HashMap<>();
map.put("propType", conf.getDetailType());
if (BadgeConfigTypeEnum.of(conf.getDetailType())) {
BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(SysOriginPlatformEnum.LIKEI.name(), propsId);
url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : "";
}
officialNoticeClient.send( officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder().toAccount(param.getAcceptUserId()) NoticeExtTemplateCustomizeCmd.builder().toAccount(param.getAcceptUserId())
.noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS)
.title(JSON.toJSONString(map))
.content(I18nUtils.getPropsRewardContent(conf.getDetailType(), conf.getQuantity(), I18nUtils.getLanguageByRegion(region.getRegionName()))) .content(I18nUtils.getPropsRewardContent(conf.getDetailType(), conf.getQuantity(), I18nUtils.getLanguageByRegion(region.getRegionName())))
.expand(null) .expand(url)
.build()); .build());
} catch (Exception e) { } catch (Exception e) {
log.error("saveSendLog 发送通知失败{}", e.getMessage()); log.error("saveSendLog 发送通知失败{}", e.getMessage());