lucky24-后台-明细
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
package com.accompany.admin.vo.luckybag;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@ApiModel
|
||||
public class Lucky24RecordAdminVo {
|
||||
|
||||
@ExcelProperty("记录id")
|
||||
@ApiModelProperty("记录id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("时间")
|
||||
@ApiModelProperty("时间")
|
||||
private String createTime;
|
||||
|
||||
@ExcelIgnore
|
||||
@ApiModelProperty("分区id")
|
||||
private Integer partitionId;
|
||||
@ExcelProperty("分区")
|
||||
@ApiModelProperty("分区描述")
|
||||
private String partitionDesc;
|
||||
|
||||
@ExcelIgnore
|
||||
@ApiModelProperty("用户id")
|
||||
private Long uid;
|
||||
@ExcelProperty("用户id")
|
||||
@ApiModelProperty("用户erbanNo")
|
||||
private Long erbanNo;
|
||||
@ExcelProperty("用户昵称")
|
||||
@ApiModelProperty("用户昵称")
|
||||
private String nick;
|
||||
|
||||
@ExcelIgnore
|
||||
@ApiModelProperty("接收者用户id")
|
||||
private Long receiverUid;
|
||||
@ExcelProperty("接收者用户id")
|
||||
@ApiModelProperty("接收者用户erbanNo")
|
||||
private Long receiverErbanNo;
|
||||
@ExcelProperty("接收者用户昵称")
|
||||
@ApiModelProperty("接收者用户昵称")
|
||||
private String receiverNick;
|
||||
|
||||
@ExcelIgnore
|
||||
@ApiModelProperty("房间uid")
|
||||
private Long roomUid;
|
||||
@ExcelProperty("房间id")
|
||||
@ApiModelProperty("房间id")
|
||||
private Long roomErbanNo;
|
||||
|
||||
@ExcelProperty("礼物id")
|
||||
@ApiModelProperty("礼物id")
|
||||
private Integer giftId;
|
||||
@ExcelProperty("礼物名称")
|
||||
@ApiModelProperty("礼物名称")
|
||||
private String giftName;
|
||||
@ExcelProperty("礼物图标")
|
||||
@ApiModelProperty("礼物价格")
|
||||
private Long giftGoldPrice;
|
||||
@ExcelProperty("数量")
|
||||
@ApiModelProperty("礼物数量")
|
||||
private Integer giftNum;
|
||||
@ExcelProperty("进入")
|
||||
@ApiModelProperty("进入")
|
||||
private Long input;
|
||||
|
||||
@ExcelProperty("数组id")
|
||||
@ApiModelProperty("poolId")
|
||||
private Integer poolId;
|
||||
@ExcelProperty("期望值")
|
||||
@ApiModelProperty("期望值")
|
||||
private BigDecimal expect;
|
||||
|
||||
@ExcelProperty("是否后台赠送")
|
||||
@ApiModelProperty("是否后台赠送")
|
||||
private Boolean isSupplement;
|
||||
@ExcelProperty("数组倍数")
|
||||
@ApiModelProperty("数组倍数")
|
||||
private Integer drawMultiple;
|
||||
@ExcelProperty("最终倍数")
|
||||
@ApiModelProperty("最终倍数")
|
||||
private Integer afterMultiple;
|
||||
@ExcelProperty("退出")
|
||||
@ApiModelProperty("退出")
|
||||
private Long winGoldNum;
|
||||
|
||||
}
|
@@ -3,47 +3,29 @@ package com.accompany.admin.service.lucky;
|
||||
import cn.hippo4j.common.toolkit.CollectionUtil;
|
||||
import com.accompany.admin.service.system.SysConfAdminService;
|
||||
import com.accompany.admin.vo.Lucky24ConfigAdminVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PersonalStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PlatformStatVo;
|
||||
import com.accompany.business.dto.lucky.Lucky24GiftConfig;
|
||||
import com.accompany.business.model.lucky.Lucky24Pool;
|
||||
import com.accompany.business.mybatismapper.lucky.Lucky24PoolMapper;
|
||||
import com.accompany.business.mybatismapper.lucky.Lucky24StatMapper;
|
||||
import com.accompany.business.service.gift.Lucky24GiftSendService;
|
||||
import com.accompany.business.service.lucky.Lucky24PoolService;
|
||||
import com.accompany.business.service.lucky.Lucky24StockService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.accompany.core.model.PartitionInfo;
|
||||
import com.accompany.core.model.SysConf;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.partition.PartitionInfoService;
|
||||
import com.accompany.sharding.mapper.Lucky24RecordMapper;
|
||||
import com.accompany.sharding.vo.Lucky24PersonalStat;
|
||||
import com.accompany.sharding.vo.Lucky24PlatformStat;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@@ -61,18 +43,7 @@ public class Lucky24PoolAdminService {
|
||||
@Autowired
|
||||
private SysConfAdminService sysConfAdminService;
|
||||
@Autowired
|
||||
private PartitionInfoService partitionInfoService;
|
||||
@Autowired
|
||||
private Lucky24PoolService poolService;
|
||||
@Autowired
|
||||
private Lucky24StatMapper statMapper;
|
||||
@Autowired
|
||||
private Lucky24RecordMapper recordMapper;
|
||||
|
||||
@Resource(name = "bizExecutor")
|
||||
private ThreadPoolExecutor bizExecutor;
|
||||
|
||||
private String minStartDate = "2024-09-20";
|
||||
|
||||
public List<Lucky24Pool> listPoolByType(Integer type) {
|
||||
return mapper.selectList(Wrappers.<Lucky24Pool>lambdaQuery().eq(Lucky24Pool::getType, type).orderByDesc(Lucky24Pool::getExpect));
|
||||
@@ -215,227 +186,6 @@ public class Lucky24PoolAdminService {
|
||||
sysConfAdminService.saveOrUpdate(sysConf);
|
||||
}
|
||||
|
||||
public Lucky24PlatformStatVo getPlatform(Integer partitionId) {
|
||||
List<Lucky24PlatformStat> list = listPlatform(partitionId);
|
||||
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?
|
||||
BigDecimal.ZERO: BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(totalInput), 4, RoundingMode.HALF_UP);
|
||||
return new Lucky24PlatformStatVo(totalInput, totalOutput, totalProductionRatio, list);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public List<Lucky24PlatformStat> listPlatform(Integer partitionId) {
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
String startDate = minStartDate;
|
||||
String endDate = DateTimeUtil.getZonedTodayStr(partitionInfo.getZoneId());
|
||||
|
||||
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
||||
Map<String, Lucky24PlatformStat> statMap = new HashMap<>(dateStrList.size());
|
||||
|
||||
CountDownLatch cdl = new CountDownLatch(2);
|
||||
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
Date startTime = DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.convertStrToDate(endDate, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedStartTime = startTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemStartTime = Date.from(zonedStartTime.withZoneSameLocal(ZoneId.of(partitionInfo.getZoneId())).toInstant());
|
||||
long zoneIdHour = Duration.between(systemStartTime.toInstant(), startTime.toInstant()).toHours();
|
||||
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);
|
||||
for (Lucky24PlatformStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPlatform] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PlatformStat> statList = statMapper.listPlatformStat(partitionId, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
Map<String, Lucky24PlatformStat> historyStatMap = statList.stream().collect(Collectors.toMap(Lucky24PlatformStat::getDate, s->s));
|
||||
statMap.putAll(historyStatMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPlatform] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
cdl.await();
|
||||
|
||||
dateStrList.add(endDate);
|
||||
|
||||
return dateStrList.parallelStream().sorted(Comparator.reverseOrder()).map(dateStr->{
|
||||
Lucky24PlatformStat stat = statMap.get(dateStr);
|
||||
if (null == stat) {
|
||||
stat = new Lucky24PlatformStat(dateStr, partitionId);
|
||||
} else {
|
||||
BigDecimal productionRatio = BigDecimal.ZERO.compareTo(BigDecimal.valueOf(stat.getTotalInput())) >= 0?
|
||||
BigDecimal.ZERO: BigDecimal.valueOf(stat.getTotalOutput()).divide(BigDecimal.valueOf(stat.getTotalInput()), 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
}
|
||||
return stat;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Lucky24PersonalStatVo getPersonal(Integer partitionId, Long erbanNo, String date,
|
||||
int pageNo, int pageSize) {
|
||||
Page<Lucky24PersonalStat> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
Long uid = null;
|
||||
if (null != erbanNo){
|
||||
Users u = usersService.getUserByErbanNo(erbanNo);
|
||||
if (null == u || !u.getPartitionId().equals(partitionId)){
|
||||
return new Lucky24PersonalStatVo(new PageResult<>(page));
|
||||
}
|
||||
uid = u.getUid();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new Lucky24PersonalStatVo(new PageResult<>(page));
|
||||
}
|
||||
|
||||
long totalInput = list.stream().mapToLong(Lucky24PersonalStat::getTotalInput).sum();
|
||||
long totalOutput = list.stream().mapToLong(Lucky24PersonalStat::getTotalOutput).sum();
|
||||
BigDecimal totalProductionRatio = BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(totalInput), 4, RoundingMode.HALF_UP);
|
||||
|
||||
// 按大到小排序
|
||||
list.sort(Comparator.comparing(Lucky24PersonalStat::getTotalInput).reversed());
|
||||
int startIndex = (pageNo -1) * pageSize;
|
||||
int endIndex = Math.min(startIndex + pageSize, list.size());
|
||||
|
||||
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);
|
||||
for (Lucky24PersonalStat stat: subList) {
|
||||
Users u = usersMap.get(stat.getUid());
|
||||
if (null != u){
|
||||
stat.setErbanNo(u.getErbanNo());
|
||||
}
|
||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
BigDecimal production = inPut.subtract(outPut);
|
||||
stat.setProduction(production.longValue());
|
||||
}
|
||||
|
||||
page.setRecords(subList);
|
||||
page.setTotal(list.size());
|
||||
|
||||
return new Lucky24PersonalStatVo(totalInput, totalOutput, totalProductionRatio, new PageResult<>(page));
|
||||
}
|
||||
|
||||
String startDate = minStartDate;
|
||||
String endDate = DateTimeUtil.getZonedTodayStr(partitionInfo.getZoneId());
|
||||
|
||||
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
||||
Map<String, Lucky24PersonalStat> statMap = new HashMap<>(dateStrList.size());
|
||||
|
||||
CountDownLatch cdl = new CountDownLatch(2);
|
||||
|
||||
Long finalUid = uid;
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
List<Lucky24PersonalStat> list = listPersonal(partitionId, partitionInfo.getZoneId(), finalUid, zonedDateStr);
|
||||
for (Lucky24PersonalStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
|
||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
BigDecimal production = inPut.subtract(outPut);
|
||||
stat.setProduction(production.longValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPersonal] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PersonalStat> statList = statMapper.listPersonalStat(partitionId, finalUid, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
for (Lucky24PersonalStat stat: statList) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
|
||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
BigDecimal production = inPut.subtract(outPut);
|
||||
stat.setProduction(production.longValue());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPersonal] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
cdl.await();
|
||||
|
||||
long totalInput = statMap.values().stream().mapToLong(Lucky24PersonalStat::getTotalInput).sum();
|
||||
long totalOutput = statMap.values().stream().mapToLong(Lucky24PersonalStat::getTotalOutput).sum();
|
||||
BigDecimal totalProductionRatio = totalInput>0L?BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(totalInput), 4, RoundingMode.HALF_UP):BigDecimal.ZERO;
|
||||
|
||||
dateStrList.add(endDate);
|
||||
dateStrList.sort(Comparator.reverseOrder());
|
||||
|
||||
// 按大到小排序
|
||||
int startIndex = (pageNo -1) * pageSize;
|
||||
int endIndex = Math.min(startIndex + pageSize, dateStrList.size());
|
||||
page.setTotal(dateStrList.size());
|
||||
|
||||
List<String> subDateStrList = dateStrList.subList(startIndex, endIndex);
|
||||
page.setRecords(subDateStrList.parallelStream().map(dateStr->{
|
||||
Lucky24PersonalStat stat = statMap.get(dateStr);
|
||||
if (null == stat) {
|
||||
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo);
|
||||
} else {
|
||||
stat.setErbanNo(erbanNo);
|
||||
}
|
||||
return stat;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
return new Lucky24PersonalStatVo(totalInput, totalOutput, totalProductionRatio, new PageResult<>(page));
|
||||
}
|
||||
|
||||
private List<Lucky24PersonalStat> listPersonal(int partitionId, String zonedId, Long uid, String date) {
|
||||
ZoneId zoneId = ZoneId.of(zonedId);
|
||||
Date startTime = DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedStartTime = startTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemStartTime = Date.from(zonedStartTime.withZoneSameLocal(zoneId).toInstant());
|
||||
long zoneIdHour = Duration.between(systemStartTime.toInstant(), startTime.toInstant()).toHours();
|
||||
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);
|
||||
}
|
||||
|
||||
public void updateUserMulti(Long erbanNo) {
|
||||
Users u = usersService.getUserByErbanNo(erbanNo);
|
||||
if (null == u){
|
||||
|
@@ -0,0 +1,371 @@
|
||||
package com.accompany.admin.service.lucky;
|
||||
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PersonalStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PlatformStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24RecordAdminVo;
|
||||
import com.accompany.business.model.Gift;
|
||||
import com.accompany.business.model.lucky.Lucky24Pool;
|
||||
import com.accompany.business.mybatismapper.lucky.Lucky24PoolMapper;
|
||||
import com.accompany.business.mybatismapper.lucky.Lucky24StatMapper;
|
||||
import com.accompany.business.service.gift.GiftService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
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.sharding.mapper.Lucky24RecordMapper;
|
||||
import com.accompany.sharding.model.Lucky24Record;
|
||||
import com.accompany.sharding.vo.Lucky24PersonalStat;
|
||||
import com.accompany.sharding.vo.Lucky24PlatformStat;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.ZoneId;
|
||||
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
|
||||
@Service
|
||||
public class Lucky24RecordAdminService {
|
||||
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private PartitionInfoService partitionInfoService;
|
||||
@Autowired
|
||||
private Lucky24StatMapper statMapper;
|
||||
@Autowired
|
||||
private Lucky24RecordMapper recordMapper;
|
||||
|
||||
@Resource(name = "bizExecutor")
|
||||
private ThreadPoolExecutor bizExecutor;
|
||||
|
||||
private String minStartDate = "2024-09-20";
|
||||
@Autowired
|
||||
private Lucky24PoolMapper poolMapper;
|
||||
@Autowired
|
||||
private GiftService giftService;
|
||||
|
||||
public Lucky24PlatformStatVo getPlatform(Integer partitionId) {
|
||||
List<Lucky24PlatformStat> list = listPlatform(partitionId);
|
||||
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?
|
||||
BigDecimal.ZERO: BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(totalInput), 4, RoundingMode.HALF_UP);
|
||||
return new Lucky24PlatformStatVo(totalInput, totalOutput, totalProductionRatio, list);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public List<Lucky24PlatformStat> listPlatform(Integer partitionId) {
|
||||
PartitionInfo partitionInfo = partitionInfoService.getById(partitionId);
|
||||
String startDate = minStartDate;
|
||||
String endDate = DateTimeUtil.getZonedTodayStr(partitionInfo.getZoneId());
|
||||
|
||||
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
||||
Map<String, Lucky24PlatformStat> statMap = new HashMap<>(dateStrList.size());
|
||||
|
||||
CountDownLatch cdl = new CountDownLatch(2);
|
||||
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
Date startTime = DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.convertStrToDate(endDate, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedStartTime = startTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemStartTime = Date.from(zonedStartTime.withZoneSameLocal(ZoneId.of(partitionInfo.getZoneId())).toInstant());
|
||||
long zoneIdHour = Duration.between(systemStartTime.toInstant(), startTime.toInstant()).toHours();
|
||||
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);
|
||||
for (Lucky24PlatformStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPlatform] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PlatformStat> statList = statMapper.listPlatformStat(partitionId, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
Map<String, Lucky24PlatformStat> historyStatMap = statList.stream().collect(Collectors.toMap(Lucky24PlatformStat::getDate, s->s));
|
||||
statMap.putAll(historyStatMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPlatform] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
cdl.await();
|
||||
|
||||
dateStrList.add(endDate);
|
||||
|
||||
return dateStrList.parallelStream().sorted(Comparator.reverseOrder()).map(dateStr->{
|
||||
Lucky24PlatformStat stat = statMap.get(dateStr);
|
||||
if (null == stat) {
|
||||
stat = new Lucky24PlatformStat(dateStr, partitionId);
|
||||
} else {
|
||||
BigDecimal productionRatio = BigDecimal.ZERO.compareTo(BigDecimal.valueOf(stat.getTotalInput())) >= 0?
|
||||
BigDecimal.ZERO: BigDecimal.valueOf(stat.getTotalOutput()).divide(BigDecimal.valueOf(stat.getTotalInput()), 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
}
|
||||
return stat;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Lucky24PersonalStatVo getPersonal(Integer partitionId, Long erbanNo, String date,
|
||||
int pageNo, int pageSize) {
|
||||
Page<Lucky24PersonalStat> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
Long uid = null;
|
||||
if (null != erbanNo){
|
||||
Users u = usersService.getUserByErbanNo(erbanNo);
|
||||
if (null == u || !u.getPartitionId().equals(partitionId)){
|
||||
return new Lucky24PersonalStatVo(new PageResult<>(page));
|
||||
}
|
||||
uid = u.getUid();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new Lucky24PersonalStatVo(new PageResult<>(page));
|
||||
}
|
||||
|
||||
long totalInput = list.stream().mapToLong(Lucky24PersonalStat::getTotalInput).sum();
|
||||
long totalOutput = list.stream().mapToLong(Lucky24PersonalStat::getTotalOutput).sum();
|
||||
BigDecimal totalProductionRatio = BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(totalInput), 4, RoundingMode.HALF_UP);
|
||||
|
||||
// 按大到小排序
|
||||
list.sort(Comparator.comparing(Lucky24PersonalStat::getTotalInput).reversed());
|
||||
int startIndex = (pageNo -1) * pageSize;
|
||||
int endIndex = Math.min(startIndex + pageSize, list.size());
|
||||
|
||||
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);
|
||||
for (Lucky24PersonalStat stat: subList) {
|
||||
Users u = usersMap.get(stat.getUid());
|
||||
if (null != u){
|
||||
stat.setErbanNo(u.getErbanNo());
|
||||
}
|
||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
BigDecimal production = inPut.subtract(outPut);
|
||||
stat.setProduction(production.longValue());
|
||||
}
|
||||
|
||||
page.setRecords(subList);
|
||||
page.setTotal(list.size());
|
||||
|
||||
return new Lucky24PersonalStatVo(totalInput, totalOutput, totalProductionRatio, new PageResult<>(page));
|
||||
}
|
||||
|
||||
String startDate = minStartDate;
|
||||
String endDate = DateTimeUtil.getZonedTodayStr(partitionInfo.getZoneId());
|
||||
|
||||
List<String> dateStrList = DateTimeUtil.getDateListBetweenTwoDates(startDate, endDate, endDate);
|
||||
Map<String, Lucky24PersonalStat> statMap = new HashMap<>(dateStrList.size());
|
||||
|
||||
CountDownLatch cdl = new CountDownLatch(2);
|
||||
|
||||
Long finalUid = uid;
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
List<Lucky24PersonalStat> list = listPersonal(partitionId, partitionInfo.getZoneId(), finalUid, zonedDateStr);
|
||||
for (Lucky24PersonalStat stat: list) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
|
||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
BigDecimal production = inPut.subtract(outPut);
|
||||
stat.setProduction(production.longValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPersonal] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
bizExecutor.execute(()->{
|
||||
try {
|
||||
String historyStartDate = dateStrList.get(0);
|
||||
String historyEndDate = dateStrList.get(dateStrList.size() - 1);
|
||||
List<Lucky24PersonalStat> statList = statMapper.listPersonalStat(partitionId, finalUid, historyStartDate, historyEndDate);
|
||||
if (!CollectionUtils.isEmpty(statList)) {
|
||||
for (Lucky24PersonalStat stat: statList) {
|
||||
statMap.put(stat.getDate(), stat);
|
||||
|
||||
BigDecimal outPut = BigDecimal.valueOf(stat.getTotalOutput());
|
||||
BigDecimal inPut = BigDecimal.valueOf(stat.getTotalInput());
|
||||
BigDecimal productionRatio = outPut.divide(inPut, 4, RoundingMode.HALF_UP);
|
||||
stat.setProductionRatio(productionRatio);
|
||||
BigDecimal production = inPut.subtract(outPut);
|
||||
stat.setProduction(production.longValue());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[listPersonal] {}", e.getMessage());
|
||||
} finally {
|
||||
cdl.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
cdl.await();
|
||||
|
||||
long totalInput = statMap.values().stream().mapToLong(Lucky24PersonalStat::getTotalInput).sum();
|
||||
long totalOutput = statMap.values().stream().mapToLong(Lucky24PersonalStat::getTotalOutput).sum();
|
||||
BigDecimal totalProductionRatio = totalInput>0L?BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(totalInput), 4, RoundingMode.HALF_UP):BigDecimal.ZERO;
|
||||
|
||||
dateStrList.add(endDate);
|
||||
dateStrList.sort(Comparator.reverseOrder());
|
||||
|
||||
// 按大到小排序
|
||||
int startIndex = (pageNo -1) * pageSize;
|
||||
int endIndex = Math.min(startIndex + pageSize, dateStrList.size());
|
||||
page.setTotal(dateStrList.size());
|
||||
|
||||
List<String> subDateStrList = dateStrList.subList(startIndex, endIndex);
|
||||
page.setRecords(subDateStrList.parallelStream().map(dateStr->{
|
||||
Lucky24PersonalStat stat = statMap.get(dateStr);
|
||||
if (null == stat) {
|
||||
stat = new Lucky24PersonalStat(dateStr, partitionId, finalUid, erbanNo);
|
||||
} else {
|
||||
stat.setErbanNo(erbanNo);
|
||||
}
|
||||
return stat;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
return new Lucky24PersonalStatVo(totalInput, totalOutput, totalProductionRatio, new PageResult<>(page));
|
||||
}
|
||||
|
||||
private List<Lucky24PersonalStat> listPersonal(int partitionId, String zonedId, Long uid, String date) {
|
||||
ZoneId zoneId = ZoneId.of(zonedId);
|
||||
Date startTime = DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedStartTime = startTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemStartTime = Date.from(zonedStartTime.withZoneSameLocal(zoneId).toInstant());
|
||||
long zoneIdHour = Duration.between(systemStartTime.toInstant(), startTime.toInstant()).toHours();
|
||||
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);
|
||||
}
|
||||
|
||||
public Page<Lucky24RecordAdminVo> pageRecord(Long uid, String date, int pageNo, int pageSize) {
|
||||
Users u = usersService.getNotNullUsersByUid(uid);
|
||||
PartitionEnum partitionEnum = PartitionEnum.getByPartitionId(u.getPartitionId());
|
||||
|
||||
ZoneId zoneId = ZoneId.of(partitionEnum.getZoneId());
|
||||
Date startTime = DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.convertStrToDate(date, DateTimeUtil.DEFAULT_DATE_PATTERN));
|
||||
ZonedDateTime zonedStartTime = startTime.toInstant().atZone(ZoneId.systemDefault());
|
||||
Date systemStartTime = Date.from(zonedStartTime.withZoneSameLocal(zoneId).toInstant());
|
||||
long zoneIdHour = Duration.between(systemStartTime.toInstant(), startTime.toInstant()).toHours();
|
||||
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());
|
||||
|
||||
Page<Lucky24RecordAdminVo> voPage = new Page<>(pageNo, pageSize);
|
||||
Page<Lucky24Record> poPage = new Page<>(pageNo, pageSize);
|
||||
recordMapper.selectPage(poPage, Wrappers.<Lucky24Record>lambdaQuery()
|
||||
.eq(Lucky24Record::getUid, uid)
|
||||
.between(Lucky24Record::getCreateTime, systemStartTime, systemEndTime));
|
||||
|
||||
if (CollectionUtils.isEmpty(poPage.getRecords())){
|
||||
return voPage;
|
||||
}
|
||||
|
||||
Set<Long> uidSet = poPage.getRecords().stream().map(Lucky24Record::getReceiverUid).collect(Collectors.toSet());
|
||||
uidSet.addAll(poPage.getRecords().stream().map(Lucky24Record::getRoomUid).filter(Objects::nonNull).collect(Collectors.toSet()));
|
||||
uidSet.add(uid);
|
||||
|
||||
Map<Long, Users> usersMap = usersService.getUsersMapByUids(new ArrayList<>(uidSet));
|
||||
|
||||
Map<Integer, Gift> giftMap = giftService.getGiftMapByIdsFromDb(poPage.getRecords().stream()
|
||||
.map(Lucky24Record::getGiftId).distinct().collect(Collectors.toList()));
|
||||
|
||||
List<Integer> poolIdList = poPage.getRecords().stream().map(Lucky24Record::getPoolId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
Map<Integer, Lucky24Pool> poolMap = !CollectionUtils.isEmpty(poolIdList)?
|
||||
poolMapper.selectByIds(poolIdList).stream().collect(Collectors.toMap(Lucky24Pool::getId, pool->pool)):
|
||||
Collections.emptyMap();
|
||||
|
||||
List<Lucky24RecordAdminVo> voList = poPage.getRecords().stream().map(record->{
|
||||
Lucky24RecordAdminVo vo = new Lucky24RecordAdminVo();
|
||||
BeanUtils.copyProperties(record, vo);
|
||||
vo.setPartitionDesc(partitionEnum.getDesc());
|
||||
|
||||
Users user = usersMap.get(record.getUid());
|
||||
if (null != user) {
|
||||
vo.setErbanNo(user.getErbanNo());
|
||||
vo.setNick(user.getNick());
|
||||
}
|
||||
|
||||
Users receiverUser = usersMap.get(record.getReceiverUid());
|
||||
if (null != receiverUser){
|
||||
vo.setReceiverErbanNo(receiverUser.getErbanNo());
|
||||
vo.setReceiverNick(receiverUser.getNick());
|
||||
}
|
||||
|
||||
if (null != record.getRoomUid()){
|
||||
Users roomOwner = usersMap.get(record.getRoomUid());
|
||||
if (null != roomOwner) {
|
||||
vo.setRoomErbanNo(roomOwner.getErbanNo());
|
||||
}
|
||||
}
|
||||
|
||||
Gift gift = giftMap.get(record.getGiftId());
|
||||
if (null != gift){
|
||||
vo.setGiftName(gift.getGiftName());
|
||||
}
|
||||
|
||||
vo.setInput(record.getGiftGoldPrice() * record.getGiftNum());
|
||||
|
||||
if (null != record.getPoolId()){
|
||||
Lucky24Pool pool = poolMap.get(record.getPoolId());
|
||||
if (null != pool){
|
||||
vo.setExpect(pool.getExpect());
|
||||
}
|
||||
}
|
||||
|
||||
vo.setCreateTime(DateTimeUtil.convertDate(DateTimeUtil.addHours(record.getCreateTime(), (int) zoneIdHour), DateTimeUtil.DEFAULT_DATETIME_PATTERN));
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
voPage.setRecords(voList);
|
||||
voPage.setTotal(poPage.getTotal());
|
||||
|
||||
return voPage;
|
||||
}
|
||||
}
|
@@ -1,11 +1,8 @@
|
||||
package com.accompany.admin.controller.lucky;
|
||||
|
||||
import com.accompany.admin.service.lucky.BravoPoolAdminService;
|
||||
import com.accompany.admin.service.lucky.Lucky24PoolAdminService;
|
||||
import com.accompany.admin.vo.luckybag.BravoPersonalStatVo;
|
||||
import com.accompany.admin.vo.luckybag.BravoPlatformStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PersonalStatVo;
|
||||
import com.accompany.admin.vo.luckybag.Lucky24PlatformStatVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
|
@@ -1,11 +1,17 @@
|
||||
package com.accompany.admin.controller.lucky;
|
||||
|
||||
import com.accompany.admin.service.lucky.Lucky24PoolAdminService;
|
||||
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;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -16,13 +22,19 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
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
|
||||
@RequestMapping("/admin/lucky24/record")
|
||||
public class Lucky24RecordAdminController {
|
||||
|
||||
@Autowired
|
||||
private Lucky24PoolAdminService service;
|
||||
private Lucky24RecordAdminService service;
|
||||
|
||||
@ApiOperation("平台数据")
|
||||
@ApiImplicitParams({
|
||||
@@ -55,4 +67,41 @@ public class Lucky24RecordAdminController {
|
||||
return BusiResult.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("个人数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(value = "uid", name = "用户UID"),
|
||||
@ApiImplicitParam(value = "date", name = "开始时间", required = true),
|
||||
@ApiImplicitParam(value = "pageNo", name = "页号", required = true),
|
||||
@ApiImplicitParam(value = "pageSize", name = "页长", required = true),
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public BusiResult<PageResult<Lucky24RecordAdminVo>> pageRecord(Long uid, String date,
|
||||
int pageNo, int pageSize) {
|
||||
if (!StringUtils.hasText(date)) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
Page<Lucky24RecordAdminVo> page = service.pageRecord(uid, date, pageNo, pageSize);
|
||||
return BusiResult.success(new PageResult<>(page));
|
||||
}
|
||||
|
||||
@ApiOperation("导出")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(value = "uid", name = "用户UID"),
|
||||
@ApiImplicitParam(value = "date", name = "开始时间", required = true),
|
||||
})
|
||||
@GetMapping("/export")
|
||||
public void exportRecord(HttpServletResponse response, Long uid, String date) throws IOException {
|
||||
if (!StringUtils.hasText(date)) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
Page<Lucky24RecordAdminVo> page = service.pageRecord(uid, date, -1, -1);
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String excelName = URLEncoder.encode("幸运24用户明细", StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
|
||||
EasyExcel.write(response.getOutputStream(), Lucky24RecordAdminVo.class).sheet("幸运24用户明细").doWrite(page.getRecords());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user