Authored by chenchao

fix timeout of seller see buyer not pay order

@@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl; @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
2 2
3 import com.yohobuy.ufo.model.order.bo.ButtonShowBo; 3 import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
4 import com.yohobuy.ufo.model.order.bo.OrderInfo; 4 import com.yohobuy.ufo.model.order.bo.OrderInfo;
  5 +import com.yohobuy.ufo.model.order.common.OrderCodeType;
5 import com.yohobuy.ufo.model.order.common.OrderStatus; 6 import com.yohobuy.ufo.model.order.common.OrderStatus;
6 import com.yohobuy.ufo.model.order.common.SkupStatus; 7 import com.yohobuy.ufo.model.order.common.SkupStatus;
7 import com.yohobuy.ufo.model.order.common.TabType; 8 import com.yohobuy.ufo.model.order.common.TabType;
@@ -91,11 +92,32 @@ public abstract class AbsOrderViewService { @@ -91,11 +92,32 @@ public abstract class AbsOrderViewService {
91 return leftTime; 92 return leftTime;
92 } 93 }
93 94
  95 + Integer getPayLeftTime4Seller(OrderCodeType orderCodeType, Integer orderStatus, int createTime){
  96 + if (orderCodeType == null){
  97 + return null;
  98 + }
  99 + Integer leftTime = null;
  100 + Integer timeout = OrderInfo.PAY_TIME_SECOND;
  101 + if (orderCodeType == OrderCodeType.BUYER_TYPE){
  102 + timeout = OrderInfo.PAY_TIME_SECOND;
  103 + }
  104 + if (orderCodeType == OrderCodeType.SELLER_TYPE){
  105 + timeout = OrderInfo.SELLER_PAY_TIMEOUT;
  106 + }
  107 + boolean isFiredCal = (orderStatus == OrderStatus.WAITING_PAY.getCode())
  108 + || (orderStatus == SkupStatus.CAN_NOT_SELL.getCode());
  109 + if(isFiredCal){
  110 + leftTime = calLeftTime(timeout, createTime);
  111 + }
  112 + return leftTime;
  113 + }
  114 +
94 Integer getPayLeftTime(TabType actor, Integer orderStatus, int createTime){ 115 Integer getPayLeftTime(TabType actor, Integer orderStatus, int createTime){
95 boolean isBuyer = actor.equals(TabType.BUY); 116 boolean isBuyer = actor.equals(TabType.BUY);
96 boolean isSeller = actor.equals(TabType.SELL); 117 boolean isSeller = actor.equals(TabType.SELL);
97 Integer leftTime = null; 118 Integer leftTime = null;
98 int timeout = OrderInfo.PAY_TIME_SECOND; 119 int timeout = OrderInfo.PAY_TIME_SECOND;
  120 +
99 boolean isFiredCal = (isBuyer && orderStatus == OrderStatus.WAITING_PAY.getCode()) 121 boolean isFiredCal = (isBuyer && orderStatus == OrderStatus.WAITING_PAY.getCode())
100 || (isSeller && orderStatus == SkupStatus.CAN_NOT_SELL.getCode()); 122 || (isSeller && orderStatus == SkupStatus.CAN_NOT_SELL.getCode());
101 if(isFiredCal){ 123 if(isFiredCal){
@@ -292,8 +292,8 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -292,8 +292,8 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
292 .build(); 292 .build();
293 293
294 // 待付款时 或待发货,剩余时间 294 // 待付款时 或待发货,剩余时间
295 -  
296 - Integer leftTime = getPayLeftTime(TabType.SELL, skupStatus.getCode(), order.getCreateTime()); 295 + Integer leftTime = getPayLeftTime4Seller(OrderCodeType.SELLER_TYPE,
  296 + skupStatus.getCode(), order.getCreateTime());
297 statusDetail.setLeftTime(leftTime); 297 statusDetail.setLeftTime(leftTime);
298 298
299 return statusDetail; 299 return statusDetail;
@@ -341,7 +341,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -341,7 +341,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
341 orderDetailInfo.setUserAddress(addressInfo); 341 orderDetailInfo.setUserAddress(addressInfo);
342 //卖家 342 //卖家
343 assembleSoldPrdCompute(orderDetailInfo, order.getUid(), sellerOrderGoods.getId()); 343 assembleSoldPrdCompute(orderDetailInfo, order.getUid(), sellerOrderGoods.getId());
344 -  
345 OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, skupStatus); 344 OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, skupStatus);
346 345
347 if(SHOW_OVER_FLOW_PRICE_STATUS.contains(skupStatus.getCode())) { 346 if(SHOW_OVER_FLOW_PRICE_STATUS.contains(skupStatus.getCode())) {
@@ -404,12 +403,16 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -404,12 +403,16 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
404 403
405 @Override 404 @Override
406 protected void resetDynamicProporties(OrderDetailInfo orderDetailInfo) { 405 protected void resetDynamicProporties(OrderDetailInfo orderDetailInfo) {
407 -  
408 - Integer leftTime = getLeftTime(TabType.SELL, orderDetailInfo.getUid(), orderDetailInfo.getOrderCode(),  
409 - orderDetailInfo.getStatusDetail().getStatus(), orderDetailInfo.getSecendLevelCreateTime());  
410 - 406 + long orderCode = orderDetailInfo.getOrderCode();
  407 + CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
  408 + //TabType tabType = TabType.SELL;
  409 + Integer orderStatus = orderDetailInfo.getStatusDetail().getStatus();
  410 + if (codeMeta!=null) {
  411 + OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
  412 + Integer leftTime = getPayLeftTime4Seller(orderCodeType, orderStatus, orderDetailInfo.getSecendLevelCreateTime());
411 orderDetailInfo.getStatusDetail().setLeftTime(leftTime); 413 orderDetailInfo.getStatusDetail().setLeftTime(leftTime);
412 } 414 }
  415 + }
413 416
414 @Override 417 @Override
415 public ProductProxyService getProductProxyService() { 418 public ProductProxyService getProductProxyService() {
@@ -144,12 +144,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -144,12 +144,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
144 list.forEach(oli -> { 144 list.forEach(oli -> {
145 long orderCode = oli.getOrderCode(); 145 long orderCode = oli.getOrderCode();
146 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode); 146 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
147 - TabType tabType = TabType.SELL; 147 + //TabType tabType = TabType.SELL;
148 Integer orderStatus = oli.getStatus(); 148 Integer orderStatus = oli.getStatus();
149 - if (codeMeta!=null && codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){  
150 - tabType = TabType.BUY; 149 + if (codeMeta!=null){
  150 + OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
  151 + oli.setLeftTime(getPayLeftTime4Seller(orderCodeType, orderStatus, oli.getSecendLevelCreateTime()));
151 } 152 }
152 - oli.setLeftTime(getPayLeftTime(tabType, orderStatus, oli.getSecendLevelCreateTime())); 153 +
153 154
154 if(SellerOrderListType.WAITING_PAY.getType() == type) { 155 if(SellerOrderListType.WAITING_PAY.getType() == type) {
155 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(oli.getBuyerUid(), oli.getOrderCode()); 156 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(oli.getBuyerUid(), oli.getOrderCode());