|
|
@@ -444,11 +444,13 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
|
|
|
try {
|
|
|
// 赠送好友数量:从 LifeDiscountCoupon 查店铺优惠券 id,再按优惠券 id 查 LifeDiscountCouponStoreFriend 记录数
|
|
|
+
|
|
|
List<LifeDiscountCouponStoreFriend> giveToFriendRecords = queryGiveToFriendRecordsByStore(storeId, endDate);
|
|
|
long giveToFriendCount = giveToFriendRecords.size();
|
|
|
result.put("giveToFriendCount", giveToFriendCount);
|
|
|
|
|
|
// 赠送好友金额合计:用 LifeDiscountCouponStoreFriend 的券 id 和数量(singleQty),从 LifeDiscountCoupon 取面值,计算面值金额合计
|
|
|
+
|
|
|
BigDecimal giveToFriendAmount = giveToFriendRecords.stream()
|
|
|
.map(record -> {
|
|
|
LifeDiscountCoupon coupon = lifeDiscountCouponMapper.selectById(record.getCouponId());
|
|
|
@@ -457,6 +459,7 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
return faceValue.multiply(BigDecimal.valueOf(qty));
|
|
|
})
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
result.put("giveToFriendAmount", giveToFriendAmount);
|
|
|
|
|
|
// 赠送好友使用数/使用金额:从 life_discount_coupon_user 统计
|