Authored by chenchao

fix bug 5123

@@ -34,6 +34,7 @@ public class ActionStatusHold { @@ -34,6 +34,7 @@ public class ActionStatusHold {
34 SHOW_BUYER_DELIVER_EXPRESS_STATUS_LIST = Arrays.asList( 34 SHOW_BUYER_DELIVER_EXPRESS_STATUS_LIST = Arrays.asList(
35 OrderStatus.SELLER_SEND_OUT.getCode(), 35 OrderStatus.SELLER_SEND_OUT.getCode(),
36 OrderStatus.PLATFORM_CHECKING.getCode(), 36 OrderStatus.PLATFORM_CHECKING.getCode(),
  37 + OrderStatus.CHECKING_FAKE.getCode(),
37 OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode() 38 OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()
38 ); 39 );
39 } 40 }
@@ -65,7 +66,7 @@ public class ActionStatusHold { @@ -65,7 +66,7 @@ public class ActionStatusHold {
65 return BuyerASH.SHOW_EXPRESS_STATUS_LIST; 66 return BuyerASH.SHOW_EXPRESS_STATUS_LIST;
66 } 67 }
67 68
68 - public static boolean buyerCanShowBuyerDeliverExpressStatusList(Integer status){ 69 + public static boolean buyerCanShowSellerDeliverExpressStatusList(Integer status){
69 return BuyerASH.SHOW_BUYER_DELIVER_EXPRESS_STATUS_LIST.contains(status); 70 return BuyerASH.SHOW_BUYER_DELIVER_EXPRESS_STATUS_LIST.contains(status);
70 } 71 }
71 72
@@ -2,6 +2,7 @@ package com.yohoufo.order.service; @@ -2,6 +2,7 @@ package com.yohoufo.order.service;
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.common.TabType; 4 import com.yohobuy.ufo.model.order.common.TabType;
  5 +import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
5 import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo; 6 import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
6 import com.yohoufo.common.constant.ExpressInfoConstant; 7 import com.yohoufo.common.constant.ExpressInfoConstant;
7 import com.yohoufo.order.common.ActionStatusHold; 8 import com.yohoufo.order.common.ActionStatusHold;
@@ -85,6 +86,7 @@ public interface IExpressInfoService { @@ -85,6 +86,7 @@ public interface IExpressInfoService {
85 86
86 ExpressInfoRespBo queryLastExpressDetailInfo(Long orderCode,int type); 87 ExpressInfoRespBo queryLastExpressDetailInfo(Long orderCode,int type);
87 88
  89 + ExpressInfoDetail getLastExpressInfoDetail(TabType actor,int status, Long orderCode);
88 /** 90 /**
89 * orderCode 一定是买家订单号 91 * orderCode 一定是买家订单号
90 * @return 92 * @return
@@ -144,10 +146,10 @@ public interface IExpressInfoService { @@ -144,10 +146,10 @@ public interface IExpressInfoService {
144 return types; 146 return types;
145 } 147 }
146 148
147 - default Integer getExpressTypeBuyer(Integer status){  
148 - if (ActionStatusHold.buyerCanShowBuyerDeliverExpressStatusList(status)){  
149 - return ExpressInfoConstant.EXPRESS_TYPE_1; 149 + default List<Integer> getExpressType4Buyer(Integer status){
  150 + if (ActionStatusHold.buyerCanShowSellerDeliverExpressStatusList(status)){
  151 + return Arrays.asList(ExpressInfoConstant.EXPRESS_TYPE_1);
150 } 152 }
151 - return ExpressInfoConstant.EXPRESS_TYPE_2; 153 + return Arrays.asList(ExpressInfoConstant.EXPRESS_TYPE_2,ExpressInfoConstant.EXPRESS_TYPE_1);
152 } 154 }
153 } 155 }
@@ -88,17 +88,8 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO @@ -88,17 +88,8 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
88 if (!ActionStatusHold.getBuyerShowExpressStatusList().contains(orderStatus.getCode())){ 88 if (!ActionStatusHold.getBuyerShowExpressStatusList().contains(orderStatus.getCode())){
89 return null; 89 return null;
90 } 90 }
91 - Integer type = expressInfoService.getExpressTypeBuyer(orderStatus.getCode());  
92 - ExpressInfoDetail lastEID = null;  
93 - ExpressInfoRespBo expressInfoResp = expressInfoService.queryLastExpressDetailInfo(orderCode, type);  
94 - List<ExpressInfoDetail> eidList;  
95 - if (Objects.nonNull(expressInfoResp)  
96 - && Objects.nonNull(eidList=expressInfoResp.getExpressInfoDetailList())  
97 - && eidList.size() > 0  
98 - ){  
99 -  
100 - lastEID = eidList.get(0);  
101 - } 91 + ExpressInfoDetail lastEID = expressInfoService.getLastExpressInfoDetail(TabType.BUY, orderStatus.getCode(),
  92 + orderCode);
102 return lastEID; 93 return lastEID;
103 } 94 }
104 95
@@ -38,6 +38,7 @@ import java.util.ArrayList; @@ -38,6 +38,7 @@ import java.util.ArrayList;
38 import java.util.Arrays; 38 import java.util.Arrays;
39 import java.util.List; 39 import java.util.List;
40 import java.util.Objects; 40 import java.util.Objects;
  41 +import java.util.stream.Collectors;
41 42
42 /** 43 /**
43 * @author kun.wang 44 * @author kun.wang
@@ -338,6 +339,35 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -338,6 +339,35 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
338 return expressInfoRespBo; 339 return expressInfoRespBo;
339 } 340 }
340 341
  342 + @Override
  343 + public ExpressInfoDetail getLastExpressInfoDetail(TabType actor, int status, Long orderCode) {
  344 + List<Integer> types = null;
  345 + if(actor == TabType.SELL){
  346 + types = getExpressTypes4Seller(status);
  347 + }
  348 + if (actor == TabType.BUY){
  349 + types = getExpressType4Buyer(status);
  350 + }
  351 + if (CollectionUtils.isEmpty(types)){
  352 + return null;
  353 + }
  354 + //from big 2 small
  355 + List<Integer> sortedTypes = types.stream().sorted((o1,o2)-> o2-o1).collect(Collectors.toList());
  356 + ExpressInfoDetail lastEID = null;
  357 + for(Integer type : sortedTypes){
  358 + ExpressInfoRespBo expressInfoResp = queryLastExpressDetailInfo(orderCode, type);
  359 + List<ExpressInfoDetail> eidList;
  360 + if (Objects.nonNull(expressInfoResp)
  361 + && Objects.nonNull(eidList=expressInfoResp.getExpressInfoDetailList())
  362 + && eidList.size() > 0
  363 + ){
  364 + lastEID = eidList.get(0);
  365 + break;
  366 + }
  367 + }
  368 + return lastEID;
  369 + }
  370 +
341 371
342 /** 372 /**
343 * @param expressInfoList 373 * @param expressInfoList
@@ -183,24 +183,8 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -183,24 +183,8 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
183 if (!ActionStatusHold.getSellerShowExpressStatusList().contains(orderStatus.getCode())){ 183 if (!ActionStatusHold.getSellerShowExpressStatusList().contains(orderStatus.getCode())){
184 return null; 184 return null;
185 } 185 }
186 - List<Integer> types = expressInfoService.getExpressTypes4Seller(orderStatus.getCode());  
187 - if (CollectionUtils.isEmpty(types)){  
188 - return null;  
189 - }  
190 - //from big 2 small  
191 - List<Integer> sortedTypes = types.stream().sorted((o1,o2)-> o2-o1).collect(Collectors.toList());  
192 - ExpressInfoDetail lastEID = null;  
193 - for(Integer type : sortedTypes){  
194 - ExpressInfoRespBo expressInfoResp = expressInfoService.queryLastExpressDetailInfo(orderCode, type);  
195 - List<ExpressInfoDetail> eidList;  
196 - if (Objects.nonNull(expressInfoResp)  
197 - && Objects.nonNull(eidList=expressInfoResp.getExpressInfoDetailList())  
198 - && eidList.size() > 0  
199 - ){  
200 - lastEID = eidList.get(0);  
201 - break;  
202 - }  
203 - } 186 + ExpressInfoDetail lastEID = expressInfoService.getLastExpressInfoDetail(TabType.SELL,orderStatus.getCode(),
  187 + orderCode);
204 return lastEID; 188 return lastEID;
205 } 189 }
206 190