Authored by chenchao

quick deliver skup list

@@ -13,6 +13,7 @@ import com.yohoufo.order.model.request.SellerGoodsListRequest; @@ -13,6 +13,7 @@ import com.yohoufo.order.model.request.SellerGoodsListRequest;
13 import com.yohoufo.order.model.response.OrderSubmitResp; 13 import com.yohoufo.order.model.response.OrderSubmitResp;
14 import com.yohoufo.order.service.impl.SkupListService; 14 import com.yohoufo.order.service.impl.SkupListService;
15 import com.yohoufo.order.service.seller.changePrice.ChangePriceService; 15 import com.yohoufo.order.service.seller.changePrice.ChangePriceService;
  16 +import com.yohoufo.order.service.seller.quickDeliver.QuickDeliverGoodsService;
16 import com.yohoufo.order.utils.LoggerUtils; 17 import com.yohoufo.order.utils.LoggerUtils;
17 import org.slf4j.Logger; 18 import org.slf4j.Logger;
18 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +38,9 @@ public class SellerGoodsController { @@ -37,6 +38,9 @@ public class SellerGoodsController {
37 @Autowired 38 @Autowired
38 private ChangePriceService changePriceService; 39 private ChangePriceService changePriceService;
39 40
  41 + @Autowired
  42 + private QuickDeliverGoodsService quickDeliverGoodsService;
  43 +
40 44
41 45
42 @RequestMapping(params = "method=ufo.seller.entryPrdList") 46 @RequestMapping(params = "method=ufo.seller.entryPrdList")
@@ -175,4 +179,41 @@ public class SellerGoodsController { @@ -175,4 +179,41 @@ public class SellerGoodsController {
175 orderListInfoRsp = skupListService.getImperfectGoodsList(orderListRequest); 179 orderListInfoRsp = skupListService.getImperfectGoodsList(orderListRequest);
176 return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("卖家订单列表").build(); 180 return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("卖家订单列表").build();
177 } 181 }
  182 +
  183 +
  184 + @RequestMapping(params = "method=ufo.seller.quickDeliverPrdList")
  185 + @ResponseBody
  186 + public ApiResponse getQuickDeliverPrdList(@RequestParam("type") int type,
  187 + @RequestParam("uid") int uid,
  188 + @RequestParam(value = "page", required = false, defaultValue = "1") int page,
  189 + @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
  190 + OrderListRequest orderListRequest = OrderListRequest.builder()
  191 + .uid(uid)
  192 + .type(type)
  193 + .page(page)
  194 + .limit(limit)
  195 + .build();
  196 + logger.info("ufo.seller.quickDeliverPrdList orderListRequest {}", orderListRequest);
  197 + PageResp<OrderListInfo> orderListInfoRsp;
  198 + orderListInfoRsp = quickDeliverGoodsService.getQuickDeliverGoodsList(orderListRequest);
  199 + return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("卖家订单列表").build();
  200 + }
  201 +
  202 + @RequestMapping(params = "method=ufo.seller.quickDeliverGoodsSizeList")
  203 + @ResponseBody
  204 + public ApiResponse getQuickDeliverGoodsSizeList(@RequestParam("uid") int uid,
  205 + @RequestParam("productId")Integer productId,
  206 + @RequestParam(value = "page", required = false, defaultValue = "1") int page,
  207 + @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
  208 + SellerGoodsListRequest orderListRequest = SellerGoodsListRequest.builder()
  209 + .uid(uid)
  210 + .productId(productId)
  211 + .page(page)
  212 + .limit(limit)
  213 + .build();
  214 + logger.info("ufo.seller.quickDeliverGoodsSizeList orderListRequest {}", orderListRequest);
  215 + SellerGoodsPageResp<OrderListInfo> orderListInfoRsp;
  216 + orderListInfoRsp = quickDeliverGoodsService.getQuickDeliverGoodsSizeList(orderListRequest);
  217 + return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("卖家订单列表").build();
  218 + }
178 } 219 }
@@ -181,6 +181,8 @@ public class SkupListService { @@ -181,6 +181,8 @@ public class SkupListService {
181 return respBuilder.build(); 181 return respBuilder.build();
182 } 182 }
183 183
  184 +
  185 +
184 /** 186 /**
185 * 卖家(可以是入驻或非入驻的卖家)非入驻出售中的商品列表 187 * 卖家(可以是入驻或非入驻的卖家)非入驻出售中的商品列表
186 * @param request 188 * @param request
@@ -238,7 +240,7 @@ public class SkupListService { @@ -238,7 +240,7 @@ public class SkupListService {
238 Integer uid = request.getUid(); 240 Integer uid = request.getUid();
239 boolean isEntry = userProxyService.isEntryShop(uid); 241 boolean isEntry = userProxyService.isEntryShop(uid);
240 if (!isEntry){ 242 if (!isEntry){
241 - logger.warn("getEntryGoodsSizeList not entry seller, req {}", request); 243 + logger.warn("getQuickDeliverGoodsSizeList not entry seller, req {}", request);
242 return respBuilder.build(); 244 return respBuilder.build();
243 } 245 }
244 246
@@ -264,16 +266,15 @@ public class SkupListService { @@ -264,16 +266,15 @@ public class SkupListService {
264 logger.warn("seller get order list SellerOrderGoods is empty,req {}", request); 266 logger.warn("seller get order list SellerOrderGoods is empty,req {}", request);
265 return respBuilder.build(); 267 return respBuilder.build();
266 } 268 }
267 - final SellerType sellerType = SellerType.ENTRY;  
268 - Payment payment = Payment.WALLET;  
269 - List<OrderListInfo> orderListInfos = buildPrdSkuList(productId, sogList, sellerType, payment); 269 +
  270 + List<OrderListInfo> orderListInfos = buildEntryPrdSkuList(productId, sogList);
270 respBuilder.data(orderListInfos); 271 respBuilder.data(orderListInfos);
271 ProductInfo productInfo = buildProductInfo(uid, status, sogList, pageTotal); 272 ProductInfo productInfo = buildProductInfo(uid, status, sogList, pageTotal);
272 respBuilder.productInfo(productInfo); 273 respBuilder.productInfo(productInfo);
273 return respBuilder.build(); 274 return respBuilder.build();
274 } 275 }
275 276
276 - ProductInfo buildProductInfo(Integer uid, Integer status, List<SellerOrderGoods> sogList, int pageTotal){ 277 + public ProductInfo buildProductInfo(Integer uid, Integer status, List<SellerOrderGoods> sogList, int pageTotal){
277 ProductInfo productInfo = new ProductInfo(); 278 ProductInfo productInfo = new ProductInfo();
278 SellerOrderGoods sog = sogList.get(0); 279 SellerOrderGoods sog = sogList.get(0);
279 productInfo.setProductId(sog.getProductId()); 280 productInfo.setProductId(sog.getProductId());
@@ -417,13 +418,32 @@ public class SkupListService { @@ -417,13 +418,32 @@ public class SkupListService {
417 return map; 418 return map;
418 } 419 }
419 420
  421 + public List<OrderListInfo> buildPrdSkuList(Integer productId, List<SellerOrderGoods> sogList){
420 422
421 - private List<OrderListInfo> buildPrdSkuList(Integer productId,  
422 - List<SellerOrderGoods> sogList,  
423 - SellerType sellerType,  
424 - Payment payment){ 423 +
  424 + Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
  425 + .collect(Collectors.toSet());
  426 + ProductProxyService.PrdPriceCollection ppc = productProxyService.getPrdPriceList(productId, storageIds);
  427 + List<GoodsInfo> goodsInfoList = ppc.getGoodsInfoList();
  428 + Map<Integer, GoodsInfo> storageIdGoodInfoMap = goodsInfoList.parallelStream()
  429 + .collect(Collectors.toMap(GoodsInfo::getStorageId, Function.identity()));
  430 + Map<Integer, StorageInfoResp> storageDataMap = ppc.getStorageDataMap();
  431 +
  432 + Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(storageIds, sogList, storageDataMap);
  433 +
  434 + List<OrderListInfo> data ;
  435 + data = sogList.parallelStream()
  436 + .map(sog -> buildEntryOrderListInfo4Sku(sog, overPriceTipsMap, null, storageIdGoodInfoMap, null))
  437 + .filter(oli -> Objects.nonNull(oli))
  438 + .collect(Collectors.toList());
  439 + return data;
  440 + }
425 441
426 442
  443 + public List<OrderListInfo> buildEntryPrdSkuList(Integer productId,
  444 + List<SellerOrderGoods> sogList){
  445 + final SellerType sellerType = SellerType.ENTRY;
  446 + final Payment payment = Payment.WALLET;
427 Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId) 447 Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
428 .collect(Collectors.toSet()); 448 .collect(Collectors.toSet());
429 ProductProxyService.PrdPriceCollection ppc = productProxyService.getPrdPriceList(productId, storageIds); 449 ProductProxyService.PrdPriceCollection ppc = productProxyService.getPrdPriceList(productId, storageIds);
@@ -436,7 +456,7 @@ public class SkupListService { @@ -436,7 +456,7 @@ public class SkupListService {
436 456
437 List<OrderListInfo> data ; 457 List<OrderListInfo> data ;
438 data = sogList.parallelStream() 458 data = sogList.parallelStream()
439 - .map(sog -> buildOrderListInfo4Sku(sog, overPriceTipsMap, sellerType, storageIdGoodInfoMap, payment)) 459 + .map(sog -> buildEntryOrderListInfo4Sku(sog, overPriceTipsMap, sellerType, storageIdGoodInfoMap, payment))
440 .filter(oli -> Objects.nonNull(oli)) 460 .filter(oli -> Objects.nonNull(oli))
441 .collect(Collectors.toList()); 461 .collect(Collectors.toList());
442 return data; 462 return data;
@@ -523,7 +543,7 @@ public class SkupListService { @@ -523,7 +543,7 @@ public class SkupListService {
523 return orderListInfo; 543 return orderListInfo;
524 } 544 }
525 545
526 - OrderListInfo buildOrderListInfo4Sku(SellerOrderGoods sellerOrderGoods, 546 + public OrderListInfo buildEntryOrderListInfo4Sku(SellerOrderGoods sellerOrderGoods,
527 Map<String, String> overPriceTipsMap, 547 Map<String, String> overPriceTipsMap,
528 SellerType sellerType, 548 SellerType sellerType,
529 Map<Integer, GoodsInfo> storageIdGoodInfoMap, 549 Map<Integer, GoodsInfo> storageIdGoodInfoMap,
@@ -533,7 +553,7 @@ public class SkupListService { @@ -533,7 +553,7 @@ public class SkupListService {
533 orderListInfo.setUid(uid = sellerOrderGoods.getUid()); 553 orderListInfo.setUid(uid = sellerOrderGoods.getUid());
534 SkupStatus skupStatus = SkupStatus.getSkupStatus(sellerOrderGoods.getStatus()); 554 SkupStatus skupStatus = SkupStatus.getSkupStatus(sellerOrderGoods.getStatus());
535 if (skupStatus == null){ 555 if (skupStatus == null){
536 - logger.warn("get seller Order List skupStatus not exist, uid is {}, orderCode is {}, status is {}", 556 + logger.warn("buildEntryOrderListInfo4Sku seller Order List skupStatus not exist, uid is {}, orderCode is {}, status is {}",
537 uid, orderListInfo.getOrderCode(), sellerOrderGoods.getStatus()); 557 uid, orderListInfo.getOrderCode(), sellerOrderGoods.getStatus());
538 return null; 558 return null;
539 } 559 }
@@ -548,6 +568,8 @@ public class SkupListService { @@ -548,6 +568,8 @@ public class SkupListService {
548 .sellerType(sellerType).skupStatus(skupStatus) 568 .sellerType(sellerType).skupStatus(skupStatus)
549 .skupType(skupType).storageNum(storageNum) 569 .skupType(skupType).storageNum(storageNum)
550 .viewType(ViewType.LIST).build(); 570 .viewType(ViewType.LIST).build();
  571 +
  572 +
551 // 按钮显示 573 // 按钮显示
552 List<ButtonShowBo> buttons = sellerOrderViewService.getButtons(bsfc, 0); 574 List<ButtonShowBo> buttons = sellerOrderViewService.getButtons(bsfc, 0);
553 orderListInfo.setButtons(buttons == null ? Lists.newArrayList() : new ArrayList<>(buttons)); 575 orderListInfo.setButtons(buttons == null ? Lists.newArrayList() : new ArrayList<>(buttons));
@@ -711,4 +733,6 @@ public class SkupListService { @@ -711,4 +733,6 @@ public class SkupListService {
711 733
712 return respBuilder.build(); 734 return respBuilder.build();
713 } 735 }
  736 +
  737 +
714 } 738 }
@@ -3,25 +3,36 @@ package com.yohoufo.order.service.seller.quickDeliver; @@ -3,25 +3,36 @@ package com.yohoufo.order.service.seller.quickDeliver;
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.bo.GoodsInfo; 5 import com.yohobuy.ufo.model.order.bo.GoodsInfo;
6 -import com.yohobuy.ufo.model.order.common.OrderCodeType;  
7 -import com.yohobuy.ufo.model.order.common.SkupStatus; 6 +import com.yohobuy.ufo.model.order.bo.ProductInfo;
  7 +import com.yohobuy.ufo.model.order.common.*;
8 import com.yohobuy.ufo.model.order.constants.SkupType; 8 import com.yohobuy.ufo.model.order.constants.SkupType;
9 import com.yohobuy.ufo.model.order.req.QuickDeliverOrderSubmitReq; 9 import com.yohobuy.ufo.model.order.req.QuickDeliverOrderSubmitReq;
  10 +import com.yohobuy.ufo.model.order.resp.OrderListInfo;
  11 +import com.yohobuy.ufo.model.order.resp.PageResp;
  12 +import com.yohobuy.ufo.model.order.resp.SellerGoodsPageResp;
10 import com.yohoufo.common.alarm.EventBusPublisher; 13 import com.yohoufo.common.alarm.EventBusPublisher;
11 import com.yohoufo.common.alarm.SmsAlarmEvent; 14 import com.yohoufo.common.alarm.SmsAlarmEvent;
  15 +import com.yohoufo.dal.order.SellerOrderGoodsViewMapper;
12 import com.yohoufo.dal.order.model.SellerOrderGoods; 16 import com.yohoufo.dal.order.model.SellerOrderGoods;
13 import com.yohoufo.order.model.QuickDeliverOrderContext; 17 import com.yohoufo.order.model.QuickDeliverOrderContext;
  18 +import com.yohoufo.order.model.request.OrderListRequest;
  19 +import com.yohoufo.order.model.request.SellerGoodsListRequest;
14 import com.yohoufo.order.model.response.OrderSubmitResp; 20 import com.yohoufo.order.model.response.OrderSubmitResp;
15 import com.yohoufo.order.service.handler.SellerOrderSubmitHandler; 21 import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
  22 +import com.yohoufo.order.service.impl.SkupListService;
16 import com.yohoufo.order.service.proxy.ProductProxyService; 23 import com.yohoufo.order.service.proxy.ProductProxyService;
17 import com.yohoufo.order.service.seller.orderMeta.SellerOrderMetaService; 24 import com.yohoufo.order.service.seller.orderMeta.SellerOrderMetaService;
18 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 25 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
  26 +import org.apache.commons.collections.CollectionUtils;
19 import org.slf4j.Logger; 27 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory; 28 import org.slf4j.LoggerFactory;
21 import org.springframework.beans.factory.annotation.Autowired; 29 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.stereotype.Service; 30 import org.springframework.stereotype.Service;
23 31
24 import java.math.BigDecimal; 32 import java.math.BigDecimal;
  33 +import java.util.ArrayList;
  34 +import java.util.Arrays;
  35 +import java.util.List;
25 36
26 /** 37 /**
27 * @author chenchao 38 * @author chenchao
@@ -49,6 +60,12 @@ public class QuickDeliverGoodsService { @@ -49,6 +60,12 @@ public class QuickDeliverGoodsService {
49 @Autowired 60 @Autowired
50 private SellerOrderMetaService sellerOrderMetaService; 61 private SellerOrderMetaService sellerOrderMetaService;
51 62
  63 + @Autowired
  64 + private SellerOrderGoodsViewMapper sellerOrderGoodsViewMapper;
  65 +
  66 + @Autowired
  67 + private SkupListService skupListService;
  68 +
52 public OrderSubmitResp publish(QuickDeliverOrderSubmitReq req){ 69 public OrderSubmitResp publish(QuickDeliverOrderSubmitReq req){
53 70
54 QuickDeliverOrderContext qdoc = quickDeliverPublishProcessor.buildPublishCtx(req); 71 QuickDeliverOrderContext qdoc = quickDeliverPublishProcessor.buildPublishCtx(req);
@@ -123,4 +140,99 @@ public class QuickDeliverGoodsService { @@ -123,4 +140,99 @@ public class QuickDeliverGoodsService {
123 140
124 } 141 }
125 142
  143 + /**
  144 + * 卖家出售中的闪购商品列表
  145 + * @param request
  146 + * @return
  147 + */
  148 + public PageResp<OrderListInfo> getQuickDeliverGoodsList(OrderListRequest request){
  149 + PageResp.PageRespBuilder respBuilder;
  150 + int limit = request.getLimit();
  151 + respBuilder = PageResp.builder()
  152 + .page(request.getPage())
  153 + .pageSize(limit);
  154 + Integer uid = request.getUid();
  155 +
  156 + int type;
  157 + if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()) {
  158 + SkupStatus viewableStatus = SkupStatus.CAN_SELL;
  159 + List<Integer> statusList = Arrays.asList(viewableStatus.getCode());
  160 + final List<Integer> skupTypeCodes = getSkupTypeCodes();
  161 + int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSkc(uid, statusList, skupTypeCodes);
  162 + respBuilder.total(total)
  163 + .pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1));
  164 + if (total == 0){
  165 + return respBuilder.build();
  166 + }
  167 + int offset = (request.getPage() - 1) * limit;
  168 + List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSkc(uid,
  169 + statusList, skupTypeCodes, offset , limit);
  170 + if (CollectionUtils.isEmpty(sogList)){
  171 + logger.warn("seller get entry order list SellerOrderGoods is empty,req {}", request);
  172 + return respBuilder.build();
  173 + }
  174 + List<OrderListInfo> data = skupListService.buildProductList(sogList, viewableStatus);
  175 + respBuilder.data(data);
  176 + }
  177 +
  178 + return respBuilder.build();
  179 + }
  180 +
  181 + private static final List<Integer> SKUP_TYPE_CODES;
  182 + static {
  183 + SKUP_TYPE_CODES = new ArrayList<>(1);
  184 + SKUP_TYPE_CODES.add(SkupType.QUICK_DELIVER.getCode());
  185 + }
  186 +
  187 + public List<Integer> getSkupTypeCodes(){
  188 +
  189 + return SKUP_TYPE_CODES;
  190 + }
  191 +
  192 + /**
  193 + * 卖家入驻后 单个skc聚合的所有尺码商品
  194 + * @param request
  195 + * @return
  196 + */
  197 + public SellerGoodsPageResp<OrderListInfo> getQuickDeliverGoodsSizeList(SellerGoodsListRequest request){
  198 + SellerGoodsPageResp.SGPRBuilder respBuilder;
  199 + int limit = request.getLimit();
  200 + respBuilder = SellerGoodsPageResp.builder()
  201 + .page(request.getPage())
  202 + .pageSize(limit);
  203 +
  204 + Integer status = SkupStatus.CAN_SELL.getCode();
  205 + Integer uid = request.getUid();
  206 +
  207 +
  208 + Integer productId;
  209 + SellerOrderGoods sogCondition = new SellerOrderGoods();
  210 + sogCondition.setProductId(productId=request.getProductId());
  211 + sogCondition.setUid(uid);
  212 + sogCondition.setStatus(status);
  213 + final List<Integer> skupTypeCodes = getSkupTypeCodes();
  214 + //
  215 + int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypeCodes);
  216 + respBuilder.total(total);
  217 + if (total == 0){
  218 + return respBuilder.build();
  219 + }
  220 + int pageTotal = (total % limit == 0) ? (total / limit) : (total / limit + 1);
  221 + respBuilder.pagetotal(pageTotal);
  222 + int offset = (request.getPage() - 1) * limit;
  223 + List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition,
  224 + skupTypeCodes, offset, limit);
  225 + //TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络IO
  226 + if (CollectionUtils.isEmpty(sogList)){
  227 + logger.warn("seller get order list SellerOrderGoods is empty,req {}", request);
  228 + return respBuilder.build();
  229 + }
  230 +
  231 + List<OrderListInfo> orderListInfos = skupListService.buildPrdSkuList(productId, sogList);
  232 + respBuilder.data(orderListInfos);
  233 + ProductInfo productInfo = skupListService.buildProductInfo(uid, status, sogList, pageTotal);
  234 + respBuilder.productInfo(productInfo);
  235 + return respBuilder.build();
  236 + }
  237 +
126 } 238 }
@@ -10,13 +10,14 @@ import com.yohobuy.ufo.model.order.constants.SkupType; @@ -10,13 +10,14 @@ import com.yohobuy.ufo.model.order.constants.SkupType;
10 import com.yohoufo.order.constants.ViewType; 10 import com.yohoufo.order.constants.ViewType;
11 import com.yohoufo.order.utils.SellerGoodsHelper; 11 import com.yohoufo.order.utils.SellerGoodsHelper;
12 import lombok.AllArgsConstructor; 12 import lombok.AllArgsConstructor;
  13 +import lombok.Builder;
13 import lombok.Data; 14 import lombok.Data;
14 import lombok.NoArgsConstructor; 15 import lombok.NoArgsConstructor;
15 -import lombok.Builder;  
16 16
17 import java.util.ArrayList; 17 import java.util.ArrayList;
18 import java.util.Arrays; 18 import java.util.Arrays;
19 import java.util.List; 19 import java.util.List;
  20 +import java.util.Objects;
20 21
21 /** 22 /**
22 * Created by chao.chen on 2019/4/16. 23 * Created by chao.chen on 2019/4/16.
@@ -37,6 +38,7 @@ public class ButtonShowFactory { @@ -37,6 +38,7 @@ public class ButtonShowFactory {
37 ViewType viewType; 38 ViewType viewType;
38 } 39 }
39 40
  41 +
40 private Context context; 42 private Context context;
41 43
42 public ButtonShowFactory(Context context) { 44 public ButtonShowFactory(Context context) {
@@ -48,6 +50,8 @@ public class ButtonShowFactory { @@ -48,6 +50,8 @@ public class ButtonShowFactory {
48 private final static List<ButtonShowBo> CAN_SELL_LIST_BTNS_4_ENTRY; 50 private final static List<ButtonShowBo> CAN_SELL_LIST_BTNS_4_ENTRY;
49 51
50 private final static List<ButtonShowBo> CAN_SELL_DETAIL_BTNS_4_ENTRY; 52 private final static List<ButtonShowBo> CAN_SELL_DETAIL_BTNS_4_ENTRY;
  53 +
  54 + private static final List<ButtonShowBo> CAN_SELL_LIST_BTNS_4_QUICK_DELIVER;
51 static { 55 static {
52 56
53 CAN_SELL_LIST_BTNS_4_ENTRY_ONLY_ONE_PRD 57 CAN_SELL_LIST_BTNS_4_ENTRY_ONLY_ONE_PRD
@@ -56,6 +60,8 @@ public class ButtonShowFactory { @@ -56,6 +60,8 @@ public class ButtonShowFactory {
56 = Arrays.asList(ButtonShow.BATCH_CANCEL_SOLD.getBo(), ButtonShow.CHANGE_PRICE.getBo()); 60 = Arrays.asList(ButtonShow.BATCH_CANCEL_SOLD.getBo(), ButtonShow.CHANGE_PRICE.getBo());
57 CAN_SELL_DETAIL_BTNS_4_ENTRY = CAN_SELL_LIST_BTNS_4_ENTRY; 61 CAN_SELL_DETAIL_BTNS_4_ENTRY = CAN_SELL_LIST_BTNS_4_ENTRY;
58 62
  63 + CAN_SELL_LIST_BTNS_4_QUICK_DELIVER = CAN_SELL_LIST_BTNS_4_ENTRY;
  64 +
59 } 65 }
60 66
61 public List<ButtonShowBo> getButtons(){ 67 public List<ButtonShowBo> getButtons(){
@@ -80,54 +86,87 @@ public class ButtonShowFactory { @@ -80,54 +86,87 @@ public class ButtonShowFactory {
80 Integer storageNum = context.storageNum; 86 Integer storageNum = context.storageNum;
81 boolean isEntrySeller = (sellerType == SellerType.ENTRY); 87 boolean isEntrySeller = (sellerType == SellerType.ENTRY);
82 //非入驻商家 或者支付方式不是钱包 or 瑕疵or二手 的订单,均为原先方式 88 //非入驻商家 或者支付方式不是钱包 or 瑕疵or二手 的订单,均为原先方式
83 - if (payment == null || payment != Payment.WALLET || SellerGoodsHelper.isImperfectGoods(skupType)){ 89 + if (SellerGoodsHelper.isImperfectGoods(skupType)){
84 return skupStatus.getDetailButtons(); 90 return skupStatus.getDetailButtons();
85 } 91 }
86 -  
87 - if(payment == Payment.WALLET){ 92 + List<ButtonShowBo> buttonShowBos = null;
  93 + //priority : 1 . 闪购 -> 2. 入驻钱包支付
  94 + if (SkupType.QUICK_DELIVER.equals(skupType)){
  95 + switch (skupStatus){
  96 + case CAN_SELL:
  97 + buttonShowBos = CAN_SELL_LIST_BTNS_4_QUICK_DELIVER;
  98 + break;
  99 + }
  100 + }else if(payment!=null && payment == Payment.WALLET){
88 if (storageNum>1 && isEntrySeller) { 101 if (storageNum>1 && isEntrySeller) {
89 if (skupStatus == SkupStatus.CAN_SELL) { 102 if (skupStatus == SkupStatus.CAN_SELL) {
90 - return CAN_SELL_DETAIL_BTNS_4_ENTRY; 103 + buttonShowBos = CAN_SELL_DETAIL_BTNS_4_ENTRY;
91 } 104 }
92 } 105 }
93 106
94 if (storageNum == 1){ 107 if (storageNum == 1){
95 if(skupStatus == SkupStatus.CAN_SELL){ 108 if(skupStatus == SkupStatus.CAN_SELL){
  109 + buttonShowBos = CAN_SELL_LIST_BTNS_4_ENTRY_ONLY_ONE_PRD;
  110 + }
  111 + }
  112 + }
  113 + //as protect action, fetch default button
  114 + if (Objects.isNull(buttonShowBos)){
  115 + buttonShowBos = skupStatus.getDetailButtons();
  116 + }
  117 + return buttonShowBos;
  118 + }
  119 +
  120 + public List<ButtonShowBo> getListButtonsOfEntryGoods(){
  121 + SkupStatus skupStatus = context.skupStatus;
  122 + Integer storageNum = context.storageNum;
  123 + List<ButtonShowBo> buttons = null;
  124 + final int threshold = 1;
  125 + if (storageNum>threshold && isEntrySeller()) {
  126 + if (skupStatus == SkupStatus.CAN_SELL) {
  127 + return CAN_SELL_LIST_BTNS_4_ENTRY;
  128 + }
  129 + }
  130 +
  131 + if (storageNum == threshold){
  132 + if(skupStatus == SkupStatus.CAN_SELL){
96 return CAN_SELL_LIST_BTNS_4_ENTRY_ONLY_ONE_PRD; 133 return CAN_SELL_LIST_BTNS_4_ENTRY_ONLY_ONE_PRD;
97 } 134 }
98 } 135 }
  136 +
  137 + return buttons;
99 } 138 }
100 139
101 - return skupStatus.getDetailButtons(); 140 + private boolean isEntrySeller(){
  141 + SellerType sellerType = context.sellerType;
  142 + return (sellerType == SellerType.ENTRY);
102 } 143 }
103 144
104 public List<ButtonShowBo> getListButtons() { 145 public List<ButtonShowBo> getListButtons() {
105 146
106 - SellerType sellerType = context.sellerType; 147 +
107 SkupType skupType = context.skupType; 148 SkupType skupType = context.skupType;
108 Payment payment = context.payment; 149 Payment payment = context.payment;
109 SkupStatus skupStatus = context.skupStatus; 150 SkupStatus skupStatus = context.skupStatus;
110 - Integer storageNum = context.storageNum;  
111 - boolean isEntrySeller = (sellerType == SellerType.ENTRY);  
112 151
113 - if (payment == null || payment != Payment.WALLET || SellerGoodsHelper.isImperfectGoods(skupType)){ 152 + if (SellerGoodsHelper.isImperfectGoods(skupType)){
114 return skupStatus.getListButtons(); 153 return skupStatus.getListButtons();
115 } 154 }
116 -  
117 -  
118 - if(payment == Payment.WALLET){  
119 - if (storageNum>1 && isEntrySeller) {  
120 - if (skupStatus == SkupStatus.CAN_SELL) {  
121 - return CAN_SELL_LIST_BTNS_4_ENTRY; 155 + List<ButtonShowBo> buttons = null;
  156 + //priority : 1 . 闪购 -> 2. 入驻钱包支付
  157 + if (SkupType.QUICK_DELIVER.equals(skupType)){
  158 + switch (skupStatus){
  159 + case CAN_SELL:
  160 + buttons = CAN_SELL_LIST_BTNS_4_QUICK_DELIVER;
  161 + break;
122 } 162 }
  163 + } else if(payment!=null && payment == Payment.WALLET){
  164 + buttons = getListButtonsOfEntryGoods();
123 } 165 }
124 166
125 - if (storageNum == 1){  
126 - if(skupStatus == SkupStatus.CAN_SELL){  
127 - return CAN_SELL_LIST_BTNS_4_ENTRY_ONLY_ONE_PRD;  
128 - } 167 + if (Objects.isNull(buttons)){
  168 + buttons = skupStatus.getListButtons();
129 } 169 }
130 - }  
131 - return skupStatus.getListButtons(); 170 + return buttons;
132 } 171 }
133 } 172 }
1 package com.yohoufo.order.utils; 1 package com.yohoufo.order.utils;
2 2
3 -import com.yohobuy.ufo.model.order.constants.OrderConstant;  
4 import com.yohobuy.ufo.model.order.constants.RegionEnum; 3 import com.yohobuy.ufo.model.order.constants.RegionEnum;
5 import com.yohobuy.ufo.model.order.constants.SkupType; 4 import com.yohobuy.ufo.model.order.constants.SkupType;
6 -import com.yohoufo.order.model.response.DepositResp;  
7 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport; 5 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport;
8 -import org.apache.commons.lang3.StringUtils;  
9 6
10 import java.math.BigDecimal; 7 import java.math.BigDecimal;
11 import java.util.Objects; 8 import java.util.Objects;