Просмотр исходного кода

Merge branch 'qtz3' of SH-Arbitrate/Arbitrate-Backend into dev

qtz 2 лет назад
Родитель
Сommit
d3701b7299

+ 5
- 3
ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java Просмотреть файл

80
      * @return
80
      * @return
81
      */
81
      */
82
     public static boolean downLoadFileByUrl(String httpUrl, String dir) throws EsignDemoException {
82
     public static boolean downLoadFileByUrl(String httpUrl, String dir) throws EsignDemoException {
83
+        boolean downLoadFileFlag = false;
83
         InputStream fis = null;
84
         InputStream fis = null;
84
         FileOutputStream fileOutputStream = null;
85
         FileOutputStream fileOutputStream = null;
85
         try {
86
         try {
95
             while ((length = fis.read(buffer, 0, 1024)) != -1) {
96
             while ((length = fis.read(buffer, 0, 1024)) != -1) {
96
                 fileOutputStream.write(buffer, 0, length);
97
                 fileOutputStream.write(buffer, 0, length);
97
             }
98
             }
99
+            downLoadFileFlag = true;
98
         } catch (IOException e) {
100
         } catch (IOException e) {
99
             EsignDemoException ex = new EsignDemoException("获取文件流异常", e);
101
             EsignDemoException ex = new EsignDemoException("获取文件流异常", e);
100
             ex.initCause(e);
102
             ex.initCause(e);
101
-            throw ex;
103
+            return downLoadFileFlag;
102
         } finally {
104
         } finally {
103
             try {
105
             try {
104
                 if (fis != null) {
106
                 if (fis != null) {
110
             } catch (IOException e) {
112
             } catch (IOException e) {
111
                 EsignDemoException ex = new EsignDemoException("关闭文件流异常", e);
113
                 EsignDemoException ex = new EsignDemoException("关闭文件流异常", e);
112
                 ex.initCause(e);
114
                 ex.initCause(e);
113
-                throw ex;
115
+                return downLoadFileFlag;
114
             }
116
             }
115
         }
117
         }
116
-        return true;
118
+        return downLoadFileFlag;
117
     }
119
     }
118
 
120
 
119
 
121
 

+ 2
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java Просмотреть файл

85
         return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
85
         return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
86
     }
86
     }
87
 
87
 
88
+
89
+
88
   public static void main(String[] args) throws EsignDemoException {
90
   public static void main(String[] args) throws EsignDemoException {
89
       String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx";
91
       String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx";
90
         EsignHttpResponse uploadUrl = getUploadUrl(filePath);
92
         EsignHttpResponse uploadUrl = getUploadUrl(filePath);

+ 22
- 6
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Просмотреть файл

21
 import org.springframework.stereotype.Component;
21
 import org.springframework.stereotype.Component;
22
 import org.springframework.transaction.annotation.Transactional;
22
 import org.springframework.transaction.annotation.Transactional;
23
 
23
 
24
+import java.io.File;
25
+import java.io.IOException;
24
 import java.time.LocalDate;
26
 import java.time.LocalDate;
25
 import java.util.List;
27
 import java.util.List;
26
 import java.util.UUID;
28
 import java.util.UUID;
38
     private DeptIdentifyMapper deptIdentifyMapper;
40
     private DeptIdentifyMapper deptIdentifyMapper;
39
 
41
 
40
     @Scheduled(cron = "0/10 * * * * ?")
42
     @Scheduled(cron = "0/10 * * * * ?")
43
+//    @Scheduled(cron = "0/30 * * * * ?")
41
     @Transactional
44
     @Transactional
42
     public void fixExecuteSelectFlowDetailUtils(){
45
     public void fixExecuteSelectFlowDetailUtils(){
43
         Gson gson = new Gson();
46
         Gson gson = new Gson();
118
                                     caseApplication.setFilearbitraUrl(filearbitraUrl);
121
                                     caseApplication.setFilearbitraUrl(filearbitraUrl);
119
                                     caseApplicationMapper.submitCaseApplication(caseApplication);
122
                                     caseApplicationMapper.submitCaseApplication(caseApplication);
120
 
123
 
121
-                     /*               LocalDate now = LocalDate.now();
124
+                                    LocalDate now = LocalDate.now();
122
                                     String year = Integer.toString(now.getYear());
125
                                     String year = Integer.toString(now.getYear());
123
                                     String month = String.format("%02d", now.getMonthValue());
126
                                     String month = String.format("%02d", now.getMonthValue());
124
                                     String day = String.format("%02d", now.getDayOfMonth());
127
                                     String day = String.format("%02d", now.getDayOfMonth());
125
                                     String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
128
                                     String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
126
                                     String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
129
                                     String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
127
                                     String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
130
                                     String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
128
-                                    String savePath = "/home/ruoyi/uploadPath/upload";
131
+                                    String savePath = "/home/ruoyi/uploadPath/upload/";
132
+
133
+                                    // 创建日期目录
134
+                                    File saveFolder = new File(saveFolderPath);
135
+                                    if (!saveFolder.exists()) {
136
+                                        saveFolder.mkdirs();
137
+                                    }
129
                                     String resultFilePath = saveFolderPath + "/" + fileName;
138
                                     String resultFilePath = saveFolderPath + "/" + fileName;
130
-                                    String fileDownloadUrlnew  = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
131
-                                    boolean b = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
132
-                                   if(b) {
139
+                                    File resultFilePathFile  = new File(resultFilePath);
140
+                                    if (!resultFilePathFile.exists()) {
141
+                                        resultFilePathFile.createNewFile();
142
+                                    }
143
+
144
+                                   String fileDownloadUrlnew  = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
145
+                                   boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
146
+                                   if(downLoadFile) {
133
                                        Long caseAppliId = sealSignRecord.getCaseAppliId();
147
                                        Long caseAppliId = sealSignRecord.getCaseAppliId();
134
                                        CaseAttach caseAttach = new CaseAttach();
148
                                        CaseAttach caseAttach = new CaseAttach();
135
                                        caseAttach.setCaseAppliId(caseAppliId);
149
                                        caseAttach.setCaseAppliId(caseAppliId);
137
                                        caseAttach.setAnnexPath(savePath);
151
                                        caseAttach.setAnnexPath(savePath);
138
                                        caseAttach.setAnnexName(saveName);
152
                                        caseAttach.setAnnexName(saveName);
139
                                        caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
153
                                        caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
140
-                                   }*/
154
+                                   }
141
 
155
 
142
                                 }
156
                                 }
143
                             }
157
                             }
149
             }
163
             }
150
         } catch (EsignDemoException e) {
164
         } catch (EsignDemoException e) {
151
             e.printStackTrace();
165
             e.printStackTrace();
166
+        }catch (IOException e) {
167
+            e.printStackTrace();
152
         }
168
         }
153
 
169
 
154
     }
170
     }