Authored by chenchao

fix

@@ -746,7 +746,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -746,7 +746,7 @@ public class PaymentServiceImpl implements IPaymentService {
746 transfer.setUpdateTime(now); 746 transfer.setUpdateTime(now);
747 try { 747 try {
748 logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount); 748 logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
749 - shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount.getAlipayId()); 749 + shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount);
750 if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) { 750 if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) {
751 transfer.setInterfaceType(2); 751 transfer.setInterfaceType(2);
752 ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); 752 ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
@@ -1130,7 +1130,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1130,7 +1130,7 @@ public class PaymentServiceImpl implements IPaymentService {
1130 .alipayUid(account.getAlipayId()) 1130 .alipayUid(account.getAlipayId())
1131 .alipayAccount(account.getAlipayAccount()) 1131 .alipayAccount(account.getAlipayAccount())
1132 .transferAmount(amount) 1132 .transferAmount(amount)
1133 - .riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid) ) 1133 + .riskWatcher((uid, aliRsp)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, aliRsp) )
1134 .transfer(); 1134 .transfer();
1135 if (transferResult.getCode() == 200) { 1135 if (transferResult.getCode() == 200) {
1136 logger.info("{}, transfer success and out trade no is {}", logTag, orderCode); 1136 logger.info("{}, transfer success and out trade no is {}", logTag, orderCode);
@@ -1192,7 +1192,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1192,7 +1192,7 @@ public class PaymentServiceImpl implements IPaymentService {
1192 .transferAmount(amount) 1192 .transferAmount(amount)
1193 .businessId(businessId) 1193 .businessId(businessId)
1194 .userName(account.getCertName()) 1194 .userName(account.getCertName())
1195 - .riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid)) 1195 + .riskWatcher((uid, aar)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, aar))
1196 .transfer(); 1196 .transfer();
1197 // success to wait 1197 // success to wait
1198 if (transferResult.getCode() == 200) { 1198 if (transferResult.getCode() == 200) {
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl; @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
2 2
3 import com.yoho.core.dal.datasource.annotation.Database; 3 import com.yoho.core.dal.datasource.annotation.Database;
4 import com.yohobuy.ufo.model.order.common.OrderStatus; 4 import com.yohobuy.ufo.model.order.common.OrderStatus;
  5 +import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
5 import com.yohoufo.common.alarm.EventBusPublisher; 6 import com.yohoufo.common.alarm.EventBusPublisher;
6 import com.yohoufo.common.alarm.SmsAlarmEvent; 7 import com.yohoufo.common.alarm.SmsAlarmEvent;
7 import com.yohoufo.common.exception.UfoServiceException; 8 import com.yohoufo.common.exception.UfoServiceException;
@@ -63,14 +64,19 @@ public class ShoppingRiskWatchDog { @@ -63,14 +64,19 @@ public class ShoppingRiskWatchDog {
63 } 64 }
64 65
65 @Database(DataSource="ufo_order") 66 @Database(DataSource="ufo_order")
66 - public void checkAlipayBlackUser(int uid, String alipayUid){  
67 - if (StringUtils.isBlank(alipayUid)){ 67 + public void checkAlipayBlackUser(int uid, AuthorizeResultRespVO aliPayAccount){
  68 +
  69 + if (Objects.isNull(aliPayAccount)){
68 logger.warn("in checkAlipayBlackUser alipayUid null, uid {}", uid); 70 logger.warn("in checkAlipayBlackUser alipayUid null, uid {}", uid);
69 return; 71 return;
70 } 72 }
71 - if(Objects.nonNull(alipayBlackUserMapper.selectByAlipayUid(alipayUid))){  
72 - logger.info("checkAlipayBlackUser intercept black uid {} alipay uid {}", uid, alipayUid);  
73 - SmsAlarmEvent smsAlarmEvent = AlarmEventBuilder.buildAlipayBlackUidAlarmEvent(uid, alipayUid); 73 + String aliUid = aliPayAccount.getAlipayId();
  74 + if (StringUtils.isBlank(aliUid)){
  75 + aliUid = aliPayAccount.getAlipayAccount();
  76 + }
  77 + if(Objects.nonNull(alipayBlackUserMapper.selectByAlipayUid(aliUid))){
  78 + logger.info("checkAlipayBlackUser intercept black uid {} alipay uid {}", uid, aliUid);
  79 + SmsAlarmEvent smsAlarmEvent = AlarmEventBuilder.buildAlipayBlackUidAlarmEvent(uid, aliUid);
74 EventBusPublisher.publishEvent(smsAlarmEvent); 80 EventBusPublisher.publishEvent(smsAlarmEvent);
75 throw new UfoServiceException(441, "支付宝黑名单"); 81 throw new UfoServiceException(441, "支付宝黑名单");
76 } 82 }
@@ -8,24 +8,20 @@ import com.yoho.error.exception.ServiceException; @@ -8,24 +8,20 @@ import com.yoho.error.exception.ServiceException;
8 import com.yohobuy.ufo.model.order.bo.OrderInfo; 8 import com.yohobuy.ufo.model.order.bo.OrderInfo;
9 import com.yohobuy.ufo.model.order.common.Payment; 9 import com.yohobuy.ufo.model.order.common.Payment;
10 import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; 10 import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
11 -import com.yohoufo.common.utils.DateUtil;  
12 -import com.yohoufo.common.utils.HttpClient;  
13 -import com.yohoufo.common.utils.MD5Utils;  
14 -import com.yohoufo.common.utils.RSAUtils;  
15 -import com.yohoufo.common.utils.WXUtil; 11 +import com.yohoufo.common.utils.*;
16 import com.yohoufo.dal.order.OrdersPayHbfqMapper; 12 import com.yohoufo.dal.order.OrdersPayHbfqMapper;
17 import com.yohoufo.dal.order.model.OrdersPayHbfq; 13 import com.yohoufo.dal.order.model.OrdersPayHbfq;
18 -import com.yohoufo.dal.order.model.TradeBills;  
19 import com.yohoufo.order.common.HbfqEnum; 14 import com.yohoufo.order.common.HbfqEnum;
20 import com.yohoufo.order.config.AlipayConfig; 15 import com.yohoufo.order.config.AlipayConfig;
21 import com.yohoufo.order.constants.RefundContant; 16 import com.yohoufo.order.constants.RefundContant;
22 -import com.yohoufo.order.model.*; 17 +import com.yohoufo.order.model.PayQueryBo;
  18 +import com.yohoufo.order.model.PayRefundBo;
  19 +import com.yohoufo.order.model.PaymentData;
  20 +import com.yohoufo.order.model.TransferData;
23 import com.yohoufo.order.service.pay.AbstractPayService; 21 import com.yohoufo.order.service.pay.AbstractPayService;
24 import com.yohoufo.order.service.transfer.TransferChannel; 22 import com.yohoufo.order.service.transfer.TransferChannel;
25 import com.yohoufo.order.service.transfer.TransferResult; 23 import com.yohoufo.order.service.transfer.TransferResult;
26 import com.yohoufo.order.utils.AlipayExceedMillionTransferErrors; 24 import com.yohoufo.order.utils.AlipayExceedMillionTransferErrors;
27 -import lombok.Builder;  
28 -import lombok.Data;  
29 import org.apache.commons.lang3.StringUtils; 25 import org.apache.commons.lang3.StringUtils;
30 import org.slf4j.Logger; 26 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory; 27 import org.slf4j.LoggerFactory;
@@ -39,7 +35,6 @@ import java.nio.charset.StandardCharsets; @@ -39,7 +35,6 @@ import java.nio.charset.StandardCharsets;
39 import java.text.SimpleDateFormat; 35 import java.text.SimpleDateFormat;
40 import java.util.*; 36 import java.util.*;
41 import java.util.function.BiConsumer; 37 import java.util.function.BiConsumer;
42 -import java.util.function.Supplier;  
43 38
44 public abstract class AlipayServiceAbstract extends AbstractPayService { 39 public abstract class AlipayServiceAbstract extends AbstractPayService {
45 40
@@ -204,7 +199,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -204,7 +199,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
204 String alipayUid; 199 String alipayUid;
205 String alipayAccount; 200 String alipayAccount;
206 BigDecimal transferAmount; 201 BigDecimal transferAmount;
207 - BiConsumer<Integer, String> rishWatcherConsumer; 202 + BiConsumer<Integer, AuthorizeResultRespVO> rishWatcherConsumer;
208 203
209 private AlipayTransfer(int uid){ 204 private AlipayTransfer(int uid){
210 this.uid = uid; 205 this.uid = uid;
@@ -230,14 +225,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -230,14 +225,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
230 return this; 225 return this;
231 } 226 }
232 227
233 - public AlipayTransfer riskWatcher(BiConsumer<Integer, String> rishWatcherConsumer){ 228 + public AlipayTransfer riskWatcher(BiConsumer<Integer, AuthorizeResultRespVO> rishWatcherConsumer){
234 this.rishWatcherConsumer = rishWatcherConsumer; 229 this.rishWatcherConsumer = rishWatcherConsumer;
235 return this; 230 return this;
236 } 231 }
237 232
238 @Override 233 @Override
239 public TransferResult transfer() { 234 public TransferResult transfer() {
240 - rishWatcherConsumer.accept(uid, alipayUid); 235 + AuthorizeResultRespVO aar = AuthorizeResultRespVO.builder().alipayId(alipayUid)
  236 + .alipayAccount(alipayAccount).build();
  237 + rishWatcherConsumer.accept(uid, aar);
241 Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount); 238 Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount);
242 String respTxt; 239 String respTxt;
243 try { 240 try {
@@ -328,7 +325,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -328,7 +325,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
328 BigDecimal transferAmount; 325 BigDecimal transferAmount;
329 String businessId; 326 String businessId;
330 String userName; 327 String userName;
331 - BiConsumer<Integer, String> riskWatcher; 328 + BiConsumer<Integer, AuthorizeResultRespVO> riskWatcher;
332 private AlipayExceedMillionTransferChannel(int uid){ 329 private AlipayExceedMillionTransferChannel(int uid){
333 this.uid = uid; 330 this.uid = uid;
334 } 331 }
@@ -363,14 +360,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -363,14 +360,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
363 return this; 360 return this;
364 } 361 }
365 362
366 - public AlipayExceedMillionTransferChannel riskWatcher(BiConsumer<Integer, String> riskWatcher){ 363 + public AlipayExceedMillionTransferChannel riskWatcher(BiConsumer<Integer, AuthorizeResultRespVO> riskWatcher){
367 this.riskWatcher = riskWatcher; 364 this.riskWatcher = riskWatcher;
368 return this; 365 return this;
369 } 366 }
370 367
371 @Override 368 @Override
372 public TransferResult transfer() { 369 public TransferResult transfer() {
373 - riskWatcher.accept(uid, alipayUid); 370 + AuthorizeResultRespVO aar = AuthorizeResultRespVO.builder().alipayId(alipayUid)
  371 + .alipayAccount(alipayAccount).build();
  372 + riskWatcher.accept(uid, aar);
374 Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount); 373 Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount);
375 String respTxt; 374 String respTxt;
376 try { 375 try {