日常任务-公会开业任务刷新逻辑
This commit is contained in:
@@ -25,6 +25,7 @@ public interface DailyTaskConstant {
|
||||
ip_limit,//主播上麦领取ip限制
|
||||
device_limit,//主播上麦领取设备限制
|
||||
guild_diamod,//公会日流水
|
||||
guild_task_receive,//公会任务领取状态
|
||||
;
|
||||
|
||||
@Override
|
||||
|
@@ -31,6 +31,8 @@ import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.util.I18NMessageSourceUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.redisson.api.RMap;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.codec.TypedJsonJacksonCodec;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -43,6 +45,8 @@ import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.accompany.business.constant.dailytask.DailyTaskConstant.RedisKey.guild_task_receive;
|
||||
|
||||
@Service
|
||||
public class GuildTaskService {
|
||||
@Autowired
|
||||
@@ -67,6 +71,8 @@ public class GuildTaskService {
|
||||
private RewardUtil rewardUtil;
|
||||
@Autowired
|
||||
private BaseSendService baseSendService;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
public void updateTaskCreateProgress(Date now, PartitionEnum partitionEnum) {
|
||||
int partitionId = partitionEnum.getId();
|
||||
@@ -142,10 +148,8 @@ public class GuildTaskService {
|
||||
GuildTaskReachRecord existOne = existRecordMap.get(levelInfo.getLevel());
|
||||
if (existOne != null) {
|
||||
//不是当天并且等级已经达标,计算下一级
|
||||
if (!statDate.equals(existOne.getStatDate()) && existOne.getReachStatus() <= 0) {
|
||||
this.addNewGuildReachRecord(cycleDate, resultList, levelInfo, guildId, partitionId, statDate,
|
||||
diamond, anchorReachNum, memberNum.intValue());
|
||||
} else if (statDate.equals(existOne.getStatDate())) {
|
||||
RMap<Integer, Integer> receicveStatus = this.receicveStatus(existOne.getGuildId());
|
||||
if (statDate.equals(existOne.getStatDate()) && !receicveStatus.containsKey(existOne.getLevel())) {
|
||||
existOne.setDiamondNum(diamond);
|
||||
existOne.setAnchorNum(memberNum.intValue());
|
||||
existOne.setAnchorMicReachNum(anchorReachNum);
|
||||
@@ -160,6 +164,9 @@ public class GuildTaskService {
|
||||
if (!reachStatus) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.addNewGuildReachRecord(cycleDate, resultList, levelInfo, guildId, partitionId, statDate,
|
||||
diamond, anchorReachNum, memberNum.intValue());
|
||||
}
|
||||
} else {
|
||||
boolean calNext = this.addNewGuildReachRecord(cycleDate, resultList, levelInfo, guildId, partitionId,
|
||||
@@ -417,7 +424,11 @@ public class GuildTaskService {
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
if (reachRecord.getReceiveStatus() > 0) {
|
||||
throw new ServiceException(BusiStatus.DAILY_TASK_RECEIVE_END);
|
||||
throw new ServiceException(BusiStatus.ROOM_DAY_DIAMOND_REWARD_RECV_RECORD_EXIST);
|
||||
}
|
||||
RMap<Integer, Integer> receicveStatus = this.receicveStatus(reachRecord.getGuildId());
|
||||
if (receicveStatus.fastPutIfAbsent(reachRecord.getLevel(), 1)) {
|
||||
throw new ServiceException(BusiStatus.ROOM_DAY_DIAMOND_REWARD_RECV_RECORD_EXIST);
|
||||
}
|
||||
Integer guildId = reachRecord.getGuildId();
|
||||
Guild guild = guildService.getVaildGuildById(guildId);
|
||||
@@ -516,4 +527,7 @@ public class GuildTaskService {
|
||||
baseSendService.sendSystemMsg(uidStr, tip);
|
||||
}
|
||||
|
||||
private RMap<Integer, Integer> receicveStatus(Integer guildId) {
|
||||
return redissonClient.getMap(guild_task_receive.getKey(guildId), new TypedJsonJacksonCodec(Integer.class, Integer.class));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user