Authored by 匡佳华

香港仓订单购买人收件人姓名,手机号一致性校验

... ... @@ -3,4 +3,6 @@ package com.yohoufo.order.constants;
public interface ClientSpecialSemanticCode {
int needRealName = 440;
int WaitingPayLimit = 512;
int realNameMisMatch = 443;
int mobileMisMatch = 444;
}
... ...
... ... @@ -2,12 +2,14 @@ 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.order.vo.AddressInfo;
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;
import com.yohoufo.dal.order.AlipayBlackUserMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.user.model.ZhiMaCert;
import com.yohoufo.order.constants.ClientSpecialSemanticCode;
import com.yohoufo.order.convert.builder.AlarmEventBuilder;
import com.yohoufo.order.service.handler.transfer.AlipayTransferChancelSelector;
... ... @@ -58,12 +60,29 @@ public class ShoppingRiskWatchDog {
}
}
public void checkRealName4OverseasOrder(int uid, int skupTypeCode){
if (SellerGoodsHelper.isOverseas(skupTypeCode)){
if (!userProxyService.checkRealNameCert(uid)){
logger.warn("in checkRealName4OverseasOrder result false, uid {}", uid);
throw new UfoServiceException(ClientSpecialSemanticCode.needRealName, "请完成实名认证后操作");
}
public void checkOverseasOrderUserInfo(int uid, int skupTypeCode, AddressInfo addressInfo){
//(1) 非香港仓商品,直接返回
if(!SellerGoodsHelper.isOverseas(skupTypeCode)){
return;
}
//(2) 校验是否实名认证
ZhiMaCert zhimaCert = userProxyService.getRealNameInfo(uid);
if (zhimaCert == null){
logger.warn("checkOverseaOrderUserInfo: need realName cert, uid is {}", uid);
throw new UfoServiceException(ClientSpecialSemanticCode.needRealName, "请完成实名认证后操作");
}
//(3) 校验和收件人的姓名,手机号是否一致
String buyerName = zhimaCert.getCertName();
String receiverName = addressInfo.getConsignee();
if(!buyerName.equals(receiverName)){
logger.warn("checkOverseaOrderUserInfo: name not match, receiverName is {}, buyerMobile is {}", receiverName, buyerName);
throw new UfoServiceException(ClientSpecialSemanticCode.realNameMisMatch, "收件人姓名必须与实名认证信息一致");
}
String buyerMobile = userProxyService.getMobile(uid);
String receiverMobile = addressInfo.getMobile();
if(!buyerMobile.equals(receiverMobile)){
logger.warn("checkOverseaOrderUserInfo: mobile not match, receiverMobile is {}, buyerMobile is {}", receiverMobile, buyerMobile);
throw new UfoServiceException(ClientSpecialSemanticCode.mobileMisMatch, "收件人手机号必须与账号对应手机号一致");
}
}
... ...
... ... @@ -544,14 +544,17 @@ public class ShoppingServiceImpl implements IShoppingService {
// 检查skup是否可售
SellerOrderGoods psog = checkSkupSellOrNot(shoppingRequest.getUid(), shoppingRequest.getSkup());
shoppingRiskWatchDog.checkRealName4OverseasOrder(uid, psog.getAttributes());
checkSkupIsChangePrice(uid, skup);
//活动价格
ActivityPrice activityPrice = checkAndGetActivityPrice(shoppingRequest, psog);
//查询并校验用户地址
Pair<AddressInfo, AddressInfo> userAddressPair = getAndCheckAddressInfo(shoppingRequest);
//若购买的是香港仓商品,uid必须实名认证,且姓名和手机号必须与收货人一致
shoppingRiskWatchDog.checkOverseasOrderUserInfo(uid, psog.getAttributes(), userAddressPair.getKey());
//算费
ChargeContext chargeContext = buildChargeContext(shoppingRequest, psog, activityPrice, ChargeParam.SUBMIT);
chargeContext.setShipFeeRequird(true);
... ...
... ... @@ -11,6 +11,7 @@ import com.yoho.service.model.request.UserAddressReqBO;
import com.yoho.service.model.social.response.UserInfoRspBO;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.dal.user.model.ZhiMaCert;
import com.yohoufo.order.convert.AddressInfoConvertor;
import com.yohoufo.order.service.IStoredSellerService;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -206,4 +207,21 @@ public class UserProxyService extends AbsProxyService{
}
return result;
}
/**
* 获取用户实名认证信息
* @param uid
* @return
*/
public ZhiMaCert getRealNameInfo(int uid) {
try{
com.yoho.tools.common.beans.ApiResponse<ZhiMaCert> resp = ufoServiceCaller.call("ufo.user.zhiMaCertInfo", uid);
if (resp != null&&resp.getCode()==200 && resp.getData() != null) {
return (ZhiMaCert) resp.getData();
}
}catch(Exception e){
logger.warn("call getRealNameInfo fail, uid is {}, e is {}", uid, e);
}
return null;
}
}
... ...