Commit a6d837ed authored by luzhuang's avatar luzhuang

文件上传转换添加日志

parent eb0308d9
......@@ -790,10 +790,10 @@ public class BChapterServiceImpl implements BChapterService {
LogUtil.fileChangeLog("------------------存在直接返回路径----------------------------" + fileOld);
return returnBasePath + File.separator + name;
} else {
LogUtil.fileChangeLog("------------------判断是否可读----------------------------" + fileOld);
String downLoadName = downLoadFile(bFile, file, filePath);
LogUtil.fileChangeLog("------------------判断pdf是否可读----------------------------" + fileOld);
FileReadableUtil.fileReadable(filePath + File.separator + downLoadName, fileMaxSize, fileMaxPages);
LogUtil.fileChangeLog("------------------返回下载后路径-----------------------------" + downLoadName);
LogUtil.fileChangeLog("------------------pdf文件可读--返回下载后路径-----------------------------" + downLoadName);
return returnBasePath + File.separator + downLoadName;
}
}
......@@ -801,7 +801,7 @@ public class BChapterServiceImpl implements BChapterService {
if (FileTypeEnum.PPT.getCode().equals(bFile.getType()) || FileTypeEnum.WORD.getCode().equals(bFile.getType()) || FileTypeEnum.TXT.getCode().equals(bFile.getType())) {
LogUtil.fileChangeLog("------------------文件为ppt或word或txt----------------------------");
if (fileNew.exists()) {
LogUtil.fileChangeLog("------------------转换后文件存在直接返回-----------------------------");
LogUtil.fileChangeLog("------------------转换后文件-存在-直接返回-----------------------------");
return returnBasePath + File.separator + newName;
} else {
LogUtil.fileChangeLog("------------------删除老文件----------------------------");
......@@ -812,6 +812,7 @@ public class BChapterServiceImpl implements BChapterService {
//判断文件是否可读
LogUtil.fileChangeLog("------------------判断文件是否可读-----------------------------" + filePath + File.separator + name);
FileReadableUtil.fileReadable(filePath + File.separator + downLoadFileName, fileMaxSize, fileMaxPages);
LogUtil.fileChangeLog("------------------------非pdf文件可读-----------------------"+ downLoadFileName);
LogUtil.fileChangeLog("-----------------------------------------------downLoadFileUrl:" + filePath + File.separator + downLoadFileName);
LogUtil.fileChangeLog("-----------------------------------------------filePath:" + filePath + File.separator + newName);
int result = officeToPdf.transformToPdf(filePath + File.separator + downLoadFileName, filePath + File.separator + newName);
......@@ -892,13 +893,15 @@ public class BChapterServiceImpl implements BChapterService {
byte[] buf = new byte[1024 * 512];
int length = bis.read(buf);
//保存文件
LogUtil.fileChangeLog("------------------保存文件-----------------------------");
LogUtil.fileChangeLog("------------------保存文件开始-----------------------------");
while (length != -1) {
bos.write(buf, 0, length);
length = bis.read(buf);
}
LogUtil.fileChangeLog("------------------关闭--BufferedInputStream--和--BufferedOutputStream--流---------------------------");
bos.close();
bis.close();
LogUtil.fileChangeLog("------------------断开--HttpURLConnection--连接---------------------------");
conn.disconnect();
LogUtil.fileChangeLog("****************download + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
} catch (Exception e) {
......
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