From 02d23dc21753c65c8d962b1d85071c64bcd5b613 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 09:46:38 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=B8=BB=E8=A6=81=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=8F=82=E6=95=B0=E5=90=8E=E7=AB=AF=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98=EF=BC=8C=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E9=97=AE=E9=A2=98=E7=AD=89=202=E3=80=81=E9=85=8D?= =?UTF-8?q?=E9=80=81=E5=95=86=E5=93=81=E8=B6=85=E5=87=BA=E9=85=8D=E9=80=81?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E6=8F=90=E5=87=BA=E8=AD=A6=E5=91=8A=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=98=AF=E4=BE=9D=E7=84=B6=E5=8F=AF=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/common/enums/ResultCode.java | 2 + .../common/verification/SliderImageUtil.java | 2 +- .../lili/modules/goods/entity/dos/Goods.java | 4 +- .../modules/goods/entity/dos/GoodsParams.java | 67 -------- .../modules/goods/entity/dos/Parameters.java | 11 +- .../goods/entity/dos/Specification.java | 4 +- .../goods/entity/dto/DraftGoodsDTO.java | 3 +- .../goods/entity/dto/GoodsOperationDTO.java | 7 +- .../goods/entity/dto/GoodsParamsDTO.java | 31 ++++ .../goods/entity/dto/GoodsParamsItemDTO.java | 35 +++++ .../goods/entity/vos/DraftGoodsVO.java | 5 +- ...odsParamsVO.java => GoodsParamsDTOVO.java} | 4 +- .../goods/entity/vos/GoodsParamsGroupVO.java | 2 +- .../modules/goods/entity/vos/GoodsVO.java | 4 +- .../goods/mapper/GoodsParamsMapper.java | 8 +- .../goods/service/GoodsParamsService.java | 76 ---------- .../serviceimpl/CategoryServiceImpl.java | 10 +- .../serviceimpl/DraftGoodsServiceImpl.java | 9 +- .../serviceimpl/GoodsParamsServiceImpl.java | 143 ------------------ .../goods/serviceimpl/GoodsServiceImpl.java | 26 ++-- .../serviceimpl/GoodsSkuServiceImpl.java | 8 +- .../order/cart/render/TradeBuilder.java | 13 +- .../search/entity/dos/EsGoodsIndex.java | 53 +++---- .../search/service/EsGoodsIndexService.java | 6 +- .../serviceimpl/EsGoodsIndexServiceImpl.java | 8 +- ...tegoryParameterGroupManagerController.java | 7 +- .../GoodsParameterManagerController.java | 1 - .../goods/ParameterManagerController.java | 1 - .../other/ElasticsearchController.java | 8 +- 29 files changed, 179 insertions(+), 379 deletions(-) delete mode 100644 framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java create mode 100644 framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java create mode 100644 framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java rename framework/src/main/java/cn/lili/modules/goods/entity/vos/{GoodsParamsVO.java => GoodsParamsDTOVO.java} (90%) delete mode 100644 framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java delete mode 100644 framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java index bc0b33c2..b23eb766 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -196,6 +196,8 @@ public enum ResultCode { ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"), + ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"), + /** * 支付 */ diff --git a/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java b/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java index a40cfc67..39b00968 100644 --- a/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java +++ b/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java @@ -78,7 +78,7 @@ public class SliderImageUtil { graphics.dispose(); //添加水印 - ImageUtil.addWatermark(originalImage, "请滑动拼图"); + ImageUtil.addWatermark(originalImage, "LILI-SHOP"); ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();//新建流。 ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。 byte[] newImagery = newImageOs.toByteArray(); diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java index acf79d3d..e4f8eefa 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java @@ -221,8 +221,8 @@ public class Goods extends BaseEntity { this.intro = goodsOperationDTO.getIntro(); this.mobileIntro = goodsOperationDTO.getMobileIntro(); this.cost = goodsOperationDTO.getCost(); - if (goodsOperationDTO.getGoodsParamsList() != null && goodsOperationDTO.getGoodsParamsList().isEmpty()) { - this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsList()); + if (goodsOperationDTO.getGoodsParamsDTOList() != null && goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) { + this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList()); } //如果立即上架则 this.marketEnable = goodsOperationDTO.isRelease() ? GoodsStatusEnum.UPPER.name() : GoodsStatusEnum.DOWN.name(); diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java deleted file mode 100644 index 16045221..00000000 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java +++ /dev/null @@ -1,67 +0,0 @@ -package cn.lili.modules.goods.entity.dos; - -import cn.lili.base.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.hibernate.validator.constraints.Length; - -import javax.persistence.Entity; -import javax.persistence.Table; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; - -/** - * 商品关联参数 - * - * @author pikachu - * @date 2020-02-23 9:14:33 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Entity -@Table(name = "li_goods_params") -@TableName("li_goods_params") -@ApiModel(value = "商品关联参数") -public class GoodsParams extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 商品id - */ - @TableField(value = "goods_id") - @ApiModelProperty(value = "商品id", hidden = true) - private String goodsId; - /** - * 参数id - */ - @TableField(value = "param_id") - @ApiModelProperty(value = "参数id", required = true) - private String paramId; - /** - * 参数名字 - */ - @TableField(value = "param_name") - @ApiModelProperty(value = "参数名字", required = true) - private String paramName; - /** - * 参数值 - */ - @TableField(value = "param_value") - @ApiModelProperty(value = "参数值", required = true) - @Length(max = 100, message = "参数值字符不能大于120") - private String paramValue; - - @TableField(value = "is_index") - @ApiModelProperty(value = "是否可索引,0 不显示 1 显示", required = true) - @NotNull(message = "是否可索引必选") - @Min(value = 0, message = "是否可索引传值不正确") - @Max(value = 1, message = "是否可索引传值不正确") - private Integer isIndex = 0; - -} \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java index f9198944..96fcc1f8 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java @@ -1,13 +1,17 @@ package cn.lili.modules.goods.entity.dos; -import cn.lili.base.BaseEntity; +import cn.lili.base.IdEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Length; +import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Max; import javax.validation.constraints.Min; @@ -25,7 +29,9 @@ import javax.validation.constraints.NotNull; @Table(name = "li_parameters") @TableName("li_parameters") @ApiModel(value = "商品参数") -public class Parameters extends BaseEntity { +public class Parameters extends IdEntity { + + private static final long serialVersionUID = -566510714456317006L; @@ -36,6 +42,7 @@ public class Parameters extends BaseEntity { @ApiModelProperty(value = "选择值") + @NotEmpty(message = "参数选项值必填") private String options; @ApiModelProperty(value = "是否可索引,0 不显示 1 显示", required = true) diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java index 436d6ce3..b4e8a272 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java @@ -1,6 +1,6 @@ package cn.lili.modules.goods.entity.dos; -import cn.lili.base.BaseEntity; +import cn.lili.base.IdEntity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -23,7 +23,7 @@ import javax.validation.constraints.NotEmpty; @Table(name = "li_specification") @TableName("li_specification") @ApiModel(value = "规格项") -public class Specification extends BaseEntity { +public class Specification extends IdEntity { private static final long serialVersionUID = 147792597901239486L; diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java index 607223b6..b1517e6b 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java @@ -1,7 +1,6 @@ package cn.lili.modules.goods.entity.dto; import cn.lili.modules.goods.entity.dos.DraftGoods; -import cn.lili.modules.goods.entity.dos.GoodsParams; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -22,7 +21,7 @@ public class DraftGoodsDTO extends DraftGoods { @ApiModelProperty(value = "商品参数") @Valid - private List goodsParamsList; + private List goodsParamsDTOList; @ApiModelProperty(value = "商品图片") private List goodsGalleryList; diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java index 20cf8120..3decd397 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java @@ -1,6 +1,5 @@ package cn.lili.modules.goods.entity.dto; -import cn.lili.modules.goods.entity.dos.GoodsParams; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; @@ -83,8 +82,7 @@ public class GoodsOperationDTO implements Serializable { private boolean recommend; @ApiModelProperty(value = "商品参数") - @Valid - private List goodsParamsList; + private List goodsParamsDTOList; @ApiModelProperty(value = "商品图片") private List goodsGalleryList; @@ -121,4 +119,7 @@ public class GoodsOperationDTO implements Serializable { */ @ApiModelProperty(value = "商品类型") private String goodsType; + + + } diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java new file mode 100644 index 00000000..09be40e0 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java @@ -0,0 +1,31 @@ +package cn.lili.modules.goods.entity.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 商品关联参数 + * + * @author pikachu + * @date 2020-02-23 9:14:33 + */ +@Data +@ApiModel(value = "商品参数分组") +public class GoodsParamsDTO { + + @TableField(value = "group_id") + @ApiModelProperty(value = "分组id") + private String groupId; + + @TableField(value = "group_name") + @ApiModelProperty(value = "分组名称") + private String groupName; + + @ApiModelProperty(value = "分组内的商品参数列表") + private List goodsParamsItemDTOList; + +} \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java new file mode 100644 index 00000000..84eb2113 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java @@ -0,0 +1,35 @@ +package cn.lili.modules.goods.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; + +/** + * 商品参数项 + * + * @author Chopper + * @version v1.0 + * 2021-06-24 15:41 + */ +@Data +@ApiModel(value = "商品参数列表") +public class GoodsParamsItemDTO { + + @ApiModelProperty(value = "参数ID") + private String paramId; + + @ApiModelProperty(value = "参数名字") + private String paramName; + + @ApiModelProperty(value = "参数值") + private String paramValue; + + @ApiModelProperty(value = "是否可索引,0 不索引 1 索引") + private Integer isIndex = 0; + + @ApiModelProperty(value = "是否必填,0 不显示 1 显示") + private Integer required = 0; +} diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java index f6e67966..2bf39fad 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java @@ -1,10 +1,9 @@ package cn.lili.modules.goods.entity.vos; import cn.lili.modules.goods.entity.dos.DraftGoods; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.EqualsAndHashCode; import java.util.List; @@ -23,7 +22,7 @@ public class DraftGoodsVO extends DraftGoods { private List categoryName; @ApiModelProperty(value = "商品参数") - private List goodsParamsList; + private List goodsParamsDTOList; @ApiModelProperty(value = "商品图片") private List goodsGalleryList; diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsDTOVO.java similarity index 90% rename from framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsVO.java rename to framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsDTOVO.java index 795a22c6..64deda4f 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsVO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsDTOVO.java @@ -1,7 +1,7 @@ package cn.lili.modules.goods.entity.vos; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -12,7 +12,7 @@ import lombok.Data; * @date 2020-02-26 23:24:13 */ @Data -public class GoodsParamsVO extends GoodsParams { +public class GoodsParamsDTOVO extends GoodsParamsDTO { private static final long serialVersionUID = -4904700751774005326L; @ApiModelProperty("1 输入项 2 选择项") diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java index 18d0a9d5..9202f953 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java @@ -16,7 +16,7 @@ import java.util.List; public class GoodsParamsGroupVO implements Serializable { private static final long serialVersionUID = 1450550797436233753L; @ApiModelProperty("参数组关联的参数集合") - private List params; + private List params; @ApiModelProperty("参数组名称") private String groupName; @ApiModelProperty("参数组id") diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java index 6207aac0..ebb31251 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java @@ -1,7 +1,7 @@ package cn.lili.modules.goods.entity.vos; import cn.lili.modules.goods.entity.dos.Goods; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -22,7 +22,7 @@ public class GoodsVO extends Goods { private List categoryName; @ApiModelProperty(value = "商品参数") - private List goodsParamsList; + private List goodsParamsDTOList; @ApiModelProperty(value = "商品图片") private List goodsGalleryList; diff --git a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java index 37d136f4..471c649c 100644 --- a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java +++ b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java @@ -1,7 +1,7 @@ package cn.lili.modules.goods.mapper; -import cn.lili.modules.goods.entity.dos.GoodsParams; -import cn.lili.modules.goods.entity.vos.GoodsParamsVO; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; +import cn.lili.modules.goods.entity.vos.GoodsParamsDTOVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select; @@ -14,9 +14,9 @@ import java.util.List; * @author pikachu * @date 2020-02-18 15:18:56 */ -public interface GoodsParamsMapper extends BaseMapper { +public interface GoodsParamsMapper extends BaseMapper { @Select("select p.*,gp.param_value,p.group_id from li_parameters p left join li_goods_params gp on p.id=gp.param_id and gp.goods_id = #{goodsId} where p.category_id = #{categoryId} order by sort") - List paramList(String goodsId, String categoryId); + List paramList(String goodsId, String categoryId); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java b/framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java deleted file mode 100644 index bd8195fc..00000000 --- a/framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java +++ /dev/null @@ -1,76 +0,0 @@ -package cn.lili.modules.goods.service; - -import cn.lili.modules.goods.entity.dos.GoodsParams; -import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO; -import cn.lili.modules.goods.entity.vos.GoodsParamsVO; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; - - -/** - * 商品关联参数业务层 - * - * @author pikachu - * @date 2020-03-13 16:18:56 - */ -public interface GoodsParamsService extends IService { - - /** - * 添加商品参数 - * @param paramList 参数列表 - * @param goodsId 商品ID - */ - void addParams(List paramList, String goodsId); - - /** - * 更新商品参数是否索引 - * - * @param paramId 参数id - * @param isIndex 是否索引 - */ - void updateParametersIsIndex(String paramId, Integer isIndex); - - /** - * 根据参数id删除已经设置的商品参数 - * - * @param paramId 参数id - */ - void deleteByParamId(String paramId); - - /** - * 获取商品关联参数 - * - * @param goodsId 商品ID - * @return 商品关联参数 - */ - List getGoodsParamsByGoodsId(String goodsId); - - /** - * 添加商品参数 - * - * @param goodsParamsVO 商品参数 - * @return 添加是否成功 - */ - boolean addParams(GoodsParamsVO goodsParamsVO); - - /** - * 根据分类id查询绑定参数信息 - * - * @param categoryId 分类id - * @param goodsId 商品id - * @return 分类id - */ - List paramList(String categoryId, String goodsId); - - /** - * 查询商品参数信息 - * - * @param goodsId 商品id - * @param categoryId 分了id - * @return 商品参数信息 - */ - List queryGoodsParams(String goodsId, String categoryId); - - -} \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java index 3c46db2b..6f350d1c 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java @@ -8,7 +8,7 @@ import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.dos.CategoryParameterGroup; import cn.lili.modules.goods.entity.vos.CategoryVO; import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO; -import cn.lili.modules.goods.entity.vos.GoodsParamsVO; +import cn.lili.modules.goods.entity.vos.GoodsParamsDTOVO; import cn.lili.modules.goods.mapper.CategoryMapper; import cn.lili.modules.goods.service.CategoryService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -255,13 +255,13 @@ public class CategoryServiceImpl extends ServiceImpl i * @param paramList 参数列表 * @return 拼装后的返回值 */ - private List convertParamList(List groupList, List paramList) { - Map> map = new HashMap<>(16); - for (GoodsParamsVO param : paramList) { + private List convertParamList(List groupList, List paramList) { + Map> map = new HashMap<>(16); + for (GoodsParamsDTOVO param : paramList) { if (map.get(param.getGroupId()) != null) { map.get(param.getGroupId()).add(param); } else { - List list = new ArrayList<>(); + List list = new ArrayList<>(); list.add(param); map.put(param.getGroupId(), list); } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java index ca55c272..25292b88 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java @@ -8,6 +8,7 @@ import cn.lili.common.utils.StringUtils; import cn.lili.modules.goods.entity.dos.*; import cn.lili.modules.goods.entity.dto.DraftGoodsDTO; import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.vos.DraftGoodsVO; import cn.lili.modules.goods.mapper.DraftGoodsMapper; import cn.lili.modules.goods.service.CategoryService; @@ -45,7 +46,7 @@ public class DraftGoodsServiceImpl extends ServiceImpl list = JSONUtil.toList(jsonArray, GoodsSku.class); diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java deleted file mode 100644 index 9c91b756..00000000 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.lili.modules.goods.serviceimpl; - -import cn.lili.modules.goods.entity.dos.CategoryParameterGroup; -import cn.lili.modules.goods.entity.dos.GoodsParams; -import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO; -import cn.lili.modules.goods.entity.vos.GoodsParamsVO; -import cn.lili.modules.goods.mapper.GoodsParamsMapper; -import cn.lili.modules.goods.service.CategoryParameterGroupService; -import cn.lili.modules.goods.service.GoodsParamsService; -import cn.lili.modules.goods.service.ParametersService; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * 商品关联参数接口实现 - * - * @author pikachu - * @version v1.0 - * @since v1.0 - * 2020-02-23 15:18:56 - */ -@Service -@Transactional -public class GoodsParamsServiceImpl extends ServiceImpl implements GoodsParamsService { - //分类-参数绑定 - @Autowired - private CategoryParameterGroupService categoryParameterGroupService; - - - @Override - public void addParams(List paramList, String goodsId) { - //先删除现有商品参数 - this.remove(new UpdateWrapper().eq("goods_id", goodsId)); - //循环添加参数 - if (paramList != null) { - for (GoodsParams param : paramList) { - GoodsParams goodsParams = new GoodsParams(); - goodsParams.setGoodsId(goodsId); - goodsParams.setParamName(param.getParamName()); - goodsParams.setParamValue(param.getParamValue()); - goodsParams.setIsIndex(param.getIsIndex()); - goodsParams.setParamId(param.getId()); - this.save(goodsParams); - } - } - } - - /** - * 更新商品参数是否索引 - * - * @param paramId 参数id - * @param isIndex 是否索引 - */ - @Override - public void updateParametersIsIndex(String paramId, Integer isIndex) { - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(GoodsParams::getParamId, paramId); - updateWrapper.set(GoodsParams::getIsIndex, isIndex); - this.update(updateWrapper); - } - - /** - * 根据参数id删除已经设置的商品参数 - * - * @param paramId 参数id - */ - @Override - public void deleteByParamId(String paramId) { - this.remove(new QueryWrapper().eq("param_id", paramId)); - } - - @Override - public List getGoodsParamsByGoodsId(String goodsId) { - return this.list(new LambdaQueryWrapper().eq(GoodsParams::getGoodsId, goodsId)); - } - - /** - * 添加商品参数 - * - * @param goodsParamsVO 商品参数 - * @return 添加是否成功 - */ - @Override - public boolean addParams(GoodsParamsVO goodsParamsVO) { - return this.save(goodsParamsVO); - } - - @Override - public List paramList(String goodsId, String categoryId) { - return this.baseMapper.paramList(goodsId, categoryId); - } - - @Override - public List queryGoodsParams(String categoryId, String goodsId) { - //查询分类关联参数组 - List groupList = categoryParameterGroupService.getCategoryGroup(categoryId); - //查询商品参数 - List paramList = this.paramList(goodsId, categoryId); - //拼装数据返回 - return this.convertParamList(groupList, paramList); - } - - - /** - * 拼装返回值 - * - * @param paramList - * @return - */ - private List convertParamList(List groupList, List paramList) { - Map> map = new HashMap<>(16); - for (GoodsParamsVO param : paramList) { - if (map.get(param.getGroupId()) != null) { - map.get(param.getGroupId()).add(param); - } else { - List list = new ArrayList<>(); - list.add(param); - map.put(param.getGroupId(), list); - } - } - List resList = new ArrayList<>(); - for (CategoryParameterGroup group : groupList) { - GoodsParamsGroupVO list = new GoodsParamsGroupVO(); - list.setGroupName(group.getGroupName()); - list.setGroupId(group.getId()); - list.setParams(map.get(group.getId())); - resList.add(list); - } - return resList; - } -} \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 29593f34..b93dbeca 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -17,6 +17,7 @@ import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.dos.Goods; import cn.lili.modules.goods.entity.dos.GoodsGallery; import cn.lili.modules.goods.entity.dto.GoodsOperationDTO; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.dto.GoodsSearchParams; import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; @@ -59,9 +60,7 @@ import java.util.List; @Transactional public class GoodsServiceImpl extends ServiceImpl implements GoodsService { - //商品属性 - @Autowired - private GoodsParamsService goodsParamsService; + //分类 @Autowired private CategoryService categoryService; @@ -107,12 +106,12 @@ public class GoodsServiceImpl extends ServiceImpl implements this.checkGoods(goods); //向goods加入图片 this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods); + //添加商品参数 + if (goodsOperationDTO.getGoodsParamsDTOList() != null && !goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) { + goods.setParams(JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList())); + } //添加商品 this.save(goods); - //添加商品参数 - if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) { - this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId()); - } //添加商品sku信息 this.goodsSkuService.add(goodsOperationDTO.getSkuList(), goods); //添加相册 @@ -130,12 +129,12 @@ public class GoodsServiceImpl extends ServiceImpl implements this.checkGoods(goods); //向goods加入图片 this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods); + //添加商品参数 + if (goodsOperationDTO.getGoodsParamsDTOList() != null && !goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) { + goods.setParams(JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList())); + } //修改商品 this.updateById(goods); - //添加商品参数 - if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) { - this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId()); - } //修改商品sku信息 this.goodsSkuService.update(goodsOperationDTO.getSkuList(), goods, goodsOperationDTO.getRegeneratorSkuFlag()); //添加相册 @@ -180,7 +179,10 @@ public class GoodsServiceImpl extends ServiceImpl implements } goodsVO.setCategoryName(categoryName); - goodsVO.setGoodsParamsList(goodsParamsService.getGoodsParamsByGoodsId(goodsId)); + //参数非空则填写参数 + if (StringUtils.isNotEmpty(goods.getParams())) { + goodsVO.setGoodsParamsDTOList(JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class)); + } return goodsVO; } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index 3f7419b1..adfcb2c9 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -14,7 +14,7 @@ import cn.lili.common.utils.PageUtil; import cn.lili.common.utils.StringUtils; import cn.lili.config.rocketmq.RocketmqCustomProperties; import cn.lili.modules.goods.entity.dos.Goods; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.goods.entity.dto.GoodsSearchParams; import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO; @@ -204,7 +204,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i //获取当前商品的索引信息 EsGoodsIndex goodsIndex = goodsIndexService.findById(skuId); if (goodsIndex == null) { - goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsList()); + goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsDTOList()); } //商品规格 GoodsSkuVO goodsSkuDetail = this.getGoodsSkuVO(goodsSku); @@ -458,8 +458,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl i EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId()); EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSku); if (goods.getParams() != null && !goods.getParams().isEmpty()) { - List goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class); - goodsIndex = new EsGoodsIndex(goodsSku, goodsParams); + List goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class); + goodsIndex = new EsGoodsIndex(goodsSku, goodsParamDTOS); } //如果商品库存不为0,并且es中有数据 if (goodsSku.getQuantity() > 0 && esGoodsOld == null) { diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java index d51ddd1c..2f75e40d 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java @@ -1,5 +1,7 @@ package cn.lili.modules.order.cart.render; +import cn.lili.common.enums.ResultCode; +import cn.lili.common.exception.ServiceException; import cn.lili.modules.order.cart.entity.dto.TradeDTO; import cn.lili.modules.order.cart.entity.enums.CartTypeEnum; import cn.lili.modules.order.cart.entity.vo.CartSkuVO; @@ -98,6 +100,15 @@ public class TradeBuilder { log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e); } } + + if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { + StringBuilder stringBuilder = new StringBuilder("包含商品有-"); + tradeDTO.getNotSupportFreight().forEach(sku -> { + stringBuilder.append(sku.getGoodsSku().getGoodsName()); + }); + throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); + } + //购物车信息接受 List cartVOList = new ArrayList<>(); //循环购物车信息 @@ -113,7 +124,7 @@ public class TradeBuilder { /** * 创建一笔交易 * - * @param checkedWay 购物车类型 + * @param checkedWay 购物车类型 * @return 交易信息 */ public Trade createTrade(CartTypeEnum checkedWay) { diff --git a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java index e8388bd1..e3b72a27 100644 --- a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java +++ b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java @@ -1,8 +1,8 @@ package cn.lili.modules.search.entity.dos; import cn.lili.common.elasticsearch.EsSuffix; -import cn.lili.modules.goods.entity.dos.GoodsParams; import cn.lili.modules.goods.entity.dos.GoodsSku; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -273,36 +273,37 @@ public class EsGoodsIndex implements Serializable { this.intro = sku.getIntro(); this.grade = sku.getGrade(); this.releaseTime = new Date(); -// if (CharSequenceUtil.isNotEmpty(sku.getSpecs())) { -// List attributes = new ArrayList<>(); -// JSONObject jsonObject = JSONUtil.parseObj(sku.getSpecs()); -// for (Map.Entry entry : jsonObject.entrySet()) { -// if (!entry.getKey().equals("images")) { -// EsGoodsAttribute attribute = new EsGoodsAttribute(); -// attribute.setType(1); -// attribute.setName(entry.getKey()); -// attribute.setValue(entry.getValue().toString()); -// attributes.add(attribute); -// } -// } -// this.attrList = attributes; -// } } } - public EsGoodsIndex(GoodsSku sku, List goodsParams) { + /** + * 参数索引增加 + * + * @param sku + * @param goodsParamDTOS + */ + public EsGoodsIndex(GoodsSku sku, List goodsParamDTOS) { this(sku); - if (goodsParams != null && !goodsParams.isEmpty()) { + //如果参数不为空 + if (goodsParamDTOS != null && !goodsParamDTOS.isEmpty()) { + //接受不了参数索引 List attributes = new ArrayList<>(); - for (GoodsParams goodsParam : goodsParams) { - EsGoodsAttribute attribute = new EsGoodsAttribute(); - if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) { - attribute.setType(1); - attribute.setName(goodsParam.getParamName()); - attribute.setValue(goodsParam.getParamValue()); - attributes.add(attribute); - } - } + //循环参数分组 + goodsParamDTOS.forEach(goodsParamGroup -> { + //循环分组的内容 + goodsParamGroup.getGoodsParamsItemDTOList().forEach(goodsParam -> { + //如果字段需要索引,则增加索引字段 + if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) { + EsGoodsAttribute attribute = new EsGoodsAttribute(); + attribute.setType(1); + attribute.setName(goodsParam.getParamName()); + attribute.setValue(goodsParam.getParamValue()); + attributes.add(attribute); + } + } + ); + + }); this.attrList = attributes; } } diff --git a/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java b/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java index fbc7bc17..1d696cb2 100644 --- a/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java +++ b/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java @@ -1,6 +1,6 @@ package cn.lili.modules.search.service; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.promotion.entity.dos.PromotionGoods; import cn.lili.modules.promotion.entity.dto.BasePromotion; @@ -146,8 +146,8 @@ public interface EsGoodsIndexService { * 重置当前商品索引 * * @param goodsSku 商品sku信息 - * @param goodsParams 商品参数 + * @param goodsParamDTOS 商品参数 * @return 商品索引 */ - EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParams); + EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParamDTOS); } diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java index e1240279..8ac541e4 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java @@ -8,7 +8,7 @@ import cn.hutool.extra.pinyin.PinyinUtil; import cn.lili.common.elasticsearch.BaseElasticsearchService; import cn.lili.common.elasticsearch.EsSuffix; import cn.lili.config.elasticsearch.ElasticsearchProperties; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.goods.entity.dos.GoodsWords; import cn.lili.modules.goods.entity.enums.GoodsWordsTypeEnum; @@ -368,12 +368,12 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements * 重置当前商品索引 * * @param goodsSku 商品sku信息 - * @param goodsParams 商品参数 + * @param goodsParamDTOS 商品参数 * @return 商品索引 */ @Override - public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParams) { - EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParams); + public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParamDTOS) { + EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParamDTOS); //获取活动信息 Map goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index); //写入促销信息 diff --git a/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java index ca7b820e..4658ab88 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java @@ -1,8 +1,8 @@ package cn.lili.controller.goods; import cn.lili.common.enums.ResultCode; -import cn.lili.common.exception.ServiceException; import cn.lili.common.enums.ResultUtil; +import cn.lili.common.exception.ServiceException; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.dos.CategoryParameterGroup; import cn.lili.modules.goods.entity.dos.Parameters; @@ -14,6 +14,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -50,7 +51,7 @@ public class CategoryParameterGroupManagerController { @ApiOperation(value = "保存数据") @PostMapping - public ResultMessage saveOrUpdate(CategoryParameterGroup categoryParameterGroup) { + public ResultMessage saveOrUpdate(@Validated CategoryParameterGroup categoryParameterGroup) { if (categoryParameterGroupService.save(categoryParameterGroup)) { return ResultUtil.data(categoryParameterGroup); @@ -60,7 +61,7 @@ public class CategoryParameterGroupManagerController { @ApiOperation(value = "更新数据") @PutMapping - public ResultMessage update(CategoryParameterGroup categoryParameterGroup) { + public ResultMessage update(@Validated CategoryParameterGroup categoryParameterGroup) { if (categoryParameterGroupService.updateById(categoryParameterGroup)) { return ResultUtil.data(categoryParameterGroup); diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java index eb9ec22a..c80bbb4d 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java @@ -3,7 +3,6 @@ package cn.lili.controller.goods; import cn.lili.common.enums.ResultUtil; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO; -import cn.lili.modules.goods.service.GoodsParamsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; diff --git a/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java index 8555e5c9..6d16dadb 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java @@ -5,7 +5,6 @@ import cn.lili.common.enums.ResultUtil; import cn.lili.common.exception.ServiceException; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.dos.Parameters; -import cn.lili.modules.goods.service.GoodsParamsService; import cn.lili.modules.goods.service.ParametersService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; diff --git a/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java b/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java index 5ab07dbd..083e91f0 100644 --- a/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java +++ b/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java @@ -2,9 +2,8 @@ package cn.lili.controller.other; import cn.hutool.json.JSONUtil; import cn.lili.modules.goods.entity.dos.Goods; -import cn.lili.modules.goods.entity.dos.GoodsParams; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.dos.GoodsSku; -import cn.lili.modules.goods.entity.dos.Parameters; import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; import cn.lili.modules.goods.service.GoodsService; @@ -15,7 +14,6 @@ import cn.lili.modules.search.entity.dos.EsGoodsIndex; import cn.lili.modules.search.service.EsGoodsIndexService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import io.swagger.annotations.Api; -import org.junit.jupiter.api.Assertions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.GetMapping; @@ -73,8 +71,8 @@ public class ElasticsearchController { Goods goods = goodsService.getById(goodsId); EsGoodsIndex index = new EsGoodsIndex(goodsSku); if (goods.getParams() != null && !goods.getParams().isEmpty()) { - List goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class); - index = new EsGoodsIndex(goodsSku, goodsParams); + List goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class); + index = new EsGoodsIndex(goodsSku, goodsParamDTOS); } Map goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index); index.setPromotionMap(goodsCurrentPromotionMap);