diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java index f3850a4..d4ef17a 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java @@ -18,7 +18,6 @@ public interface TbProductMapper { TbProduct selectById(Integer id); - List selectByIdIn(@Param("ids") String ids); List selectByIdInAndCheck(@Param("ids") String ids); List selectHot(@Param("shopId") String shopId,@Param("list") Set proIds); 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 14a982d..54010b0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java @@ -1,20 +1,23 @@ package com.chaozhanggui.system.cashierservice.entity; +import com.chaozhanggui.system.cashierservice.entity.vo.ProductGroupVo; import lombok.Data; import org.springframework.data.annotation.Transient; -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-18 14:41:53 + * @since 2024-11-19 15:52:20 */ @Data public class TbProduct implements Serializable { - private static final long serialVersionUID = -40921077034892720L; + private static final long serialVersionUID = 876918627328411456L; /** * id */ @@ -27,11 +30,6 @@ public class TbProduct implements Serializable { * 商品规格 */ private Integer specId; - /** - * 商户Id - */ - private String merchantId; - private String shopId; /** * 商品名称 @@ -42,7 +40,7 @@ public class TbProduct implements Serializable { */ private String shortTitle; /** - * 商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券商品 coupon + * 普通商品 normal 套餐商品 package 称重商品 weigh 团购券 coupon */ private String type; /** @@ -76,10 +74,6 @@ public class TbProduct implements Serializable { * 0--待审核 1审核通过 -1审核失败 -2违规下架 */ private Integer status; - /** - * 审核失败原因 - */ - private String failMsg; /** * 是否热销 */ @@ -108,6 +102,10 @@ public class TbProduct implements Serializable { private Long createdAt; private Long updatedAt; + /** + * 0 固定套餐 1可选套餐 + */ + private Integer groupType; /** * 套餐内容 */ @@ -148,6 +146,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 String cartNumber="0"; @@ -159,6 +193,6 @@ public class TbProduct implements Serializable { @Transient private TbProductSkuResult productSkuResult; - + private List proGroupVo; } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ProductGroupVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ProductGroupVo.java new file mode 100644 index 0000000..61d7a28 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ProductGroupVo.java @@ -0,0 +1,34 @@ +package com.chaozhanggui.system.cashierservice.entity.vo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductGroupVo { + + private Integer count; + //选几个 + private Integer number; + //类别 + private String title; + + //食物 + private List goods=new ArrayList<>(); + + @Data + @JsonIgnoreProperties(ignoreUnknown = true) + public static class Food { + private Integer proId; + private String proName; + private Integer skuId; + private String skuName; + private BigDecimal price; + private String number; + private String unitName; + } +} 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 e0fb5dc..096ca52 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -477,6 +477,9 @@ public class ProductService { boolean isMemberPrice = shopInfo.getIsMemberPrice() != null && shopInfo.getIsMemberPrice() == 1; if (!CollectionUtils.isEmpty(products)) { products.parallelStream().forEach(it -> { + if("package".equals(it.getType())){ + it.setProGroupVo(JSONUtil.parseListTNewList(it.getGroupSnap(), ProductGroupVo.class)); + } TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId())); it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : ""); if(check){ diff --git a/src/main/resources/mapper/TbProductMapper.xml b/src/main/resources/mapper/TbProductMapper.xml index 84e9c14..7372799 100644 --- a/src/main/resources/mapper/TbProductMapper.xml +++ b/src/main/resources/mapper/TbProductMapper.xml @@ -6,20 +6,17 @@ - - - - + + - @@ -27,6 +24,10 @@ + + + + @@ -34,14 +35,26 @@ + + + + + + + + + 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 + , category_id, spec_id, shop_id, name, short_title, type, pack_fee, + low_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_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 + - @@ -76,9 +80,8 @@ LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id JOIN (SELECT product_id ,SUM(real_sales_number) as realSalesNumber FROM tb_product_sku - WHERE shop_id = #{shopId} - and is_del = 0 - AND product_id IN + WHERE + shop_id = #{shopId} and is_del = 0 AND product_id IN #{item} @@ -86,7 +89,8 @@ ORDER BY realSalesNumber DESC LIMIT 3) AS top_products ON tb.id = top_products.product_id where tb.status = 1 - and tb.type_enum != 'group' + and tb.type != 'coupon' and tb.is_del = 0 + and tb.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and tb.start_time <= CURRENT_TIMESTAMP and tb.end_time >= CURRENT_TIMESTAMP and tb.is_grounding = 1 group by tb.id order by stockNumber desc @@ -101,17 +105,12 @@ and tb.shop_id = #{shopId} and tb.status = 1 and tb.is_grounding = 1 - and tb.type_enum != 'group' + and tb.type != 'coupon' and tb.is_del = 0 + and tb.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and tb.start_time <= CURRENT_TIMESTAMP and tb.end_time >= CURRENT_TIMESTAMP group by tb.id order by tb.sort asc - - - - - -