Authored by chenchao

support query shipfee by user address

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField; @@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField;
4 import lombok.Getter; 4 import lombok.Getter;
5 import lombok.Setter; 5 import lombok.Setter;
6 6
  7 +import java.math.BigDecimal;
  8 +
7 /** 9 /**
8 * Created by li.ma on 2018/9/27. 10 * Created by li.ma on 2018/9/27.
9 */ 11 */
@@ -21,6 +23,9 @@ public class AppraiseAddressResp { @@ -21,6 +23,9 @@ public class AppraiseAddressResp {
21 23
22 @JSONField(name="id") 24 @JSONField(name="id")
23 private Integer type; 25 private Integer type;
  26 +
  27 + @Getter@Setter
  28 + private BigDecimal shipFee;
24 /** 29 /**
25 * 是否变更 30 * 是否变更
26 */ 31 */
@@ -81,19 +81,11 @@ public interface IExpressInfoService { @@ -81,19 +81,11 @@ public interface IExpressInfoService {
81 AppraiseAddressResp noticeAppraiseAddressChanged(Integer uid, Long orderCode); 81 AppraiseAddressResp noticeAppraiseAddressChanged(Integer uid, Long orderCode);
82 82
83 83
84 - /**  
85 - * 根据订单号获取快递类型  
86 - * 1:卖家到鉴定中心  
87 - * 2:鉴定中心到买家  
88 - * 3:鉴定中心退回到卖家  
89 - *  
90 - * @param orderCode  
91 - * @return  
92 - */  
93 - //Integer getExpressType(Long orderCode); 84 +
  85 + AppraiseAddressResp queryByUserAddress(int uid,String addressId);
  86 +
94 87
95 88
96 - //ExpressInfoRespBo queryLastExpressDetailInfo(Long orderCode,int type);  
97 89
98 ExpressInfoDetail getLastExpressInfoDetail(TabType actor,int status, Long orderCode); 90 ExpressInfoDetail getLastExpressInfoDetail(TabType actor,int status, Long orderCode);
99 91
@@ -20,6 +20,7 @@ import com.yohoufo.common.alarm.EventBusPublisher; @@ -20,6 +20,7 @@ import com.yohoufo.common.alarm.EventBusPublisher;
20 import com.yohoufo.common.caller.UfoServiceCaller; 20 import com.yohoufo.common.caller.UfoServiceCaller;
21 import com.yohoufo.common.constant.ExpressInfoConstant; 21 import com.yohoufo.common.constant.ExpressInfoConstant;
22 import com.yohoufo.common.exception.UfoServiceException; 22 import com.yohoufo.common.exception.UfoServiceException;
  23 +import com.yohoufo.common.utils.AddressUtil;
23 import com.yohoufo.common.utils.DateUtil; 24 import com.yohoufo.common.utils.DateUtil;
24 import com.yohoufo.common.utils.UserInfoHiddenHelper; 25 import com.yohoufo.common.utils.UserInfoHiddenHelper;
25 import com.yohoufo.dal.order.*; 26 import com.yohoufo.dal.order.*;
@@ -37,6 +38,7 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder; @@ -37,6 +38,7 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder;
37 import com.yohoufo.order.service.proxy.InBoxFacade; 38 import com.yohoufo.order.service.proxy.InBoxFacade;
38 import com.yohoufo.order.service.proxy.OrderStatusFlowService; 39 import com.yohoufo.order.service.proxy.OrderStatusFlowService;
39 import com.yohoufo.order.service.proxy.ProductProxyService; 40 import com.yohoufo.order.service.proxy.ProductProxyService;
  41 +import com.yohoufo.order.service.proxy.UserProxyService;
40 import com.yohoufo.order.service.seller.setting.SellerService; 42 import com.yohoufo.order.service.seller.setting.SellerService;
41 import com.yohoufo.order.service.seller.setting.SellerWrapper; 43 import com.yohoufo.order.service.seller.setting.SellerWrapper;
42 import org.apache.commons.collections.CollectionUtils; 44 import org.apache.commons.collections.CollectionUtils;
@@ -111,6 +113,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -111,6 +113,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
111 @Autowired 113 @Autowired
112 private IBuyerOrderMetaService buyerOrderMetaService; 114 private IBuyerOrderMetaService buyerOrderMetaService;
113 115
  116 + @Autowired
  117 + private UserProxyService userProxyService;
  118 +
114 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data"; 119 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
115 120
116 //物流文案设置 121 //物流文案设置
@@ -1120,5 +1125,33 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -1120,5 +1125,33 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
1120 return resp; 1125 return resp;
1121 } 1126 }
1122 1127
  1128 + @Override
  1129 + public AppraiseAddressResp queryByUserAddress(int uid, String addressIdStr) {
  1130 + int addressId = AddressUtil.getDecryptStr(addressIdStr);
  1131 + if (addressId < 0){
  1132 + LOGGER.warn("queryByUserAddess addressId invalidate, uid {}, addressId is {}",
  1133 + uid, addressIdStr);
  1134 + throw new ServiceException(ServiceError.ORDER_ADDRESSID_INVALIDATE);
  1135 + }
  1136 +
  1137 + //query the address
  1138 + AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId);
  1139 + // 根据用户id查询默认地址的省份
  1140 + AppraiseAddressResp resp = null;
  1141 + if (null != hiddenBackAddress ) {
  1142 + // 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
  1143 + AppraiseAddress address = appraiseAddressService.queryAppraiseAddressByAreaCode(hiddenBackAddress.getAreaCode());
  1144 +
  1145 + resp = new AppraiseAddressResp.builder().setAreaCode(address.getAreaCode()).build();
  1146 + resp.setShipFee(address.getShipFee());
  1147 + LOGGER.info("In queryByUserAddess hiddenBackAddress success, uid {} addressIdStr {}, AppraiseAddressResp",
  1148 + uid, addressIdStr, resp);
  1149 + }else {
  1150 + LOGGER.warn("In queryByUserAddess hiddenBackAddress is null, uid {} addressIdStr {}", uid, addressIdStr);
  1151 + }
  1152 +
  1153 + return resp;
  1154 + }
  1155 +
1123 1156
1124 } 1157 }