删除优惠卷
新版优惠卷
This commit is contained in:
@@ -56,10 +56,6 @@ public class BuyOrderController {
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private OrderCartService orderCartService;
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
@@ -241,7 +237,7 @@ public class BuyOrderController {
|
||||
totalPrice = totalPrice.add(price.multiply(BigDecimal.valueOf(quantity)));
|
||||
}
|
||||
//商品价格减去优惠券的优惠金额
|
||||
totalPrice = totalPrice.subtract(useCouponAmount(buyOrder));
|
||||
// totalPrice = totalPrice.subtract(0);
|
||||
|
||||
//加上运费金额
|
||||
totalPrice = totalPrice.add(getShoppingAmount(buyOrder));
|
||||
@@ -467,12 +463,6 @@ public class BuyOrderController {
|
||||
if (buyOrder == null) {
|
||||
return R.error("订单不存在");
|
||||
}
|
||||
if (buyOrder.getCouponId() != null) {
|
||||
Integer couponId = buyOrder.getCouponId();
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(couponId);
|
||||
couponHistory.setUseStatus(0);
|
||||
couponHistoryService.updateById(couponHistory);
|
||||
}
|
||||
// 库存回滚
|
||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderProductQueryWrapper.eq("order_id", buyOrder.getOrderId());
|
||||
@@ -519,14 +509,6 @@ public class BuyOrderController {
|
||||
//1. 判断订单状态
|
||||
BuyOrder byId = buyOrderService.getById(orderId);
|
||||
if (byId != null) {
|
||||
//2. 判断当前订单是否存在优惠券 进行 回显
|
||||
Integer couponId = byId.getCouponId();
|
||||
if (couponId != null) {
|
||||
|
||||
CouponHistoryEntity byId1 = couponHistoryService.getById(couponId);
|
||||
byId1.setUseStatus(0);
|
||||
couponHistoryService.updateById(byId1);
|
||||
}
|
||||
// 库存回滚
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", byId.getOrderId()));
|
||||
@@ -832,26 +814,6 @@ public class BuyOrderController {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用优惠券
|
||||
*
|
||||
* @param buyOrder
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal useCouponAmount(BuyOrder buyOrder) {
|
||||
Integer couponId = buyOrder.getCouponId();
|
||||
if (couponId != null&&couponId!=0) {
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(couponId);
|
||||
couponHistory.setUseStatus(1);
|
||||
couponHistory.setUseTime(new Date());
|
||||
couponHistory.setOrderId(Long.valueOf(buyOrder.getOrderId()));
|
||||
couponHistory.setOrderSn(buyOrder.getOrderSn());
|
||||
CouponEntity coupon = couponService.getById(couponHistory.getCouponId());
|
||||
|
||||
return coupon.getCouponAmount();
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user