Authored by chenchao
Committed by LUOXC

add risk watch

(cherry picked from commit 78c9f3a2)
  1 +package com.yohoufo.dal.order;
  2 +
  3 +import com.yohoufo.dal.order.model.AlipayBlackUser;
  4 +
  5 +public interface AlipayBlackUserMapper {
  6 +
  7 + int insert(AlipayBlackUser record);
  8 +
  9 + int insertSelective(AlipayBlackUser record);
  10 +
  11 + AlipayBlackUser selectByAlipayUid(String alipayUid);
  12 +
  13 + int updateByPrimaryKeySelective(AlipayBlackUser record);
  14 +
  15 + int updateByPrimaryKey(AlipayBlackUser record);
  16 +}
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +public class AlipayBlackUser {
  4 + private Integer id;
  5 +
  6 + private String alipayUid;
  7 +
  8 + public Integer getId() {
  9 + return id;
  10 + }
  11 +
  12 + public void setId(Integer id) {
  13 + this.id = id;
  14 + }
  15 +
  16 + public String getAlipayUid() {
  17 + return alipayUid;
  18 + }
  19 +
  20 + public void setAlipayUid(String alipayUid) {
  21 + this.alipayUid = alipayUid == null ? null : alipayUid.trim();
  22 + }
  23 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.yohoufo.dal.order.AlipayBlackUserMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AlipayBlackUser">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="alipay_uid" jdbcType="VARCHAR" property="alipayUid" />
  7 + </resultMap>
  8 + <sql id="Base_Column_List">
  9 + id, alipay_uid
  10 + </sql>
  11 +
  12 + <select id="selectByAlipayUid" parameterType="java.lang.String" resultMap="BaseResultMap">
  13 + select
  14 + <include refid="Base_Column_List" />
  15 + from alipay_black_user
  16 + where alipay_uid = #{alipayUid,jdbcType=VARCHAR}
  17 + </select>
  18 +
  19 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AlipayBlackUser" useGeneratedKeys="true">
  20 + insert into alipay_black_user (alipay_uid)
  21 + values (#{alipayUid,jdbcType=VARCHAR})
  22 + </insert>
  23 + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AlipayBlackUser" useGeneratedKeys="true">
  24 + insert into alipay_black_user
  25 + <trim prefix="(" suffix=")" suffixOverrides=",">
  26 + <if test="alipayUid != null">
  27 + alipay_uid,
  28 + </if>
  29 + </trim>
  30 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  31 + <if test="alipayUid != null">
  32 + #{alipayUid,jdbcType=VARCHAR},
  33 + </if>
  34 + </trim>
  35 + </insert>
  36 + <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AlipayBlackUser">
  37 + update alipay_black_user
  38 + <set>
  39 + <if test="alipayUid != null">
  40 + alipay_uid = #{alipayUid,jdbcType=VARCHAR},
  41 + </if>
  42 + </set>
  43 + where id = #{id,jdbcType=INTEGER}
  44 + </update>
  45 + <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AlipayBlackUser">
  46 + update alipay_black_user
  47 + set alipay_uid = #{alipayUid,jdbcType=VARCHAR}
  48 + where id = #{id,jdbcType=INTEGER}
  49 + </update>
  50 +</mapper>
@@ -91,5 +91,12 @@ public class AlarmEventBuilder { @@ -91,5 +91,12 @@ public class AlarmEventBuilder {
91 return smsAlarmEvent; 91 return smsAlarmEvent;
92 } 92 }
93 93
  94 + public static SmsAlarmEvent buildAlipayBlackUidAlarmEvent(int uid, String alipayUid){
  95 + SmsAlarmEvent smsAlarmEvent ;
  96 + String content ;
  97 + content = "拦截到支付宝黑名单用户:"+ uid +",alipayUid:" + alipayUid ;
  98 + smsAlarmEvent = new SmsAlarmEvent("ufoOrder.alipayBlackUid", "ufoOrder.alipayBlackUidIntercept", content);
  99 + return smsAlarmEvent;
  100 + }
94 101
95 } 102 }
@@ -31,20 +31,14 @@ import com.yohoufo.order.model.request.PaymentRequest; @@ -31,20 +31,14 @@ import com.yohoufo.order.model.request.PaymentRequest;
31 import com.yohoufo.order.model.request.TransferMoneyRequest; 31 import com.yohoufo.order.model.request.TransferMoneyRequest;
32 import com.yohoufo.order.model.response.PaymentConfirmRsp; 32 import com.yohoufo.order.model.response.PaymentConfirmRsp;
33 import com.yohoufo.order.model.response.PrepayResponse; 33 import com.yohoufo.order.model.response.PrepayResponse;
34 -import com.yohoufo.order.service.*;  
35 import com.yohoufo.order.mq.TopicConstants; 34 import com.yohoufo.order.mq.TopicConstants;
36 import com.yohoufo.order.mq.producer.TradeMqSender; 35 import com.yohoufo.order.mq.producer.TradeMqSender;
37 -import com.yohoufo.order.service.AbstractOrderPaymentService;  
38 -import com.yohoufo.order.service.BuyerOrderPaymentService;  
39 -import com.yohoufo.order.service.IPaymentService;  
40 -import com.yohoufo.order.service.MerchantOrderPaymentService;  
41 -import com.yohoufo.order.service.SellerOrderPaymentService; 36 +import com.yohoufo.order.service.*;
42 import com.yohoufo.order.service.handler.BuyerOrderPayDiffTimeHandler; 37 import com.yohoufo.order.service.handler.BuyerOrderPayDiffTimeHandler;
43 import com.yohoufo.order.service.handler.transfer.AlipayTransferChancelSelector; 38 import com.yohoufo.order.service.handler.transfer.AlipayTransferChancelSelector;
44 import com.yohoufo.order.service.pay.AbstractPayService; 39 import com.yohoufo.order.service.pay.AbstractPayService;
45 import com.yohoufo.order.service.pay.alipay.AlipayOuyinService; 40 import com.yohoufo.order.service.pay.alipay.AlipayOuyinService;
46 import com.yohoufo.order.service.pay.unionpay.JsUnionpayService; 41 import com.yohoufo.order.service.pay.unionpay.JsUnionpayService;
47 -import com.yohoufo.order.service.pay.unionpay.UnionpayServiceAbstract;  
48 import com.yohoufo.order.service.pay.wallet.WalletPayService; 42 import com.yohoufo.order.service.pay.wallet.WalletPayService;
49 import com.yohoufo.order.service.pay.weixin.WeixinMiniappPayService; 43 import com.yohoufo.order.service.pay.weixin.WeixinMiniappPayService;
50 import com.yohoufo.order.service.pay.weixin.WeixinPayUFORealAppService; 44 import com.yohoufo.order.service.pay.weixin.WeixinPayUFORealAppService;
@@ -53,7 +47,6 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; @@ -53,7 +47,6 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
53 import com.yohoufo.order.service.transfer.TransferResult; 47 import com.yohoufo.order.service.transfer.TransferResult;
54 import com.yohoufo.order.utils.LoggerUtils; 48 import com.yohoufo.order.utils.LoggerUtils;
55 import com.yohoufo.order.utils.PaymentHelper; 49 import com.yohoufo.order.utils.PaymentHelper;
56 -import lombok.val;  
57 import org.apache.commons.collections.CollectionUtils; 50 import org.apache.commons.collections.CollectionUtils;
58 import org.apache.commons.lang3.StringUtils; 51 import org.apache.commons.lang3.StringUtils;
59 import org.slf4j.Logger; 52 import org.slf4j.Logger;
@@ -168,6 +161,9 @@ public class PaymentServiceImpl implements IPaymentService { @@ -168,6 +161,9 @@ public class PaymentServiceImpl implements IPaymentService {
168 @Autowired 161 @Autowired
169 private TradeMqSender tradeMqSender; 162 private TradeMqSender tradeMqSender;
170 163
  164 + @Autowired
  165 + private ShoppingRiskWatchDog shoppingRiskWatchDog;
  166 +
171 /** 167 /**
172 * 获取主场的订单service 168 * 获取主场的订单service
173 * 169 *
@@ -692,7 +688,8 @@ public class PaymentServiceImpl implements IPaymentService { @@ -692,7 +688,8 @@ public class PaymentServiceImpl implements IPaymentService {
692 } 688 }
693 689
694 @Database(ForceMaster = true) 690 @Database(ForceMaster = true)
695 - public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount, AuthorizeResultRespVO aliPayAccount) { 691 + public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount,
  692 + AuthorizeResultRespVO aliPayAccount) {
696 logger.info("退还商家所有保证金,转账开始,orderCode = {}, uid={}, amount={}, alipayAccount={}", orderCode, uid, amount, aliPayAccount); 693 logger.info("退还商家所有保证金,转账开始,orderCode = {}, uid={}, amount={}, alipayAccount={}", orderCode, uid, amount, aliPayAccount);
697 694
698 int now = (int) (System.currentTimeMillis() / 1000); 695 int now = (int) (System.currentTimeMillis() / 1000);
@@ -743,7 +740,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -743,7 +740,7 @@ public class PaymentServiceImpl implements IPaymentService {
743 transfer.setUpdateTime(now); 740 transfer.setUpdateTime(now);
744 try { 741 try {
745 logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount); 742 logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
746 - 743 + shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount.getAlipayId());
747 if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) { 744 if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) {
748 transfer.setInterfaceType(2); 745 transfer.setInterfaceType(2);
749 ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); 746 ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
@@ -1120,12 +1117,14 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1120,12 +1117,14 @@ public class PaymentServiceImpl implements IPaymentService {
1120 addTradeBills(tradeBills); 1117 addTradeBills(tradeBills);
1121 } 1118 }
1122 1119
  1120 +
1123 private void transferWithAlipayTransferAndAddSuccessTradeBills(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) { 1121 private void transferWithAlipayTransferAndAddSuccessTradeBills(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) {
1124 - TransferResult transferResult = alipayService.newAlipayTransfer() 1122 + TransferResult transferResult = alipayService.newAlipayTransfer(account.getUid())
1125 .transferOrderCode(Long.toString(orderCode)) 1123 .transferOrderCode(Long.toString(orderCode))
1126 .alipayUid(account.getAlipayId()) 1124 .alipayUid(account.getAlipayId())
1127 .alipayAccount(account.getAlipayAccount()) 1125 .alipayAccount(account.getAlipayAccount())
1128 .transferAmount(amount) 1126 .transferAmount(amount)
  1127 + .riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid) )
1129 .transfer(); 1128 .transfer();
1130 if (transferResult.getCode() == 200) { 1129 if (transferResult.getCode() == 200) {
1131 logger.info("{}, transfer success and out trade no is {}", logTag, orderCode); 1130 logger.info("{}, transfer success and out trade no is {}", logTag, orderCode);
@@ -1146,11 +1145,13 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1146,11 +1145,13 @@ public class PaymentServiceImpl implements IPaymentService {
1146 } 1145 }
1147 1146
1148 private void transferWithAlipayTransfer(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) { 1147 private void transferWithAlipayTransfer(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) {
1149 - TransferResult transferResult = alipayService.newAlipayTransfer() 1148 +
  1149 + TransferResult transferResult = alipayService.newAlipayTransfer(account.getUid())
1150 .transferOrderCode(Long.toString(orderCode)) 1150 .transferOrderCode(Long.toString(orderCode))
1151 .alipayUid(account.getAlipayId()) 1151 .alipayUid(account.getAlipayId())
1152 .alipayAccount(account.getAlipayAccount()) 1152 .alipayAccount(account.getAlipayAccount())
1153 .transferAmount(amount) 1153 .transferAmount(amount)
  1154 + .riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid))
1154 .transfer(); 1155 .transfer();
1155 if (transferResult.getCode() == 200) { 1156 if (transferResult.getCode() == 200) {
1156 logger.info("{}, transfer success and out trade no is {}", logTag, orderCode); 1157 logger.info("{}, transfer success and out trade no is {}", logTag, orderCode);
@@ -1171,15 +1172,21 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1171,15 +1172,21 @@ public class PaymentServiceImpl implements IPaymentService {
1171 } 1172 }
1172 } 1173 }
1173 1174
1174 - private void transferWithAlipayExceedMillionTransfer(String logTag, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, BigDecimal amount, OrdersPayTransfer transfer) { 1175 + private void transferWithAlipayExceedMillionTransfer(String logTag,
  1176 + TradeBills tradeBills,
  1177 + long orderCode,
  1178 + AuthorizeResultRespVO account,
  1179 + BigDecimal amount,
  1180 + OrdersPayTransfer transfer) {
1175 String businessId = transfer.getId() + "_" + tradeBills.getId(); 1181 String businessId = transfer.getId() + "_" + tradeBills.getId();
1176 - TransferResult transferResult = alipayService.newAlipayExceedMillionTransfer() 1182 + TransferResult transferResult = alipayService.newAlipayExceedMillionTransfer(account.getUid())
1177 .transferOrderCode(Long.toString(orderCode)) 1183 .transferOrderCode(Long.toString(orderCode))
1178 .alipayUid(account.getAlipayId()) 1184 .alipayUid(account.getAlipayId())
1179 .alipayAccount(account.getAlipayAccount()) 1185 .alipayAccount(account.getAlipayAccount())
1180 .transferAmount(amount) 1186 .transferAmount(amount)
1181 .businessId(businessId) 1187 .businessId(businessId)
1182 .userName(account.getCertName()) 1188 .userName(account.getCertName())
  1189 + .riskWatcher((uid, alipayUid)-> shoppingRiskWatchDog.checkAlipayBlackUser(uid, alipayUid))
1183 .transfer(); 1190 .transfer();
1184 // success to wait 1191 // success to wait
1185 if (transferResult.getCode() == 200) { 1192 if (transferResult.getCode() == 200) {
@@ -1196,8 +1203,12 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1196,8 +1203,12 @@ public class PaymentServiceImpl implements IPaymentService {
1196 } 1203 }
1197 1204
1198 1205
1199 - private Map<String, String> transferWhenExceedMillion(Integer transferId, TradeBills tradeBills, long orderCode, AuthorizeResultRespVO account, 1206 + private Map<String, String> transferWhenExceedMillion(Integer transferId,
  1207 + TradeBills tradeBills,
  1208 + long orderCode,
  1209 + AuthorizeResultRespVO account,
1200 BigDecimal amount, int now) throws Exception { 1210 BigDecimal amount, int now) throws Exception {
  1211 +
1201 Map<String, String> mapResult = alipayService.transferMoneyWhenExceedMillion( 1212 Map<String, String> mapResult = alipayService.transferMoneyWhenExceedMillion(
1202 Long.toString(orderCode), 1213 Long.toString(orderCode),
1203 transferId + "_" + tradeBills.getId(), 1214 transferId + "_" + tradeBills.getId(),
@@ -2,19 +2,25 @@ package com.yohoufo.order.service.impl; @@ -2,19 +2,25 @@ package com.yohoufo.order.service.impl;
2 2
3 import com.yohobuy.ufo.model.order.common.OrderStatus; 3 import com.yohobuy.ufo.model.order.common.OrderStatus;
4 import com.yohobuy.ufo.model.order.constants.RegionEnum; 4 import com.yohobuy.ufo.model.order.constants.RegionEnum;
  5 +import com.yohoufo.common.alarm.EventBusPublisher;
  6 +import com.yohoufo.common.alarm.SmsAlarmEvent;
5 import com.yohoufo.common.exception.UfoServiceException; 7 import com.yohoufo.common.exception.UfoServiceException;
  8 +import com.yohoufo.dal.order.AlipayBlackUserMapper;
6 import com.yohoufo.dal.order.BuyerOrderMapper; 9 import com.yohoufo.dal.order.BuyerOrderMapper;
7 import com.yohoufo.order.constants.ClientSpecialSemanticCode; 10 import com.yohoufo.order.constants.ClientSpecialSemanticCode;
  11 +import com.yohoufo.order.convert.builder.AlarmEventBuilder;
8 import com.yohoufo.order.service.proxy.UserProxyService; 12 import com.yohoufo.order.service.proxy.UserProxyService;
9 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport; 13 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport;
10 import com.yohoufo.order.utils.LoggerUtils; 14 import com.yohoufo.order.utils.LoggerUtils;
11 import com.yohoufo.order.utils.SellerGoodsHelper; 15 import com.yohoufo.order.utils.SellerGoodsHelper;
  16 +import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 17 import org.slf4j.Logger;
13 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Component; 19 import org.springframework.stereotype.Component;
15 20
16 import java.util.ArrayList; 21 import java.util.ArrayList;
17 import java.util.List; 22 import java.util.List;
  23 +import java.util.Objects;
18 24
19 /** 25 /**
20 * 购物风控 26 * 购物风控
@@ -32,6 +38,9 @@ public class ShoppingRiskWatchDog { @@ -32,6 +38,9 @@ public class ShoppingRiskWatchDog {
32 @Autowired 38 @Autowired
33 private UserProxyService userProxyService; 39 private UserProxyService userProxyService;
34 40
  41 + @Autowired
  42 + private AlipayBlackUserMapper alipayBlackUserMapper;
  43 +
35 public void checkWaitingPayCnt(int uid){ 44 public void checkWaitingPayCnt(int uid){
36 logger.info("in ShoppingRiskWatchDog.checkWaitingPayCnt uid {}", uid); 45 logger.info("in ShoppingRiskWatchDog.checkWaitingPayCnt uid {}", uid);
37 List<Integer> statusList = new ArrayList<>(1); 46 List<Integer> statusList = new ArrayList<>(1);
@@ -53,4 +62,18 @@ public class ShoppingRiskWatchDog { @@ -53,4 +62,18 @@ public class ShoppingRiskWatchDog {
53 } 62 }
54 } 63 }
55 } 64 }
  65 +
  66 +
  67 + public void checkAlipayBlackUser(int uid, String alipayUid){
  68 + if (StringUtils.isBlank(alipayUid)){
  69 + logger.warn("in checkAlipayBlackUser alipayUid null, uid {}", uid);
  70 + return;
  71 + }
  72 + if(Objects.nonNull(alipayBlackUserMapper.selectByAlipayUid(alipayUid))){
  73 + logger.info("checkAlipayBlackUser intercept black uid {} alipay uid {}", uid, alipayUid);
  74 + SmsAlarmEvent smsAlarmEvent = AlarmEventBuilder.buildAlipayBlackUidAlarmEvent(uid, alipayUid);
  75 + EventBusPublisher.publishEvent(smsAlarmEvent);
  76 + throw new UfoServiceException(441, "支付宝黑名单");
  77 + }
  78 + }
56 } 79 }
@@ -7,6 +7,7 @@ import com.yoho.error.ServiceError; @@ -7,6 +7,7 @@ import com.yoho.error.ServiceError;
7 import com.yoho.error.exception.ServiceException; 7 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.yohoufo.common.utils.DateUtil; 11 import com.yohoufo.common.utils.DateUtil;
11 import com.yohoufo.common.utils.HttpClient; 12 import com.yohoufo.common.utils.HttpClient;
12 import com.yohoufo.common.utils.MD5Utils; 13 import com.yohoufo.common.utils.MD5Utils;
@@ -37,6 +38,8 @@ import java.nio.charset.Charset; @@ -37,6 +38,8 @@ import java.nio.charset.Charset;
37 import java.nio.charset.StandardCharsets; 38 import java.nio.charset.StandardCharsets;
38 import java.text.SimpleDateFormat; 39 import java.text.SimpleDateFormat;
39 import java.util.*; 40 import java.util.*;
  41 +import java.util.function.BiConsumer;
  42 +import java.util.function.Supplier;
40 43
41 public abstract class AlipayServiceAbstract extends AbstractPayService { 44 public abstract class AlipayServiceAbstract extends AbstractPayService {
42 45
@@ -192,14 +195,15 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -192,14 +195,15 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
192 } 195 }
193 196
194 public class AlipayTransfer implements TransferChannel { 197 public class AlipayTransfer implements TransferChannel {
195 - 198 + int uid;
196 String transferOrderCode; 199 String transferOrderCode;
197 String alipayUid; 200 String alipayUid;
198 String alipayAccount; 201 String alipayAccount;
199 BigDecimal transferAmount; 202 BigDecimal transferAmount;
  203 + BiConsumer<Integer, String> rishWatcherConsumer;
200 204
201 - private AlipayTransfer(){  
202 - 205 + private AlipayTransfer(int uid){
  206 + this.uid = uid;
203 } 207 }
204 208
205 public AlipayTransfer transferOrderCode(String transferOrderCode){ 209 public AlipayTransfer transferOrderCode(String transferOrderCode){
@@ -222,8 +226,14 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -222,8 +226,14 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
222 return this; 226 return this;
223 } 227 }
224 228
  229 + public AlipayTransfer riskWatcher(BiConsumer<Integer, String> rishWatcherConsumer){
  230 + this.rishWatcherConsumer = rishWatcherConsumer;
  231 + return this;
  232 + }
  233 +
225 @Override 234 @Override
226 public TransferResult transfer() { 235 public TransferResult transfer() {
  236 + rishWatcherConsumer.accept(uid, alipayUid);
227 Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount); 237 Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount);
228 String respTxt; 238 String respTxt;
229 try { 239 try {
@@ -272,12 +282,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -272,12 +282,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
272 } 282 }
273 } 283 }
274 284
275 - public AlipayTransfer newAlipayTransfer(){  
276 - return new AlipayTransfer(); 285 + public AlipayTransfer newAlipayTransfer(int uid){
  286 + return new AlipayTransfer(uid);
277 } 287 }
278 288
279 - public AlipayExceedMillionTransferChannel newAlipayExceedMillionTransfer(){  
280 - return new AlipayExceedMillionTransferChannel(); 289 + public AlipayExceedMillionTransferChannel newAlipayExceedMillionTransfer(int uid){
  290 + return new AlipayExceedMillionTransferChannel(uid);
281 } 291 }
282 292
283 293
@@ -307,16 +317,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -307,16 +317,16 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
307 } 317 }
308 318
309 public class AlipayExceedMillionTransferChannel implements TransferChannel{ 319 public class AlipayExceedMillionTransferChannel implements TransferChannel{
310 - 320 + int uid;
311 String transferOrderCode; 321 String transferOrderCode;
312 String alipayUid; 322 String alipayUid;
313 String alipayAccount; 323 String alipayAccount;
314 BigDecimal transferAmount; 324 BigDecimal transferAmount;
315 String businessId; 325 String businessId;
316 String userName; 326 String userName;
317 -  
318 - private AlipayExceedMillionTransferChannel(){  
319 - 327 + BiConsumer<Integer, String> riskWatcher;
  328 + private AlipayExceedMillionTransferChannel(int uid){
  329 + this.uid = uid;
320 } 330 }
321 331
322 public AlipayExceedMillionTransferChannel transferOrderCode(String transferOrderCode){ 332 public AlipayExceedMillionTransferChannel transferOrderCode(String transferOrderCode){
@@ -349,6 +359,11 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -349,6 +359,11 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
349 return this; 359 return this;
350 } 360 }
351 361
  362 + public AlipayExceedMillionTransferChannel riskWatcher(BiConsumer<Integer, String> riskWatcher){
  363 + this.riskWatcher = riskWatcher;
  364 + return this;
  365 + }
  366 +
352 @Override 367 @Override
353 public TransferResult transfer() { 368 public TransferResult transfer() {
354 Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount); 369 Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount);