package cn.freemud.service.impl;

import cn.freemud.adapter.ShoppingCartConvertAdapter;
import cn.freemud.entities.dto.product.ProductTypeBeanDTO;
import cn.freemud.entities.vo.CartGoods;
import com.alibaba.fastjson.JSON;

import java.util.List;

/**
 * @author : xh.Z
 * @email : fisherman0510@163.com
 * @Date : 2022/11/1 15:48
 * @description :
 */
public class DemoMain {
    public static void main(String[] args) {
        CartGoods cartGoods = JSON.parseObject("{\"singleOrder\":0,\"subForeignName\":\"\",\"isTableware\":false,\"skuForeignName\":\"\",\"createTimeMili\":1667287572100,\"pic\":\"https://picture.sandload.cn/1652755219677.png\",\"originalMaterialAmount\":0,\"riseSell\":1,\"isMonthCard\":0,\"memberDiscount\":100,\"spuForeignName\":\"\",\"skuId\":\"241152650474924095\",\"addCartTime\":1667287572100,\"classificationForeignName\":\"\",\"linkedId\":\"\",\"cartGoodsUid\":\"d7398995-5e75-445e-8fd3-d17bee2ac571\",\"isB3S1CouponGoods\":0,\"weight\":0.0,\"classificationId\":\"\",\"goodsType\":2,\"originalProductType\":7,\"unit\":\"\",\"qty\":1,\"name\":\"只有固定套餐\",\"isB3S1Coupon\":0,\"couponData\":[],\"spuName\":\"只有固定套餐\",\"originalPrice\":0,\"goodsId\":\"spq88710125853421364485\",\"productMaterialList\":[],\"customerCode\":\"bnjui875\",\"finalPrice\":100,\"productComboList\":[{\"spuName\":\"柠檬茶\",\"originalPrice\":100,\"goodsId\":\"218530585442843686\",\"customerCode\":\"hlsnmc001\",\"finalPrice\":100,\"pic\":\"https://picture.sandload.cn/1631171610655.png\",\"foreignName\":\"\",\"extra\":[],\"spuForeignName\":\"\",\"skuId\":\"218530585442843686\",\"linkedId\":\"\",\"amount\":100,\"stockLimit\":false,\"weight\":0.0,\"tax\":0.0,\"originalProductType\":1,\"weightType\":false,\"unit\":\"\",\"originalAmount\":100,\"taxId\":\"\",\"qty\":1,\"name\":\"柠檬茶\"},{\"spuName\":\"柚子茶\",\"originalPrice\":100,\"goodsId\":\"215058511331065876\",\"customerCode\":\"903\",\"finalPrice\":100,\"pic\":\"https://picture.sandload.cn/1627894433448.png\",\"foreignName\":\"\",\"extra\":[],\"spuForeignName\":\"\",\"skuId\":\"215058511331065876\",\"linkedId\":\"\",\"amount\":100,\"stockLimit\":false,\"weight\":0.0,\"tax\":0.0,\"originalProductType\":1,\"weightType\":false,\"unit\":\"\",\"originalAmount\":100,\"taxId\":\"\",\"qty\":1,\"name\":\"柚子茶\"},{\"spuName\":\"薯条\uD83C\uDF36\",\"originalPrice\":100,\"goodsId\":\"245793855683830582\",\"customerCode\":\"xy66\",\"finalPrice\":100,\"pic\":\"https://picture.sandload.cn/1657160747233.png\",\"foreignName\":\"\",\"extra\":[{\"attributeId\":\"245793500277383947\",\"attributeName\":\"正常糖\"},{\"attributeId\":\"245793437248529157\",\"attributeName\":\"☆[微笑]\uD83C\uDF36️辣\"},{\"attributeId\":\"218527006041635865\",\"attributeName\":\"花生酱\"}],\"specProductId\":\"245793500277383947/245793437248529157/218527006041635865\",\"spuForeignName\":\"\",\"skuId\":\"245793855683830582\",\"linkedId\":\"\",\"amount\":100,\"stockLimit\":false,\"weight\":0.0,\"tax\":0.0,\"originalProductType\":1,\"weightType\":false,\"unit\":\"\",\"originalAmount\":100,\"subName\":\"正常糖/☆[微笑]\uD83C\uDF36️辣/花生酱\",\"taxId\":\"\",\"qty\":1,\"name\":\"薯条\uD83C\uDF36\"}],\"stockMode\":1,\"packPrice\":0,\"skuName\":\"只有固定套餐\",\"foreignName\":\"\",\"classificationName\":\"\",\"extra\":[],\"canUseCoupon\":1,\"productGroupList\":[],\"amount\":0,\"stockLimit\":false,\"isMonthCardGoods\":0,\"weightType\":false,\"originalAmount\":0,\"subName\":\"\",\"isSunnyCoupon\":0,\"materialAmount\":0,\"spuId\":\"241152650474924095\",\"couponCode\":\"88710125853421364485\"}",
                CartGoods.class);
        List<ProductTypeBeanDTO> productBeans = JSON.parseArray("[{\"additionalGroupList\":[],\"barcode\":\"\",\"brandId\":\"\",\"brandName\":\"\",\"businessNo\":\"\",\"category\":\"\",\"categoryName\":\"\",\"companyId\":\"2692\",\"customerCode\":\"bnjui875\",\"finalPrice\":100,\"foreignName\":\"\",\"isDishware\":0,\"isSkuProduct\":0,\"linkedId\":\"\",\"memberDiscount\":0,\"name\":\"只有固定套餐\",\"openMemberDiscount\":0,\"originalPrice\":100,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1652755219677.png\",\"pid\":\"241152650474924095\",\"productAttributeGroupList\":[],\"productBindingCouponTypes\":[],\"productCode\":\"ui9087ty78\",\"productComboList\":[{\"customerCode\":\"hlsnmc001\",\"finalPrice\":100,\"foreignProductName\":\"\",\"linkedId\":\"\",\"originalPrice\":100,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1631171610655.png\",\"productCode\":\"hlsnmc001\",\"productId\":\"218530585442843686\",\"productName\":\"柠檬茶\",\"productType\":1,\"quantity\":1,\"stockLimit\":1,\"tax\":0.0,\"taxId\":\"\",\"unit\":\"\",\"weight\":0.0,\"weightType\":0},{\"customerCode\":\"903\",\"finalPrice\":100,\"foreignProductName\":\"\",\"linkedId\":\"\",\"originalPrice\":100,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1627894433448.png\",\"productCode\":\"123\",\"productId\":\"215058511331065876\",\"productName\":\"柚子茶\",\"productType\":1,\"quantity\":1,\"stockLimit\":1,\"tax\":0.0,\"taxId\":\"\",\"unit\":\"\",\"weight\":0.0,\"weightType\":0},{\"customerCode\":\"xy66\",\"finalPrice\":100,\"foreignProductName\":\"\",\"linkedId\":\"\",\"originalPrice\":100,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1657160747233.png\",\"productCode\":\"12\",\"productId\":\"245793855683830582\",\"productName\":\"薯条\uD83C\uDF36\",\"productType\":1,\"quantity\":1,\"stockLimit\":1,\"tax\":0.0,\"taxId\":\"\",\"unit\":\"\",\"weight\":0.0,\"weightType\":0}],\"productGroupList\":[],\"productPictureList\":[{\"sequence\":\"0\",\"type\":\"default\",\"url\":\"https://picture.sandload.cn/1652755219677.png\"}],\"riseSell\":1,\"singleOrder\":0,\"skuList\":[],\"skuSpecValues\":[],\"specification\":\"\",\"status\":2,\"stock\":9999,\"stockLimit\":2,\"stockMode\":2,\"type\":7,\"unit\":\"\",\"weight\":0.0,\"weightType\":0}]",
                ProductTypeBeanDTO.class);

        ShoppingCartConvertAdapter adapter = new ShoppingCartConvertAdapter();
        adapter.updateStockModelAndStockLimit(cartGoods,productBeans);
    }
}
