|
|
|
@ -11,6 +11,8 @@ import com.hfkj.entity.*; |
|
|
|
|
import com.hfkj.model.order.OrderChildModel; |
|
|
|
|
import com.hfkj.model.order.OrderModel; |
|
|
|
|
import com.hfkj.mqtopic.OrderTopic; |
|
|
|
|
import com.hfkj.service.discount.CouponDiscountService; |
|
|
|
|
import com.hfkj.service.discount.CouponDiscountUserRelService; |
|
|
|
|
import com.hfkj.service.order.*; |
|
|
|
|
import com.hfkj.service.user.UserIntegralService; |
|
|
|
|
import com.hfkj.sysenum.UserIntegralRecordOpUserTypeEnum; |
|
|
|
@ -67,6 +69,10 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
private OrderPaySuccessService orderPaySuccessService; |
|
|
|
|
@Resource |
|
|
|
|
private UserIntegralService userIntegralService; |
|
|
|
|
@Resource |
|
|
|
|
private CouponDiscountUserRelService couponDiscountUserRelService; |
|
|
|
|
@Resource |
|
|
|
|
private CouponDiscountService couponDiscountService; |
|
|
|
|
@Override |
|
|
|
|
public BsOrder editData(BsOrder order) { |
|
|
|
|
order.setUpdateTime(new Date()); |
|
|
|
@ -103,8 +109,20 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
deduction.setOrderNo(order.getOrderNo()); |
|
|
|
|
deduction.setIntegralDiscountPrice(deduction.getIntegralDiscountPrice()==null?0L: deduction.getIntegralDiscountPrice()); |
|
|
|
|
if (order.getDeduction().getUserCouponDiscountId() != null) { |
|
|
|
|
// 查询用户优惠券
|
|
|
|
|
CouponDiscountUserRel discountUserRel = couponDiscountUserRelService.getRel(order.getDeduction().getUserCouponDiscountId()); |
|
|
|
|
if (discountUserRel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知优惠券"); |
|
|
|
|
} |
|
|
|
|
if (discountUserRel.getStatus() != 1) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券状态不处于待使用"); |
|
|
|
|
} |
|
|
|
|
// 查询优惠券
|
|
|
|
|
CouponDiscount discount = couponDiscountService.queryDetail(discountUserRel.getDiscountId()); |
|
|
|
|
if (discount == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知优惠券"); |
|
|
|
|
} |
|
|
|
|
// 计算优惠
|
|
|
|
|
CouponDiscount discount = new CouponDiscount(); |
|
|
|
|
deduction.setCouponDiscountId(discount.getId()); |
|
|
|
|
deduction.setCouponDiscountType(discount.getType()); |
|
|
|
|
deduction.setCouponDiscountPrice(discount.getPrice()); |
|
|
|
|