订单 累计

This commit is contained in:
2025-12-25 18:40:12 +08:00
parent 3b83d210dc
commit 5df01f5192
3 changed files with 9 additions and 43 deletions

View File

@@ -124,20 +124,16 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
break;
case "COST_AMOUNT":
conditionMap.put("COST_AMOUNT", orderInfoService.getOneAs(query().select("IFNULL(sum(pay_amount), 0) as total_amount ").eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getUserId, shopUserInfo.getUserId())
conditionMap.put("COST_AMOUNT", orderInfoService.getOneAs(query()
.select("IFNULL(sum(pay_amount), 0) as total_amount ")
.eq(OrderInfo::getShopId, shopId)
.eq(OrderInfo::getUserId, shopUserInfo.getUserId())
.eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()), BigDecimal.class)
.compareTo(new BigDecimal(item.getValue())) >= 0);
break;
case "RECHARGE_AMOUNT":
conditionMap.put("RECHARGE_AMOUNT", paymentService.getOneAs(query().select("IFNULL(sum(amount), 0) as total_amount ")
.eq(OrderPayment::getShopId, shopId)
.eq(OrderPayment::getSourceType, PayTypeConstants.SourceType.MEMBER_IN)
.eq(OrderPayment::getPayType, PayTypeConstants.PayType.PAY)
.eq(OrderPayment::getSourceId, shopUserInfo.getId())
.eq(OrderPayment::getPayStatus, PayTypeConstants.PayStatus.SUCCESS), BigDecimal.class)
conditionMap.put("RECHARGE_AMOUNT", paymentService.countMemberInAmount(shopId, shopUserInfo.getId())
.compareTo(new BigDecimal(item.getValue())) >= 0);
break;
default:
throw new CzgException("会员开通条件类型错误");
@@ -422,12 +418,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
.eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()), BigDecimal.class)
.compareTo(new BigDecimal(item.getValue())) >= 0;
case "RECHARGE_AMOUNT" ->
paymentService.getOneAs(query().select("IFNULL(sum(amount), 0) as total_amount")
.eq(OrderPayment::getShopId, shopId)
.eq(OrderPayment::getSourceType, PayTypeConstants.SourceType.MEMBER_IN)
.eq(OrderPayment::getPayType, PayTypeConstants.PayType.PAY)
.eq(OrderPayment::getSourceId, shopUser.getId())
.eq(OrderPayment::getPayStatus, PayTypeConstants.PayStatus.SUCCESS), BigDecimal.class)
paymentService.countMemberInAmount(shopId, shopUser.getId())
.compareTo(new BigDecimal(item.getValue())) >= 0;
default -> throw new CzgException("会员开通条件类型错误");
};