瀏覽代碼

导出代充账号

zoujiajian 10 月之前
父節點
當前提交
a4423faeca

+ 169 - 0
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelRechargeAccountData.java

@@ -0,0 +1,169 @@
+package com.cyksj.model.excel;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.cyksj.model.entity.GoodsDon;
+import com.cyksj.model.entity.GroupsRelation;
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.DbIgnore;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj11111111
+ * 文件名: ExcelRechargeAccountData
+ * 创建者: JavaZou
+ * 创建时间:2025/10/9 15:23
+ */
+@Getter
+@Setter
+@ExcelIgnoreUnannotated
+@SearchBean(tables = "groups_relation gr left join groups_trips gt on gt.id = gr.groups_id" +
+		" left join goods_don_sku gdk on gdk.id = gt.sku_id " +
+		" left join goods_don g on g.id = gdk.goods_id" +
+		" left join user u on u.id = gr.user_id",
+		where = ":errorInfo:")
+public class ExcelRechargeAccountData {
+
+	@DbField("select order_no from order_don o where o.user_id = gr.user_id and o.relation_id = gr.id and o.status not in ('noPayment','close','refund') order by o.id desc limit 1")
+	@ExcelProperty("订单号")
+	private String orderNo;
+
+	@DbField("gr.id")
+	private Long relationId;
+
+	@DbField("gr.user_id")
+	@ExcelProperty("用户ID")
+	private Long userId;
+
+	@DbField("u.nickname")
+	@ExcelProperty("用户名")
+	private String nickname;
+
+	@DbField("gr.status")
+	private GroupsRelation.Status status;
+
+	@DbField("gr.account")
+	@ExcelProperty("账号")
+	private String account;
+
+	@DbField("gr.password")
+	@ExcelProperty("密码")
+	private String password;
+
+	/**
+	 * 联系方式
+	 */
+	@DbField("gr.contact")
+	@ExcelProperty("联系方式")
+	private String contact;
+
+	/**
+	 * 备用验证码
+	 */
+	@DbField("gr.bp_verify_code")
+	@ExcelProperty("备用验证码")
+	private String bpVerifyCode;
+
+	@DbField("g.id")
+	private Long goodsId;
+
+	@DbField("g.title")
+	@ExcelProperty("平台")
+	private String title;
+
+	@DbField("gdk.id")
+	private Long skuId;
+
+	@DbField("gdk.spec_val")
+	@ExcelProperty("规格")
+	private String specVal;
+
+	/**
+	 * 代充剩余次数
+	 */
+	@DbField("gr.recharge_remain_num")
+	@ExcelProperty("代充剩余次数")
+	private Integer rechargeRemainNum;
+
+	@DbField("gr.submit_time")
+	@ExcelProperty("提交时间")
+	private Date submitTime;
+
+	@DbField("gr.send_time")
+	@ExcelProperty("发货时间")
+	private Date sendTime;
+
+	@DbField("gr.expiry_time")
+	@ExcelProperty("到期时间")
+	private Date expiryTime;
+
+	@DbField("gr.recharge_status")
+	private GroupsRelation.RechargeStatus rechargeStatus;
+
+	@DbIgnore
+	@ExcelProperty("状态")
+	private String rechargeStatusStr;
+
+	@DbField("gr.recharge_error_info")
+	@ExcelProperty("失败原因")
+	private String rechargeErrorInfo;
+
+	/**
+	 * 代充备注
+	 */
+	@DbField("gr.recharge_remark")
+	@ExcelProperty("备注")
+	private String rechargeRemark;
+
+	@DbField("gr.operator")
+	@ExcelProperty("操作人")
+	private String operator;
+
+	/***
+	 * 代充次数
+	 */
+	@DbField("gr.recharge_num")
+	private Integer rechargeNum;
+
+	/**
+	 * 代充任务id
+	 */
+	@DbField("gr.gpt_task_id")
+	private String gptTaskId;
+
+	/**
+	 * 代充token
+	 */
+	@DbField("gr.gpt_token")
+	private String gptToken;
+
+	/**
+	 * 家庭组邀请链接
+	 */
+	@DbField("gr.invite_link")
+	private String inviteLink;
+
+	/**
+	 * 座位数
+	 */
+	@DbField("gdk.num")
+	private Integer skuNUm;
+
+	@DbField("g.special_type")
+	private GoodsDon.SpecialType specialType;
+
+	public String getRechargeStatusStr() {
+		return this.rechargeStatus.getDesc();
+	}
+
+	public String getRechargeErrorInfo() {
+		if (this.rechargeStatus == GroupsRelation.RechargeStatus.recharge_error) {
+			return rechargeErrorInfo;
+		}
+		return null;
+	}
+}

+ 39 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupRelationController.java

@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.annotation.Log;
 import com.cyksj.common.annotation.NoSubmit;
@@ -18,6 +19,7 @@ import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.*;
 import com.cyksj.mapper.manage.cms.CmsUserMapper;
 import com.cyksj.model.entity.*;
+import com.cyksj.model.excel.ExcelRechargeAccountData;
 import com.cyksj.model.manage.views.AccountView;
 import com.cyksj.model.manage.views.GroupsRelationBackView;
 import com.cyksj.model.request.*;
@@ -32,6 +34,7 @@ import com.cyksj.service.mange.gpt.GptRechargeService;
 import com.cyksj.service.relation.GroupRelationClearService;
 import com.cyksj.service.scheduler.SchedulerService;
 import com.cyksj.web.controller.recharge.req.ParseTokenRequest;
+import com.cyksj.web.util.EasyExcelUtils;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
@@ -45,6 +48,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.Date;
 import java.util.List;
 import java.util.Optional;
@@ -149,6 +153,41 @@ public class CmsGroupRelationController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }
 
+    /**
+     * 导出代充账号
+     */
+    @GetMapping("/export/recharge")
+    public void getRechargeList(String rechargeStatus, String orderNo, Boolean isVipError, HttpServletResponse response) {
+        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+        if (StrUtil.isEmpty(rechargeStatus)) {
+            builder.field(ExcelRechargeAccountData::getRechargeStatus).op(Operator.NotNull);
+        }
+        if (StrUtil.isNotBlank(orderNo)) {
+            OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
+                    .eq(OrderDon::getOrderNo, orderNo)
+                    .last("limit 1"));
+            Long relationId = 0l;
+            if (orderDon != null) {
+                relationId = orderDon.getRelationId();
+                builder.field(ExcelRechargeAccountData::getUserId, orderDon.getUserId());
+            }
+            builder.field(ExcelRechargeAccountData::getRelationId, relationId);
+        }
+        if (isVipError != null) {
+            builder.field(ExcelRechargeAccountData::getRechargeStatus, GroupsRelation.RechargeStatus.recharge_error.name());
+            if (isVipError) {
+                builder.field(ExcelRechargeAccountData::getRechargeErrorInfo, "会员").op(Operator.Contain);
+            } else {
+                builder.put("errorInfo", "(gr.recharge_error_info is null or gr.recharge_error_info not like '%会员%')");
+            }
+        }
+        List<ExcelRechargeAccountData> list = beanSearcher.searchAll(ExcelRechargeAccountData.class, builder
+                .field(ExcelRechargeAccountData::getStatus, List.of(GroupsRelation.Status.validity.name(), GroupsRelation.Status.outside.name())).op(Operator.InList)
+                .orderBy(ExcelRechargeAccountData::getSubmitTime).desc()
+                .build());
+        EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelRechargeAccountData.class, list, "代充列表", "代充列表", ExcelTypeEnum.XLSX, null);
+    }
+
     /**
      * 代充账号 状态变更
      */