Authored by chenchao
Committed by LUOXC

fix

(cherry picked from commit 4bb1e094)
... ... @@ -740,7 +740,7 @@ public class PaymentServiceImpl implements IPaymentService {
transfer.setUpdateTime(now);
try {
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount.getAlipayId());
shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount);
if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) {
transfer.setInterfaceType(2);
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
... ... @@ -1124,7 +1124,7 @@ public class PaymentServiceImpl implements IPaymentService {
.alipayUid(account.getAlipayId())
.alipayAccount(account.getAlipayAccount())
.transferAmount(amount)
.riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid) )
.riskWatcher((uid, aliRsp)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, aliRsp) )
.transfer();
if (transferResult.getCode() == 200) {
logger.info("{}, transfer success and out trade no is {}", logTag, orderCode);
... ... @@ -1186,7 +1186,7 @@ public class PaymentServiceImpl implements IPaymentService {
.transferAmount(amount)
.businessId(businessId)
.userName(account.getCertName())
.riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid))
.riskWatcher((uid, aar)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, aar))
.transfer();
// success to wait
if (transferResult.getCode() == 200) {
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
import com.yohoufo.common.exception.UfoServiceException;
... ... @@ -63,14 +64,19 @@ public class ShoppingRiskWatchDog {
}
@Database(DataSource="ufo_order")
public void checkAlipayBlackUser(int uid, String alipayUid){
if (StringUtils.isBlank(alipayUid)){
public void checkAlipayBlackUser(int uid, AuthorizeResultRespVO aliPayAccount){
if (Objects.isNull(aliPayAccount)){
logger.warn("in checkAlipayBlackUser alipayUid null, uid {}", uid);
return;
}
if(Objects.nonNull(alipayBlackUserMapper.selectByAlipayUid(alipayUid))){
logger.info("checkAlipayBlackUser intercept black uid {} alipay uid {}", uid, alipayUid);
SmsAlarmEvent smsAlarmEvent = AlarmEventBuilder.buildAlipayBlackUidAlarmEvent(uid, alipayUid);
String aliUid = aliPayAccount.getAlipayId();
if (StringUtils.isBlank(aliUid)){
aliUid = aliPayAccount.getAlipayAccount();
}
if(Objects.nonNull(alipayBlackUserMapper.selectByAlipayUid(aliUid))){
logger.info("checkAlipayBlackUser intercept black uid {} alipay uid {}", uid, aliUid);
SmsAlarmEvent smsAlarmEvent = AlarmEventBuilder.buildAlipayBlackUidAlarmEvent(uid, aliUid);
EventBusPublisher.publishEvent(smsAlarmEvent);
throw new UfoServiceException(441, "支付宝黑名单");
}
... ...
... ... @@ -8,24 +8,20 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.HttpClient;
import com.yohoufo.common.utils.MD5Utils;
import com.yohoufo.common.utils.RSAUtils;
import com.yohoufo.common.utils.WXUtil;
import com.yohoufo.common.utils.*;
import com.yohoufo.dal.order.OrdersPayHbfqMapper;
import com.yohoufo.dal.order.model.OrdersPayHbfq;
import com.yohoufo.dal.order.model.TradeBills;
import com.yohoufo.order.common.HbfqEnum;
import com.yohoufo.order.config.AlipayConfig;
import com.yohoufo.order.constants.RefundContant;
import com.yohoufo.order.model.*;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.PaymentData;
import com.yohoufo.order.model.TransferData;
import com.yohoufo.order.service.pay.AbstractPayService;
import com.yohoufo.order.service.transfer.TransferChannel;
import com.yohoufo.order.service.transfer.TransferResult;
import com.yohoufo.order.utils.AlipayExceedMillionTransferErrors;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -39,7 +35,6 @@ import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
public abstract class AlipayServiceAbstract extends AbstractPayService {
... ... @@ -200,7 +195,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
String alipayUid;
String alipayAccount;
BigDecimal transferAmount;
BiConsumer<Integer, String> rishWatcherConsumer;
BiConsumer<Integer, AuthorizeResultRespVO> rishWatcherConsumer;
private AlipayTransfer(int uid){
this.uid = uid;
... ... @@ -226,14 +221,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
return this;
}
public AlipayTransfer riskWatcher(BiConsumer<Integer, String> rishWatcherConsumer){
public AlipayTransfer riskWatcher(BiConsumer<Integer, AuthorizeResultRespVO> rishWatcherConsumer){
this.rishWatcherConsumer = rishWatcherConsumer;
return this;
}
@Override
public TransferResult transfer() {
rishWatcherConsumer.accept(uid, alipayUid);
AuthorizeResultRespVO aar = AuthorizeResultRespVO.builder().alipayId(alipayUid)
.alipayAccount(alipayAccount).build();
rishWatcherConsumer.accept(uid, aar);
Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount);
String respTxt;
try {
... ... @@ -324,7 +321,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
BigDecimal transferAmount;
String businessId;
String userName;
BiConsumer<Integer, String> riskWatcher;
BiConsumer<Integer, AuthorizeResultRespVO> riskWatcher;
private AlipayExceedMillionTransferChannel(int uid){
this.uid = uid;
}
... ... @@ -359,14 +356,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
return this;
}
public AlipayExceedMillionTransferChannel riskWatcher(BiConsumer<Integer, String> riskWatcher){
public AlipayExceedMillionTransferChannel riskWatcher(BiConsumer<Integer, AuthorizeResultRespVO> riskWatcher){
this.riskWatcher = riskWatcher;
return this;
}
@Override
public TransferResult transfer() {
riskWatcher.accept(uid, alipayUid);
AuthorizeResultRespVO aar = AuthorizeResultRespVO.builder().alipayId(alipayUid)
.alipayAccount(alipayAccount).build();
riskWatcher.accept(uid, aar);
Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount);
String respTxt;
try {
... ...