独联体发放的钻石奖励加上对应发放的额外钻石数量

This commit is contained in:
2025-10-17 15:30:23 +08:00
parent a94cd19025
commit 9138c19853
2 changed files with 22 additions and 19 deletions

View File

@@ -319,9 +319,9 @@ public enum I18nAlertEnum {
GOLD_BEAN_NAME("Gold Bean"), GOLD_BEAN_NAME("Gold Bean"),
DIAMOND_NAME("DIAMOND"), DIAMOND_NAME("DIAMOND"),
GUILD_CREATE_TASK_MSG("你在公会的卓越表现,获得了精美奖励。快去背包看看吧!"), GUILD_CREATE_TASK_MSG("你在公会的卓越表现,获得了精美奖励。快去背包看看吧!"),
EXTRA_GUILD_MSG("你的钻石奖励已经发放,请注意查收"), EXTRA_GUILD_MSG("尊敬的用户,根据政策,您的公会长次日奖励{0}钻石已到账,您可以前往【我的钱包】查看"),
EXTRA_GUILD_MEMBER_MSG("你的钻石奖励已经发放,请注意查收"), EXTRA_GUILD_MEMBER_MSG("尊敬的用户,根据政策,您的主播次日奖励{0}钻石已到账,您可以前往【我的钱包】查看"),
EXTRA_ROOM_MSG("你的钻石奖励已经发放,请注意查收"), EXTRA_ROOM_MSG("尊敬的用户,根据政策,您每周一结算的奖励{0}钻石已到账,您可以前往【我的钱包】查看"),
; ;
private final String defaultStr; private final String defaultStr;

View File

@@ -138,19 +138,20 @@ public class ExtraDiamondDayService {
boolean updateBatchById = guildExtraDiamondDayService.updateBatchById(guildExtraDiamondDays); boolean updateBatchById = guildExtraDiamondDayService.updateBatchById(guildExtraDiamondDays);
if (!updateBatchById) { if (!updateBatchById) {
} }
HashSet<Long> uids = new HashSet<>(); Map<Long, BigDecimal> sendGoldMap = new HashMap<>();
for (GuildExtraDiamondDay extraDiamondDay : guildExtraDiamondDays) { for (GuildExtraDiamondDay extraDiamondDay : guildExtraDiamondDays) {
BigDecimal sendGold = BigDecimal.ZERO;
if (extraDiamondDay.getAnchorExtraNum().compareTo(BigDecimal.ZERO) > 0) { if (extraDiamondDay.getAnchorExtraNum().compareTo(BigDecimal.ZERO) > 0) {
userPurseService.addGold(extraDiamondDay.getUid(), extraDiamondDay.getAnchorExtraNum().doubleValue(), ANCHOR_EXTRA_GOLD); userPurseService.addGold(extraDiamondDay.getUid(), extraDiamondDay.getAnchorExtraNum().doubleValue(), ANCHOR_EXTRA_GOLD);
uids.add(extraDiamondDay.getUid()); sendGold = sendGold.add(extraDiamondDay.getAnchorExtraNum());
} }
if (extraDiamondDay.getAnchorExtraLuckyNum().compareTo(BigDecimal.ZERO) > 0) { if (extraDiamondDay.getAnchorExtraLuckyNum().compareTo(BigDecimal.ZERO) > 0) {
userPurseService.addGold(extraDiamondDay.getUid(), extraDiamondDay.getAnchorExtraLuckyNum().doubleValue(), ANCHOR_EXTRA_LUCKY_GOLD); userPurseService.addGold(extraDiamondDay.getUid(), extraDiamondDay.getAnchorExtraLuckyNum().doubleValue(), ANCHOR_EXTRA_LUCKY_GOLD);
uids.add(extraDiamondDay.getUid()); sendGold = sendGold.add(extraDiamondDay.getAnchorExtraLuckyNum());
} }
sendGoldMap.put(extraDiamondDay.getUid(), sendGold);
} }
String message = I18NMessageSourceUtil.getMessage(I18nAlertEnum.EXTRA_GUILD_MEMBER_MSG, partitionId); this.sendMessage(I18nAlertEnum.EXTRA_GUILD_MEMBER_MSG, sendGoldMap, partitionId);
this.sendMessage(message, uids);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("sendGuildMemberExtraDiamondTask anchor error" , e); log.error("sendGuildMemberExtraDiamondTask anchor error" , e);
@@ -204,15 +205,14 @@ public class ExtraDiamondDayService {
ownerExtra = ownerExtra == null ? add : ownerExtra.add(add); ownerExtra = ownerExtra == null ? add : ownerExtra.add(add);
ownerExtraMap.put(ownerUid, ownerExtra); ownerExtraMap.put(ownerUid, ownerExtra);
} }
HashSet<Long> uids = new HashSet<>(); Map<Long, BigDecimal> sendGoldMap = new HashMap<>();
for (Map.Entry<Long, BigDecimal> decimalEntry : ownerExtraMap.entrySet()) { for (Map.Entry<Long, BigDecimal> decimalEntry : ownerExtraMap.entrySet()) {
if (decimalEntry.getValue().compareTo(BigDecimal.ZERO) > 0) { if (decimalEntry.getValue().compareTo(BigDecimal.ZERO) > 0) {
userPurseService.addGold(decimalEntry.getKey(), decimalEntry.getValue().doubleValue(), OWNER_EXTRA_GOLD); userPurseService.addGold(decimalEntry.getKey(), decimalEntry.getValue().doubleValue(), OWNER_EXTRA_GOLD);
uids.add(decimalEntry.getKey()); sendGoldMap.put(decimalEntry.getKey(), decimalEntry.getValue());
} }
} }
String message = I18NMessageSourceUtil.getMessage(I18nAlertEnum.EXTRA_GUILD_MSG, partitionId); this.sendMessage(I18nAlertEnum.EXTRA_GUILD_MSG, sendGoldMap, partitionId);
this.sendMessage(message, uids);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("sendGuildExtraDiamondTask anchor error" , e); log.error("sendGuildExtraDiamondTask anchor error" , e);
@@ -258,18 +258,17 @@ public class ExtraDiamondDayService {
}, },
BigDecimal::add BigDecimal::add
)); ));
HashSet<Long> uids = new HashSet<>(); Map<Long, BigDecimal> sendGoldMap = new HashMap<>();
extraDiamondMap.entrySet().stream() extraDiamondMap.entrySet().stream()
.filter(entry -> entry.getValue().compareTo(BigDecimal.ZERO) > 0) .filter(entry -> entry.getValue().compareTo(BigDecimal.ZERO) > 0)
.forEach(entry -> { .forEach(entry -> {
Long roomUid = entry.getKey(); Long roomUid = entry.getKey();
BigDecimal extraDiamond = entry.getValue(); BigDecimal extraDiamond = entry.getValue();
userPurseService.addGold(roomUid, extraDiamond.doubleValue(), ROOM_EXTRA_GOLD); userPurseService.addGold(roomUid, extraDiamond.doubleValue(), ROOM_EXTRA_GOLD);
uids.add(roomUid); sendGoldMap.put(roomUid, extraDiamond);
}); });
String message = I18NMessageSourceUtil.getMessage(I18nAlertEnum.EXTRA_GUILD_MEMBER_MSG, partitionId); this.sendMessage(I18nAlertEnum.EXTRA_ROOM_MSG, sendGoldMap, partitionId);
this.sendMessage(message, uids);
} catch (Exception e) { } catch (Exception e) {
log.error("sendLastDayDiamondtask room error" , e); log.error("sendLastDayDiamondtask room error" , e);
} finally { } finally {
@@ -280,9 +279,13 @@ public class ExtraDiamondDayService {
} }
@Async @Async
public void sendMessage(String msg, Set<Long> uids) { public void sendMessage(I18nAlertEnum msg, Map<Long, BigDecimal> sendGoldMap, Integer partitionId) {
uids.forEach(uid -> { sendGoldMap.entrySet().forEach(entry -> {
baseSendService.sendSystemMsg(uid.toString(), msg); if (entry.getValue().compareTo(BigDecimal.ZERO) <= 0) {
return;
}
String message = I18NMessageSourceUtil.getMessage(msg, new Object[]{entry.getValue()}, partitionId);
baseSendService.sendSystemMsg(entry.getKey().toString(), message);
}); });
} }
} }