Переглянути джерело

【CHG】导出二维码增加计时日志

ZhaoMn 3 роки тому
батько
коміт
afcbfe81e9

+ 3 - 0
railway-business/src/main/java/com/railway/business/safetool/service/impl/BaseSafetyToolServiceImpl.java

@@ -225,6 +225,7 @@ public class BaseSafetyToolServiceImpl implements IBaseSafetyToolService {
       return AjaxResult.error("临时目录创建失败");
     }
     log.info(" * 开始整理二维码图片文件 * ");
+    long time1 = System.currentTimeMillis();
     for (BaseSafetyTool tool : tools){
       String jpgPath = tmpPath + tool.getToolCode() + ".jpg";
       HttpUtils.download(tool.getQcodeUrl(), jpgPath);
@@ -235,6 +236,8 @@ public class BaseSafetyToolServiceImpl implements IBaseSafetyToolService {
     } catch (ZipException e) {
       return AjaxResult.error("文件压缩失败");
     }
+    long time2 = System.currentTimeMillis();
+    log.debug(" ****** {}", (time2 - time1));
     String zipFilePath = localFilePath + "/" + zipFile;
     log.info("压缩文件: {} - {}", zipFile, zipFilePath);
     return sysFileService.uploadFile(zipFilePath);

+ 3 - 2
railway-common/src/main/java/com/railway/common/utils/http/HttpUtils.java

@@ -134,11 +134,11 @@ public class HttpUtils {
   }
 
   public static void download(String url, String filePath) {
+    long time1 = System.currentTimeMillis();
     InputStream in = sendGetStream(url);
     if(null == in){
       return;
     }
-    log.debug(" -- {}", url);
     File file = new File(filePath);
     byte[] bytes = new byte[4096];
     int len;
@@ -149,7 +149,8 @@ public class HttpUtils {
     } catch (IOException e) {
       log.error("下载出错 : {}", url);
     }
-    log.debug(" ++ {}", filePath);
+    long time2 = System.currentTimeMillis();
+    log.debug(" ++ {}", (time2 - time1));
   }
 
   /**