Authored by chenchao

optimized : get hidden address by no hidden

@@ -206,13 +206,14 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -206,13 +206,14 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
206 } 206 }
207 207
208 //the address of send back 2 seller 208 //the address of send back 2 seller
209 - AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 209 +
210 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); 210 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId);
211 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){ 211 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){
212 logger.warn("submit appraise order addressId need update, uid {}, appraise {}, addressId {}", 212 logger.warn("submit appraise order addressId need update, uid {}, appraise {}, addressId {}",
213 uid, productId, addressId); 213 uid, productId, addressId);
214 throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE); 214 throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE);
215 } 215 }
  216 + AddressInfo hiddenBackAddress = UserProxyService.getHiddenAddressFromNotHidden(noHiddenBackAddress);
216 //dependency product service support produce data 217 //dependency product service support produce data
217 ProductInfo productInfo = productProxyService.getProductInfo(uid, productId); 218 ProductInfo productInfo = productProxyService.getProductInfo(uid, productId);
218 if (Objects.isNull(productInfo)){ 219 if (Objects.isNull(productInfo)){
@@ -1054,8 +1054,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -1054,8 +1054,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
1054 } 1054 }
1055 1055
1056 @Override 1056 @Override
1057 - public AddressInfo hiddenBackAddress(int uid, int addressId) {  
1058 - AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 1057 + public AddressInfo hiddenBackAddress(AddressInfo noHidden) {
  1058 + AddressInfo hiddenBackAddress = UserProxyService.getHiddenAddressFromNotHidden(noHidden);
1059 1059
1060 return hiddenBackAddress; 1060 return hiddenBackAddress;
1061 } 1061 }
@@ -5,6 +5,7 @@ import com.yoho.error.exception.ServiceException; @@ -5,6 +5,7 @@ import com.yoho.error.exception.ServiceException;
5 import com.yohobuy.ufo.model.order.vo.AddressInfo; 5 import com.yohobuy.ufo.model.order.vo.AddressInfo;
6 import com.yohoufo.common.utils.AddressUtil; 6 import com.yohoufo.common.utils.AddressUtil;
7 import com.yohoufo.order.constants.MetaKey; 7 import com.yohoufo.order.constants.MetaKey;
  8 +import com.yohoufo.order.service.proxy.UserProxyService;
8 import com.yohoufo.order.utils.LoggerUtils; 9 import com.yohoufo.order.utils.LoggerUtils;
9 import org.apache.commons.collections.CollectionUtils; 10 import org.apache.commons.collections.CollectionUtils;
10 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -30,8 +31,9 @@ public class MetaAddressService<E> { @@ -30,8 +31,9 @@ public class MetaAddressService<E> {
30 } 31 }
31 32
32 //the address of send back 2 seller 33 //the address of send back 2 seller
33 - AddressInfo hiddenBackAddress = callBack.hiddenBackAddress(uid, addressId); 34 +
34 AddressInfo noHiddenBackAddress = callBack.noHiddenBackAddress(uid, addressId); 35 AddressInfo noHiddenBackAddress = callBack.noHiddenBackAddress(uid, addressId);
  36 + AddressInfo hiddenBackAddress = callBack.hiddenBackAddress(noHiddenBackAddress);
35 final String key = MetaKey.RECALL_ADDRESS, hiiden_key = MetaKey.RECALL_HIDDEN_ADDRESS; 37 final String key = MetaKey.RECALL_ADDRESS, hiiden_key = MetaKey.RECALL_HIDDEN_ADDRESS;
36 E noHiddenAddressMeta= callBack.buildnoHiddenAddressMeta(uid, orderCode, key, noHiddenBackAddress); 38 E noHiddenAddressMeta= callBack.buildnoHiddenAddressMeta(uid, orderCode, key, noHiddenBackAddress);
37 39
@@ -85,7 +87,7 @@ public class MetaAddressService<E> { @@ -85,7 +87,7 @@ public class MetaAddressService<E> {
85 87
86 void updateMetaVal(E e); 88 void updateMetaVal(E e);
87 89
88 - AddressInfo hiddenBackAddress(int uid, int addressId); 90 + AddressInfo hiddenBackAddress(AddressInfo noHiddenAddress);
89 91
90 AddressInfo noHiddenBackAddress(int uid, int addressId); 92 AddressInfo noHiddenBackAddress(int uid, int addressId);
91 93
@@ -216,14 +216,14 @@ public class SellerBidPublishService { @@ -216,14 +216,14 @@ public class SellerBidPublishService {
216 } 216 }
217 217
218 //the address of send back 2 seller 218 //the address of send back 2 seller
219 - AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 219 +
220 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); 220 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId);
221 if (AddressHelper.isNeedUpdate(noHiddenBackAddress)) { 221 if (AddressHelper.isNeedUpdate(noHiddenBackAddress)) {
222 logger.warn("addressId need update, uid is {}, addressId is {}", 222 logger.warn("addressId need update, uid is {}, addressId is {}",
223 uid, addressId); 223 uid, addressId);
224 throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE); 224 throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE);
225 } 225 }
226 - 226 + AddressInfo hiddenBackAddress = UserProxyService.getHiddenAddressFromNotHidden(noHiddenBackAddress);
227 return Pair.of(noHiddenBackAddress, hiddenBackAddress); 227 return Pair.of(noHiddenBackAddress, hiddenBackAddress);
228 } 228 }
229 229
@@ -605,8 +605,7 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -605,8 +605,7 @@ public class ShoppingServiceImpl implements IShoppingService {
605 } 605 }
606 606
607 //脱敏的用户地址 607 //脱敏的用户地址
608 - AddressInfo hiddenAddress = userProxyService.getHiddenAddressInfo(shoppingRequest.getUid(), addressId);  
609 - 608 + AddressInfo hiddenAddress = UserProxyService.getHiddenAddressFromNotHidden(addressInfo);
610 return Pair.of(addressInfo, hiddenAddress); 609 return Pair.of(addressInfo, hiddenAddress);
611 } 610 }
612 611
@@ -22,6 +22,7 @@ import com.yohoufo.common.exception.UfoServiceException; @@ -22,6 +22,7 @@ import com.yohoufo.common.exception.UfoServiceException;
22 import com.yohoufo.dal.order.model.SellerOrderGoods; 22 import com.yohoufo.dal.order.model.SellerOrderGoods;
23 import com.yohoufo.order.convert.PrdPriceConvertor; 23 import com.yohoufo.order.convert.PrdPriceConvertor;
24 import com.yohoufo.order.convert.builder.AlarmEventBuilder; 24 import com.yohoufo.order.convert.builder.AlarmEventBuilder;
  25 +import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
25 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport; 26 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport;
26 import lombok.Data; 27 import lombok.Data;
27 import org.apache.commons.collections.CollectionUtils; 28 import org.apache.commons.collections.CollectionUtils;
@@ -248,8 +249,11 @@ public class ProductProxyService extends AbsProxyService{ @@ -248,8 +249,11 @@ public class ProductProxyService extends AbsProxyService{
248 } 249 }
249 250
250 public void addSalesInfo(Integer skup) { 251 public void addSalesInfo(Integer skup) {
  252 + Runnable addSalesTask = ()-> {
251 logger.info("order submit finished. 增加销量数据,skup= {}", skup); 253 logger.info("order submit finished. 增加销量数据,skup= {}", skup);
252 ufoServiceCaller.call("ufo.product.addSales", skup); 254 ufoServiceCaller.call("ufo.product.addSales", skup);
  255 + };
  256 + ThreadPoolFactory.getCommomExecutorService().execute(addSalesTask);
253 } 257 }
254 258
255 public StorageDataResp getStorageData(int storageId){ 259 public StorageDataResp getStorageData(int storageId){
@@ -11,6 +11,7 @@ import com.yoho.service.model.request.UserAddressReqBO; @@ -11,6 +11,7 @@ import com.yoho.service.model.request.UserAddressReqBO;
11 import com.yoho.service.model.social.response.UserInfoRspBO; 11 import com.yoho.service.model.social.response.UserInfoRspBO;
12 import com.yohobuy.ufo.model.order.vo.AddressInfo; 12 import com.yohobuy.ufo.model.order.vo.AddressInfo;
13 import com.yohoufo.common.ApiResponse; 13 import com.yohoufo.common.ApiResponse;
  14 +import com.yohoufo.common.utils.UserInfoHiddenHelper;
14 import com.yohoufo.dal.user.model.ZhiMaCert; 15 import com.yohoufo.dal.user.model.ZhiMaCert;
15 import com.yohoufo.order.convert.AddressInfoConvertor; 16 import com.yohoufo.order.convert.AddressInfoConvertor;
16 import com.yohoufo.order.service.IStoredSellerService; 17 import com.yohoufo.order.service.IStoredSellerService;
@@ -61,6 +62,38 @@ public class UserProxyService extends AbsProxyService{ @@ -61,6 +62,38 @@ public class UserProxyService extends AbsProxyService{
61 } 62 }
62 63
63 /** 64 /**
  65 + * {
  66 + * "address":"国家广告产业园5栋",
  67 + * "address_id":2394872,
  68 + * "area":"江苏省 南京市 建邺区 建邺区新城科技园",
  69 + * "areaCode":"320105400",
  70 + * "consignee":"陈超",
  71 + * "isUpdate":"N",
  72 + * "mobile":"18061464565",
  73 + * "phone":"null",
  74 + * "zipCode":"null"}
  75 + * @param noHiddenAddress
  76 + * @return
  77 + */
  78 + public static AddressInfo getHiddenAddressFromNotHidden(AddressInfo noHiddenAddress){
  79 + String address = UserInfoHiddenHelper.getHiddenAddress(noHiddenAddress.getAddress());
  80 + String consignee = UserInfoHiddenHelper.getHiddenUserNickName(noHiddenAddress.getConsignee());
  81 + String mobile = UserInfoHiddenHelper.hidePhoneNo(noHiddenAddress.getMobile());
  82 + //
  83 + AddressInfo hiddenAddress = new AddressInfo();
  84 + hiddenAddress.setAreaCode(noHiddenAddress.getAreaCode());
  85 + hiddenAddress.setArea(noHiddenAddress.getArea());
  86 + hiddenAddress.setAddress_id(noHiddenAddress.getAddress_id());
  87 + hiddenAddress.setIsUpdate(noHiddenAddress.getIsUpdate());
  88 +
  89 + //hidden
  90 + hiddenAddress.setAddress(address);
  91 + hiddenAddress.setConsignee(consignee);
  92 + hiddenAddress.setMobile(mobile);
  93 + return hiddenAddress;
  94 + }
  95 +
  96 + /**
64 * 获取用户信息 97 * 获取用户信息
65 * 地址不隐藏星号 98 * 地址不隐藏星号
66 * @param uid 99 * @param uid
@@ -534,8 +534,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -534,8 +534,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
534 } 534 }
535 535
536 @Override 536 @Override
537 - public AddressInfo hiddenBackAddress(int uid, int addressId) {  
538 - return userProxyService.getHiddenAddressInfo(uid, addressId); 537 + public AddressInfo hiddenBackAddress(AddressInfo noHidden) {
  538 + return UserProxyService.getHiddenAddressFromNotHidden(noHidden);
539 } 539 }
540 540
541 @Override 541 @Override
@@ -75,14 +75,14 @@ public class ImperfectPublishProcessor implements PublishProcessor<ImperfectOrde @@ -75,14 +75,14 @@ public class ImperfectPublishProcessor implements PublishProcessor<ImperfectOrde
75 } 75 }
76 76
77 //the address of send back 2 seller 77 //the address of send back 2 seller
78 - AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 78 +
79 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); 79 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId);
80 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){ 80 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){
81 logger.warn("seller submit addressId need update, uid is {}, storageId is {}, addressId is {}", 81 logger.warn("seller submit addressId need update, uid is {}, storageId is {}, addressId is {}",
82 uid, storageId, addressId); 82 uid, storageId, addressId);
83 throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE); 83 throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE);
84 } 84 }
85 - 85 + AddressInfo hiddenBackAddress = UserProxyService.getHiddenAddressFromNotHidden(noHiddenBackAddress);
86 ImperfectGoodsInfo imperfectGoodsInfo = checkImperfectGoodsInfo(iosr); 86 ImperfectGoodsInfo imperfectGoodsInfo = checkImperfectGoodsInfo(iosr);
87 87
88 //step 1: rpc get product detail by storage id 88 //step 1: rpc get product detail by storage id
@@ -106,14 +106,14 @@ public class SellerOrderPrepareProcessor @@ -106,14 +106,14 @@ public class SellerOrderPrepareProcessor
106 } 106 }
107 107
108 //the address of send back 2 seller 108 //the address of send back 2 seller
109 - AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 109 +
110 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); 110 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId);
111 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){ 111 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){
112 log.warn("seller submit addressId need update, uid is {}, storageId is {}, addressId is {}", 112 log.warn("seller submit addressId need update, uid is {}, storageId is {}, addressId is {}",
113 uid, storageId, addressId); 113 uid, storageId, addressId);
114 throw new UfoServiceException(400,"您的收货地址缺少所在地的街道信息,请更新收货地址"); 114 throw new UfoServiceException(400,"您的收货地址缺少所在地的街道信息,请更新收货地址");
115 } 115 }
116 - 116 + AddressInfo hiddenBackAddress = UserProxyService.getHiddenAddressFromNotHidden(noHiddenBackAddress);
117 Integer businessClientCode = OrderAssist.findBusinessClientCode(req.getBusinessClient()); 117 Integer businessClientCode = OrderAssist.findBusinessClientCode(req.getBusinessClient());
118 // 118 //
119 SellerOrderContext context = new SellerOrderContext(); 119 SellerOrderContext context = new SellerOrderContext();
@@ -387,7 +387,7 @@ public class ShoppingSupport { @@ -387,7 +387,7 @@ public class ShoppingSupport {
387 } 387 }
388 388
389 //脱敏的用户地址 389 //脱敏的用户地址
390 - AddressInfo hiddenAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 390 + AddressInfo hiddenAddress = UserProxyService.getHiddenAddressFromNotHidden(addressInfo);
391 391
392 return Pair.of(addressInfo, hiddenAddress); 392 return Pair.of(addressInfo, hiddenAddress);
393 } 393 }