Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-03-18 10:19:31 +08:00
4 changed files with 13 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ public class StatisticTask {
@Resource
private ShopOrderStatisticService shopOrderStatisticService;
// @Scheduled(cron = "1/6 * * * * ? ")
@Scheduled(cron = "0 0 9 * * ?")
public void run() {
long start = System.currentTimeMillis();

View File

@@ -1,6 +1,7 @@
package com.czg.order.entity;
import com.alibaba.fastjson2.annotation.JSONField;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
@@ -136,6 +137,7 @@ public class ShopOrderStatistic implements Serializable {
/**
* 新增会员数
*/
@Column(ignore = true)
private Long newMemberCount = 0L;
/**
* 店铺id

View File

@@ -714,7 +714,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
}
}
if (!payType.equals(PayEnums.VIP_PAY)) {
if ((orderInfo.getPayType() != null && orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue()))
|| (payType != null && !payType.equals(PayEnums.VIP_PAY))) {
//下单赠送积分
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
}

View File

@@ -60,8 +60,8 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
// 统计充值记录
Map<Long, BigDecimal> flowMap = shopUserFlowService.list(new QueryWrapper()
.ge(ShopUserFlow::getCreateTime, startOfDay)
.le(ShopUserFlow::getCreateTime, endOfDay)
.ge(ShopUserFlow::getCreateTime, startOfDay.toLocalDateTime())
.le(ShopUserFlow::getCreateTime, endOfDay.toLocalDateTime())
.in(ShopUserFlow::getBizCode, CollUtil.newArrayList("cashIn", "wechatIn", "alipayIn", "awardIn"))).stream()
.collect(Collectors.groupingBy(
ShopUserFlow::getShopId,
@@ -138,13 +138,17 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
// 充值金额
// statistic.setRechargeAmount(BigDecimal.ZERO);
//客单价
statistic.setCustomerUnitPrice(totalAmount.divide(totalCount, 2, RoundingMode.DOWN));
if (totalAmount.compareTo(BigDecimal.ZERO) != 0) {
statistic.setCustomerUnitPrice(totalAmount.divide(totalCount, 2, RoundingMode.DOWN));
}
// 查询台桌数量
long count = shopTableService.count(new QueryWrapper().eq(ShopTable::getShopId, shopId));
//翻台率
statistic.setTableTurnoverRate(totalCount.subtract(BigDecimal.valueOf(count)).divide(BigDecimal.valueOf(count), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100)));
if (count > 0) {
statistic.setTableTurnoverRate(totalCount.subtract(BigDecimal.valueOf(count)).divide(BigDecimal.valueOf(count), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100)));
}
statistic.setUpdateTime(LocalDateTime.now());
BeanUtil.copyProperties(info, statistic);
saveOrUpdate(statistic);