Showing
1 changed file
with
18 additions
and
17 deletions
@@ -681,9 +681,8 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -681,9 +681,8 @@ public class PaymentServiceImpl implements IPaymentService { | ||
681 | throw new ServiceException(400, "不合法的金额:" + transferAmount); | 681 | throw new ServiceException(400, "不合法的金额:" + transferAmount); |
682 | } | 682 | } |
683 | 683 | ||
684 | - AuthorizeResultRespVO account = getAlipayAccount(targetUid); | ||
685 | - if (account == null || | ||
686 | - (StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) { | 684 | + AuthorizeResultRespVO account = getOneValidAlipayAccount(targetUid); |
685 | + if (account == null) { | ||
687 | logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid); | 686 | logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid); |
688 | record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode()); | 687 | record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode()); |
689 | addTradeBills(record); | 688 | addTradeBills(record); |
@@ -1096,9 +1095,8 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1096,9 +1095,8 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1096 | private void transfer(String logTag, TradeBills tradeBills, BigDecimal amount, TradeBills lockKey) { | 1095 | private void transfer(String logTag, TradeBills tradeBills, BigDecimal amount, TradeBills lockKey) { |
1097 | long orderCode = tradeBills.getOrderCode(); | 1096 | long orderCode = tradeBills.getOrderCode(); |
1098 | try { | 1097 | try { |
1099 | - AuthorizeResultRespVO account = getAlipayAccount(tradeBills.getUid()); | ||
1100 | - if (account == null || | ||
1101 | - (StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) { | 1098 | + AuthorizeResultRespVO account = getOneValidAlipayAccount(tradeBills.getUid()); |
1099 | + if (account == null) { | ||
1102 | logger.warn("{}, can not find a alipay account", logTag); | 1100 | logger.warn("{}, can not find a alipay account", logTag); |
1103 | throw new ServiceException(400, "uid[" + tradeBills.getUid() + "]没有获取到有效的支付宝账号"); | 1101 | throw new ServiceException(400, "uid[" + tradeBills.getUid() + "]没有获取到有效的支付宝账号"); |
1104 | } | 1102 | } |
@@ -1431,17 +1429,20 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1431,17 +1429,20 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1431 | } | 1429 | } |
1432 | 1430 | ||
1433 | 1431 | ||
1434 | - @SuppressWarnings("unchecked") | ||
1435 | - private AuthorizeResultRespVO getAlipayAccount(int targetUid) { | ||
1436 | - ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid); | ||
1437 | - if (resp != null) { | ||
1438 | - AuthorizeResultRespVO data = (AuthorizeResultRespVO) resp.getData(); | ||
1439 | - if (data != null) { | ||
1440 | - return data; | ||
1441 | - } | ||
1442 | - } | ||
1443 | - return null; | ||
1444 | - } | 1432 | + private AuthorizeResultRespVO getOneValidAlipayAccount(int targetUid) { |
1433 | + ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid); | ||
1434 | + AuthorizeResultRespVO account = null; | ||
1435 | + if (resp != null) { | ||
1436 | + account = (AuthorizeResultRespVO) resp.getData(); | ||
1437 | + } | ||
1438 | + if (account == null || | ||
1439 | + (StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId())) | ||
1440 | + || StringUtils.equals("invalid", account.getAlipayAccount()) | ||
1441 | + || StringUtils.equals("invalid", account.getAlipayId())) { | ||
1442 | + return null; | ||
1443 | + } | ||
1444 | + return account; | ||
1445 | + } | ||
1445 | 1446 | ||
1446 | 1447 | ||
1447 | /** | 1448 | /** |
-
Please register or login to post a comment