From 51c160aa260cdb6424b1ff007c5983ac6b1f4a83 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Tue, 19 Nov 2024 16:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=A0=A1=E9=AA=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashierservice/entity/TbProduct.java | 78 +++++++---- .../service/ProductService.java | 34 ++--- src/main/resources/mapper/TbProductMapper.xml | 124 +++++++++++------- 3 files changed, 145 insertions(+), 91 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java index 73f0a1e..2d38cb3 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java @@ -1,13 +1,20 @@ package com.chaozhanggui.system.cashierservice.entity; import lombok.Data; - -import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalTime; +import java.io.Serializable; import java.util.List; +/** + * (TbProduct)实体类 + * + * @author ww + * @since 2024-11-19 15:23:12 + */ @Data public class TbProduct implements Serializable { + private static final long serialVersionUID = 371589032559725924L; /** * id */ @@ -20,10 +27,6 @@ public class TbProduct implements Serializable { * 商品规格 */ private Integer specId; - /** - * 商户Id - */ - private String merchantId; private String shopId; /** @@ -35,9 +38,14 @@ public class TbProduct implements Serializable { */ private String shortTitle; /** - * 商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券商品 coupon + * 普通商品 normal 套餐商品 package 称重商品 weigh 团购券 coupon */ private String type; + /** + * 计量商品 normal + * 多规格商品 sku + */ + private String typeEnum; /** * 包装费 */ @@ -47,12 +55,10 @@ public class TbProduct implements Serializable { */ private BigDecimal lowPrice; - private BigDecimal lowMemberPrice; /** * 单位Id */ private Integer unitId; - private String unitSnap; /** * 商品封面图 */ @@ -69,22 +75,10 @@ public class TbProduct implements Serializable { * 0--待审核 1审核通过 -1审核失败 -2违规下架 */ private Integer status; - /** - * 审核失败原因 - */ - private String failMsg; /** * 是否热销 */ private Integer isHot; - /** - * 计量商品 normal - * 称重商品 weight - * 多规格商品 sku - * 套餐商品 group - * 时价商品 currentPrice - */ - private String typeEnum; /** * 是否回收站 0-否,1回收站 */ @@ -101,6 +95,10 @@ public class TbProduct implements Serializable { private Long createdAt; private Long updatedAt; + /** + * 0 固定套餐 1可选套餐 + */ + private Integer groupType; /** * 套餐内容 */ @@ -141,6 +139,42 @@ public class TbProduct implements Serializable { * 库存警戒线 */ private Integer warnLine; + /** + * 堂食 table 自取 dine 配送 delivery 快递 express + */ + private String showType; + /** + * 称重 价格/千克 + */ + private BigDecimal weight; + /** + * 是否允许临时改价 + */ + private Integer isTempPrice; + /** + * 日销售上限 + */ + private Integer dayLimit; + /** + * 每单销售上限 + */ + private Integer singleOrderLimit; + /** + * 每人销售上限 + */ + private Integer singlePeopleLimit; + /** + * 周 数组 周一,周二,周日 + */ + private String days; + /** + * 可用开始时间 + */ + private LocalTime startTime; + /** + * 可用结束时间 + */ + private LocalTime endTime; private int orderCount; @@ -152,6 +186,4 @@ public class TbProduct implements Serializable { private List skuList; - private static final long serialVersionUID = 1L; - } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index d7669b8..9fc02b9 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -70,33 +70,33 @@ public class ProductService { } - public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){ - List TbProduct=null; - if(ObjectUtil.isEmpty(categoryId)){ - TbProduct=tbProductMapper.selectByShopId(shopId,commdityName); - }else { - TbProduct=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName); + public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId) { + List tbProducts = null; + if (ObjectUtil.isEmpty(categoryId)) { + tbProducts = tbProductMapper.selectByShopId(shopId, commdityName); + } else { + tbProducts = tbProductMapper.selectByShopIdAndShopType(shopId, categoryId, commdityName); } String day = DateUtils.getDay(); - if(ObjectUtil.isNotEmpty(TbProduct)){ - TbProduct.parallelStream().forEach(it->{ - Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId,day, ""); - it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount); - TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId()); - if(ObjectUtil.isEmpty(tbProductSpec)){ - tbProductSpec=new TbProductSpec(); + if (ObjectUtil.isNotEmpty(tbProducts)) { + tbProducts.parallelStream().forEach(it -> { + Integer orderCount = tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(), it.getId().toString(), masterId, day, ""); + it.setOrderCount((ObjectUtil.isNull(orderCount) || ObjectUtil.isEmpty(orderCount)) ? 0 : orderCount); + TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(it.getSpecId()); + if (ObjectUtil.isEmpty(tbProductSpec)) { + tbProductSpec = new TbProductSpec(); } it.setTbProductSpec(tbProductSpec); - TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId()); - if(ObjectUtil.isEmpty(skuResult)){ - skuResult=new TbProductSkuResult(); + TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId()); + if (ObjectUtil.isEmpty(skuResult)) { + skuResult = new TbProductSkuResult(); } it.setProductSkuResult(skuResult); }); } - return Result.success(CodeEnum.SUCCESS,TbProduct); + return Result.success(CodeEnum.SUCCESS, tbProducts); } diff --git a/src/main/resources/mapper/TbProductMapper.xml b/src/main/resources/mapper/TbProductMapper.xml index eccfb2f..7f29709 100644 --- a/src/main/resources/mapper/TbProductMapper.xml +++ b/src/main/resources/mapper/TbProductMapper.xml @@ -1,45 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id - , category_id, spec_id, merchant_id, shop_id, name, short_title, type, pack_fee, low_price, low_member_price, - unit_id, cover_img, images, sort, status, fail_msg, is_hot, type_enum, is_del, is_stock, is_pause_sale, - created_at, updated_at, group_snap, spec_info, select_spec, - spec_table_headers, group_category_id, real_sales_number, stock_number, is_grounding, is_refund_stock, warn_line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, category_id, spec_id, merchant_id, shop_id, name, short_title, + type, pack_fee, low_price, unit_id, cover_img, images, sort, status, + is_hot, type_enum, is_del, is_stock, is_pause_sale, created_at, updated_at, + group_type, group_snap, spec_info, select_spec, spec_table_headers, + group_category_id, real_sales_number, stock_number, is_grounding, + is_refund_stock, warn_line, show_type, weight, is_temp_price, + day_limit, single_order_limit, single_people_limit, days, start_time, end_time + + + + +