111
This commit is contained in:
1 parent
cc19707f29
commit
642c616d23
2 files changed
+21
-19
No files matched your search
-7
@@ -255,13 +255,6 @@ public class WalletTransactionController {
|
||||
DataScope dataScope = null;
|
||||
Long count = walletTransactionMapper.count(dto, dataScope);
|
||||
if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围");
|
||||
|
||||
try {
|
||||
ThreadUtil.sleep(10000, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
walletTransactionService.exportByTemplate(response, dto, count, "file/个人充值明细.xlsx", dataScope);
|
||||
}
|
||||
|
||||
|
||||
+21
-12
@@ -67,6 +67,9 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
/**
|
||||
* 会员钱包流水表
|
||||
*
|
||||
@@ -333,7 +336,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
map.put("startTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN));
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
long pageSize = 1000;
|
||||
long pageSize = 2000;
|
||||
long finalTotal = (total == null || total == 0) ? 0 : total;
|
||||
int pages = (int) ((finalTotal + pageSize - 1) / pageSize);
|
||||
if (pages == 0) pages = 1;
|
||||
@@ -343,21 +346,27 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
for (int i = 1; i <= pages; i++) {
|
||||
long currentPage = i;
|
||||
futures.add(CompletableFuture.supplyAsync(() -> {
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
Page<WalletTransactionVo> pageList = scopePageList(new Page<>(currentPage, pageSize), dto, dataScope);
|
||||
if (ObjectUtil.isEmpty(pageList) || ObjectUtil.isEmpty(pageList.getRecords())) {
|
||||
return new ArrayList<>();
|
||||
if (requestAttributes != null) {
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
}
|
||||
List<WalletTransactionVo> list = pageList.getRecords();
|
||||
for (WalletTransactionVo v : list) {
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
try {
|
||||
Page<WalletTransactionVo> pageList = scopePageList(new Page<>(currentPage, pageSize), dto, dataScope);
|
||||
if (ObjectUtil.isEmpty(pageList) || ObjectUtil.isEmpty(pageList.getRecords())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getBizType())) {
|
||||
v.setBizType(WalletBizEnum.valueOfByType(v.getBizType()).getDesc());
|
||||
List<WalletTransactionVo> list = pageList.getRecords();
|
||||
for (WalletTransactionVo v : list) {
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getBizType())) {
|
||||
v.setBizType(WalletBizEnum.valueOfByType(v.getBizType()).getDesc());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} finally {
|
||||
RequestContextHolder.resetRequestAttributes();
|
||||
}
|
||||
return list;
|
||||
}, executor));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user