|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.google.common.base.Splitter;
|
|
|
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.ProductInfo;
|
|
|
import com.yohobuy.ufo.model.order.common.ButtonShow;
|
|
|
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
|
|
|
import com.yohobuy.ufo.model.order.common.SellerType;
|
|
|
import com.yohobuy.ufo.model.order.common.SkupStatus;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
|
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.SellerGoodsPageResp;
|
|
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsViewMapper;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.order.model.request.OrderListRequest;
|
|
|
import com.yohoufo.order.service.cache.OrderCacheService;
|
|
|
import com.yohoufo.order.model.request.SellerGoodsListRequest;
|
|
|
import com.yohoufo.order.service.proxy.UserProxyService;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
...
|
...
|
@@ -18,8 +24,11 @@ import org.slf4j.Logger; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Created by chao.chen on 2018/12/13.
|
...
|
...
|
@@ -33,8 +42,6 @@ public class SkupListService { |
|
|
@Autowired
|
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private OrderCacheService orderCacheService;
|
|
|
|
|
|
@Autowired
|
|
|
private UserProxyService userProxyService;
|
...
|
...
|
@@ -106,7 +113,7 @@ public class SkupListService { |
|
|
.pageSize(limit);
|
|
|
int type;
|
|
|
if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()) {
|
|
|
List<Integer> statusList = sellerOrderListService.initOrderListRequest(request);
|
|
|
List<Integer> statusList = Arrays.asList(SkupStatus.CAN_SELL.getCode());
|
|
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSkc(request.getUid(), statusList);
|
|
|
respBuilder.total(total)
|
|
|
.pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1));
|
...
|
...
|
@@ -120,9 +127,7 @@ public class SkupListService { |
|
|
logger.warn("seller get entry order list SellerOrderGoods is empty,req {}", request);
|
|
|
return respBuilder.build();
|
|
|
}
|
|
|
boolean isEntry = userProxyService.isEntryShop(request.getUid());
|
|
|
final SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON;
|
|
|
List<OrderListInfo> data = sellerOrderListService.buildOrderList(sogList, sellerType);
|
|
|
List<OrderListInfo> data = buildProductList(sogList, statusList);
|
|
|
respBuilder.data(data);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -142,14 +147,60 @@ public class SkupListService { |
|
|
|
|
|
|
|
|
|
|
|
public PageResp<OrderListInfo> getEntryGoodsSizeList(OrderListRequest request){
|
|
|
PageResp.PageRespBuilder respBuilder;
|
|
|
public SellerGoodsPageResp<OrderListInfo> getEntryGoodsSizeList(SellerGoodsListRequest request){
|
|
|
SellerGoodsPageResp.SGPRBuilder respBuilder;
|
|
|
int limit = request.getLimit();
|
|
|
respBuilder = PageResp.builder()
|
|
|
respBuilder = SellerGoodsPageResp.builder()
|
|
|
.page(request.getPage())
|
|
|
.pageSize(limit);
|
|
|
|
|
|
|
|
|
return respBuilder.build();
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<OrderListInfo> buildProductList(List<SellerOrderGoods> sogList, List<Integer> statusList){
|
|
|
|
|
|
List<OrderListInfo> data ;
|
|
|
data = sogList.parallelStream()
|
|
|
.map(sog -> buildOrderListInfo(sog, statusList))
|
|
|
.filter(oli -> Objects.nonNull(oli))
|
|
|
.collect(Collectors.toList());
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods, List<Integer> statusList) {
|
|
|
Integer uid;
|
|
|
OrderListInfo orderListInfo = new OrderListInfo();
|
|
|
orderListInfo.setUid(uid = sellerOrderGoods.getUid());
|
|
|
SkupStatus skupStatus = SkupStatus.getSkupStatus(sellerOrderGoods.getStatus());
|
|
|
if (skupStatus == null){
|
|
|
logger.warn("get seller Order List skupStatus not exist, uid is {}, orderCode is {}, status is {}",
|
|
|
uid, orderListInfo.getOrderCode(), sellerOrderGoods.getStatus());
|
|
|
return null;
|
|
|
}
|
|
|
// 订单中状态显示
|
|
|
orderListInfo.setStatus(skupStatus.getCode());
|
|
|
orderListInfo.setStatuStr(skupStatus.getDesc());
|
|
|
|
|
|
// 按钮显示
|
|
|
List<ButtonShowBo> buttons = Arrays.asList(ButtonShow.STORAGE_MANAGE.getBo());
|
|
|
orderListInfo.setButtons(buttons);
|
|
|
//
|
|
|
ProductInfo productInfo = new ProductInfo();
|
|
|
productInfo.setColorName(sellerOrderGoods.getColorName());
|
|
|
productInfo.setProductName(sellerOrderGoods.getProductName());
|
|
|
String imageUrl = ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
|
|
|
productInfo.setImageUrl(imageUrl);
|
|
|
Integer productId;
|
|
|
productInfo.setProductId(productId=sellerOrderGoods.getProductId());
|
|
|
//
|
|
|
SellerOrderGoods psogOfMerge = sellerOrderGoodsViewMapper.selectByUidStatusGBSkc(uid,statusList,productId);
|
|
|
if (psogOfMerge != null){
|
|
|
productInfo.setStorageNum(psogOfMerge.getStorageNum());
|
|
|
productInfo.setSizeNum(psogOfMerge.getSizeNum());
|
|
|
}
|
|
|
orderListInfo.setProductInfo(productInfo);
|
|
|
return orderListInfo;
|
|
|
}
|
|
|
} |
...
|
...
|
|