周星任务修改
This commit is contained in:
parent
12b9151f21
commit
04c88b1640
@ -362,80 +362,6 @@ public class WeeklyRewardsSentManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送上周周星奖励.
|
||||
*/
|
||||
public void sendLastWeekStar(SysOriginPlatformEnum sysOrigin) {
|
||||
|
||||
List<GiftConfigCO> gifts = lastWeekStarGift(sysOrigin);
|
||||
if (CollectionUtils.isEmpty(gifts) || gifts.size() < 3) {
|
||||
log.warn("周星奖励主动发送:活动礼物不是三个,不发送任何奖励.系统:{}", sysOrigin.name());
|
||||
return;
|
||||
}
|
||||
log.warn("上周三个周星礼物: {}.系统:{}", JacksonUtils.toJson(gifts), sysOrigin.name());
|
||||
|
||||
List<ActivityResourceCO> activityResources = activityMapper
|
||||
.toListActivityResourceCO(activitySourceGroupGateway
|
||||
.listActivityResource(sysOrigin, PropsActivityTypeEnum.STAR));
|
||||
if (CollectionUtils.isEmpty(activityResources) || activityResources.size() < 12) {
|
||||
log.warn("周星奖励主动发送:规则配置没有12组,不发送任何奖励.系统:{}", sysOrigin.name());
|
||||
return;
|
||||
}
|
||||
List<List<ActivityResourceCO>> listResources = Lists
|
||||
.partition(activityResources.stream().filter(activityResourceCO ->
|
||||
activityResourceCO.getRule().getSort() > 3).collect(Collectors.toList()), 3);
|
||||
|
||||
// 将三组奖励循环
|
||||
for (int resourcesIndex = 0; resourcesIndex < listResources.size(); resourcesIndex++) {
|
||||
|
||||
// 礼物i - Top成员
|
||||
List<WeekStarGiftCount> giftUsers = weekStarGiftCountService
|
||||
.listLastWeekTop(sysOrigin.name(), gifts.get(resourcesIndex).getId(), 3);
|
||||
|
||||
if (CollectionUtils.isEmpty(giftUsers)) {
|
||||
log.warn("周星奖励主动发送:活动礼物序号{}, 活动礼物ID: {},没有获奖用户.系统:{}",
|
||||
resourcesIndex + 1,
|
||||
gifts.get(resourcesIndex).getId(), sysOrigin.name());
|
||||
continue;
|
||||
}
|
||||
// 奖励
|
||||
List<ActivityResourceCO> resourcesList = listResources.get(resourcesIndex);
|
||||
|
||||
// 给具体用户发具体奖励组
|
||||
for (int userIndex = 0; userIndex < giftUsers.size(); userIndex++) {
|
||||
|
||||
// 获得具体奖励与具体用户
|
||||
ActivityResourceCO detailedAward = resourcesList.get(userIndex);
|
||||
if (Objects.isNull(detailedAward)) {
|
||||
log.warn("周星奖励主动发送:活动礼物{},top{} 配置不存在.系统:{}", resourcesIndex + 1,
|
||||
userIndex + 1,
|
||||
sysOrigin.name());
|
||||
continue;
|
||||
}
|
||||
WeekStarGiftCount user = giftUsers.get(userIndex);
|
||||
if (Objects.isNull(user)) {
|
||||
log.warn("周星奖励主动发送:活动礼物{},top{} 用户不存在.系统:{}", resourcesIndex + 1,
|
||||
userIndex + 1,
|
||||
sysOrigin.name());
|
||||
continue;
|
||||
}
|
||||
|
||||
// 发送奖励
|
||||
sendPropsManager.sendActivityGroup(SendRewardGroup.builder()
|
||||
.trackId(detailedAward.getRule().getId())
|
||||
.sysOrigin(sysOrigin)
|
||||
.acceptUserId(user.getUserId())
|
||||
.resourceGroupId(detailedAward.getRule().getResourceGroupId())
|
||||
.origin(SendPropsOrigin.WEEK_STAR)
|
||||
.build());
|
||||
log.warn("周星奖励主动发送:活动礼物{},top{} 用户:{} 奖励已发送.系统:{}", resourcesIndex + 1,
|
||||
userIndex + 1,
|
||||
user.getUserId(), sysOrigin.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 只需3组资源配置 sendLastWeekStar方法 需要12组配置
|
||||
* @param sysOrigin
|
||||
@ -462,7 +388,7 @@ public class WeeklyRewardsSentManager {
|
||||
|
||||
// 获取当前礼物的Top3用户
|
||||
List<WeekStarGiftCount> giftUsers = weekStarGiftCountService
|
||||
.listThisWeekTopV2(sysOrigin.name(),3);
|
||||
.listLastWeekTopV2(sysOrigin.name(),3);
|
||||
|
||||
if (CollectionUtils.isEmpty(giftUsers)) {
|
||||
log.warn("没有获奖用户.系统:{}", sysOrigin.name());
|
||||
@ -504,7 +430,7 @@ public class WeeklyRewardsSentManager {
|
||||
* 获得上周周星礼物.
|
||||
*/
|
||||
private List<GiftConfigCO> lastWeekStarGift(SysOriginPlatformEnum sysOrigin) {
|
||||
return weekStarGroupService.getByTypeOne(sysOrigin, WeekStarGiftTypeEnum.THIS_WEEK)
|
||||
return weekStarGroupService.getByTypeOne(sysOrigin, WeekStarGiftTypeEnum.LAST_WEEK)
|
||||
.map(weekStarGroup -> appGiftConfigMapper.toGiftConfigCO(giftConfigService
|
||||
.listByIds(weekStarGiftService.listGiftIdsByGroupId(weekStarGroup.getId()))))
|
||||
.orElse(Lists.newArrayList());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user