Authored by tanling

button show leftTime

... ... @@ -11,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
... ... @@ -52,17 +53,17 @@ public interface AbsSellerOrderViewService {
// 按钮显示
List<ButtonShowBo> buttons = null;
if(ViewType.LIST == viewType){
buttons = skupStatus.getListButtons(lst);
buttons = new ArrayList<>(skupStatus.getListButtons(lst));
}
if (ViewType.DETAIL == viewType){
buttons = skupStatus.getDetailButtons(lst);
buttons = new ArrayList<>(skupStatus.getDetailButtons(lst));
}
// 支付剩余时间无,则干掉支付按钮
if(!CollectionUtils.isEmpty(buttons)){
if (leftTime != null && leftTime <= 0){
buttons.removeIf(x-> ButtonShow.PAY_EARNESTMONEY.getCode().equals(x.getCode()));
buttons.removeIf(x-> x!=null && ButtonShow.PAY_EARNESTMONEY.getCode().equals(x.getCode()));
}
}
... ...
... ... @@ -4,6 +4,7 @@ import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohoufo.common.utils.DateUtil;
... ... @@ -22,6 +23,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
/**
* Created by chenchao on 2018/9/20.
*/
... ... @@ -141,7 +144,14 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
orderDetailInfo.setUid(buyerUid = buyerOrder.getUid());
orderDetailInfo.setOrderCode(orderCode = buyerOrder.getOrderCode());
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setButtons(formatButtons(orderStatus, orderStatus.getDetailButtons(tabType)));
orderDetailInfo.setButtons(formatButtons(orderStatus, new ArrayList<>(orderStatus.getDetailButtons(tabType))));
// 买家 买家订单号 需要处理立即支付
// 卖家 卖家订单号 不存在立即支付的按钮
Integer leftTime = getPayLeftTime(buyerOrder.getBuyerOrderStatus(), buyerOrder.getCreateTime());
if (leftTime != null && leftTime <= 0){
orderDetailInfo.getButtons().removeIf(x-> x!=null && ButtonShow.NOW_BUY.getCode() == (x.getCode())) ;
}
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType);
orderDetailInfo.setStatusDetail(statusDetail);
... ... @@ -181,14 +191,11 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
return GoodsInfoConvertor.SellerOrderGoods2GoodsInfo(sellerOrderGoods);
}
Integer getPayLeftTime(TabType actor, Integer orderStatus, int createTime){
boolean isBuyer = actor.equals(TabType.BUY);
boolean isSeller = actor.equals(TabType.SELL);
Integer getPayLeftTime(Integer orderStatus, int createTime){
Integer leftTime = null;
int timeout = OrderInfo.PAY_TIME_SECOND;
boolean isFiredCal = (isBuyer && orderStatus == OrderStatus.WAITING_PAY.getCode())
|| (isSeller && orderStatus == SkupStatus.CAN_NOT_SELL.getCode());
boolean isFiredCal =orderStatus == OrderStatus.WAITING_PAY.getCode();
if(isFiredCal){
leftTime = calLeftTime(timeout, createTime);
}
... ...
... ... @@ -18,6 +18,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
... ... @@ -140,12 +141,12 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
orderListInfo.setLeftTime(leftTime);
// 按钮显示
orderListInfo.setButtons(formatButtons(orderStatus, orderStatus.getListButtons(tabType)));
orderListInfo.setButtons(formatButtons(orderStatus, new ArrayList<>(orderStatus.getListButtons(tabType))));
// 当剩余时间小于0
if (!CollectionUtils.isEmpty(orderListInfo.getButtons())){
if (orderListInfo.getLeftTime() != null && orderListInfo.getLeftTime() <= 0){
orderListInfo.getButtons().removeIf(x->ButtonShow.NOW_BUY.getCode().equals(x.getCode()));
orderListInfo.getButtons().removeIf(x-> x!=null && ButtonShow.NOW_BUY.getCode().equals(x.getCode()));
}
}
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.common.OrderListType;
... ... @@ -100,6 +101,10 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO
Integer leftTime = getLeftTime(TabType.BUY, oli.getUid(), oli.getOrderCode(), oli.getStatus(),
oli.getSecendLevelCreateTime());
oli.setLeftTime(leftTime);
if (oli.getLeftTime()!=null && oli.getLeftTime()<=0){
oli.getButtons().removeIf(x-> x!=null && ButtonShow.NOW_BUY.getCode().equals(x.getCode()));
}
});
}
}
... ...
... ... @@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
... ... @@ -318,7 +319,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
Integer leftTime = calLeftTime(OrderInfo.SELLER_PAY_TIMEOUT, order.getCreateTime());
List<ButtonShowBo> buttons = getButtons(ViewType.DETAIL, storageNum, sellerType, order.getPayment(), skupStatus, leftTime);
orderDetailInfo.setButtons(buttons);
orderDetailInfo.setButtons(new ArrayList<>(buttons));
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setUserAddress(addressInfo);
//卖家
... ... @@ -399,6 +400,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
Integer leftTime = getPayLeftTime4Seller(orderCodeType, orderStatus, orderDetailInfo.getSecendLevelCreateTime());
orderDetailInfo.getStatusDetail().setLeftTime(leftTime);
if (leftTime!=null && leftTime<=0){
orderDetailInfo.getButtons().removeIf(x-> x!=null &&
(ButtonShow.NOW_BUY.getCode().equals(x.getCode()) || ButtonShow.PAY_EARNESTMONEY.getCode().equals(x.getCode())));
}
}
}
... ...