公会榜单top3奖励定时任务
This commit is contained in:
@@ -18,7 +18,8 @@ public enum ActivityType {
|
||||
|
||||
VIGOUR_MONTH(11, "COMMON ACTIVITY", ACTIVITY_FIRST_COMMON, true),
|
||||
|
||||
GUILD_MONTH(12, "GUILD MONTH", ACTIVITY_FIRST_COMMON, true),
|
||||
GUILD_MONTH_TOP(12, "GUILD MONTH", ACTIVITY_FIRST_COMMON, true),
|
||||
GUILD_MONTH_ANCHOR_TOP(13, "GUILD_MONTH_ANCHOR_TOP", ACTIVITY_FIRST_COMMON, true),
|
||||
;
|
||||
|
||||
private Integer type;
|
||||
|
@@ -58,7 +58,7 @@ public class SuperLuckyGiftDiamondIncomeListener implements ApplicationListener<
|
||||
String cycleDate = CycleTimeUtil.getCycleDateByZoneId(time, partitionInfo.getZoneId());
|
||||
guildMemberDiamondStatisticsService.update(cycleDate, guildMember, totalDiamondNum);
|
||||
//todo 时区 zoneId
|
||||
guildRankService.updateRank(guildMember.getGuildId(), totalDiamondNum, receiver.getPartitionId());
|
||||
guildRankService.updateRank(guildMember.getGuildId(), guildMember.getUid(), totalDiamondNum, receiver.getPartitionId());
|
||||
String statDate = CycleTimeUtil.getCycleDay(time, partitionInfo.getZoneId());
|
||||
guildDiamondStatisticsDayService.updateDayDiamondStatistics(cycleDate, statDate, guildMember, totalDiamondNum);
|
||||
}
|
||||
|
@@ -461,7 +461,7 @@ public class ActivityRankRuleService {
|
||||
|
||||
public void sendLevelRankAward(ActivityType activityType, Long uid, Integer level, String currentKeyDate, Integer partitionId, String message) {
|
||||
try {
|
||||
log.info("sendRankAward, activityType:{},uid:{}, level:{}, currentKeyDate:{}, partitionId:{},begin", activityType.name(), uid, level, currentKeyDate, partitionId);
|
||||
log.info("sendLevelRankAward, activityType:{},uid:{}, level:{}, currentKeyDate:{}, partitionId:{},begin", activityType.name(), uid, level, currentKeyDate, partitionId);
|
||||
RSet<Integer> set = this.activityRewardSign(activityType, uid, currentKeyDate, partitionId);
|
||||
boolean sysFlag = false;
|
||||
for (int actLevel = 1; actLevel <= level; actLevel++) {
|
||||
@@ -476,9 +476,28 @@ public class ActivityRankRuleService {
|
||||
baseSendService.sendSystemMsg(uid.toString(), message);
|
||||
}
|
||||
set.expire(expire, TimeUnit.DAYS);
|
||||
log.info("sendRankAward, activityType:{},uid:{}, level:{}, currentKeyDate:{}, partitionId:{},success", activityType.name(), uid, level, currentKeyDate, partitionId);
|
||||
log.info("sendLevelRankAward, activityType:{},uid:{}, level:{}, currentKeyDate:{}, partitionId:{},success", activityType.name(), uid, level, currentKeyDate, partitionId);
|
||||
} catch (Exception e) {
|
||||
log.info("sendRankAward, activityType:{} uid:{}, level:{}, currentKeyDate:{}, partitionId:{},error :{}", activityType.name(), uid, level, currentKeyDate, partitionId, e.getMessage(), e);
|
||||
log.info("sendLevelRankAward, activityType:{} uid:{}, level:{}, currentKeyDate:{}, partitionId:{},error :{}", activityType.name(), uid, level, currentKeyDate, partitionId, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 此方法只允许发指定等级奖励
|
||||
* @param activityType
|
||||
* @param uid
|
||||
* @param level
|
||||
* @param currentKeyDate
|
||||
* @param partitionId
|
||||
*/
|
||||
public void sendLevelRankAwardOnlyLevel(ActivityType activityType, Long uid, Integer level, String currentKeyDate, Integer partitionId) {
|
||||
try {
|
||||
log.info("sendLevelRankAwardOnlyLevel, activityType:{},uid:{}, level:{}, currentKeyDate:{}, partitionId:{},begin", activityType.name(), uid, level, currentKeyDate, partitionId);
|
||||
activityH5AwardRecordService.sendAwardCheckSend(activityType, partitionId, uid, level, currentKeyDate, ActivitySkipType.normal, expire);
|
||||
activityH5RecordService.saveRecord(partitionId, uid, level, currentKeyDate, activityType);
|
||||
log.info("sendLevelRankAwardOnlyLevel, activityType:{},uid:{}, level:{}, currentKeyDate:{}, partitionId:{},success", activityType.name(), uid, level, currentKeyDate, partitionId);
|
||||
} catch (Exception e) {
|
||||
log.info("sendLevelRankAwardOnlyLevel, activityType:{} uid:{}, level:{}, currentKeyDate:{}, partitionId:{},error :{}", activityType.name(), uid, level, currentKeyDate, partitionId, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,6 @@ import com.accompany.business.vo.message.ClanMessage;
|
||||
import com.accompany.common.config.SystemConfig;
|
||||
import com.accompany.common.constant.Attach;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.constant.RankConstant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
|
@@ -87,8 +87,8 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
QueryWrapper<UserInfoCard> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(UserInfoCard::getUid, uid)
|
||||
.eq(UserInfoCard::getUsed, Constant.UserInfoCardUsed.USING).eq(UserInfoCard::getStatus, Constant.UserInfoCardStatus.VALID)
|
||||
.gt(UserInfoCard :: getExpireTime, new Date());
|
||||
return getOne(queryWrapper);
|
||||
.gt(UserInfoCard :: getExpireTime, new Date()).orderByDesc(UserInfoCard::getUpdateTime);
|
||||
return getOne(queryWrapper, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,12 +3,10 @@ package com.accompany.business.service.family;
|
||||
import com.accompany.business.model.family.FamilyMember;
|
||||
import com.accompany.business.mybatismapper.family.FamilyMemberMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -80,4 +78,16 @@ public class FamilyMemberService extends ServiceImpl<FamilyMemberMapper, FamilyM
|
||||
.eq(FamilyMember::getFamilyId, familyId)
|
||||
.update();
|
||||
}
|
||||
|
||||
|
||||
public List<Long> listVaildFamilyMember(Integer familyId) {
|
||||
List<FamilyMember> familyMembers = this.lambdaQuery()
|
||||
.eq(null != familyId, FamilyMember::getFamilyId, familyId)
|
||||
.eq(FamilyMember::getEnable, Boolean.TRUE)
|
||||
.list();
|
||||
if (CollectionUtils.isEmpty(familyMembers)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
return familyMembers.stream().map(FamilyMember::getUid).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@@ -32,6 +32,8 @@ public class FamilyRankService {
|
||||
private FamilyService familyService;
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private FamilyMemberService familyMemberService;
|
||||
|
||||
public List<ClanRankListVO> listRank(Integer partitionId, Byte periodType){
|
||||
List<Family> familyList = familyService.listVaildFamilyByPartitionId(partitionId);
|
||||
@@ -63,7 +65,7 @@ public class FamilyRankService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void updateRank(Integer familyId, Long totalGoldNum, Integer partitionId){
|
||||
public void updateRank(Integer familyId, Long uid, Long totalGoldNum, Integer partitionId){
|
||||
RScoredSortedSet<Integer> weekRank = getWeekRank(partitionId);
|
||||
weekRank.addScore(familyId, totalGoldNum);
|
||||
weekRank.expire(7, TimeUnit.DAYS);
|
||||
@@ -71,6 +73,9 @@ public class FamilyRankService {
|
||||
RScoredSortedSet<Integer> monthRank = getMonthRank(partitionId, RankConstant.PeriodType.nowadays);
|
||||
monthRank.addScore(familyId, totalGoldNum);
|
||||
monthRank.expire(60, TimeUnit.DAYS);
|
||||
RScoredSortedSet<Long> monthMemberRank = getMonthMemberRank(familyId, partitionId, RankConstant.PeriodType.nowadays);
|
||||
monthMemberRank.addScore(uid, totalGoldNum);
|
||||
monthMemberRank.expire(60, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
@Async
|
||||
@@ -82,7 +87,7 @@ public class FamilyRankService {
|
||||
|
||||
Users u = usersService.getNotNullUsersByUid(familyGiftRecord.getReceiverUid());
|
||||
|
||||
updateRank(familyGiftRecord.getFamilyId(), familyGiftRecord.getTotalGoldNum(), u.getPartitionId());
|
||||
updateRank(familyGiftRecord.getFamilyId(), familyGiftRecord.getReceiverUid(), familyGiftRecord.getTotalGoldNum(), u.getPartitionId());
|
||||
|
||||
log.info("[familyRank] addScore success, familyId {} totalGoldNum {} uid {} partitionId {}",
|
||||
familyGiftRecord.getFamilyId(), familyGiftRecord.getTotalGoldNum(), u.getUid(), u.getPartitionId());
|
||||
@@ -125,4 +130,27 @@ public class FamilyRankService {
|
||||
return redissonClient.getScoredSortedSet(RedisKey.family_month_rank.getKey(monthStr, partitionId.toString()));
|
||||
}
|
||||
|
||||
public RScoredSortedSet<Long> getMonthMemberRank(Integer familyId, Integer partitionId, Byte periodType){
|
||||
Date date = new Date();
|
||||
if (RankConstant.PeriodType.previousOne.equals(periodType)) {
|
||||
date = DateUtil.offsetMonth(date, -1);
|
||||
}
|
||||
String monthStr = DateTimeUtil.convertDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN_YEAR_MONTH);
|
||||
return redissonClient.getScoredSortedSet(RedisKey.family_month_rank.getKey(monthStr, partitionId.toString(), familyId.toString()));
|
||||
}
|
||||
|
||||
public List<Long> listValidMemberRank(Integer familyId, Integer partitionId, Byte periodType){
|
||||
RScoredSortedSet<Long> monthMemberRank = getMonthMemberRank(familyId, partitionId, periodType);
|
||||
Collection<ScoredEntry<Long>> rankList = monthMemberRank.entryRangeReversed(0, Integer.MAX_VALUE);
|
||||
if (CollectionUtils.isEmpty(rankList)){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<Long> vaildFamilyMember = familyMemberService.listVaildFamilyMember(familyId);
|
||||
if (org.apache.commons.collections.CollectionUtils.isEmpty(vaildFamilyMember)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<Long> longList = rankList.stream().map(ScoredEntry::getValue).collect(Collectors.toList());
|
||||
return longList.stream().filter(vaildFamilyMember::contains).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,12 +3,10 @@ package com.accompany.business.service.guild;
|
||||
import com.accompany.business.model.guild.GuildMember;
|
||||
import com.accompany.business.mybatismapper.guild.GuildMemberMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -78,4 +76,16 @@ public class GuildMemberService extends ServiceImpl<GuildMemberMapper, GuildMemb
|
||||
.eq(GuildMember::getGuildId, familyId)
|
||||
.update();
|
||||
}
|
||||
|
||||
|
||||
public List<Long> listVaildGuildMember(Integer familyId) {
|
||||
List<GuildMember> guildMembers = this.lambdaQuery()
|
||||
.eq(null != familyId, GuildMember::getGuildId, familyId)
|
||||
.eq(GuildMember::getEnable, Boolean.TRUE)
|
||||
.list();
|
||||
if (CollectionUtils.isEmpty(guildMembers)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
return guildMembers.stream().map(GuildMember::getUid).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@@ -40,6 +40,8 @@ public class GuildRankService {
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private PartitionInfoService partitionInfoService;
|
||||
@Autowired
|
||||
private GuildMemberService guildMemberService;
|
||||
|
||||
public List<ClanRankListVO> listRank(Integer partitionId, Byte periodType){
|
||||
List<Guild> guildList = guildService.listVaildGuildByPartitionId(partitionId);
|
||||
@@ -52,7 +54,11 @@ public class GuildRankService {
|
||||
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
String zoneId = null != partitionInfo ? partitionInfo.getZoneId() : ZoneId.systemDefault().getId();
|
||||
Map<Integer, Double> monthIncomeMap = getMonthRankScoreMap(partitionId, zoneId, periodType);
|
||||
Date date = new Date();
|
||||
if (RankConstant.PeriodType.previousOne.equals(periodType)) {
|
||||
date = DateUtil.offsetMonth(date, -1);
|
||||
}
|
||||
Map<Integer, Double> monthIncomeMap = getMonthRankScoreMap(partitionId, zoneId, date);
|
||||
|
||||
return guildList.stream().map(guild -> {
|
||||
ClanRankListVO vo = new ClanRankListVO();
|
||||
@@ -73,7 +79,7 @@ public class GuildRankService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void updateRank(Integer guildId, double totalGoldNum, Integer partitionId){
|
||||
public void updateRank(Integer guildId, Long uid, double totalGoldNum, Integer partitionId){
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
String zoneId = null != partitionInfo? partitionInfo.getZoneId(): ZoneId.systemDefault().getId();
|
||||
|
||||
@@ -81,9 +87,13 @@ public class GuildRankService {
|
||||
weekRank.addScore(guildId, totalGoldNum);
|
||||
weekRank.expire(7, TimeUnit.DAYS);
|
||||
|
||||
RScoredSortedSet<Integer> monthRank = getMonthRank(partitionId, zoneId, RankConstant.PeriodType.nowadays);
|
||||
Date date = new Date();
|
||||
RScoredSortedSet<Integer> monthRank = getMonthRank(partitionId, zoneId, date);
|
||||
monthRank.addScore(guildId, totalGoldNum);
|
||||
monthRank.expire(60, TimeUnit.DAYS);
|
||||
RScoredSortedSet<Long> monthMemberRank = getMonthMemberRank(guildId, partitionId, zoneId, date);
|
||||
monthMemberRank.addScore(uid, totalGoldNum);
|
||||
monthMemberRank.expire(60, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
@Async
|
||||
@@ -93,7 +103,7 @@ public class GuildRankService {
|
||||
return;
|
||||
}
|
||||
|
||||
updateRank(guildGiftRecord.getGuildId(), guildGiftRecord.getTotalGoldNum(), guildGiftRecord.getPartitionId());
|
||||
updateRank(guildGiftRecord.getGuildId(), guildGiftRecord.getReceiverUid(), guildGiftRecord.getTotalGoldNum(), guildGiftRecord.getPartitionId());
|
||||
|
||||
log.info("[guildRank] addScore success, guildId {} totalGoldNum {} uid {} partitionId {}",
|
||||
guildGiftRecord.getGuildId(), guildGiftRecord.getTotalGoldNum(), guildGiftRecord.getReceiverUid(), guildGiftRecord.getPartitionId());
|
||||
@@ -116,8 +126,8 @@ public class GuildRankService {
|
||||
return redissonClient.getScoredSortedSet(RedisKey.guild_week_rank.getKey(mondayStr, partitionId.toString()));
|
||||
}
|
||||
|
||||
public Map<Integer, Double> getMonthRankScoreMap(Integer partitionId, String zoneId, Byte periodType){
|
||||
RScoredSortedSet<Integer> rank = getMonthRank(partitionId, zoneId, periodType);
|
||||
public Map<Integer, Double> getMonthRankScoreMap(Integer partitionId, String zoneId, Date date){
|
||||
RScoredSortedSet<Integer> rank = getMonthRank(partitionId, zoneId, date);
|
||||
Collection<ScoredEntry<Integer>> rankList = rank.entryRangeReversed(0, Integer.MAX_VALUE);
|
||||
if (CollectionUtils.isEmpty(rankList)){
|
||||
return Collections.emptyMap();
|
||||
@@ -127,14 +137,30 @@ public class GuildRankService {
|
||||
.collect(Collectors.toMap(ScoredEntry::getValue, ScoredEntry::getScore));
|
||||
}
|
||||
|
||||
public RScoredSortedSet<Integer> getMonthRank(Integer partitionId, String zoneId, Byte periodType){
|
||||
Date date = new Date();
|
||||
if (RankConstant.PeriodType.previousOne.equals(periodType)) {
|
||||
date = DateUtil.offsetMonth(date, -1);
|
||||
}
|
||||
public RScoredSortedSet<Integer> getMonthRank(Integer partitionId, String zoneId, Date date){
|
||||
ZonedDateTime zdt = DateTimeUtil.convertWithZoneId(date, zoneId);
|
||||
String monthStr = zdt.withDayOfMonth(1).format(DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
return redissonClient.getScoredSortedSet(RedisKey.guild_month_rank.getKey(monthStr, partitionId.toString()));
|
||||
}
|
||||
|
||||
public RScoredSortedSet<Long> getMonthMemberRank(Integer guildId, Integer partitionId, String zoneId, Date date){
|
||||
ZonedDateTime zdt = DateTimeUtil.convertWithZoneId(date, zoneId);
|
||||
String monthStr = zdt.withDayOfMonth(1).format(DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
return redissonClient.getScoredSortedSet(RedisKey.guild_month_rank.getKey(monthStr, partitionId.toString(), guildId.toString()));
|
||||
}
|
||||
|
||||
public List<Long> listMemberRank(Integer guildId, Integer partitionId, String zoneId, Date date) {
|
||||
RScoredSortedSet<Long> monthMemberRank = getMonthMemberRank(guildId, partitionId, zoneId, date);
|
||||
Collection<ScoredEntry<Long>> rankList = monthMemberRank.entryRangeReversed(0, Integer.MAX_VALUE);
|
||||
if (CollectionUtils.isEmpty(rankList)){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<Long> vaildGuildMember = guildMemberService.listVaildGuildMember(guildId);
|
||||
if (CollectionUtils.isEmpty(vaildGuildMember)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<Long> longList = rankList.stream().map(ScoredEntry::getValue).collect(Collectors.toList());
|
||||
return longList.stream().filter(vaildGuildMember::contains).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,21 +3,34 @@ package com.accompany.business.service.rank;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.accompany.business.constant.activity.ActivityType;
|
||||
import com.accompany.business.service.activity.h5.ActivityRankRuleService;
|
||||
import com.accompany.business.service.family.FamilyRankService;
|
||||
import com.accompany.business.service.guild.GuildRankService;
|
||||
import com.accompany.business.service.guild.GuildRelationService;
|
||||
import com.accompany.business.vo.clan.ClanRankListVO;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.constant.RankConstant;
|
||||
import com.accompany.common.enums.RedisZSetEnum;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.enumeration.PartitionEnum;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.model.PartitionInfo;
|
||||
import com.accompany.core.service.partition.PartitionInfoService;
|
||||
import com.alibaba.excel.util.DateUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.accompany.business.constant.activity.ActivityType.KRYPTON_MONTH;
|
||||
import static com.accompany.business.constant.activity.ActivityType.VIGOUR_MONTH;
|
||||
import static com.accompany.business.constant.activity.ActivityType.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -25,23 +38,28 @@ public class MonthRankTaskService {
|
||||
|
||||
@Autowired
|
||||
private ActivityRankRuleService activityRankRuleService;
|
||||
@Autowired
|
||||
private PartitionInfoService partitionInfoService;
|
||||
@Autowired
|
||||
private FamilyRankService familyRankService;
|
||||
@Autowired
|
||||
private GuildRankService guildRankService;
|
||||
|
||||
/**
|
||||
* 东三区排行榜单奖励
|
||||
* @param lastMonthDate
|
||||
* @param partitionId
|
||||
*/
|
||||
public void sendLastMonthRankTop4GMT3(Byte rankType, Date lastMonthDate, Integer partitionId) {
|
||||
public void sendLastMonthRankTop3(Byte rankType, Date lastMonthDate, Integer partitionId) {
|
||||
String rankTypeStr = null;
|
||||
ActivityType activityType = null;
|
||||
switch (rankType){
|
||||
case RankConstant.RankType.vigour:
|
||||
rankTypeStr = RedisKey.vigour_rank.name();
|
||||
activityType = KRYPTON_MONTH;
|
||||
activityType = VIGOUR_MONTH;
|
||||
break;
|
||||
case RankConstant.RankType.krypton:
|
||||
rankTypeStr = RedisKey.krypton_rank.name();
|
||||
activityType = VIGOUR_MONTH;
|
||||
activityType = KRYPTON_MONTH;
|
||||
break;
|
||||
}
|
||||
IRank iRank = RankServiceFactory.getServiceByType(rankTypeStr, RankConstant.RankDatetype.month);
|
||||
@@ -50,11 +68,13 @@ public class MonthRankTaskService {
|
||||
log.info("sendLastMonthRankTop4GMT3.emptyList");
|
||||
return;
|
||||
}
|
||||
String dateTimeFormat = iRank.dateTimeFormat(lastMonthDate);
|
||||
PartitionEnum partitionEnum = PartitionEnum.getByPartitionId(partitionId);
|
||||
Date formatDate = DateTimeUtil.withZoneSameInstant(lastMonthDate, partitionEnum.getZoneId());
|
||||
String dateTimeFormat = iRank.dateTimeFormat(formatDate);
|
||||
int level = 1;
|
||||
for (Map<String, Object> map : rankSet) {
|
||||
Long memberUid = Long.valueOf(map.get(RedisZSetEnum.member.name()).toString());
|
||||
activityRankRuleService.sendLevelRankAward(activityType, memberUid, level++, dateTimeFormat, partitionId, null);
|
||||
activityRankRuleService.sendLevelRankAwardOnlyLevel(activityType, memberUid, level++, dateTimeFormat, partitionId);
|
||||
if (level > 3) {//保证只发前3
|
||||
break;
|
||||
}
|
||||
@@ -62,11 +82,71 @@ public class MonthRankTaskService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 东八区排行榜单奖励
|
||||
* @param lastMonthDate
|
||||
* @param partitionId
|
||||
*/
|
||||
public void sendLastMonthRankTop4GMT8(Date lastMonthDate, Integer partitionId) {
|
||||
|
||||
public void sendLastMonthGuildRankTop3(Date lastMonthDate, Integer partitionId) {
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
if (null == partitionInfo) {
|
||||
throw new ServiceException(BusiStatus.PARTITION_ERROR);
|
||||
}
|
||||
List<ClanRankListVO> clanRankListVOS;
|
||||
if (Constant.ClanMode.FAMILY.equals(partitionInfo.getClanMode())) {
|
||||
clanRankListVOS = familyRankService.listRank(partitionInfo.getId(), RankConstant.PeriodType.previousOne);
|
||||
if (CollectionUtils.isEmpty(clanRankListVOS)) {
|
||||
return;
|
||||
}
|
||||
int top = 1;
|
||||
String dateTimeFormat = DateTimeUtil.convertDate(lastMonthDate, DateTimeUtil.DEFAULT_DATE_PATTERN_YEAR_MONTH);
|
||||
for (ClanRankListVO clanRankListVO : clanRankListVOS) {
|
||||
activityRankRuleService
|
||||
.sendLevelRankAwardOnlyLevel(GUILD_MONTH_TOP, clanRankListVO.getClanElderUid(), top, dateTimeFormat, partitionId);
|
||||
List<Long> validMemberRank = familyRankService
|
||||
.listValidMemberRank(clanRankListVO.getClanId().intValue(), partitionId, RankConstant.PeriodType.previousOne);
|
||||
if (CollectionUtils.isNotEmpty(validMemberRank)) {
|
||||
int i = 1;
|
||||
for (Long familyUid : validMemberRank) {
|
||||
activityRankRuleService.sendLevelRankAwardOnlyLevel(GUILD_MONTH_ANCHOR_TOP, familyUid, top, dateTimeFormat, partitionId);
|
||||
i++;
|
||||
if (i>10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
top++;
|
||||
if (top > 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (Constant.ClanMode.GUILD.equals(partitionInfo.getClanMode())) {
|
||||
clanRankListVOS = guildRankService.listRank(partitionInfo.getId(), RankConstant.PeriodType.previousOne);
|
||||
if (CollectionUtils.isEmpty(clanRankListVOS)) {
|
||||
return;
|
||||
}
|
||||
int top = 1;
|
||||
ZonedDateTime zdt = DateTimeUtil.convertWithZoneId(lastMonthDate, partitionInfo.getZoneId());
|
||||
String dateTimeFormat = zdt.withDayOfMonth(1).format(DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
for (ClanRankListVO clanRankListVO : clanRankListVOS) {
|
||||
activityRankRuleService
|
||||
.sendLevelRankAwardOnlyLevel(GUILD_MONTH_TOP, clanRankListVO.getClanElderUid(), top, dateTimeFormat, partitionId);
|
||||
List<Long> validMemberRank = guildRankService
|
||||
.listMemberRank(clanRankListVO.getClanId().intValue(), partitionId, partitionInfo.getZoneId(), lastMonthDate);
|
||||
if (CollectionUtils.isNotEmpty(validMemberRank)) {
|
||||
int i = 1;
|
||||
for (Long familyUid : validMemberRank) {
|
||||
activityRankRuleService
|
||||
.sendLevelRankAwardOnlyLevel(GUILD_MONTH_ANCHOR_TOP, familyUid, top, dateTimeFormat, partitionId);
|
||||
i++;
|
||||
if (i>10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
top++;
|
||||
if (top > 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -124,7 +124,14 @@ public class RankController {
|
||||
@RequestMapping(value = "/taskRank", method = RequestMethod.GET)
|
||||
public BusiResult sendLastMonthRankTop4GMT3(Byte rankType, String lastMonthDate, Integer partitionId) {
|
||||
Date parseDateTime = DateUtil.parseDateTime(lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthRankTop4GMT3(rankType, parseDateTime, partitionId);
|
||||
monthRankTaskService.sendLastMonthRankTop3(rankType, parseDateTime, partitionId);
|
||||
return new BusiResult(BusiStatus.SUCCESS);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/taskRankGuild", method = RequestMethod.GET)
|
||||
public BusiResult sendLastMonthGuildRankTop3(String lastMonthDate, Integer partitionId) {
|
||||
Date parseDateTime = DateUtil.parseDateTime(lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthGuildRankTop3(parseDateTime, partitionId);
|
||||
return new BusiResult(BusiStatus.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ public class MonthRankTask extends BaseTask {
|
||||
|
||||
/**
|
||||
* 排行榜前三奖励
|
||||
* 每月1号凌晨0点10分执行
|
||||
* 每月1号凌晨0点05分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 5 0 1 * ?", zone = "Etc/GMT-3")
|
||||
public void monthRankTaskGMT3() {
|
||||
@@ -32,23 +32,30 @@ public class MonthRankTask extends BaseTask {
|
||||
for (PartitionEnum partitionEnum : partitionEnumList) {
|
||||
try {
|
||||
log.info("=-=monthRankTaskGMT3.krypton_rank=-=:date:{},lastMonthDate:{}", DateUtil.formatDateTime(date), lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthRankTop4GMT3(RankConstant.RankType.krypton, lastMonthDate, partitionEnum.getId());
|
||||
monthRankTaskService.sendLastMonthRankTop3(RankConstant.RankType.krypton, lastMonthDate, partitionEnum.getId());
|
||||
log.info("=-=monthRankTaskGMT3.krypton_rank=-= end");
|
||||
} catch (Exception e) {
|
||||
log.error("[monthRankTaskGMT3.krypton_rank] 异常", e);
|
||||
}
|
||||
try {
|
||||
log.info("=-=monthRankTaskGMT3.vigour_rank=-=:date:{},lastMonthDate:{}", DateUtil.formatDateTime(date), lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthRankTop4GMT3(RankConstant.RankType.vigour, lastMonthDate, partitionEnum.getId());
|
||||
monthRankTaskService.sendLastMonthRankTop3(RankConstant.RankType.vigour, lastMonthDate, partitionEnum.getId());
|
||||
log.info("=-=monthRankTaskGMT3.vigour_rank=-= end");
|
||||
} catch (Exception e) {
|
||||
log.error("[monthRankTaskGMT3.vigour_rank] 异常", e);
|
||||
}
|
||||
try {
|
||||
log.info("=-=monthRankTaskGMT3.guild=-=:date:{},lastMonthDate:{}", DateUtil.formatDateTime(date), lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthGuildRankTop3(lastMonthDate, partitionEnum.getId());
|
||||
log.info("=-=monthRankTaskGMT3.guild=-= end");
|
||||
} catch (Exception e) {
|
||||
log.error("[monthRankTaskGMT3.guild] 异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 排行榜前三奖励
|
||||
* 每月1号凌晨0点10分执行
|
||||
* 每月1号凌晨0点05分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 5 0 1 * ?")
|
||||
public void monthRankTaskGMT8() {
|
||||
@@ -58,18 +65,25 @@ public class MonthRankTask extends BaseTask {
|
||||
for (PartitionEnum partitionEnum : partitionEnumList) {
|
||||
try {
|
||||
log.info("=-=monthRankTaskGMT8.krypton_rank=-=:date:{},lastMonthDate:{}", DateUtil.formatDateTime(date), lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthRankTop4GMT3(RankConstant.RankType.krypton, lastMonthDate, partitionEnum.getId());
|
||||
monthRankTaskService.sendLastMonthRankTop3(RankConstant.RankType.krypton, lastMonthDate, partitionEnum.getId());
|
||||
log.info("=-=monthRankTaskGMT8.krypton_rank=-= end");
|
||||
} catch (Exception e) {
|
||||
log.error("[monthRankTaskGMT8.krypton_rank] 异常", e);
|
||||
}
|
||||
try {
|
||||
log.info("=-=monthRankTaskGMT8.vigour_rank=-=:date:{},lastMonthDate:{}", DateUtil.formatDateTime(date), lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthRankTop4GMT3(RankConstant.RankType.vigour, lastMonthDate, partitionEnum.getId());
|
||||
monthRankTaskService.sendLastMonthRankTop3(RankConstant.RankType.vigour, lastMonthDate, partitionEnum.getId());
|
||||
log.info("=-=monthRankTaskGMT8.vigour_rank=-= end");
|
||||
} catch (Exception e) {
|
||||
log.error("[monthRankTaskGMT8.vigour_rank] 异常", e);
|
||||
}
|
||||
try {
|
||||
log.info("=-=monthRankTaskGMT8.guild=-=:date:{},lastMonthDate:{}", DateUtil.formatDateTime(date), lastMonthDate);
|
||||
monthRankTaskService.sendLastMonthGuildRankTop3(lastMonthDate, partitionEnum.getId());
|
||||
log.info("=-=monthRankTaskGMT8.guild=-= end");
|
||||
} catch (Exception e) {
|
||||
log.error("[monthRankTaskGMT8.guild] 异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user