修复导出类型转换异常
This commit is contained in:
@@ -10,9 +10,11 @@
|
||||
*/
|
||||
package com.accompany.business.service.flow;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.common.utils.StringUtils;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.service.common.JedisLockService;
|
||||
@@ -22,6 +24,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.xuanyin.flowteam.dto.FlowTeamSettlementDetail;
|
||||
import com.xuanyin.flowteam.dto.FlowTeamSettlementInfoExportDto;
|
||||
import com.xuanyin.flowteam.dto.FlowTeamSettlementInfoVo;
|
||||
import com.xuanyin.flowteam.mapper.FlowTeamSettlementInfoMapper;
|
||||
import com.xuanyin.flowteam.mapper.FlowTeamSettlementInfoMapperExpand;
|
||||
import com.xuanyin.flowteam.model.FlowTeamInfo;
|
||||
@@ -29,6 +32,7 @@ import com.xuanyin.flowteam.model.FlowTeamSettlementInfo;
|
||||
import com.xuanyin.flowteam.service.FlowTeamInfoService;
|
||||
import com.xuanyin.flowteam.service.FlowTeamSettlementInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -239,8 +243,31 @@ public class FlowTeamSettlementBizService {
|
||||
}
|
||||
|
||||
public void export(Long groupId, String teamId, ServletWebRequest servletWebRequest) {
|
||||
List<FlowTeamSettlementInfoExportDto> datas = flowTeamSettlementInfoMapperExpand.settlementExport(groupId, teamId);
|
||||
DateDateConverter dateDateConverter = new DateDateConverter();
|
||||
List<FlowTeamSettlementInfoVo> admins = flowTeamSettlementInfoMapperExpand.settlementExport(groupId, teamId);
|
||||
List<FlowTeamSettlementInfoExportDto> datas = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(admins)) {
|
||||
for (FlowTeamSettlementInfoVo admin : admins) {
|
||||
FlowTeamSettlementInfoExportDto dto = new FlowTeamSettlementInfoExportDto();
|
||||
BeanUtils.copyProperties(admin, dto);
|
||||
Date signUpTime = admin.getSignUpTime();
|
||||
Date inviteTime = admin.getInviteTime();
|
||||
Date firstChargeTime = admin.getFirstChargeTime();
|
||||
Date firstGiveTime = admin.getFirstGiveTime();
|
||||
if (signUpTime != null) {
|
||||
dto.setSignUpTimeStr(DateTimeUtil.convertDate(signUpTime));
|
||||
}
|
||||
if (inviteTime != null) {
|
||||
dto.setInviteTimeStr(DateTimeUtil.convertDate(signUpTime));
|
||||
}
|
||||
if (firstChargeTime != null) {
|
||||
dto.setFirstChargeTimeStr(DateTimeUtil.convertDate(signUpTime));
|
||||
}
|
||||
if (firstGiveTime != null) {
|
||||
dto.setFirstGiveTimeStr(DateTimeUtil.convertDate(signUpTime));
|
||||
}
|
||||
datas.add(dto);
|
||||
}
|
||||
}
|
||||
if (servletWebRequest.getResponse() != null) {
|
||||
try {
|
||||
//这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
@@ -250,7 +277,6 @@ public class FlowTeamSettlementBizService {
|
||||
String fileName = URLEncoder.encode("邀请用户", "UTF-8").replaceAll("\\+", "%20");
|
||||
servletWebRequest.getResponse().setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
EasyExcel.write(servletWebRequest.getResponse().getOutputStream(), FlowTeamSettlementInfoExportDto.class)
|
||||
.registerConverter(dateDateConverter)
|
||||
.sheet("邀请用户")
|
||||
.doWrite(datas);
|
||||
} catch (Exception e) {
|
||||
|
@@ -1,11 +1,9 @@
|
||||
package com.xuanyin.flowteam.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.converters.date.DateDateConverter;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
@@ -24,20 +22,20 @@ public class FlowTeamSettlementInfoExportDto {
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
@ExcelProperty(value = "注册时间", converter = DateDateConverter.class)
|
||||
private Date signUpTime;
|
||||
@ExcelProperty("注册时间")
|
||||
private String signUpTimeStr;
|
||||
|
||||
/**
|
||||
* 被邀请时间
|
||||
*/
|
||||
@ExcelProperty(value = "被邀请时间", converter = DateDateConverter.class)
|
||||
private Date inviteTime;
|
||||
@ExcelProperty("被邀请时间")
|
||||
private String inviteTimeStr;
|
||||
|
||||
/**
|
||||
* 首充时间
|
||||
*/
|
||||
@ExcelProperty(value = "首充时间", converter = DateDateConverter.class)
|
||||
private Date firstChargeTime;
|
||||
@ExcelProperty("首充时间")
|
||||
private String firstChargeTimeStr;
|
||||
|
||||
/**
|
||||
* 从被邀请时间起算首次充值时间
|
||||
@@ -54,8 +52,8 @@ public class FlowTeamSettlementInfoExportDto {
|
||||
/**
|
||||
* 首次获得转赠钻石时间
|
||||
*/
|
||||
@ExcelProperty(value = "首次获得转赠钻石时间", converter = DateDateConverter.class)
|
||||
private Date firstGiveTime;
|
||||
@ExcelProperty("首次获得转赠钻石时间")
|
||||
private String firstGiveTimeStr;
|
||||
|
||||
/**
|
||||
* 首次获得转赠钻石金额
|
||||
|
@@ -0,0 +1,77 @@
|
||||
package com.xuanyin.flowteam.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/8/12 14:57
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class FlowTeamSettlementInfoVo {
|
||||
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty("ID")
|
||||
private String erBanNo;
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
@ApiModelProperty("注册时间")
|
||||
private Date signUpTime;
|
||||
|
||||
/**
|
||||
* 被邀请时间
|
||||
*/
|
||||
@ApiModelProperty("被邀请时间")
|
||||
private Date inviteTime;
|
||||
|
||||
/**
|
||||
* 首充时间
|
||||
*/
|
||||
@ApiModelProperty("首充时间")
|
||||
private Date firstChargeTime;
|
||||
|
||||
/**
|
||||
* 从被邀请时间起算首次充值时间
|
||||
*/
|
||||
@ApiModelProperty("从被邀请时间起算首次充值时间")
|
||||
private Integer diffTimeNum;
|
||||
|
||||
/**
|
||||
* 首次充值金额
|
||||
*/
|
||||
@ApiModelProperty("首次充值金额")
|
||||
private BigDecimal firstChargeAmount;
|
||||
|
||||
/**
|
||||
* 首次获得转赠钻石时间
|
||||
*/
|
||||
@ApiModelProperty("首次获得转赠钻石时间")
|
||||
private Date firstGiveTime;
|
||||
|
||||
/**
|
||||
* 首次获得转赠钻石金额
|
||||
*/
|
||||
@ApiModelProperty("首次获得转赠钻石金额")
|
||||
private BigDecimal diamondAmount;
|
||||
|
||||
/**
|
||||
* 从被邀请起截止到目前的充值
|
||||
*/
|
||||
@ApiModelProperty("从被邀请起截止到目前的充值")
|
||||
private BigDecimal totalChargeAmount;
|
||||
|
||||
/**
|
||||
* 从被邀请起截止到目前转赠的钻石流水
|
||||
*/
|
||||
@ApiModelProperty("从被邀请起截止到目前转赠的钻石流水")
|
||||
private BigDecimal totalDiamondAmount;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package com.xuanyin.flowteam.mapper;
|
||||
|
||||
import com.xuanyin.flowteam.dto.FlowTeamSettlementInfoExportDto;
|
||||
import com.xuanyin.flowteam.dto.FlowTeamSettlementInfoVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,5 +19,5 @@ public interface FlowTeamSettlementInfoMapperExpand {
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
List<FlowTeamSettlementInfoExportDto> settlementExport(@Param("groupId") Long groupId, @Param("teamId") String teamId);
|
||||
List<FlowTeamSettlementInfoVo> settlementExport(@Param("groupId") Long groupId, @Param("teamId") String teamId);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.xuanyin.flowteam.mapper.FlowTeamSettlementInfoMapperExpand">
|
||||
<select id="settlementExport" resultType="com.xuanyin.flowteam.dto.FlowTeamSettlementInfoExportDto">
|
||||
<select id="settlementExport" resultType="com.xuanyin.flowteam.dto.FlowTeamSettlementInfoVo">
|
||||
select
|
||||
u.erban_no as erBanNo,
|
||||
a.sign_time as signUpTime,
|
||||
|
Reference in New Issue
Block a user