|
|
@@ -85,7 +85,10 @@ public class LedgerExportController {
|
|
|
//构建excel头
|
|
|
List<List<String>> headlist = buildExcelHeader(columnConfigs);
|
|
|
|
|
|
- List<List<Object>> dataList = buildExcelDataList(apiInfo, headlist, dto.getQueryParam());
|
|
|
+ //构建头对应的key
|
|
|
+ List<List<String>> keylist = buildEntityKey(columnConfigs);
|
|
|
+
|
|
|
+ List<List<Object>> dataList = buildExcelDataList(apiInfo, keylist, dto.getQueryParam());
|
|
|
|
|
|
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
EasyExcel.write(bot).head(headlist).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
|
|
|
@@ -107,6 +110,17 @@ public class LedgerExportController {
|
|
|
* @return
|
|
|
*/
|
|
|
private List<List<String>> buildExcelHeader(JsonArray columnConfigs) {
|
|
|
+ List<List<String>> list = ListUtils.newArrayList();
|
|
|
+ for (JsonElement element : columnConfigs) {
|
|
|
+ String key = element.getAsJsonObject().get("label").getAsString();
|
|
|
+ List<String> head = ListUtils.newArrayList();
|
|
|
+ head.add(key);
|
|
|
+ list.add(head);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<List<String>> buildEntityKey(JsonArray columnConfigs) {
|
|
|
List<List<String>> list = ListUtils.newArrayList();
|
|
|
for (JsonElement element : columnConfigs) {
|
|
|
String key = element.getAsJsonObject().get("field").getAsString();
|