no message
							parent
							
								
									cd2a574fee
								
							
						
					
					
						commit
						4f820b52d5
					
				| 
						 | 
					@ -117,16 +117,7 @@ public class ItemController {
 | 
				
			||||||
    @SaCheckPermission("item:exportItems")
 | 
					    @SaCheckPermission("item:exportItems")
 | 
				
			||||||
    @OperateLog
 | 
					    @OperateLog
 | 
				
			||||||
    public void exportItems(@PathVariable String taskId, HttpServletResponse response){
 | 
					    public void exportItems(@PathVariable String taskId, HttpServletResponse response){
 | 
				
			||||||
        long startTime = System.currentTimeMillis();
 | 
					 | 
				
			||||||
        itemQueryService.exportItem(taskId, response);
 | 
					        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);
 | 
					        exportTaskService.cleanupTask(taskId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,7 @@
 | 
				
			||||||
            <AppenderRef ref="druidSlowSqlLog"/>
 | 
					            <AppenderRef ref="druidSlowSqlLog"/>
 | 
				
			||||||
        </logger>
 | 
					        </logger>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <Root level="error">
 | 
					        <Root level="info">
 | 
				
			||||||
            <AppenderRef ref="Console"/>
 | 
					            <AppenderRef ref="Console"/>
 | 
				
			||||||
            <AppenderRef ref="debug"/>
 | 
					            <AppenderRef ref="debug"/>
 | 
				
			||||||
            <AppenderRef ref="info"/>
 | 
					            <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 {
 | 
					    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);
 | 
					        SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
 | 
				
			||||||
        HorizontalCellStyleStrategy horizontalCellStyleStrategy = getHorizontalCellStyleStrategy();
 | 
					        HorizontalCellStyleStrategy horizontalCellStyleStrategy = getHorizontalCellStyleStrategy();
 | 
				
			||||||
        try (ExcelWriter excelWriter = FastExcel.write(response.getOutputStream(), head).registerWriteHandler(horizontalCellStyleStrategy).build()) {
 | 
					        try (ExcelWriter excelWriter = FastExcel.write(response.getOutputStream(), head).registerWriteHandler(horizontalCellStyleStrategy).build()) {
 | 
				
			||||||
| 
						 | 
					@ -108,6 +109,13 @@ public final class SmartExcelUtil {
 | 
				
			||||||
                long progress = processed * 100 / total;
 | 
					                long progress = processed * 100 / total;
 | 
				
			||||||
                progressUpdater.accept(taskId, progress);
 | 
					                progressUpdater.accept(taskId, progress);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            if (System.currentTimeMillis() - startTime <= 1000) {
 | 
				
			||||||
 | 
					                try {
 | 
				
			||||||
 | 
					                    Thread.sleep(2000);
 | 
				
			||||||
 | 
					                } catch (InterruptedException e) {
 | 
				
			||||||
 | 
					                    System.out.println("异常" + e.getMessage());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            excelWriter.finish();
 | 
					            excelWriter.finish();
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            throw new BusinessException("导出失败");
 | 
					            throw new BusinessException("导出失败");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ spring:
 | 
				
			||||||
      username: druid
 | 
					      username: druid
 | 
				
			||||||
      password: 1024
 | 
					      password: 1024
 | 
				
			||||||
      login:
 | 
					      login:
 | 
				
			||||||
        enabled: false
 | 
					        enabled: true
 | 
				
			||||||
      method:
 | 
					      method:
 | 
				
			||||||
        pointcut: net.lab1024.sa..*Service.*
 | 
					        pointcut: net.lab1024.sa..*Service.*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue