Commit 3ae200d2 by fudahua

feat: 耗时

parent 8b5732e6
package com.gic.cloud.data.hook.service.impl; package com.gic.cloud.data.hook.service.impl;
import cn.hutool.core.date.StopWatch;
import cn.medubi.client.utils.LogPak; import cn.medubi.client.utils.LogPak;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -877,11 +878,17 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService { ...@@ -877,11 +878,17 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
String dirName="hdfs"+task.getId(); String dirName="hdfs"+task.getId();
String path=HDFS_URL+"/"+dirName; String path=HDFS_URL+"/"+dirName;
try { try {
StopWatch stopWatch = StopWatch.create("down");
stopWatch.start();
logger.info("下载开始");
boolean downloadFlag = HDFSUtil.getInstance().downloadFile(path, SAVE_FOLDER); boolean downloadFlag = HDFSUtil.getInstance().downloadFile(path, SAVE_FOLDER);
if (!downloadFlag) { if (!downloadFlag) {
logger.info("下载失败:{}-{}",path,JSONObject.toJSONString(task)); logger.info("下载失败:{}-{}",path,JSONObject.toJSONString(task));
return; return;
} }
stopWatch.stop();
logger.info("下载耗时:{}",stopWatch.getLastTaskTimeMillis());
stopWatch.start();
List<String> xlsxFiles=new ArrayList<>(); List<String> xlsxFiles=new ArrayList<>();
AtomicInteger count=new AtomicInteger(0); AtomicInteger count=new AtomicInteger(0);
AtomicReference<XlsxFileInfo> currentFile=new AtomicReference<>(); AtomicReference<XlsxFileInfo> currentFile=new AtomicReference<>();
...@@ -896,7 +903,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService { ...@@ -896,7 +903,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}); });
//结束 //结束
saveXlsSplitNew(currentFile.get().filepath,null,null,currentFile.get(),count,true); saveXlsSplitNew(currentFile.get().filepath,null,null,currentFile.get(),count,true);
stopWatch.stop();
logger.info("写入本地excel耗时:{}",stopWatch.getLastTaskTimeMillis());
stopWatch.start();
//是否压缩 //是否压缩
boolean zipFlag = (xlsxFiles.size() > 1) ? true : false; boolean zipFlag = (xlsxFiles.size() > 1) ? true : false;
String cloudFileUrl=null; String cloudFileUrl=null;
...@@ -914,7 +923,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService { ...@@ -914,7 +923,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
logger.info("[ 开始上传文件到腾讯云 ]: {}", task.getId()); logger.info("[ 开始上传文件到腾讯云 ]: {}", task.getId());
cloudFileUrl = cloudFileUpload(task.getEnterpriseId(), new File(currentFile.get().filepath), taskFileExt.substring(1)); cloudFileUrl = cloudFileUpload(task.getEnterpriseId(), new File(currentFile.get().filepath), taskFileExt.substring(1));
} }
stopWatch.stop();
logger.info("上传腾讯云耗时:{}",stopWatch.getLastTaskTimeMillis());
logger.info("[ 上传腾讯云 ]: {}", "地址为:" + cloudFileUrl); logger.info("[ 上传腾讯云 ]: {}", "地址为:" + cloudFileUrl);
task.setStatus(DownloadTaskStatus.COMPLISHED); task.setStatus(DownloadTaskStatus.COMPLISHED);
task.setOverTime(new Date()); task.setOverTime(new Date());
......
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.io.FileOutputStream;
import java.util.Date;
public class ExceTest2 {
public static void main(String[] args) {
int n=25;
int c=100;
Double aDouble = Double.valueOf((double) n / c);
System.out.println(aDouble);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment