|
@@ -120,7 +120,10 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
|
|
|
//上传完,需要生成pdf
|
|
|
String dFile1 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
|
|
|
openOfficeService.start();
|
|
|
- openOfficeService.office2PDF(path + fileName,dFile1);
|
|
|
+ File testFile = new File(dFile1);
|
|
|
+ if(!testFile .exists()){
|
|
|
+ openOfficeService.office2PDF(path + fileName,dFile1);
|
|
|
+ }
|
|
|
//模具报废情况下,设置files2
|
|
|
String dFile2 = "";
|
|
|
if (blongType == 5 && file2 != null && !file2.isEmpty()) {
|
|
@@ -139,7 +142,10 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
|
|
|
saveFile2.createNewFile();
|
|
|
file2.transferTo(saveFile2);
|
|
|
dFile2 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
|
|
|
- openOfficeService.office2PDF(path + fileName,dFile2);
|
|
|
+ testFile = new File(dFile2);
|
|
|
+ if(!testFile .exists()){
|
|
|
+ openOfficeService.office2PDF(path + fileName,dFile2);
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
projectFile = null;
|
|
@@ -730,14 +736,17 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
|
|
|
file.transferTo(saveFile);
|
|
|
//上传完,需要生成pdf
|
|
|
String dFile1 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
|
|
|
- openOfficeService.office2PDF(path + fileName,dFile1);
|
|
|
- PdfFile pdfFile = new PdfFile();
|
|
|
- pdfFile.setPdfUrl("/upload/"+dFile1);
|
|
|
- pdfFile.setFileId(partFile.getId());
|
|
|
- pdfFile.setType(1);
|
|
|
- pdfFile.setRafId(partFile.getModelId());
|
|
|
- pdfFile.setSourceFileUrl(partFile.getFileUrl());
|
|
|
- pdfFileMapper.insert(pdfFile);
|
|
|
+ File newFile = new File(dFile1);
|
|
|
+ if(!newFile .exists()){
|
|
|
+ openOfficeService.office2PDF(path + fileName,dFile1);
|
|
|
+ PdfFile pdfFile = new PdfFile();
|
|
|
+ pdfFile.setPdfUrl("/upload/"+dFile1);
|
|
|
+ pdfFile.setFileId(partFile.getId());
|
|
|
+ pdfFile.setType(1);
|
|
|
+ pdfFile.setRafId(partFile.getModelId());
|
|
|
+ pdfFile.setSourceFileUrl(partFile.getFileUrl());
|
|
|
+ pdfFileMapper.insert(pdfFile);
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
partFile = null;
|