积分 赠送与扣除
This commit is contained in:
parent
bdecc4542e
commit
e7163f5476
|
|
@ -15,6 +15,7 @@ import com.czg.config.RedisCst;
|
|||
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.order.dto.BigDecimalDTO;
|
||||
import com.czg.order.dto.CheckOrderPay;
|
||||
import com.czg.order.dto.OrderInfoAddDTO;
|
||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||
|
|
@ -31,9 +32,7 @@ import com.czg.order.vo.HistoryOrderVo;
|
|||
import com.czg.order.vo.OrderDetailSmallVO;
|
||||
import com.czg.order.vo.OrderInfoVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.order.dto.BigDecimalDTO;
|
||||
import com.czg.service.order.enums.OrderStatusEnums;
|
||||
import com.czg.service.order.mapper.OrderInfoMapper;
|
||||
import com.czg.utils.AssertUtil;
|
||||
|
|
@ -76,6 +75,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
private RedisService redisService;
|
||||
@Resource
|
||||
private RabbitPublisher rabbitPublisher;
|
||||
@Resource
|
||||
private MemberPointsService pointsService;
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
@DubboReference
|
||||
|
|
@ -235,7 +236,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
if (!orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||
throw new ValidateException("生成支付订单失败,订单不可支付");
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
Long shopId = orderInfo.getShopId();
|
||||
AssertUtil.isNull(shopId, "生成支付订单失败,订单信息异常");
|
||||
PointsBasicSetting pointSetting = pointsBasicService.getById(shopId);
|
||||
if (param.getPointsNum() > 0 && !pointSetting.getEnableDeduction().equals(1)) {
|
||||
throw new ValidateException("生成支付订单失败,该店铺未开启积分抵扣");
|
||||
|
|
@ -477,6 +479,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
upOrderInfo(orderInfo, new BigDecimal(czgCallBackDto.getAmount() / 100L),
|
||||
DateUtil.parseLocalDateTime(czgCallBackDto.getPayTime()), payment.getId(), null);
|
||||
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
|
||||
pointsService.deductPoints(orderInfo.getUserId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo.getId());
|
||||
}
|
||||
pointsService.consumeAwardPoints(orderInfo.getUserId(), orderInfo.getId());
|
||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||
} else if ("memberIn".equals(payment.getPayType()) || "free".equals(payment.getPayType())) {
|
||||
boolean isFree = "free".equals(payment.getPayType());
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ public class PayServiceImpl implements PayService {
|
|||
@Resource
|
||||
private CzgPayService czgPayService;
|
||||
@Resource
|
||||
private MemberPointsService pointsService;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Resource
|
||||
private OrderDetailService orderDetailService;
|
||||
|
|
@ -151,6 +153,10 @@ public class PayServiceImpl implements PayService {
|
|||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||
LocalDateTime.now(), null, PayEnums.CASH_PAY);
|
||||
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
|
||||
pointsService.deductPoints(orderInfo.getUserId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo.getId());
|
||||
}
|
||||
pointsService.consumeAwardPoints(orderInfo.getUserId(), orderInfo.getId());
|
||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue