shiyj1101
2021-08-05 e57e32fc43da31917912eebb4e47d4e50df1a9e9
service-goods/src/main/java/com/java110/goods/api/ProductApi.java
old mode 100644 new mode 100755
@@ -169,9 +169,19 @@
        JSONObject spec = null;
        List<ProductSpecValuePo> productSpecValuePos = new ArrayList<>();
        boolean hasDefault = false;
        ProductSpecValuePo productSpecValuePo = null;
        for (int specIndex = 0; specIndex < productSpecs.size(); specIndex++) {
            spec = productSpecs.getJSONObject(specIndex);
            productSpecValuePos.add(BeanConvertUtil.covertBean(spec, ProductSpecValuePo.class));
            productSpecValuePo = BeanConvertUtil.covertBean(spec, ProductSpecValuePo.class);
            productSpecValuePos.add(productSpecValuePo);
            if("T".equals(productSpecValuePo.getIsDefault())){
                hasDefault = true;
            }
        }
        if(!hasDefault){
            throw new IllegalArgumentException("请求报文中未包含默认规格");
        }
        ProductPo productPo = BeanConvertUtil.covertBean(reqJson, ProductPo.class);
@@ -209,15 +219,25 @@
        JSONObject spec = null;
        List<ProductSpecValuePo> productSpecValuePos = null;
        ;
        boolean hasDefault = false;
        ProductSpecValuePo productSpecValuePo = null;
        if (productSpecs != null) {
            productSpecValuePos = new ArrayList<>();
            for (int specIndex = 0; specIndex < productSpecs.size(); specIndex++) {
                spec = productSpecs.getJSONObject(specIndex);
                productSpecValuePos.add(BeanConvertUtil.covertBean(spec, ProductSpecValuePo.class));
                productSpecValuePo = BeanConvertUtil.covertBean(spec, ProductSpecValuePo.class);
                productSpecValuePos.add(productSpecValuePo);
                if("T".equals(productSpecValuePo.getIsDefault())){
                    hasDefault = true;
                }
            }
        }
        if(!hasDefault){
            throw new IllegalArgumentException("请求报文中未包含默认规格");
        }
        ProductPo productPo = BeanConvertUtil.covertBean(reqJson, ProductPo.class);
        productPo.setStoreId(storeId);