Authored by 张帅

提供接口_种草相关

package com.yohoufo.order.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
import com.yohobuy.ufo.model.order.common.TabType;
... ... @@ -24,6 +27,9 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@RestController
... ... @@ -366,4 +372,57 @@ public class BuyerOrderController {
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
return new ApiResponse.ApiResponseBuilder().code(200).data(buyerOrderNums).message("get orderListNums success").build();
}
/**
* [购买] 已购买的商品列表
*/
@RequestMapping(params = "method=ufo.buyedGoods.list")
@ResponseBody
public ApiResponse getMyBuyedGoods(
@RequestParam("uid") int uid,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
TabType actor = TabType.BUY;
OrderListRequest orderListRequest = OrderListRequest.builder()
.uid(uid)
.type(5)
.page(page)
.limit(limit)
.tabType(actor.getValue())
.actor(actor)
.build();
LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest);
PageResp<OrderListInfo> orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
List<JSONObject> goods = Lists.newArrayList();
List<Integer> goodsId = Lists.newArrayList();
if(null != orderListInfoRsp.getData() ){
for (OrderListInfo orderListInfo: orderListInfoRsp.getData()) {
GoodsInfo goodsInfo = orderListInfo.getGoodsInfo();
if(!goodsId.contains(goodsInfo.getProductId())){
JSONObject object = new JSONObject();
object.put("image",goodsInfo.getGoodImg());
object.put("market_price",goodsInfo.getGoodPrice());
object.put("product_id",goodsInfo.getProductId());
object.put("product_name",goodsInfo.getProductName());
object.put("product_skn",goodsInfo.getProductId());
object.put("sales_price",goodsInfo.getGoodPrice());
goods.add(object);
goodsId.add(goodsInfo.getProductId());
}
}
}
Map<String, Object> map = new HashMap<>();
map.put("product_list", goods);
map.put("page_total", orderListInfoRsp.getPagetotal());
map.put("page", orderListInfoRsp.getPage());
map.put("page_size", limit);
map.put("total", orderListInfoRsp.getTotal());
return new ApiResponse.ApiResponseBuilder().code(200).data(map).message("已购买商品列表").build();
}
}
... ...