This commit is contained in:
阿沐 2024-02-27 18:45:16 +08:00
parent 9da2bd8524
commit 60cccc3932
2 changed files with 6 additions and 4 deletions

View File

@ -42,7 +42,6 @@ public class ExcelDataListener<T> extends AnalysisEventListener<T> {
public void invoke(T data, AnalysisContext context) {
list.add(data);
if (list.size() == 500) {
System.out.println(("自己逻辑..."));
this.callBack.doSaveBatch(list);
list.clear();
}

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.fhs.common.utils.ConverterUtils;
import com.fhs.core.trans.anno.Trans;
@ -120,7 +121,7 @@ public class ExcelUtils {
*/
public static <T> void excelExport(Class<T> head, File file, String sheetName, List<T> data) {
try {
EasyExcel.write(file, head).sheet(sheetName).doWrite(data);
EasyExcel.write(file, head).sheet(sheetName).registerConverter(new LongStringConverter()).doWrite(data);
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -139,7 +140,8 @@ public class ExcelUtils {
try {
HttpServletResponse response = getExportResponse(excelName);
EasyExcel.write(response.getOutputStream(), head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName).doWrite(data);
EasyExcel.write(response.getOutputStream(), head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName)
.registerConverter(new LongStringConverter()).doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
@ -158,7 +160,8 @@ public class ExcelUtils {
try {
HttpServletResponse response = getExportResponse(excelName);
EasyExcel.write(response.getOutputStream()).head(head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName).doWrite(data);
EasyExcel.write(response.getOutputStream()).head(head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName)
.registerConverter(new LongStringConverter()).doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
}