幸运24-后台-个人-用户充值等级
This commit is contained in:
@@ -16,6 +16,7 @@ import com.accompany.core.enumeration.PartitionEnum;
|
|||||||
import com.accompany.core.model.PartitionInfo;
|
import com.accompany.core.model.PartitionInfo;
|
||||||
import com.accompany.core.model.Users;
|
import com.accompany.core.model.Users;
|
||||||
import com.accompany.core.service.partition.PartitionInfoService;
|
import com.accompany.core.service.partition.PartitionInfoService;
|
||||||
|
import com.accompany.payment.service.UserRechargeLevelService;
|
||||||
import com.accompany.sharding.mapper.Lucky24RecordMapper;
|
import com.accompany.sharding.mapper.Lucky24RecordMapper;
|
||||||
import com.accompany.sharding.model.Lucky24Record;
|
import com.accompany.sharding.model.Lucky24Record;
|
||||||
import com.accompany.sharding.vo.Lucky24PersonalStat;
|
import com.accompany.sharding.vo.Lucky24PersonalStat;
|
||||||
@@ -50,6 +51,8 @@ public class Lucky24RecordAdminService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PartitionInfoService partitionInfoService;
|
private PartitionInfoService partitionInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private UserRechargeLevelService userRechargeLevelService;
|
||||||
|
@Autowired
|
||||||
private Lucky24StatMapper statMapper;
|
private Lucky24StatMapper statMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private Lucky24RecordMapper recordMapper;
|
private Lucky24RecordMapper recordMapper;
|
||||||
@@ -174,11 +177,14 @@ public class Lucky24RecordAdminService {
|
|||||||
List<Lucky24PersonalStat> subList = list.subList(startIndex, endIndex);
|
List<Lucky24PersonalStat> subList = list.subList(startIndex, endIndex);
|
||||||
List<Long> uidList = subList.stream().map(Lucky24PersonalStat::getUid).collect(Collectors.toList());
|
List<Long> uidList = subList.stream().map(Lucky24PersonalStat::getUid).collect(Collectors.toList());
|
||||||
Map<Long, Users> usersMap = usersService.getUsersMapByUids(uidList);
|
Map<Long, Users> usersMap = usersService.getUsersMapByUids(uidList);
|
||||||
|
Map<Long, String> userRechargeLevelMap = userRechargeLevelService.mapLevelByUid(uidList);
|
||||||
for (Lucky24PersonalStat stat: subList) {
|
for (Lucky24PersonalStat stat: subList) {
|
||||||
Users u = usersMap.get(stat.getUid());
|
Users u = usersMap.get(stat.getUid());
|
||||||
if (null != u){
|
if (null != u){
|
||||||
stat.setErbanNo(u.getErbanNo());
|
stat.setErbanNo(u.getErbanNo());
|
||||||
}
|
}
|
||||||
|
stat.setUserRechargeLevel(userRechargeLevelMap.get(stat.getUid()));
|
||||||
|
|
||||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||||
@@ -199,6 +205,8 @@ public class Lucky24RecordAdminService {
|
|||||||
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
||||||
Map<String, Lucky24PersonalStat> statMap = new HashMap<>(dateStrList.size());
|
Map<String, Lucky24PersonalStat> statMap = new HashMap<>(dateStrList.size());
|
||||||
|
|
||||||
|
String userRechargeLevel = userRechargeLevelService.getLevelByUid(uid);
|
||||||
|
|
||||||
CountDownLatch cdl = new CountDownLatch(2);
|
CountDownLatch cdl = new CountDownLatch(2);
|
||||||
|
|
||||||
Long finalUid = uid;
|
Long finalUid = uid;
|
||||||
@@ -264,9 +272,10 @@ public class Lucky24RecordAdminService {
|
|||||||
page.setRecords(subDateStrList.parallelStream().map(dateStr->{
|
page.setRecords(subDateStrList.parallelStream().map(dateStr->{
|
||||||
Lucky24PersonalStat stat = statMap.get(dateStr);
|
Lucky24PersonalStat stat = statMap.get(dateStr);
|
||||||
if (null == stat) {
|
if (null == stat) {
|
||||||
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo);
|
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo, userRechargeLevel);
|
||||||
} else {
|
} else {
|
||||||
stat.setErbanNo(erbanNo);
|
stat.setErbanNo(erbanNo);
|
||||||
|
stat.setUserRechargeLevel(userRechargeLevel);
|
||||||
}
|
}
|
||||||
return stat;
|
return stat;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
@@ -283,7 +292,9 @@ public class Lucky24RecordAdminService {
|
|||||||
Date endTime = DateTimeUtil.getEndTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
Date endTime = DateTimeUtil.getEndTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||||
ZonedDateTime zonedEndTime = endTime.toInstant().atZone(ZoneId.systemDefault());
|
ZonedDateTime zonedEndTime = endTime.toInstant().atZone(ZoneId.systemDefault());
|
||||||
Date systemEndTime = Date.from(zonedEndTime.withZoneSameLocal(zoneId).toInstant());
|
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) {
|
public Page<Lucky24RecordAdminVo> pageRecord(Long uid, String date, Integer poolType, int pageNo, int pageSize) {
|
||||||
|
@@ -13,8 +13,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserRechargeLevelService extends ServiceImpl<UserRechargeLevelMapper, UserRechargeLevel> implements InitializingBean {
|
public class UserRechargeLevelService extends ServiceImpl<UserRechargeLevelMapper, UserRechargeLevel> implements InitializingBean {
|
||||||
@@ -46,6 +47,15 @@ public class UserRechargeLevelService extends ServiceImpl<UserRechargeLevelMappe
|
|||||||
return level;
|
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) {
|
public void statistics(Long uid, BigDecimal totalReceiveGoldNum, BigDecimal last60TotalReceiveGoldNum) {
|
||||||
|
|
||||||
boolean isRechargeUser = rechargeUserService.isRechargeUser(uid);
|
boolean isRechargeUser = rechargeUserService.isRechargeUser(uid);
|
||||||
|
@@ -24,6 +24,8 @@ public class Lucky24PersonalStat {
|
|||||||
private Long uid;
|
private Long uid;
|
||||||
@ApiModelProperty("erbanNO")
|
@ApiModelProperty("erbanNO")
|
||||||
private Long erbanNo;
|
private Long erbanNo;
|
||||||
|
@ApiModelProperty("用户充值等级")
|
||||||
|
private String userRechargeLevel;
|
||||||
|
|
||||||
@ApiModelProperty("送礼金币总额")
|
@ApiModelProperty("送礼金币总额")
|
||||||
private Long totalInput;
|
private Long totalInput;
|
||||||
@@ -42,11 +44,12 @@ public class Lucky24PersonalStat {
|
|||||||
@ApiModelProperty("中奖率")
|
@ApiModelProperty("中奖率")
|
||||||
private BigDecimal winRate;
|
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.date = date;
|
||||||
this.partitionId = partitionId;
|
this.partitionId = partitionId;
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.erbanNo = erbanNo;
|
this.erbanNo = erbanNo;
|
||||||
|
this.userRechargeLevel = userRechargeLevel;
|
||||||
this.totalInput = 0L;
|
this.totalInput = 0L;
|
||||||
this.totalOutput = 0L;
|
this.totalOutput = 0L;
|
||||||
this.production = 0L;
|
this.production = 0L;
|
||||||
|
@@ -6,6 +6,6 @@ import io.swagger.annotations.ApiModel;
|
|||||||
public class Lucky25PersonalStat extends Lucky24PersonalStat {
|
public class Lucky25PersonalStat extends Lucky24PersonalStat {
|
||||||
|
|
||||||
public Lucky25PersonalStat(String date, Integer partitionId, Long uid, Long erbanNo) {
|
public Lucky25PersonalStat(String date, Integer partitionId, Long uid, Long erbanNo) {
|
||||||
super(date, partitionId, uid, erbanNo);
|
super(date, partitionId, uid, erbanNo, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user