jyc 6 dagar sedan
förälder
incheckning
c9c330c8b5

+ 240 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeGroupBuyMain.java

@@ -0,0 +1,240 @@
+package shop.alien.entity.store;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 团购主表
+ * @TableName life_group_buy_main
+ */
+@TableName(value ="life_group_buy_main")
+@JsonInclude
+@Data
+public class LifeGroupBuyMain {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 团购类型(1美食)
+     */
+    @ApiModelProperty(value = "团购类型(1美食)")
+    @TableField("group_type")
+    private Integer groupType;
+
+    /**
+     * 状态(0草稿/1待审核/2未开始/3审核拒绝/4已售罄/5进行中/6已下架/7已结束)
+     */
+    @ApiModelProperty(value = "状态(0草稿/1待审核/2未开始/3审核拒绝/4已售罄/5进行中/6已下架/7已结束)")
+    @TableField("status")
+    private Integer status;
+
+    /**
+     * 商铺id
+     */
+    @ApiModelProperty(value = "商铺id")
+    @TableField("store_id")
+    private String storeId;
+
+    /**
+     * 图片id
+     */
+    @ApiModelProperty(value = "图片id")
+    @TableField("image_id")
+    private String imageId;
+
+    /**
+     * 团购名称
+     */
+    @ApiModelProperty(value = "团购名称")
+    @TableField("group_name")
+    private String groupName;
+
+    /**
+     * 开始时间类型(0审核通过立即开始/1手动设置)
+     */
+    @ApiModelProperty(value = "开始时间类型(0审核通过立即开始/1手动设置)")
+    @TableField("start_time_type")
+    private Integer startTimeType;
+
+    /**
+     * 开始时间
+     */
+    @ApiModelProperty(value = "开始时间")
+    @TableField("start_time_value")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startTimeValue;
+
+    /**
+     * 结束时间
+     */
+    @ApiModelProperty(value = "结束时间")
+    @TableField("end_time")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endTime;
+
+    /**
+     * 库存数量
+     */
+    @ApiModelProperty(value = "库存数量")
+    @TableField("inventory_num")
+    private Integer inventoryNum;
+
+    /**
+     * 限购类型(0不限量/1自定义)
+     */
+    @ApiModelProperty(value = "限购类型(0不限量/1自定义)")
+    @TableField("quota_type")
+    private Integer quotaType;
+
+    /**
+     * 限购值
+     */
+    @ApiModelProperty(value = "限购值")
+    @TableField("quota_value")
+    private String quotaValue;
+
+    /**
+     * 原价
+     */
+    @ApiModelProperty(value = "原价")
+    @TableField("original_price")
+    private BigDecimal originalPrice;
+
+    /**
+     * 优惠价
+     */
+    @ApiModelProperty(value = "优惠价")
+    @TableField("preferential_price")
+    private BigDecimal preferentialPrice;
+
+    /**
+     * 有效期类型(0指定天数/1指定时间段)
+     */
+    @ApiModelProperty(value = "有效期类型(0指定天数/1指定时间段)")
+    @TableField("effective_date_type")
+    private Integer effectiveDateType;
+
+    /**
+     * 有效期值
+     */
+    @ApiModelProperty(value = "有效期值")
+    @TableField("effective_date_value")
+    private String effectiveDateValue;
+
+    /**
+     * 不可用日期类型(0全部日期可用/1限制日期:1234567;节日id/2自定义不可用日期)
+     */
+    @ApiModelProperty(value = "不可用日期类型(0全部日期可用/1限制日期:1234567;节日id/2自定义不可用日期)")
+    @TableField("disable_date_type")
+    private Integer disableDateType;
+
+    /**
+     * 不可用日期值
+     */
+    @ApiModelProperty(value = "不可用日期值")
+    @TableField("disable_date_value")
+    private String disableDateValue;
+
+    /**
+     * 核销方式
+     */
+    @ApiModelProperty(value = "核销方式")
+    @TableField("write_off")
+    private String writeOff;
+
+    /**
+     * 预约规则
+     */
+    @ApiModelProperty(value = "预约规则")
+    @TableField("reservation_rules")
+    private String reservationRules;
+
+    /**
+     * 使用规则
+     */
+    @ApiModelProperty(value = "使用规则")
+    @TableField("use_rules")
+    private String useRules;
+
+    /**
+     * 适用人数
+     */
+    @ApiModelProperty(value = "适用人数")
+    @TableField("applicable_num")
+    private String applicableNum;
+
+    /**
+     * 其他规则
+     */
+    @ApiModelProperty(value = "其他规则")
+    @TableField("other_rules")
+    private String otherRules;
+
+    /**
+     * 发票类型(0电子发票/1纸质发票)
+     */
+    @ApiModelProperty(value = "发票类型(0电子发票/1纸质发票)")
+    @TableField("invoice_type")
+    private Integer invoiceType;
+
+    /**
+     * 发票说明
+     */
+    @ApiModelProperty(value = "发票说明")
+    @TableField("invoice_describe")
+    private String invoiceDescribe;
+
+    /**
+     * 是否保价(0否/1是)
+     */
+    @ApiModelProperty(value = "是否保价(0否/1是)")
+    @TableField("insured_flag")
+    private Integer insuredFlag;
+
+    /**
+     * 当价格低于当前价格
+     */
+    @ApiModelProperty(value = "当价格低于当前价格")
+    @TableField("insured_price")
+    private BigDecimal insuredPrice;
+
+    /**
+     * 自动为用户补偿优惠券id
+     */
+    @ApiModelProperty(value = "自动为用户补偿优惠券id")
+    @TableField("coupon_id")
+    private Integer couponId;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    @TableField("created_user_id")
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "修改时间")
+    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    @TableField("updated_user_id")
+    private Integer updatedUserId;
+}

+ 97 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeGroupBuyThali.java

@@ -0,0 +1,97 @@
+package shop.alien.entity.store;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 团购套餐详情子表
+ * @TableName life_group_buy_thali
+ */
+@TableName(value ="life_group_buy_thali")
+@JsonInclude
+@Data
+public class LifeGroupBuyThali {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 团购主表id
+     */
+    @ApiModelProperty(value = "团购主表id")
+    @TableField("parent_id")
+    private String parentId;
+
+    /**
+     * 团购分类名称
+     */
+    @ApiModelProperty(value = "团购分类名称")
+    @TableField("group_name")
+    private String groupName;
+
+    /**
+     * 团购详情关联id
+     */
+    @ApiModelProperty(value = "团购详情关联id")
+    @TableField("detail_id")
+    private String detailId;
+
+    /**
+     * 数量
+     */
+    @ApiModelProperty(value = "数量")
+    @TableField("qty")
+    private Integer qty;
+
+    /**
+     * 价格
+     */
+    @ApiModelProperty(value = "价格")
+    @TableField("price")
+    private BigDecimal price;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    @TableField("created_user_id")
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "修改时间")
+    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    @TableField("updated_user_id")
+    private Integer updatedUserId;
+
+    @TableField(exist = false)
+    private String detailName;
+
+    @TableField(exist = false)
+    private String detailImg;
+
+    @TableField(exist = false)
+    private String detailPrice;
+
+    @TableField(exist = false)
+    private String detailUnit;
+}

+ 20 - 0
alien-entity/src/main/java/shop/alien/entity/store/dto/LifeGroupBuyDto.java

@@ -0,0 +1,20 @@
+package shop.alien.entity.store.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import shop.alien.entity.store.LifeGroupBuyMain;
+import shop.alien.entity.store.LifeGroupBuyThali;
+
+import java.util.List;
+
+/**
+ * 团购
+ */
+@Data
+@JsonInclude
+public class LifeGroupBuyDto {
+
+    private LifeGroupBuyMain lifeGroupBuyMain;
+
+    private List<LifeGroupBuyThali> lifeGroupBuyThalis;
+}

+ 245 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java

@@ -0,0 +1,245 @@
+package shop.alien.entity.store.vo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import shop.alien.entity.store.LifeGroupBuyThali;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 团购
+ */
+@Data
+@JsonInclude
+public class LifeGroupBuyThaliVo {
+
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 团购类型(1美食)
+     */
+    @ApiModelProperty(value = "团购类型(1美食)")
+    @TableField("group_type")
+    private Integer groupType;
+
+    /**
+     * 状态(0草稿/1待审核/2未开始/3审核拒绝/4已售罄/5进行中/6已下架/7已结束)
+     */
+    @ApiModelProperty(value = "状态(0草稿/1待审核/2未开始/3审核拒绝/4已售罄/5进行中/6已下架/7已结束)")
+    @TableField("status")
+    private Integer status;
+
+    /**
+     * 商铺id
+     */
+    @ApiModelProperty(value = "商铺id")
+    @TableField("store_id")
+    private String storeId;
+
+    /**
+     * 图片id
+     */
+    @ApiModelProperty(value = "图片id")
+    @TableField("image_id")
+    private String imageId;
+    private String imageValueStr;
+
+    /**
+     * 团购名称
+     */
+    @ApiModelProperty(value = "团购名称")
+    @TableField("group_name")
+    private String groupName;
+
+    /**
+     * 开始时间类型(0审核通过立即开始/1手动设置)
+     */
+    @ApiModelProperty(value = "开始时间类型(0审核通过立即开始/1手动设置)")
+    @TableField("start_time_type")
+    private Integer startTimeType;
+
+    /**
+     * 开始时间
+     */
+    @ApiModelProperty(value = "开始时间")
+    @TableField("start_time_value")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startTimeValue;
+
+    /**
+     * 结束时间
+     */
+    @ApiModelProperty(value = "结束时间")
+    @TableField("end_time")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endTime;
+
+    /**
+     * 库存数量
+     */
+    @ApiModelProperty(value = "库存数量")
+    @TableField("inventory_num")
+    private Integer inventoryNum;
+
+    /**
+     * 限购类型(0不限量/1自定义)
+     */
+    @ApiModelProperty(value = "限购类型(0不限量/1自定义)")
+    @TableField("quota_type")
+    private Integer quotaType;
+
+    /**
+     * 限购值
+     */
+    @ApiModelProperty(value = "限购值")
+    @TableField("quota_value")
+    private String quotaValue;
+
+    /**
+     * 原价
+     */
+    @ApiModelProperty(value = "原价")
+    @TableField("original_price")
+    private BigDecimal originalPrice;
+
+    /**
+     * 优惠价
+     */
+    @ApiModelProperty(value = "优惠价")
+    @TableField("preferential_price")
+    private BigDecimal preferentialPrice;
+
+    /**
+     * 有效期类型(0指定天数/1指定时间段)
+     */
+    @ApiModelProperty(value = "有效期类型(0指定天数/1指定时间段)")
+    @TableField("effective_date_type")
+    private Integer effectiveDateType;
+
+    /**
+     * 有效期值
+     */
+    @ApiModelProperty(value = "有效期值")
+    @TableField("effective_date_value")
+    private String effectiveDateValue;
+
+    /**
+     * 不可用日期类型(0全部日期可用/1限制日期:1234567;节日id/2自定义不可用日期)
+     */
+    @ApiModelProperty(value = "不可用日期类型(0全部日期可用/1限制日期:1234567;节日id/2自定义不可用日期)")
+    @TableField("disable_date_type")
+    private Integer disableDateType;
+
+    /**
+     * 不可用日期值
+     */
+    @ApiModelProperty(value = "不可用日期值")
+    @TableField("disable_date_value")
+    private String disableDateValue;
+    private String disableDateValueStr;
+
+    /**
+     * 核销方式
+     */
+    @ApiModelProperty(value = "核销方式")
+    @TableField("write_off")
+    private String writeOff;
+
+    /**
+     * 预约规则
+     */
+    @ApiModelProperty(value = "预约规则")
+    @TableField("reservation_rules")
+    private String reservationRules;
+
+    /**
+     * 使用规则
+     */
+    @ApiModelProperty(value = "使用规则")
+    @TableField("use_rules")
+    private String useRules;
+
+    /**
+     * 适用人数
+     */
+    @ApiModelProperty(value = "适用人数")
+    @TableField("applicable_num")
+    private String applicableNum;
+
+    /**
+     * 其他规则
+     */
+    @ApiModelProperty(value = "其他规则")
+    @TableField("other_rules")
+    private String otherRules;
+
+    /**
+     * 发票类型(0电子发票/1纸质发票)
+     */
+    @ApiModelProperty(value = "发票类型(0电子发票/1纸质发票)")
+    @TableField("invoice_type")
+    private Integer invoiceType;
+
+    /**
+     * 发票说明
+     */
+    @ApiModelProperty(value = "发票说明")
+    @TableField("invoice_describe")
+    private String invoiceDescribe;
+
+    /**
+     * 是否保价(0否/1是)
+     */
+    @ApiModelProperty(value = "是否保价(0否/1是)")
+    @TableField("insured_flag")
+    private Integer insuredFlag;
+
+    /**
+     * 当价格低于当前价格
+     */
+    @ApiModelProperty(value = "当价格低于当前价格")
+    @TableField("insured_price")
+    private BigDecimal insuredPrice;
+
+    /**
+     * 自动为用户补偿优惠券id
+     */
+    @ApiModelProperty(value = "自动为用户补偿优惠券id")
+    @TableField("coupon_id")
+    private Integer couponId;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    @TableField("created_user_id")
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "修改时间")
+    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    @TableField("updated_user_id")
+    private Integer updatedUserId;
+
+    @ApiModelProperty(value = "子信息")
+    private List<LifeGroupBuyThali> details;
+}

+ 35 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeGroupBuyMainMapper.java

@@ -0,0 +1,35 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.store.LifeGroupBuyMain;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import shop.alien.entity.store.vo.LifeGroupBuyThaliVo;
+
+/**
+* @author youch
+* @description 针对表【life_group_buy_main(团购主表)】的数据库操作Mapper
+* @createDate 2025-07-28 14:31:30
+* @Entity shop.alien.entity.store.LifeGroupBuyMain
+*/
+@Mapper
+public interface LifeGroupBuyMainMapper extends BaseMapper<LifeGroupBuyMain> {
+
+    @Select("select id,group_type,status,store_id,image_id,group_name,start_time_type,\n" +
+            "        start_time_value,end_time,inventory_num,quota_type,quota_value,\n" +
+            "        original_price,preferential_price,effective_date_type,effective_date_value,disable_date_type,\n" +
+            "        disable_date_value,write_off,reservation_rules,use_rules,applicable_num,\n" +
+            "        other_rules,invoice_type,invoice_describe,insured_flag,insured_price,\n" +
+            "        coupon_id,delete_flag,created_time,updated_time,created_user_id,\n" +
+            "        updated_user_id from life_group_buy_main ${ew.customSqlSegment}")
+    IPage<LifeGroupBuyThaliVo> selectPageByThaliVo(IPage<LifeGroupBuyThaliVo> lifeGroupBuyThaliVoIPage,@Param(Constants.WRAPPER) QueryWrapper<LifeGroupBuyThaliVo> queryWrapper);
+}
+
+
+
+

+ 18 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeGroupBuyThaliMapper.java

@@ -0,0 +1,18 @@
+package shop.alien.mapper;
+
+import shop.alien.entity.store.LifeGroupBuyThali;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author youch
+* @description 针对表【life_group_buy_thali(团购套餐详情子表)】的数据库操作Mapper
+* @createDate 2025-07-28 14:31:30
+* @Entity shop.alien.entity.store.LifeGroupBuyThali
+*/
+public interface LifeGroupBuyThaliMapper extends BaseMapper<LifeGroupBuyThali> {
+
+}
+
+
+
+

+ 8 - 0
alien-entity/src/main/resources/mapper/LifeGroupBuyMainMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shop.alien.mapper.LifeGroupBuyMainMapper">
+
+
+</mapper>

+ 8 - 0
alien-entity/src/main/resources/mapper/LifeGroupBuyThaliMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shop.alien.mapper.LifeGroupBuyThaliMapper">
+
+
+</mapper>

+ 88 - 0
alien-store/src/main/java/shop/alien/store/controller/LifeGroupBuyController.java

@@ -0,0 +1,88 @@
+package shop.alien.store.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.dto.LifeGroupBuyDto;
+import shop.alien.entity.store.vo.LifeGroupBuyThaliVo;
+import shop.alien.store.service.LifeGroupBuyService;
+
+/**
+ * 团购
+ */
+@Api(tags = {"重构-团购"})
+@Slf4j
+@CrossOrigin
+@RestController
+@RequestMapping("/groupBuy")
+@RequiredArgsConstructor
+public class LifeGroupBuyController {
+
+    private final LifeGroupBuyService lifeGroupBuyService;
+
+    @ApiOperation("保存套餐团购")
+    @PostMapping("/saveThali")
+    public R<Boolean> saveThali(@RequestBody LifeGroupBuyDto lifeGroupBuyDto) {
+        log.info("LifeGroupBuyController.saveThali?lifeGroupBuyDto={}", lifeGroupBuyDto.toString());
+        if (lifeGroupBuyService.saveThali(lifeGroupBuyDto)) {
+            return R.success("成功");
+        }
+        return R.fail("失败");
+    }
+
+    @ApiOperation("套餐团购列表")
+    @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "页数", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "size", value = "页容", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "storeId", value = "门店id", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "status", value = "状态(0草稿/1待审核/2未开始/3审核拒绝/4已售罄/5进行中/6已下架/7已结束)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "groupName", value = "名称", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "groupType", value = "团购类型", dataType = "String", paramType = "query", required = false)
+    })
+    @GetMapping("/getThaliList")
+    private R<IPage<LifeGroupBuyThaliVo>> getThaliList(@RequestParam(value = "page", defaultValue = "1") int page,
+                                                       @RequestParam(value = "size", defaultValue = "10") int size,
+                                                       @RequestParam(value = "storeId") String storeId,
+                                                       @RequestParam(value = "status", required = false) String status,
+                                                       @RequestParam(value = "groupName", required = false) String groupName,
+                                                       @RequestParam(value = "groupType", required = false) String groupType) {
+        log.info("LifeGroupBuyController.getThaliList?page={},size={},storeId={},status={},groupName={},groupType={}", page, size, storeId, status, groupName, groupType);
+        return R.data(lifeGroupBuyService.getThaliList(page, size, storeId, status, groupName, groupType));
+    }
+
+    @ApiOperation("id查询套餐团购")
+    @GetMapping("/getThaliById")
+    private R getThaliById(@RequestParam("id") String id) {
+        log.info("LifeGroupBuyController.getThaliById?id={}", id);
+        return R.data(lifeGroupBuyService.getThaliById(id));
+    }
+
+    @ApiOperation("修改团购状态")
+    @GetMapping("/updateStatus")
+    private R updateStatus(@RequestParam("id") String id, @RequestParam("status") String status) {
+        log.info("LifeGroupBuyController.updateStatus?id={},status={}", id, status);
+        if (lifeGroupBuyService.updateStatus(id, status)) {
+            return R.success("成功");
+        }
+        return R.fail("失败");
+    }
+
+    @ApiOperation("删除套餐团购")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "groupType", value = "团购类型(1美食)", dataType = "String", paramType = "query", required = true)
+    })
+    @GetMapping("/delThaliById")
+    private R delThaliById(@RequestParam("id") String id, @RequestParam("groupType") String groupType) {
+        log.info("LifeGroupBuyController.delThaliById?id={},groupType={}", id, groupType);
+        if (lifeGroupBuyService.delThaliById(id, groupType)) {
+            return R.success("成功");
+        }
+        return R.fail("失败");
+    }
+}

+ 25 - 0
alien-store/src/main/java/shop/alien/store/service/LifeGroupBuyService.java

@@ -0,0 +1,25 @@
+package shop.alien.store.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.transaction.annotation.Transactional;
+import shop.alien.entity.store.LifeGroupBuyMain;
+import shop.alien.entity.store.dto.LifeGroupBuyDto;
+import shop.alien.entity.store.vo.LifeGroupBuyThaliVo;
+
+/**
+ * 团购
+ */
+public interface LifeGroupBuyService extends IService<LifeGroupBuyMain> {
+
+    @Transactional(rollbackFor = Exception.class)
+    boolean saveThali(LifeGroupBuyDto lifeGroupBuyDto);
+
+    IPage<LifeGroupBuyThaliVo> getThaliList(int page, int size, String storeId, String status, String groupName, String groupType);
+
+    LifeGroupBuyThaliVo getThaliById(String id);
+
+    boolean updateStatus(String id,String status);
+
+    boolean delThaliById(String id,String groupType);
+}

+ 158 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java

@@ -0,0 +1,158 @@
+package shop.alien.store.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import shop.alien.entity.store.*;
+import shop.alien.entity.store.dto.LifeGroupBuyDto;
+import shop.alien.entity.store.vo.LifeGroupBuyThaliVo;
+import shop.alien.entity.store.vo.StoreMenuVo;
+import shop.alien.mapper.*;
+import shop.alien.store.service.LifeGroupBuyService;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 团购
+ */
+@Service
+@RequiredArgsConstructor
+public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper, LifeGroupBuyMain> implements LifeGroupBuyService {
+
+    private final LifeGroupBuyMainMapper lifeGroupBuyMainMapper;
+
+    private final LifeGroupBuyThaliMapper lifeGroupBuyThaliMapper;
+
+    private final StoreImgMapper storeImgMapper;
+
+    private final EssentialHolidayComparisonMapper essentialHolidayComparisonMapper;
+
+    private final StoreMenuMapper storeMenuMapper;
+
+    @Override
+    public boolean saveThali(LifeGroupBuyDto lifeGroupBuyDto) {
+        LifeGroupBuyMain lifeGroupBuyMain = lifeGroupBuyDto.getLifeGroupBuyMain();
+        List<LifeGroupBuyThali> lifeGroupBuyThalis = lifeGroupBuyDto.getLifeGroupBuyThalis();
+        if (ObjectUtils.isEmpty(lifeGroupBuyMain.getId())) {
+            lifeGroupBuyMainMapper.insert(lifeGroupBuyMain);
+            if (ObjectUtils.isNotEmpty(lifeGroupBuyThalis)) {
+                for (LifeGroupBuyThali lifeGroupBuyThali : lifeGroupBuyThalis) {
+                    lifeGroupBuyThali.setParentId(lifeGroupBuyMain.getId().toString());
+                    lifeGroupBuyThaliMapper.insert(lifeGroupBuyThali);
+                }
+            }
+            return true;
+        } else {
+            lifeGroupBuyMainMapper.updateById(lifeGroupBuyMain);
+            lifeGroupBuyThaliMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyThali>().eq(LifeGroupBuyThali::getParentId, lifeGroupBuyMain.getId()).set(LifeGroupBuyThali::getDeleteFlag, 1));
+            if (ObjectUtils.isNotEmpty(lifeGroupBuyThalis)) {
+                for (LifeGroupBuyThali lifeGroupBuyThali : lifeGroupBuyThalis) {
+                    lifeGroupBuyThali.setParentId(lifeGroupBuyMain.getId().toString());
+                    lifeGroupBuyThaliMapper.insert(lifeGroupBuyThali);
+                }
+            }
+            return true;
+        }
+    }
+
+    @Override
+    public IPage<LifeGroupBuyThaliVo> getThaliList(int page, int size, String storeId, String status, String groupName, String groupType) {
+        QueryWrapper<LifeGroupBuyThaliVo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.isNotEmpty(storeId), "store_id", storeId)
+                .eq(StringUtils.isNotEmpty(status), "status", status)
+                .eq(StringUtils.isNotEmpty(groupType), "group_type", groupType)
+                .like(StringUtils.isNotEmpty(groupName), "group_name", groupName)
+                .eq("delete_flag", 0)
+                .orderByDesc("created_time");
+        IPage<LifeGroupBuyThaliVo> lifeGroupBuyThaliVoIPage = new Page<>(page, size);
+        IPage<LifeGroupBuyThaliVo> lifeGroupBuyMainIPage = lifeGroupBuyMainMapper.selectPageByThaliVo(lifeGroupBuyThaliVoIPage, queryWrapper);
+        List<LifeGroupBuyThaliVo> records = lifeGroupBuyMainIPage.getRecords();
+        if (ObjectUtils.isNotEmpty(records)) {
+            List<Integer> collect = records.stream().map(LifeGroupBuyThaliVo::getId).collect(Collectors.toList());
+            List<LifeGroupBuyThali> lifeGroupBuyThalis = lifeGroupBuyThaliMapper.selectList(new LambdaQueryWrapper<LifeGroupBuyThali>().in(LifeGroupBuyThali::getParentId, collect).eq(LifeGroupBuyThali::getDeleteFlag, 0));
+            records.forEach(i -> i.setDetails(lifeGroupBuyThalis.stream().filter(d -> i.getId().toString().equals(d.getParentId())).collect(Collectors.toList())));
+            for (LifeGroupBuyThaliVo record : records) {
+                record.setDetails(lifeGroupBuyThalis.stream().filter(d -> record.getId().toString().equals(d.getParentId())).collect(Collectors.toList()));
+
+                getMainImgAndDisableDate(record);
+            }
+        }
+        return lifeGroupBuyMainIPage;
+    }
+
+    @Override
+    public LifeGroupBuyThaliVo getThaliById(String id) {
+        LifeGroupBuyMain lifeGroupBuyMain = lifeGroupBuyMainMapper.selectById(id);
+        LifeGroupBuyThaliVo lifeGroupBuyThaliVo = new LifeGroupBuyThaliVo();
+        BeanUtils.copyProperties(lifeGroupBuyMain, lifeGroupBuyThaliVo);
+        List<LifeGroupBuyThali> lifeGroupBuyThalis = lifeGroupBuyThaliMapper.selectList(new LambdaQueryWrapper<LifeGroupBuyThali>().eq(LifeGroupBuyThali::getParentId, id).eq(LifeGroupBuyThali::getDeleteFlag, 0));
+
+        //美食
+        if (lifeGroupBuyMain.getGroupType() == 1) {
+            for (LifeGroupBuyThali lifeGroupBuyThali : lifeGroupBuyThalis) {
+                if (StringUtils.isNotEmpty(lifeGroupBuyThali.getDetailId())) {
+                    StoreMenuVo menuInfo = storeMenuMapper.getMenuInfo(Integer.parseInt(lifeGroupBuyThali.getDetailId()));
+                    if (ObjectUtils.isNotEmpty(menuInfo)) {
+                        lifeGroupBuyThali.setDetailName(menuInfo.getDishName());
+                        lifeGroupBuyThali.setDetailImg(menuInfo.getImgUrl());
+                        lifeGroupBuyThali.setDetailPrice(menuInfo.getDishPrice().toString());
+                        lifeGroupBuyThali.setDetailUnit(menuInfo.getDishesUnit());
+                    }
+                }
+            }
+        }
+
+        lifeGroupBuyThaliVo.setDetails(lifeGroupBuyThalis);
+        getMainImgAndDisableDate(lifeGroupBuyThaliVo);
+        return lifeGroupBuyThaliVo;
+    }
+
+    @Override
+    public boolean updateStatus(String id, String status) {
+        lifeGroupBuyMainMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyMain>().eq(LifeGroupBuyMain::getId, id).set(LifeGroupBuyMain::getStatus, status));
+        return true;
+    }
+
+    @Override
+    public boolean delThaliById(String id, String groupType) {
+        if ("1".equals(groupType)) {
+            lifeGroupBuyThaliMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyThali>().eq(LifeGroupBuyThali::getParentId, id).set(LifeGroupBuyThali::getDeleteFlag, 1));
+        }
+        lifeGroupBuyMainMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyMain>().eq(LifeGroupBuyMain::getId, id).set(LifeGroupBuyMain::getDeleteFlag, 1));
+        return true;
+    }
+
+    private void getMainImgAndDisableDate(LifeGroupBuyThaliVo record) {
+        //图片
+        if (StringUtils.isNotEmpty(record.getImageId())) {
+            List<String> imgIds = Arrays.asList(record.getImageId().split(","));
+            List<StoreImg> storeImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().in(StoreImg::getId, imgIds));
+            if (ObjectUtils.isNotEmpty(storeImgs)) {
+                String imgs = storeImgs.stream()
+                        .map(StoreImg::getImgUrl)
+                        .collect(Collectors.joining(","));
+                record.setImageValueStr(imgs);
+            }
+        }
+        //不可用日期
+        if (ObjectUtils.isNotEmpty(record.getDisableDateType())) {
+            if (record.getDisableDateType() == 1) {
+                List<String> valueList = Arrays.asList(record.getDisableDateValue().split(";"));
+                List<String> list = Arrays.asList(valueList.get(1).split(","));
+                List<EssentialHolidayComparison> essentialHolidayComparisons = essentialHolidayComparisonMapper.selectList(new LambdaQueryWrapper<EssentialHolidayComparison>().in(EssentialHolidayComparison::getId, list));
+                String holiday = essentialHolidayComparisons.stream().map(EssentialHolidayComparison::getFestivalName).collect(Collectors.joining(","));
+                record.setDisableDateValueStr(valueList.get(0) + ";" + holiday);
+            }
+        }
+    }
+}