Authored by chenchao

optimized code

... ... @@ -104,7 +104,11 @@ public class SkupListService {
return orderListInfoRsp;
}
/**
* 卖家入驻后出售中的商品列表
* @param request
* @return
*/
public PageResp<OrderListInfo> getEntryGoodsList(OrderListRequest request){
PageResp.PageRespBuilder respBuilder;
int limit = request.getLimit();
... ... @@ -134,6 +138,11 @@ public class SkupListService {
return respBuilder.build();
}
/**
* 卖家(可以是入驻或非入驻的卖家)非入驻出售中的商品列表
* @param request
* @return
*/
public PageResp<OrderListInfo> getNotEntryGoodsList(OrderListRequest request){
PageResp.PageRespBuilder respBuilder;
int limit = request.getLimit();
... ... @@ -170,7 +179,11 @@ public class SkupListService {
}
/**
* 卖家入驻后 单个skc聚合的所有尺码商品
* @param request
* @return
*/
public SellerGoodsPageResp<OrderListInfo> getEntryGoodsSizeList(SellerGoodsListRequest request){
SellerGoodsPageResp.SGPRBuilder respBuilder;
int limit = request.getLimit();
... ... @@ -201,7 +214,7 @@ public class SkupListService {
int offset = (request.getPage() - 1) * limit;
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition,
offset, limit);
//TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络I
//TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络IO
if (CollectionUtils.isEmpty(sogList)){
logger.warn("seller get order list SellerOrderGoods is empty,req {}", request);
return respBuilder.build();
... ... @@ -233,12 +246,11 @@ public class SkupListService {
return productInfo;
}
public List<OrderListInfo> buildPrdSkuList(List<SellerOrderGoods> sogList, SellerType sellerType){
ProductInfo productInfo = new ProductInfo();
private List<OrderListInfo> buildPrdSkuList(List<SellerOrderGoods> sogList, SellerType sellerType){
Map<String, String> overPriceTipsMap = sellerOrderListService.buildOverPriceTipsMap(sogList);
List<OrderListInfo> data ;
data = sogList.parallelStream()
.map(sog -> buildOrderListInfo4Sku(sog, overPriceTipsMap))
.map(sog -> buildOrderListInfo4Sku(sog, overPriceTipsMap, sellerType))
.filter(oli -> Objects.nonNull(oli))
.collect(Collectors.toList());
return data;
... ... @@ -311,7 +323,8 @@ public class SkupListService {
return orderListInfo;
}
OrderListInfo buildOrderListInfo4Sku(SellerOrderGoods sellerOrderGoods, Map<String, String> overPriceTipsMap) {
OrderListInfo buildOrderListInfo4Sku(SellerOrderGoods sellerOrderGoods, Map<String, String> overPriceTipsMap,
SellerType sellerType) {
Integer uid;
OrderListInfo orderListInfo = new OrderListInfo();
orderListInfo.setUid(uid = sellerOrderGoods.getUid());
... ... @@ -326,7 +339,7 @@ public class SkupListService {
orderListInfo.setStatuStr(skupStatus.getDesc());
// 按钮显示
List<ButtonShowBo> buttons = skupStatus.getListButtons(SellerType.ENTRY);
List<ButtonShowBo> buttons = skupStatus.getListButtons(sellerType);
orderListInfo.setButtons(buttons);
//
GoodsInfo productInfo = new GoodsInfo();
... ...