giftStrategy性能优化
This commit is contained in:
parent
ce1d9fd16c
commit
72f9cf4255
@ -400,7 +400,7 @@ public class GiveGiftsListener implements MessageListener {
|
|||||||
// 排行榜相关
|
// 排行榜相关
|
||||||
offlineProcessGiftEvent(OfflineStatisticsGiftEventType.RANK_COUNT, runningWater);
|
offlineProcessGiftEvent(OfflineStatisticsGiftEventType.RANK_COUNT, runningWater);
|
||||||
|
|
||||||
// 钻石统计相关
|
// 火箭统计相关
|
||||||
offlineProcessGiftEvent(OfflineStatisticsGiftEventType.ROCKET_COUNT, runningWater);
|
offlineProcessGiftEvent(OfflineStatisticsGiftEventType.ROCKET_COUNT, runningWater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,15 +154,6 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
}
|
}
|
||||||
giftGiveRunningWaterService.addLog(runningWater.getId(), "开始:礼物统计相关");
|
giftGiveRunningWaterService.addLog(runningWater.getId(), "开始:礼物统计相关");
|
||||||
|
|
||||||
// try {
|
|
||||||
// 如果发送的是告白礼物则发送人与接收人全部增加一次告白机会
|
|
||||||
saveConfessionChance(runningWater);
|
|
||||||
// 如果是祝福礼物,增加CP礼物记录
|
|
||||||
saveBlessingsRecord(runningWater);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("cptesttest catch:{}", e.getMessage(), e);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 幸运礼物比例
|
// 幸运礼物比例
|
||||||
BigDecimal luckyGiftRatio = gameLuckyGiftCommon.getLuckyGiftShareRatio(runningWater.getSysOrigin());
|
BigDecimal luckyGiftRatio = gameLuckyGiftCommon.getLuckyGiftShareRatio(runningWater.getSysOrigin());
|
||||||
log.info("GiftCountStrategy.processor---幸运礼物比例:{}", luckyGiftRatio);
|
log.info("GiftCountStrategy.processor---幸运礼物比例:{}", luckyGiftRatio);
|
||||||
@ -172,23 +163,9 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
.getProfileById(Long.parseLong(runningWater.getOriginId()));
|
.getProfileById(Long.parseLong(runningWater.getOriginId()));
|
||||||
|
|
||||||
if (Objects.nonNull(roomProfile)) {
|
if (Objects.nonNull(roomProfile)) {
|
||||||
|
|
||||||
// 房间粉丝人气票活动 - 保留,接下会来做这个活动
|
|
||||||
// roomFanVotesActivity(roomProfile.getId(), roomProfile.getUserId(), runningWater.getUserId(),
|
|
||||||
// runningWater.getGiftId(), giftValue.getActualAmount().longValue());
|
|
||||||
|
|
||||||
// 房间贡献相关
|
// 房间贡献相关
|
||||||
roomContribution(runningWater, roomProfile);
|
roomContribution(runningWater, roomProfile);
|
||||||
|
|
||||||
userMqMessageService.sendBadgeEvent(roomProfile.getUserId(),
|
|
||||||
BadgeKeyEnum.FORTUNE_ROOM.name());
|
|
||||||
|
|
||||||
// 团队房间内PK
|
|
||||||
processIndoorTeamPk(runningWater, roomProfile.getId(), luckyGiftRatio);
|
|
||||||
|
|
||||||
// 房间内PK
|
|
||||||
processRoomPk(runningWater, luckyGiftRatio);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 20230406 财富和魅力积分双倍
|
// 20230406 财富和魅力积分双倍
|
||||||
@ -204,24 +181,6 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
getActualAmount(isLuckyGift, giftValue.getActualAmount(),
|
getActualAmount(isLuckyGift, giftValue.getActualAmount(),
|
||||||
luckyGiftRatio));
|
luckyGiftRatio));
|
||||||
|
|
||||||
BigDecimal wealthActualAmount = isDoubleLevelExpActivity
|
|
||||||
? actualAmount.multiply(new BigDecimal(2)).setScale(0, RoundingMode.DOWN)
|
|
||||||
: actualAmount;
|
|
||||||
|
|
||||||
// 送礼物不再计入财富等级
|
|
||||||
// consumptionLevelService.incrConsumptionGolds(runningWater.getUserId(), wealthActualAmount);
|
|
||||||
//累计财富等级mq
|
|
||||||
// taskMqMessage.sendTask(TaskApprovalEvent.builder()
|
|
||||||
// .taskId(13)
|
|
||||||
// .userId(runningWater.getUserId())
|
|
||||||
// .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
|
|
||||||
// .build());
|
|
||||||
|
|
||||||
// 财富等级
|
|
||||||
// consumptionLevelService.incrConsumptionGolds(runningWater.getUserId(), wealthActualAmount);
|
|
||||||
|
|
||||||
userMqMessageService.sendBadgeEvent(runningWater.getUserId(), BadgeKeyEnum.WEALTH.name());
|
|
||||||
|
|
||||||
boolean isHighPriceGift = checkHighPriceGift(runningWater);
|
boolean isHighPriceGift = checkHighPriceGift(runningWater);
|
||||||
|
|
||||||
BigDecimal giftValueCount = BigDecimal.valueOf(getActualAmount(isLuckyGift,
|
BigDecimal giftValueCount = BigDecimal.valueOf(getActualAmount(isLuckyGift,
|
||||||
@ -235,13 +194,6 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
|
|
||||||
// 记录魅力等级
|
// 记录魅力等级
|
||||||
consumptionLevelService.incrConsumptionDiamond(accept.getAcceptUserId(), charmGiftValue);
|
consumptionLevelService.incrConsumptionDiamond(accept.getAcceptUserId(), charmGiftValue);
|
||||||
/*taskMqMessage.sendTask(TaskApprovalEvent.builder()
|
|
||||||
.taskId(14)
|
|
||||||
.userId(accept.getAcceptUserId())
|
|
||||||
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
|
|
||||||
.build());*/
|
|
||||||
|
|
||||||
userMqMessageService.sendBadgeEvent(accept.getAcceptUserId(), BadgeKeyEnum.CHARM.name());
|
|
||||||
|
|
||||||
// 保存高价值礼物公共礼物墙
|
// 保存高价值礼物公共礼物墙
|
||||||
if (isHighPriceGift) {
|
if (isHighPriceGift) {
|
||||||
@ -254,15 +206,6 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
// 家族
|
// 家族
|
||||||
// processFamily(runningWater, isLuckyGift, luckyGiftRatio);
|
// processFamily(runningWater, isLuckyGift, luckyGiftRatio);
|
||||||
|
|
||||||
// 处理关系卡
|
|
||||||
// processUserFriendCard(runningWater, isLuckyGift, luckyGiftRatio);
|
|
||||||
|
|
||||||
// 累计活动
|
|
||||||
// consumeActivity(runningWater, isLuckyGift, luckyGiftRatio);
|
|
||||||
|
|
||||||
// Spins 送礼物任务
|
|
||||||
// handleSpinsGiftTask(runningWater);
|
|
||||||
|
|
||||||
giftGiveRunningWaterService.addLog(runningWater.getId(), "结束:礼物统计相关");
|
giftGiveRunningWaterService.addLog(runningWater.getId(), "结束:礼物统计相关");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +636,7 @@ public class GiftCountStrategy implements GiftStrategy {
|
|||||||
.getValueBigDecimal(EnumConfigKey.HIGH_VALUE_GIFT_STANDARD, runningWater.getSysOrigin());
|
.getValueBigDecimal(EnumConfigKey.HIGH_VALUE_GIFT_STANDARD, runningWater.getSysOrigin());
|
||||||
|
|
||||||
if (Objects.isNull(cost)) {
|
if (Objects.isNull(cost)) {
|
||||||
throw new IllegalArgumentException("Configuration error");
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return runningWater.getGiftValue().getUnitPrice().compareTo(cost) >= 0;
|
return runningWater.getGiftValue().getUnitPrice().compareTo(cost) >= 0;
|
||||||
|
|||||||
@ -101,28 +101,6 @@ public class RankCountStrategy implements GiftStrategy {
|
|||||||
|
|
||||||
GiftValue giftValue = runningWater.getGiftValue();
|
GiftValue giftValue = runningWater.getGiftValue();
|
||||||
|
|
||||||
/*if(runningWater.getSysOrigin().equals("YOLO")) {
|
|
||||||
Map<Long, Long> userIdMap = runningWater.getAcceptUsers().stream()
|
|
||||||
.collect(Collectors.toMap(GiftAcceptUser::getAcceptUserId,
|
|
||||||
GiftAcceptUser::getAcceptUserId,
|
|
||||||
(existing, replacement) -> existing));
|
|
||||||
|
|
||||||
Set<Long> duplicateUserIdSet = userIdMap.values().stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
List<GiftAcceptUser> acceptUsers = runningWater.getAcceptUsers();
|
|
||||||
|
|
||||||
// 使用迭代器进行安全的删除操作
|
|
||||||
Iterator<GiftAcceptUser> iterator = acceptUsers.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
GiftAcceptUser user = iterator.next();
|
|
||||||
if (!user.getAnchor() && duplicateUserIdSet.contains(user.getAcceptUserId())) {
|
|
||||||
// 将需要删除的用户添加到临时列表中
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runningWater.setAcceptUsers(acceptUsers);
|
|
||||||
}*/
|
|
||||||
// 幸运礼物比例
|
// 幸运礼物比例
|
||||||
boolean isLuckyGift = isLuckyGift(giftValue);
|
boolean isLuckyGift = isLuckyGift(giftValue);
|
||||||
BigDecimal luckyGiftRatio = gameLuckyGiftCommon.getLuckyGiftShareRatio(runningWater.getSysOrigin());
|
BigDecimal luckyGiftRatio = gameLuckyGiftCommon.getLuckyGiftShareRatio(runningWater.getSysOrigin());
|
||||||
@ -163,18 +141,9 @@ public class RankCountStrategy implements GiftStrategy {
|
|||||||
countCpValue(runningWater);
|
countCpValue(runningWater);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 专属礼物
|
|
||||||
countExclusiveActivity(runningWater);
|
|
||||||
|
|
||||||
// 首页排行榜
|
// 首页排行榜
|
||||||
homeRank(runningWater, luckyGiftRatio);
|
homeRank(runningWater, luckyGiftRatio);
|
||||||
|
|
||||||
// 系统活动排行榜累计
|
|
||||||
sysActivityCount(runningWater);
|
|
||||||
|
|
||||||
// KTV游戏统计
|
|
||||||
// gameKtv(runningWater, luckyGiftRatio);
|
|
||||||
|
|
||||||
giftGiveRunningWaterService.addLog(runningWater.getId(), "结束:排行榜相关统计");
|
giftGiveRunningWaterService.addLog(runningWater.getId(), "结束:排行榜相关统计");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user