Commit 4b756eb7482af5126365fce6c4b3faa40182ee7b
1 parent
7248a85c
fix: 报表导出取消使用CompletableFuture<Void>
Showing
1 changed file
with
16 additions
and
24 deletions
... | ... | @@ -178,8 +178,8 @@ public class TkReportGenerateRecordServiceImpl |
178 | 178 | |
179 | 179 | @Override |
180 | 180 | public void generateExcelUpdateReportRecord(ReportFormConfigDTO formConfigDTO,List<ExecuteAttributesDTO> executeAttributes, |
181 | - String recordId) { | |
182 | - List<CompletableFuture<CustomDataForExcelDTO>> list = new ArrayList<>(); | |
181 | + String recordId){ | |
182 | + List<CustomDataForExcelDTO> list = new ArrayList<>(); | |
183 | 183 | for(ExecuteAttributesDTO dto:executeAttributes){ |
184 | 184 | Long startTs = formConfigDTO.getQueryCondition().getStartTs(); |
185 | 185 | Long endTs = formConfigDTO.getQueryCondition().getEndTs(); |
... | ... | @@ -191,29 +191,21 @@ public class TkReportGenerateRecordServiceImpl |
191 | 191 | startTs = endTs - differenceTs; |
192 | 192 | formConfigDTO.getQueryCondition().setStartTs(startTs); |
193 | 193 | formConfigDTO.getQueryCondition().setEndTs(endTs); |
194 | - list.add(getTsKvValuesOrGenerateExcel(formConfigDTO, dto)); | |
194 | + CustomDataForExcelDTO result = getTsKvValuesOrGenerateExcel(formConfigDTO, dto).join(); | |
195 | + list.add(result); | |
195 | 196 | } |
196 | - CompletableFuture<Void> future = CompletableFuture.allOf(list.toArray(new CompletableFuture[0])); | |
197 | - // 在所有异步任务完成后进行下一步处理 | |
198 | - future.thenRun(() -> { | |
199 | - // 获取所有结果 | |
200 | - List<CustomDataForExcelDTO> results = new ArrayList<>(); | |
201 | - for (CompletableFuture<CustomDataForExcelDTO> futureResult : list) { | |
202 | - CustomDataForExcelDTO dto = futureResult.join(); | |
203 | - results.add(dto); | |
204 | - } | |
205 | - ObjectNode executeCondition = JacksonUtil.newObjectNode(); | |
206 | - QueryConditionDTO queryCondition = formConfigDTO.getQueryCondition(); | |
207 | - executeCondition.replace( | |
208 | - FastIotConstants.CHART_EXECUTE_CONDITION, | |
209 | - JacksonUtil.convertValue(queryCondition, JsonNode.class)); | |
210 | - executeCondition.replace( | |
211 | - FastIotConstants.CHART_EXECUTE_ATTRIBUTES, | |
212 | - JacksonUtil.convertValue(formConfigDTO.getExecuteAttributes(), JsonNode.class)); | |
213 | - // 汇总所有数据,生成Excel并上传 | |
214 | - generateExcelAndUpload(results,formConfigDTO.getName(),recordId,formConfigDTO.getTenantId(), | |
215 | - executeCondition); | |
216 | - }); | |
197 | + // 获取所有结果 | |
198 | + ObjectNode executeCondition = JacksonUtil.newObjectNode(); | |
199 | + QueryConditionDTO queryCondition = formConfigDTO.getQueryCondition(); | |
200 | + executeCondition.replace( | |
201 | + FastIotConstants.CHART_EXECUTE_CONDITION, | |
202 | + JacksonUtil.convertValue(queryCondition, JsonNode.class)); | |
203 | + executeCondition.replace( | |
204 | + FastIotConstants.CHART_EXECUTE_ATTRIBUTES, | |
205 | + JacksonUtil.convertValue(formConfigDTO.getExecuteAttributes(), JsonNode.class)); | |
206 | + // 汇总所有数据,生成Excel并上传 | |
207 | + generateExcelAndUpload(list,formConfigDTO.getName(),recordId,formConfigDTO.getTenantId(), | |
208 | + executeCondition); | |
217 | 209 | } |
218 | 210 | |
219 | 211 | private CompletableFuture<CustomDataForExcelDTO> getTsKvValuesOrGenerateExcel( | ... | ... |