Browse Source

卡密商品导出已使用的卡密

Chris-zy 1 year ago
parent
commit
d7a4f7c1a3

+ 40 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/GoodsMgrController.java

@@ -8,6 +8,7 @@ import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
 import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
 import com.qs.mp.admin.domain.*;
 import com.qs.mp.admin.domain.excel.GoodsCardImportExcel;
+import com.qs.mp.admin.domain.excel.GoodsCardUsedExcel;
 import com.qs.mp.admin.domain.excel.GoodsExcel;
 import com.qs.mp.admin.domain.param.GoodsCardQueryParam;
 import com.qs.mp.admin.domain.param.GoodsParam;
@@ -33,6 +34,7 @@ import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 import ma.glasnost.orika.MapperFacade;
 import org.apache.commons.lang3.StringUtils;
+import org.aspectj.weaver.AjcMemberMaker;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -698,4 +700,42 @@ public class GoodsMgrController extends BaseApiController {
     }
 
 
+
+    /**
+     * 导出已使用卡密
+     * @param param
+     * @return
+     */
+    @PostMapping("/export/card/list")
+    @PreAuthorize("@ss.hasPermi('business:goods:export')")
+    @ApiOperation("导出已使用卡密")
+    @ApiResponses(
+            @ApiResponse(code = 200, message = "OK", response = GoodsCard.class)
+    )
+    public AjaxResult exportUserdCardList(@RequestBody GoodsCardQueryParam param) {
+        if (param.getGoodsId() == null || param.getGoodsId() == 0) {
+            return AjaxResult.error("商品id不正确");
+        }
+
+        List<GoodsCard> list = goodsCardService.list(new LambdaQueryWrapper<GoodsCard>()
+                .eq(GoodsCard::getGoodsId, param.getGoodsId())
+                .eq(GoodsCard::getIsUse, 1));
+
+        List<GoodsCardUsedExcel> goodsCardUsedExcels = new ArrayList<>();
+
+        for (GoodsCard GoodsCardUsed : list) {
+            GoodsCardUsedExcel goodsCardExcel = new GoodsCardUsedExcel();
+            BeanUtils.copyProperties(GoodsCardUsed, goodsCardExcel);
+
+            goodsCardUsedExcels.add(goodsCardExcel);
+        }
+
+        ExcelUtil<GoodsCardUsedExcel> util = new ExcelUtil<>(GoodsCardUsedExcel.class);
+        return util.exportExcel(goodsCardUsedExcels, "商品导出", false);
+
+    }
+
+
+
+
 }

+ 47 - 0
mp-service/src/main/java/com/qs/mp/admin/domain/excel/GoodsCardUsedExcel.java

@@ -0,0 +1,47 @@
+package com.qs.mp.admin.domain.excel;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.qs.mp.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商品已使用卡密导出类
+ * @author yang.zhao
+ */
+@ApiModel("商品卡密导出类")
+@Data
+public class GoodsCardUsedExcel {
+
+    @Excel(name = "主键")
+    private Long id;
+
+    @Excel(name = "商品id")
+    private Long goodsId;
+
+    @Excel(name = "卡号")
+    private String cardNo;
+
+    @Excel(name = "卡密")
+    private String cardPwd;
+
+    @Excel(name = "是否使用:0未使用,1已使用")
+    private Integer isUse;
+
+    @Excel(name = "逻辑删除标识")
+    private Integer isDeleted;
+
+    @Excel(name = "创建时间")
+    private Date createdTime;
+
+    @Excel(name = "更新时间")
+    private Date updatedTime;
+
+}