Explorar o código

fix 退款数据统计

zoujiajian %!s(int64=3) %!d(string=hai) anos
pai
achega
c837bc14eb

+ 10 - 0
netflix-dao/src/main/java/com/cyksj/model/views/BackgroundDataView.java

@@ -34,6 +34,16 @@ public class BackgroundDataView {
 	 */
 	private BigDecimal totalOrderAmount;
 
+	/**
+	 * 退款单数
+	 */
+	private Integer totalNumOfRefundOrder;
+
+	/**
+	 * 退款金额
+	 */
+	private BigDecimal totalRefundAmount;
+
 	/**
 	 * 近5天将要到期的主账号总数
 	 */

+ 6 - 0
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -153,6 +153,12 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		Optional<BigDecimal> totalMoney = orderDons.stream().map(OrderDon::getMoney).reduce(BigDecimal::add);
 		//总订单金额
 		backgroundDataView.setTotalOrderAmount(totalMoney.isPresent() ? totalMoney.get().divide(BigDecimal.valueOf(100)) : BigDecimal.ZERO);
+		//退款列表
+		List<OrderDon> refundOrders = Optional.ofNullable(orderDonService.list(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getStatus, OrderDon.Status.refund).select(OrderDon::getId, OrderDon::getRefundMoney))).orElse(new ArrayList<>());
+		backgroundDataView.setTotalNumOfRefundOrder(refundOrders.size());
+		//退款金额
+		Optional<BigDecimal> totalRefundAmount = refundOrders.stream().map(OrderDon::getRefundMoney).reduce(BigDecimal::add);
+		backgroundDataView.setTotalRefundAmount(totalRefundAmount.isPresent() ? totalRefundAmount.get().divide(BigDecimal.valueOf(100)) : BigDecimal.ZERO);
 		//近5天将要到期的主账号总数
 		DateTime now = DateTime.now();
 		DateTime zero = DateUtil.beginOfDay(now);