|
|
|
@@ -8,6 +8,7 @@ import com.iformall.domain.dto.WxSharingOrderDto; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.vo.WxCardSpendVo; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.*; |
|
|
|
import com.iformall.service.WxCardSpendService; |
|
|
|
import com.iformall.service.WxProfitSharingOrderService; |
|
|
|
@@ -135,6 +136,14 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 9. 分账 |
|
|
|
try { |
|
|
|
shareForCardPay(record.getTenantId(), record.getCardId(), record.getOrderId(), record.getId()); |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error("分账失败"+ e.getMessage()); |
|
|
|
return new ResultData(e.getErrorCode(), e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
// 7. update card info |
|
|
|
cardInfo.setRemainingAmount(remaingAmount); |
|
|
|
cardInfo.setRemainingShareFeeAmount(remain_real_pament); |
|
|
|
@@ -181,12 +190,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "merchantSubsidy info 插入出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 9. 分账 |
|
|
|
try { |
|
|
|
shareForCardPay(record.getTenantId(), record.getCardId(), record.getOrderId(), record.getId()); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("分账失败"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(record); |
|
|
|
} |
|
|
|
@@ -249,10 +253,11 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
psNum = wxCardSpendMapper.selectCount(cardSpendQ); |
|
|
|
if (psNum >= 20) { |
|
|
|
logger.error("微信分账已超过限制次数-20次"); |
|
|
|
return; |
|
|
|
throw new MallinkException(ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL); |
|
|
|
} |
|
|
|
// 微信分账 |
|
|
|
try { |
|
|
|
@@ -278,7 +283,11 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
shareOrder.setTenantId(tenantId); |
|
|
|
shareOrder.setTransactionId(cardInfo.getTransactionId()); |
|
|
|
shareOrder.setShareAmount(cardSpend.getRealPayment()); |
|
|
|
profitSharingOrderService.createSharingOrder(shareOrder); |
|
|
|
ResultData resultData = profitSharingOrderService.createSharingOrder(shareOrder); |
|
|
|
if(resultData.code != 200) { |
|
|
|
// 分账异常 |
|
|
|
throw new MallinkException(resultData.code, resultData.message); |
|
|
|
} |
|
|
|
if(cardSpend.getCardRemainAmount().equals(0)) { |
|
|
|
if (cardSpend.getCardRemainRealAmount() > 0) { |
|
|
|
// 卡已被抵扣,但是分账还有余额 |
|
|
|
|