From dc181d4428c85f681d342e2ca5c7760aea5f254d Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 08 八月 2025 17:22:53 +0800
Subject: [PATCH] 导出,商品标签

---
 framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java          |   14 +
 manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java             |    9 +
 framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsExportDTO.java               |   36 ++++
 framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java      |    2 
 framework/src/main/java/cn/lili/modules/order/order/entity/dto/CouponExportDetailDTO.java  |   77 +++++++++
 framework/src/main/java/cn/lili/modules/promotion/service/MemberCouponService.java         |    3 
 framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java                   |    2 
 framework/src/main/java/cn/lili/modules/promotion/mapper/MemberCouponMapper.java           |    5 
 manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java        |    8 +
 framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java            |   97 +++++++++++
 framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java |  139 +++++++++++++++++
 manager-api/src/main/java/cn/lili/controller/lmk/GoodsTagController.java                   |   35 ++++
 framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java                    |    3 
 13 files changed, 423 insertions(+), 7 deletions(-)

diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsExportDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsExportDTO.java
new file mode 100644
index 0000000..4596d79
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsExportDTO.java
@@ -0,0 +1,36 @@
+package cn.lili.modules.goods.entity.dto;
+
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * lmk-shop-java
+ *
+ * @author : zxl
+ * @date : 2025-08-08 10:23
+ **/
+@Data
+public class GoodsExportDTO {
+    @ApiModelProperty(value = "鍟嗗搧鍚嶇О")
+    private String goodsName;
+    @ApiModelProperty(value = "鍟嗗搧缂栧彿")
+    private String id;
+    @ApiModelProperty(value = "浠锋牸")
+    private Double price;
+
+    @ApiModelProperty(value = "閿�鍞ā寮�")
+    private String salesModel;
+
+    @ApiModelProperty(value = "鍟嗗搧绫诲瀷")
+    private String goodsType;
+
+    @ApiModelProperty(value = "涓婃灦鐘舵��")
+    private String marketEnable;
+
+    @ApiModelProperty(value = "瀹℃牳鐘舵��")
+    private String authFlag;
+
+    @ApiModelProperty(value = "鍗栧鍚嶅瓧")
+    private String storeName;
+}
diff --git a/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java b/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java
index f3c9054..51ec12f 100644
--- a/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java
+++ b/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java
@@ -13,6 +13,7 @@
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.util.List;
 
@@ -199,4 +200,6 @@
 
 
     void addGoodsCommentNum(Integer commentNum, String goodsId);
+
+    void queryExportGoods(HttpServletResponse response, GoodsSearchParams searchParams);
 }
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
index 8fb237a..b80f5b5 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
@@ -15,10 +15,7 @@
 import cn.lili.common.security.context.UserContext;
 import cn.lili.common.security.enums.UserEnums;
 import cn.lili.modules.goods.entity.dos.*;
-import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
-import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
-import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
-import cn.lili.modules.goods.entity.dto.GoodsSortDTO;
+import cn.lili.modules.goods.entity.dto.*;
 import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
 import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
 import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
@@ -50,6 +47,10 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,6 +58,9 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -311,9 +315,91 @@
         return this.page(PageUtil.initPage(goodsSearchParams), goodsSearchParams.queryWrapper());
     }
 
+    @Override
+    public void queryExportGoods(HttpServletResponse response, GoodsSearchParams searchParams) {
+        List<Goods> list = this.list(searchParams.queryWrapper());
+
+        XSSFWorkbook workbook = initGoodsExportData(list);
+        try {
+            // 璁剧疆鍝嶅簲澶�
+            String fileName = URLEncoder.encode("鍟嗗搧娓呭崟", "UTF-8");
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+
+            ServletOutputStream out = response.getOutputStream();
+            workbook.write(out);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                workbook.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+    }
+    private XSSFWorkbook initGoodsExportData(List<Goods> list) {
+        List<GoodsExportDTO> goodsExportDTOs = new ArrayList<>();
+        for (Goods goods : list) {
+            GoodsExportDTO goodsExportDTO = new GoodsExportDTO();
+            BeanUtils.copyProperties(goods, goodsExportDTO);
+            goodsExportDTOs.add(goodsExportDTO);
+        }
+
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        Sheet sheet = workbook.createSheet("鍟嗗搧娓呭崟");
+        Row header = sheet.createRow(0);
+        String[] headers = {"鍟嗗搧鍚嶇О", "鍟嗗搧缂栧彿", "浠锋牸", "閿�鍞ā寮�", "鍟嗗搧绫诲瀷", "鐘舵��", "瀹℃牳鐘舵��", "搴楅摵鍚嶇О"};
+        for (int i = 0; i < headers.length; i++) {
+            Cell cell = header.createCell(i);
+            cell.setCellValue(headers[i]);
+        }
+        for (int i = 0; i < goodsExportDTOs.size(); i++) {
+            GoodsExportDTO goodsExportDTO = goodsExportDTOs.get(i);
+            Row row = sheet.createRow(i + 1);
+            row.createCell(0).setCellValue(goodsExportDTO.getGoodsName());
+            row.createCell(1).setCellValue(goodsExportDTO.getId());
+            row.createCell(2).setCellValue(goodsExportDTO.getPrice());
+            if ("RETAIL".equals(goodsExportDTO.getSalesModel())) {
+                row.createCell(3).setCellValue("闆跺敭");
+            } else if ("WHOLESALE".equals(goodsExportDTO.getSalesModel())) {
+                row.createCell(3).setCellValue("鎵瑰彂");
+            } else if ("PRESALE".equals(goodsExportDTO.getSalesModel())) {
+                row.createCell(3).setCellValue("棰勫敭");
+            } else {
+                row.createCell(3).setCellValue("鍏朵粬绫诲瀷");
+            }
+
+            if ("PHYSICAL_GOODS".equals(goodsExportDTO.getGoodsType())) {
+                row.createCell(4).setCellValue("瀹炵墿鍟嗗搧");
+            } else if ("VIRTUAL_GOODS".equals(goodsExportDTO.getGoodsType())) {
+                row.createCell(4).setCellValue("铏氭嫙鍟嗗搧");
+            } else {
+                row.createCell(4).setCellValue("鐢靛瓙鍗″埜");
+            }
+
+            if ("DOWN".equals(goodsExportDTO.getMarketEnable())) {
+                row.createCell(5).setCellValue("涓嬫灦");
+            } else if ("UPPER".equals(goodsExportDTO.getMarketEnable())) {
+                row.createCell(5).setCellValue("涓婃灦");
+            }
+
+            if ("TOBEAUDITED".equals(goodsExportDTO.getAuthFlag())) {
+                row.createCell(6).setCellValue("寰呭鏍�");
+            } else if ("PASS".equals(goodsExportDTO.getAuthFlag())) {
+                row.createCell(6).setCellValue("閫氳繃");
+            } else if ("REFUSE".equals(goodsExportDTO.getAuthFlag())) {
+                row.createCell(6).setCellValue("鎷掔粷");
+            }
+            row.createCell(7).setCellValue(goodsExportDTO.getStoreName());
+
+        }
+        return workbook;
+    }
     /**
      * 鍟嗗搧鏌ヨ
-     *
+     *g
      * @param goodsSearchParams 鏌ヨ鍙傛暟
      * @return 鍟嗗搧淇℃伅
      */
@@ -587,6 +673,7 @@
         this.baseMapper.addGoodsCommentNum(commentNum, goodsId);
     }
 
+
     /**
      * 鏇存柊鍟嗗搧鐘舵��
      *
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java b/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java
index e3afa30..a0e6867 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java
@@ -48,4 +48,6 @@
      * @return
      */
     Result getByGoodsId(String goodsId);
+
+    Result addOrUpdateTag(GoodsTagForm form);
 }
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java
index e70fb07..783940d 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java
@@ -12,11 +12,13 @@
 import cn.lili.utils.PageUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
 
 import java.util.List;
 import java.util.stream.Collectors;
@@ -62,9 +64,21 @@
     public Result getByGoodsId(String goodsId) {
         LambdaQueryWrapper<GoodsTag> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(GoodsTag::getGoodsId, goodsId);
+        queryWrapper.eq(GoodsTag::getDeleteFlag,Boolean.FALSE);
         return Result.ok().data(baseMapper.selectList(queryWrapper));
     }
 
+    @Override
+    public Result addOrUpdateTag(GoodsTagForm form) {
+        //宸叉湁鏍囩
+        //鍒犻櫎宸叉湁鐨勬爣绛炬彃鍏ユ渶鏂扮殑鏍囩
+        baseMapper.delete(new LambdaQueryWrapper<GoodsTag>().eq(GoodsTag::getGoodsId, form.getGoodsId()));
+        if (!CollectionUtils.isEmpty(form.getTagIds())){
+            this.addGoodsTag(form);
+        }
+        return Result.ok("缂栬緫鎴愬姛");
+    }
+
 
     @Override
     public Result addGoodsTag(GoodsTagForm form) {
diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/CouponExportDetailDTO.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/CouponExportDetailDTO.java
new file mode 100644
index 0000000..0e11133
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/CouponExportDetailDTO.java
@@ -0,0 +1,77 @@
+package cn.lili.modules.order.order.entity.dto;
+
+
+import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum;
+import cn.lili.modules.promotion.entity.enums.PromotionsScopeTypeEnum;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.data.elasticsearch.annotations.DateFormat;
+import org.springframework.data.elasticsearch.annotations.Field;
+import org.springframework.data.elasticsearch.annotations.FieldType;
+
+import java.util.Date;
+
+/**
+ * lmk-shop-java
+ *
+ * @author : zxl
+ * @date : 2025-08-07 17:42
+ **/
+@Data
+public class CouponExportDetailDTO {
+    @ApiModelProperty(value = "浼氬憳鍚嶇О")
+    private String memberName;
+
+    @ApiModelProperty(value = "浼樻儬鍒稿悕绉�")
+    private String couponName;
+
+    @ApiModelProperty(value = "鍟嗗鍚嶇О锛屽鏋滄槸骞冲彴锛岃繖涓�间负 platform")
+    private String storeName;
+
+
+    @ApiModelProperty(value = "闈㈤")
+    private Double price;
+
+    @ApiModelProperty(value = "鎶樻墸")
+    private Double discount;
+
+    @ApiModelProperty(value = "娑堣垂闂ㄦ")
+    private Double consumeThreshold;
+
+    /**
+     * @see cn.lili.modules.promotion.entity.enums.CouponGetEnum
+     */
+    @ApiModelProperty(value = "浼樻儬鍒哥被鍨嬶紝鍒嗕负鍏嶈垂棰嗗彇鍜屾椿鍔ㄨ禒閫�")
+    private String getType;
+
+    /**
+     * @see MemberCouponStatusEnum
+     */
+    @ApiModelProperty(value = "浼氬憳浼樻儬鍒哥姸鎬�")
+    private String memberCouponStatus;
+    /**
+     * POINT("鎵撴姌"), PRICE("鍑忓厤鐜伴噾");
+     *
+     * @see cn.lili.modules.promotion.entity.enums.CouponTypeEnum
+     */
+    @ApiModelProperty(value = "浼樻儬鍗风被鍨�")
+    private String couponType;
+
+    /**
+     * @see PromotionsScopeTypeEnum
+     */
+    @ApiModelProperty(value = "鍏宠仈鑼冨洿绫诲瀷")
+    private String scopeType;
+
+    @ApiModelProperty(value = "浣跨敤璧峰鏃堕棿")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
+    private Date startTime;
+
+    @ApiModelProperty(value = "浣跨敤鎴鏃堕棿")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
+    private Date endTime;
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java
index 5c2b8ff..b41cddb 100644
--- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java
@@ -183,8 +183,6 @@
     private COSUtil cosUtil;
     @Autowired
     private AdminUserService adminUserService;
-    @Autowired
-    private RoleService roleService;
 
 
     @Override
diff --git a/framework/src/main/java/cn/lili/modules/promotion/mapper/MemberCouponMapper.java b/framework/src/main/java/cn/lili/modules/promotion/mapper/MemberCouponMapper.java
index fab2453..eeae4b5 100644
--- a/framework/src/main/java/cn/lili/modules/promotion/mapper/MemberCouponMapper.java
+++ b/framework/src/main/java/cn/lili/modules/promotion/mapper/MemberCouponMapper.java
@@ -9,6 +9,8 @@
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
+import java.util.List;
+
 /**
  * 浼氬憳浼樻儬鍒告暟鎹鐞嗗眰
  *
@@ -20,4 +22,7 @@
     @Select("SELECT mc.*,c.coupon_name FROM li_member_coupon mc LEFT JOIN li_coupon c ON mc.coupon_id = c.id ${ew.customSqlSegment}")
     Page<MemberCouponVO> getMemberCoupons(Page<MemberCoupon> page, @Param(Constants.WRAPPER) Wrapper<MemberCouponVO> queryWrapper);
 
+    @Select("SELECT mc.*,c.coupon_name FROM li_member_coupon mc LEFT JOIN li_coupon c ON mc.coupon_id = c.id ${ew.customSqlSegment}")
+    List<MemberCouponVO> getMemberCouponsExport( @Param(Constants.WRAPPER) Wrapper<MemberCouponVO> queryWrapper);
+
 }
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/promotion/service/MemberCouponService.java b/framework/src/main/java/cn/lili/modules/promotion/service/MemberCouponService.java
index b807a08..055e323 100644
--- a/framework/src/main/java/cn/lili/modules/promotion/service/MemberCouponService.java
+++ b/framework/src/main/java/cn/lili/modules/promotion/service/MemberCouponService.java
@@ -8,6 +8,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -165,6 +166,8 @@
      */
     Page<MemberCouponVO> getMemberCouponsPage(Page<MemberCoupon> page, MemberCouponSearchParams param);
 
+    void queryExportCoupon(HttpServletResponse response, MemberCouponSearchParams searchParams);
+
     /**
      * 鑾峰彇浼氬憳棰嗗彇杩囩殑浼樻儬鍒告暟閲�
      */
diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java
index b4d643a..73325fb 100644
--- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java
@@ -1,5 +1,7 @@
 package cn.lili.modules.promotion.serviceimpl;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.text.CharSequenceUtil;
 import cn.lili.cache.Cache;
 import cn.lili.common.enums.ResultCode;
@@ -7,6 +9,11 @@
 import cn.lili.common.security.AuthUser;
 import cn.lili.common.security.context.UserContext;
 import cn.lili.common.vo.PageVO;
+import cn.lili.modules.lmk.enums.general.AdminRoleEnum;
+import cn.lili.modules.order.order.entity.dto.CouponExportDetailDTO;
+import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
+import cn.lili.modules.order.order.entity.dto.OrderExportDetailDTO;
+import cn.lili.modules.permission.service.AdminUserService;
 import cn.lili.modules.promotion.entity.dos.Coupon;
 import cn.lili.modules.promotion.entity.dos.MemberCoupon;
 import cn.lili.modules.promotion.entity.dto.search.MemberCouponSearchParams;
@@ -20,6 +27,7 @@
 import cn.lili.modules.promotion.service.MemberCouponService;
 import cn.lili.modules.promotion.tools.PromotionTools;
 import cn.lili.mybatis.util.PageUtil;
+import cn.lili.utils.CommonUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -27,6 +35,10 @@
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheConfig;
 import org.springframework.cache.annotation.CacheEvict;
@@ -34,6 +46,9 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
 import java.util.*;
 
 /**
@@ -52,6 +67,8 @@
     @Autowired
     private CouponService couponService;
 
+    @Autowired
+    private AdminUserService adminUserService;
     /**
      * 缂撳瓨
      */
@@ -306,6 +323,26 @@
         this.update(updateWrapper);
     }
 
+    public List<MemberCouponVO> getMemberCouponsPageExport(MemberCouponSearchParams param){
+        QueryWrapper<MemberCouponVO> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getMemberId()), "mc.member_id", param.getMemberId());
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getStoreId()), "c.store_id", param.getStoreId());
+        queryWrapper.like(CharSequenceUtil.isNotEmpty(param.getMemberName()), "mc.member_name", param.getMemberName());
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getCouponId()), "mc.coupon_id", param.getCouponId());
+        queryWrapper.like(CharSequenceUtil.isNotEmpty(param.getCouponName()), "c.coupon_name", param.getCouponName());
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getGetType()), "mc.get_type", param.getGetType());
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getScopeType()), "mc.scope_type", param.getPromotionStatus());
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getCouponType()), "mc.coupon_type", param.getCouponType());
+        queryWrapper.eq(CharSequenceUtil.isNotEmpty(param.getMemberCouponStatus()), "mc.member_coupon_status", param.getMemberCouponStatus());
+        if (param.getStartTime() != null) {
+            queryWrapper.ge("mc.start_time", new Date(param.getStartTime()));
+        }
+        if (param.getEndTime() != null) {
+            queryWrapper.le("mc.end_time", new Date(param.getEndTime()));
+        }
+        return this.baseMapper.getMemberCouponsExport(queryWrapper);
+    }
+
     @Override
     public Page<MemberCouponVO> getMemberCouponsPage(Page<MemberCoupon> page, MemberCouponSearchParams param) {
         QueryWrapper<MemberCouponVO> queryWrapper = new QueryWrapper<>();
@@ -326,7 +363,107 @@
         }
         return this.baseMapper.getMemberCoupons(page, queryWrapper);
     }
+    @Override
+    public void queryExportCoupon(HttpServletResponse response, MemberCouponSearchParams searchParams) {
 
+        List<MemberCouponVO> records = this.getMemberCouponsPageExport(searchParams);
+        XSSFWorkbook workbook = initCouponExportData(records);
+        try {
+            // 璁剧疆鍝嶅簲澶�
+            String fileName = URLEncoder.encode("浼樻儬鍒搁鍙栬褰�", "UTF-8");
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+
+            ServletOutputStream out = response.getOutputStream();
+            workbook.write(out);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                workbook.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private XSSFWorkbook initCouponExportData(List<MemberCouponVO> list){
+        List<CouponExportDetailDTO> couponExportDetailDTOS = new ArrayList<>();
+        for (MemberCoupon memberCoupon : list){
+            CouponExportDetailDTO dto = new CouponExportDetailDTO();
+            BeanUtil.copyProperties(memberCoupon, dto);
+            couponExportDetailDTOS.add(dto);
+        }
+        System.out.println("-----------------------");
+        System.out.println(couponExportDetailDTOS);
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        Sheet sheet = workbook.createSheet("浼樻儬鍒搁鍙栬褰�");
+        Row header = sheet.createRow(0);
+        String[] headers = {"浼氬憳鍚嶇О","浼樻儬鍒稿悕绉�","鍙戝竷搴楅摵","闈㈤/鎶樻墸","浣跨敤闂ㄦ","鑾峰彇鏂瑰紡"
+        ,"浼氬憳浼樻儬鍒哥姸鎬�","浼樻儬鍒哥被鍨�","鍝佺被鎻忚堪","浣跨敤璧峰鏃堕棿","鎴鏃堕棿"};
+        for(int i= 0 ;i< headers.length;i++){
+            Cell cell = header.createCell(i);
+            cell.setCellValue(headers[i]);
+        }
+        //濉厖鏁版嵁
+        for (int i =0 ;i< couponExportDetailDTOS.size();i++){
+            CouponExportDetailDTO dto = couponExportDetailDTOS.get(i);
+            Row row = sheet.createRow(i+1);
+            row.createCell(0).setCellValue(dto.getMemberName());
+            row.createCell(1).setCellValue(dto.getCouponName());
+            if ("platform".equals(dto.getStoreName())){
+                row.createCell(2).setCellValue("骞冲彴");
+            }else {
+                row.createCell(2).setCellValue(dto.getStoreName());
+            }
+            if (dto.getDiscount() != null){
+                row.createCell(3).setCellValue(dto.getDiscount()+"鎶�");
+            }
+            if (dto.getPrice()!=null){
+                row.createCell(3).setCellValue(dto.getPrice()+"锟�");
+            }
+            row.createCell(4).setCellValue(dto.getConsumeThreshold());
+            if("FREE".equals(dto.getGetType())){
+                row.createCell(5).setCellValue("鍏嶈垂鑾峰彇");
+            }else if("ACTIVITY".equals(dto.getGetType())){
+                row.createCell(5).setCellValue("娲诲姩鑾峰彇");
+            }else if("lime".equals(dto.getGetType())){
+                row.createCell(5).setCellValue("鍐呰喘");
+            }else if("purple".equals(dto.getGetType())){
+                row.createCell(5).setCellValue("鏈煡");
+            }
+
+            if("NEW".equals(dto.getMemberCouponStatus())){
+                row.createCell(6).setCellValue("宸查鍙�");
+            }else if("USED".equals(dto.getMemberCouponStatus())){
+                row.createCell(6).setCellValue("宸蹭娇鐢�");
+            }else if("EXPIRE".equals(dto.getMemberCouponStatus())){
+                row.createCell(6).setCellValue("宸茶繃鏈�");
+            }else if("CLOSED".equals(dto.getMemberCouponStatus())){
+                row.createCell(6).setCellValue("宸蹭綔搴�");
+            }
+            if("DISCOUNT".equals(dto.getCouponType())){
+                row.createCell(7).setCellValue("鎵撴姌");
+            }else if("PRICE".equals(dto.getCouponType())){
+                row.createCell(7).setCellValue("鍑忓厤鐜伴噾");
+            }else{
+                row.createCell(7).setCellValue("鏈煡");
+            }
+            if ("ALL".equals(dto.getScopeType())) {
+                row.createCell(8).setCellValue("鍏ㄥ搧绫�");
+            }else if ("PORTION_GOODS_CATEGORY".equals(dto.getScopeType())) {
+                row.createCell(8).setCellValue("鍟嗗搧鍒嗙被");
+            } else if ("PORTION_SHOP_CATEGORY".equals(dto.getScopeType())) {
+                row.createCell(8).setCellValue("搴楅摵鍒嗙被");
+            } else if ("PORTION_GOODS".equals(dto.getScopeType())) {
+                row.createCell(8).setCellValue("鎸囧畾鍟嗗搧");
+            }
+
+            row.createCell(9).setCellValue(DateUtil.formatDateTime(dto.getStartTime()));
+            row.createCell(10).setCellValue(DateUtil.formatDateTime(dto.getEndTime()));
+        }
+        return workbook;
+    }
     @Override
     public long getMemberCouponNum(String memberId, String couponId) {
         LambdaQueryWrapper<MemberCoupon> queryWrapper = new LambdaQueryWrapper<>();
@@ -335,6 +472,8 @@
         return this.count(queryWrapper);
     }
 
+
+
     /**
      * 娓呴櫎鏃犳晥鐨勪細鍛樹紭鎯犲埜
      *
diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java
index d73f452..572443a 100644
--- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java
+++ b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java
@@ -2,6 +2,7 @@
 
 import cn.lili.common.aop.annotation.DemoSite;
 import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
+import cn.lili.common.context.ThreadContextHolder;
 import cn.lili.common.enums.ResultCode;
 import cn.lili.common.enums.ResultUtil;
 import cn.lili.common.exception.ServiceException;
@@ -17,6 +18,7 @@
 import cn.lili.modules.goods.entity.vos.GoodsVO;
 import cn.lili.modules.goods.service.GoodsService;
 import cn.lili.modules.goods.service.GoodsSkuService;
+import cn.lili.modules.promotion.entity.dto.search.MemberCouponSearchParams;
 import cn.lili.utils.COSUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.Api;
@@ -26,6 +28,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import javax.validation.constraints.NotEmpty;
 import java.util.Arrays;
@@ -69,6 +72,12 @@
         return ResultUtil.data(goodsService.queryByParams(goodsSearchParams));
     }
 
+    @ApiOperation(value = "鏌ヨ鍟嗗搧娓呭崟瀵煎嚭瀵煎嚭鍒楄〃")
+    @GetMapping("/queryExportGoods")
+    public void queryExportGoods(GoodsSearchParams searchParams) {
+        HttpServletResponse response = ThreadContextHolder.getHttpResponse();
+        goodsService.queryExportGoods(response,searchParams);}
+
     @ApiOperation(value = "鍒嗛〉鑾峰彇鍟嗗搧鍒楄〃")
     @GetMapping(value = "/sku/list")
     public ResultMessage<IPage<GoodsSku>> getSkuByPage(GoodsSearchParams goodsSearchParams) {
diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/GoodsTagController.java b/manager-api/src/main/java/cn/lili/controller/lmk/GoodsTagController.java
new file mode 100644
index 0000000..7c7f38d
--- /dev/null
+++ b/manager-api/src/main/java/cn/lili/controller/lmk/GoodsTagController.java
@@ -0,0 +1,35 @@
+package cn.lili.controller.lmk;
+
+
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.form.GoodsTagForm;
+import cn.lili.modules.lmk.service.GoodsTagService;
+import io.swagger.annotations.Api;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * lmk-shop-java
+ *
+ * @author : zxl
+ * @date : 2025-08-08 15:04
+ **/
+@Validated
+@RequiredArgsConstructor
+@Api(value = "鍟嗗搧鏍囩", tags = "鍟嗗搧鏍囩")
+@RestController
+@RequestMapping("/manager/lmk/goodsTag")
+public class GoodsTagController {
+
+    private final GoodsTagService goodsTagService;
+
+    @PostMapping("addOrUpdate")
+    public Result addOrUpDateTag(@RequestBody GoodsTagForm form){
+        return goodsTagService.addOrUpdateTag(form);
+    }
+    @GetMapping("/getGoods/{id}")
+    public Result getGoodSTagById(@PathVariable("id") String goodsId){
+        return goodsTagService.getByGoodsId(goodsId);
+    }
+}
diff --git a/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java b/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java
index 5c2b748..9c2c386 100644
--- a/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java
+++ b/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java
@@ -1,5 +1,6 @@
 package cn.lili.controller.promotion;
 
+import cn.lili.common.context.ThreadContextHolder;
 import cn.lili.common.enums.ResultCode;
 import cn.lili.common.enums.ResultUtil;
 import cn.lili.common.exception.ServiceException;
@@ -24,6 +25,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
@@ -121,6 +123,12 @@
         return ResultUtil.data(result);
     }
 
+    @ApiOperation(value = "鏌ヨ浼樻儬鍗峰鍑哄垪琛�")
+    @GetMapping("/queryExportCoupon")
+    public void queryExportCoupon(MemberCouponSearchParams searchParams) {
+        HttpServletResponse response = ThreadContextHolder.getHttpResponse();
+        memberCouponService.queryExportCoupon(response,searchParams);}
+
     private void setStoreInfo(CouponVO couponVO) {
         AuthUser currentUser = UserContext.getCurrentUser();
         if (currentUser == null) {

--
Gitblit v1.8.0