We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实体的一些字段导出列是空的 字段有aRate,bRate,PhoneRate 版本:3.3.2、3.3.4 这两个版本都试过
import com.alibaba.excel.annotation.ExcelProperty; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.math.BigDecimal; @Data public class CusDataSummaryTotalListVO { /** * 日期 **/ @ExcelProperty("日期") @JsonProperty("dayDate") private String dayDate; /** * 本周总数据 **/ @ExcelProperty("本周总数据") @JsonProperty("nowNum") private BigDecimal nowNum; /** * 上周总数据 **/ @ExcelProperty("上周总数据") @JsonProperty("beforeNum") private BigDecimal beforeNum; /** * 总环比(本周-上周)/上周 **/ @ExcelProperty("总环比") @JsonProperty("allRate") private BigDecimal allRate; /** * A组本周总数据 **/ @ExcelProperty("A组本周总数据") @JsonProperty("nowaNum") private BigDecimal nowaNum; /** * A组上周总数据 **/ @ExcelProperty("A组上周总数据") @JsonProperty("beforeaNum") private BigDecimal beforeaNum; /** * A组环比 **/ @ExcelProperty("A组环比") @JsonProperty("aRate") private BigDecimal aRate; /** * B组本周总数据 **/ @ExcelProperty("B组本周总数据") @JsonProperty("nowbNum") private BigDecimal nowbNum; /** * B组上周总数据 **/ @ExcelProperty("B组上周总数据") @JsonProperty("beforebNum") private BigDecimal beforebNum; /** * B组环比 **/ @ExcelProperty("B组环比") @JsonProperty("bRate") private BigDecimal bRate; /** * AB组环比 **/ @ExcelProperty("AB组环比") @JsonProperty("abRate") private BigDecimal abRate; /** * 电话组本周总数据 **/ @ExcelProperty("电话组本周总数据") @JsonProperty("nowPhoneNum") private BigDecimal nowPhoneNum; /** * 电话组上周总数据 **/ @ExcelProperty("电话组上周总数据") @JsonProperty("beforePhoneNum") private BigDecimal beforePhoneNum; /** * 电话组环比 **/ @ExcelProperty("电话组环比") @JsonProperty("PhoneRate") private BigDecimal PhoneRate; /** * 其他本周总数据 **/ @ExcelProperty("其他本周总数据") @JsonProperty("nowOtherNum") private BigDecimal nowOtherNum; /** * 其他上周总数据 **/ @ExcelProperty("其他上周总数据") @JsonProperty("beforeOtherNum") private BigDecimal beforeOtherNum; /** * 其他环比 **/ @ExcelProperty("其他环比") @JsonProperty("OtherRate") private BigDecimal OtherRate; /** * 类型 **/ @ExcelProperty("类型") @JsonProperty("type") private String type; /** * 姓名 **/ @ExcelProperty("姓名") @JsonProperty("userName") private String userName; /** * 分组 **/ @ExcelProperty("分组") @JsonProperty("zu") private String zu; }
/** * 导出Excel * * @return */ @ApiOperation("导出Excel") @GetMapping("/Actions/ExportTotal") public void ExportTotal(HttpServletResponse response) throws IOException { List<CusDataSummaryTotalListVO> list = new ArrayList<>(); list.add(new CusDataSummaryTotalListVO()); List<String> columnFiledNames = Arrays.asList("dayDate,nowNum,beforeNum,allRate,nowaNum,beforeaNum,aRate,nowbNum,beforebNum,bRate,nowPhoneNum,beforePhoneNum,PhoneRate,nowOtherNum,beforeOtherNum,OtherRate".split(",")); EasyExcelUtil.excelWriter(response, columnFiledNames, "客服数据分组汇总.xlsx", "sheet", CusDataSummaryTotalListVO.class, list); } /** * 设置返回流以及写入表头 * @param response * @param columnFiledNames * @param fileName * @param clazz * @return * @throws IOException */ public static void excelWriter(HttpServletResponse response, Collection<String> columnFiledNames, String fileName, String sheetName, final Class<?> clazz, List<?> list) throws IOException { // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName1 = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-Disposition", "attachment;filename*=utf-8" + fileName1); // 响应类型,编码 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // 这里 指定文件 @Cleanup ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).includeColumnFieldNames(columnFiledNames).orderByIncludeColumn(true).head(clazz).build(); List<? extends List<?>> lists = Lists.partition(list, COUNT); int r = 1; for (List<?> l: lists) { writExcel(excelWriter, r, sheetName+r, l); r++; } }
没有任何异常,但是 aRate,bRate,PhoneRate 这几列是空,修改类型也是一样,但是把字段改一下就没问题了
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
link #3983
It seems not a bug. I will remove BUG tag.
BUG
psxjoy
zhuangjiaju
No branches or pull requests
触发场景描述
实体的一些字段导出列是空的
字段有aRate,bRate,PhoneRate
版本:3.3.2、3.3.4
这两个版本都试过
触发Bug的代码
实体:
导出方法:
提示的异常或者没有达到的效果
没有任何异常,但是 aRate,bRate,PhoneRate 这几列是空,修改类型也是一样,但是把字段改一下就没问题了
The text was updated successfully, but these errors were encountered: