幸运24-统计-poolType分组汇总
This commit is contained in:
@@ -39,7 +39,6 @@ import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@@ -64,8 +63,8 @@ public class Lucky24RecordAdminService {
|
||||
@Autowired
|
||||
private GiftService giftService;
|
||||
|
||||
public Lucky24PlatformStatVo getPlatform(Integer partitionId) {
|
||||
List<Lucky24PlatformStat> list = listPlatform(partitionId);
|
||||
public Lucky24PlatformStatVo getPlatform(Integer partitionId, Integer poolType) {
|
||||
List<Lucky24PlatformStat> list = listPlatform(partitionId, poolType);
|
||||
long totalInput = list.stream().mapToLong(Lucky24PlatformStat::getTotalInput).sum();
|
||||
long totalOutput = list.stream().mapToLong(Lucky24PlatformStat::getTotalOutput).sum();
|
||||
BigDecimal totalProductionRatio = BigDecimal.ZERO.compareTo(BigDecimal.valueOf(totalOutput)) >= 0?
|
||||
@@ -74,7 +73,7 @@ public class Lucky24RecordAdminService {
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public List<Lucky24PlatformStat> listPlatform(Integer partitionId) {
|
||||
public List<Lucky24PlatformStat> listPlatform(Integer partitionId, Integer poolType) {
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
String startDate = minStartDate;
|
||||
String endDate = DateTimeUtil.getZonedTodayStr(partitionInfo.getZoneId());
|
||||
@@ -93,7 +92,9 @@ public class Lucky24RecordAdminService {
|
||||
Date endTime = DateTimeUtil.getEndTimeOfDay(DateTimeUtil.convertStrToDate(endDate, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedEndTime = endTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemEndTime = Date.from(zonedEndTime.withZoneSameLocal(ZoneId.of(partitionInfo.getZoneId())).toInstant());
|
||||
List<Lucky24PlatformStat> list = recordMapper.listPlatform(partitionId, systemStartTime, systemEndTime, zoneIdHour);
|
||||
List<Lucky24PlatformStat> list = null == poolType?
|
||||
recordMapper.listPlatform(partitionId, systemStartTime, systemEndTime, zoneIdHour):
|
||||
recordMapper.listPlatformByPoolType(partitionId, poolType, systemStartTime, systemEndTime, zoneIdHour);
|
||||
for (Lucky24PlatformStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
}
|
||||
@@ -108,7 +109,7 @@ public class Lucky24RecordAdminService {
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PlatformStat> statList = statMapper.listPlatformStat(partitionId, historyStartDate, historyEndDate);
|
||||
List<Lucky24PlatformStat> statList = statMapper.listPlatformStat(partitionId, poolType, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
Map<String, Lucky24PlatformStat> historyStatMap = statList.stream().collect(Collectors.toMap(Lucky24PlatformStat::getDate, s->s));
|
||||
statMap.putAll(historyStatMap);
|
||||
@@ -138,7 +139,7 @@ public class Lucky24RecordAdminService {
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Lucky24PersonalStatVo getPersonal(Integer partitionId, Long erbanNo, String date,
|
||||
public Lucky24PersonalStatVo getPersonal(Integer partitionId, Long erbanNo, String date, Integer poolType,
|
||||
int pageNo, int pageSize) {
|
||||
Page<Lucky24PersonalStat> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
@@ -154,8 +155,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):
|
||||
statMapper.listPersonalStat(partitionId, uid, date, date);
|
||||
List<Lucky24PersonalStat> list = zonedDateStr.equals(date)? listPersonal(partitionId, partitionInfo.getZoneId(), uid, date, poolType):
|
||||
statMapper.listPersonalStat(partitionId, uid, poolType, date, date);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new Lucky24PersonalStatVo(new PageResult<>(page));
|
||||
@@ -203,7 +204,7 @@ public class Lucky24RecordAdminService {
|
||||
Long finalUid = uid;
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
List<Lucky24PersonalStat> list = listPersonal(partitionId, partitionInfo.getZoneId(), finalUid, zonedDateStr);
|
||||
List<Lucky24PersonalStat> list = listPersonal(partitionId, partitionInfo.getZoneId(), finalUid, zonedDateStr, poolType);
|
||||
for (Lucky24PersonalStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
|
||||
@@ -225,7 +226,7 @@ public class Lucky24RecordAdminService {
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PersonalStat> statList = statMapper.listPersonalStat(partitionId, finalUid, historyStartDate, historyEndDate);
|
||||
List<Lucky24PersonalStat> statList = statMapper.listPersonalStat(partitionId, finalUid, poolType, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
for (Lucky24PersonalStat stat: statList) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
@@ -273,7 +274,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) {
|
||||
private List<Lucky24PersonalStat> listPersonal(int partitionId, String zonedId, Long uid, String date, 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());
|
||||
@@ -285,7 +286,7 @@ public class Lucky24RecordAdminService {
|
||||
return recordMapper.listPersonal(partitionId, uid, systemStartTime, systemEndTime, zoneIdHour);
|
||||
}
|
||||
|
||||
public Page<Lucky24RecordAdminVo> pageRecord(Long uid, String date, int pageNo, int pageSize) {
|
||||
public Page<Lucky24RecordAdminVo> pageRecord(Long uid, String date, Integer poolType, int pageNo, int pageSize) {
|
||||
Users u = usersService.getNotNullUsersByUid(uid);
|
||||
PartitionEnum partitionEnum = PartitionEnum.getByPartitionId(u.getPartitionId());
|
||||
|
||||
@@ -302,7 +303,8 @@ public class Lucky24RecordAdminService {
|
||||
Page<Lucky24Record> poPage = new Page<>(pageNo, pageSize);
|
||||
recordMapper.selectPage(poPage, Wrappers.<Lucky24Record>lambdaQuery()
|
||||
.eq(Lucky24Record::getUid, uid)
|
||||
.between(Lucky24Record::getCreateTime, systemStartTime, systemEndTime));
|
||||
.between(Lucky24Record::getCreateTime, systemStartTime, systemEndTime)
|
||||
.eq(null != poolType, Lucky24Record::getPoolType, poolType));
|
||||
|
||||
if (CollectionUtils.isEmpty(poPage.getRecords())){
|
||||
return voPage;
|
||||
|
@@ -16,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "幸运24")
|
||||
@RestController
|
||||
@@ -28,16 +27,23 @@ public class Lucky24PoolAdminController {
|
||||
|
||||
@ApiOperation("类型列表")
|
||||
@GetMapping("/listType")
|
||||
public BusiResult<List<Map<String, Object>>> listType() {
|
||||
return BusiResult.success(Arrays.stream(Lucky24PoolTypeEnum.values())
|
||||
public BusiResult<List<Map<String, Object>>> listType(Boolean needAll) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if (Boolean.TRUE.equals(needAll)) {
|
||||
Map<String, Object> all = new HashMap<>();
|
||||
all.put("type", 0);
|
||||
all.put("name", "全部");
|
||||
list.add(all);
|
||||
}
|
||||
list.addAll(Arrays.stream(Lucky24PoolTypeEnum.values())
|
||||
.sorted(Comparator.comparing(Lucky24PoolTypeEnum::getType))
|
||||
.map(typeEnum -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("type", typeEnum.getType());
|
||||
map.put("name", typeEnum.getName());
|
||||
map.put("disabled", typeEnum.getType() == Lucky24PoolTypeEnum.EXTRA_POOL.getType());
|
||||
return map;
|
||||
}).collect(Collectors.toList()));
|
||||
}).toList());
|
||||
return BusiResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("池子列表")
|
||||
|
@@ -4,7 +4,6 @@ import com.accompany.admin.service.lucky.Lucky24RecordAdminService;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PersonalStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PlatformStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24RecordAdminVo;
|
||||
import com.accompany.admin.vo.miniGame.MiniGameWeekJackpotUserRecordAdminVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
@@ -26,7 +25,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "幸运24")
|
||||
@RestController
|
||||
@@ -39,13 +37,14 @@ public class Lucky24RecordAdminController {
|
||||
@ApiOperation("平台数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(value = "partitionId", name = "分区ID", required = true),
|
||||
@ApiImplicitParam(value = "poolType", name = "数组类型"),
|
||||
})
|
||||
@GetMapping("/platform")
|
||||
public BusiResult<Lucky24PlatformStatVo> platform(Integer partitionId) {
|
||||
public BusiResult<Lucky24PlatformStatVo> platform(Integer partitionId, Integer poolType) {
|
||||
if (null == partitionId) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
Lucky24PlatformStatVo platformStat = service.getPlatform(partitionId);
|
||||
Lucky24PlatformStatVo platformStat = service.getPlatform(partitionId, poolType);
|
||||
return BusiResult.success(platformStat);
|
||||
}
|
||||
|
||||
@@ -54,16 +53,17 @@ public class Lucky24RecordAdminController {
|
||||
@ApiImplicitParam(value = "partitionId", name = "分区ID", required = true),
|
||||
@ApiImplicitParam(value = "erbanNo", name = "用户ID"),
|
||||
@ApiImplicitParam(value = "date", name = "开始日期", required = true),
|
||||
@ApiImplicitParam(value = "poolType", name = "数组类型", required = true),
|
||||
@ApiImplicitParam(value = "pageNo", name = "页号", required = true),
|
||||
@ApiImplicitParam(value = "pageSize", name = "页长", required = true),
|
||||
})
|
||||
@GetMapping("/personal")
|
||||
public BusiResult<Lucky24PersonalStatVo> personal(Integer partitionId, Long erbanNo, String date,
|
||||
public BusiResult<Lucky24PersonalStatVo> personal(Integer partitionId, Long erbanNo, String date, 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, pageNo, pageSize);
|
||||
Lucky24PersonalStatVo vo = service.getPersonal(partitionId, erbanNo, date, poolType, pageNo, pageSize);
|
||||
return BusiResult.success(vo);
|
||||
}
|
||||
|
||||
@@ -71,16 +71,17 @@ public class Lucky24RecordAdminController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(value = "uid", name = "用户UID"),
|
||||
@ApiImplicitParam(value = "date", name = "开始时间", required = true),
|
||||
@ApiImplicitParam(value = "poolType", name = "数组类型"),
|
||||
@ApiImplicitParam(value = "pageNo", name = "页号", required = true),
|
||||
@ApiImplicitParam(value = "pageSize", name = "页长", required = true),
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public BusiResult<PageResult<Lucky24RecordAdminVo>> pageRecord(Long uid, String date,
|
||||
public BusiResult<PageResult<Lucky24RecordAdminVo>> pageRecord(Long uid, String date, Integer poolType,
|
||||
int pageNo, int pageSize) {
|
||||
if (!StringUtils.hasText(date)) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
Page<Lucky24RecordAdminVo> page = service.pageRecord(uid, date, pageNo, pageSize);
|
||||
Page<Lucky24RecordAdminVo> page = service.pageRecord(uid, date, poolType, pageNo, pageSize);
|
||||
return BusiResult.success(new PageResult<>(page));
|
||||
}
|
||||
|
||||
@@ -88,13 +89,14 @@ public class Lucky24RecordAdminController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(value = "uid", name = "用户UID"),
|
||||
@ApiImplicitParam(value = "date", name = "开始时间", required = true),
|
||||
@ApiImplicitParam(value = "poolType", name = "数组类型"),
|
||||
})
|
||||
@GetMapping("/export")
|
||||
public void exportRecord(HttpServletResponse response, Long uid, String date) throws IOException {
|
||||
public void exportRecord(HttpServletResponse response, Long uid, String date, Integer poolType) throws IOException {
|
||||
if (!StringUtils.hasText(date)) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
Page<Lucky24RecordAdminVo> page = service.pageRecord(uid, date, -1, -1);
|
||||
Page<Lucky24RecordAdminVo> page = service.pageRecord(uid, date, poolType, -1, -1);
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
|
@@ -18,6 +18,8 @@ public class Lucky24PersonalStat {
|
||||
private String date;
|
||||
@ApiModelProperty("分区id")
|
||||
private Integer partitionId;
|
||||
@ApiModelProperty("分区描述")
|
||||
private Integer poolType;
|
||||
@ApiModelProperty("uid")
|
||||
private Long uid;
|
||||
@ApiModelProperty("erbanNO")
|
||||
|
@@ -18,6 +18,8 @@ public class Lucky24PlatformStat {
|
||||
private String date;
|
||||
@ApiModelProperty("分区id")
|
||||
private Integer partitionId;
|
||||
@ApiModelProperty("数组类型")
|
||||
private Integer poolType;
|
||||
@ApiModelProperty("送礼金币总额")
|
||||
private Long totalInput;
|
||||
@ApiModelProperty("送礼返币总额")
|
||||
|
@@ -14,9 +14,18 @@ public interface Lucky24RecordMapper extends BaseMapper<Lucky24Record> {
|
||||
List<Lucky24PlatformStat> listPlatform(@Param("partitionId") Integer partitionId, @Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("zoneIdHour") long zoneIdHour);
|
||||
|
||||
List<Lucky24PlatformStat> listPlatformByPoolType(@Param("partitionId") Integer partitionId, @Param("poolType") Integer poolType,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("zoneIdHour") long zoneIdHour);
|
||||
|
||||
List<Lucky24PersonalStat> listPersonal(@Param("partitionId") Integer partitionId,
|
||||
@Param("uid") Long uid,
|
||||
@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);
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.accompany.sharding.mapper.Lucky24RecordMapper">
|
||||
|
||||
<select id="listPlatform" resultType="com.accompany.sharding.vo.Lucky24PlatformStat">
|
||||
select `date`, partition_id,
|
||||
select `date`, partition_id, 0 as pool_type,
|
||||
sum(`totalInput`) `totalInput`, sum(`totalOutput`) `totalOutput`,
|
||||
sum(`totalOutput`) / sum(`totalInput`) `productionRatio`,
|
||||
count(*) `count`, count((IF(`maxOutput` > 0, 1, null))) `winCount`,
|
||||
@@ -23,9 +23,34 @@
|
||||
group by `date`
|
||||
</select>
|
||||
|
||||
<select id="listPlatformByPoolType" resultType="com.accompany.sharding.vo.Lucky24PlatformStat">
|
||||
select `date`, partition_id, pool_type,
|
||||
sum(`totalInput`) `totalInput`, sum(`totalOutput`) `totalOutput`,
|
||||
sum(`totalOutput`) / sum(`totalInput`) `productionRatio`,
|
||||
count(*) `count`, count((IF(`maxOutput` > 0, 1, null))) `winCount`,
|
||||
sum(`num`) `num`, sum(`winNum`) `winNum`, sum(`winNum`) / sum(`num`) `winRate`
|
||||
from (
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`,
|
||||
partition_id,
|
||||
pool_type,
|
||||
sum(gift_num * gift_gold_price) `totalInput`,
|
||||
sum(win_gold_num) `totalOutput`,
|
||||
count(*) `num`,
|
||||
count((case when win_gold_num > 0 then 1 end)) `winNum`,
|
||||
max(win_gold_num) `maxOutput`
|
||||
from lucky_24_record r
|
||||
where r.create_time >= #{startTime} and r.create_time <= #{endTime}
|
||||
and r.partition_id = #{partitionId}
|
||||
<if test="null != poolType">
|
||||
and r.pool_type = #{poolType}
|
||||
</if>
|
||||
group by `date`, uid, pool_type) l
|
||||
group by `date`, pool_type
|
||||
</select>
|
||||
|
||||
<select id="listPersonal" resultType="com.accompany.sharding.vo.Lucky24PersonalStat">
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`, partition_id,
|
||||
r.uid,
|
||||
r.uid, 0 as pool_type,
|
||||
sum(gift_num * gift_gold_price) `totalInput`,
|
||||
sum(win_gold_num) `totalOutput`,
|
||||
sum(gift_num * gift_gold_price) - sum(win_gold_num) `production`,
|
||||
@@ -43,4 +68,27 @@
|
||||
group by `date`, r.uid
|
||||
</select>
|
||||
|
||||
<select id="listPersonalByPoolType" resultType="com.accompany.sharding.vo.Lucky24PersonalStat">
|
||||
select date(date_add(r.create_time, INTERVAL #{zoneIdHour} HOUR)) `date`, partition_id,
|
||||
r.uid, r.pool_type,
|
||||
sum(gift_num * gift_gold_price) `totalInput`,
|
||||
sum(win_gold_num) `totalOutput`,
|
||||
sum(gift_num * gift_gold_price) - sum(win_gold_num) `production`,
|
||||
sum(win_gold_num) / sum(gift_num * gift_gold_price) `productionRatio`,
|
||||
sum(gift_num * gift_gold_price) / count(*) `avgInput`,
|
||||
count(*) `num`,
|
||||
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
|
||||
where r.create_time >= #{startTime} and r.create_time <= #{endTime}
|
||||
<if test="null != uid">
|
||||
and r.uid = #{uid}
|
||||
</if>
|
||||
<if test="null != poolType">
|
||||
and r.pool_type = #{poolType}
|
||||
</if>
|
||||
and r.partition_id = #{partitionId}
|
||||
group by `date`, r.uid, pool_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@@ -12,10 +12,11 @@ public interface Lucky24StatMapper {
|
||||
|
||||
int savePersonal(@Param("item") Lucky24PersonalStat item);
|
||||
|
||||
List<Lucky24PlatformStat> listPlatformStat(@Param("partitionId") Integer partitionId, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
List<Lucky24PlatformStat> listPlatformStat(@Param("partitionId") Integer partitionId, @Param("poolType") Integer poolType,
|
||||
@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
List<Lucky24PersonalStat> listPersonalStat(@Param("partitionId") Integer partitionId,
|
||||
@Param("uid") Long uid,
|
||||
@Param("uid") Long uid, @Param("poolType") Integer poolType,
|
||||
@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
}
|
||||
|
@@ -79,6 +79,18 @@ public class Lucky24RecordService extends ServiceImpl<Lucky24RecordMapper, Lucky
|
||||
});
|
||||
}
|
||||
|
||||
List<Lucky24PlatformStat> platformByPoolTypeList = this.baseMapper.listPlatformByPoolType(partitionId, null, startTime, endTime, zoneIdHour);
|
||||
log.info("[lucky24RecordStat] platformByPoolType partitionId {} startTime {} endTime {} zoneIdHour {} platformByPoolTypeList: {}",
|
||||
partitionId, DateTimeUtil.convertDate(startTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN),
|
||||
DateTimeUtil.convertDate(endTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN), zoneIdHour, JSON.toJSONString(platformByPoolTypeList));
|
||||
if (!CollectionUtils.isEmpty(platformByPoolTypeList)) {
|
||||
bizExecutor.execute(() -> {
|
||||
for (Lucky24PlatformStat platformStat : platformByPoolTypeList) {
|
||||
statMapper.savePlatform(platformStat);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
List<Lucky24PersonalStat> personalList = this.baseMapper.listPersonal(partitionId, null, startTime, endTime, zoneIdHour);
|
||||
log.info("[lucky24RecordStat] personal partitionId {} startTime {} endTime {} zoneIdHour {} personalList: {}",
|
||||
partitionId, DateTimeUtil.convertDate(startTime, DateTimeUtil.DEFAULT_DATETIME_PATTERN),
|
||||
@@ -93,5 +105,20 @@ public class Lucky24RecordService extends ServiceImpl<Lucky24RecordMapper, Lucky
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<Lucky24PersonalStat> personalByPoolTypeList = this.baseMapper.listPersonalByPoolType(partitionId, 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));
|
||||
if (!CollectionUtils.isEmpty(personalByPoolTypeList)) {
|
||||
List<List<Lucky24PersonalStat>> list = Lists.partition(personalByPoolTypeList, 20);
|
||||
for (List<Lucky24PersonalStat> personalStatList : list) {
|
||||
bizExecutor.execute(() -> {
|
||||
for (Lucky24PersonalStat personalStat : personalStatList) {
|
||||
statMapper.savePersonal(personalStat);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.accompany.business.mybatismapper.lucky.Lucky24StatMapper">
|
||||
<insert id="savePlatform">
|
||||
insert into lucky_24_record_platform_stat
|
||||
VALUES (#{item.date}, #{item.partitionId}, #{item.totalInput}, #{item.totalOutput}, #{item.productionRatio},
|
||||
VALUES (#{item.date}, #{item.partitionId}, #{item.poolType}, #{item.totalInput}, #{item.totalOutput}, #{item.productionRatio},
|
||||
#{item.num}, #{item.count}, #{item.winNum}, #{item.winCount}, #{item.winRate})
|
||||
ON DUPLICATE KEY UPDATE total_input = #{item.totalInput}, total_output = #{item.totalOutput}, production_ratio = #{item.productionRatio},
|
||||
num = #{item.num}, `count` = #{item.count}, win_num = #{item.winNum}, win_count = #{item.winCount}, win_rate = #{item.winRate};
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<insert id="savePersonal">
|
||||
insert into lucky_24_record_personal_stat
|
||||
VALUES (#{item.date}, #{item.partitionId}, #{item.uid}, #{item.totalInput}, #{item.totalOutput},
|
||||
VALUES (#{item.date}, #{item.partitionId}, #{item.uid}, #{item.poolType}, #{item.totalInput}, #{item.totalOutput},
|
||||
#{item.production}, #{item.productionRatio}, #{item.avgInput},
|
||||
#{item.num}, #{item.winNum}, #{item.winRate})
|
||||
ON DUPLICATE KEY UPDATE total_input = #{item.totalInput}, total_output = #{item.totalOutput},
|
||||
@@ -23,6 +23,12 @@
|
||||
select * from lucky_24_record_platform_stat s
|
||||
where s.date between #{startDate} and #{endDate}
|
||||
and s.partition_id = #{partitionId}
|
||||
<if test="null != poolType">
|
||||
and s.pool_type = #{poolType}
|
||||
</if>
|
||||
<if test="null == poolType">
|
||||
and s.pool_type = 0
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listPersonalStat" resultType="com.accompany.sharding.vo.Lucky24PersonalStat">
|
||||
@@ -32,6 +38,12 @@
|
||||
<if test="null != uid">
|
||||
and s.uid = #{uid}
|
||||
</if>
|
||||
<if test="null != poolType">
|
||||
and s.pool_type = #{poolType}
|
||||
</if>
|
||||
<if test="null == poolType">
|
||||
and s.pool_type = 0
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user