Authored by chenchao

add prd info in group by sku+price

package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.req.SellerGoodsRequest;
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.yohobuy.ufo.model.order.resp.SellerOrderListResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.request.SellerGoodsListRequest;
import com.yohoufo.order.service.impl.SkupListService;
import com.yohoufo.order.utils.LoggerUtils;
... ... @@ -15,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Objects;
/**
* Created by chao.chen on 2018/12/19.
*/
... ... @@ -84,6 +90,17 @@ public class SellerGoodsController {
return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("卖家订单列表").build();
}
@RequestMapping(params = "method=ufo.sellerGoods.refresh")
@ResponseBody
public ApiResponse refresh(@RequestParam("productId") int productId,
@RequestParam("uid") int uid) {
SellerGoodsRequest orderRequest = SellerGoodsRequest.builder()
.uid(uid).productId(productId)
.build();
logger.info("in ufo.sellerGoods.refresh, req {}", orderRequest);
OrderListInfo orderListInfo = skupListService.getOrderListInfo(orderRequest);
return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfo).message("刷新成功").build();
}
}
... ...
... ... @@ -3,17 +3,18 @@ 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.GoodsInfo;
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.req.SellerGoodsRequest;
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.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.SellerGoodsListRequest;
... ... @@ -206,14 +207,34 @@ public class SkupListService {
return respBuilder.build();
}
final SellerType sellerType = SellerType.ENTRY;
List<OrderListInfo> data = buildPrdSkuList(sogList, sellerType);
respBuilder.data(data);
List<OrderListInfo> orderListInfos = buildPrdSkuList(sogList, sellerType);
respBuilder.data(orderListInfos);
ProductInfo productInfo = buildProductInfo(sogList);
respBuilder.productInfo(productInfo);
return respBuilder.build();
}
public List<OrderListInfo> buildPrdSkuList(List<SellerOrderGoods> sogList, SellerType sellerType){
ProductInfo buildProductInfo(List<SellerOrderGoods> sogList){
ProductInfo productInfo = new ProductInfo();
SellerOrderGoods sog = sogList.get(0);
productInfo.setProductId(sog.getProductId());
productInfo.setProductName(sog.getProductName());
productInfo.setColorId(sog.getColorId());
productInfo.setColorName(sog.getColorName());
String imageUrl = ImageUrlAssist.getAllProductPicUrl(sog.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
productInfo.setImageUrl(imageUrl);
//
productInfo.setSizeNum(sogList.size());
int storageNum = 0;
for(SellerOrderGoods csog : sogList){
storageNum += csog.getStorageNum();
}
productInfo.setStorageNum(storageNum);
return productInfo;
}
public List<OrderListInfo> buildPrdSkuList(List<SellerOrderGoods> sogList, SellerType sellerType){
ProductInfo productInfo = new ProductInfo();
Map<String, String> overPriceTipsMap = sellerOrderListService.buildOverPriceTipsMap(sogList);
List<OrderListInfo> data ;
data = sogList.parallelStream()
... ... @@ -234,6 +255,27 @@ public class SkupListService {
return data;
}
/**
* 根据单个商品id查询入驻后商品
* @param req
* @return
*/
public OrderListInfo getOrderListInfo(SellerGoodsRequest req){
Integer status = SkupStatus.CAN_SELL.getCode();
Integer uid = req.getUid();
SellerOrderGoods sogCondition = new SellerOrderGoods();
Integer productId;
sogCondition.setProductId(productId=req.getProductId());
sogCondition.setUid(uid);
sogCondition.setStatus(status);
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition, 0, 1);
if (CollectionUtils.isEmpty(sogList)){
logger.warn("in getOrderListInfo soglist is empty req {}", req);
return null;
}
return buildOrderListInfo(sogList.get(0), Arrays.asList(status));
}
OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods, List<Integer> statusList) {
Integer uid;
OrderListInfo orderListInfo = new OrderListInfo();
... ... @@ -291,9 +333,10 @@ public class SkupListService {
productInfo.setColorName(sellerOrderGoods.getColorName());
productInfo.setProductName(sellerOrderGoods.getProductName());
String imageUrl = ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
productInfo.setImageUrl(imageUrl);
productInfo.setGoodImg(imageUrl);
Integer productId;
productInfo.setProductId(productId=sellerOrderGoods.getProductId());
productInfo.setStorageNum(sellerOrderGoods.getStorageNum());
//
orderListInfo.setGoodsInfo(productInfo);
... ...