EasyExcel
EasyExcel是一个基于Java的简单、省内存的读写Excel的开源项目。
官网:(https://github.com/alibaba/easyexcel)
常见api · 语雀 (https://www.yuque.com/easyexcel/doc/api)。
定义格式
package com.bootcrab.cos.dto.coms.easyexcel;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
/**
* @author ZhzGod
* @date 2022/4/25 17:44
* @introduction
*/
public class CardIdentifierRequestDTO {
/**
* 客户编号
*/
//@ExcelProperty("客户编号")
@ExcelProperty(index = 0)
private String customerId;
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
}
监听模板
package com.bootcrab.cos.service.coms.notice.batch.easyexcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelDataConvertException;
import com.alibaba.excel.metadata.CellExtra;
import com.alibaba.fastjson.JSON;
import com.bootcrab.cos.dto.coms.easyexcel.CardIdentifierRequestDTO;
import com.bootcrab.cos.service.third.social.CreditInfoInquireService;
import com.bootcrab.cos.util.DateProUtil;
import com.bootcrab.cos.xface.dto.maintenance.ocr.dopa.XfaceCardIdentifierRequestDTO;
import com.bootcrab.cos.xface.dto.maintenance.ocr.dopa.