Authored by chenchao

Merge branch 'test6.8.6' into dev_order_6.8.6

@@ -110,7 +110,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -110,7 +110,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
110 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); 110 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
111 } 111 }
112 112
113 - if(orderStatus.getCode() == OrderStatus.HAS_PAYED.getCode() || orderStatus.getCode() == OrderStatus.SEND_OUT_TIMEOUT.getCode()){ 113 + /*if(orderStatus.getCode() == OrderStatus.HAS_PAYED.getCode() || orderStatus.getCode() == OrderStatus.SEND_OUT_TIMEOUT.getCode()){
114 TimeoutBo timeoutBo = ordersPayService.getDeliverLeftTime(uid, orderCode); 114 TimeoutBo timeoutBo = ordersPayService.getDeliverLeftTime(uid, orderCode);
115 if(timeoutBo!=null && timeoutBo.getTimelimit().intValue() != DelayTime.MINUTES_36_HOURS * 60 115 if(timeoutBo!=null && timeoutBo.getTimelimit().intValue() != DelayTime.MINUTES_36_HOURS * 60
116 && timeoutBo.getStartTime()!=null && timeoutBo.getStartTime().intValue()>=deliveryMinutesService.getOnlineTime()){ 116 && timeoutBo.getStartTime()!=null && timeoutBo.getStartTime().intValue()>=deliveryMinutesService.getOnlineTime()){
@@ -118,7 +118,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -118,7 +118,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
118 buyerUid, orderCode); 118 buyerUid, orderCode);
119 OrderStatus.resetDescForSeller(orderStatus); 119 OrderStatus.resetDescForSeller(orderStatus);
120 } 120 }
121 - } 121 + }*/
122 122
123 BuyerOrderGoods buyerOrderGoods = getBuyerOrderGoods(buyerUid, orderCode); 123 BuyerOrderGoods buyerOrderGoods = getBuyerOrderGoods(buyerUid, orderCode);
124 if (buyerOrderGoods == null){ 124 if (buyerOrderGoods == null){
@@ -24,10 +24,12 @@ import com.yohoufo.order.model.dto.SellerOrderComputeResult; @@ -24,10 +24,12 @@ import com.yohoufo.order.model.dto.SellerOrderComputeResult;
24 import com.yohoufo.order.model.request.OrderRequest; 24 import com.yohoufo.order.model.request.OrderRequest;
25 import com.yohoufo.order.model.response.GoodsInfo; 25 import com.yohoufo.order.model.response.GoodsInfo;
26 import com.yohoufo.order.model.response.OrderDetailInfo; 26 import com.yohoufo.order.model.response.OrderDetailInfo;
  27 +import com.yohoufo.order.mq.DelayTime;
27 import com.yohoufo.order.service.AbsSellerOrderViewService; 28 import com.yohoufo.order.service.AbsSellerOrderViewService;
28 import com.yohoufo.order.service.IOrderDetailService; 29 import com.yohoufo.order.service.IOrderDetailService;
29 import com.yohoufo.order.service.cache.OrderCacheService; 30 import com.yohoufo.order.service.cache.OrderCacheService;
30 import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor; 31 import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
  32 +import com.yohoufo.order.service.proxy.DeliveryMinutesService;
31 import com.yohoufo.order.service.proxy.ProductProxyService; 33 import com.yohoufo.order.service.proxy.ProductProxyService;
32 import com.yohoufo.order.service.proxy.UserProxyService; 34 import com.yohoufo.order.service.proxy.UserProxyService;
33 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 35 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
@@ -89,6 +91,10 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -89,6 +91,10 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
89 @Autowired 91 @Autowired
90 private SellerOrderPrepareProcessor sellerOrderPrepareProcessor; 92 private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
91 93
  94 +
  95 + @Autowired
  96 + private DeliveryMinutesService deliveryMinutesService;
  97 +
92 private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL, 98 private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,
93 SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL, 99 SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,
94 SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL); 100 SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL);
@@ -387,6 +393,19 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -387,6 +393,19 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
387 .statuStr(orderStatus.getStatusStr(tabType)) 393 .statuStr(orderStatus.getStatusStr(tabType))
388 .detailDesc(orderStatus.getDetailDesc(tabType)) 394 .detailDesc(orderStatus.getDetailDesc(tabType))
389 .build(); 395 .build();
  396 +
  397 + if(orderStatus.getCode() == OrderStatus.HAS_PAYED.getCode() || orderStatus.getCode() == OrderStatus.SEND_OUT_TIMEOUT.getCode()){
  398 + TimeoutBo timeoutBo = ordersPayService.getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode());
  399 + if(timeoutBo!=null && timeoutBo.getTimelimit().intValue() != DelayTime.MINUTES_36_HOURS * 60
  400 + && timeoutBo.getStartTime()!=null && timeoutBo.getStartTime().intValue()>=deliveryMinutesService.getOnlineTime()){
  401 + logger.info("getStatusDetail resetDescForSeller , buyerUid {} orderCode is {},statusDetail {}", buyerOrder.getUid(),
  402 + buyerOrder.getOrderCode(),statusDetail);
  403 + statusDetail.setDetailDesc(statusDetail.getDetailDesc().replace("36","120"));
  404 + logger.info("getStatusDetail resetDescForSeller after, buyerUid {} orderCode is {},statusDetail {}", buyerOrder.getUid(),
  405 + buyerOrder.getOrderCode(),statusDetail);
  406 + }
  407 + }
  408 +
390 if(orderStatus == OrderStatus.HAS_PAYED){ 409 if(orderStatus == OrderStatus.HAS_PAYED){
391 Integer deliverLeftTime = getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode(), buyerOrder.getStatus()); 410 Integer deliverLeftTime = getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode(), buyerOrder.getStatus());
392 if (deliverLeftTime != null){ 411 if (deliverLeftTime != null){
1 package com.yohoufo.order.service.proxy; 1 package com.yohoufo.order.service.proxy;
2 2
  3 +import com.google.common.cache.Cache;
  4 +import com.google.common.cache.CacheBuilder;
  5 +import com.google.common.collect.Lists;
  6 +import com.yoho.core.cache.LocalCache;
3 import com.yoho.core.config.ConfigReader; 7 import com.yoho.core.config.ConfigReader;
  8 +import com.yohobuy.ufo.model.order.resp.ExpressCompanyRespBo;
  9 +import com.yohoufo.common.utils.OrikaUtils;
  10 +import com.yohoufo.dal.order.model.ExpressCompany;
  11 +import com.yohoufo.order.model.bo.TradeBillsSummaryBo;
  12 +import com.yohoufo.order.model.response.AppraiseAddressResp;
  13 +import com.yohoufo.order.service.impl.AppraiseAddressService;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
4 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.stereotype.Component; 17 import org.springframework.stereotype.Component;
6 18
  19 +import javax.annotation.PostConstruct;
  20 +import java.util.List;
  21 +import java.util.concurrent.TimeUnit;
  22 +
7 /** 23 /**
8 * 动态获取发货时间 24 * 动态获取发货时间
9 */ 25 */
10 @Component 26 @Component
11 public class DeliveryMinutesService { 27 public class DeliveryMinutesService {
  28 + private static final Logger logger = LoggerFactory.getLogger(DeliveryMinutesService.class);
12 @Autowired 29 @Autowired
13 private ConfigReader configReader; 30 private ConfigReader configReader;
14 31
  32 + //缓存
  33 + private LocalCache localCache_onlineTime = new LocalCache();
  34 + private static final String ONLINE_TIME_CACHE_KEY = "sellerDeliverNewOnlineTimeCacheKey";
  35 +
  36 + private LocalCache localCache_second = new LocalCache();
  37 + private static final String SECOND_CACHE_KEY = "sellerDeliverNoticeSecondCacheKey";
  38 +
  39 + private LocalCache localCache_third = new LocalCache();
  40 + private static final String THIRD_CACHE_KEY = "sellerDeliverNoticeThirdCacheKey";
  41 +
  42 + @PostConstruct
  43 + private void init() {
  44 + localCache_onlineTime.init(ONLINE_TIME_CACHE_KEY, 8, TimeUnit.HOURS, (String s, Object o) -> {
  45 + logger.info("init ONLINE_TIME_CACHE_KEY s = {}, o = {}", s, o);
  46 + return configReader.getInt("ufo.order.sellerDeliverNewOnlineTime",1548756000);
  47 + });
  48 +
  49 + localCache_second.init(SECOND_CACHE_KEY, 9, TimeUnit.HOURS, (String s, Object o) -> {
  50 + logger.info("init SECOND_CACHE_KEY s = {}, o = {}", s, o);
  51 + return configReader.getInt("ufo.order.sellerDeliverNoticeSecond",108*60);
  52 + });
  53 +
  54 + localCache_third.init(THIRD_CACHE_KEY, 10, TimeUnit.HOURS, (String s, Object o) -> {
  55 + logger.info("init THIRD_CACHE_KEY s = {}, o = {}", s, o);
  56 + return configReader.getInt("ufo.order.sellerDeliverNoticeThird",120*60);
  57 + });
  58 + }
  59 +
15 public int getDeliverMinutesSecond(){ 60 public int getDeliverMinutesSecond(){
16 - return configReader.getInt("ufo.order.sellerDeliverNoticeSecond",108*60); 61 + Object value=localCache_second.get(SECOND_CACHE_KEY);
  62 + if(null == value) {
  63 + return 108*60;
  64 + }
  65 + return (Integer) value;
17 } 66 }
18 67
19 public int getDeliverMinutesThird(){ 68 public int getDeliverMinutesThird(){
20 - return configReader.getInt("ufo.order.sellerDeliverNoticeThird",120*60); 69 + Object value=localCache_third.get(THIRD_CACHE_KEY);
  70 + if(null == value) {
  71 + return 120*60;
  72 + }
  73 + return (Integer) value;
21 } 74 }
22 75
23 /** 76 /**
@@ -31,7 +84,11 @@ public class DeliveryMinutesService { @@ -31,7 +84,11 @@ public class DeliveryMinutesService {
31 84
32 //上线时间 : 新的时间戳 85 //上线时间 : 新的时间戳
33 public int getOnlineTime(){ 86 public int getOnlineTime(){
34 - return configReader.getInt("ufo.order.sellerDeliverNewOnlineTime",1548756000); 87 + Object value=localCache_onlineTime.get(ONLINE_TIME_CACHE_KEY);
  88 + if(null == value) {
  89 + return 1548756000;
  90 + }
  91 + return (Integer) value;
35 } 92 }
36 93
37 94