日常任务-送礼任务类型bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.accompany.business.vo.dailytask;
|
||||
|
||||
import com.accompany.business.constant.dailytask.DailyTaskTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -22,5 +23,6 @@ public class DailyProgressContext {
|
||||
private Integer giftNum;
|
||||
private Long recvGoldNum;
|
||||
private Date createTime;
|
||||
private DailyTaskTypeEnum taskType;
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import com.accompany.business.common.constant.RewardTypeEnum;
|
||||
import com.accompany.business.constant.dailytask.DailyTaskConstant;
|
||||
import com.accompany.business.constant.dailytask.DailyTaskTypeEnum;
|
||||
import com.accompany.business.constant.dailytask.GoldBeanBillType;
|
||||
import com.accompany.business.model.dailytask.DailyTaskConfig;
|
||||
import com.accompany.business.model.dailytask.DailyTaskReward;
|
||||
import com.accompany.business.model.guild.GuildMember;
|
||||
import com.accompany.business.service.guild.GuildMemberService;
|
||||
@@ -93,6 +94,10 @@ public abstract class AbstractDailyTaskHandler implements DailyTaskHandler {
|
||||
public void executeProgress(DailyProgressContext progressContext) {
|
||||
Users users = usersService.getUsersByUid(progressContext.getUid());
|
||||
progressContext.setPartitionId(users.getPartitionId());
|
||||
DailyTaskConfig dailyTaskConfig = dailyTaskConfigService.getByPartTaskKey(progressContext.getPartitionId(), progressContext.getTaskType().name());
|
||||
if (dailyTaskConfig == null) {
|
||||
return;
|
||||
}
|
||||
this.doExecuteProgress(progressContext);
|
||||
}
|
||||
|
||||
|
@@ -68,6 +68,7 @@ public class DailyTaskService {
|
||||
* @param dailyProgressContext
|
||||
*/
|
||||
public void executeProgress(DailyTaskTypeEnum taskType, DailyProgressContext dailyProgressContext) {
|
||||
dailyProgressContext.setTaskType(taskType);
|
||||
DailyTaskHandler handler = taskHandlerRegistry.getHandler(taskType.getHandlerType());
|
||||
handler.executeProgress(dailyProgressContext);
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ import com.accompany.business.vo.dailytask.DailyTaskContext;
|
||||
import com.accompany.business.vo.dailytask.DailyTaskVo;
|
||||
import org.redisson.api.RBucket;
|
||||
import org.redisson.api.RMap;
|
||||
import org.redisson.client.codec.LongCodec;
|
||||
import org.redisson.codec.TypedJsonJacksonCodec;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -34,8 +34,9 @@ public class RoomSendGiftGoldNumHandler extends AbstractDailyTaskHandler {
|
||||
}
|
||||
Long uid = progressContext.getUid();
|
||||
Integer partitionId = progressContext.getPartitionId();
|
||||
DailyTaskTypeEnum taskType = progressContext.getTaskType();
|
||||
String todayDate = getTaskDate(partitionId, progressContext.getCreateTime());
|
||||
RBucket<Integer> taskStatus = taskStatus(uid, todayDate, ROOM_SEND_NOMAL_GIFT_GOLD);
|
||||
RBucket<Integer> taskStatus = taskStatus(uid, todayDate, taskType);
|
||||
if (taskStatus.isExists()) {
|
||||
return;
|
||||
}
|
||||
@@ -43,28 +44,28 @@ public class RoomSendGiftGoldNumHandler extends AbstractDailyTaskHandler {
|
||||
if (giftGold < 20000) {
|
||||
return;
|
||||
}
|
||||
RMap<Long, Long> sendGoldNum = sendGoldNum(partitionId, todayDate);
|
||||
Long addAndGet = sendGoldNum.addAndGet(uid, progressContext.getGiftNum());
|
||||
RMap<Long, Integer> sendGoldNum = sendGoldNum(partitionId, todayDate);
|
||||
Integer addAndGet = sendGoldNum.addAndGet(uid, progressContext.getGiftNum());
|
||||
sendGoldNum.expire(Duration.ofDays(EXPIRE_DAY));
|
||||
DailyTaskConfig dailyTaskConfig = dailyTaskConfigService.getByPartTaskKey(partitionId, ROOM_SEND_NOMAL_GIFT_GOLD.name());
|
||||
DailyTaskConfig dailyTaskConfig = dailyTaskConfigService.getByPartTaskKey(partitionId, taskType.name());
|
||||
if (dailyTaskConfig != null && addAndGet != null && addAndGet >= dailyTaskConfig.getReachNum()) {
|
||||
taskStatus(uid, todayDate, DailyTaskTypeEnum.ROOM_SEND_NOMAL_GIFT_GOLD).set(1, Duration.ofDays(EXPIRE_DAY));
|
||||
taskStatus(uid, todayDate, taskType).set(1, Duration.ofDays(EXPIRE_DAY));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyTaskVo doHandle(DailyTaskContext context) {
|
||||
String todayDate = context.getTodayDate();
|
||||
RMap<Long, Long> sendGoldNum = sendGoldNum(context.getPartitionId(), todayDate);
|
||||
RMap<Long, Integer> sendGoldNum = sendGoldNum(context.getPartitionId(), todayDate);
|
||||
Long uid = context.getUid();
|
||||
DailyTaskTypeEnum dailyTaskTypeEnum = context.getDailyTaskTypeEnum();
|
||||
return DailyTaskVo.builder()
|
||||
.receiveStatus(computeReceiveStatus(uid, todayDate, dailyTaskTypeEnum))
|
||||
.reachNum(sendGoldNum.getOrDefault(uid, 0L))
|
||||
.reachNum(sendGoldNum.getOrDefault(uid, 0).longValue())
|
||||
.build();
|
||||
}
|
||||
|
||||
private RMap<Long, Long> sendGoldNum(Integer partitionId, String todayDate) {
|
||||
return redissonClient.getMap(send_gold_num.getKey(partitionId.toString(), todayDate), LongCodec.INSTANCE);
|
||||
private RMap<Long, Integer> sendGoldNum(Integer partitionId, String todayDate) {
|
||||
return redissonClient.getMap(send_gold_num.getKey(partitionId.toString(), todayDate), new TypedJsonJacksonCodec(Long.class, Integer.class));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user