|
@@ -18,6 +18,7 @@ package org.springblade.resource.endpoint;
|
|
|
|
|
|
import com.aliyun.oss.model.*;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.itextpdf.text.pdf.PdfReader;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.SneakyThrows;
|
|
@@ -348,8 +349,8 @@ public class LargeFileEndpoint {
|
|
|
largeFile.setSuffix(param.getObjectType());
|
|
|
iLargeFileService.save(largeFile);
|
|
|
|
|
|
- if(param.getTotalChunks()== param.getChunkNumber()){
|
|
|
- Thread.sleep(400);
|
|
|
+ if((param.getTotalChunks()+"").equals(param.getChunkNumber()+"") ){
|
|
|
+ Thread.sleep(1000);
|
|
|
//第八步 检查文件是否全部完成上传
|
|
|
lock.lock();
|
|
|
try {
|
|
@@ -384,9 +385,11 @@ public class LargeFileEndpoint {
|
|
|
if(param.getFilename().contains("pdf")){
|
|
|
// FileInputStream inputStream1 = new FileInputStream(filePath + param.getFilename());
|
|
|
try {
|
|
|
- PDDocument document = PDDocument.load(multipartFile.getInputStream());
|
|
|
+ //PDDocument document = PDDocument.load(multipartFile.getInputStream());
|
|
|
+ PdfReader pdfReader = new PdfReader(multipartFile.getInputStream());
|
|
|
+ int pages = pdfReader.getNumberOfPages();
|
|
|
//获取文件页数
|
|
|
- newBladeFile.setPage(document.getPages().getCount());
|
|
|
+ newBladeFile.setPage(pages);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -601,4 +604,5 @@ public class LargeFileEndpoint {
|
|
|
return param.getIdentifier() + extension;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|