| | |
| | | public void exportPowerHistoryList(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody PowerNetFactorHisReqDTO dto) throws IOException { |
| | | log.info("exportPowerHistoryList开始"); |
| | | String firstCol = "时间"; |
| | | List<String> column = new ArrayList<>(); |
| | | column.add("时间"); |
| | | column.add(firstCol); |
| | | List<List<Object>> exportData = new ArrayList<>(); |
| | | |
| | | List<String> nodeCodeList = dto.getNodeCodeList(); |
| | |
| | | } |
| | | dataAll.put(powerNetFactorQuery.getNodeName(), dataMap); |
| | | } |
| | | |
| | | log.info("column=" + JSONArray.toJSONString(column)); |
| | | for (String cate : categories) { |
| | | List<Object> row = new ArrayList<>(); |
| | | row.add(cate); |
| | | for (String col : column) { |
| | | row.add(dataAll.get(col).get(cate)); |
| | | if (firstCol.equals(col)) { |
| | | row.add(cate); |
| | | } else if (dataAll.get(col) == null) { |
| | | log.info(col + " is null"); |
| | | row.add(""); |
| | | } else if (dataAll.get(col).get(cate) == null) { |
| | | log.info(col + cate + " is null"); |
| | | row.add(""); |
| | | } else { |
| | | row.add(dataAll.get(col).get(cate)); |
| | | } |
| | | } |
| | | exportData.add(row); |
| | | } |
| | | log.info("column=" + JSONArray.toJSONString(column)); |
| | | log.info("exportData.size=" + exportData.size()); |
| | | ExcelUtils.write(response, "历史.xlsx", "历史数据", column, exportData); |
| | | } |