|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.hfkj.service.order.impl; |
|
|
|
package com.hfkj.service.order.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.hfkj.common.exception.BaseException; |
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
@ -228,11 +229,14 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
)); |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral()); |
|
|
|
childOrder.setCouponDiscountPrice( |
|
|
|
childOrder.setCouponDiscountPrice( |
|
|
|
|
|
|
|
// 可退款金额大于0 可退款金额+可退款积分=优惠券优惠
|
|
|
|
childOrder.getSurplusRefundPrice().compareTo(BigDecimal.ZERO) == 1 |
|
|
|
childOrder.getSurplusRefundPrice().compareTo(BigDecimal.ZERO) == 1 |
|
|
|
? childOrder.getProductTotalPrice().subtract(childOrder.getSurplusRefundPrice()) |
|
|
|
? childOrder.getProductTotalPrice().subtract( |
|
|
|
|
|
|
|
childOrder.getSurplusRefundPrice().add(new BigDecimal(childOrder.getSurplusRefundIntegral().toString()).divide(new BigDecimal("100")))) |
|
|
|
: childOrder.getSurplusRefundPrice()); |
|
|
|
: childOrder.getSurplusRefundPrice()); |
|
|
|
childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral()); |
|
|
|
|
|
|
|
childOrder.setTotalDeductionPrice( |
|
|
|
childOrder.setTotalDeductionPrice( |
|
|
|
childOrder.getCouponDiscountPrice() |
|
|
|
childOrder.getCouponDiscountPrice() |
|
|
|
.add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100"))) |
|
|
|
.add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100"))) |
|
|
@ -307,12 +311,12 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
deduction.setCouponDiscountPrice(discount.getPrice()); |
|
|
|
deduction.setCouponDiscountPrice(discount.getPrice()); |
|
|
|
// 卡卷类型 1:满减 2:抵扣 3:折扣
|
|
|
|
// 卡卷类型 1:满减 2:抵扣 3:折扣
|
|
|
|
if (1 == discount.getType()) { |
|
|
|
if (1 == discount.getType()) { |
|
|
|
deduction.setCouponDiscountActualPrice(discount.getPrice()); |
|
|
|
|
|
|
|
} else if (2 == discount.getType()) { |
|
|
|
|
|
|
|
if (discount.getCondition().compareTo(order.getProductTotalPrice()) < 0) { |
|
|
|
if (discount.getCondition().compareTo(order.getProductTotalPrice()) < 0) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未满足优惠券满减条件"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未满足优惠券满减条件"); |
|
|
|
} |
|
|
|
} |
|
|
|
deduction.setCouponDiscountActualPrice(discount.getPrice()); |
|
|
|
deduction.setCouponDiscountActualPrice(discount.getPrice()); |
|
|
|
|
|
|
|
} else if (2 == discount.getType()) { |
|
|
|
|
|
|
|
deduction.setCouponDiscountActualPrice(discount.getPrice()); |
|
|
|
} else if (3 == discount.getType()) { |
|
|
|
} else if (3 == discount.getType()) { |
|
|
|
deduction.setCouponDiscountPrice(discount.getPercentage()); |
|
|
|
deduction.setCouponDiscountPrice(discount.getPercentage()); |
|
|
|
deduction.setCouponDiscountActualPrice( |
|
|
|
deduction.setCouponDiscountActualPrice( |
|
|
@ -326,6 +330,8 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
deduction.setTotalDeductionPrice(deduction.getCouponDiscountActualPrice() |
|
|
|
deduction.setTotalDeductionPrice(deduction.getCouponDiscountActualPrice() |
|
|
|
.add(new BigDecimal(deduction.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100")))); |
|
|
|
.add(new BigDecimal(deduction.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100")))); |
|
|
|
orderDeductionService.editData(deduction); |
|
|
|
orderDeductionService.editData(deduction); |
|
|
|
|
|
|
|
} catch (BaseException e) { |
|
|
|
|
|
|
|
throw e; |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券使用异常"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券使用异常"); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|