Przeglądaj źródła

提现申请导出

cup 2 lat temu
rodzic
commit
c634e46228

+ 67 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/ChannelWithdrawMgrController.java

@@ -3,6 +3,10 @@ package com.qs.mp.web.controller.api.admin;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.qs.mp.admin.domain.excel.ChannelWithdrawExcel;
+import com.qs.mp.admin.domain.excel.UserTicketOrderItemExcel;
+import com.qs.mp.admin.domain.param.ChannelWithdrawQueryParam;
 import com.qs.mp.channel.domain.ChannelOrder;
 import com.qs.mp.channel.domain.ChannelOrderItem;
 import com.qs.mp.channel.domain.ChannelWithdraw;
@@ -19,11 +23,18 @@ import com.qs.mp.common.enums.BusinessType;
 import com.qs.mp.common.enums.ChannelWithdrawStatusEnum;
 import com.qs.mp.common.enums.ErrorCodeEnum;
 import com.qs.mp.common.utils.DateUtils;
+import com.qs.mp.utils.ExcelUtil;
 import com.qs.mp.web.controller.common.BaseApiController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
+
 import lombok.AllArgsConstructor;
 import ma.glasnost.orika.MapperFacade;
 import org.apache.commons.lang3.StringUtils;
@@ -104,4 +115,60 @@ public class ChannelWithdrawMgrController extends BaseApiController {
     return AjaxResult.success("操作成功");
   }
 
+
+  @PostMapping("/export")
+  @ApiOperation("提现申请导出")
+  @PreAuthorize("@ss.hasPermi('finance:withdraw:export')")
+  public AjaxResult export(@RequestBody ChannelWithdrawQueryParam param) {
+
+    // 导出时间范围限制校验
+    Date startTime = param.getStartDay();
+    Date endTime = param.getEndDay();
+    if (startTime == null || endTime == null) {
+      return AjaxResult.error("导出数据必须设置日期范围");
+    }
+    if (DateUtils.diff(startTime, endTime) > 30) {
+      return AjaxResult.error("导出的数据不能超过31天");
+    }
+
+    List<ChannelWithdrawVO> withdrawList = channelWithdrawService.listWithdrawVO(new QueryWrapper<ChannelWithdraw>()
+            .eq(null != param.getStatus() && param.getStatus() != 0, "t1.status", param.getStatus())
+            .like(StringUtils.isNotBlank(param.getName()), "t2.name", param.getName())
+            .ge(null != param.getStartDay(), "t1.create_time", param.getStartDay())
+            .lt(null != param.getEndDay(), "t1.create_time", param.getEndDay())
+            .orderByDesc("t1.create_time"));
+
+    if (CollectionUtils.isEmpty(withdrawList)) {
+      return error("没有符合条件的记录");
+    }
+
+    List<ChannelWithdrawExcel> channelWithdrawExcelList = new ArrayList<>();
+    for (ChannelWithdrawVO channelWithdrawVO : withdrawList) {
+      ChannelWithdrawExcel channelWithdrawExcel = new ChannelWithdrawExcel();
+        channelWithdrawExcel.setCreateTime(channelWithdrawVO.getCreateTime());
+        channelWithdrawExcel.setTransferTime(channelWithdrawVO.getTransferTime());
+        channelWithdrawExcel.setName(channelWithdrawVO.getName());
+        channelWithdrawExcel.setMobile(channelWithdrawVO.getMobile());
+        Integer money = channelWithdrawVO.getMoney();
+        if (Objects.isNull(money)) {
+          money = 0;
+        }
+        channelWithdrawExcel.setMoney(BigDecimal.valueOf(money).divide(BigDecimal.valueOf(100),2 ,RoundingMode.HALF_UP));
+        if (Objects.nonNull(channelWithdrawVO.getLevel())) {
+          if (channelWithdrawVO.getLevel() == 0) {
+            channelWithdrawExcel.setLevel("经销商");
+          } else {
+            channelWithdrawExcel.setLevel("渠道商");
+          }
+        }
+      if (Objects.nonNull(channelWithdrawVO.getStatus())) {
+        channelWithdrawExcel.setStatus(channelWithdrawVO.getStatus().getDesc());
+      }
+      channelWithdrawExcelList.add(channelWithdrawExcel);
+    }
+    ExcelUtil<ChannelWithdrawExcel> util = new ExcelUtil<>(ChannelWithdrawExcel.class);
+    return util.exportExcel(channelWithdrawExcelList, "提现申请导出", false);
+  }
+
+
 }

+ 51 - 0
mp-service/src/main/java/com/qs/mp/admin/domain/excel/ChannelWithdrawExcel.java

@@ -0,0 +1,51 @@
+package com.qs.mp.admin.domain.excel;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.qs.mp.common.annotation.Excel;
+import com.qs.mp.common.enums.ChannelWithdrawStatusEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 提现记录导出
+ * @author Cup
+ * @date 2022/6/13
+ */
+@ApiModel(value = "提现记录导出")
+@Data
+public class ChannelWithdrawExcel {
+
+    @Excel(name = "申请时间")
+    private Date createTime;
+
+    @Excel(name = "处理时间")
+    private Date transferTime;
+
+    @Excel(name = "渠道名称")
+    private String name;
+
+
+    @Excel(name = "渠道手机号码")
+    private String mobile;
+
+    /**
+     * 渠道级别,0:经销商;1:一级渠道;2:二级渠道
+     */
+    @Excel(name = "渠道类型")
+    private String level;
+
+
+    @Excel(name = "提现金额")
+    private BigDecimal money;
+
+
+    @Excel(name = "提现状态")
+    private String status;
+
+}

+ 30 - 0
mp-service/src/main/java/com/qs/mp/admin/domain/param/ChannelWithdrawQueryParam.java

@@ -0,0 +1,30 @@
+package com.qs.mp.admin.domain.param;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author Cup
+ * @date 2022/6/13
+ */
+@ApiModel(value = "提现记录查询入参类")
+@Data
+public class ChannelWithdrawQueryParam {
+
+    @ApiModelProperty("提现状态 1申请,2审核通过,3审核拒绝")
+    private Integer status;
+
+    @ApiModelProperty("渠道/经销商名称")
+    private String name;
+
+    @ApiModelProperty("开始时间")
+    private Date startDay;
+
+    @ApiModelProperty("结束时间")
+    private Date endDay;
+
+
+}

+ 21 - 0
mp-service/src/main/java/com/qs/mp/channel/domain/ChannelWithdraw.java

@@ -9,6 +9,9 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.qs.mp.common.enums.ChannelWithdrawStatusEnum;
 import java.io.Serializable;
 import java.util.Date;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -18,70 +21,82 @@ import lombok.Data;
  */
 @TableName("mp_channel_withdraw")
 @Data
+@ApiModel("渠道提现表实体类")
 public class ChannelWithdraw implements Serializable {
 
   private static final long serialVersionUID = 1L;
 
   @TableId(value = "id" , type = IdType.AUTO)
+  @ApiModelProperty("id")
   private Long id;
 
   /**
    * 渠道id
    */
+  @ApiModelProperty("渠道ID")
   @TableField("channel_id")
   private Long channelId;
 
   /**
    * 提现金额
    */
+  @ApiModelProperty("提现金额")
   @TableField("money")
   private Integer money;
 
   /**
    * 手续费
    */
+  @ApiModelProperty("手续费")
   @TableField("charge_amt")
   private Integer chargeAmt;
 
   /**
    * 当前可用资金
    */
+  @ApiModelProperty("当前可用资金")
   @TableField("available_money")
   private Integer availableMoney;
 
   /**
    * 支付类型 1支付宝,2微信,3银行卡
    */
+  @ApiModelProperty("支付类型 1支付宝,2微信,3银行卡")
   @TableField("pay_type")
   private String payType;
 
   /**
    * 持卡人
    */
+  @ApiModelProperty("持卡人")
   @TableField("user_name")
   private String userName;
 
   /**
    * 卡号
    */
+  @ApiModelProperty("卡号")
   @TableField("card_no")
   private String cardNo;
 
   /**
    * 银行卡所属银行
    */
+  @ApiModelProperty("银行卡所属银行")
   @TableField("bank_name")
   private String bankName;
 
   /**
    * 开户行
    */
+  @ApiModelProperty("开户行")
   @TableField("branch_name")
   private String branchName;
 
   /**
    * 提现状态 1申请,2审核通过,3审核拒绝
    */
+  @ApiModelProperty("提现状态 1申请,2审核通过,3审核拒绝")
   @TableField("status")
   @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
   private ChannelWithdrawStatusEnum status;
@@ -89,36 +104,42 @@ public class ChannelWithdraw implements Serializable {
   /**
    * 转账凭证
    */
+  @ApiModelProperty("转装凭证")
   @TableField("transfer_img")
   private String transferImg;
 
   /**
    * 转账时间
    */
+  @ApiModelProperty("转账时间")
   @TableField("transfer_time")
   private Date transferTime;
 
   /**
    * 审核内容备注
    */
+  @ApiModelProperty("审核内容备注")
   @TableField("verify_content")
   private String verifyContent;
 
   /**
    * 审核人用户名
    */
+  @ApiModelProperty("审核人用户名")
   @TableField("verifier")
   private String verifier;
 
   /**
    * 创建时间
    */
+  @ApiModelProperty("创建时间")
   @TableField("create_time")
   private Date createTime;
 
   /**
    * 修改时间
    */
+  @ApiModelProperty("修改时间")
   @TableField("update_time")
   private Date updateTime;
 

+ 6 - 0
mp-service/src/main/java/com/qs/mp/channel/domain/vo/ChannelWithdrawVO.java

@@ -2,26 +2,32 @@ package com.qs.mp.channel.domain.vo;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.qs.mp.channel.domain.ChannelWithdraw;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
  * @author zhongcp
  * @Date 2022/3/21
  */
+@ApiModel("提现记录相关出参类")
 @Data
 public class ChannelWithdrawVO extends ChannelWithdraw {
   /**
    * 渠道名称
    */
+  @ApiModelProperty("渠道名称")
   private String name;
 
   /**
    * 渠道级别,0:经销商;1:一级渠道;2:二级渠道
    */
+  @ApiModelProperty("渠道级别,0:经销商;1:一级渠道;2:二级渠道")
   private Integer level;
 
   /**
    * 手机号
    */
+  @ApiModelProperty("手机号")
   private String mobile;
 }