| | |
| | | String reportDate = getMetaValue(metaMap, "reportDate", ""); |
| | | String printedAt = getMetaValue(metaMap, "printedAt", ""); |
| | | String operator = getMetaValue(metaMap, "operator", ""); |
| | | return new ExcelUtil.ExportMeta(reportTitle, reportDate, printedAt, operator, count); |
| | | return new ExcelUtil.ExportMeta( |
| | | reportTitle, |
| | | reportDate, |
| | | printedAt, |
| | | operator, |
| | | count, |
| | | getReportStyle(metaMap) |
| | | ); |
| | | } |
| | | |
| | | private String getMetaValue(Map<?, ?> metaMap, String key, String defaultValue) { |
| | | Object value = metaMap.get(key); |
| | | return Objects.isNull(value) ? defaultValue : String.valueOf(value); |
| | | } |
| | | |
| | | private Map<String, Object> getReportStyle(Map<?, ?> metaMap) { |
| | | Object reportStyleObject = metaMap.get("reportStyle"); |
| | | if (!(reportStyleObject instanceof Map<?, ?> reportStyleMap)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | Map<String, Object> reportStyle = new HashMap<>(); |
| | | for (Map.Entry<?, ?> entry : reportStyleMap.entrySet()) { |
| | | reportStyle.put(String.valueOf(entry.getKey()), entry.getValue()); |
| | | } |
| | | return reportStyle; |
| | | } |
| | | } |