Authored by tanling

button show leftTime

@@ -11,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils; @@ -11,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils;
11 import org.slf4j.Logger; 11 import org.slf4j.Logger;
12 12
13 import java.math.BigDecimal; 13 import java.math.BigDecimal;
  14 +import java.util.ArrayList;
14 import java.util.Arrays; 15 import java.util.Arrays;
15 import java.util.List; 16 import java.util.List;
16 17
@@ -52,17 +53,17 @@ public interface AbsSellerOrderViewService { @@ -52,17 +53,17 @@ public interface AbsSellerOrderViewService {
52 // 按钮显示 53 // 按钮显示
53 List<ButtonShowBo> buttons = null; 54 List<ButtonShowBo> buttons = null;
54 if(ViewType.LIST == viewType){ 55 if(ViewType.LIST == viewType){
55 - buttons = skupStatus.getListButtons(lst); 56 + buttons = new ArrayList<>(skupStatus.getListButtons(lst));
56 } 57 }
57 58
58 if (ViewType.DETAIL == viewType){ 59 if (ViewType.DETAIL == viewType){
59 - buttons = skupStatus.getDetailButtons(lst); 60 + buttons = new ArrayList<>(skupStatus.getDetailButtons(lst));
60 } 61 }
61 62
62 // 支付剩余时间无,则干掉支付按钮 63 // 支付剩余时间无,则干掉支付按钮
63 if(!CollectionUtils.isEmpty(buttons)){ 64 if(!CollectionUtils.isEmpty(buttons)){
64 if (leftTime != null && leftTime <= 0){ 65 if (leftTime != null && leftTime <= 0){
65 - buttons.removeIf(x-> ButtonShow.PAY_EARNESTMONEY.getCode().equals(x.getCode())); 66 + buttons.removeIf(x-> x!=null && ButtonShow.PAY_EARNESTMONEY.getCode().equals(x.getCode()));
66 } 67 }
67 } 68 }
68 69
@@ -4,6 +4,7 @@ import com.yoho.error.ServiceError; @@ -4,6 +4,7 @@ import com.yoho.error.ServiceError;
4 import com.yoho.error.exception.ServiceException; 4 import com.yoho.error.exception.ServiceException;
5 import com.yohobuy.ufo.model.order.bo.OrderInfo; 5 import com.yohobuy.ufo.model.order.bo.OrderInfo;
6 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; 6 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
  7 +import com.yohobuy.ufo.model.order.common.ButtonShow;
7 import com.yohobuy.ufo.model.order.common.SkupStatus; 8 import com.yohobuy.ufo.model.order.common.SkupStatus;
8 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 9 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
9 import com.yohoufo.common.utils.DateUtil; 10 import com.yohoufo.common.utils.DateUtil;
@@ -22,6 +23,8 @@ import org.slf4j.Logger; @@ -22,6 +23,8 @@ import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory; 23 import org.slf4j.LoggerFactory;
23 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
24 25
  26 +import java.util.ArrayList;
  27 +
25 /** 28 /**
26 * Created by chenchao on 2018/9/20. 29 * Created by chenchao on 2018/9/20.
27 */ 30 */
@@ -141,7 +144,14 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -141,7 +144,14 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
141 orderDetailInfo.setUid(buyerUid = buyerOrder.getUid()); 144 orderDetailInfo.setUid(buyerUid = buyerOrder.getUid());
142 orderDetailInfo.setOrderCode(orderCode = buyerOrder.getOrderCode()); 145 orderDetailInfo.setOrderCode(orderCode = buyerOrder.getOrderCode());
143 orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 146 orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
144 - orderDetailInfo.setButtons(formatButtons(orderStatus, orderStatus.getDetailButtons(tabType))); 147 + orderDetailInfo.setButtons(formatButtons(orderStatus, new ArrayList<>(orderStatus.getDetailButtons(tabType))));
  148 +
  149 + // 买家 买家订单号 需要处理立即支付
  150 + // 卖家 卖家订单号 不存在立即支付的按钮
  151 + Integer leftTime = getPayLeftTime(buyerOrder.getBuyerOrderStatus(), buyerOrder.getCreateTime());
  152 + if (leftTime != null && leftTime <= 0){
  153 + orderDetailInfo.getButtons().removeIf(x-> x!=null && ButtonShow.NOW_BUY.getCode() == (x.getCode())) ;
  154 + }
145 155
146 OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType); 156 OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType);
147 orderDetailInfo.setStatusDetail(statusDetail); 157 orderDetailInfo.setStatusDetail(statusDetail);
@@ -181,14 +191,11 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -181,14 +191,11 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
181 return GoodsInfoConvertor.SellerOrderGoods2GoodsInfo(sellerOrderGoods); 191 return GoodsInfoConvertor.SellerOrderGoods2GoodsInfo(sellerOrderGoods);
182 } 192 }
183 193
184 - Integer getPayLeftTime(TabType actor, Integer orderStatus, int createTime){  
185 - boolean isBuyer = actor.equals(TabType.BUY);  
186 - boolean isSeller = actor.equals(TabType.SELL); 194 + Integer getPayLeftTime(Integer orderStatus, int createTime){
187 Integer leftTime = null; 195 Integer leftTime = null;
188 int timeout = OrderInfo.PAY_TIME_SECOND; 196 int timeout = OrderInfo.PAY_TIME_SECOND;
189 197
190 - boolean isFiredCal = (isBuyer && orderStatus == OrderStatus.WAITING_PAY.getCode())  
191 - || (isSeller && orderStatus == SkupStatus.CAN_NOT_SELL.getCode()); 198 + boolean isFiredCal =orderStatus == OrderStatus.WAITING_PAY.getCode();
192 if(isFiredCal){ 199 if(isFiredCal){
193 leftTime = calLeftTime(timeout, createTime); 200 leftTime = calLeftTime(timeout, createTime);
194 } 201 }
@@ -18,6 +18,7 @@ import org.apache.commons.collections.CollectionUtils; @@ -18,6 +18,7 @@ import org.apache.commons.collections.CollectionUtils;
18 import org.slf4j.Logger; 18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory; 19 import org.slf4j.LoggerFactory;
20 20
  21 +import java.util.ArrayList;
21 import java.util.List; 22 import java.util.List;
22 import java.util.Map; 23 import java.util.Map;
23 import java.util.function.Function; 24 import java.util.function.Function;
@@ -140,12 +141,12 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements @@ -140,12 +141,12 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
140 orderListInfo.setLeftTime(leftTime); 141 orderListInfo.setLeftTime(leftTime);
141 142
142 // 按钮显示 143 // 按钮显示
143 - orderListInfo.setButtons(formatButtons(orderStatus, orderStatus.getListButtons(tabType))); 144 + orderListInfo.setButtons(formatButtons(orderStatus, new ArrayList<>(orderStatus.getListButtons(tabType))));
144 145
145 // 当剩余时间小于0 146 // 当剩余时间小于0
146 if (!CollectionUtils.isEmpty(orderListInfo.getButtons())){ 147 if (!CollectionUtils.isEmpty(orderListInfo.getButtons())){
147 if (orderListInfo.getLeftTime() != null && orderListInfo.getLeftTime() <= 0){ 148 if (orderListInfo.getLeftTime() != null && orderListInfo.getLeftTime() <= 0){
148 - orderListInfo.getButtons().removeIf(x->ButtonShow.NOW_BUY.getCode().equals(x.getCode())); 149 + orderListInfo.getButtons().removeIf(x-> x!=null && ButtonShow.NOW_BUY.getCode().equals(x.getCode()));
149 } 150 }
150 } 151 }
151 152
@@ -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.yoho.error.ServiceError; 3 import com.yoho.error.ServiceError;
4 import com.yoho.error.exception.ServiceException; 4 import com.yoho.error.exception.ServiceException;
  5 +import com.yohobuy.ufo.model.order.common.ButtonShow;
5 import com.yohobuy.ufo.model.order.common.TabType; 6 import com.yohobuy.ufo.model.order.common.TabType;
6 import com.yohobuy.ufo.model.order.resp.OrderListInfo; 7 import com.yohobuy.ufo.model.order.resp.OrderListInfo;
7 import com.yohobuy.ufo.model.order.common.OrderListType; 8 import com.yohobuy.ufo.model.order.common.OrderListType;
@@ -100,6 +101,10 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO @@ -100,6 +101,10 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO
100 Integer leftTime = getLeftTime(TabType.BUY, oli.getUid(), oli.getOrderCode(), oli.getStatus(), 101 Integer leftTime = getLeftTime(TabType.BUY, oli.getUid(), oli.getOrderCode(), oli.getStatus(),
101 oli.getSecendLevelCreateTime()); 102 oli.getSecendLevelCreateTime());
102 oli.setLeftTime(leftTime); 103 oli.setLeftTime(leftTime);
  104 +
  105 + if (oli.getLeftTime()!=null && oli.getLeftTime()<=0){
  106 + oli.getButtons().removeIf(x-> x!=null && ButtonShow.NOW_BUY.getCode().equals(x.getCode()));
  107 + }
103 }); 108 });
104 } 109 }
105 } 110 }
@@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
39 import org.springframework.stereotype.Service; 39 import org.springframework.stereotype.Service;
40 40
41 import java.math.BigDecimal; 41 import java.math.BigDecimal;
  42 +import java.util.ArrayList;
42 import java.util.Arrays; 43 import java.util.Arrays;
43 import java.util.List; 44 import java.util.List;
44 import java.util.Objects; 45 import java.util.Objects;
@@ -318,7 +319,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -318,7 +319,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
318 Integer leftTime = calLeftTime(OrderInfo.SELLER_PAY_TIMEOUT, order.getCreateTime()); 319 Integer leftTime = calLeftTime(OrderInfo.SELLER_PAY_TIMEOUT, order.getCreateTime());
319 320
320 List<ButtonShowBo> buttons = getButtons(ViewType.DETAIL, storageNum, sellerType, order.getPayment(), skupStatus, leftTime); 321 List<ButtonShowBo> buttons = getButtons(ViewType.DETAIL, storageNum, sellerType, order.getPayment(), skupStatus, leftTime);
321 - orderDetailInfo.setButtons(buttons); 322 + orderDetailInfo.setButtons(new ArrayList<>(buttons));
322 orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 323 orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
323 orderDetailInfo.setUserAddress(addressInfo); 324 orderDetailInfo.setUserAddress(addressInfo);
324 //卖家 325 //卖家
@@ -399,6 +400,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -399,6 +400,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
399 OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType()); 400 OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
400 Integer leftTime = getPayLeftTime4Seller(orderCodeType, orderStatus, orderDetailInfo.getSecendLevelCreateTime()); 401 Integer leftTime = getPayLeftTime4Seller(orderCodeType, orderStatus, orderDetailInfo.getSecendLevelCreateTime());
401 orderDetailInfo.getStatusDetail().setLeftTime(leftTime); 402 orderDetailInfo.getStatusDetail().setLeftTime(leftTime);
  403 +
  404 + if (leftTime!=null && leftTime<=0){
  405 + orderDetailInfo.getButtons().removeIf(x-> x!=null &&
  406 + (ButtonShow.NOW_BUY.getCode().equals(x.getCode()) || ButtonShow.PAY_EARNESTMONEY.getCode().equals(x.getCode())));
  407 + }
402 } 408 }
403 } 409 }
404 410