| @@ -141,6 +141,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| record.setCardRemainAmount(remaingAmount); | record.setCardRemainAmount(remaingAmount); | ||||
| record.setCardBeforeRealAmount(cardInfo.getRemainingShareFeeAmount()); | record.setCardBeforeRealAmount(cardInfo.getRemainingShareFeeAmount()); | ||||
| record.setCardRemainRealAmount(remain_real_pament); | record.setCardRemainRealAmount(remain_real_pament); | ||||
| record.setPayStatus(EnumCardSpendStatus.NOT_PAY.getCode()); | |||||
| record.setCreateDate(curDate); | record.setCreateDate(curDate); | ||||
| record.setUpdateDate(curDate); | record.setUpdateDate(curDate); | ||||
| try { | try { | ||||
| @@ -316,6 +317,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| WxMerchant merchant = wxMerchantMapper.selectByPrimaryKey(cardSpend.getMerchantId()); | WxMerchant merchant = wxMerchantMapper.selectByPrimaryKey(cardSpend.getMerchantId()); | ||||
| if (cardSpend != null && cardInfo != null && merchant != null) { | if (cardSpend != null && cardInfo != null && merchant != null) { | ||||
| // 分账 | |||||
| WxSharingOrderDto shareOrder = new WxSharingOrderDto(); | WxSharingOrderDto shareOrder = new WxSharingOrderDto(); | ||||
| shareOrder.setcUserId(cardSpend.getOwnerId()); | shareOrder.setcUserId(cardSpend.getOwnerId()); | ||||
| shareOrder.setMerchantId(cardSpend.getMerchantId()); | shareOrder.setMerchantId(cardSpend.getMerchantId()); | ||||
| @@ -332,7 +334,20 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 分账异常 | // 分账异常 | ||||
| throw new MallinkException(resultData.code, resultData.message); | throw new MallinkException(resultData.code, resultData.message); | ||||
| } | } | ||||
| if(cardSpend.getCardRemainAmount().equals(0)) { | |||||
| // 卡消费记录状态更新 | |||||
| { | |||||
| WxCardSpend updateRecord = new WxCardSpend(); | |||||
| updateRecord.setId(cardSpend.getId()); | |||||
| updateRecord.setPayStatus(EnumCardSpendStatus.PS_SHARED.getCode()); | |||||
| updateRecord.setUpdateDate(new Date()); | |||||
| wxCardSpendMapper.updateByPrimaryKeySelective(updateRecord); | |||||
| } | |||||
| if(cardSpend.getCardRemainAmount().equals(0) | |||||
| || psNum == 19) { | |||||
| // 卡余额为0,或者卡已分账20次,发起分账完结 | |||||
| if (cardSpend.getCardRemainRealAmount() > 0) { | if (cardSpend.getCardRemainRealAmount() > 0) { | ||||
| // 卡已被抵扣,但是分账还有余额 | // 卡已被抵扣,但是分账还有余额 | ||||
| cardShareFinished(cardInfo, shareOrder); | cardShareFinished(cardInfo, shareOrder); | ||||