diff --git a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java index 51ef5acc0..7a4e3e42c 100644 --- a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java +++ b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java @@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import com.bsd.pjcloud.common.core.util.TenantTable; + import java.time.LocalDateTime; /** @@ -26,182 +27,184 @@ import java.time.LocalDateTime; public class CanteenSpuEntity extends Model { - /** - * 商品 SPU 编号,自增 - */ + /** + * 商品 SPU 编号,自增 + */ @TableId(type = IdType.ASSIGN_ID) - @Schema(description="商品 SPU 编号,自增") + @Schema(description = "商品 SPU 编号,自增") private Long id; - /** - * 商品名称 - */ - @Schema(description="商品名称") + /** + * 商品名称 + */ + @Schema(description = "商品名称") private String name; - /** - * 商品简介 - */ - @Schema(description="商品简介") + /** + * 商品简介 + */ + @Schema(description = "商品简介") private String introduction; - /** - * 商品详情 - */ - @Schema(description="商品详情") + /** + * 商品详情 + */ + @Schema(description = "商品详情") private String description; - /** - * 商品分类编号 - */ - @Schema(description="商品分类编号") + /** + * 商品分类编号 + */ + @Schema(description = "商品分类编号") private Long categoryId; - /** - * 商品封面图 - */ - @Schema(description="商品封面图") + /** + * 商品封面图 + */ + @Schema(description = "商品封面图") private String picUrl; - /** - * 商品轮播图地址 - 数组,以逗号分隔 - 最多上传15张 - */ - @Schema(description="商品轮播图") + /** + * 商品轮播图地址 + * 数组,以逗号分隔 + * 最多上传15张 + */ + @Schema(description = "商品轮播图") private String sliderPicUrls; - /** - * 排序字段 - */ - @Schema(description="排序字段") + /** + * 排序字段 + */ + @Schema(description = "排序字段") private Integer sort; - /** - * 商品状态: 1 上架(开启) 0 下架(禁用) -1 回收 - */ - @Schema(description="商品状态: 1 上架(开启) 0 下架(禁用) -1 回收") + /** + * 商品状态: 1 上架(开启) 0 下架(禁用) -1 回收 + */ + @Schema(description = "商品状态: 1 上架(开启) 0 下架(禁用) -1 回收") private Integer status; - /** - * 规格类型:0 单规格 1 多规格 - */ - @Schema(description="规格类型:0 单规格 1 多规格") + /** + * 规格类型:0 单规格 1 多规格 + */ + @Schema(description = "规格类型:0 单规格 1 多规格") private Boolean specType; - /** - * 商品价格,单位使用:分 - */ - @Schema(description="商品价格,单位使用:分") + /** + * 商品价格,单位使用:分 + */ + @Schema(description = "商品价格,单位使用:分") // @JsonSerialize(using = MoneySerializer.class) // 分 -> 元 // @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分 private Integer price; - /** - * 市场价,单位使用:分 - */ - @Schema(description="市场价,单位使用:分") + /** + * 市场价,单位使用:分 + */ + @Schema(description = "市场价,单位使用:分") // @JsonSerialize(using = MoneySerializer.class) // 分 -> 元 // @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分 private Integer marketPrice; - /** - * 成本价,单位: 分 - */ - @Schema(description="成本价,单位: 分") + /** + * 成本价,单位: 分 + */ + @Schema(description = "成本价,单位: 分") // @JsonSerialize(using = MoneySerializer.class) // 分 -> 元 // @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分 private Integer costPrice; - /** - * 库存 - */ - @Schema(description="库存") + /** + * 库存 + */ + @Schema(description = "库存") private Integer stock; - /** - * 赠送积分 - */ - @Schema(description="赠送积分") + /** + * 赠送积分 + */ + @Schema(description = "赠送积分") private Integer giveIntegral; - /** - * 商品销量 - */ - @Schema(description="商品销量") + /** + * 商品销量 + */ + @Schema(description = "商品销量") private Integer salesCount; - /** - * 虚拟销量 - */ - @Schema(description="虚拟销量") + /** + * 虚拟销量 + */ + @Schema(description = "虚拟销量") private Integer virtualSalesCount; - /** - * 商品点击量 - */ - @Schema(description="商品点击量") + /** + * 商品点击量 + */ + @Schema(description = "商品点击量") private Integer browseCount; + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "是否删除 -1:已删除 0:正常") + private String delFlag; - @TableLogic - @TableField(fill = FieldFill.INSERT) - @Schema(description = "是否删除 -1:已删除 0:正常") - private String delFlag; - - /** - * 系统类型 2每日 3在线订餐 - */ - @Schema(description="系统类型 2每日 3在线订餐") + /** + * 系统类型 2每日 3在线订餐 + */ + @Schema(description = "系统类型 2每日 3在线订餐") private Long systemType; - /** - * 商户编号 - */ - @Schema(description="商户编号") + /** + * 商户编号 + */ + @Schema(description = "商户编号") private Long merchantId; - /** - * 部门id - */ - @Schema(description="部门id") + /** + * 部门id + */ + @Schema(description = "部门id") private Long deptId; - /** - * 创建人 - */ - @TableField(fill = FieldFill.INSERT) - @Schema(description="创建人") + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") private String createBy; - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT) - @Schema(description="创建时间") + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") private LocalDateTime createTime; - /** - * 更新人 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @Schema(description="更新人") + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新人") private String updateBy; - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @Schema(description="更新时间") + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新时间") private LocalDateTime updateTime; - /** - * 租户编号 - */ - @Schema(description="租户编号") + /** + * 租户编号 + */ + @Schema(description = "租户编号") private Long tenantId; - @Schema(description="是否显示") - private String isShow; + @Schema(description = "是否显示") + private String isShow; + + @Schema(description = "是否涨价") + private String isPriceIncreased; } \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenDailyMenuListVO.java b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenDailyMenuListVO.java index 3f522b01e..ecb1f1636 100644 --- a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenDailyMenuListVO.java +++ b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenDailyMenuListVO.java @@ -1,5 +1,6 @@ package com.bsd.pjcloud.canteen.vo; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @Data @@ -44,4 +45,9 @@ public class ADCanteenDailyMenuListVO { * 排序 */ private Integer sort; + + /** + * 是否涨价 + */ + private String isPriceIncreased; } diff --git a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenSpuListVO.java b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenSpuListVO.java index d7460b143..168a37e0e 100644 --- a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenSpuListVO.java +++ b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/ADCanteenSpuListVO.java @@ -15,71 +15,72 @@ public class ADCanteenSpuListVO { /** * 商品 SPU 编号,自增 */ - @Schema(description="商品 SPU 编号,自增") + @Schema(description = "商品 SPU 编号,自增") private Long id; /** * 商品名称 */ - @Schema(description="商品名称") + @Schema(description = "商品名称") private String name; /** * 商品分类编号 */ - @Schema(description="商品分类编号") + @Schema(description = "商品分类编号") private Long categoryId; /** * 商品封面图 */ - @Schema(description="商品封面图") + @Schema(description = "商品封面图") private String picUrl; /** * 商品价格,单位使用:分 */ - @Schema(description="商品价格,单位使用:分") + @Schema(description = "商品价格,单位使用:分") private Integer price; /** * 市场价,单位使用:分 */ - @Schema(description="市场价,单位使用:分") + @Schema(description = "市场价,单位使用:分") private Integer marketPrice; /** * 库存 */ - @Schema(description="库存") + @Schema(description = "库存") private Integer stock; /** * 商品销量 */ - @Schema(description="商品销量") + @Schema(description = "商品销量") private Integer salesCount; /** * 商户编号 */ - @Schema(description="商户编号") + @Schema(description = "商户编号") private Long merchantId; /** * 部门id */ - @Schema(description="部门id") + @Schema(description = "部门id") private Long deptId; + @Schema(description = "是否涨价") + private String isPriceIncreased; - - @Schema(description="餐段类型") + @Schema(description = "餐段类型") private String categoryType; } diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java index 7f0b1de3a..8241ee60a 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java @@ -46,6 +46,7 @@ public class CanteenSpuServiceImpl extends ServiceImpl wrapper) { return baseMapper.selectListByScope(wrapper, DataScope.of()); @@ -59,11 +60,11 @@ public class CanteenSpuServiceImpl extends ServiceImpl spu.getStock()) { - R.failed(spu.getName()+"库存不足,无法完成操作"); + R.failed(spu.getName() + "库存不足,无法完成操作"); } int i = baseMapper.updateStock(item.getId(), item.getIncrCount()); // if (item.getIncrCount() <= 0) { @@ -89,7 +90,7 @@ public class CanteenSpuServiceImpl extends ServiceImpl> listMap = canteenCategoryEntities.stream().collect(Collectors.groupingBy(CanteenCategoryEntity::getId)); bean.forEach(item -> { - if (null!=listMap.get(item.getCategoryId()).get(0).getCategoryType()){ + if (null != listMap.get(item.getCategoryId()).get(0).getCategoryType()) { item.setCategoryType(listMap.get(item.getCategoryId()).get(0).getCategoryType()); } }); @@ -127,7 +128,7 @@ public class CanteenSpuServiceImpl extends ServiceImpl canteenCategoryEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); canteenCategoryEntityLambdaQueryWrapper.like(CanteenCategoryEntity::getCategoryType, canteenDailySpuDTO.getHourType()); List canteenCategoryEntities = canteenCategoryMapper.selectList(canteenCategoryEntityLambdaQueryWrapper); - List caIds = canteenCategoryEntities.stream().map(CanteenCategoryEntity::getId).collect(Collectors.toList()); + List caIds = canteenCategoryEntities.stream().map(CanteenCategoryEntity::getId).collect(Collectors.toList()); wrapper.in(!CollectionUtils.isEmpty(caIds), CanteenSpuEntity::getCategoryId, caIds); // wrapper.orderByAsc(CanteenSpuEntity::getSort); @@ -164,32 +165,32 @@ public class CanteenSpuServiceImpl extends ServiceImpl pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of()); List records = pageData.getRecords(); - + // 构建返回的VO列表 List resultList = new ArrayList<>(); - + if (!CollectionUtils.isEmpty(records)) { // 获取所有SPU ID List spuIds = records.stream() .map(CanteenSpuEntity::getId) .collect(Collectors.toList()); - + // 查询对应的库存信息 LambdaQueryWrapper stockWrapper = Wrappers.lambdaQuery(); stockWrapper.in(CanteenStockEntity::getItemId, spuIds); stockWrapper.eq(CanteenStockEntity::getItemType, "2"); // 假设"成品"表示菜品的类型 List stockList = canteenStockMapper.selectList(stockWrapper); - + // 将库存信息映射到SPU ID Map stockMap = stockList.stream() .collect(Collectors.toMap(CanteenStockEntity::getItemId, stock -> stock, (v1, v2) -> v1)); - + // 构建返回结果 for (CanteenSpuEntity spu : records) { CanteenSpuStockVO vo = new CanteenSpuStockVO(); vo.setName(spu.getName()); vo.setPicUrl(spu.getPicUrl()); - + // 设置库存信息 CanteenStockEntity stock = stockMap.get(spu.getId()); if (stock != null) { @@ -205,11 +206,11 @@ public class CanteenSpuServiceImpl extends ServiceImpl resultPage = new Page<>(); resultPage.setRecords(resultList); @@ -217,7 +218,7 @@ public class CanteenSpuServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName()); wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId()); + wrapper.eq(Objects.nonNull(canteenSpu.getIsPriceIncreased()), CanteenSpuEntity::getIsPriceIncreased, canteenSpu.getIsPriceIncreased()); wrapper.orderByAsc(CanteenSpuEntity::getSort).orderByDesc(CanteenSpuEntity::getId); LambdaQueryWrapper canteenOnlineSpuEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenDailyMenuMapper.xml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenDailyMenuMapper.xml index f47debe6c..97c691e96 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenDailyMenuMapper.xml +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenDailyMenuMapper.xml @@ -28,6 +28,7 @@ +