diff --git a/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java b/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java index 778eac91..3e75b8aa 100644 --- a/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java +++ b/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java @@ -3,9 +3,9 @@ package co.yixiang.utils.location; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; -import co.yixiang.constant.ShopKeyUtils; import co.yixiang.exception.BadRequestException; import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.ShopKeyUtils; import com.alibaba.fastjson.JSONObject; /** diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java index 1d63d38b..cf11b0b2 100644 --- a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java @@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; @@ -50,6 +51,7 @@ import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @author hupeng @@ -119,7 +121,12 @@ public class StoreCombinationController { .eq(YxStoreProductAttrResult::getProductId,yxStoreCombination.getProductId()).last("limit 1")); JSONObject result = JSON.parseObject(storeProductAttrResult.getResult()); List attrValues = storeProductAttrValueService.list(new LambdaQueryWrapper().eq(YxStoreProductAttrValue::getProductId, yxStoreCombination.getProductId())); - List productFormatDtos = generator.convert(attrValues, ProductFormatDto.class); + List productFormatDtos =attrValues.stream().map(i ->{ + ProductFormatDto productFormatDto = new ProductFormatDto(); + BeanUtils.copyProperties(i,productFormatDto); + productFormatDto.setPic(i.getImage()); + return productFormatDto; + }).collect(Collectors.toList()); if(SpecTypeEnum.TYPE_1.getValue().equals(yxStoreCombination.getSpecType())){ productDto.setAttr(new ProductFormatDto()); productDto.setAttrs(productFormatDtos); diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java index 8c5e058c..2187fa72 100644 --- a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java @@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; @@ -39,6 +40,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.*; +import java.util.stream.Collectors; /** * @author hupeng @@ -135,8 +137,12 @@ public class StoreSeckillController { JSONObject result = JSON.parseObject(storeProductAttrResult.getResult()); List attrValues = storeProductAttrValueService.list(new LambdaQueryWrapper().eq(YxStoreProductAttrValue::getProductId, yxStoreSeckill.getProductId())); - List productFormatDtos = generator.convert(attrValues, ProductFormatDto.class); - + List productFormatDtos =attrValues.stream().map(i ->{ + ProductFormatDto productFormatDto = new ProductFormatDto(); + BeanUtils.copyProperties(i,productFormatDto); + productFormatDto.setPic(i.getImage()); + return productFormatDto; + }).collect(Collectors.toList()); if(SpecTypeEnum.TYPE_1.getValue().equals(yxStoreSeckill.getSpecType())){ productDto.setAttr(new ProductFormatDto()); productDto.setAttrs(productFormatDtos); diff --git a/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java index 6acd1793..d18554eb 100644 --- a/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java +++ b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java @@ -36,6 +36,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; @@ -57,6 +58,7 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @author hupeng @@ -186,7 +188,12 @@ public class StoreProductController { .eq(YxStoreProductAttrResult::getProductId,id).last("limit 1")); JSONObject result = JSON.parseObject(storeProductAttrResult.getResult()); List attrValues = storeProductAttrValueService.list(new LambdaQueryWrapper().eq(YxStoreProductAttrValue::getProductId, yxStoreProduct.getId())); - List productFormatDtos = generator.convert(attrValues, ProductFormatDto.class); + List productFormatDtos =attrValues.stream().map(i ->{ + ProductFormatDto productFormatDto = new ProductFormatDto(); + BeanUtils.copyProperties(i,productFormatDto); + productFormatDto.setPic(i.getImage()); + return productFormatDto; + }).collect(Collectors.toList()); if(SpecTypeEnum.TYPE_1.getValue().equals(yxStoreProduct.getSpecType())){ productDto.setAttr(new ProductFormatDto()); productDto.setAttrs(productFormatDtos);