no message
parent
cd2a574fee
commit
4f820b52d5
|
|
@ -117,16 +117,7 @@ public class ItemController {
|
|||
@SaCheckPermission("item:exportItems")
|
||||
@OperateLog
|
||||
public void exportItems(@PathVariable String taskId, HttpServletResponse response){
|
||||
long startTime = System.currentTimeMillis();
|
||||
itemQueryService.exportItem(taskId, response);
|
||||
log.info("导出物料数据完成,耗时:{}ms", System.currentTimeMillis() - startTime);
|
||||
if (System.currentTimeMillis() - startTime <= 1000) {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("异常", e);
|
||||
}
|
||||
}
|
||||
exportTaskService.cleanupTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
<AppenderRef ref="druidSlowSqlLog"/>
|
||||
</logger>
|
||||
|
||||
<Root level="error">
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console"/>
|
||||
<AppenderRef ref="debug"/>
|
||||
<AppenderRef ref="info"/>
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public final class SmartExcelUtil {
|
|||
}
|
||||
|
||||
public static <T, E> void batchExportExcel(HttpServletResponse response, String fileName, String sheetName, Class head, String taskId, long total, BiFunction<Long, Integer, List<T>> pageQueryFunction, Function<T, E> convertFunction, ToLongFunction<T> idExtractor, int pageSize, BiConsumer<String, Long> progressUpdater) throws IOException {
|
||||
long startTime = System.currentTimeMillis();
|
||||
SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
|
||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = getHorizontalCellStyleStrategy();
|
||||
try (ExcelWriter excelWriter = FastExcel.write(response.getOutputStream(), head).registerWriteHandler(horizontalCellStyleStrategy).build()) {
|
||||
|
|
@ -108,6 +109,13 @@ public final class SmartExcelUtil {
|
|||
long progress = processed * 100 / total;
|
||||
progressUpdater.accept(taskId, progress);
|
||||
}
|
||||
if (System.currentTimeMillis() - startTime <= 1000) {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("异常" + e.getMessage());
|
||||
}
|
||||
}
|
||||
excelWriter.finish();
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("导出失败");
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ spring:
|
|||
username: druid
|
||||
password: 1024
|
||||
login:
|
||||
enabled: false
|
||||
enabled: true
|
||||
method:
|
||||
pointcut: net.lab1024.sa..*Service.*
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue