|
|
|
@ -8,7 +8,6 @@ import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
import org.assertj.core.util.Lists;
|
|
|
|
|
import org.beetl.sql.annotation.entity.AssignID;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
@ -187,7 +186,7 @@ public class ExcelUtil {
|
|
|
|
|
list.addAll(extendsData);
|
|
|
|
|
}
|
|
|
|
|
list.forEach(item -> {
|
|
|
|
|
List<Object> itemList = Lists.newArrayList();
|
|
|
|
|
List<Object> itemList = new ArrayList<>();
|
|
|
|
|
for (String head : heads) {
|
|
|
|
|
itemList.add(ObjectUtils.defaultIfNull(item.get(head), ""));
|
|
|
|
|
}
|
|
|
|
@ -232,9 +231,9 @@ public class ExcelUtil {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static List<List<String>> heads(Collection<String> heads) {
|
|
|
|
|
List<List<String>> list = Lists.newArrayList();
|
|
|
|
|
List<List<String>> list = new ArrayList<>();
|
|
|
|
|
for (String head : heads) {
|
|
|
|
|
list.add(Lists.newArrayList(head));
|
|
|
|
|
list.add(new ArrayList<>(Collections.singleton(head)));
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
@ -299,7 +298,9 @@ public class ExcelUtil {
|
|
|
|
|
.sheet(sheetName);
|
|
|
|
|
// 注册转换器
|
|
|
|
|
Optional.ofNullable(converters).ifPresent(e -> e.forEach(sheet::registerConverter));
|
|
|
|
|
if (isFreezeHead) sheet.registerWriteHandler(new FreezeAndFilter());
|
|
|
|
|
if (isFreezeHead) {
|
|
|
|
|
sheet.registerWriteHandler(new FreezeAndFilter());
|
|
|
|
|
}
|
|
|
|
|
sheet.doWrite(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -330,7 +331,9 @@ public class ExcelUtil {
|
|
|
|
|
.sheet(sheetName);
|
|
|
|
|
// 注册转换器
|
|
|
|
|
Optional.ofNullable(converters).ifPresent(e -> e.forEach(sheet::registerConverter));
|
|
|
|
|
if (isFreezeHead) sheet.registerWriteHandler(new FreezeAndFilter());
|
|
|
|
|
if (isFreezeHead) {
|
|
|
|
|
sheet.registerWriteHandler(new FreezeAndFilter());
|
|
|
|
|
}
|
|
|
|
|
sheet.doWrite(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|