Sfoglia il codice sorgente

web-中台 套餐状态列表 审核状态 套餐详情

qxy 4 mesi fa
parent
commit
f70cda82ce

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeCouponVo.java

@@ -20,7 +20,7 @@ import java.util.List;
 @EqualsAndHashCode(callSuper = false)
 @JsonInclude
 @NoArgsConstructor
-@ApiModel(value = "LifeCouponVo对象", description = "套餐")
+@ApiModel(value = "LifeCouponVo对象", description = "代金券")
 public class LifeCouponVo extends LifeCoupon {
 
     @TableId(value = "id", type = IdType.AUTO)

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

@@ -0,0 +1,45 @@
+package shop.alien.entity.store.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import shop.alien.entity.store.LifeGroupBuyMain;
+import shop.alien.entity.store.StoreImg;
+
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@JsonInclude
+@NoArgsConstructor
+@ApiModel(value = "LifeGroupBuyMainVo对象", description = "套餐")
+public class LifeGroupBuyMainVo extends LifeGroupBuyMain {
+
+    @ApiModelProperty(value = "是否过期 0:未过期 1:已过期")
+    private String expiredState;
+
+    @ApiModelProperty(value = "商家名称")
+    private String storeName;
+
+    @ApiModelProperty(value = "商家手机号")
+    private String phone;
+
+    @ApiModelProperty(value = "套餐名称映射导出类字段")
+    private String couponName;
+
+    @ApiModelProperty(value = "套餐状态映射导出类字段")
+    private String couponState;
+
+    @ApiModelProperty(value = "套餐时间映射导出类字段")
+    private String couponTime;
+
+    @ApiModelProperty(value = "剩余天数映射导出类字段")
+    private String daysToExpire;
+
+    @ApiModelProperty(value = "图片list")
+    private List<StoreImg> storeImgList;
+
+}

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

@@ -0,0 +1,34 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.store.LifeGroupBuyMain;
+import shop.alien.entity.store.vo.LifeGroupBuyMainVo;
+
+import java.util.List;
+
+
+public interface PlatformStoreLifeGroupBuyMainMapper extends BaseMapper<LifeGroupBuyMain> {
+
+    @Select("SELECT\n" +
+            "\tlife.id,store.store_name,life.inventory_num,life.group_name,user.phone,life.created_time,life.start_time_value,life.end_time,life.status\n" +
+            "FROM\n" +
+            "\tlife_group_buy_main life\n" +
+            "\tJOIN store_info store ON store.id = life.store_id\n" +
+            "\tJOIN store_user user ON store.id = user.store_id\n"+
+            "${ew.customSqlSegment}")
+    IPage<LifeGroupBuyMainVo> getLifeGroupBuyMainList(IPage<LifeGroupBuyMainVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeGroupBuyMainVo> wrapper);
+
+    @Select("SELECT\n" +
+            "\tlife.id,store.store_name,life.inventory_num,life.group_name,user.phone,life.created_time,life.start_time_value,life.end_time,life.status\n" +
+            "FROM\n" +
+            "\tlife_group_buy_main life\n" +
+            "\tJOIN store_info store ON store.id = life.store_id\n" +
+            "\tJOIN store_user user ON store.id = user.store_id\n"+
+            "${ew.customSqlSegment}")
+    List<LifeGroupBuyMainVo> getLifeGroupBuyMainList(@Param(Constants.WRAPPER) QueryWrapper<LifeGroupBuyMainVo> wrapper);
+}

+ 47 - 8
alien-store/src/main/java/shop/alien/store/controller/PlatformStoreCouponController.java

@@ -7,7 +7,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LifeCoupon;
+import shop.alien.entity.store.LifeGroupBuyMain;
 import shop.alien.entity.store.vo.LifeCouponVo;
+import shop.alien.entity.store.vo.LifeGroupBuyMainVo;
 import shop.alien.store.service.PlatformStoreCouponService;
 
 import java.io.IOException;
@@ -22,7 +24,7 @@ public class PlatformStoreCouponController {
 
     private final PlatformStoreCouponService platformStoreCouponService;
 
-    @ApiOperation("套餐/代金券列表")
+    @ApiOperation("代金券列表")
     @ApiOperationSupport(order = 1)
     @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
             @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true),
@@ -38,6 +40,33 @@ public class PlatformStoreCouponController {
         return R.data(platformStoreCouponService.getCouponList(page, size, storeName, status, createdTime, phone, type));
     }
 
+    @ApiOperation("web-新套餐列表/查询套餐状态")
+    @ApiOperationSupport(order = 14)
+    @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "storeName", value = "商家名称", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "createdTime", value = "创建时间", dataType = "Date", paramType = "query"),
+            @ApiImplicitParam(name = "status", value = "审核状态", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "expiredState", value = "过期状态", dataType = "String", paramType = "query")
+    })
+    @GetMapping("/getLifeGroupBuyMainList")
+    public R<IPage<LifeGroupBuyMainVo>> getLifeGroupBuyMainList(Integer page, Integer size, String storeName, String status, @RequestParam(value = "createdTime", required = false) String createdTime, String phone, String expiredState) {
+        log.info("PlatformStoreCouponController.getLifeGroupBuyMainList?page={},size={},name={},status={},createdTime={}", page, size, storeName, status, createdTime, phone, expiredState);
+        return R.data(platformStoreCouponService.getLifeGroupBuyMainList(page, size, storeName, status, createdTime, phone, expiredState));
+    }
+
+    @ApiOperation("web-新套餐状态详情")
+    @ApiOperationSupport(order = 16)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "Integer", paramType = "query")
+    })
+    @GetMapping("/getLifeGroupBuyMainByDetail")
+    public R<LifeGroupBuyMainVo> getLifeGroupBuyMainByDetail(Integer id) {
+        log.info("PlatformStoreCouponController.getLifeGroupBuyMainByDetail?id={}", id);
+        return R.data(platformStoreCouponService.getLifeGroupBuyMainByDetail(id));
+    }
+
     /**
      * web-分页查询店铺信息
      *
@@ -47,7 +76,7 @@ public class PlatformStoreCouponController {
      * @param expiredState 过期状态
      * @return IPage<StoreInfoVo>
      */
-    @ApiOperation("web-分页查询套餐状态")
+    @ApiOperation("web-分页查询代金券状态")
     @ApiOperationSupport(order = 7)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@@ -75,6 +104,15 @@ public class PlatformStoreCouponController {
         return R.data(platformStoreCouponService.couponStatusExport(status, expiredState));
     }
 
+    @ApiOperation("web-新导出套餐状态Excel")
+    @ApiOperationSupport(order = 15)
+    @GetMapping("/lifeGroupBuyMainStatusExport")
+    public R lifeGroupBuyMainStatusExport(@RequestParam(required = false) String status,
+                                @RequestParam(required = false) String expiredState) throws IOException {
+        log.info("PlatformStoreCouponController.lifeGroupBuyMainStatusExport");
+        return R.data(platformStoreCouponService.lifeGroupBuyMainStatusExport(status, expiredState));
+    }
+
     @ApiOperation("web-套餐状态删除")
     @ApiOperationSupport(order = 11)
     @GetMapping("/deleteCouponStatus")
@@ -83,7 +121,7 @@ public class PlatformStoreCouponController {
         return platformStoreCouponService.deleteCouponStatus(id);
     }
 
-    @ApiOperation("套餐/代金券详情")
+    @ApiOperation("代金券详情")
     @ApiOperationSupport(order = 2)
     @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键id", dataType = "Integer", paramType = "query", required = true)})
     @GetMapping("/getCouponById")
@@ -92,15 +130,16 @@ public class PlatformStoreCouponController {
         return R.data(platformStoreCouponService.getCouponById(id));
     }
 
-    @ApiOperation("套餐/代金券审核")
+    @ApiOperation("web-套餐/代金券审核")
     @ApiOperationSupport(order = 2)
     @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键id", dataType = "Integer", paramType = "query", required = true),
             @ApiImplicitParam(name = "status", value = "状态", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "comment", value = "审批意见", dataType = "String", paramType = "query")})
+            @ApiImplicitParam(name = "comment", value = "审批意见", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "代金券/套餐类型 0:代金券 1:套餐", dataType = "String", paramType = "query")})
     @GetMapping("/approvalCoupon")
-    public R<Integer> approvalCoupon(Integer id, Integer status, String comment) {
-        log.info("PlatformStoreCouponController.approvalCoupon?id={},status={},comment={}", id, status, comment);
-        return R.data(platformStoreCouponService.approvalCoupon(id, status, comment));
+    public R<Integer> approvalCoupon(Integer id, Integer status, String comment, String type) {
+        log.info("PlatformStoreCouponController.approvalCoupon?id={},status={},comment={}type={}", id, status, comment, type);
+        return R.data(platformStoreCouponService.approvalCoupon(id, status, comment, type));
     }
 
 }

+ 9 - 2
alien-store/src/main/java/shop/alien/store/service/PlatformStoreCouponService.java

@@ -3,6 +3,7 @@ package shop.alien.store.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import shop.alien.entity.store.LifeCoupon;
 import shop.alien.entity.store.vo.LifeCouponVo;
+import shop.alien.entity.store.vo.LifeGroupBuyMainVo;
 
 import java.io.IOException;
 
@@ -10,13 +11,19 @@ public interface PlatformStoreCouponService {
 
     IPage<LifeCouponVo> getCouponList(Integer page, Integer size, String storeName, String status, String createdTime, String phone, String type);
 
+    IPage<LifeGroupBuyMainVo> getLifeGroupBuyMainList(Integer page, Integer size, String storeName, String status, String createdTime, String phone, String expiredState);
+
     IPage<LifeCouponVo> getCouponStatusList(Integer page, Integer size, String status, String expiredState);
 
     LifeCouponVo getCouponById(Integer id);
 
-    int approvalCoupon(Integer id, Integer status, String comment);
+    int approvalCoupon(Integer id, Integer status, String comment, String type);
+
+    String couponStatusExport(String status, String expiredState) throws IOException;
 
-    String couponStatusExport(String status, String expiredState) throws IOException;;
+    String lifeGroupBuyMainStatusExport(String status, String expiredState) throws IOException;
 
     int deleteCouponStatus(Integer id);
+
+    LifeGroupBuyMainVo getLifeGroupBuyMainByDetail(Integer id);
 }

+ 238 - 15
alien-store/src/main/java/shop/alien/store/service/impl/PlatformStoreCouponServiceImpl.java

@@ -1,5 +1,6 @@
 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.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -9,10 +10,17 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import shop.alien.entity.store.LifeCoupon;
+import shop.alien.entity.store.LifeGroupBuyMain;
+import shop.alien.entity.store.StoreImg;
+import shop.alien.entity.store.StoreInfo;
 import shop.alien.entity.store.excelVo.StoreCouponStatusVo;
 import shop.alien.entity.store.excelVo.util.ExcelGenerator;
 import shop.alien.entity.store.vo.LifeCouponVo;
+import shop.alien.entity.store.vo.LifeGroupBuyMainVo;
 import shop.alien.mapper.PlatformStoreCouponMapper;
+import shop.alien.mapper.PlatformStoreLifeGroupBuyMainMapper;
+import shop.alien.mapper.StoreImgMapper;
+import shop.alien.mapper.StoreInfoMapper;
 import shop.alien.store.service.PlatformStoreCouponService;
 
 import java.io.IOException;
@@ -28,6 +36,9 @@ import java.util.stream.Collectors;
 public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponService {
 
     private final PlatformStoreCouponMapper platformStoreCouponMapper;
+    private final PlatformStoreLifeGroupBuyMainMapper platformStoreLifeGroupBuyMainMapper;
+    private final StoreInfoMapper storeInfoMapper;
+    private final StoreImgMapper storeImgMapper;
 
     List<LifeCouponVo> toExcel = new ArrayList<>();
 
@@ -80,6 +91,54 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
     }
 
     @Override
+    public IPage<LifeGroupBuyMainVo> getLifeGroupBuyMainList(Integer page, Integer size, String storeName, String status, String createdTime, String phone, String expiredState) {
+        QueryWrapper<LifeGroupBuyMainVo> wrapper = new QueryWrapper<>();
+        wrapper.like(StringUtils.isNotEmpty(storeName), "store.store_name", storeName);
+        if(status==null || status.equals("")){
+            wrapper.in("life.status",1,2,3,4,5,6,7);
+        }
+        if(status.equals("9")){
+            wrapper.in("life.status",4,5,6,7);
+        }else{
+            wrapper.eq(StringUtils.isNotEmpty(status), "life.status", status);
+        }
+        //0:套餐未过期 1:套餐已过期
+        LocalDateTime nowDate = LocalDateTime.now(); // 获取当前时间
+        if(expiredState!=null){
+            if(expiredState.equals("0")){
+                wrapper.gt("life.end_time",nowDate);
+            }
+            if(expiredState.equals("1")){
+                wrapper.lt("life.end_time",nowDate);
+            }
+        }
+
+        wrapper.eq("life.delete_flag", 0);
+        wrapper.eq("store.delete_flag", 0);
+        wrapper.eq("user.delete_flag", 0);
+        wrapper.like(StringUtils.isNotEmpty(createdTime), "life.created_time", createdTime);
+        wrapper.like(StringUtils.isNotEmpty(phone), "user.phone", phone);
+        wrapper.orderByDesc("life.created_time");
+
+        IPage<LifeGroupBuyMainVo> lifeGroupBuyMainList = platformStoreLifeGroupBuyMainMapper.getLifeGroupBuyMainList(new Page<>(page, size), wrapper);
+        lifeGroupBuyMainList.getRecords().forEach(item -> {
+// expiredState 赋值逻辑(修正版)
+            LocalDateTime now = LocalDateTime.now(); // 获取当前时间
+            Date endDate = item.getEndTime();
+            if (endDate != null) {
+                LocalDateTime endDateTime = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                // 核心逻辑:未过期时赋 0,已过期赋 1(与前端枚举定义一致)
+                if (now.isBefore(endDateTime)) {
+                    item.setExpiredState("0"); // 当前时间未超过 endDate → 未到期
+                } else {
+                    item.setExpiredState("1"); // 当前时间超过 endDate → 已到期
+                }
+            }
+        });
+        return lifeGroupBuyMainList;
+    }
+
+    @Override
     public IPage<LifeCouponVo> getCouponStatusList(Integer page, Integer size, String status, String expiredState) {
         IPage<LifeCouponVo> iPage = new Page<>(page, size);
         QueryWrapper<LifeCouponVo> wrapper = new QueryWrapper<>();
@@ -173,23 +232,36 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
     }
 
     @Override
-    public int approvalCoupon(Integer id, Integer status, String comment) {
-        LifeCoupon coupon = platformStoreCouponMapper.selectById(id);
-        if (null == coupon) return 0;
-
-        // 如果通过,且券有效时间在当前时间之前,则修改状态为进行中
-        Date now = new Date();
-        if (status == 0 && coupon.getStartDate().before(now) && coupon.getEndDate().after(now)) {
-            status = 1;
-        }
+    public int approvalCoupon(Integer id, Integer status, String comment, String type) {
+        if(type.equals("0")){
+            LifeCoupon coupon = platformStoreCouponMapper.selectById(id);
+            if (null == coupon) return 0;
+
+            // 如果通过,且券有效时间在当前时间之前,则修改状态为进行中
+            Date now = new Date();
+            if (status == 0 && coupon.getStartDate().before(now) && coupon.getEndDate().after(now)) {
+                status = 1;
+            }
 
-        coupon.setStatus(status);
-        coupon.setApprovalComments(comment);
-        // 审核后开始
-        if ("0".equals(coupon.getSaleTimeStrType())) {
-            coupon.setStartDate(new Date());
+            coupon.setStatus(status);
+            coupon.setApprovalComments(comment);
+            // 审核后开始
+            if ("0".equals(coupon.getSaleTimeStrType())) {
+                coupon.setStartDate(new Date());
+            }
+            return platformStoreCouponMapper.updateById(coupon);
+        }else{
+           LifeGroupBuyMain lifeGroupBuyMain = platformStoreLifeGroupBuyMainMapper.selectById(id);
+            if (null == lifeGroupBuyMain) return 0;
+            lifeGroupBuyMain.setStatus(status);
+            lifeGroupBuyMain.setApprovalComments(comment);
+            // 审核后开始
+            if ("0".equals(lifeGroupBuyMain.getStartTimeType())) {
+                lifeGroupBuyMain.setStartTimeValue(new Date());
+            }
+            return platformStoreLifeGroupBuyMainMapper.updateById(lifeGroupBuyMain);
         }
-        return platformStoreCouponMapper.updateById(coupon);
+
     }
 
     @Override
@@ -301,10 +373,161 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
     }
 
     @Override
+    public String lifeGroupBuyMainStatusExport(String status, String expiredState) throws IOException {
+        QueryWrapper<LifeGroupBuyMainVo> wrapper = new QueryWrapper<>();
+        // 定义允许的状态值
+        if(status==null || status.equals("")){
+            wrapper.in("life.status",1,2,3,4,5,6,7);
+        }
+        if(status.equals("9")){
+            wrapper.in("life.status",4,5,6,7);
+        }else{
+            wrapper.eq(StringUtils.isNotEmpty(status), "life.status", status);
+        }
+        //0:套餐未过期 1:套餐已过期
+        LocalDateTime nowDate = LocalDateTime.now(); // 获取当前时间
+        if(expiredState!=null){
+            if(expiredState.equals("0")){
+                wrapper.gt("life.end_time",nowDate);
+            }
+            if(expiredState.equals("1")){
+                wrapper.lt("life.end_time",nowDate);
+            }
+        }
+
+        wrapper.eq("life.delete_flag", 0);
+        wrapper.eq("store.delete_flag", 0);
+        wrapper.eq("user.delete_flag", 0);
+
+        wrapper.orderByDesc("life.created_time");
+
+        List<LifeGroupBuyMainVo> lifeGroupBuyMainList = platformStoreLifeGroupBuyMainMapper.getLifeGroupBuyMainList(wrapper);
+        lifeGroupBuyMainList.forEach(item -> {
+            if (item.getStatus() == 1) {
+                item.setCouponState("待审核");
+            } else if (item.getStatus() == 2) {
+                item.setCouponState("未开始");
+            } else if (item.getStatus() == 3) {
+                item.setCouponState("审核拒绝");
+            } else if (item.getStatus() == 4 && item.getInventoryNum() == 0) {
+                item.setCouponState("已售罄");
+            } else if (item.getStatus() == 5 && item.getInventoryNum()>0) {
+                item.setCouponState("进行中");
+            }
+            else if (item.getStatus() == 6) {
+                item.setCouponState("已下架");
+            }
+            else if (item.getStatus() == 7) {
+                item.setCouponState("已结束");
+            }
+            item.setCouponName(item.getGroupName());
+            Date startDate = item.getStartTimeValue();
+            Date endDate = item.getEndTime();
+            // expiredState 赋值逻辑(修正版)
+            LocalDateTime now = LocalDateTime.now(); // 获取当前时间
+
+            // 格式化日期
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            String formattedEndDate = "";
+            if (endDate != null) {
+                LocalDateTime endDateTime = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                // 调整结束时间为前一天的23:59:59
+                endDateTime = endDateTime.minusDays(1).withHour(23).withMinute(59).withSecond(59);
+                formattedEndDate = endDateTime.format(formatter);
+
+                // 核心逻辑:未过期时赋 0,已过期赋 1(与前端枚举定义一致)
+                if (now.isBefore(endDateTime)) {
+                    // 计算剩余天数
+                    long remainingDays = ChronoUnit.DAYS.between(now, endDateTime);
+                    item.setDaysToExpire(remainingDays + "天");
+                    item.setExpiredState("未到期"); // 当前时间未超过 endDate → 未到期
+                } else {
+                    item.setDaysToExpire("0天");
+                    item.setExpiredState("已到期"); // 当前时间超过 endDate → 已到期
+                }
+                // 将结束时间调整为前一秒
+                endDateTime = endDateTime.minusSeconds(1);
+            }
+
+            if (startDate != null) {
+                LocalDateTime startDateTime = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                String formattedStartDate = startDateTime.format(formatter);
+                item.setCouponTime(formattedStartDate + "-" + formattedEndDate);
+            }
+        });
+
+        // 根据 expiredState 进行筛选
+        if (StringUtils.isNotEmpty(expiredState)) {
+            // 将前端传递的 "0"/"1" 转换为业务状态
+            String targetState = "0".equals(expiredState) ? "未到期" : "已到期";
+
+            // 筛选时增加空值判断,避免 NPE
+            lifeGroupBuyMainList = lifeGroupBuyMainList.stream()
+                    .filter(item -> {
+                        String itemState = item.getExpiredState(); // 获取当前项的状态
+                        return targetState.equals(itemState); // 严格匹配字符串
+                    })
+                    .collect(Collectors.toList());
+        }
+        List<StoreCouponStatusVo> storeCouponStatusVos = new ArrayList<>();
+        int index = 1;
+        for (LifeGroupBuyMainVo record : lifeGroupBuyMainList) {
+            StoreCouponStatusVo storeCouponStatusVo = new StoreCouponStatusVo();
+            BeanUtils.copyProperties(record, storeCouponStatusVo);
+            storeCouponStatusVo.setId(String.valueOf(index++)); // 设置序号
+            storeCouponStatusVos.add(storeCouponStatusVo);
+        }
+        String fileName = UUID.randomUUID().toString().replace("-", "");
+
+        ExcelGenerator.generateExcel(excelPath + excelGeneratePath + fileName + ".xlsx", storeCouponStatusVos, StoreCouponStatusVo.class);
+        return fileUrl + "excel" + excelGeneratePath + fileName + ".xlsx";
+    }
+
+    @Override
     public int deleteCouponStatus(Integer id) {
         LifeCoupon lifeCoupon = new LifeCoupon();
         lifeCoupon.setId(String.valueOf(id));
         lifeCoupon.setStatusDeleteFlag(1);
         return platformStoreCouponMapper.deleteById(id);
     }
+
+    @Override
+    public LifeGroupBuyMainVo getLifeGroupBuyMainByDetail(Integer id) {
+        LifeGroupBuyMain lifeGroupBuyMain = platformStoreLifeGroupBuyMainMapper.selectById(id);
+        // 添加商户信息
+        StoreInfo storeUser = storeInfoMapper.selectById(lifeGroupBuyMain.getStoreId());
+
+        List<String> collect = Arrays.stream(lifeGroupBuyMain.getImageId().split(","))
+                    .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);
+        //0:套餐未过期 1:套餐已过期
+        LocalDateTime nowDate = LocalDateTime.now(); // 获取当前时间
+
+        // 格式化日期
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        String formattedEndDate = "";
+            LocalDateTime endDateTime = lifeGroupBuyMainVo.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+            // 调整结束时间为前一天的23:59:59
+            endDateTime = endDateTime.minusDays(1).withHour(23).withMinute(59).withSecond(59);
+//            formattedEndDate = endDateTime.format(formatter);
+
+            // 核心逻辑:未过期时赋 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 → 已到期
+            }
+
+        return lifeGroupBuyMainVo;
+    }
 }