diff --git a/@rbv b/@rbv index b268f9ed1..f07527b06 160000 --- a/@rbv +++ b/@rbv @@ -1 +1 @@ -Subproject commit b268f9ed1e9a891ded25bbeca4130153b1764782 +Subproject commit f07527b06b21bee5e2bf6b927b733903178c1954 diff --git a/src/main/java/com/rebuild/core/service/datareport/DataReportManager.java b/src/main/java/com/rebuild/core/service/datareport/DataReportManager.java index 5ba634d0b..119e58b05 100644 --- a/src/main/java/com/rebuild/core/service/datareport/DataReportManager.java +++ b/src/main/java/com/rebuild/core/service/datareport/DataReportManager.java @@ -217,6 +217,7 @@ public class DataReportManager implements ConfigManager { else if (fileName.endsWith(".doc")) name += ".doc"; else if (fileName.endsWith(".xlsx")) name += ".xlsx"; else if (fileName.endsWith(".xls")) name += ".xls"; + else if (fileName.endsWith(".csv")) name += ".csv"; break; } } diff --git a/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator.java b/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator.java index e63ff86a6..e1b7ed237 100644 --- a/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator.java +++ b/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator.java @@ -81,7 +81,8 @@ import static com.rebuild.core.service.datareport.TemplateExtractor33.NROW_PREFI @Slf4j public class EasyExcelGenerator extends SetUser { - final protected static String MDATA_KEY = "."; + final protected static String DKEY_RECORD_MAIN = "."; + final protected static String DKEY_LIST = DKEY_RECORD_MAIN + "36LIST"; protected File templateFile; protected Integer writeSheetAt = null; @@ -110,10 +111,11 @@ public class EasyExcelGenerator extends SetUser { Map>> datas = buildData(); if (datas.isEmpty()) throw new DefinedException(Language.L("暂无数据")); + // 记录模板-主记录 Map main = null; - if (datas.containsKey(MDATA_KEY)) { - main = datas.get(MDATA_KEY).get(0); - datas.remove(MDATA_KEY); + if (datas.containsKey(DKEY_RECORD_MAIN)) { + main = datas.get(DKEY_RECORD_MAIN).get(0); + datas.remove(DKEY_RECORD_MAIN); } FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); @@ -124,10 +126,10 @@ public class EasyExcelGenerator extends SetUser { .registerWriteHandler(new FormulaCellWriteHandler()) .build(); - // 一个列表 + // 一个列表/列表模板 if (datas.size() == 1) { - Object o = datas.values().iterator().next(); - excelWriter.fill(o, fillConfig, writeSheet); + Object datas35 = datas.values().iterator().next(); + excelWriter.fill(datas35, fillConfig, writeSheet); } // fix: v3.6 多个列表 else if (datas.size() > 1) { @@ -253,7 +255,7 @@ public class EasyExcelGenerator extends SetUser { Assert.notNull(record, "No record found : " + recordId); Map d = buildData(record, varsMapOfMain); - datas.put(MDATA_KEY, Collections.singletonList(d)); + datas.put(DKEY_RECORD_MAIN, Collections.singletonList(d)); } // 明细 @@ -274,7 +276,7 @@ public class EasyExcelGenerator extends SetUser { detailList.add(buildData(c, varsMapOfDetail)); phNumber++; } - datas.put(MDATA_KEY + "detail", detailList); + datas.put(DKEY_RECORD_MAIN + "detail", detailList); } // 审批 @@ -293,7 +295,7 @@ public class EasyExcelGenerator extends SetUser { approvalList.add(buildData(c, varsMapOfApproval)); phNumber++; } - datas.put(MDATA_KEY + "approval", approvalList); + datas.put(DKEY_RECORD_MAIN + "approval", approvalList); } return datas; diff --git a/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator33.java b/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator33.java index 63859a954..83863f1e0 100644 --- a/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator33.java +++ b/src/main/java/com/rebuild/core/service/datareport/EasyExcelGenerator33.java @@ -155,7 +155,7 @@ public class EasyExcelGenerator33 extends EasyExcelGenerator { Assert.notNull(record, "No record found : " + recordId); Map d = buildData(record, varsMapOfMain); - datas.put(MDATA_KEY, Collections.singletonList(d)); + datas.put(DKEY_RECORD_MAIN, Collections.singletonList(d)); mdataHolder = d; } diff --git a/src/main/java/com/rebuild/core/service/datareport/EasyExcelListGenerator.java b/src/main/java/com/rebuild/core/service/datareport/EasyExcelListGenerator.java index 1719d2a13..74e154474 100644 --- a/src/main/java/com/rebuild/core/service/datareport/EasyExcelListGenerator.java +++ b/src/main/java/com/rebuild/core/service/datareport/EasyExcelListGenerator.java @@ -97,7 +97,7 @@ public class EasyExcelListGenerator extends EasyExcelGenerator { if (varsMap.containsKey(PH__CURRENTDATETIME)) phValues.put(PH__CURRENTDATETIME, getPhValue(PH__CURRENTDATETIME)); Map>> datasMap = new HashMap<>(); - datasMap.put(MDATA_KEY, datas); + datasMap.put(DKEY_LIST, datas); return datasMap; } diff --git a/src/main/resources/web/admin/data/report-templates.html b/src/main/resources/web/admin/data/report-templates.html index e4b94bf19..43efb6b4f 100644 --- a/src/main/resources/web/admin/data/report-templates.html +++ b/src/main/resources/web/admin/data/report-templates.html @@ -11,15 +11,21 @@ .mdi-monitor::before { margin-left: -1px; } + .badge.badge-info { + color: #555; + } .badge.badge-info.excel { background-color: #0f9d58; + background-color: #caead8; } .badge.badge-info.word { background-color: #307cf1; + background-color: #d2e0f4; } .badge.badge-info.html5 { background-color: #f16529; background-color: #e44d26; + background-color: #f6dbd4; }