Browse Source

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
5 năm trước cách đây
mục cha
commit
313ae6d474

+ 12 - 12
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -117,13 +117,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         e.printStackTrace();
                         projectFile = null;
                     }
-                    //上传完,需要生成pdf
-                    String dFile1 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
-                    openOfficeService.start();
-                    File testFile = new File(dFile1);
-                    if(!testFile .exists()){
-                        openOfficeService.office2PDF(path + fileName,dFile1);
-                    }
                     //模具报废情况下,设置files2
                     String dFile2 = "";
                     if (blongType == 5 && file2 != null && !file2.isEmpty()) {
@@ -141,11 +134,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         try {
                             saveFile2.createNewFile();
                             file2.transferTo(saveFile2);
-                            dFile2 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
-                             testFile = new File(dFile2);
-                            if(!testFile .exists()){
-                                openOfficeService.office2PDF(path + fileName,dFile2);
-                            }
                         } catch (IOException e) {
                             e.printStackTrace();
                             projectFile = null;
@@ -165,6 +153,13 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         projectFile.setDwgType(userVO.getDwgType());
                     }
                     mouldFileMapper.insert(projectFile);
+                    //上传完,需要生成pdf
+                    String dFile1 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
+                    openOfficeService.start();
+                    File testFile = new File(dFile1);
+                    if(!testFile .exists()){
+                        openOfficeService.office2PDF(path + fileName,dFile1);
+                    }
                     PdfFile pdfFile = new PdfFile();
                     pdfFile.setPdfUrl("/upload/"+dFile1.substring(path.length()));
                     pdfFile.setFileId(projectFile.getId());
@@ -173,6 +168,11 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     pdfFile.setSourceFileUrl(projectFile.getFileUrl());
                     pdfFileMapper.insert(pdfFile);
                     if(blongType == 5 && file2 != null && !file2.isEmpty()){
+                        dFile2 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
+                        testFile = new File(dFile2);
+                        if(!testFile .exists()){
+                            openOfficeService.office2PDF(path + fileName,dFile2);
+                        }
                         pdfFile = new PdfFile();
                         pdfFile.setPdfUrl("/upload/"+dFile2.substring(path.length()));
                         pdfFile.setFileId(projectFile.getId());