BackFlowInfo backFlowInfo = monitorMapper.getBackFlowInfo(modelNo, dataDate);
String excelUrl = backFlowInfo.getMergeDataPath();
com.grapecity.documents.excel.Workbook workbook=new com.grapecity.documents.excel.Workbook();
String dirFileName = CommUtils.getUuidKey() + ".xlsx";
String fileTempPath = filePath + Constant.SEPARATOR+ dirFileName;
File targetFile = new File(filePath, FilenameUtils.getName(dirFileName));
try (InputStream inputStream = FileUpAndDownloadUtil.downLoadFile(excelUrl)) {
FileUtils.copyInputStreamToFile(inputStream, targetFile);
if (inputStream != null) {
inputStream.close();
}
workbook.open(fileTempPath);
} catch (Exception e) {
log.error("***100001queryGatherData失败***"+e.getMessage(),e);
} finally {
if (targetFile.exists() && targetFile.isFile()){
boolean flag = targetFile.delete();
if (flag){
log.info("****100002文件已经删除***"+targetFile);
}
}
}
return workbook.toJson(); |