1、主要解决商品参数后端存储格式问题,结构问题等
2、配送商品超出配送区域提出警告,但是依然可以下单问题处理
This commit is contained in:
parent
158234412c
commit
02d23dc217
@ -196,6 +196,8 @@ public enum ResultCode {
|
|||||||
|
|
||||||
ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"),
|
ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"),
|
||||||
|
|
||||||
|
ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付
|
* 支付
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ public class SliderImageUtil {
|
|||||||
graphics.dispose();
|
graphics.dispose();
|
||||||
|
|
||||||
//添加水印
|
//添加水印
|
||||||
ImageUtil.addWatermark(originalImage, "请滑动拼图");
|
ImageUtil.addWatermark(originalImage, "LILI-SHOP");
|
||||||
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();//新建流。
|
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();//新建流。
|
||||||
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
|
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
|
||||||
byte[] newImagery = newImageOs.toByteArray();
|
byte[] newImagery = newImageOs.toByteArray();
|
||||||
|
@ -221,8 +221,8 @@ public class Goods extends BaseEntity {
|
|||||||
this.intro = goodsOperationDTO.getIntro();
|
this.intro = goodsOperationDTO.getIntro();
|
||||||
this.mobileIntro = goodsOperationDTO.getMobileIntro();
|
this.mobileIntro = goodsOperationDTO.getMobileIntro();
|
||||||
this.cost = goodsOperationDTO.getCost();
|
this.cost = goodsOperationDTO.getCost();
|
||||||
if (goodsOperationDTO.getGoodsParamsList() != null && goodsOperationDTO.getGoodsParamsList().isEmpty()) {
|
if (goodsOperationDTO.getGoodsParamsDTOList() != null && goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
|
||||||
this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsList());
|
this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList());
|
||||||
}
|
}
|
||||||
//如果立即上架则
|
//如果立即上架则
|
||||||
this.marketEnable = goodsOperationDTO.isRelease() ? GoodsStatusEnum.UPPER.name() : GoodsStatusEnum.DOWN.name();
|
this.marketEnable = goodsOperationDTO.isRelease() ? GoodsStatusEnum.UPPER.name() : GoodsStatusEnum.DOWN.name();
|
||||||
|
@ -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;
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +1,17 @@
|
|||||||
package cn.lili.modules.goods.entity.dos;
|
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 com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.Max;
|
import javax.validation.constraints.Max;
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
@ -25,7 +29,9 @@ import javax.validation.constraints.NotNull;
|
|||||||
@Table(name = "li_parameters")
|
@Table(name = "li_parameters")
|
||||||
@TableName("li_parameters")
|
@TableName("li_parameters")
|
||||||
@ApiModel(value = "商品参数")
|
@ApiModel(value = "商品参数")
|
||||||
public class Parameters extends BaseEntity {
|
public class Parameters extends IdEntity {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -566510714456317006L;
|
private static final long serialVersionUID = -566510714456317006L;
|
||||||
|
|
||||||
@ -36,6 +42,7 @@ public class Parameters extends BaseEntity {
|
|||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "选择值")
|
@ApiModelProperty(value = "选择值")
|
||||||
|
@NotEmpty(message = "参数选项值必填")
|
||||||
private String options;
|
private String options;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否可索引,0 不显示 1 显示", required = true)
|
@ApiModelProperty(value = "是否可索引,0 不显示 1 显示", required = true)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.lili.modules.goods.entity.dos;
|
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.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@ -23,7 +23,7 @@ import javax.validation.constraints.NotEmpty;
|
|||||||
@Table(name = "li_specification")
|
@Table(name = "li_specification")
|
||||||
@TableName("li_specification")
|
@TableName("li_specification")
|
||||||
@ApiModel(value = "规格项")
|
@ApiModel(value = "规格项")
|
||||||
public class Specification extends BaseEntity {
|
public class Specification extends IdEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 147792597901239486L;
|
private static final long serialVersionUID = 147792597901239486L;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cn.lili.modules.goods.entity.dto;
|
package cn.lili.modules.goods.entity.dto;
|
||||||
|
|
||||||
import cn.lili.modules.goods.entity.dos.DraftGoods;
|
import cn.lili.modules.goods.entity.dos.DraftGoods;
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsParams;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ public class DraftGoodsDTO extends DraftGoods {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "商品参数")
|
@ApiModelProperty(value = "商品参数")
|
||||||
@Valid
|
@Valid
|
||||||
private List<GoodsParams> goodsParamsList;
|
private List<GoodsParamsDTO> goodsParamsDTOList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品图片")
|
@ApiModelProperty(value = "商品图片")
|
||||||
private List<String> goodsGalleryList;
|
private List<String> goodsGalleryList;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.lili.modules.goods.entity.dto;
|
package cn.lili.modules.goods.entity.dto;
|
||||||
|
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsParams;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@ -83,8 +82,7 @@ public class GoodsOperationDTO implements Serializable {
|
|||||||
private boolean recommend;
|
private boolean recommend;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品参数")
|
@ApiModelProperty(value = "商品参数")
|
||||||
@Valid
|
private List<GoodsParamsDTO> goodsParamsDTOList;
|
||||||
private List<GoodsParams> goodsParamsList;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品图片")
|
@ApiModelProperty(value = "商品图片")
|
||||||
private List<String> goodsGalleryList;
|
private List<String> goodsGalleryList;
|
||||||
@ -121,4 +119,7 @@ public class GoodsOperationDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "商品类型")
|
@ApiModelProperty(value = "商品类型")
|
||||||
private String goodsType;
|
private String goodsType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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<GoodsParamsItemDTO> goodsParamsItemDTOList;
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -1,10 +1,9 @@
|
|||||||
package cn.lili.modules.goods.entity.vos;
|
package cn.lili.modules.goods.entity.vos;
|
||||||
|
|
||||||
import cn.lili.modules.goods.entity.dos.DraftGoods;
|
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 io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ public class DraftGoodsVO extends DraftGoods {
|
|||||||
private List<String> categoryName;
|
private List<String> categoryName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品参数")
|
@ApiModelProperty(value = "商品参数")
|
||||||
private List<GoodsParams> goodsParamsList;
|
private List<GoodsParamsDTO> goodsParamsDTOList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品图片")
|
@ApiModelProperty(value = "商品图片")
|
||||||
private List<String> goodsGalleryList;
|
private List<String> goodsGalleryList;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.lili.modules.goods.entity.vos;
|
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 io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ import lombok.Data;
|
|||||||
* @date 2020-02-26 23:24:13
|
* @date 2020-02-26 23:24:13
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class GoodsParamsVO extends GoodsParams {
|
public class GoodsParamsDTOVO extends GoodsParamsDTO {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4904700751774005326L;
|
private static final long serialVersionUID = -4904700751774005326L;
|
||||||
@ApiModelProperty("1 输入项 2 选择项")
|
@ApiModelProperty("1 输入项 2 选择项")
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
public class GoodsParamsGroupVO implements Serializable {
|
public class GoodsParamsGroupVO implements Serializable {
|
||||||
private static final long serialVersionUID = 1450550797436233753L;
|
private static final long serialVersionUID = 1450550797436233753L;
|
||||||
@ApiModelProperty("参数组关联的参数集合")
|
@ApiModelProperty("参数组关联的参数集合")
|
||||||
private List<GoodsParamsVO> params;
|
private List<GoodsParamsDTOVO> params;
|
||||||
@ApiModelProperty("参数组名称")
|
@ApiModelProperty("参数组名称")
|
||||||
private String groupName;
|
private String groupName;
|
||||||
@ApiModelProperty("参数组id")
|
@ApiModelProperty("参数组id")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.lili.modules.goods.entity.vos;
|
package cn.lili.modules.goods.entity.vos;
|
||||||
|
|
||||||
import cn.lili.modules.goods.entity.dos.Goods;
|
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 io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class GoodsVO extends Goods {
|
|||||||
private List<String> categoryName;
|
private List<String> categoryName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品参数")
|
@ApiModelProperty(value = "商品参数")
|
||||||
private List<GoodsParams> goodsParamsList;
|
private List<GoodsParamsDTO> goodsParamsDTOList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品图片")
|
@ApiModelProperty(value = "商品图片")
|
||||||
private List<String> goodsGalleryList;
|
private List<String> goodsGalleryList;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.lili.modules.goods.mapper;
|
package cn.lili.modules.goods.mapper;
|
||||||
|
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsParams;
|
import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
|
||||||
import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
|
import cn.lili.modules.goods.entity.vos.GoodsParamsDTOVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
@ -14,9 +14,9 @@ import java.util.List;
|
|||||||
* @author pikachu
|
* @author pikachu
|
||||||
* @date 2020-02-18 15:18:56
|
* @date 2020-02-18 15:18:56
|
||||||
*/
|
*/
|
||||||
public interface GoodsParamsMapper extends BaseMapper<GoodsParams> {
|
public interface GoodsParamsMapper extends BaseMapper<GoodsParamsDTO> {
|
||||||
|
|
||||||
@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")
|
@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<GoodsParamsVO> paramList(String goodsId, String categoryId);
|
List<GoodsParamsDTOVO> paramList(String goodsId, String categoryId);
|
||||||
|
|
||||||
}
|
}
|
@ -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<GoodsParams> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加商品参数
|
|
||||||
* @param paramList 参数列表
|
|
||||||
* @param goodsId 商品ID
|
|
||||||
*/
|
|
||||||
void addParams(List<GoodsParams> 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<GoodsParams> getGoodsParamsByGoodsId(String goodsId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加商品参数
|
|
||||||
*
|
|
||||||
* @param goodsParamsVO 商品参数
|
|
||||||
* @return 添加是否成功
|
|
||||||
*/
|
|
||||||
boolean addParams(GoodsParamsVO goodsParamsVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据分类id查询绑定参数信息
|
|
||||||
*
|
|
||||||
* @param categoryId 分类id
|
|
||||||
* @param goodsId 商品id
|
|
||||||
* @return 分类id
|
|
||||||
*/
|
|
||||||
List<GoodsParamsVO> paramList(String categoryId, String goodsId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品参数信息
|
|
||||||
*
|
|
||||||
* @param goodsId 商品id
|
|
||||||
* @param categoryId 分了id
|
|
||||||
* @return 商品参数信息
|
|
||||||
*/
|
|
||||||
List<GoodsParamsGroupVO> queryGoodsParams(String goodsId, String categoryId);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -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.dos.CategoryParameterGroup;
|
||||||
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
||||||
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
|
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.mapper.CategoryMapper;
|
||||||
import cn.lili.modules.goods.service.CategoryService;
|
import cn.lili.modules.goods.service.CategoryService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -255,13 +255,13 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|||||||
* @param paramList 参数列表
|
* @param paramList 参数列表
|
||||||
* @return 拼装后的返回值
|
* @return 拼装后的返回值
|
||||||
*/
|
*/
|
||||||
private List<GoodsParamsGroupVO> convertParamList(List<CategoryParameterGroup> groupList, List<GoodsParamsVO> paramList) {
|
private List<GoodsParamsGroupVO> convertParamList(List<CategoryParameterGroup> groupList, List<GoodsParamsDTOVO> paramList) {
|
||||||
Map<String, List<GoodsParamsVO>> map = new HashMap<>(16);
|
Map<String, List<GoodsParamsDTOVO>> map = new HashMap<>(16);
|
||||||
for (GoodsParamsVO param : paramList) {
|
for (GoodsParamsDTOVO param : paramList) {
|
||||||
if (map.get(param.getGroupId()) != null) {
|
if (map.get(param.getGroupId()) != null) {
|
||||||
map.get(param.getGroupId()).add(param);
|
map.get(param.getGroupId()).add(param);
|
||||||
} else {
|
} else {
|
||||||
List<GoodsParamsVO> list = new ArrayList<>();
|
List<GoodsParamsDTOVO> list = new ArrayList<>();
|
||||||
list.add(param);
|
list.add(param);
|
||||||
map.put(param.getGroupId(), list);
|
map.put(param.getGroupId(), list);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import cn.lili.common.utils.StringUtils;
|
|||||||
import cn.lili.modules.goods.entity.dos.*;
|
import cn.lili.modules.goods.entity.dos.*;
|
||||||
import cn.lili.modules.goods.entity.dto.DraftGoodsDTO;
|
import cn.lili.modules.goods.entity.dto.DraftGoodsDTO;
|
||||||
import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams;
|
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.entity.vos.DraftGoodsVO;
|
||||||
import cn.lili.modules.goods.mapper.DraftGoodsMapper;
|
import cn.lili.modules.goods.mapper.DraftGoodsMapper;
|
||||||
import cn.lili.modules.goods.service.CategoryService;
|
import cn.lili.modules.goods.service.CategoryService;
|
||||||
@ -45,7 +46,7 @@ public class DraftGoodsServiceImpl extends ServiceImpl<DraftGoodsMapper, DraftGo
|
|||||||
public boolean addGoodsDraft(DraftGoodsDTO draftGoods) {
|
public boolean addGoodsDraft(DraftGoodsDTO draftGoods) {
|
||||||
draftGoods.setGoodsGalleryListJson(JSONUtil.toJsonStr(draftGoods.getGoodsGalleryList()));
|
draftGoods.setGoodsGalleryListJson(JSONUtil.toJsonStr(draftGoods.getGoodsGalleryList()));
|
||||||
draftGoods.setSkuListJson(JSONUtil.toJsonStr(draftGoods.getSkuList()));
|
draftGoods.setSkuListJson(JSONUtil.toJsonStr(draftGoods.getSkuList()));
|
||||||
draftGoods.setGoodsParamsListJson(JSONUtil.toJsonStr(draftGoods.getGoodsParamsList()));
|
draftGoods.setGoodsParamsListJson(JSONUtil.toJsonStr(draftGoods.getGoodsParamsDTOList()));
|
||||||
return this.save(draftGoods);
|
return this.save(draftGoods);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ public class DraftGoodsServiceImpl extends ServiceImpl<DraftGoodsMapper, DraftGo
|
|||||||
public boolean updateGoodsDraft(DraftGoodsDTO draftGoods) {
|
public boolean updateGoodsDraft(DraftGoodsDTO draftGoods) {
|
||||||
draftGoods.setGoodsGalleryListJson(JSONUtil.toJsonStr(draftGoods.getGoodsGalleryList()));
|
draftGoods.setGoodsGalleryListJson(JSONUtil.toJsonStr(draftGoods.getGoodsGalleryList()));
|
||||||
draftGoods.setSkuListJson(JSONUtil.toJsonStr(draftGoods.getSkuList()));
|
draftGoods.setSkuListJson(JSONUtil.toJsonStr(draftGoods.getSkuList()));
|
||||||
draftGoods.setGoodsParamsListJson(JSONUtil.toJsonStr(draftGoods.getGoodsParamsList()));
|
draftGoods.setGoodsParamsListJson(JSONUtil.toJsonStr(draftGoods.getGoodsParamsDTOList()));
|
||||||
return this.updateById(draftGoods);
|
return this.updateById(draftGoods);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ public class DraftGoodsServiceImpl extends ServiceImpl<DraftGoodsMapper, DraftGo
|
|||||||
}
|
}
|
||||||
draftGoods.setGoodsGalleryListJson(JSONUtil.toJsonStr(draftGoods.getGoodsGalleryList()));
|
draftGoods.setGoodsGalleryListJson(JSONUtil.toJsonStr(draftGoods.getGoodsGalleryList()));
|
||||||
draftGoods.setSkuListJson(JSONUtil.toJsonStr(this.getGoodsSkuList(draftGoods.getSkuList())));
|
draftGoods.setSkuListJson(JSONUtil.toJsonStr(this.getGoodsSkuList(draftGoods.getSkuList())));
|
||||||
draftGoods.setGoodsParamsListJson(JSONUtil.toJsonStr(draftGoods.getGoodsParamsList()));
|
draftGoods.setGoodsParamsListJson(JSONUtil.toJsonStr(draftGoods.getGoodsParamsDTOList()));
|
||||||
this.saveOrUpdate(draftGoods);
|
this.saveOrUpdate(draftGoods);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ public class DraftGoodsServiceImpl extends ServiceImpl<DraftGoodsMapper, DraftGo
|
|||||||
categoryName.add(category.getName());
|
categoryName.add(category.getName());
|
||||||
}
|
}
|
||||||
draftGoodsVO.setCategoryName(categoryName);
|
draftGoodsVO.setCategoryName(categoryName);
|
||||||
draftGoodsVO.setGoodsParamsList(JSONUtil.toList(JSONUtil.parseArray(draftGoods.getGoodsParamsListJson()), GoodsParams.class));
|
draftGoodsVO.setGoodsParamsDTOList(JSONUtil.toList(JSONUtil.parseArray(draftGoods.getGoodsParamsListJson()), GoodsParamsDTO.class));
|
||||||
draftGoodsVO.setGoodsGalleryList(JSONUtil.toList(JSONUtil.parseArray(draftGoods.getGoodsGalleryListJson()), String.class));
|
draftGoodsVO.setGoodsGalleryList(JSONUtil.toList(JSONUtil.parseArray(draftGoods.getGoodsGalleryListJson()), String.class));
|
||||||
JSONArray jsonArray = JSONUtil.parseArray(draftGoods.getSkuListJson());
|
JSONArray jsonArray = JSONUtil.parseArray(draftGoods.getSkuListJson());
|
||||||
List<GoodsSku> list = JSONUtil.toList(jsonArray, GoodsSku.class);
|
List<GoodsSku> list = JSONUtil.toList(jsonArray, GoodsSku.class);
|
||||||
|
@ -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<GoodsParamsMapper, GoodsParams> implements GoodsParamsService {
|
|
||||||
//分类-参数绑定
|
|
||||||
@Autowired
|
|
||||||
private CategoryParameterGroupService categoryParameterGroupService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addParams(List<GoodsParams> paramList, String goodsId) {
|
|
||||||
//先删除现有商品参数
|
|
||||||
this.remove(new UpdateWrapper<GoodsParams>().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<GoodsParams> 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<GoodsParams>().eq("param_id", paramId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GoodsParams> getGoodsParamsByGoodsId(String goodsId) {
|
|
||||||
return this.list(new LambdaQueryWrapper<GoodsParams>().eq(GoodsParams::getGoodsId, goodsId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加商品参数
|
|
||||||
*
|
|
||||||
* @param goodsParamsVO 商品参数
|
|
||||||
* @return 添加是否成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean addParams(GoodsParamsVO goodsParamsVO) {
|
|
||||||
return this.save(goodsParamsVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GoodsParamsVO> paramList(String goodsId, String categoryId) {
|
|
||||||
return this.baseMapper.paramList(goodsId, categoryId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GoodsParamsGroupVO> queryGoodsParams(String categoryId, String goodsId) {
|
|
||||||
//查询分类关联参数组
|
|
||||||
List<CategoryParameterGroup> groupList = categoryParameterGroupService.getCategoryGroup(categoryId);
|
|
||||||
//查询商品参数
|
|
||||||
List<GoodsParamsVO> paramList = this.paramList(goodsId, categoryId);
|
|
||||||
//拼装数据返回
|
|
||||||
return this.convertParamList(groupList, paramList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼装返回值
|
|
||||||
*
|
|
||||||
* @param paramList
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<GoodsParamsGroupVO> convertParamList(List<CategoryParameterGroup> groupList, List<GoodsParamsVO> paramList) {
|
|
||||||
Map<String, List<GoodsParamsVO>> map = new HashMap<>(16);
|
|
||||||
for (GoodsParamsVO param : paramList) {
|
|
||||||
if (map.get(param.getGroupId()) != null) {
|
|
||||||
map.get(param.getGroupId()).add(param);
|
|
||||||
} else {
|
|
||||||
List<GoodsParamsVO> list = new ArrayList<>();
|
|
||||||
list.add(param);
|
|
||||||
map.put(param.getGroupId(), list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<GoodsParamsGroupVO> 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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.Goods;
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsGallery;
|
import cn.lili.modules.goods.entity.dos.GoodsGallery;
|
||||||
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
|
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.dto.GoodsSearchParams;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||||
@ -59,9 +60,7 @@ import java.util.List;
|
|||||||
@Transactional
|
@Transactional
|
||||||
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
|
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
|
||||||
|
|
||||||
//商品属性
|
|
||||||
@Autowired
|
|
||||||
private GoodsParamsService goodsParamsService;
|
|
||||||
//分类
|
//分类
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoryService categoryService;
|
private CategoryService categoryService;
|
||||||
@ -107,12 +106,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|||||||
this.checkGoods(goods);
|
this.checkGoods(goods);
|
||||||
//向goods加入图片
|
//向goods加入图片
|
||||||
this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods);
|
this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods);
|
||||||
|
//添加商品参数
|
||||||
|
if (goodsOperationDTO.getGoodsParamsDTOList() != null && !goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
|
||||||
|
goods.setParams(JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList()));
|
||||||
|
}
|
||||||
//添加商品
|
//添加商品
|
||||||
this.save(goods);
|
this.save(goods);
|
||||||
//添加商品参数
|
|
||||||
if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) {
|
|
||||||
this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId());
|
|
||||||
}
|
|
||||||
//添加商品sku信息
|
//添加商品sku信息
|
||||||
this.goodsSkuService.add(goodsOperationDTO.getSkuList(), goods);
|
this.goodsSkuService.add(goodsOperationDTO.getSkuList(), goods);
|
||||||
//添加相册
|
//添加相册
|
||||||
@ -130,12 +129,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|||||||
this.checkGoods(goods);
|
this.checkGoods(goods);
|
||||||
//向goods加入图片
|
//向goods加入图片
|
||||||
this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods);
|
this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods);
|
||||||
|
//添加商品参数
|
||||||
|
if (goodsOperationDTO.getGoodsParamsDTOList() != null && !goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
|
||||||
|
goods.setParams(JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList()));
|
||||||
|
}
|
||||||
//修改商品
|
//修改商品
|
||||||
this.updateById(goods);
|
this.updateById(goods);
|
||||||
//添加商品参数
|
|
||||||
if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) {
|
|
||||||
this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId());
|
|
||||||
}
|
|
||||||
//修改商品sku信息
|
//修改商品sku信息
|
||||||
this.goodsSkuService.update(goodsOperationDTO.getSkuList(), goods, goodsOperationDTO.getRegeneratorSkuFlag());
|
this.goodsSkuService.update(goodsOperationDTO.getSkuList(), goods, goodsOperationDTO.getRegeneratorSkuFlag());
|
||||||
//添加相册
|
//添加相册
|
||||||
@ -180,7 +179,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|||||||
}
|
}
|
||||||
goodsVO.setCategoryName(categoryName);
|
goodsVO.setCategoryName(categoryName);
|
||||||
|
|
||||||
goodsVO.setGoodsParamsList(goodsParamsService.getGoodsParamsByGoodsId(goodsId));
|
//参数非空则填写参数
|
||||||
|
if (StringUtils.isNotEmpty(goods.getParams())) {
|
||||||
|
goodsVO.setGoodsParamsDTOList(JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class));
|
||||||
|
}
|
||||||
|
|
||||||
return goodsVO;
|
return goodsVO;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import cn.lili.common.utils.PageUtil;
|
|||||||
import cn.lili.common.utils.StringUtils;
|
import cn.lili.common.utils.StringUtils;
|
||||||
import cn.lili.config.rocketmq.RocketmqCustomProperties;
|
import cn.lili.config.rocketmq.RocketmqCustomProperties;
|
||||||
import cn.lili.modules.goods.entity.dos.Goods;
|
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.GoodsSku;
|
||||||
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
|
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
|
||||||
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
|
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
|
||||||
@ -204,7 +204,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
|||||||
//获取当前商品的索引信息
|
//获取当前商品的索引信息
|
||||||
EsGoodsIndex goodsIndex = goodsIndexService.findById(skuId);
|
EsGoodsIndex goodsIndex = goodsIndexService.findById(skuId);
|
||||||
if (goodsIndex == null) {
|
if (goodsIndex == null) {
|
||||||
goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsList());
|
goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsDTOList());
|
||||||
}
|
}
|
||||||
//商品规格
|
//商品规格
|
||||||
GoodsSkuVO goodsSkuDetail = this.getGoodsSkuVO(goodsSku);
|
GoodsSkuVO goodsSkuDetail = this.getGoodsSkuVO(goodsSku);
|
||||||
@ -458,8 +458,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
|||||||
EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId());
|
EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId());
|
||||||
EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSku);
|
EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSku);
|
||||||
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
|
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
|
||||||
List<GoodsParams> goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class);
|
List<GoodsParamsDTO> goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class);
|
||||||
goodsIndex = new EsGoodsIndex(goodsSku, goodsParams);
|
goodsIndex = new EsGoodsIndex(goodsSku, goodsParamDTOS);
|
||||||
}
|
}
|
||||||
//如果商品库存不为0,并且es中有数据
|
//如果商品库存不为0,并且es中有数据
|
||||||
if (goodsSku.getQuantity() > 0 && esGoodsOld == null) {
|
if (goodsSku.getQuantity() > 0 && esGoodsOld == null) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.lili.modules.order.cart.render;
|
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.dto.TradeDTO;
|
||||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||||
@ -98,6 +100,15 @@ public class TradeBuilder {
|
|||||||
log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e);
|
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<CartVO> cartVOList = new ArrayList<>();
|
List<CartVO> cartVOList = new ArrayList<>();
|
||||||
//循环购物车信息
|
//循环购物车信息
|
||||||
@ -113,7 +124,7 @@ public class TradeBuilder {
|
|||||||
/**
|
/**
|
||||||
* 创建一笔交易
|
* 创建一笔交易
|
||||||
*
|
*
|
||||||
* @param checkedWay 购物车类型
|
* @param checkedWay 购物车类型
|
||||||
* @return 交易信息
|
* @return 交易信息
|
||||||
*/
|
*/
|
||||||
public Trade createTrade(CartTypeEnum checkedWay) {
|
public Trade createTrade(CartTypeEnum checkedWay) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package cn.lili.modules.search.entity.dos;
|
package cn.lili.modules.search.entity.dos;
|
||||||
|
|
||||||
import cn.lili.common.elasticsearch.EsSuffix;
|
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.dos.GoodsSku;
|
||||||
|
import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -273,36 +273,37 @@ public class EsGoodsIndex implements Serializable {
|
|||||||
this.intro = sku.getIntro();
|
this.intro = sku.getIntro();
|
||||||
this.grade = sku.getGrade();
|
this.grade = sku.getGrade();
|
||||||
this.releaseTime = new Date();
|
this.releaseTime = new Date();
|
||||||
// if (CharSequenceUtil.isNotEmpty(sku.getSpecs())) {
|
|
||||||
// List<EsGoodsAttribute> attributes = new ArrayList<>();
|
|
||||||
// JSONObject jsonObject = JSONUtil.parseObj(sku.getSpecs());
|
|
||||||
// for (Map.Entry<String, Object> 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> goodsParams) {
|
/**
|
||||||
|
* 参数索引增加
|
||||||
|
*
|
||||||
|
* @param sku
|
||||||
|
* @param goodsParamDTOS
|
||||||
|
*/
|
||||||
|
public EsGoodsIndex(GoodsSku sku, List<GoodsParamsDTO> goodsParamDTOS) {
|
||||||
this(sku);
|
this(sku);
|
||||||
if (goodsParams != null && !goodsParams.isEmpty()) {
|
//如果参数不为空
|
||||||
|
if (goodsParamDTOS != null && !goodsParamDTOS.isEmpty()) {
|
||||||
|
//接受不了参数索引
|
||||||
List<EsGoodsAttribute> attributes = new ArrayList<>();
|
List<EsGoodsAttribute> attributes = new ArrayList<>();
|
||||||
for (GoodsParams goodsParam : goodsParams) {
|
//循环参数分组
|
||||||
EsGoodsAttribute attribute = new EsGoodsAttribute();
|
goodsParamDTOS.forEach(goodsParamGroup -> {
|
||||||
if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) {
|
//循环分组的内容
|
||||||
attribute.setType(1);
|
goodsParamGroup.getGoodsParamsItemDTOList().forEach(goodsParam -> {
|
||||||
attribute.setName(goodsParam.getParamName());
|
//如果字段需要索引,则增加索引字段
|
||||||
attribute.setValue(goodsParam.getParamValue());
|
if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) {
|
||||||
attributes.add(attribute);
|
EsGoodsAttribute attribute = new EsGoodsAttribute();
|
||||||
}
|
attribute.setType(1);
|
||||||
}
|
attribute.setName(goodsParam.getParamName());
|
||||||
|
attribute.setValue(goodsParam.getParamValue());
|
||||||
|
attributes.add(attribute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
this.attrList = attributes;
|
this.attrList = attributes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.lili.modules.search.service;
|
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.goods.entity.dos.GoodsSku;
|
||||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||||
import cn.lili.modules.promotion.entity.dto.BasePromotion;
|
import cn.lili.modules.promotion.entity.dto.BasePromotion;
|
||||||
@ -146,8 +146,8 @@ public interface EsGoodsIndexService {
|
|||||||
* 重置当前商品索引
|
* 重置当前商品索引
|
||||||
*
|
*
|
||||||
* @param goodsSku 商品sku信息
|
* @param goodsSku 商品sku信息
|
||||||
* @param goodsParams 商品参数
|
* @param goodsParamDTOS 商品参数
|
||||||
* @return 商品索引
|
* @return 商品索引
|
||||||
*/
|
*/
|
||||||
EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List<GoodsParams> goodsParams);
|
EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List<GoodsParamsDTO> goodsParamDTOS);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import cn.hutool.extra.pinyin.PinyinUtil;
|
|||||||
import cn.lili.common.elasticsearch.BaseElasticsearchService;
|
import cn.lili.common.elasticsearch.BaseElasticsearchService;
|
||||||
import cn.lili.common.elasticsearch.EsSuffix;
|
import cn.lili.common.elasticsearch.EsSuffix;
|
||||||
import cn.lili.config.elasticsearch.ElasticsearchProperties;
|
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.GoodsSku;
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsWords;
|
import cn.lili.modules.goods.entity.dos.GoodsWords;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsWordsTypeEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsWordsTypeEnum;
|
||||||
@ -368,12 +368,12 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
|||||||
* 重置当前商品索引
|
* 重置当前商品索引
|
||||||
*
|
*
|
||||||
* @param goodsSku 商品sku信息
|
* @param goodsSku 商品sku信息
|
||||||
* @param goodsParams 商品参数
|
* @param goodsParamDTOS 商品参数
|
||||||
* @return 商品索引
|
* @return 商品索引
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List<GoodsParams> goodsParams) {
|
public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List<GoodsParamsDTO> goodsParamDTOS) {
|
||||||
EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParams);
|
EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParamDTOS);
|
||||||
//获取活动信息
|
//获取活动信息
|
||||||
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
|
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
|
||||||
//写入促销信息
|
//写入促销信息
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package cn.lili.controller.goods;
|
package cn.lili.controller.goods;
|
||||||
|
|
||||||
import cn.lili.common.enums.ResultCode;
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
|
||||||
import cn.lili.common.enums.ResultUtil;
|
import cn.lili.common.enums.ResultUtil;
|
||||||
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
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.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -50,7 +51,7 @@ public class CategoryParameterGroupManagerController {
|
|||||||
|
|
||||||
@ApiOperation(value = "保存数据")
|
@ApiOperation(value = "保存数据")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResultMessage<CategoryParameterGroup> saveOrUpdate(CategoryParameterGroup categoryParameterGroup) {
|
public ResultMessage<CategoryParameterGroup> saveOrUpdate(@Validated CategoryParameterGroup categoryParameterGroup) {
|
||||||
|
|
||||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||||
return ResultUtil.data(categoryParameterGroup);
|
return ResultUtil.data(categoryParameterGroup);
|
||||||
@ -60,7 +61,7 @@ public class CategoryParameterGroupManagerController {
|
|||||||
|
|
||||||
@ApiOperation(value = "更新数据")
|
@ApiOperation(value = "更新数据")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public ResultMessage<CategoryParameterGroup> update(CategoryParameterGroup categoryParameterGroup) {
|
public ResultMessage<CategoryParameterGroup> update(@Validated CategoryParameterGroup categoryParameterGroup) {
|
||||||
|
|
||||||
if (categoryParameterGroupService.updateById(categoryParameterGroup)) {
|
if (categoryParameterGroupService.updateById(categoryParameterGroup)) {
|
||||||
return ResultUtil.data(categoryParameterGroup);
|
return ResultUtil.data(categoryParameterGroup);
|
||||||
|
@ -3,7 +3,6 @@ package cn.lili.controller.goods;
|
|||||||
import cn.lili.common.enums.ResultUtil;
|
import cn.lili.common.enums.ResultUtil;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
|
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
|
||||||
import cn.lili.modules.goods.service.GoodsParamsService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
@ -5,7 +5,6 @@ import cn.lili.common.enums.ResultUtil;
|
|||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
import cn.lili.modules.goods.entity.dos.Parameters;
|
||||||
import cn.lili.modules.goods.service.GoodsParamsService;
|
|
||||||
import cn.lili.modules.goods.service.ParametersService;
|
import cn.lili.modules.goods.service.ParametersService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
@ -2,9 +2,8 @@ package cn.lili.controller.other;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.modules.goods.entity.dos.Goods;
|
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.GoodsSku;
|
||||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||||
import cn.lili.modules.goods.service.GoodsService;
|
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 cn.lili.modules.search.service.EsGoodsIndexService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -73,8 +71,8 @@ public class ElasticsearchController {
|
|||||||
Goods goods = goodsService.getById(goodsId);
|
Goods goods = goodsService.getById(goodsId);
|
||||||
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
|
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
|
||||||
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
|
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
|
||||||
List<GoodsParams> goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class);
|
List<GoodsParamsDTO> goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class);
|
||||||
index = new EsGoodsIndex(goodsSku, goodsParams);
|
index = new EsGoodsIndex(goodsSku, goodsParamDTOS);
|
||||||
}
|
}
|
||||||
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
|
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
|
||||||
index.setPromotionMap(goodsCurrentPromotionMap);
|
index.setPromotionMap(goodsCurrentPromotionMap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user