| | |
| | | } |
| | | |
| | | @PostMapping("/net-factor/export-history") |
| | | @Operation(summary = "功率因数-电网拓扑功率历史(多code)") |
| | | @Operation(summary = "功率因数-电网拓扑功率历史导出(多code)") |
| | | public void exportPowerHistoryList(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody PowerNetFactorHisReqDTO dto) throws IOException { |
| | | log.info("exportPowerHistoryList开始"); |
| | | List<String> column = new ArrayList<>(); |
| | | column.add("时间"); |
| | | List<List<Object>> exportData = new ArrayList<>(); |
| | |
| | | Map<String, Object> dataMap = new HashMap<>(); |
| | | |
| | | if (StringUtils.isNotBlank(pointNo)) { |
| | | log.info("查询功率"); |
| | | apiPointValueQueryDTO.setPointNo(pointNo); |
| | | List<ApiPointValueDTO> chartData = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO); |
| | | for (ApiPointValueDTO pv : chartData) { |
| | |
| | | dataMap.put(key, val); |
| | | } |
| | | } else if (StringUtils.isNotBlank(pointNoArr[0]) && StringUtils.isNotBlank(pointNoArr[1])) { |
| | | log.info("查询累计功率"); |
| | | apiPointValueQueryDTO.setPointNo(pointNoArr[0]); |
| | | List<ApiPointValueDTO> chartDataP = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO); |
| | | Map<String, Double> dataMapP = new HashMap<>(); |
| | |
| | | |
| | | for (String cate : categories) { |
| | | List<Object> row = new ArrayList<>(); |
| | | row.add(cate); |
| | | for (String col : column) { |
| | | 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); |
| | | } |
| | | |