Explorar o código

web-中台 套餐详情

qxy hai 4 meses
pai
achega
1dd8d11346

+ 5 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyMainVo.java

@@ -8,9 +8,11 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import shop.alien.entity.store.EssentialHolidayComparison;
 import shop.alien.entity.store.LifeGroupBuyMain;
+import shop.alien.entity.store.LifeGroupBuyThali;
 import shop.alien.entity.store.StoreImg;
 
 import java.util.List;
+import java.util.Map;
 
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -45,4 +47,7 @@ public class LifeGroupBuyMainVo extends LifeGroupBuyMain {
 
     @ApiModelProperty(value = "不可用日期list")
     private List<EssentialHolidayComparison> essentialHolidayComparisonList;
+
+    @ApiModelProperty(value = "套餐子表list")
+    private List<LifeGroupBuyThali> lifeGroupBuyThaliList;
 }

+ 23 - 5
alien-entity/src/main/java/shop/alien/mapper/LifeGroupBuyThaliMapper.java

@@ -1,16 +1,34 @@
 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.toolkit.Constants;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeGroupBuyThali;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+
+import java.util.List;
+
 /**
-* @author youch
-* @description 针对表【life_group_buy_thali(团购套餐详情子表)】的数据库操作Mapper
-* @createDate 2025-07-28 14:31:30
-* @Entity shop.alien.entity.store.LifeGroupBuyThali
-*/
+ * @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> {
 
+    @Select("SELECT\n" +
+            "\tlife.id,life.detail_id,life.group_name,life.parent_id,life.detail_sort,life.price,life.qty,life.detail_sort,life.created_time,store.dish_name,store.dish_price,\n" +
+            "\tstore.dishes_unit,\n" +
+            "\tstore.img_id as dishImg \n" +
+            "FROM\n" +
+            "\tlife_group_buy_thali life\n" +
+            "\tLEFT JOIN store_menu store ON life.detail_id = store.id\n" +
+            "${ew.customSqlSegment}")
+    List<LifeGroupBuyThali> getLifeGroupBuyThaliList(@Param(Constants.WRAPPER) LambdaQueryWrapper<LifeGroupBuyThali> wrapper);
+
 }
 
 

+ 1 - 0
alien-entity/src/main/java/shop/alien/mapper/PlatformStoreLifeGroupBuyMainMapper.java

@@ -31,4 +31,5 @@ public interface PlatformStoreLifeGroupBuyMainMapper extends BaseMapper<LifeGrou
             "\tJOIN store_user user ON store.id = user.store_id\n"+
             "${ew.customSqlSegment}")
     List<LifeGroupBuyMainVo> getLifeGroupBuyMainList(@Param(Constants.WRAPPER) QueryWrapper<LifeGroupBuyMainVo> wrapper);
+
 }

+ 23 - 17
alien-store/src/main/java/shop/alien/store/service/impl/PlatformStoreCouponServiceImpl.java

@@ -44,8 +44,11 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
     private final StoreInfoMapper storeInfoMapper;
 
     private final StoreImgMapper storeImgMapper;
+
     private final EssentialHolidayComparisonMapper essentialHolidayComparisonMapper;
 
+    private final LifeGroupBuyThaliMapper lifeGroupBuyThaliMapper;
+
     private final AliOSSUtil aliOSSUtil;
 
     List<LifeCouponVo> toExcel = new ArrayList<>();
@@ -250,8 +253,8 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
             if (null == lifeGroupBuyMain) return 0;
             lifeGroupBuyMain.setStatus(status);
             lifeGroupBuyMain.setApprovalComments(comment);
-            // 审核后开始
-            if (lifeGroupBuyMain.getStartTimeType()==0) {
+            // 审核通过后开始
+            if (lifeGroupBuyMain.getStartTimeType() == 0 && lifeGroupBuyMain.getStatus() == 5) {
                 lifeGroupBuyMain.setStartTimeValue(new Date());
             }
             return platformStoreLifeGroupBuyMainMapper.updateById(lifeGroupBuyMain);
@@ -484,7 +487,12 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
 
     @Override
     public LifeGroupBuyMainVo getLifeGroupBuyMainByDetail(Integer id) {
+        LifeGroupBuyMainVo lifeGroupBuyMainVo = new LifeGroupBuyMainVo();
         LifeGroupBuyMain lifeGroupBuyMain = platformStoreLifeGroupBuyMainMapper.selectById(id);
+        List<LifeGroupBuyThali> lifeGroupBuyThali = lifeGroupBuyThaliMapper.getLifeGroupBuyThaliList(new LambdaQueryWrapper<LifeGroupBuyThali>()
+                .eq(LifeGroupBuyThali::getParentId, lifeGroupBuyMain.getId()).groupBy(LifeGroupBuyThali::getDetailId));
+        lifeGroupBuyMainVo.setLifeGroupBuyThaliList(lifeGroupBuyThali);
+
         // 添加商户信息
         StoreInfo storeUser = storeInfoMapper.selectById(lifeGroupBuyMain.getStoreId());
         // 图片
@@ -492,8 +500,6 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
                 .map(String::trim)
                 .collect(Collectors.toList());
         List<StoreImg> storeImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().in(StoreImg::getId, collect));
-
-        LifeGroupBuyMainVo lifeGroupBuyMainVo = new LifeGroupBuyMainVo();
         BeanUtils.copyProperties(lifeGroupBuyMain, lifeGroupBuyMainVo);
         lifeGroupBuyMainVo.setStoreName(storeUser.getStoreName());
         lifeGroupBuyMainVo.setStoreImgList(storeImgs);
@@ -519,22 +525,22 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
             lifeGroupBuyMainVo.setExpiredState("1"); // 当前时间超过 endDate → 已到期
         }
 
-            // 核心逻辑:未过期时赋 0,已过期赋 1(与前端枚举定义一致)
-            if (nowDate.isBefore(endDateTime)) {
-                // 计算剩余天数
-                long remainingDays = ChronoUnit.DAYS.between(nowDate, endDateTime);
-                lifeGroupBuyMainVo.setDaysToExpire(remainingDays + "天");
-                lifeGroupBuyMainVo.setExpiredState("0"); // 当前时间未超过 endDate → 未到期
-            } else {
-                lifeGroupBuyMainVo.setDaysToExpire("0天");
-                lifeGroupBuyMainVo.setExpiredState("1"); // 当前时间超过 endDate → 已到期
-            }
+        // 核心逻辑:未过期时赋 0,已过期赋 1(与前端枚举定义一致)
+        if (nowDate.isBefore(endDateTime)) {
+            // 计算剩余天数
+            long remainingDays = ChronoUnit.DAYS.between(nowDate, endDateTime);
+            lifeGroupBuyMainVo.setDaysToExpire(remainingDays + "天");
+            lifeGroupBuyMainVo.setExpiredState("0"); // 当前时间未超过 endDate → 未到期
+        } else {
+            lifeGroupBuyMainVo.setDaysToExpire("0天");
+            lifeGroupBuyMainVo.setExpiredState("1"); // 当前时间超过 endDate → 已到期
+        }
         // 不可用日期
         String afterSemicolon = lifeGroupBuyMain.getDisableDateValue().split(";")[1];
-        if(StringUtils.isNotEmpty(afterSemicolon)){
+        if (StringUtils.isNotEmpty(afterSemicolon)) {
             List<String> collectUnavailableDate = Arrays.stream(afterSemicolon.split(",")).map(String::trim).collect(Collectors.toList());
-            if(CollectionUtils.isNotEmpty(collectUnavailableDate)){
-                List<EssentialHolidayComparison> essentialHolidayComparisons = essentialHolidayComparisonMapper.selectList(new LambdaQueryWrapper<EssentialHolidayComparison>().in(EssentialHolidayComparison::getId,collectUnavailableDate));
+            if (CollectionUtils.isNotEmpty(collectUnavailableDate)) {
+                List<EssentialHolidayComparison> essentialHolidayComparisons = essentialHolidayComparisonMapper.selectList(new LambdaQueryWrapper<EssentialHolidayComparison>().in(EssentialHolidayComparison::getId, collectUnavailableDate));
                 lifeGroupBuyMainVo.setEssentialHolidayComparisonList(essentialHolidayComparisons);
             }
         }