Authored by chenchao

add isAdvance 4 response BO of list and detail

1 package com.yohoufo.order.model.response; 1 package com.yohoufo.order.model.response;
2 2
3 3
  4 +import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
4 import com.yohobuy.ufo.model.order.bo.PlatformFee; 5 import com.yohobuy.ufo.model.order.bo.PlatformFee;
5 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 6 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
6 import com.yohobuy.ufo.model.order.vo.AddressInfo; 7 import com.yohobuy.ufo.model.order.vo.AddressInfo;
7 -import com.yohobuy.ufo.model.order.bo.ButtonShowBo;  
8 import lombok.AllArgsConstructor; 8 import lombok.AllArgsConstructor;
9 import lombok.Data; 9 import lombok.Data;
10 import lombok.NoArgsConstructor; 10 import lombok.NoArgsConstructor;
@@ -95,7 +95,7 @@ public class OrderDetailInfo { @@ -95,7 +95,7 @@ public class OrderDetailInfo {
95 private String isOffline; 95 private String isOffline;
96 96
97 /** 97 /**
98 - * 是否预售 98 + * 是否预售 是 :Y, 否 :N
99 */ 99 */
100 private String isAdvance; 100 private String isAdvance;
101 @Builder 101 @Builder
@@ -27,6 +27,7 @@ import com.yohoufo.order.service.IExpressInfoService; @@ -27,6 +27,7 @@ import com.yohoufo.order.service.IExpressInfoService;
27 import com.yohoufo.order.service.IOrderDetailService; 27 import com.yohoufo.order.service.IOrderDetailService;
28 import com.yohoufo.order.service.proxy.DeliveryMinutesService; 28 import com.yohoufo.order.service.proxy.DeliveryMinutesService;
29 import com.yohoufo.order.utils.BuyerOrderUtils; 29 import com.yohoufo.order.utils.BuyerOrderUtils;
  30 +import com.yohoufo.order.utils.OrderAssist;
30 import lombok.experimental.Builder; 31 import lombok.experimental.Builder;
31 import org.slf4j.Logger; 32 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory; 33 import org.slf4j.LoggerFactory;
@@ -210,6 +211,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -210,6 +211,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
210 //只有卖家在查看买家的订单时才有 211 //只有卖家在查看买家的订单时才有
211 assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup()); 212 assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup());
212 orderDetailInfo.setAppraiseVideoUrl(buildNode.appraiseVideoUrl); 213 orderDetailInfo.setAppraiseVideoUrl(buildNode.appraiseVideoUrl);
  214 + orderDetailInfo.setIsAdvance(OrderAssist.getOrderIsAdvance(buyerOrder.getAttributes()));
213 //orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(buyerUid, orderCode, buyerOrder.getStatus())); 215 //orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(buyerUid, orderCode, buyerOrder.getStatus()));
214 return orderDetailInfo; 216 return orderDetailInfo;
215 } 217 }
@@ -18,6 +18,7 @@ import com.yohoufo.order.constants.ViewType; @@ -18,6 +18,7 @@ import com.yohoufo.order.constants.ViewType;
18 import com.yohoufo.order.model.request.OrderListRequest; 18 import com.yohoufo.order.model.request.OrderListRequest;
19 import com.yohoufo.order.service.IOrderListService; 19 import com.yohoufo.order.service.IOrderListService;
20 import com.yohoufo.order.utils.BuyerOrderUtils; 20 import com.yohoufo.order.utils.BuyerOrderUtils;
  21 +import com.yohoufo.order.utils.OrderAssist;
21 import org.apache.commons.collections.CollectionUtils; 22 import org.apache.commons.collections.CollectionUtils;
22 import org.slf4j.Logger; 23 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory; 24 import org.slf4j.LoggerFactory;
@@ -200,10 +201,16 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements @@ -200,10 +201,16 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
200 orderListInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 201 orderListInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
201 setAddressInfo(orderListInfo); 202 setAddressInfo(orderListInfo);
202 orderListInfo.setAppraiseVideoUrl(appraiseVideo.get(buyerOrder.getOrderCode())); 203 orderListInfo.setAppraiseVideoUrl(appraiseVideo.get(buyerOrder.getOrderCode()));
  204 + orderListInfo.setIsAdvance(OrderAssist.getOrderIsAdvance(buyerOrder.getAttributes()));
203 return orderListInfo; 205 return orderListInfo;
204 } 206 }
205 207
206 abstract void setAddressInfo(OrderListInfo orderListInfo); 208 abstract void setAddressInfo(OrderListInfo orderListInfo);
207 209
  210 + /**
  211 + * 重置动态数据
  212 + * @param list
  213 + * @param type
  214 + */
208 protected abstract void resetDynamicProporties(List<OrderListInfo> list,int type); 215 protected abstract void resetDynamicProporties(List<OrderListInfo> list,int type);
209 } 216 }
@@ -36,6 +36,7 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; @@ -36,6 +36,7 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
36 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 36 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
37 import com.yohoufo.order.service.wrapper.SellerOrderTimeoutWrapper; 37 import com.yohoufo.order.service.wrapper.SellerOrderTimeoutWrapper;
38 import com.yohoufo.order.utils.LoggerUtils; 38 import com.yohoufo.order.utils.LoggerUtils;
  39 +import com.yohoufo.order.utils.OrderAssist;
39 import org.apache.commons.lang3.StringUtils; 40 import org.apache.commons.lang3.StringUtils;
40 import org.slf4j.Logger; 41 import org.slf4j.Logger;
41 import org.springframework.beans.factory.annotation.Autowired; 42 import org.springframework.beans.factory.annotation.Autowired;
@@ -325,10 +326,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -325,10 +326,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
325 OrderDetailInfo orderDetailInfo = new OrderDetailInfo(); 326 OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
326 orderDetailInfo.setUid(order.getUid()); 327 orderDetailInfo.setUid(order.getUid());
327 orderDetailInfo.setOrderCode(getOrderCode(skupStatus, order)); 328 orderDetailInfo.setOrderCode(getOrderCode(skupStatus, order));
328 -  
329 -  
330 Integer storageNum = sellerOrderGoods.getNum(); 329 Integer storageNum = sellerOrderGoods.getNum();
331 -  
332 Integer leftTime = calLeftTime(OrderInfo.SELLER_PAY_TIMEOUT, order.getCreateTime()); 330 Integer leftTime = calLeftTime(OrderInfo.SELLER_PAY_TIMEOUT, order.getCreateTime());
333 331
334 List<ButtonShowBo> buttons = getButtons(ViewType.DETAIL, storageNum, sellerType, order.getPayment(), skupStatus, leftTime); 332 List<ButtonShowBo> buttons = getButtons(ViewType.DETAIL, storageNum, sellerType, order.getPayment(), skupStatus, leftTime);
@@ -364,7 +362,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -364,7 +362,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
364 orderDetailInfo.setIsPaid(getIsPaid(skupStatus)); 362 orderDetailInfo.setIsPaid(getIsPaid(skupStatus));
365 orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime()); 363 orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime());
366 orderDetailInfo.setCreateTime(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 364 orderDetailInfo.setCreateTime(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
367 - 365 + orderDetailInfo.setIsAdvance(OrderAssist.getSkupIsAdvance(sellerOrderGoods.getAttributes()));
368 return orderDetailInfo; 366 return orderDetailInfo;
369 } 367 }
370 368
@@ -29,7 +29,6 @@ import com.yohoufo.order.service.IOrderListService; @@ -29,7 +29,6 @@ import com.yohoufo.order.service.IOrderListService;
29 import com.yohoufo.order.service.cache.OrderCacheService; 29 import com.yohoufo.order.service.cache.OrderCacheService;
30 import com.yohoufo.order.service.proxy.ProductProxyService; 30 import com.yohoufo.order.service.proxy.ProductProxyService;
31 import com.yohoufo.order.service.proxy.UserProxyService; 31 import com.yohoufo.order.service.proxy.UserProxyService;
32 -import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;  
33 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 32 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
34 import com.yohoufo.order.service.wrapper.SellerOrderTimeoutWrapper; 33 import com.yohoufo.order.service.wrapper.SellerOrderTimeoutWrapper;
35 import com.yohoufo.order.utils.LoggerUtils; 34 import com.yohoufo.order.utils.LoggerUtils;
@@ -290,6 +289,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -290,6 +289,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
290 if (SHOW_OVER_FLOW_PRICE_STATUS.contains(skupStatus.getCode())){ 289 if (SHOW_OVER_FLOW_PRICE_STATUS.contains(skupStatus.getCode())){
291 orderListInfo.setTips(overPriceTipsMap.get(OrderAssist.overFlowPriceKey(sellerOrderGoods.getStorageId(), sellerOrderGoods.getGoodsPrice()))); 290 orderListInfo.setTips(overPriceTipsMap.get(OrderAssist.overFlowPriceKey(sellerOrderGoods.getStorageId(), sellerOrderGoods.getGoodsPrice())));
292 } 291 }
  292 + orderListInfo.setIsAdvance(OrderAssist.getSkupIsAdvance(sellerOrderGoods.getAttributes()));
293 return orderListInfo; 293 return orderListInfo;
294 } 294 }
295 295
@@ -537,6 +537,7 @@ public class SkupListService { @@ -537,6 +537,7 @@ public class SkupListService {
537 orderListInfo.setGoodsInfo(productInfo); 537 orderListInfo.setGoodsInfo(productInfo);
538 //tips 538 //tips
539 orderListInfo.setTips(overPriceTipsMap.get(OrderAssist.overFlowPriceKey(sellerOrderGoods.getStorageId(), sellerOrderGoods.getGoodsPrice()))); 539 orderListInfo.setTips(overPriceTipsMap.get(OrderAssist.overFlowPriceKey(sellerOrderGoods.getStorageId(), sellerOrderGoods.getGoodsPrice())));
  540 + orderListInfo.setIsAdvance(OrderAssist.getSkupIsAdvance(sellerOrderGoods.getAttributes()));
540 return orderListInfo; 541 return orderListInfo;
541 } 542 }
542 } 543 }
1 package com.yohoufo.order.utils; 1 package com.yohoufo.order.utils;
2 2
  3 +import com.yohobuy.ufo.model.order.common.OrderAttributes;
  4 +import com.yohobuy.ufo.model.order.constants.SkupType;
  5 +
3 import java.math.BigDecimal; 6 import java.math.BigDecimal;
  7 +import java.util.Objects;
4 8
5 /** 9 /**
6 * Created by chao.chen on 2018/12/20. 10 * Created by chao.chen on 2018/12/20.
7 */ 11 */
8 public class OrderAssist { 12 public class OrderAssist {
  13 + public static final String Y = "Y", N = "N";
9 14
10 public static String overFlowPriceKey(Integer storageId, BigDecimal salePrice){ 15 public static String overFlowPriceKey(Integer storageId, BigDecimal salePrice){
11 return new StringBuilder().append(storageId).append("_").append(salePrice).toString(); 16 return new StringBuilder().append(storageId).append("_").append(salePrice).toString();
12 } 17 }
  18 +
  19 +
  20 + public static String getSkupIsAdvance(Integer attribute){
  21 + return Objects.nonNull(attribute) && SkupType.ADVANCE.getCode() == attribute ? Y : N;
  22 + }
  23 +
  24 + public static String getOrderIsAdvance(Integer attribute){
  25 + return Objects.nonNull(attribute) && OrderAttributes.ADVANCE_SALE.getCode() == attribute ? Y : N;
  26 + }
13 } 27 }