|
@@ -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);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|