Authored by tanling

支付时间无,则干掉待支付的按钮

package com.yohoufo.order.service;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.SellerType;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohoufo.order.common.Payment;
... ... @@ -25,7 +26,8 @@ public interface AbsSellerOrderViewService {
List<Integer> SHOW_OVER_FLOW_PRICE_STATUS = Arrays.asList(SkupStatus.CAN_SELL.getCode());
default List<ButtonShowBo> getButtons(ViewType viewType, Integer storageNum, SellerType st, Integer payment, SkupStatus skupStatus){
default List<ButtonShowBo> getButtons(ViewType viewType, Integer storageNum, SellerType st,
Integer payment, SkupStatus skupStatus, Integer leftTime){
//异常扯淡,兼容老数据,
boolean isEntry = st == SellerType.ENTRY;
... ... @@ -56,6 +58,10 @@ public interface AbsSellerOrderViewService {
buttons = skupStatus.getDetailButtons(lst);
}
// 支付剩余时间无,则干掉支付按钮
if (leftTime != null && leftTime <= 0){
buttons.removeIf(x->x.getCode() == ButtonShow.PAY_EARNESTMONEY.getCode());
}
return buttons;
}
... ...
... ... @@ -2,7 +2,7 @@ package com.yohoufo.order.service.impl;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
... ... @@ -17,7 +17,6 @@ import com.yohoufo.order.service.IOrderListService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
... ... @@ -136,12 +135,18 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
orderListInfo.setStatuStr(orderStatus.getStatusStr(tabType));
// 按钮显示
orderListInfo.setButtons(formatButtons(orderStatus, orderStatus.getListButtons(tabType)));
// 当订单状态是待付款, 显示leftTime
Integer leftTime = getLeftTime(tabType, buyerUid, orderCode, buyerOrder.getStatus(), buyerOrder.getCreateTime());
orderListInfo.setLeftTime(leftTime);
// 按钮显示
orderListInfo.setButtons(formatButtons(orderStatus, orderStatus.getListButtons(tabType)));
// 当剩余时间小于0
if (orderListInfo.getLeftTime() != null && orderListInfo.getLeftTime() <= 0){
orderListInfo.getButtons().removeIf(x->x.getCode() == ButtonShow.NOW_BUY.getCode());
}
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMap.get(buyerOrder.getOrderCode());
if (buyerOrderGoods == null){
logger.warn("getOrderList buyer goods not exist, uid is {}, orderCode is {}",
... ...
... ... @@ -248,14 +248,15 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
orderListInfo.setStatuStr(skupStatus.getDesc());
Integer storageNum = sellerOrderGoods.getNum();
// 按钮显示
List<ButtonShowBo> buttons;
buttons = getButtons(ViewType.LIST, storageNum, st, sellerOrder.getPayment(), skupStatus);
orderListInfo.setButtons(buttons);
// 当订单状态是待付款, 显示leftTime
if (sellerOrderGoods.getStatus() == SkupStatus.CAN_NOT_SELL.getCode()){
orderListInfo.setLeftTime(calLeftTime(OrderInfo.SELLER_PAY_TIMEOUT, sellerOrder.getCreateTime()));
}
// 按钮显示
List<ButtonShowBo> buttons = getButtons(ViewType.LIST, storageNum, st, sellerOrder.getPayment(), skupStatus, orderListInfo.getLeftTime());
orderListInfo.setButtons(buttons);
orderListInfo.setSkup(sellerOrderGoods.getId());
orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
... ...