跨年烟花活动-榜单结算
This commit is contained in:
@@ -5808,11 +5808,11 @@ public class Constant {
|
||||
|
||||
public static final byte SEND_DAY_RANK = 1;
|
||||
|
||||
public static final byte SEND_WEEK_RANK = 2;
|
||||
public static final byte SEND_RANK = 2;
|
||||
|
||||
public static final byte RECV_DAY_RANK = 3;
|
||||
|
||||
public static final byte RECV_WEEK_RANK = 4;
|
||||
public static final byte RECV_RANK = 4;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1800,9 +1800,9 @@ public enum RedisKey {
|
||||
room_free_gift_user_uid_gift, //房间免费礼物倒计时
|
||||
|
||||
new_year_firework_send_day_rank,
|
||||
new_year_firework_send_week_rank,
|
||||
new_year_firework_send_rank,
|
||||
new_year_firework_recv_day_rank,
|
||||
new_year_firework_recv_week_rank,
|
||||
new_year_firework_recv_rank,
|
||||
|
||||
new_year_firework_day_output_record;
|
||||
|
||||
|
@@ -39,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -328,12 +329,12 @@ public class ActNewYearFireworkService implements InitializingBean, ApplicationL
|
||||
switch (type){
|
||||
case Constant.NewYearFireworkRankType.SEND_DAY_RANK:
|
||||
return RedisKey.new_year_firework_send_day_rank.getKey(DateTimeUtil.getTodayStr());
|
||||
case Constant.NewYearFireworkRankType.SEND_WEEK_RANK:
|
||||
return RedisKey.new_year_firework_send_week_rank.getKey(DateTimeUtil.getMondayStr());
|
||||
case Constant.NewYearFireworkRankType.SEND_RANK:
|
||||
return RedisKey.new_year_firework_send_rank.getKey(DateTimeUtil.getMondayStr());
|
||||
case Constant.NewYearFireworkRankType.RECV_DAY_RANK:
|
||||
return RedisKey.new_year_firework_recv_day_rank.getKey(DateTimeUtil.getTodayStr());
|
||||
case Constant.NewYearFireworkRankType.RECV_WEEK_RANK:
|
||||
return RedisKey.new_year_firework_recv_week_rank.getKey(DateTimeUtil.getMondayStr());
|
||||
case Constant.NewYearFireworkRankType.RECV_RANK:
|
||||
return RedisKey.new_year_firework_recv_rank.getKey(DateTimeUtil.getMondayStr());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -346,7 +347,7 @@ public class ActNewYearFireworkService implements InitializingBean, ApplicationL
|
||||
dayRank.addScore(sendUid, goldNumD);
|
||||
|
||||
String week = DateTimeUtil.getMondayDateStr(sendGiftTime, DateTimeUtil.DEFAULT_DATE_PATTERN);
|
||||
String weekRankKey = RedisKey.new_year_firework_send_week_rank.getKey(week);
|
||||
String weekRankKey = RedisKey.new_year_firework_send_rank.getKey(week);
|
||||
RScoredSortedSet<Long> weekRank = redissonClient.getScoredSortedSet(weekRankKey);
|
||||
weekRank.addScore(sendUid, goldNumD);
|
||||
}
|
||||
@@ -358,11 +359,22 @@ public class ActNewYearFireworkService implements InitializingBean, ApplicationL
|
||||
dayRank.addScore(recvUid, goldNumD);
|
||||
|
||||
String week = DateTimeUtil.getMondayDateStr(sendGiftTime, DateTimeUtil.DEFAULT_DATE_PATTERN);
|
||||
String weekRankKey = RedisKey.new_year_firework_recv_week_rank.getKey(week);
|
||||
String weekRankKey = RedisKey.new_year_firework_recv_rank.getKey(week);
|
||||
RScoredSortedSet<Long> weekRank = redissonClient.getScoredSortedSet(weekRankKey);
|
||||
weekRank.addScore(recvUid, goldNumD);
|
||||
}
|
||||
|
||||
public void settlement(LocalDateTime now) {
|
||||
NewYearFireworkActConfigDTO config = getConfig();
|
||||
if (config.inActTimeRange(now)){
|
||||
//todo 每日榜
|
||||
dayOutputRecord.clear();
|
||||
} else if (null != config.getEndTime() && Duration.between(now, config.getEndTime()).toDays() <= 1L){
|
||||
//todo 总榜
|
||||
dayOutputRecord.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void log(Long uid, String event) {
|
||||
Date now = new Date();
|
||||
NewYearFireworkEventLog log = new NewYearFireworkEventLog();
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activities.ActNewYearFireworkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
public class ActNewYearFireworkTask {
|
||||
|
||||
@Autowired
|
||||
private ActNewYearFireworkService service;
|
||||
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void settlement(){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
service.settlement(now);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user