mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-25 00:15:06 +08:00
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.product.api.sku;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuDecrementStockBatchReqDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface ProductSkuApi {
|
||||
|
||||
|
||||
/**
|
||||
* 根据skuId列表 查询sku信息
|
||||
*
|
||||
* @param skuIds sku ID列表
|
||||
* @return sku信息列表
|
||||
*/
|
||||
List<SkuInfoRespDTO> getSkusByIds(Collection<Long> skuIds);
|
||||
|
||||
/**
|
||||
* 批量扣减sku库存
|
||||
*
|
||||
* @param batchReqDTO sku库存信息列表
|
||||
*/
|
||||
void decrementStockBatch(SkuDecrementStockBatchReqDTO batchReqDTO);
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.product.api.sku.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SkuDecrementStockBatchReqDTO {
|
||||
|
||||
|
||||
private List<Item> items;
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商品 SKU 编号,自增
|
||||
*/
|
||||
private Long skuId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
||||
public static SkuDecrementStockBatchReqDTO of(List<Item> items) {
|
||||
return new SkuDecrementStockBatchReqDTO(items);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package cn.iocoder.yudao.module.product.api.sku.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
@Data
|
||||
public class SkuInfoRespDTO {
|
||||
|
||||
/**
|
||||
* 商品 SKU 编号,自增
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 商品 SKU 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* SPU 编号
|
||||
*/
|
||||
private Long spuId;
|
||||
|
||||
/**
|
||||
* 规格值数组,JSON 格式
|
||||
*/
|
||||
private List<Property> properties;
|
||||
/**
|
||||
* 销售价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 市场价,单位:分
|
||||
*/
|
||||
private Integer marketPrice;
|
||||
/**
|
||||
* 成本价,单位:分
|
||||
*/
|
||||
private Integer costPrice;
|
||||
/**
|
||||
* SKU 的条形码
|
||||
*/
|
||||
private String barCode;
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String picUrl;
|
||||
/**
|
||||
* SKU 状态
|
||||
* <p>
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
private Integer stock;
|
||||
/**
|
||||
* 预警预存
|
||||
*/
|
||||
private Integer warnStock;
|
||||
/**
|
||||
* 商品重量,单位:kg 千克
|
||||
*/
|
||||
private Double weight;
|
||||
/**
|
||||
* 商品体积,单位:m^3 平米
|
||||
*/
|
||||
private Double volume;
|
||||
|
||||
/**
|
||||
* 商品属性
|
||||
*/
|
||||
@Data
|
||||
public static class Property {
|
||||
|
||||
/**
|
||||
* 属性编号
|
||||
*/
|
||||
private Long propertyId;
|
||||
/**
|
||||
* 属性值编号
|
||||
*/
|
||||
private Long valueId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.product.api.spu;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
|
||||
import cn.iocoder.yudao.module.product.api.spu.dto.SpuInfoRespDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface ProductSpuApi {
|
||||
|
||||
|
||||
/**
|
||||
* 根据spuId列表 查询spu信息
|
||||
*
|
||||
* @param spuIds spu ID列表
|
||||
* @return spu信息列表
|
||||
*/
|
||||
List<SpuInfoRespDTO> getSpusByIds(Collection<Long> spuIds);
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package cn.iocoder.yudao.module.product.api.spu.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum;
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
@Data
|
||||
public class SpuInfoRespDTO {
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 商品卖点
|
||||
*/
|
||||
private String sellPoint;
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 商品分类编号
|
||||
*/
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 商品品牌编号
|
||||
*/
|
||||
private Long brandId;
|
||||
/**
|
||||
* 商品图片的数组
|
||||
* <p>
|
||||
* 1. 第一张图片将作为商品主图,支持同时上传多张图;
|
||||
* 2. 建议使用尺寸 800x800 像素以上、大小不超过 1M 的正方形图片;
|
||||
* 3. 至少 1 张,最多上传 10 张
|
||||
*/
|
||||
private List<String> picUrls;
|
||||
/**
|
||||
* 商品视频
|
||||
*/
|
||||
private String videoUrl;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 商品状态
|
||||
* <p>
|
||||
* 枚举 {@link ProductSpuStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
/**
|
||||
* 规格类型
|
||||
* <p>
|
||||
* 枚举 {@link ProductSpuSpecTypeEnum}
|
||||
*/
|
||||
private Integer specType;
|
||||
/**
|
||||
* 最小价格,单位使用:分
|
||||
* <p>
|
||||
* 基于其对应的 {@link SkuInfoRespDTO#getPrice()} 最小值
|
||||
*/
|
||||
private Integer minPrice;
|
||||
/**
|
||||
* 最大价格,单位使用:分
|
||||
* <p>
|
||||
* 基于其对应的 {@link SkuInfoRespDTO#getPrice()} 最大值
|
||||
*/
|
||||
private Integer maxPrice;
|
||||
/**
|
||||
* 市场价,单位使用:分
|
||||
* <p>
|
||||
* 基于其对应的 {@link SkuInfoRespDTO#getMarketPrice()} 最大值
|
||||
*/
|
||||
private Integer marketPrice;
|
||||
/**
|
||||
* 总库存
|
||||
* <p>
|
||||
* 基于其对应的 {@link SkuInfoRespDTO#getStock()} 求和
|
||||
*/
|
||||
private Integer totalStock;
|
||||
/**
|
||||
* 是否展示库存
|
||||
*/
|
||||
private Boolean showStock;
|
||||
|
||||
// ========== 统计相关字段 =========
|
||||
|
||||
/**
|
||||
* 商品销量
|
||||
*/
|
||||
private Integer salesCount;
|
||||
/**
|
||||
* 虚拟销量
|
||||
*/
|
||||
private Integer virtualSalesCount;
|
||||
/**
|
||||
* 商品点击量
|
||||
*/
|
||||
private Integer clickCount;
|
||||
|
||||
}
|
Reference in New Issue
Block a user