Authored by LUOXC

refacotr

... ... @@ -681,9 +681,8 @@ public class PaymentServiceImpl implements IPaymentService {
throw new ServiceException(400, "不合法的金额:" + transferAmount);
}
AuthorizeResultRespVO account = getAlipayAccount(targetUid);
if (account == null ||
(StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) {
AuthorizeResultRespVO account = getOneValidAlipayAccount(targetUid);
if (account == null) {
logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid);
record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode());
addTradeBills(record);
... ... @@ -1096,9 +1095,8 @@ public class PaymentServiceImpl implements IPaymentService {
private void transfer(String logTag, TradeBills tradeBills, BigDecimal amount, TradeBills lockKey) {
long orderCode = tradeBills.getOrderCode();
try {
AuthorizeResultRespVO account = getAlipayAccount(tradeBills.getUid());
if (account == null ||
(StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) {
AuthorizeResultRespVO account = getOneValidAlipayAccount(tradeBills.getUid());
if (account == null) {
logger.warn("{}, can not find a alipay account", logTag);
throw new ServiceException(400, "uid[" + tradeBills.getUid() + "]没有获取到有效的支付宝账号");
}
... ... @@ -1431,17 +1429,20 @@ public class PaymentServiceImpl implements IPaymentService {
}
@SuppressWarnings("unchecked")
private AuthorizeResultRespVO getAlipayAccount(int targetUid) {
ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid);
if (resp != null) {
AuthorizeResultRespVO data = (AuthorizeResultRespVO) resp.getData();
if (data != null) {
return data;
}
}
return null;
}
private AuthorizeResultRespVO getOneValidAlipayAccount(int targetUid) {
ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid);
AuthorizeResultRespVO account = null;
if (resp != null) {
account = (AuthorizeResultRespVO) resp.getData();
}
if (account == null ||
(StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))
|| StringUtils.equals("invalid", account.getAlipayAccount())
|| StringUtils.equals("invalid", account.getAlipayId())) {
return null;
}
return account;
}
/**
... ...