package com.yami.shop.systemtest.data;
|
|
import com.yami.shop.bean.model.Product;
|
import com.yami.shop.bean.model.Sku;
|
import com.yami.shop.bean.param.ProductParam;
|
import com.yami.shop.systemtest.base.BaseTest;
|
import com.yami.shop.systemtest.constants.Constant;
|
import com.yami.shop.systemtest.util.HttpUtil;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 商品数据,为啥叫商品数据不叫商品测试呢,因为这个商品在订单里面都会用到
|
*
|
*/
|
public class ProductData {
|
|
public static Long getProduct(double price,double deliveryAmount) {
|
String url = Constant.SHOP_URL + "/prod/prod";
|
return HttpUtil.post(url, getProductParam(price, deliveryAmount), Long.class);
|
}
|
|
|
public static ProductParam getProductParam(double price,double deliveryAmount){
|
ProductParam productParam = new ProductParam();
|
productParam.setCategoryId(107L);
|
productParam.setShopCategoryId(197L);
|
productParam.setDeliveryAmount(deliveryAmount);
|
productParam.setPrice(price);
|
// 实体商品
|
productParam.setMold(0);
|
productParam.setProdName("接口测试商品");
|
productParam.setProdNameCn("接口测试商品");
|
productParam.setProdNameEn("en");
|
productParam.setPic("/test.png");
|
productParam.setImgs("/test.png");
|
productParam.setOriPrice(0d);
|
|
// 配送方式
|
Product.DeliveryModeVO deliveryModeVO = new Product.DeliveryModeVO();
|
deliveryModeVO.setHasShopDelivery(true);
|
deliveryModeVO.setHasUserPickUp(true);
|
deliveryModeVO.setHasCityDelivery(true);
|
productParam.setDeliveryModeVo(deliveryModeVO);
|
|
List<Sku> skuList = new ArrayList<>();
|
Sku sku = new Sku();
|
sku.setPrice(price);
|
sku.setStocks(100);
|
skuList.add(sku);
|
|
productParam.setSkuList(skuList);
|
|
return productParam;
|
}
|
|
}
|