|
|
|
@@ -206,7 +206,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
Integer subsidyFee = subsidyFeeD.intValue(); |
|
|
|
logger.info("补贴额: " + subsidyFee); |
|
|
|
if (cardInfo.getSaleAmount().equals(0) || subsidyFee > 0) { |
|
|
|
// 有补贴时入库 |
|
|
|
// 有补贴时入库, 免费卡消费时, 或者有补贴金额时 |
|
|
|
int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate(), false); |
|
|
|
Integer realSubsidyFee = subsidyFee - iSubChargeFee; |
|
|
|
WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); |
|
|
|
@@ -246,27 +246,31 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
} |
|
|
|
|
|
|
|
if (payAccount.checkShare()) { |
|
|
|
// 9. 分账 |
|
|
|
try { |
|
|
|
shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || |
|
|
|
ErrorCode.PROFIT_SHARING_TIME_EXPIRED.getCode() == e.getErrorCode()) { |
|
|
|
// 分账已到20次限制,后面只记录,不分账 |
|
|
|
// 分账已过期,后面只记录,不分账 |
|
|
|
logger.error("分账已到20次限制,后面只记录,无法分账"); |
|
|
|
try { |
|
|
|
creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); |
|
|
|
} catch (Exception ex) { |
|
|
|
logger.error("分账已到20次限制,记录到结算表失败"); |
|
|
|
// 分账 |
|
|
|
if (cardInfo.isBuyed()) { |
|
|
|
// 9. 只有有价卡才能分账 |
|
|
|
try { |
|
|
|
shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || |
|
|
|
ErrorCode.PROFIT_SHARING_TIME_EXPIRED.getCode() == e.getErrorCode()) { |
|
|
|
// 分账已到20次限制,后面只记录,不分账 |
|
|
|
// 分账已过期,后面只记录,不分账 |
|
|
|
logger.error("分账已到20次限制,后面只记录,无法分账"); |
|
|
|
try { |
|
|
|
creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); |
|
|
|
} catch (Exception ex) { |
|
|
|
logger.error("分账已到20次限制,记录到结算表失败"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new MallinkException(e.getErrorCode(), e.getMessage()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new MallinkException(e.getErrorCode(), e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (cardInfo.getSaleAmount() > 0 && payment > 0) { |
|
|
|
// 有价储值卡消费时,如果未启用分账,金额也记入补贴表,可能会导致查询错误, TODO |
|
|
|
if (cardInfo.isBuyed() && payment > 0) { |
|
|
|
try { |
|
|
|
creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); |
|
|
|
} catch (Exception ex) { |
|
|
|
|