|
@@ -341,11 +341,11 @@ public class VipCardLogServiceImpl implements IVipCardLogService {
|
|
|
//计算已使用次数
|
|
//计算已使用次数
|
|
|
BigDecimal useSum = BigDecimal.valueOf(carInformation.getTotalNumber() - userMembershipCard.getRemainingNumber());
|
|
BigDecimal useSum = BigDecimal.valueOf(carInformation.getTotalNumber() - userMembershipCard.getRemainingNumber());
|
|
|
|
|
|
|
|
- //计算需要支付的金额
|
|
|
|
|
- BigDecimal userPrice = useSum.multiply(carInformation.getOriginalPrice());
|
|
|
|
|
|
|
+ //计算需要支付的金额 = 原价 / 总次数(四舍五入) * 已使用次数
|
|
|
|
|
+ BigDecimal userPrice = carInformation.getOriginalPrice().divide(BigDecimal.valueOf(carInformation.getTotalNumber()), 2, RoundingMode.HALF_UP).multiply(useSum);
|
|
|
|
|
|
|
|
//实际支付的金额 - 需要支付的金额 = 退款金额
|
|
//实际支付的金额 - 需要支付的金额 = 退款金额
|
|
|
- BigDecimal refundMoner = orderInfo.getMemberPrice().subtract(userPrice);
|
|
|
|
|
|
|
+ BigDecimal refundMoner = orderInfo.getPracticalMoney().subtract(userPrice);
|
|
|
|
|
|
|
|
//判断如果退款金额 不大于0, 则设置退款金额为0
|
|
//判断如果退款金额 不大于0, 则设置退款金额为0
|
|
|
refundMoner = refundMoner.compareTo(BigDecimal.ZERO) > 0 ? refundMoner : BigDecimal.ZERO;
|
|
refundMoner = refundMoner.compareTo(BigDecimal.ZERO) > 0 ? refundMoner : BigDecimal.ZERO;
|
|
@@ -378,6 +378,10 @@ public class VipCardLogServiceImpl implements IVipCardLogService {
|
|
|
vipCardLog.setRefundPrice(refundPrice);
|
|
vipCardLog.setRefundPrice(refundPrice);
|
|
|
orderInfo.setRefundPrice(refundPrice);
|
|
orderInfo.setRefundPrice(refundPrice);
|
|
|
|
|
|
|
|
|
|
+ //使用钱包支付的订单, 不走我微信退款
|
|
|
|
|
+ if (!"weChart".equals(orderInfo.getPaymentType())) {
|
|
|
|
|
+ executeUpdate = true;
|
|
|
|
|
+ }
|
|
|
// executeUpdate=true 时才执行更新操作(包括订单状态、会员卡余额、次卡次数等)
|
|
// executeUpdate=true 时才执行更新操作(包括订单状态、会员卡余额、次卡次数等)
|
|
|
if (executeUpdate) {
|
|
if (executeUpdate) {
|
|
|
if ("vipCard".equals(orderInfo.getPaymentType())) {
|
|
if ("vipCard".equals(orderInfo.getPaymentType())) {
|
|
@@ -425,10 +429,7 @@ public class VipCardLogServiceImpl implements IVipCardLogService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// executeUpdate=false 时只返回计算结果,不更新任何状态
|
|
// executeUpdate=false 时只返回计算结果,不更新任何状态
|
|
|
- if ("weChart".equals(orderInfo.getPaymentType())) {
|
|
|
|
|
- return AjaxResult.success(orderInfo);
|
|
|
|
|
- }
|
|
|
|
|
- return AjaxResult.success("退款金额计算成功!");
|
|
|
|
|
|
|
+ return AjaxResult.success(orderInfo);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|