diff --git a/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/vo/order/HardDeptTotalVo.java b/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/vo/order/HardDeptTotalVo.java index 2c9f88ec6..1337eca32 100644 --- a/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/vo/order/HardDeptTotalVo.java +++ b/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/vo/order/HardDeptTotalVo.java @@ -48,6 +48,12 @@ public class HardDeptTotalVo { @Schema(description = "退款次数") private Long orderRefundCont = 0L; + @Schema(description = "盈利金额") + private Long orderProfitPrice = 0L; + + @Schema(description = "盈利次数") + private Long orderProfitCont = 0L; + /** * 导出相关 */ diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardOrderTotalController.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardOrderTotalController.java index 13a25897f..84af93c8a 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardOrderTotalController.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardOrderTotalController.java @@ -246,8 +246,12 @@ public class HardOrderTotalController { BigDecimal orderPayPriceSum = BigDecimal.ZERO; BigDecimal orderPayCountSum = BigDecimal.ZERO; + BigDecimal orderRefundPriceSum = BigDecimal.ZERO; BigDecimal orderRefundContSum = BigDecimal.ZERO; + // 盈利 + BigDecimal orderProfitPriceSum = BigDecimal.ZERO; + BigDecimal orderProfitContSum = BigDecimal.ZERO; Long lineNumber = 1L; for (HardDeptTotalVo v : list) { @@ -305,6 +309,14 @@ public class HardOrderTotalController { orderRefundContSum = orderRefundContSum.add(BigDecimal.valueOf(v.getOrderRefundCont())); v.setOrderRefundCont(BigDecimal.valueOf(v.getOrderRefundCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue()); } + if (ObjectUtil.isNotEmpty(v.getOrderProfitPrice())) { + orderProfitPriceSum = orderProfitPriceSum.add(BigDecimal.valueOf(v.getOrderProfitPrice())); + v.setOrderProfitPrice(BigDecimal.valueOf(v.getOrderProfitPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue()); + } + if (ObjectUtil.isNotEmpty(v.getOrderProfitCont())) { + orderProfitContSum = orderProfitContSum.add(BigDecimal.valueOf(v.getOrderProfitCont())); + v.setOrderProfitCont(BigDecimal.valueOf(v.getOrderProfitCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue()); + } // 批量充值 map.put("walletPriceSum", walletPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); map.put("walletCountSum", walletCountSum.toString()); @@ -320,8 +332,12 @@ public class HardOrderTotalController { map.put("orderPayPriceSum", orderPayPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); map.put("orderPayCountSum", orderPayCountSum.toString()); + map.put("orderRefundPriceSum", orderRefundPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); map.put("orderRefundContSum", orderRefundContSum.toString()); + + map.put("orderProfitPriceSum", orderProfitPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); + map.put("orderProfitContSum", orderProfitContSum.toString()); } } excelWriter.fill(map, writeSheet); diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardOrderTotalServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardOrderTotalServiceImpl.java index ecb2799c2..a139bb132 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardOrderTotalServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardOrderTotalServiceImpl.java @@ -273,7 +273,20 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService { } return hardOrderMapper.sumAndCount(refundDto); }); - CompletableFuture allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture); + // 查看盈利流水 + CompletableFuture> profitFuture = CompletableFuture.supplyAsync(() -> { + HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto(); + refundDto.setDeptIds(deptIds); + refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes()); + if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) { + refundDto.setCreateTimeList(dto.getCreateTimeList()); + } + if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) { + refundDto.setWalletTypeId(dto.getWalletTypeId()); + } + return hardOrderMapper.sumAndCount(refundDto); + }); + CompletableFuture allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture, profitFuture); allFutures.join(); List walletBatchList = walletBatchFuture.join(); List walletReduceList = walletReduceFuture.join(); @@ -281,6 +294,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService { List walletOnceReduceList = walletOnceReduceFuture.join(); List payList = payFuture.join(); List refundList = refundFuture.join(); + List profitList = profitFuture.join(); // 聚合一下数据 for (HardDeptTotalVo v : resultList) { if (ObjectUtil.isNotEmpty(walletBatchList)) { @@ -319,6 +333,13 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService { v.setOrderRefundCont(i.getCount()); }); } + // 查看盈利流水 + if (ObjectUtil.isNotEmpty(profitList)) { + profitList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> { + v.setOrderProfitPrice(i.getSum()); + v.setOrderProfitCont(i.getCount()); + }); + } } return resultList; }); diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/resources/file/部门交易金额汇总.xlsx b/pjcloud-hardware/pjcloud-hardware-biz/src/main/resources/file/部门交易金额汇总.xlsx index 51d149779..26441d9e0 100644 Binary files a/pjcloud-hardware/pjcloud-hardware-biz/src/main/resources/file/部门交易金额汇总.xlsx and b/pjcloud-hardware/pjcloud-hardware-biz/src/main/resources/file/部门交易金额汇总.xlsx differ