幸运24-后台-个人-用户充值等级

This commit is contained in:
khalil
2025-06-19 11:07:03 +08:00
parent 160cecb032
commit 4ce6a1f7ec
4 changed files with 29 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ import com.accompany.core.enumeration.PartitionEnum;
import com.accompany.core.model.PartitionInfo;
import com.accompany.core.model.Users;
import com.accompany.core.service.partition.PartitionInfoService;
import com.accompany.payment.service.UserRechargeLevelService;
import com.accompany.sharding.mapper.Lucky24RecordMapper;
import com.accompany.sharding.model.Lucky24Record;
import com.accompany.sharding.vo.Lucky24PersonalStat;
@@ -50,6 +51,8 @@ public class Lucky24RecordAdminService {
@Autowired
private PartitionInfoService partitionInfoService;
@Autowired
private UserRechargeLevelService userRechargeLevelService;
@Autowired
private Lucky24StatMapper statMapper;
@Autowired
private Lucky24RecordMapper recordMapper;
@@ -174,11 +177,14 @@ public class Lucky24RecordAdminService {
List<Lucky24PersonalStat> subList = list.subList(startIndex, endIndex);
List<Long> uidList = subList.stream().map(Lucky24PersonalStat::getUid).collect(Collectors.toList());
Map<Long, Users> usersMap = usersService.getUsersMapByUids(uidList);
Map<Long, String> userRechargeLevelMap = userRechargeLevelService.mapLevelByUid(uidList);
for (Lucky24PersonalStat stat: subList) {
Users u = usersMap.get(stat.getUid());
if (null != u){
stat.setErbanNo(u.getErbanNo());
}
stat.setUserRechargeLevel(userRechargeLevelMap.get(stat.getUid()));
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
@@ -199,6 +205,8 @@ public class Lucky24RecordAdminService {
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
Map<String, Lucky24PersonalStat> statMap = new HashMap<>(dateStrList.size());
String userRechargeLevel = userRechargeLevelService.getLevelByUid(uid);
CountDownLatch cdl = new CountDownLatch(2);
Long finalUid = uid;
@@ -264,9 +272,10 @@ public class Lucky24RecordAdminService {
page.setRecords(subDateStrList.parallelStream().map(dateStr->{
Lucky24PersonalStat stat = statMap.get(dateStr);
if (null == stat) {
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo);
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo, userRechargeLevel);
} else {
stat.setErbanNo(erbanNo);
stat.setUserRechargeLevel(userRechargeLevel);
}
return stat;
}).collect(Collectors.toList()));
@@ -283,7 +292,9 @@ public class Lucky24RecordAdminService {
Date endTime = DateTimeUtil.getEndTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
ZonedDateTime zonedEndTime = endTime.toInstant().atZone(ZoneId.systemDefault());
Date systemEndTime = Date.from(zonedEndTime.withZoneSameLocal(zoneId).toInstant());
return recordMapper.listPersonal(partitionId, uid, systemStartTime, systemEndTime, zoneIdHour);
return null == poolType?
recordMapper.listPersonal(partitionId, uid, systemStartTime, systemEndTime, zoneIdHour):
recordMapper.listPersonalByPoolType(partitionId, uid, poolType, systemStartTime, systemEndTime, zoneIdHour);
}
public Page<Lucky24RecordAdminVo> pageRecord(Long uid, String date, Integer poolType, int pageNo, int pageSize) {

View File

@@ -13,8 +13,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
public class UserRechargeLevelService extends ServiceImpl<UserRechargeLevelMapper, UserRechargeLevel> implements InitializingBean {
@@ -46,6 +47,15 @@ public class UserRechargeLevelService extends ServiceImpl<UserRechargeLevelMappe
return level;
}
public Map<Long, String> mapLevelByUid(List<Long> uidList){
List<UserRechargeLevel> levelList = listByIds(uidList);
Map<Long, String> map = levelList.stream().collect(Collectors.toMap(UserRechargeLevel::getUid, UserRechargeLevel::getLevel));
for (Long uid: uidList){
map.putIfAbsent(uid, userRechargeLevelConfigService.getDefaultLevel());
}
return map;
}
public void statistics(Long uid, BigDecimal totalReceiveGoldNum, BigDecimal last60TotalReceiveGoldNum) {
boolean isRechargeUser = rechargeUserService.isRechargeUser(uid);

View File

@@ -24,6 +24,8 @@ public class Lucky24PersonalStat {
private Long uid;
@ApiModelProperty("erbanNO")
private Long erbanNo;
@ApiModelProperty("用户充值等级")
private String userRechargeLevel;
@ApiModelProperty("送礼金币总额")
private Long totalInput;
@@ -42,11 +44,12 @@ public class Lucky24PersonalStat {
@ApiModelProperty("中奖率")
private BigDecimal winRate;
public Lucky24PersonalStat(String date, Integer partitionId, Long uid, Long erbanNo) {
public Lucky24PersonalStat(String date, Integer partitionId, Long uid, Long erbanNo, String userRechargeLevel) {
this.date = date;
this.partitionId = partitionId;
this.uid = uid;
this.erbanNo = erbanNo;
this.userRechargeLevel = userRechargeLevel;
this.totalInput = 0L;
this.totalOutput = 0L;
this.production = 0L;

View File

@@ -6,6 +6,6 @@ import io.swagger.annotations.ApiModel;
public class Lucky25PersonalStat extends Lucky24PersonalStat {
public Lucky25PersonalStat(String date, Integer partitionId, Long uid, Long erbanNo) {
super(date, partitionId, uid, erbanNo);
super(date, partitionId, uid, erbanNo, null);
}
}