feat:增加钱包统计纬度,正元对接修改
This commit is contained in:
1 parent
de3e27d819
commit
35e0f6fad9
19 files changed
+248
-116
No files matched your search
+12
@@ -39,6 +39,18 @@ public class HardOrderCsVo implements BaseMchInterface, BaseHardInterface {
|
||||
@Schema(description = "总消费次数")
|
||||
private BigDecimal totalPayCount;
|
||||
|
||||
@Schema(description = "总退款金额(元)")
|
||||
private BigDecimal totalRefundPrice;
|
||||
|
||||
@Schema(description = "总退款次数")
|
||||
private BigDecimal totalRefundCount;
|
||||
|
||||
@Schema(description = "总盈利金额(元)")
|
||||
private BigDecimal totalProfitPrice;
|
||||
|
||||
@Schema(description = "总盈利次数")
|
||||
private BigDecimal totalProfitCount;
|
||||
|
||||
/**
|
||||
* 导出相关
|
||||
*/
|
||||
|
||||
+13
-1
@@ -38,7 +38,19 @@ public class HardOrderSbVo implements BaseMchInterface, BaseHardInterface {
|
||||
|
||||
@Schema(description = "总消费次数")
|
||||
private BigDecimal totalPayCount;
|
||||
|
||||
|
||||
@Schema(description = "总退款金额(元)")
|
||||
private BigDecimal totalRefundPrice;
|
||||
|
||||
@Schema(description = "总退款次数")
|
||||
private BigDecimal totalRefundCount;
|
||||
|
||||
@Schema(description = "总盈利金额(元)")
|
||||
private BigDecimal totalProfitPrice;
|
||||
|
||||
@Schema(description = "总盈利次数")
|
||||
private BigDecimal totalProfitCount;
|
||||
|
||||
/**
|
||||
* 导出相关
|
||||
*/
|
||||
|
||||
+78
-19
@@ -13,13 +13,11 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardDeptTotalVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderCsVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderSbVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardZyCardSyncVo;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderTotalService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -53,16 +51,15 @@ public class HardOrderTotalController {
|
||||
|
||||
@PostMapping("/page-list-sb")
|
||||
@Operation(summary = "设备交易记录")
|
||||
public R<Page<HardOrderSbVo>> pageListSb(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return R.ok(HardOrderTotalService.pageListSb(page, dto));
|
||||
public R<List<HardOrderSbVo>> pageListSb(@RequestBody HardOrderDto dto) {
|
||||
return R.ok(HardOrderTotalService.listSb(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/page-list-cs")
|
||||
@Operation(summary = "商户交易记录")
|
||||
public R<Page<HardOrderCsVo>> pageListCs(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
public R<List<HardOrderCsVo>> pageListCs(@RequestBody HardOrderDto dto) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return R.ok(HardOrderTotalService.pageListCs(page, dto));
|
||||
return R.ok(HardOrderTotalService.listCs(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/page-list-dept")
|
||||
@@ -88,8 +85,15 @@ public class HardOrderTotalController {
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getPayTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
BigDecimal countTotal = BigDecimal.ZERO;
|
||||
// 总消费
|
||||
BigDecimal totalPayPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalPayCount = BigDecimal.ZERO;
|
||||
// 总退款
|
||||
BigDecimal totalRefundPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalRefundCount = BigDecimal.ZERO;
|
||||
// 总盈利
|
||||
BigDecimal totalProfitPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalProfitCount = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
for (HardOrderSbVo v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
@@ -97,16 +101,40 @@ public class HardOrderTotalController {
|
||||
if (ObjectUtil.isNotEmpty(v.getHardType())) {
|
||||
v.setHardType(HardTypeEnum.valueOfByType(v.getHardType()).getDescription());
|
||||
}
|
||||
// 总消费
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayPrice())) {
|
||||
priceTotal = priceTotal.add(v.getTotalPayPrice());
|
||||
totalPayPrice = totalPayPrice.add(v.getTotalPayPrice());
|
||||
v.setTotalPayPrice(v.getTotalPayPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayCount())) {
|
||||
countTotal = countTotal.add(v.getTotalPayCount());
|
||||
totalPayCount = totalPayCount.add(v.getTotalPayCount());
|
||||
}
|
||||
// 总退款
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundPrice())) {
|
||||
totalRefundPrice = totalRefundPrice.add(v.getTotalRefundPrice());
|
||||
v.setTotalRefundPrice(v.getTotalRefundPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundCount())) {
|
||||
totalRefundCount = totalRefundCount.add(v.getTotalRefundCount());
|
||||
}
|
||||
// 总盈利
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitPrice())) {
|
||||
totalProfitPrice = totalProfitPrice.add(v.getTotalProfitPrice());
|
||||
v.setTotalProfitPrice(v.getTotalProfitPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitCount())) {
|
||||
totalProfitCount = totalProfitCount.add(v.getTotalProfitCount());
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", countTotal.toString());
|
||||
// 总消费
|
||||
map.put("computeTotalPayPrice", totalPayPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", totalPayCount.toString());
|
||||
// 总退款
|
||||
map.put("computeTotalRefundPrice", totalRefundPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalRefundCount", totalRefundCount.toString());
|
||||
// 总盈利
|
||||
map.put("computeTotalProfitPrice", totalProfitPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalProfitCount", totalProfitCount.toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
@@ -131,8 +159,15 @@ public class HardOrderTotalController {
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getPayTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
BigDecimal countTotal = BigDecimal.ZERO;
|
||||
// 总消费
|
||||
BigDecimal totalPayPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalPayCount = BigDecimal.ZERO;
|
||||
// 总退款
|
||||
BigDecimal totalRefundPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalRefundCount = BigDecimal.ZERO;
|
||||
// 总盈利
|
||||
BigDecimal totalProfitPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalProfitCount = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
for (HardOrderCsVo v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
@@ -140,16 +175,40 @@ public class HardOrderTotalController {
|
||||
if (ObjectUtil.isNotEmpty(v.getHardType())) {
|
||||
v.setHardType(HardTypeEnum.valueOfByType(v.getHardType()).getDescription());
|
||||
}
|
||||
// 总消费
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayPrice())) {
|
||||
priceTotal = priceTotal.add(v.getTotalPayPrice());
|
||||
totalPayPrice = totalPayPrice.add(v.getTotalPayPrice());
|
||||
v.setTotalPayPrice(v.getTotalPayPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayCount())) {
|
||||
countTotal = countTotal.add(v.getTotalPayCount());
|
||||
totalPayCount = totalPayCount.add(v.getTotalPayCount());
|
||||
}
|
||||
// 总退款
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundPrice())) {
|
||||
totalRefundPrice = totalRefundPrice.add(v.getTotalRefundPrice());
|
||||
v.setTotalRefundPrice(v.getTotalRefundPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundCount())) {
|
||||
totalRefundCount = totalRefundCount.add(v.getTotalRefundCount());
|
||||
}
|
||||
// 总盈利
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitPrice())) {
|
||||
totalProfitPrice = totalProfitPrice.add(v.getTotalProfitPrice());
|
||||
v.setTotalProfitPrice(v.getTotalProfitPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitCount())) {
|
||||
totalProfitCount = totalProfitCount.add(v.getTotalProfitCount());
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", countTotal.toString());
|
||||
// 总消费
|
||||
map.put("computeTotalPayPrice", totalPayPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", totalPayCount.toString());
|
||||
// 总退款
|
||||
map.put("computeTotalRefundPrice", totalRefundPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalRefundCount", totalRefundCount.toString());
|
||||
// 总盈利
|
||||
map.put("computeTotalProfitPrice", totalProfitPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalProfitCount", totalProfitCount.toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderSumAndCountDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.*;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -86,7 +85,7 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
return selectListByScope(commonWrapper(dto), DataScope.of());
|
||||
}
|
||||
|
||||
Page<HardOrderSbVo> pageListSb(Page page, @Param("dto") HardOrderDto dto);
|
||||
Page<HardOrderSbVo> listSb(Page page, @Param("dto") HardOrderDto dto);
|
||||
|
||||
List<HardOrderSbVo> listSb(@Param("dto") HardOrderDto dto);
|
||||
|
||||
|
||||
-4
@@ -12,12 +12,8 @@ import java.util.List;
|
||||
|
||||
public interface HardOrderTotalService {
|
||||
|
||||
Page<HardOrderSbVo> pageListSb(Page page, HardOrderDto dto);
|
||||
|
||||
List<HardOrderSbVo> listSb(HardOrderDto dto);
|
||||
|
||||
Page<HardOrderCsVo> pageListCs(Page page, HardOrderDto dto);
|
||||
|
||||
List<HardOrderCsVo> listCs(HardOrderDto dto);
|
||||
|
||||
List<HardDeptTotalVo> pageListDept(HardDeptTotalDto dto);
|
||||
|
||||
+91
-56
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
|
||||
@@ -8,7 +9,6 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
@@ -33,7 +33,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@@ -48,88 +47,124 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
private final RemoteWalletTransactionService remoteWalletTransactionService;
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
|
||||
@Override
|
||||
public Page<HardOrderSbVo> pageListSb(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderSbVo> list = hardOrderMapper.pageListSb(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardOrderSbVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
// 设备
|
||||
List<Long> hardIds = list.getRecords().stream().map(HardOrderSbVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list.getRecords(), CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardOrderSbVo> listSb(HardOrderDto dto) {
|
||||
List<HardOrderSbVo> list = hardOrderMapper.listSb(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 查询总流水
|
||||
CompletableFuture<List<HardOrderSbVo>> totalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
return hardOrderMapper.listSb(totalDto);
|
||||
});
|
||||
// 扣款总流水
|
||||
CompletableFuture<List<HardOrderSbVo>> refundListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto refundDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listSb(refundDto);
|
||||
});
|
||||
// 盈利
|
||||
CompletableFuture<List<HardOrderSbVo>> profitListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardOrderMapper.listSb(profitDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(totalListFuture, refundListFuture, profitListFuture);
|
||||
allFutures.join();
|
||||
List<HardOrderSbVo> totalList = totalListFuture.join();
|
||||
List<HardOrderSbVo> refundList = refundListFuture.join();
|
||||
List<HardOrderSbVo> profitList = profitListFuture.join();
|
||||
// 聚合一下数据
|
||||
for (HardOrderSbVo v : totalList) {
|
||||
// 退款
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getHardId(), v.getHardId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalRefundPrice(i.getTotalPayPrice());
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getHardId(), v.getHardId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
v.setTotalProfitCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(totalList)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.stream().map(HardOrderSbVo::getMerchantId).distinct().toList();
|
||||
List<Long> mchIds = totalList.stream().map(HardOrderSbVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
WalletDataUtil.convertMchList(totalList, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardOrderSbVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
List<Long> hardIds = totalList.stream().map(HardOrderSbVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
HardUtil.convertHardList(totalList, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<HardOrderCsVo> pageListCs(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderCsVo> list = hardOrderMapper.pageListCs(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardOrderCsVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return totalList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardOrderCsVo> listCs(HardOrderDto dto) {
|
||||
List<HardOrderCsVo> list = hardOrderMapper.listCs(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 查询总流水
|
||||
CompletableFuture<List<HardOrderCsVo>> totalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
return hardOrderMapper.listCs(totalDto);
|
||||
});
|
||||
// 扣款总流水
|
||||
CompletableFuture<List<HardOrderCsVo>> refundListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto refundDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listCs(refundDto);
|
||||
});
|
||||
// 盈利
|
||||
CompletableFuture<List<HardOrderCsVo>> profitListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardOrderMapper.listCs(profitDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(totalListFuture, refundListFuture, profitListFuture);
|
||||
allFutures.join();
|
||||
List<HardOrderCsVo> totalList = totalListFuture.join();
|
||||
List<HardOrderCsVo> refundList = refundListFuture.join();
|
||||
List<HardOrderCsVo> profitList = profitListFuture.join();
|
||||
for (HardOrderCsVo v : totalList) {
|
||||
// 退款
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getMerchantId(), v.getMerchantId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalRefundPrice(i.getTotalPayPrice());
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getMerchantId(), v.getMerchantId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
v.setTotalProfitCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
}
|
||||
// 聚合一下数据
|
||||
if (ObjectUtil.isNotEmpty(totalList)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.stream().map(HardOrderCsVo::getMerchantId).distinct().toList();
|
||||
List<Long> mchIds = totalList.stream().map(HardOrderCsVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
WalletDataUtil.convertMchList(totalList, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return totalList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -112,7 +112,7 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="pageListSb" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSbVo">
|
||||
<select id="listSb" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSbVo">
|
||||
select
|
||||
a.hard_id,
|
||||
a.merchant_id,
|
||||
|
||||
Reference in new issue
Block a user