|
@@ -279,16 +279,7 @@ public class SettlementManageBillServiceImpl extends ServiceImpl<SettlementManag
|
|
// 3. 支付方式统计
|
|
// 3. 支付方式统计
|
|
calculateClothPayTypeAmounts(orderList, stats);
|
|
calculateClothPayTypeAmounts(orderList, stats);
|
|
// 4. 退款方式统计
|
|
// 4. 退款方式统计
|
|
- Map<String, BigDecimal> refundTypeAmounts = calculateClothRefundTypeAmounts(refundList);
|
|
|
|
- stats.setWechatRefundAmount(refundTypeAmounts.getOrDefault("0", BigDecimal.ZERO)); // 微信
|
|
|
|
- stats.setAlipayRefundAmount(refundTypeAmounts.getOrDefault("1", BigDecimal.ZERO)); // 支付宝
|
|
|
|
- stats.setCashRefundAmount(refundTypeAmounts.getOrDefault("2", BigDecimal.ZERO)); // 现金
|
|
|
|
- stats.setMemberRefundAmount(refundTypeAmounts.getOrDefault("3", BigDecimal.ZERO)); // 余额
|
|
|
|
- stats.setUnionRefundAmount(refundTypeAmounts.getOrDefault("4", BigDecimal.ZERO)); // 银联
|
|
|
|
- //循环获取总金额
|
|
|
|
- refundTypeAmounts.keySet().forEach(key -> {
|
|
|
|
- stats.setTransactionRefundAmount(stats.getTransactionRefundAmount().add(refundTypeAmounts.get(key)));
|
|
|
|
- });
|
|
|
|
|
|
+ calculateClothRefundTypeAmounts(refundList, stats);
|
|
|
|
|
|
// 5. 退款统计
|
|
// 5. 退款统计
|
|
Map<String, BigDecimal> refundAmounts = calculateClothRefundAmounts(refundList);
|
|
Map<String, BigDecimal> refundAmounts = calculateClothRefundAmounts(refundList);
|
|
@@ -409,20 +400,31 @@ public class SettlementManageBillServiceImpl extends ServiceImpl<SettlementManag
|
|
/**
|
|
/**
|
|
* 计算洗衣订单支付方式金额
|
|
* 计算洗衣订单支付方式金额
|
|
*/
|
|
*/
|
|
- private Map<String, BigDecimal> calculateClothRefundTypeAmounts(List<OrderClothRefund> orderList) {
|
|
|
|
- if (orderList == null || orderList.size() == 0) {
|
|
|
|
- return new HashMap<>();
|
|
|
|
|
|
+ private void calculateClothRefundTypeAmounts(List<OrderClothRefund> orderList, OrderStatisticsVO stats) {
|
|
|
|
+
|
|
|
|
+ BigDecimal wxPayAmount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal alipayAmount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal cashAmount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal memberAmount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal unionAmount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal transactionAmount = BigDecimal.ZERO;
|
|
|
|
+ for (OrderClothRefund order : orderList) {
|
|
|
|
+ if (OrderRefundStatus.REFUND_SUCCESS.getCode().equals(order.getRefundStatus())) {
|
|
|
|
+ wxPayAmount = CurrencyUtil.add(wxPayAmount, order.getWxRefundAmount());
|
|
|
|
+ alipayAmount = CurrencyUtil.add(alipayAmount, order.getAliRefundAmount());
|
|
|
|
+ cashAmount = CurrencyUtil.add(cashAmount, order.getCashRefundAmount());
|
|
|
|
+ memberAmount = CurrencyUtil.add(memberAmount, order.getMemberRefundAmount());
|
|
|
|
+ transactionAmount = CurrencyUtil.add(transactionAmount, order.getRefundAmount());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return orderList.stream()
|
|
|
|
- .filter(order -> OrderRefundStatus.REFUND_SUCCESS.getCode().equals(order.getRefundStatus()))
|
|
|
|
- .collect(Collectors.groupingBy(
|
|
|
|
- OrderClothRefund::getPayType,
|
|
|
|
- Collectors.reducing(
|
|
|
|
- BigDecimal.ZERO,
|
|
|
|
- OrderClothRefund::getRefundAmount,
|
|
|
|
- BigDecimal::add
|
|
|
|
- )
|
|
|
|
- ));
|
|
|
|
|
|
+
|
|
|
|
+ stats.setWechatRefundAmount(wxPayAmount); // 微信
|
|
|
|
+ stats.setAlipayRefundAmount(alipayAmount); // 支付宝
|
|
|
|
+ stats.setCashRefundAmount(cashAmount); // 现金
|
|
|
|
+ stats.setMemberRefundAmount(memberAmount); // 余额
|
|
|
|
+ stats.setUnionRefundAmount(unionAmount); // 银联
|
|
|
|
+ stats.setTransactionRefundAmount(transactionAmount);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|