|
|
|
@@ -119,7 +119,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "获取payAccount失败"); |
|
|
|
} |
|
|
|
|
|
|
|
// 5. 扣减计算 |
|
|
|
// 4. 扣减计算 |
|
|
|
Integer payment = cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); |
|
|
|
Double dChargeFee = Math.ceil(payment * 1.0D * payAccount.getRate() / 10000); |
|
|
|
Integer real_payment = payment - dChargeFee.intValue(); |
|
|
|
@@ -132,7 +132,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment; |
|
|
|
} |
|
|
|
|
|
|
|
// 6 insert card_spend |
|
|
|
// 5 insert card_spend |
|
|
|
record.setId(idWorker.nextId()); |
|
|
|
record.setPayment(payment); |
|
|
|
record.setRealPayment(real_payment); |
|
|
|
@@ -150,6 +150,19 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 6. update order status |
|
|
|
WxOrder orderUpdate = new WxOrder(); |
|
|
|
orderUpdate.setId(order.getId()); |
|
|
|
orderUpdate.setPaymentTime(curDate); |
|
|
|
orderUpdate.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); |
|
|
|
orderUpdate.setUpdateDate(curDate); |
|
|
|
try { |
|
|
|
wxOrderMapper.updateByPrimaryKeySelective(orderUpdate); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("order update error"); |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "order update 出错!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 7. update card info |
|
|
|
cardInfo.setRemainingAmount(remaingAmount); |
|
|
|
cardInfo.setRemainingShareFeeAmount(remain_real_pament); |
|
|
|
|