共富商城
This commit is contained in:
1 parent
5968204663
commit
1699a33b1e
6 files changed
+50
-50
No files matched your search
+12
-12
@@ -153,7 +153,7 @@ public class MallAppController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 按商品ID分组SKU
|
// 按商品ID分组SKU
|
||||||
Map<Long, List<MallProductSkuEntity>> skuMap = skuList.stream()
|
Map<Long, List<MallProductSkuEntity>> skuMap = skuList.stream()
|
||||||
.collect(Collectors.groupingBy(MallProductSkuEntity::getProductId));
|
.collect(Collectors.groupingBy(MallProductSkuEntity::getProductId));
|
||||||
|
|
||||||
// 转换为VO
|
// 转换为VO
|
||||||
@@ -177,14 +177,14 @@ public class MallAppController {
|
|||||||
productVo.setMinPrice(skus.stream()
|
productVo.setMinPrice(skus.stream()
|
||||||
.map(MallProductSkuEntity::getPrice)
|
.map(MallProductSkuEntity::getPrice)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.min(java.math.BigDecimal::compareTo)
|
.min(Integer::compareTo)
|
||||||
.orElse(java.math.BigDecimal.ZERO));
|
.orElse(0));
|
||||||
|
|
||||||
// 计算总库存
|
// 计算总库存
|
||||||
productVo.setTotalStock(skus.stream()
|
productVo.setTotalStock(skus.stream()
|
||||||
.map(MallProductSkuEntity::getStock)
|
.map(MallProductSkuEntity::getStock)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.mapToInt(Integer::intValue)
|
.mapToDouble(Double::doubleValue)
|
||||||
.sum());
|
.sum());
|
||||||
|
|
||||||
|
|
||||||
@@ -232,13 +232,13 @@ public class MallAppController {
|
|||||||
@ParameterObject Page page,
|
@ParameterObject Page page,
|
||||||
@RequestParam(required = false) Long categoryId,
|
@RequestParam(required = false) Long categoryId,
|
||||||
@RequestParam(required = false) String keyword,
|
@RequestParam(required = false) String keyword,
|
||||||
@RequestParam(required = false) Long merchantId
|
Long merchantId
|
||||||
) {
|
) {
|
||||||
LambdaQueryWrapper<MallProductEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<MallProductEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
wrapper.eq(categoryId != null, MallProductEntity::getCategoryId, categoryId);
|
wrapper.eq(categoryId != null, MallProductEntity::getCategoryId, categoryId);
|
||||||
wrapper.like(StrUtil.isNotBlank(keyword), MallProductEntity::getTitle, keyword);
|
wrapper.like(StrUtil.isNotBlank(keyword), MallProductEntity::getTitle, keyword);
|
||||||
wrapper.eq(merchantId != null, MallProductEntity::getMerchantId, merchantId);
|
wrapper.eq(merchantId != null, MallProductEntity::getMerchantId, merchantId);
|
||||||
wrapper.eq(MallProductEntity::getStatus, 1); // 只查上架商品
|
wrapper.eq(MallProductEntity::getStatus, MallConstants.Status.ENABLED); // 只查上架商品
|
||||||
|
|
||||||
IPage<MallProductEntity> productPage = mallProductService.page(page, wrapper);
|
IPage<MallProductEntity> productPage = mallProductService.page(page, wrapper);
|
||||||
|
|
||||||
@@ -267,14 +267,14 @@ public class MallAppController {
|
|||||||
vo.setMinPrice(skus.stream()
|
vo.setMinPrice(skus.stream()
|
||||||
.map(MallProductSkuEntity::getPrice)
|
.map(MallProductSkuEntity::getPrice)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.min(java.math.BigDecimal::compareTo)
|
.min(Integer::compareTo)
|
||||||
.orElse(java.math.BigDecimal.ZERO));
|
.orElse(0));
|
||||||
|
|
||||||
// 计算总库存
|
// 计算总库存
|
||||||
vo.setTotalStock(skus.stream()
|
vo.setTotalStock(skus.stream()
|
||||||
.map(MallProductSkuEntity::getStock)
|
.map(MallProductSkuEntity::getStock)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.mapToInt(Integer::intValue)
|
.mapToDouble(Double::doubleValue)
|
||||||
.sum());
|
.sum());
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
@@ -490,14 +490,14 @@ public class MallAppController {
|
|||||||
vo.setMinPrice(skus.stream()
|
vo.setMinPrice(skus.stream()
|
||||||
.map(MallProductSkuEntity::getPrice)
|
.map(MallProductSkuEntity::getPrice)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.min(java.math.BigDecimal::compareTo)
|
.min(Integer::compareTo)
|
||||||
.orElse(java.math.BigDecimal.ZERO));
|
.orElse(0));
|
||||||
|
|
||||||
// 计算总库存
|
// 计算总库存
|
||||||
vo.setTotalStock(skus.stream()
|
vo.setTotalStock(skus.stream()
|
||||||
.map(MallProductSkuEntity::getStock)
|
.map(MallProductSkuEntity::getStock)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.mapToInt(Integer::intValue)
|
.mapToDouble(Double::doubleValue)
|
||||||
.sum());
|
.sum());
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
|
|||||||
+7
-7
@@ -79,22 +79,22 @@ public class MallProductEntity extends Model<MallProductEntity> {
|
|||||||
private Integer priceType;
|
private Integer priceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPU售价(当price_type=2有效)
|
* SPU售价(当price_type=2有效,单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description="SPU售价(当price_type=2有效)")
|
@Schema(description="SPU售价(当price_type=2有效,单位:分)")
|
||||||
private BigDecimal spuPrice;
|
private Integer spuPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 划线价
|
* 划线价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description="划线价")
|
@Schema(description="划线价(单位:分)")
|
||||||
private BigDecimal originalPrice;
|
private Integer originalPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总库存(冗余)
|
* 总库存(冗余)
|
||||||
*/
|
*/
|
||||||
@Schema(description="总库存(冗余)")
|
@Schema(description="总库存(冗余)")
|
||||||
private Integer totalStock;
|
private Double totalStock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量单位
|
* 计量单位
|
||||||
|
|||||||
+7
-7
@@ -49,22 +49,22 @@ public class MallProductSkuEntity extends Model<MallProductSkuEntity> {
|
|||||||
private String skuName;
|
private String skuName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售价
|
* 售价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description="售价")
|
@Schema(description="售价(单位:分)")
|
||||||
private BigDecimal price;
|
private Integer price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本价
|
* 成本价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description="成本价")
|
@Schema(description="成本价(单位:分)")
|
||||||
private BigDecimal costPrice;
|
private Integer costPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存
|
* 库存
|
||||||
*/
|
*/
|
||||||
@Schema(description="库存")
|
@Schema(description="库存")
|
||||||
private Integer stock;
|
private Double stock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条码
|
* 条码
|
||||||
|
|||||||
+7
-7
@@ -72,22 +72,22 @@ public class MallProductDetailAppVo {
|
|||||||
private Integer priceType;
|
private Integer priceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPU售价
|
* SPU售价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "SPU售价")
|
@Schema(description = "SPU售价(单位:分)")
|
||||||
private BigDecimal spuPrice;
|
private Integer spuPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 划线价
|
* 划线价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "划线价")
|
@Schema(description = "划线价(单位:分)")
|
||||||
private BigDecimal originalPrice;
|
private Integer originalPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总库存
|
* 总库存
|
||||||
*/
|
*/
|
||||||
@Schema(description = "总库存")
|
@Schema(description = "总库存")
|
||||||
private Integer totalStock;
|
private Double totalStock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量单位
|
* 计量单位
|
||||||
|
|||||||
+10
-10
@@ -70,22 +70,22 @@ public class MallProductListAppVo {
|
|||||||
private Integer priceType;
|
private Integer priceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPU售价
|
* SPU售价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "SPU售价")
|
@Schema(description = "SPU售价(单位:分)")
|
||||||
private BigDecimal spuPrice;
|
private Integer spuPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 划线价
|
* 划线价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "划线价")
|
@Schema(description = "划线价(单位:分)")
|
||||||
private BigDecimal originalPrice;
|
private Integer originalPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总库存
|
* 总库存
|
||||||
*/
|
*/
|
||||||
@Schema(description = "总库存")
|
@Schema(description = "总库存")
|
||||||
private Integer totalStock;
|
private Double totalStock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量单位
|
* 计量单位
|
||||||
@@ -100,10 +100,10 @@ public class MallProductListAppVo {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最低价格(从SKU中计算)
|
* 最低价格(从SKU中计算,单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "最低价格")
|
@Schema(description = "最低价格(单位:分)")
|
||||||
private BigDecimal minPrice;
|
private Integer minPrice;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+7
-7
@@ -40,22 +40,22 @@ public class MallProductSkuAppVo {
|
|||||||
private String skuName;
|
private String skuName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售价
|
* 售价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "售价")
|
@Schema(description = "售价(单位:分)")
|
||||||
private BigDecimal price;
|
private Integer price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本价
|
* 成本价(单位:分)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "成本价")
|
@Schema(description = "成本价(单位:分)")
|
||||||
private BigDecimal costPrice;
|
private Integer costPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存
|
* 库存
|
||||||
*/
|
*/
|
||||||
@Schema(description = "库存")
|
@Schema(description = "库存")
|
||||||
private Integer stock;
|
private Double stock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条码
|
* 条码
|
||||||
|
|||||||
Reference in new issue
Block a user