Authored by tanling

订单详情显示鉴定中心

  1 +package com.yohoufo.order.model.response;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Data;
  5 +import lombok.NoArgsConstructor;
  6 +import lombok.experimental.Builder;
  7 +
  8 +@Builder
  9 +@Data
  10 +@AllArgsConstructor
  11 +@NoArgsConstructor
  12 +public class AppraiseAddressInfo {
  13 +
  14 + String addressName;
  15 +
  16 + String mobile;
  17 +
  18 + String address;
  19 +
  20 +}
@@ -42,6 +42,11 @@ public class OrderDetailInfo { @@ -42,6 +42,11 @@ public class OrderDetailInfo {
42 * 卖家:寄回地址 42 * 卖家:寄回地址
43 */ 43 */
44 private AddressInfo userAddress; 44 private AddressInfo userAddress;
  45 +
  46 + /**
  47 + * 卖家指定的鉴定中心地址
  48 + */
  49 + AppraiseAddressInfo appraiseAddress;
45 /** 50 /**
46 * 按钮显示 51 * 按钮显示
47 */ 52 */
@@ -102,6 +107,7 @@ public class OrderDetailInfo { @@ -102,6 +107,7 @@ public class OrderDetailInfo {
102 107
103 private Integer attributes; 108 private Integer attributes;
104 109
  110 +
105 @Builder 111 @Builder
106 @Data 112 @Data
107 @AllArgsConstructor 113 @AllArgsConstructor
@@ -20,6 +20,7 @@ import com.yohoufo.order.constants.ViewType; @@ -20,6 +20,7 @@ import com.yohoufo.order.constants.ViewType;
20 import com.yohoufo.order.convert.GoodsInfoConvertor; 20 import com.yohoufo.order.convert.GoodsInfoConvertor;
21 import com.yohoufo.order.model.request.OrderRequest; 21 import com.yohoufo.order.model.request.OrderRequest;
22 import com.yohobuy.ufo.model.order.bo.GoodsInfo; 22 import com.yohobuy.ufo.model.order.bo.GoodsInfo;
  23 +import com.yohoufo.order.model.response.AppraiseAddressInfo;
23 import com.yohoufo.order.model.response.OrderDetailInfo; 24 import com.yohoufo.order.model.response.OrderDetailInfo;
24 import com.yohoufo.order.service.IExpressInfoService; 25 import com.yohoufo.order.service.IExpressInfoService;
25 import com.yohoufo.order.service.IOrderDetailService; 26 import com.yohoufo.order.service.IOrderDetailService;
@@ -57,6 +58,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -57,6 +58,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
57 58
58 abstract ExpressInfoDetail getExpressInfoDetail(OrderStatus orderStatus, long orderCode); 59 abstract ExpressInfoDetail getExpressInfoDetail(OrderStatus orderStatus, long orderCode);
59 60
  61 + abstract AppraiseAddressInfo getAppraiseAddress(Integer depotNo, String areaCode);
60 62
61 abstract AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup); 63 abstract AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup);
62 64
@@ -135,6 +137,8 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -135,6 +137,8 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
135 137
136 OrderDetailInfo orderDetailInfo = buildOrderDetail(buildNode, actor); 138 OrderDetailInfo orderDetailInfo = buildOrderDetail(buildNode, actor);
137 139
  140 + orderDetailInfo.setAppraiseAddress(getAppraiseAddress(sellerOrderGoods.getDepotNo(), userAddress.getAreaCode()));
  141 +
138 return orderDetailInfo; 142 return orderDetailInfo;
139 143
140 } 144 }
@@ -19,6 +19,7 @@ import com.yohoufo.dal.order.model.BuyerOrderMeta; @@ -19,6 +19,7 @@ import com.yohoufo.dal.order.model.BuyerOrderMeta;
19 import com.yohoufo.dal.order.model.SellerOrderGoods; 19 import com.yohoufo.dal.order.model.SellerOrderGoods;
20 import com.yohoufo.order.common.ActionStatusHold; 20 import com.yohoufo.order.common.ActionStatusHold;
21 import com.yohoufo.order.constants.MetaKey; 21 import com.yohoufo.order.constants.MetaKey;
  22 +import com.yohoufo.order.model.response.AppraiseAddressInfo;
22 import com.yohoufo.order.model.response.OrderDetailInfo; 23 import com.yohoufo.order.model.response.OrderDetailInfo;
23 import com.yohoufo.order.service.IOrderDetailService; 24 import com.yohoufo.order.service.IOrderDetailService;
24 import com.yohoufo.order.service.handler.BuyerOrderButtonsHandler; 25 import com.yohoufo.order.service.handler.BuyerOrderButtonsHandler;
@@ -103,6 +104,12 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO @@ -103,6 +104,12 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
103 } 104 }
104 105
105 @Override 106 @Override
  107 + AppraiseAddressInfo getAppraiseAddress(Integer depotNo, String areaCode) {
  108 + return null;
  109 + }
  110 +
  111 +
  112 + @Override
106 AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup) { 113 AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup) {
107 BuyerOrderMeta buyerOrderMeta = getBuyerOrderMeta(uid, 114 BuyerOrderMeta buyerOrderMeta = getBuyerOrderMeta(uid,
108 orderCode, MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS); 115 orderCode, MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS);
@@ -21,6 +21,8 @@ import com.yohoufo.order.convert.GoodsInfoConvertor; @@ -21,6 +21,8 @@ import com.yohoufo.order.convert.GoodsInfoConvertor;
21 import com.yohoufo.order.convert.SellerOrderConvertor; 21 import com.yohoufo.order.convert.SellerOrderConvertor;
22 import com.yohoufo.order.model.dto.SellerOrderComputeResult; 22 import com.yohoufo.order.model.dto.SellerOrderComputeResult;
23 import com.yohoufo.order.model.request.OrderRequest; 23 import com.yohoufo.order.model.request.OrderRequest;
  24 +import com.yohoufo.order.model.response.AppraiseAddressInfo;
  25 +import com.yohoufo.order.model.response.AppraiseAddressResp;
24 import com.yohoufo.order.model.response.OrderDetailInfo; 26 import com.yohoufo.order.model.response.OrderDetailInfo;
25 import com.yohoufo.order.mq.DelayTime; 27 import com.yohoufo.order.mq.DelayTime;
26 import com.yohoufo.order.service.AbsSellerOrderViewService; 28 import com.yohoufo.order.service.AbsSellerOrderViewService;
@@ -42,6 +44,8 @@ import org.springframework.stereotype.Service; @@ -42,6 +44,8 @@ import org.springframework.stereotype.Service;
42 44
43 import java.math.BigDecimal; 45 import java.math.BigDecimal;
44 import java.util.*; 46 import java.util.*;
  47 +import java.util.function.Function;
  48 +import java.util.stream.Collectors;
45 49
46 /** 50 /**
47 * Created by chenchao on 2018/9/20. 51 * Created by chenchao on 2018/9/20.
@@ -90,6 +94,47 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -90,6 +94,47 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
90 @Autowired 94 @Autowired
91 private OrderOverTimeService orderOverTimeService; 95 private OrderOverTimeService orderOverTimeService;
92 96
  97 + @Autowired
  98 + private AppraiseAddressService appraiseAddressService;
  99 +
  100 +
  101 + /**
  102 + * 根据指定的鉴定中心返回地址详情
  103 + * @param areaCode
  104 + * @return
  105 + */
  106 + public AppraiseAddressInfo getAppraiseAddress(Integer depotno, String areaCode){
  107 +
  108 + // 卖家已经发货选定了鉴定中心
  109 + if (depotno != null){
  110 + List<AppraiseAddressResp> addressRespList = appraiseAddressService.queryAddressInfoList();
  111 + Map<Integer, AppraiseAddressResp> addressRespMap = addressRespList.stream()
  112 + .collect(Collectors.toMap(AppraiseAddressResp::getType, Function.identity(), (key1, key2)-> key1));
  113 + AppraiseAddressResp addressResp = addressRespMap.get(depotno);
  114 +
  115 + if (addressResp != null){
  116 + return AppraiseAddressInfo.builder()
  117 + .address(addressResp.getAddress())
  118 + .addressName(addressResp.getAddressName())
  119 + .mobile(addressResp.getMobile()).build();
  120 + }
  121 + }
  122 +
  123 + // 卖家未发货的情况,根据寄回地址就近选中一个鉴定中心
  124 + if (StringUtils.isNoneBlank(areaCode)){
  125 + AppraiseAddressResp addressResp = appraiseAddressService.queryAddressByAreaCode(areaCode);
  126 +
  127 + if (addressResp != null){
  128 + return AppraiseAddressInfo.builder()
  129 + .address(addressResp.getAddress())
  130 + .addressName(addressResp.getAddressName())
  131 + .mobile(addressResp.getMobile()).build();
  132 + }
  133 + }
  134 +
  135 + return null;
  136 + }
  137 +
93 138
94 139
95 140