共富商城

This commit is contained in:
zjf committed 2025-09-08 18:37:54 +08:00
1 parent 5968204663
commit 1699a33b1e
6 files changed
+50 -50

No files matched your search

@@ -153,7 +153,7 @@ public class MallAppController {
);
// 按商品ID分组SKU
Map<Long, List<MallProductSkuEntity>> skuMap = skuList.stream()
Map<Long, List<MallProductSkuEntity>> skuMap = skuList.stream()
.collect(Collectors.groupingBy(MallProductSkuEntity::getProductId));
// 转换为VO
@@ -177,14 +177,14 @@ public class MallAppController {
productVo.setMinPrice(skus.stream()
.map(MallProductSkuEntity::getPrice)
.filter(Objects::nonNull)
.min(java.math.BigDecimal::compareTo)
.orElse(java.math.BigDecimal.ZERO));
.min(Integer::compareTo)
.orElse(0));
// 计算总库存
productVo.setTotalStock(skus.stream()
.map(MallProductSkuEntity::getStock)
.filter(Objects::nonNull)
.mapToInt(Integer::intValue)
.mapToDouble(Double::doubleValue)
.sum());
@@ -232,13 +232,13 @@ public class MallAppController {
@ParameterObject Page page,
@RequestParam(required = false) Long categoryId,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) Long merchantId
Long merchantId
) {
LambdaQueryWrapper<MallProductEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(categoryId != null, MallProductEntity::getCategoryId, categoryId);
wrapper.like(StrUtil.isNotBlank(keyword), MallProductEntity::getTitle, keyword);
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);
@@ -267,14 +267,14 @@ public class MallAppController {
vo.setMinPrice(skus.stream()
.map(MallProductSkuEntity::getPrice)
.filter(Objects::nonNull)
.min(java.math.BigDecimal::compareTo)
.orElse(java.math.BigDecimal.ZERO));
.min(Integer::compareTo)
.orElse(0));
// 计算总库存
vo.setTotalStock(skus.stream()
.map(MallProductSkuEntity::getStock)
.filter(Objects::nonNull)
.mapToInt(Integer::intValue)
.mapToDouble(Double::doubleValue)
.sum());
return vo;
@@ -490,14 +490,14 @@ public class MallAppController {
vo.setMinPrice(skus.stream()
.map(MallProductSkuEntity::getPrice)
.filter(Objects::nonNull)
.min(java.math.BigDecimal::compareTo)
.orElse(java.math.BigDecimal.ZERO));
.min(Integer::compareTo)
.orElse(0));
// 计算总库存
vo.setTotalStock(skus.stream()
.map(MallProductSkuEntity::getStock)
.filter(Objects::nonNull)
.mapToInt(Integer::intValue)
.mapToDouble(Double::doubleValue)
.sum());
return vo;
@@ -79,22 +79,22 @@ public class MallProductEntity extends Model<MallProductEntity> {
private Integer priceType;
/**
* SPU售价(当price_type=2有效)
* SPU售价(当price_type=2有效,单位:分)
*/
@Schema(description="SPU售价(当price_type=2有效)")
private BigDecimal spuPrice;
@Schema(description="SPU售价(当price_type=2有效,单位:分)")
private Integer spuPrice;
/**
* 划线价
* 划线价(单位:分)
*/
@Schema(description="划线价")
private BigDecimal originalPrice;
@Schema(description="划线价(单位:分)")
private Integer originalPrice;
/**
* 总库存(冗余)
*/
@Schema(description="总库存(冗余)")
private Integer totalStock;
private Double totalStock;
/**
* 计量单位
@@ -49,22 +49,22 @@ public class MallProductSkuEntity extends Model<MallProductSkuEntity> {
private String skuName;
/**
* 售价
* 售价(单位:分)
*/
@Schema(description="售价")
private BigDecimal price;
@Schema(description="售价(单位:分)")
private Integer price;
/**
* 成本价
* 成本价(单位:分)
*/
@Schema(description="成本价")
private BigDecimal costPrice;
@Schema(description="成本价(单位:分)")
private Integer costPrice;
/**
* 库存
*/
@Schema(description="库存")
private Integer stock;
private Double stock;
/**
* 条码
@@ -72,22 +72,22 @@ public class MallProductDetailAppVo {
private Integer priceType;
/**
* SPU售价
* SPU售价(单位:分)
*/
@Schema(description = "SPU售价")
private BigDecimal spuPrice;
@Schema(description = "SPU售价(单位:分)")
private Integer spuPrice;
/**
* 划线价
* 划线价(单位:分)
*/
@Schema(description = "划线价")
private BigDecimal originalPrice;
@Schema(description = "划线价(单位:分)")
private Integer originalPrice;
/**
* 总库存
*/
@Schema(description = "总库存")
private Integer totalStock;
private Double totalStock;
/**
* 计量单位
@@ -70,22 +70,22 @@ public class MallProductListAppVo {
private Integer priceType;
/**
* SPU售价
* SPU售价(单位:分)
*/
@Schema(description = "SPU售价")
private BigDecimal spuPrice;
@Schema(description = "SPU售价(单位:分)")
private Integer spuPrice;
/**
* 划线价
* 划线价(单位:分)
*/
@Schema(description = "划线价")
private BigDecimal originalPrice;
@Schema(description = "划线价(单位:分)")
private Integer originalPrice;
/**
* 总库存
*/
@Schema(description = "总库存")
private Integer totalStock;
private Double totalStock;
/**
* 计量单位
@@ -100,10 +100,10 @@ public class MallProductListAppVo {
private Integer status;
/**
* 最低价格(从SKU中计算)
* 最低价格(从SKU中计算,单位:分)
*/
@Schema(description = "最低价格")
private BigDecimal minPrice;
@Schema(description = "最低价格(单位:分)")
private Integer minPrice;
}
@@ -40,22 +40,22 @@ public class MallProductSkuAppVo {
private String skuName;
/**
* 售价
* 售价(单位:分)
*/
@Schema(description = "售价")
private BigDecimal price;
@Schema(description = "售价(单位:分)")
private Integer price;
/**
* 成本价
* 成本价(单位:分)
*/
@Schema(description = "成本价")
private BigDecimal costPrice;
@Schema(description = "成本价(单位:分)")
private Integer costPrice;
/**
* 库存
*/
@Schema(description = "库存")
private Integer stock;
private Double stock;
/**
* 条码