From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001 From: lee <4766465@qq.com> Date: Wed, 18 Dec 2024 13:27:00 +0800 Subject: [PATCH] init --- system-test/src/main/java/com/yami/shop/systemtest/data/ProductData.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 58 insertions(+), 0 deletions(-) diff --git a/system-test/src/main/java/com/yami/shop/systemtest/data/ProductData.java b/system-test/src/main/java/com/yami/shop/systemtest/data/ProductData.java new file mode 100644 index 0000000..98bf271 --- /dev/null +++ b/system-test/src/main/java/com/yami/shop/systemtest/data/ProductData.java @@ -0,0 +1,58 @@ +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; + } + +} -- Gitblit v1.9.3