代理星级反转

This commit is contained in:
2025-01-07 14:18:52 +08:00
parent ddd14f7a6c
commit 094c5c2f54
4 changed files with 19 additions and 15 deletions

View File

@@ -54,4 +54,6 @@ public class RechargeUserVo extends RechargeUser {
@ApiModelProperty("近三十天转赠的金币")
private Long giveGold;
private Integer starLevelSeq;
}

View File

@@ -9,7 +9,8 @@
rur.seq,
cr.type,
r.room_id as roomId,
ru.star_level starLevel
ru.star_level starLevel,
ru.star_level starLevelSeq
from recharge_user as ru
left join users as u on u.uid = ru.uid
left join charge_region as cr on ((ru.`type` <![CDATA[ & ]]> cr.`type`) != 0)
@@ -23,7 +24,8 @@
u.erban_no as erbanNo,
u.nick,
u.avatar,
ru.star_level starLevel
ru.star_level starLevel,
ru.star_level starLevelSeq
from recharge_user ru
inner join users u on ru.uid = u.uid
where u.partition_id = #{partitionId}

View File

@@ -196,9 +196,8 @@ public class GuildUsdChannelService {
}
Map<Long, BigDecimal> recordMap = recordList.stream().collect(Collectors.toMap(GuildUsdBillRecord::getTargetUid, GuildUsdBillRecord::getOperateCurrency));
List<RechargeUserVo> voList = rechargeUserVoList.stream().sorted(Comparator.comparing(RechargeUserVo::getStarLevel).reversed())
List<RechargeUserVo> voList = rechargeUserVoList.stream().sorted(Comparator.comparing(RechargeUserVo::getStarLevelSeq).reversed())
.collect(Collectors.toList());
Collections.reverse(voList);
return voList;
}
}

View File

@@ -54,17 +54,18 @@ public class RechargeUserController {
List<RechargeUserVo> rechargeUserVos = rechargeUserService.selectList(regionCode);
if (CollectionUtils.isNotEmpty(rechargeUserVos)) {
// List<Long> uids = rechargeUserVos.stream().map(RechargeUser::getUid).collect(Collectors.toList());
// Date date = new Date();
// Map<Long, Long> fromUserGiveGoldMap = diamondGiveHistoryService.getFromUserGiveGoldMap(uids, DateUtil.offsetDay(date, -30), date);
// for (RechargeUserVo rechargeUserVo : rechargeUserVos) {
// Long goldNum = fromUserGiveGoldMap.get(rechargeUserVo.getUid());
// goldNum = goldNum == null ? 0 : goldNum;
// rechargeUserVo.setGiveGold(goldNum);
// }
Comparator<RechargeUserVo> comparator2 = Comparator.comparing(RechargeUserVo::getStarLevel).reversed()
.thenComparing(RechargeUserVo::getIsOnline, Comparator.reverseOrder());
rechargeUserVos.stream().sorted(comparator2) .collect(Collectors.toList());
List<Long> uids = rechargeUserVos.stream().map(RechargeUser::getUid).collect(Collectors.toList());
Date date = new Date();
Map<Long, Long> fromUserGiveGoldMap = diamondGiveHistoryService.getFromUserGiveGoldMap(uids, DateUtil.offsetDay(date, -30), date);
for (RechargeUserVo rechargeUserVo : rechargeUserVos) {
Long goldNum = fromUserGiveGoldMap.get(rechargeUserVo.getUid());
goldNum = goldNum == null ? 0 : goldNum;
rechargeUserVo.setGiveGold(goldNum);
}
Comparator<RechargeUserVo> comparator2 = Comparator.comparing(RechargeUserVo::getStarLevelSeq).reversed();
comparator2 = comparator2.thenComparing(RechargeUserVo::getIsOnline, Comparator.reverseOrder());
comparator2 = comparator2.thenComparing(RechargeUserVo::getGiveGold, Comparator.reverseOrder());
rechargeUserVos = rechargeUserVos.stream().sorted(comparator2).collect(Collectors.toList());
}
return BusiResult.success(rechargeUserVos);
}