This commit is contained in:
parent
9da2bd8524
commit
60cccc3932
|
@ -42,7 +42,6 @@ public class ExcelDataListener<T> extends AnalysisEventListener<T> {
|
||||||
public void invoke(T data, AnalysisContext context) {
|
public void invoke(T data, AnalysisContext context) {
|
||||||
list.add(data);
|
list.add(data);
|
||||||
if (list.size() == 500) {
|
if (list.size() == 500) {
|
||||||
System.out.println(("自己逻辑..."));
|
|
||||||
this.callBack.doSaveBatch(list);
|
this.callBack.doSaveBatch(list);
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.URLUtil;
|
import cn.hutool.core.util.URLUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.alibaba.excel.converters.longconverter.LongStringConverter;
|
||||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||||
import com.fhs.common.utils.ConverterUtils;
|
import com.fhs.common.utils.ConverterUtils;
|
||||||
import com.fhs.core.trans.anno.Trans;
|
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) {
|
public static <T> void excelExport(Class<T> head, File file, String sheetName, List<T> data) {
|
||||||
try {
|
try {
|
||||||
EasyExcel.write(file, head).sheet(sheetName).doWrite(data);
|
EasyExcel.write(file, head).sheet(sheetName).registerConverter(new LongStringConverter()).doWrite(data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +140,8 @@ public class ExcelUtils {
|
||||||
try {
|
try {
|
||||||
HttpServletResponse response = getExportResponse(excelName);
|
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) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +160,8 @@ public class ExcelUtils {
|
||||||
try {
|
try {
|
||||||
HttpServletResponse response = getExportResponse(excelName);
|
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) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user