Просмотр исходного кода

fix 实物订单来源单数金额

zoujiajian 2 лет назад
Родитель
Сommit
add413b7a1

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/views/RealGoodsSourceData.java

@@ -14,5 +14,7 @@ import java.math.BigDecimal;
 public class RealGoodsSourceData {
 	private String labelSource;
 
+	private Integer orders;
+
 	private BigDecimal orderMoney;
 }

+ 3 - 1
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -397,7 +397,9 @@
     </select>
 
     <select id="getRealGoodsSourceData" resultType="com.cyksj.model.views.RealGoodsSourceData">
-        select label_source, sum(money) as orderMoney
+        select label_source,
+               count(*) as orders,
+               sum(money) as orderMoney
         from order_don
         where goods_id = 15
         and status not in ('close', 'noPayment', 'refund')

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -545,10 +545,11 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		Map<String, List<RealGoodsSourceData>> collect = realGoodsSourceDataList.stream().collect(Collectors.groupingBy(RealGoodsSourceData::getLabelSource));
 		OrderDon.LabelSource[] values = OrderDon.LabelSource.values();
 		BigDecimal zero = BigDecimal.ZERO;
+		Integer orders = 0;
 		RealGoodsSourceData realGoodsSourceData = null;
 		for (OrderDon.LabelSource sysSource : values) {
 			if (collect.get(sysSource.name()) == null) {
-				realGoodsSourceData = new RealGoodsSourceData(sysSource.name(), zero);
+				realGoodsSourceData = new RealGoodsSourceData(sysSource.name(), orders, zero);
 				realGoodsSourceDataList.add(realGoodsSourceData);
 			}
 		}