Commit 7abfefba authored by shengnan hu's avatar shengnan hu
Browse files

init

parents
Pipeline #281 passed with stage
in 1 minute and 55 seconds
package com.mall4j.cloud.api.product.dto;
import java.io.Serializable;
import java.util.List;
/**
* @author FrozenWatermelon
* @date 2020/11/12
*/
public class SpuUpdateDTO implements Serializable {
/**
* 分类id
*/
private Long categoryId;
/**
* 分类id列表
*/
private List<Long> categoryIds;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类等级
*/
private Integer categoryLevel;
/**
* 商品状态
*/
private Integer status;
/**
* 店铺id
*/
private Long shopId;
/**
* 店铺名称 搜索华为的时候,可以把华为的旗舰店搜索出来
*/
private String shopName;
/**
* 店铺logo
*/
private String shopImg;
/**
* 品牌id
*/
private Long brandId;
/**
* 品牌图片
*/
private String brandImg;
/**
* 品牌名称
*/
private String brandName;
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public List<Long> getCategoryIds() {
return categoryIds;
}
public void setCategoryIds(List<Long> categoryIds) {
this.categoryIds = categoryIds;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Integer getCategoryLevel() {
return categoryLevel;
}
public void setCategoryLevel(Integer categoryLevel) {
this.categoryLevel = categoryLevel;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public String getShopImg() {
return shopImg;
}
public void setShopImg(String shopImg) {
this.shopImg = shopImg;
}
public Long getBrandId() {
return brandId;
}
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getBrandImg() {
return brandImg;
}
public void setBrandImg(String brandImg) {
this.brandImg = brandImg;
}
@Override
public String toString() {
return "SpuUpdateDTO{" +
"categoryId=" + categoryId +
", categoryIds=" + categoryIds +
", categoryName='" + categoryName + '\'' +
", categoryLevel=" + categoryLevel +
", status=" + status +
", shopId=" + shopId +
", shopName='" + shopName + '\'' +
", shopImg='" + shopImg + '\'' +
", brandId=" + brandId +
", brandImg='" + brandImg + '\'' +
", brandName='" + brandName + '\'' +
'}';
}
}
package com.mall4j.cloud.api.product.feign;
import com.mall4j.cloud.api.product.vo.CategoryVO;
import com.mall4j.cloud.common.feign.FeignInsideAuthConfig;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author lhd
* @date 2020/12/23
*/
@FeignClient(value = "mall4cloud-product",contextId = "category")
public interface CategoryFeignClient {
/**
* 获取所有一级分类信息
* @return 一级分类信息
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/category/listByOneLevel")
ServerResponseEntity<List<CategoryVO>> listByOneLevel();
/**
* 根据上级id,获取子分类id列表
* @param categoryId
* @return
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/category/listCategoryId")
ServerResponseEntity<List<Long>> listCategoryId(@RequestParam("categoryId") Long categoryId);
}
package com.mall4j.cloud.api.product.feign;
import com.mall4j.cloud.api.product.bo.EsProductBO;
import com.mall4j.cloud.common.feign.FeignInsideAuthConfig;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author FrozenWatermelon
* @date 2020/11/12
*/
@FeignClient(value = "mall4cloud-product",contextId = "product")
public interface ProductFeignClient {
/**
* 通过spuId需要搜索的商品
* @param spuId spuid
* @return es保存的商品信息
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/product/loadEsProductBO")
ServerResponseEntity<EsProductBO> loadEsProductBO(@RequestParam("spuId") Long spuId);
/**
* 根据平台categoryId,获取spuId列表
* @param shopCategoryIds
* @return spuId列表
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/product/getSpuIdsByShopCategoryIds")
ServerResponseEntity<List<Long>> getSpuIdsByShopCategoryIds(@RequestParam("shopCategoryIds")List<Long> shopCategoryIds);
/**
* 根据categoryId列表,获取spuId列表
* @param categoryIds
* @return spuId列表
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/product/getSpuIdsByCategoryIds")
ServerResponseEntity<List<Long>> getSpuIdsByCategoryIds(@RequestParam("categoryIds")List<Long> categoryIds);
/**
* 根据brandId,获取spuId列表
* @param brandId
* @return spuId列表
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/product/getSpuIdsByBrandId")
ServerResponseEntity<List<Long>> getSpuIdsByBrandId(@RequestParam("brandId")Long brandId);
/**
* 根据店铺id,获取spuId列表
* @param shopId
* @return spuId列表
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/product/getSpuIdsByShopId")
ServerResponseEntity<List<Long>> getSpuIdsByShopId(@RequestParam("shopId")Long shopId);
}
package com.mall4j.cloud.api.product.feign;
import com.mall4j.cloud.common.feign.FeignInsideAuthConfig;
import com.mall4j.cloud.common.order.vo.ShopCartItemVO;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author FrozenWatermelon
* @date 2020/11/12
*/
@FeignClient(value = "mall4cloud-product",contextId = "shopCart")
public interface ShopCartFeignClient {
/**
* 获取购物项
* @return 购物项
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/shopCart/getById")
ServerResponseEntity<List<ShopCartItemVO>> getCheckedShopCartItems();
/**
* 通过购物车id删除用户购物车物品
* @param shopCartItemIds 购物车id
* @return
*/
@DeleteMapping("/delete_item")
ServerResponseEntity<Void> deleteItem(@RequestBody List<Long> shopCartItemIds);
}
package com.mall4j.cloud.api.product.feign;
import com.mall4j.cloud.api.product.vo.SkuVO;
import com.mall4j.cloud.common.feign.FeignInsideAuthConfig;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author FrozenWatermelon
* @date 2020/11/12
*/
@FeignClient(value = "mall4cloud-product",contextId = "sku")
public interface SkuFeignClient {
/**
* 通过skuId获取sku信息
* @param skuId skuId
* @return sku信息
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/sku/getById")
ServerResponseEntity<SkuVO> getById(@RequestParam("skuId") Long skuId);
}
package com.mall4j.cloud.api.product.feign;
import com.mall4j.cloud.api.product.dto.SkuStockLockDTO;
import com.mall4j.cloud.common.feign.FeignInsideAuthConfig;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author FrozenWatermelon
* @date 2020/12/22
*/
@FeignClient(value = "mall4cloud-product",contextId = "skuStockLock")
public interface SkuStockLockFeignClient {
/**
* 锁定库存
* @param skuStockLocks 参数
* @return 是否成功
*/
@PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/skuStockLock/lock")
ServerResponseEntity<Void> lock(@RequestBody List<SkuStockLockDTO> skuStockLocks);
}
package com.mall4j.cloud.api.product.feign;
import com.mall4j.cloud.api.product.vo.SpuAndSkuVO;
import com.mall4j.cloud.api.product.vo.SpuVO;
import com.mall4j.cloud.common.feign.FeignInsideAuthConfig;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author FrozenWatermelon
* @date 2020/11/12
*/
@FeignClient(value = "mall4cloud-product",contextId = "spu")
public interface SpuFeignClient {
/**
* 通过spuId需要搜索的商品
* @param spuId spuid
* @return 商品信息(spuId,name,mainImgUrl)
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/spu/getById")
ServerResponseEntity<SpuVO> getById(@RequestParam("spuId") Long spuId);
/**
* 通过spuId需要搜索的商品
* @param spuId spuId
* @param skuId skuId
* @return 商品信息
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/spu/getSpuAndSkuById")
ServerResponseEntity<SpuAndSkuVO> getSpuAndSkuById(@RequestParam("spuId") Long spuId,@RequestParam("skuId") Long skuId);
/**
* 根据spuId获取spu列表(所需字段:spuId、shopId、name、mainImgUrl)
* 根据店铺id获取spu列表
* @param spuIds 商品ids
* @param spuName 商品名称
* @param isFailure 是否失效
* @return 商品列表信息
*/
@GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/spu/getSpusBySpuIds")
ServerResponseEntity<List<SpuVO>> getSpusBySpuIds(@RequestParam("spuIds") List<Long> spuIds,@RequestParam(value = "spuName",defaultValue = "") String spuName,
@RequestParam(value = "isFailure",defaultValue = "1") Integer isFailure);
}
package com.mall4j.cloud.api.product.manager;
import cn.hutool.core.collection.CollectionUtil;
import com.mall4j.cloud.api.multishop.feign.ShopDetailFeignClient;
import com.mall4j.cloud.common.exception.Mall4cloudException;
import com.mall4j.cloud.api.product.dto.ShopCartItemDTO;
import com.mall4j.cloud.api.product.feign.ShopCartFeignClient;
import com.mall4j.cloud.api.product.feign.SpuFeignClient;
import com.mall4j.cloud.common.order.vo.ShopCartItemVO;
import com.mall4j.cloud.api.product.vo.SkuVO;
import com.mall4j.cloud.api.product.vo.SpuAndSkuVO;
import com.mall4j.cloud.api.product.vo.SpuVO;
import com.mall4j.cloud.common.order.vo.ShopCartVO;
import com.mall4j.cloud.common.response.ResponseEnum;
import com.mall4j.cloud.common.response.ServerResponseEntity;
import com.mall4j.cloud.common.util.BooleanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
/**
* 购物车适配器
* @author FrozenWatermelon
* @date 2020/12/07
*/
@Component
public class ShopCartAdapter {
@Autowired
private SpuFeignClient spuFeignClient;
@Autowired
private ShopCartFeignClient shopCartFeignClient;
@Autowired
private ShopDetailFeignClient shopDetailFeignClient;
/**
* 获取购物项组装信息
* @param shopCartItemParam 购物项参数
* @return 购物项组装信息
*/
public ServerResponseEntity<List<ShopCartItemVO>> getShopCartItems(ShopCartItemDTO shopCartItemParam) {
ServerResponseEntity<List<ShopCartItemVO>> shopCartItemResponse;
// 当立即购买时,没有提交的订单是没有购物车信息的
if (shopCartItemParam != null) {
shopCartItemResponse = conversionShopCartItem(shopCartItemParam);
}
// 从购物车提交订单
else {
shopCartItemResponse = shopCartFeignClient.getCheckedShopCartItems();
}
if (!shopCartItemResponse.isSuccess()) {
return ServerResponseEntity.transform(shopCartItemResponse);
}
// 请选择您需要的商品加入购物车
if (CollectionUtil.isEmpty(shopCartItemResponse.getData())) {
return ServerResponseEntity.fail(ResponseEnum.SHOP_CART_NOT_EXIST);
}
// 返回购物车选择的商品信息
return shopCartItemResponse;
}
/**
* 将参数转换成组装好的购物项
* @param shopCartItemParam 购物项参数
* @return 组装好的购物项
*/
public ServerResponseEntity<List<ShopCartItemVO>> conversionShopCartItem(ShopCartItemDTO shopCartItemParam){
ServerResponseEntity<SpuAndSkuVO> spuAndSkuResponse = spuFeignClient.getSpuAndSkuById(shopCartItemParam.getSpuId(),shopCartItemParam.getSkuId());
if (!spuAndSkuResponse.isSuccess()) {
return ServerResponseEntity.transform(spuAndSkuResponse);
}
SkuVO sku = spuAndSkuResponse.getData().getSku();
SpuVO spu = spuAndSkuResponse.getData().getSpu();
// 拿到购物车的所有item
ShopCartItemVO shopCartItem = new ShopCartItemVO();
shopCartItem.setCartItemId(0L);
shopCartItem.setSkuId(shopCartItemParam.getSkuId());
shopCartItem.setCount(shopCartItemParam.getCount());
shopCartItem.setSpuId(shopCartItemParam.getSpuId());
shopCartItem.setSkuName(sku.getSkuName());
shopCartItem.setSpuName(spu.getName());
shopCartItem.setImgUrl(BooleanUtil.isTrue(spu.getHasSkuImg()) ? sku.getImgUrl() : spu.getMainImgUrl());
shopCartItem.setSkuPriceFee(sku.getPriceFee());
shopCartItem.setTotalAmount(shopCartItem.getCount() * shopCartItem.getSkuPriceFee());
shopCartItem.setCreateTime(new Date());
shopCartItem.setShopId(shopCartItemParam.getShopId());
return ServerResponseEntity.success(Collections.singletonList(shopCartItem));
}
/**
* 将参数转换成组装好的购物项
* @param shopCartItems 订单参数
* @return 组装好的购物项
*/
public List<ShopCartVO> conversionShopCart(List<ShopCartItemVO> shopCartItems){
// 根据店铺ID划分item
Map<Long, List<ShopCartItemVO>> shopCartMap = shopCartItems.stream().collect(Collectors.groupingBy(ShopCartItemVO::getShopId));
// 返回一个店铺的所有信息
List<ShopCartVO> shopCarts = new ArrayList<>();
for (Long shopId : shopCartMap.keySet()) {
// 构建每个店铺的购物车信息
ShopCartVO shopCart = buildShopCart(shopId,shopCartMap.get(shopId));
shopCart.setShopId(shopId);
shopCart.setshopCartItem(shopCartMap.get(shopId));
// 店铺信息
ServerResponseEntity<String> shopNameResponse = shopDetailFeignClient.getShopNameByShopId(shopId);
if (!shopNameResponse.isSuccess()) {
throw new Mall4cloudException(shopNameResponse.getMsg());
}
shopCart.setShopName(shopNameResponse.getData());
shopCarts.add(shopCart);
}
return shopCarts;
}
private ShopCartVO buildShopCart(Long shopId, List<ShopCartItemVO> shopCartItems) {
ShopCartVO shopCart = new ShopCartVO();
shopCart.setShopId(shopId);
long total = 0L;
int totalCount = 0;
for (ShopCartItemVO shopCartItem : shopCartItems) {
total += shopCartItem.getTotalAmount();
totalCount += shopCartItem.getCount();
}
shopCart.setTotal(total);
shopCart.setTotalCount(totalCount);
return shopCart;
}
}
package com.mall4j.cloud.api.product.vo;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 属性与属性分组关联信息VO
*
* @author YXF
* @date 2020-11-23 16:20:01
*/
public class AttrCategoryVO extends BaseVO{
private static final long serialVersionUID = 1L;
@Schema(description = "属性与分类关联id" )
private Long attrCategoryId;
@Schema(description = "分类id" )
private Long categoryId;
@Schema(description = "属性id" )
private Long attrId;
public Long getAttrCategoryId() {
return attrCategoryId;
}
public void setAttrCategoryId(Long attrCategoryId) {
this.attrCategoryId = attrCategoryId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getAttrId() {
return attrId;
}
public void setAttrId(Long attrId) {
this.attrId = attrId;
}
@Override
public String toString() {
return "AttrCategoryVO{" +
"attrCategoryId=" + attrCategoryId +
",createTime=" + createTime +
",updateTime=" + updateTime +
",categoryId=" + categoryId +
",attrId=" + attrId +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* 属性信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:23
*/
public class AttrVO extends BaseVO{
private static final long serialVersionUID = 1L;
@Schema(description = "attr id" )
private Long attrId;
@Schema(description = "店铺id" )
private Long shopId;
@Schema(description = "属性名称" )
private String name;
@Schema(description = "属性描述" )
private String desc;
@Schema(description = "作为搜索参数 0:不需要,1:需要" )
private Integer searchType;
@Schema(description = "属性类型 0:销售属性,1:基本属性" )
private Integer attrType;
@Schema(description = "属性值列表" )
private List<AttrValueVO> attrValues;
@Schema(description = "分类列表" )
private List<CategoryVO> categories;
public Long getAttrId() {
return attrId;
}
public void setAttrId(Long attrId) {
this.attrId = attrId;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getAttrType() {
return attrType;
}
public void setAttrType(Integer attrType) {
this.attrType = attrType;
}
public Integer getSearchType() {
return searchType;
}
public void setSearchType(Integer searchType) {
this.searchType = searchType;
}
public List<AttrValueVO> getAttrValues() {
return attrValues;
}
public void setAttrValues(List<AttrValueVO> attrValues) {
this.attrValues = attrValues;
}
public List<CategoryVO> getCategories() {
return categories;
}
public void setCategories(List<CategoryVO> categories) {
this.categories = categories;
}
@Override
public String toString() {
return "AttrVO{" +
"attrId=" + attrId +
", shopId=" + shopId +
", name='" + name + '\'' +
", desc='" + desc + '\'' +
", attrType=" + attrType +
", searchType=" + searchType +
", attrValues=" + attrValues +
", categorys=" + categories +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 属性值信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class AttrValueVO extends BaseVO{
private static final long serialVersionUID = 1L;
@Schema(description = "属性id" )
private Long attrValueId;
@Schema(description = "属性ID" )
private Long attrId;
@Schema(description = "属性值" )
private String value;
public Long getAttrValueId() {
return attrValueId;
}
public void setAttrValueId(Long attrValueId) {
this.attrValueId = attrValueId;
}
public Long getAttrId() {
return attrId;
}
public void setAttrId(Long attrId) {
this.attrId = attrId;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
return "AttrValueVO{" +
"attrValueId=" + attrValueId +
",createTime=" + createTime +
",updateTime=" + updateTime +
",attrId=" + attrId +
",value=" + value +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mall4j.cloud.common.serializer.ImgJsonSerializer;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* 品牌信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class BrandVO extends BaseVO{
private static final long serialVersionUID = 1L;
@Schema(description = "brand_id" )
private Long brandId;
@Schema(description = "品牌名称" )
private String name;
@Schema(description = "品牌描述" )
private String desc;
@Schema(description = "品牌logo图片" )
@JsonSerialize(using = ImgJsonSerializer.class)
private String imgUrl;
@Schema(description = "检索首字母" )
private String firstLetter;
@Schema(description = "排序" )
private Integer seq;
@Schema(description = "状态 1:enable, 0:disable, -1:deleted" )
private Integer status;
@Schema(description = "分类" )
private List<CategoryVO> categories;
public Long getBrandId() {
return brandId;
}
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getFirstLetter() {
return firstLetter;
}
public void setFirstLetter(String firstLetter) {
this.firstLetter = firstLetter;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public List<CategoryVO> getCategories() {
return categories;
}
public void setCategories(List<CategoryVO> categories) {
this.categories = categories;
}
@Override
public String toString() {
return "BrandVO{" +
"brandId=" + brandId +
", name='" + name + '\'' +
", desc='" + desc + '\'' +
", imgUrl='" + imgUrl + '\'' +
", firstLetter='" + firstLetter + '\'' +
", seq=" + seq +
", status=" + status +
", categories=" + categories +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mall4j.cloud.common.serializer.ImgJsonSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* 分类信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class CategoryVO{
private static final long serialVersionUID = 1L;
@Schema(description = "分类id" )
private Long categoryId;
@Schema(description = "店铺id" )
private Long shopId;
@Schema(description = "父ID" )
private Long parentId;
@Schema(description = "分类名称" )
private String name;
@Schema(description = "分类描述" )
private String desc;
@Schema(description = "分类地址{parent_id}-{child_id},..." )
private String path;
@Schema(description = "状态 1:enable, 0:disable, -1:deleted" )
private Integer status;
@JsonSerialize(using = ImgJsonSerializer.class)
@Schema(description = "分类图标" )
private String icon;
@JsonSerialize(using = ImgJsonSerializer.class)
@Schema(description = "分类的显示图片" )
private String imgUrl;
@Schema(description = "分类层级 从0开始" )
private Integer level;
@Schema(description = "排序" )
private Integer seq;
@Schema(description = "上级分类名称" )
private List<String> pathNames;
@Schema(description = "子分类列表" )
private List<CategoryVO> categories;
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public List<String> getPathNames() {
return pathNames;
}
public void setPathNames(List<String> pathNames) {
this.pathNames = pathNames;
}
public List<CategoryVO> getCategories() {
return categories;
}
public void setCategories(List<CategoryVO> categories) {
this.categories = categories;
}
@Override
public String toString() {
return "CategoryVO{" +
"categoryId=" + categoryId +
", shopId=" + shopId +
", parentId=" + parentId +
", name='" + name + '\'' +
", desc='" + desc + '\'' +
", path='" + path + '\'' +
", status=" + status +
", icon='" + icon + '\'' +
", imgUrl='" + imgUrl + '\'' +
", level=" + level +
", seq=" + seq +
", pathNames=" + pathNames +
", categories=" + categories +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.util.List;
/**
* sku信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class SkuVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "属性id" )
private Long skuId;
@Schema(description = "SPU id" )
private Long spuId;
@Schema(description = "多个销售属性值id逗号分隔" )
private String attrs;
@Schema(description = "sku名称" )
private String skuName;
@Schema(description = "banner图片" )
private String imgUrl;
@Schema(description = "售价,整数方式保存" )
private Long priceFee;
@Schema(description = "市场价,整数方式保存" )
private Long marketPriceFee;
@Schema(description = "状态 1:enable, 0:disable, -1:deleted" )
private Integer status;
@Schema(description = "库存" )
private Integer stock;
@Schema(description = "商品编码" )
private String partyCode;
@Schema(description = "商品条形码" )
private String modelId;
@Schema(description = "商品重量" )
private BigDecimal weight;
@Schema(description = "商品体积" )
private BigDecimal volume;
@Schema(description = "当前sku规格列表" )
private List<SpuSkuAttrValueVO> spuSkuAttrValues;
public String getPartyCode() {
return partyCode;
}
public void setPartyCode(String partyCode) {
this.partyCode = partyCode;
}
public String getModelId() {
return modelId;
}
public void setModelId(String modelId) {
this.modelId = modelId;
}
public BigDecimal getWeight() {
return weight;
}
public void setWeight(BigDecimal weight) {
this.weight = weight;
}
public BigDecimal getVolume() {
return volume;
}
public void setVolume(BigDecimal volume) {
this.volume = volume;
}
public List<SpuSkuAttrValueVO> getSpuSkuAttrValues() {
return spuSkuAttrValues;
}
public void setSpuSkuAttrValues(List<SpuSkuAttrValueVO> spuSkuAttrValues) {
this.spuSkuAttrValues = spuSkuAttrValues;
}
public Integer getStock() {
return stock;
}
public void setStock(Integer stock) {
this.stock = stock;
}
public Long getSkuId() {
return skuId;
}
public Long getPriceFee() {
return priceFee;
}
public void setPriceFee(Long priceFee) {
this.priceFee = priceFee;
}
public Long getMarketPriceFee() {
return marketPriceFee;
}
public void setMarketPriceFee(Long marketPriceFee) {
this.marketPriceFee = marketPriceFee;
}
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
public Long getSpuId() {
return spuId;
}
public void setSpuId(Long spuId) {
this.spuId = spuId;
}
public String getAttrs() {
return attrs;
}
public void setAttrs(String attrs) {
this.attrs = attrs;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getSkuName() {
return skuName;
}
public void setSkuName(String skuName) {
this.skuName = skuName;
}
@Override
public String toString() {
return "SkuVO{" +
"skuId=" + skuId +
", spuId=" + spuId +
", attrs='" + attrs + '\'' +
", imgUrl='" + imgUrl + '\'' +
", priceFee=" + priceFee +
", marketPriceFee=" + marketPriceFee +
", status=" + status +
", stock=" + stock +
", spuSkuAttrValues=" + spuSkuAttrValues +
", partyCode='" + partyCode + '\'' +
", modelId='" + modelId + '\'' +
", weight=" + weight +
", volume=" + volume +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @author FrozenWatermelon
* @date 2020/12/8
*/
public class SpuAndSkuVO {
@Schema(description = "spu信息" )
private SpuVO spu;
@Schema(description = "sku信息" )
private SkuVO sku;
public SpuVO getSpu() {
return spu;
}
public void setSpu(SpuVO spu) {
this.spu = spu;
}
public SkuVO getSku() {
return sku;
}
public void setSku(SkuVO sku) {
this.sku = sku;
}
@Override
public String toString() {
return "SpuAndSkuVO{" +
"spu=" + spu +
", sku=" + sku +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 商品规格属性关联信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class SpuAttrValueVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "商品属性值关联信息id" )
private Long spuAttrValueId;
@Schema(description = "商品id" )
private Long spuId;
@Schema(description = "规格属性id" )
private Long attrId;
@Schema(description = "规格属性名称" )
private String attrName;
@Schema(description = "规格属性值id" )
private Long attrValueId;
@Schema(description = "规格属性值名称" )
private String attrValueName;
@Schema(description = "搜索类型 0:不需要,1:需要" )
private Integer searchType;
public Long getSpuAttrValueId() {
return spuAttrValueId;
}
public void setSpuAttrValueId(Long spuAttrValueId) {
this.spuAttrValueId = spuAttrValueId;
}
public Long getSpuId() {
return spuId;
}
public void setSpuId(Long spuId) {
this.spuId = spuId;
}
public Long getAttrId() {
return attrId;
}
public void setAttrId(Long attrId) {
this.attrId = attrId;
}
public String getAttrName() {
return attrName;
}
public void setAttrName(String attrName) {
this.attrName = attrName;
}
public Long getAttrValueId() {
return attrValueId;
}
public void setAttrValueId(Long attrValueId) {
this.attrValueId = attrValueId;
}
public String getAttrValueName() {
return attrValueName;
}
public void setAttrValueName(String attrValueName) {
this.attrValueName = attrValueName;
}
public Integer getSearchType() {
return searchType;
}
public void setSearchType(Integer searchType) {
this.searchType = searchType;
}
@Override
public String toString() {
return "SpuAttrValueVO{" +
"spuAttrValueId=" + spuAttrValueId +
", spuId=" + spuId +
", attrId=" + attrId +
", attrName='" + attrName + '\'' +
", attrValueId=" + attrValueId +
", attrValueName='" + attrValueName + '\'' +
", searchType=" + searchType +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 商品sku销售属性关联信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class SpuSkuAttrValueVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "商品sku销售属性关联信息id" )
private Integer spuSkuAttrId;
@Schema(description = "SPU ID" )
private Long spuId;
@Schema(description = "SKU ID" )
private Long skuId;
@Schema(description = "销售属性ID" )
private Integer attrId;
@Schema(description = "销售属性名称" )
private String attrName;
@Schema(description = "销售属性值ID" )
private Integer attrValueId;
@Schema(description = "销售属性值" )
private String attrValueName;
@Schema(description = "状态 1:enable, 0:disable, -1:deleted" )
private Integer status;
public Integer getSpuSkuAttrId() {
return spuSkuAttrId;
}
public void setSpuSkuAttrId(Integer spuSkuAttrId) {
this.spuSkuAttrId = spuSkuAttrId;
}
public Long getSpuId() {
return spuId;
}
public void setSpuId(Long spuId) {
this.spuId = spuId;
}
public Long getSkuId() {
return skuId;
}
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
public Integer getAttrId() {
return attrId;
}
public void setAttrId(Integer attrId) {
this.attrId = attrId;
}
public String getAttrName() {
return attrName;
}
public void setAttrName(String attrName) {
this.attrName = attrName;
}
public Integer getAttrValueId() {
return attrValueId;
}
public void setAttrValueId(Integer attrValueId) {
this.attrValueId = attrValueId;
}
public String getAttrValueName() {
return attrValueName;
}
public void setAttrValueName(String attrValueName) {
this.attrValueName = attrValueName;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "SpuSkuAttrValueVO{" +
"spuSkuAttrId=" + spuSkuAttrId +
", spuId=" + spuId +
", skuId=" + skuId +
", attrId=" + attrId +
", attrName='" + attrName + '\'' +
", attrValueId=" + attrValueId +
", attrValueName='" + attrValueName + '\'' +
", status=" + status +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.mall4j.cloud.api.product.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mall4j.cloud.common.serializer.ImgJsonSerializer;
import com.mall4j.cloud.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* spu信息VO
*
* @author FrozenWatermelon
* @date 2020-10-28 15:27:24
*/
public class SpuVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "spu id" )
private Long spuId;
@Schema(description = "品牌ID" )
private Long brandId;
@Schema(description = "分类ID" )
private Long categoryId;
@Schema(description = "店铺分类ID" )
private Long shopCategoryId;
@Schema(description = "店铺id" )
private Long shopId;
@Schema(description = "spu名称" )
private String name;
@Schema(description = "卖点" )
private String sellingPoint;
@Schema(description = "商品介绍主图" )
@JsonSerialize(using = ImgJsonSerializer.class)
private String mainImgUrl;
@Schema(description = "商品介绍主图 多个图片逗号分隔" )
@JsonSerialize(using = ImgJsonSerializer.class)
private String imgUrls;
@Schema(description = "售价,整数方式保存" )
private Long priceFee;
@Schema(description = "市场价,整数方式保存" )
private Long marketPriceFee;
@Schema(description = "状态 1:enable, 0:disable, -1:deleted" )
private Integer status;
@Schema(description = "sku是否含有图片 0无 1有" )
private Integer hasSkuImg;
@Schema(description = "商品详情" )
private String detail;
@Schema(description = "总库存" )
private Integer totalStock;
@Schema(description = "规格属性" )
private List<SpuAttrValueVO> spuAttrValues;
@Schema(description = "sku列表" )
private List<SkuVO> skus;
@Schema(description = "序号" )
private Integer seq;
@Schema(description = "品牌信息" )
private BrandVO brand;
@Schema(description = "商品销量" )
private Integer saleNum;
@Schema(description = "店铺名称" )
private String shopName;
@Schema(description = "分类信息" )
private CategoryVO category;
@Schema(description = "店铺分类信息" )
private CategoryVO shopCategory;
@Schema(description = "分组商品关联id" )
private Long referenceId;
public Long getReferenceId() {
return referenceId;
}
public void setReferenceId(Long referenceId) {
this.referenceId = referenceId;
}
public String getMainImgUrl() {
return mainImgUrl;
}
public void setMainImgUrl(String mainImgUrl) {
this.mainImgUrl = mainImgUrl;
}
public List<SkuVO> getSkus() {
return skus;
}
public void setSkus(List<SkuVO> skus) {
this.skus = skus;
}
public List<SpuAttrValueVO> getSpuAttrValues() {
return spuAttrValues;
}
public void setSpuAttrValues(List<SpuAttrValueVO> spuAttrValues) {
this.spuAttrValues = spuAttrValues;
}
public Integer getTotalStock() {
return totalStock;
}
public void setTotalStock(Integer totalStock) {
this.totalStock = totalStock;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public Long getSpuId() {
return spuId;
}
public void setSpuId(Long spuId) {
this.spuId = spuId;
}
public Long getBrandId() {
return brandId;
}
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getShopCategoryId() {
return shopCategoryId;
}
public void setShopCategoryId(Long shopCategoryId) {
this.shopCategoryId = shopCategoryId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImgUrls() {
return imgUrls;
}
public void setImgUrls(String imgUrls) {
this.imgUrls = imgUrls;
}
public Long getPriceFee() {
return priceFee;
}
public void setPriceFee(Long priceFee) {
this.priceFee = priceFee;
}
public Long getMarketPriceFee() {
return marketPriceFee;
}
public void setMarketPriceFee(Long marketPriceFee) {
this.marketPriceFee = marketPriceFee;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getSellingPoint() {
return sellingPoint;
}
public void setSellingPoint(String sellingPoint) {
this.sellingPoint = sellingPoint;
}
public Integer getHasSkuImg() {
return hasSkuImg;
}
public void setHasSkuImg(Integer hasSkuImg) {
this.hasSkuImg = hasSkuImg;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public BrandVO getBrand() {
return brand;
}
public void setBrand(BrandVO brand) {
this.brand = brand;
}
public Integer getSaleNum() {
return saleNum;
}
public void setSaleNum(Integer saleNum) {
this.saleNum = saleNum;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public CategoryVO getCategory() {
return category;
}
public void setCategory(CategoryVO category) {
this.category = category;
}
public CategoryVO getShopCategory() {
return shopCategory;
}
public void setShopCategory(CategoryVO shopCategory) {
this.shopCategory = shopCategory;
}
@Override
public String toString() {
return "SpuVO{" +
"spuId=" + spuId +
", brandId=" + brandId +
", categoryId=" + categoryId +
", shopCategoryId=" + shopCategoryId +
", shopId=" + shopId +
", name='" + name + '\'' +
", sellingPoint='" + sellingPoint + '\'' +
", mainImgUrl='" + mainImgUrl + '\'' +
", imgUrls='" + imgUrls + '\'' +
", priceFee=" + priceFee +
", marketPriceFee=" + marketPriceFee +
", status=" + status +
", hasSkuImg=" + hasSkuImg +
", detail='" + detail + '\'' +
", totalStock=" + totalStock +
", spuAttrValues=" + spuAttrValues +
", skus=" + skus +
", seq=" + seq +
", brand=" + brand +
", saleNum=" + saleNum +
", shopName='" + shopName + '\'' +
", category=" + category +
", shopCategory=" + shopCategory +
", referenceId=" + referenceId +
'}';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment