幸运24-后台-个人-用户充值等级-查询
This commit is contained in:
@@ -142,7 +142,7 @@ public class Lucky24RecordAdminService {
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Lucky24PersonalStatVo getPersonal(Integer partitionId, Long erbanNo, String date, Integer poolType,
|
||||
public Lucky24PersonalStatVo getPersonal(Integer partitionId, Long erbanNo, String date, String userRechargeLevel, Integer poolType,
|
||||
int pageNo, int pageSize) {
|
||||
Page<Lucky24PersonalStat> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
@@ -158,8 +158,8 @@ public class Lucky24RecordAdminService {
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
String zonedDateStr = DateTimeUtil.getZonedTodayStr(partitionInfo.getZoneId());
|
||||
if (StringUtils.hasText(date)){
|
||||
List<Lucky24PersonalStat> list = zonedDateStr.equals(date)? listPersonal(partitionId, partitionInfo.getZoneId(), uid, date, poolType):
|
||||
statMapper.listPersonalStat(partitionId, uid, poolType, date, date);
|
||||
List<Lucky24PersonalStat> list = zonedDateStr.equals(date)? listPersonal(partitionId, partitionInfo.getZoneId(), uid, date, userRechargeLevel, poolType):
|
||||
statMapper.listPersonalStat(partitionId, uid, userRechargeLevel, poolType, date, date);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new Lucky24PersonalStatVo(new PageResult<>(page));
|
||||
@@ -205,14 +205,14 @@ public class Lucky24RecordAdminService {
|
||||
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
||||
Map<String, Lucky24PersonalStat> statMap = new HashMap<>(dateStrList.size());
|
||||
|
||||
String userRechargeLevel = userRechargeLevelService.getLevelByUid(uid);
|
||||
String uRechargeLevel = userRechargeLevelService.getLevelByUid(uid);
|
||||
|
||||
CountDownLatch cdl = new CountDownLatch(2);
|
||||
|
||||
Long finalUid = uid;
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
List<Lucky24PersonalStat> list = listPersonal(partitionId, partitionInfo.getZoneId(), finalUid, zonedDateStr, poolType);
|
||||
List<Lucky24PersonalStat> list = listPersonal(partitionId, partitionInfo.getZoneId(), finalUid, zonedDateStr, userRechargeLevel, poolType);
|
||||
for (Lucky24PersonalStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
|
||||
@@ -234,7 +234,7 @@ public class Lucky24RecordAdminService {
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PersonalStat> statList = statMapper.listPersonalStat(partitionId, finalUid, poolType, historyStartDate, historyEndDate);
|
||||
List<Lucky24PersonalStat> statList = statMapper.listPersonalStat(partitionId, finalUid, userRechargeLevel, poolType, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
for (Lucky24PersonalStat stat: statList) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
@@ -272,10 +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, userRechargeLevel);
|
||||
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo, uRechargeLevel);
|
||||
} else {
|
||||
stat.setErbanNo(erbanNo);
|
||||
stat.setUserRechargeLevel(userRechargeLevel);
|
||||
stat.setUserRechargeLevel(uRechargeLevel);
|
||||
}
|
||||
return stat;
|
||||
}).collect(Collectors.toList()));
|
||||
@@ -283,7 +283,7 @@ public class Lucky24RecordAdminService {
|
||||
return new Lucky24PersonalStatVo(totalInput, totalOutput, totalProductionRatio, new PageResult<>(page));
|
||||
}
|
||||
|
||||
private List<Lucky24PersonalStat> listPersonal(int partitionId, String zonedId, Long uid, String date, Integer poolType) {
|
||||
private List<Lucky24PersonalStat> listPersonal(int partitionId, String zonedId, Long uid, String date, String userRechargeLevel, Integer poolType) {
|
||||
ZoneId zoneId = ZoneId.of(zonedId);
|
||||
Date startTime = DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedStartTime = startTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
@@ -293,8 +293,8 @@ public class Lucky24RecordAdminService {
|
||||
ZonedDateTime zonedEndTime = endTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemEndTime = Date.from(zonedEndTime.withZoneSameLocal(zoneId).toInstant());
|
||||
return null == poolType?
|
||||
recordMapper.listPersonal(partitionId, uid, systemStartTime, systemEndTime, zoneIdHour):
|
||||
recordMapper.listPersonalByPoolType(partitionId, uid, poolType, systemStartTime, systemEndTime, zoneIdHour);
|
||||
recordMapper.listPersonal(partitionId, uid, userRechargeLevel, systemStartTime, systemEndTime, zoneIdHour):
|
||||
recordMapper.listPersonalByPoolType(partitionId, uid, userRechargeLevel, poolType, systemStartTime, systemEndTime, zoneIdHour);
|
||||
}
|
||||
|
||||
public Page<Lucky24RecordAdminVo> pageRecord(Long uid, String date, Integer poolType, int pageNo, int pageSize) {
|
||||
|
@@ -58,12 +58,12 @@ public class Lucky24RecordAdminController {
|
||||
@ApiImplicitParam(value = "pageSize", name = "页长", required = true),
|
||||
})
|
||||
@GetMapping("/personal")
|
||||
public BusiResult<Lucky24PersonalStatVo> personal(Integer partitionId, Long erbanNo, String date, Integer poolType,
|
||||
public BusiResult<Lucky24PersonalStatVo> personal(Integer partitionId, Long erbanNo, String date, String userRechargeLevel, Integer poolType,
|
||||
int pageNo, int pageSize) {
|
||||
if (null == partitionId || (null == erbanNo && !StringUtils.hasText(date))) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
Lucky24PersonalStatVo vo = service.getPersonal(partitionId, erbanNo, date, poolType, pageNo, pageSize);
|
||||
Lucky24PersonalStatVo vo = service.getPersonal(partitionId, erbanNo, date, userRechargeLevel, poolType, pageNo, pageSize);
|
||||
return BusiResult.success(vo);
|
||||
}
|
||||
|
||||
|
@@ -20,12 +20,12 @@ public interface Lucky24RecordMapper extends BaseMapper<Lucky24Record> {
|
||||
|
||||
List<Lucky24PersonalStat> listPersonal(@Param("partitionId") Integer partitionId,
|
||||
@Param("uid") Long uid,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("userRechargeLevel") String userRechargeLevel, @Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("zoneIdHour") long zoneIdHour);
|
||||
|
||||
List<Lucky24PersonalStat> listPersonalByPoolType(@Param("partitionId") Integer partitionId,
|
||||
@Param("uid") Long uid, @Param("poolType") Integer poolType,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("zoneIdHour") long zoneIdHour);
|
||||
@Param("uid") Long uid, @Param("userRechargeLevel") String userRechargeLevel, @Param("poolType") Integer poolType,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("zoneIdHour") long zoneIdHour);
|
||||
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@
|
||||
</select>
|
||||
|
||||
<select id="listPersonal" resultType="com.accompany.sharding.vo.Lucky24PersonalStat">
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`, partition_id,
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`, r.partition_id,
|
||||
r.uid, 0 as pool_type,
|
||||
sum(gift_num * gift_gold_price) `totalInput`,
|
||||
sum(win_gold_num) `totalOutput`,
|
||||
@@ -60,6 +60,10 @@
|
||||
count((case when win_gold_num > 0 then r.uid else null end)) `winNum`,
|
||||
ifnull(count((case when win_gold_num > 0 then r.uid else null end)) / count(*),0) `winRate`
|
||||
from lucky_24_record r
|
||||
<if test="null != userRechargeLevel and '' != userRechargeLevel">
|
||||
inner join users u on r.uid = u.uid
|
||||
inner join user_recharge_level url on u.uid = url.uid and url.level = #{userRechargeLevel}
|
||||
</if>
|
||||
where r.create_time >= #{startTime} and r.create_time <= #{endTime}
|
||||
<if test="null != uid">
|
||||
and r.uid = #{uid}
|
||||
@@ -69,7 +73,7 @@
|
||||
</select>
|
||||
|
||||
<select id="listPersonalByPoolType" resultType="com.accompany.sharding.vo.Lucky24PersonalStat">
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`, partition_id,
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`, r.partition_id,
|
||||
r.uid, r.pool_type,
|
||||
sum(gift_num * gift_gold_price) `totalInput`,
|
||||
sum(win_gold_num) `totalOutput`,
|
||||
@@ -80,6 +84,10 @@
|
||||
count((case when win_gold_num > 0 then r.uid else null end)) `winNum`,
|
||||
ifnull(count((case when win_gold_num > 0 then r.uid else null end)) / count(*),0) `winRate`
|
||||
from lucky_24_record r
|
||||
<if test="null != userRechargeLevel and '' != userRechargeLevel">
|
||||
inner join users u on r.uid = u.uid
|
||||
inner join user_recharge_level url on u.uid = url.uid and url.level = #{userRechargeLevel}
|
||||
</if>
|
||||
where r.create_time >= #{startTime} and r.create_time <= #{endTime}
|
||||
<if test="null != uid">
|
||||
and r.uid = #{uid}
|
||||
|
@@ -16,7 +16,7 @@ public interface Lucky24StatMapper {
|
||||
@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
List<Lucky24PersonalStat> listPersonalStat(@Param("partitionId") Integer partitionId,
|
||||
@Param("uid") Long uid, @Param("poolType") Integer poolType,
|
||||
@Param("uid") Long uid, String userRechargeLevel, @Param("poolType") Integer poolType,
|
||||
@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ public class Lucky24RecordService extends ServiceImpl<Lucky24RecordMapper, Lucky
|
||||
});
|
||||
}
|
||||
|
||||
List<Lucky24PersonalStat> personalList = this.baseMapper.listPersonal(partitionId, null, startTime, endTime, zoneIdHour);
|
||||
List<Lucky24PersonalStat> personalList = this.baseMapper.listPersonal(partitionId, null, null, startTime, endTime, zoneIdHour);
|
||||
log.info("[lucky24RecordStat] personal partitionId {} startTime {} endTime {} zoneIdHour {} personalList: {}",
|
||||
partitionId, DateTimeUtil.convertDate(startTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN),
|
||||
DateTimeUtil.convertDate(endTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN), zoneIdHour, JSON.toJSONString(personalList));
|
||||
@@ -113,7 +113,7 @@ public class Lucky24RecordService extends ServiceImpl<Lucky24RecordMapper, Lucky
|
||||
}
|
||||
}
|
||||
|
||||
List<Lucky24PersonalStat> personalByPoolTypeList = this.baseMapper.listPersonalByPoolType(partitionId, null, null, startTime, endTime, zoneIdHour);
|
||||
List<Lucky24PersonalStat> personalByPoolTypeList = this.baseMapper.listPersonalByPoolType(partitionId, null, null, null, startTime, endTime, zoneIdHour);
|
||||
log.info("[lucky24RecordStat] personalByPoolType partitionId {} startTime {} endTime {} zoneIdHour {} personalByPoolTypeList: {}",
|
||||
partitionId, DateTimeUtil.convertDate(startTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN),
|
||||
DateTimeUtil.convertDate(endTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN), zoneIdHour, JSON.toJSONString(personalByPoolTypeList));
|
||||
|
Reference in New Issue
Block a user