|
@@ -61,6 +61,7 @@ import java.util.Map; |
|
@@ -61,6 +61,7 @@ import java.util.Map; |
61
|
import java.util.Objects;
|
61
|
import java.util.Objects;
|
62
|
import java.util.Optional;
|
62
|
import java.util.Optional;
|
63
|
import java.util.function.BiFunction;
|
63
|
import java.util.function.BiFunction;
|
|
|
64
|
+import java.util.function.Consumer;
|
64
|
import java.util.function.Function;
|
65
|
import java.util.function.Function;
|
65
|
|
66
|
|
66
|
import static com.yohoufo.order.common.TransferCase.EARNEST_MONEY_TO_BUYER;
|
67
|
import static com.yohoufo.order.common.TransferCase.EARNEST_MONEY_TO_BUYER;
|
|
@@ -662,20 +663,27 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -662,20 +663,27 @@ public class PaymentServiceImpl implements IPaymentService { |
662
|
throw new ServiceException(400, "不合法的金额:" + transferAmount);
|
663
|
throw new ServiceException(400, "不合法的金额:" + transferAmount);
|
663
|
}
|
664
|
}
|
664
|
|
665
|
|
665
|
- AuthorizeResultRespVO account = getOneValidAlipayAccount(targetUid);
|
|
|
666
|
- if (account == null) {
|
|
|
667
|
- logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid);
|
666
|
+ AuthorizeResultRespVO account = getOneValidAlipayAccountOr(targetUid, invalidAccount -> {
|
|
|
667
|
+ if ("invalid".equals(invalidAccount)) {
|
|
|
668
|
+ record.setTradeStatus(BillTradeStatus.YH_STORE_AMOUNT_WAIT_PAYMENT.getCode());
|
|
|
669
|
+ } else if ("invalid_hk".equals(invalidAccount)) {
|
|
|
670
|
+ record.setTradeStatus(BillTradeStatus.HK_AMOUNT_WAIT_PAYMENT.getCode());
|
|
|
671
|
+ } else {
|
668
|
record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode());
|
672
|
record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode());
|
|
|
673
|
+ }
|
669
|
addTradeBills(record);
|
674
|
addTradeBills(record);
|
|
|
675
|
+ });
|
|
|
676
|
+
|
|
|
677
|
+ if(account == null){
|
670
|
throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号");
|
678
|
throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号");
|
671
|
}
|
679
|
}
|
|
|
680
|
+
|
672
|
if(StringUtils.isNotBlank(account.getAlipayId())) {
|
681
|
if(StringUtils.isNotBlank(account.getAlipayId())) {
|
673
|
- logger.info("transferMon uid {} 支付宝账号uid有值优先使用{}", targetUid, account.getAlipayId());
|
|
|
674
|
transfer.setAlipayAccount(account.getAlipayId());
|
682
|
transfer.setAlipayAccount(account.getAlipayId());
|
675
|
} else if(StringUtils.isNotBlank(account.getAlipayAccount())) {
|
683
|
} else if(StringUtils.isNotBlank(account.getAlipayAccount())) {
|
676
|
- logger.info("transferMon uid {} 支付宝账号uid无值使用账号{}", targetUid, account.getAlipayAccount());
|
|
|
677
|
transfer.setAlipayAccount(account.getAlipayAccount());
|
684
|
transfer.setAlipayAccount(account.getAlipayAccount());
|
678
|
}
|
685
|
}
|
|
|
686
|
+
|
679
|
transfer.setUpdateTime(now);
|
687
|
transfer.setUpdateTime(now);
|
680
|
tradeBillsMapper.insert(record);
|
688
|
tradeBillsMapper.insert(record);
|
681
|
|
689
|
|
|
@@ -1277,26 +1285,42 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1277,26 +1285,42 @@ public class PaymentServiceImpl implements IPaymentService { |
1277
|
tradeBillsService.addTradeBills(record);
|
1285
|
tradeBillsService.addTradeBills(record);
|
1278
|
}
|
1286
|
}
|
1279
|
|
1287
|
|
|
|
1288
|
+ private AuthorizeResultRespVO getOneValidAlipayAccount(int targetUid) {
|
|
|
1289
|
+ return getOneValidAlipayAccountOr(targetUid, invalidAccount -> {});
|
|
|
1290
|
+ }
|
1280
|
|
1291
|
|
1281
|
|
1292
|
|
1282
|
-
|
|
|
1283
|
-
|
|
|
1284
|
-
|
|
|
1285
|
- private AuthorizeResultRespVO getOneValidAlipayAccount(int targetUid) {
|
1293
|
+ private AuthorizeResultRespVO getOneValidAlipayAccountOr(int targetUid, Consumer<String> invalidAccountHandler) {
|
1286
|
ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid);
|
1294
|
ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid);
|
1287
|
AuthorizeResultRespVO account = null;
|
1295
|
AuthorizeResultRespVO account = null;
|
1288
|
if (resp != null) {
|
1296
|
if (resp != null) {
|
1289
|
account = (AuthorizeResultRespVO) resp.getData();
|
1297
|
account = (AuthorizeResultRespVO) resp.getData();
|
1290
|
}
|
1298
|
}
|
1291
|
- if (account == null ||
|
|
|
1292
|
- (StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))
|
|
|
1293
|
- || StringUtils.equals("invalid", account.getAlipayAccount())
|
|
|
1294
|
- || StringUtils.equals("invalid", account.getAlipayId())) {
|
1299
|
+ // 账户不存在
|
|
|
1300
|
+ if (account == null) {
|
|
|
1301
|
+ invalidAccountHandler.accept(null);
|
|
|
1302
|
+ return null;
|
|
|
1303
|
+ }
|
|
|
1304
|
+ // 账户不存在
|
|
|
1305
|
+ else if ((StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) {
|
|
|
1306
|
+ invalidAccountHandler.accept(null);
|
|
|
1307
|
+ return null;
|
|
|
1308
|
+ }
|
|
|
1309
|
+ // 无效的支付宝账号
|
|
|
1310
|
+ else if (StringUtils.contains(account.getAlipayAccount(), "invalid")) {
|
|
|
1311
|
+ invalidAccountHandler.accept(account.getAlipayAccount());
|
1295
|
return null;
|
1312
|
return null;
|
1296
|
}
|
1313
|
}
|
|
|
1314
|
+ // 无效的支付宝账号
|
|
|
1315
|
+ else if (StringUtils.contains(account.getAlipayId(), "invalid")) {
|
|
|
1316
|
+ invalidAccountHandler.accept(account.getAlipayId());
|
|
|
1317
|
+ return null;
|
|
|
1318
|
+ } else {
|
1297
|
return account;
|
1319
|
return account;
|
1298
|
}
|
1320
|
}
|
1299
|
|
1321
|
|
|
|
1322
|
+ }
|
|
|
1323
|
+
|
1300
|
|
1324
|
|
1301
|
/**
|
1325
|
/**
|
1302
|
* 获取订单信息(买家订单|卖家订单|入驻充值)
|
1326
|
* 获取订单信息(买家订单|卖家订单|入驻充值)
|