幸运24-y-meta-标记染色
This commit is contained in:
@@ -37,6 +37,11 @@ public class Lucky24YUser {
|
||||
*/
|
||||
private Byte status;
|
||||
|
||||
/**
|
||||
* 输出差值
|
||||
*/
|
||||
private Long outputDiff;
|
||||
|
||||
/**
|
||||
* 当天次数
|
||||
*/
|
||||
|
@@ -2,6 +2,7 @@ package com.accompany.business.service.lucky;
|
||||
|
||||
import com.accompany.business.dto.lucky.Lucky24GiftConfig;
|
||||
import com.accompany.business.dto.lucky.Lucky24Result;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.enumeration.PartitionEnum;
|
||||
@@ -32,6 +33,8 @@ public class Lucky24UserMetaService {
|
||||
|
||||
public static final String EXTRA_POOL_COUNT = "extra_pool_count";
|
||||
|
||||
public static final String Y = "y";
|
||||
|
||||
private static final int HISTORY_QUEUE_SIZE = 40000;
|
||||
|
||||
@Autowired
|
||||
@@ -143,25 +146,6 @@ public class Lucky24UserMetaService {
|
||||
return stockResultVo;
|
||||
}
|
||||
|
||||
public void updateExtraUserMeta(long senderUid, Integer partitionId, long input, long output) {
|
||||
RMap<String, Number> userMetaMap = getUserMeta(senderUid);
|
||||
long times = userMetaMap.addAndGet(TIMES_KEY, 1L).longValue();
|
||||
|
||||
PartitionEnum partitionEnum = PartitionEnum.getByPartitionId(partitionId);
|
||||
long todayStartTimeLong = DateTimeUtil.getZonedTodayTime(partitionEnum.getZoneId());
|
||||
|
||||
String today = String.valueOf(todayStartTimeLong);
|
||||
String todayTimesKey = String.join("_", today, TIMES_KEY);
|
||||
long todayTimes = userMetaMap.addAndGet(todayTimesKey, 1L).longValue();
|
||||
String todayInputKey = String.join("_", today, INPUT_KEY);
|
||||
long todayInput = userMetaMap.addAndGet(todayInputKey, input).longValue();
|
||||
String todayOutputKey = String.join("_", today, OUTPUT_KEY);
|
||||
long todayOutput = userMetaMap.addAndGet(todayOutputKey, output).longValue();
|
||||
|
||||
log.info("[Lucky24] updateExtraUserMeta uid {} times {} today {} todayTime {} todayInput {} todayOutput {}",
|
||||
senderUid, times, todayStartTimeLong, todayTimes, todayInput, todayOutput);
|
||||
}
|
||||
|
||||
public void updateUserMeta(long senderUid, int partitionId, long input, long output) {
|
||||
RList<Lucky24Result> historyQueue = getUserHistoryQueue(senderUid);
|
||||
historyQueue.add(0, new Lucky24Result(null, null, input, output, null));
|
||||
@@ -260,10 +244,26 @@ public class Lucky24UserMetaService {
|
||||
}
|
||||
}
|
||||
|
||||
//Y用户
|
||||
if (userMetaMap.containsKey(Y)){
|
||||
String yInputKey = String.join("_", Y, INPUT_KEY);
|
||||
long yInput = userMetaMap.addAndGet(yInputKey, input).longValue();
|
||||
String yOutputKey = String.join("_", Y, OUTPUT_KEY);
|
||||
long yOutput = userMetaMap.addAndGet(yOutputKey, output).longValue();
|
||||
|
||||
log.info("[Lucky24] updateUserMeta Y uid {} YInput {} YOutput {}", senderUid, yInput, yOutput);
|
||||
}
|
||||
|
||||
log.info("[Lucky24] updateUserMeta uid {} times {} todayInput {} todayOutput {} today {} todayTimes {} todayIntput {} todayOutput {}",
|
||||
senderUid, times, totalInput, totalOutput, todayStartTimeLong, todayTimes, todayInput, todayOutput);
|
||||
}
|
||||
|
||||
public void dyeYUser(Long uid) {
|
||||
RMap<String, Number> userMetaMap = getUserMeta(uid);
|
||||
userMetaMap.putIfAbsent(Y, Constant.Yes1No0.YES);
|
||||
log.info("[Lucky24] dyeYUser uid {}", uid);
|
||||
}
|
||||
|
||||
public RMap<String, Number> getUserMeta(Long uid) {
|
||||
return redissonClient.getMap(RedisKey.lucky_24_user_meta.getKey(uid.toString()));
|
||||
}
|
||||
@@ -275,5 +275,4 @@ public class Lucky24UserMetaService {
|
||||
public RMap<String, Number> getUser10wStat(Long uid) {
|
||||
return redissonClient.getMapCache(RedisKey.lucky_24_user_10w_stat.getKey(uid.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ import java.math.BigDecimal;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class Lucky24YService {
|
||||
@@ -26,6 +25,8 @@ public class Lucky24YService {
|
||||
private Lucky24StatMapper statMapper;
|
||||
@Autowired
|
||||
private Lucky24YUserService lucky24YUserService;
|
||||
@Autowired
|
||||
private Lucky24UserMetaService userMetaService;
|
||||
|
||||
@Resource(name = "biz-executor")
|
||||
private ThreadPoolExecutor bizExecutor;
|
||||
@@ -120,6 +121,8 @@ public class Lucky24YService {
|
||||
yUser.setUpdateTime(now);
|
||||
|
||||
lucky24YUserService.saveOrUpdate(yUser);
|
||||
|
||||
userMetaService.dyeYUser(uid);
|
||||
}
|
||||
|
||||
private void tryClearYUser(Lucky24YUser yUser) {
|
||||
|
Reference in New Issue
Block a user