Bläddra i källkod

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Arbitrate-Backend into qtz3

qitz 2 år sedan
förälder
incheckning
0755325701

+ 13
- 1
ruoyi-admin/src/main/resources/application.yml Visa fil

@@ -182,4 +182,16 @@ imConfig:
182 182
   # 腾讯云账户 SecretId
183 183
   secretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
184 184
   # 腾讯云密钥
185
-  secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
185
+  secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
186
+#jodconverter:
187
+#  local:
188
+#    host: 121.40.189.20
189
+    #暂时关闭预览,启动时会有点慢
190
+#    enabled: true
191
+    #设置libreoffice主目录 linux地址如:/usr/lib64/libreoffice
192
+#    office-home: /usr/lib64/libreoffice/
193
+#    office-home: D:\app\libreOffice\
194
+    #开启多个libreoffice进程,每个端口对应一个进程
195
+#    port-numbers: 8100
196
+    #libreoffice进程重启前的最大进程数
197
+#    max-tasks-per-process: 100

+ 64
- 0
ruoyi-common/pom.xml Visa fil

@@ -11,12 +11,76 @@
11 11
 
12 12
     <artifactId>ruoyi-common</artifactId>
13 13
 
14
+
14 15
     <description>
15 16
         common通用工具
16 17
     </description>
17 18
 
18 19
     <dependencies>
19 20
 
21
+        <!--docx文件下载问题-->
22
+        <dependency>
23
+            <groupId>org.apache.poi</groupId>
24
+            <artifactId>poi-ooxml</artifactId>
25
+            <version>4.1.2</version>
26
+        </dependency>
27
+
28
+        <!-- POI依赖,读取.doc型文档-->
29
+        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
30
+        <dependency>
31
+            <groupId>org.apache.poi</groupId>
32
+            <artifactId>poi-scratchpad</artifactId>
33
+            <version>4.1.1</version>
34
+        </dependency>
35
+
36
+        <dependency>
37
+            <groupId>commons-io</groupId>
38
+            <artifactId>commons-io</artifactId>
39
+            <version>2.6</version>
40
+        </dependency>
41
+        <dependency>
42
+            <groupId>org.jodconverter</groupId>
43
+            <artifactId>jodconverter-core</artifactId>
44
+            <version>4.2.0</version>
45
+        </dependency>
46
+        <dependency>
47
+            <groupId>org.jodconverter</groupId>
48
+            <artifactId>jodconverter-local</artifactId>
49
+            <version>4.2.0</version>
50
+        </dependency>
51
+        <dependency>
52
+            <groupId>org.jodconverter</groupId>
53
+            <artifactId>jodconverter-spring-boot-starter</artifactId>
54
+            <version>4.2.0</version>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>com.artofsolving</groupId>
58
+            <artifactId>jodconverter</artifactId>
59
+            <version>2.2.1</version>
60
+        </dependency>
61
+        <dependency>
62
+            <groupId>org.openoffice</groupId>
63
+            <artifactId>jurt</artifactId>
64
+            <version>3.0.1</version>
65
+        </dependency>
66
+        <dependency>
67
+            <groupId>org.openoffice</groupId>
68
+            <artifactId>ridl</artifactId>
69
+            <version>3.0.1</version>
70
+        </dependency>
71
+        <dependency>
72
+            <groupId>org.openoffice</groupId>
73
+            <artifactId>juh</artifactId>
74
+            <version>3.0.1</version>
75
+        </dependency>
76
+        <dependency>
77
+            <groupId>org.openoffice</groupId>
78
+            <artifactId>unoil</artifactId>
79
+            <version>3.0.1</version>
80
+        </dependency>
81
+
82
+
83
+
20 84
         <!-- Spring框架基本的核心工具 -->
21 85
         <dependency>
22 86
             <groupId>org.springframework</groupId>

+ 45
- 13
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Visa fil

@@ -176,11 +176,21 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
176 176
                 Map<String, String> columnValueMap = columnValueList.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue));
177 177
                 agentName=columnValueMap.get("agentName");
178 178
                 resName=columnValueMap.get("respondentName");
179
+                resName=columnValueMap.get("respondentName");
179 180
                 // 懒得if,暂时这样
180 181
                 //
181 182
                 for (String bookmark : bookmarkList) {
182 183
                     if(columnValueMap.containsKey(bookmark)){
183
-                        datas.put(bookmark,columnValueMap.get(bookmark));
184
+                        if(bookmark.equals("resSex")){
185
+                            String responSex = columnValueMap.get(bookmark);
186
+                            if (responSex.equals("0")) {
187
+                                datas.put(bookmark, "男");
188
+                            } else {
189
+                                datas.put(bookmark, "女");
190
+                            }
191
+                        }else {
192
+                            datas.put(bookmark, columnValueMap.get(bookmark));
193
+                        }
184 194
                     }
185 195
                 }
186 196
             }else {
@@ -220,6 +230,23 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
220 230
             if (objectiJuris!=null&&objectiJuris == 1) {
221 231
                 datas.put("jurisdictionalObjection", jurisdictionalObjection);
222 232
             }
233
+
234
+            // 出席庭审人员角色名称
235
+            String attendName="秘书、";
236
+            boolean isAbsenceFlag = caseApplicationById.getIsAbsence() != null && caseApplicationById.getIsAbsence().equals(0);
237
+            boolean appIsAbsenceFlag = caseApplicationById.getAppliIsAbsen() != null && caseApplicationById.getAppliIsAbsen().equals(0);
238
+            if(isAbsenceFlag||appIsAbsenceFlag){
239
+                if(isAbsenceFlag) {
240
+                    attendName += "申请代理人" + agentName+"、";
241
+                }
242
+                if(appIsAbsenceFlag) {
243
+                    attendName += "被申请人" + resName;
244
+                }
245
+                if(attendName.endsWith("、")){
246
+                    agentName=attendName.replace("、","");
247
+                }
248
+            }
249
+
223 250
             // 仲裁员名称
224 251
             datas.put("arbitratorName", caseApplicationById.getArbitratorName());
225 252
             // 审理方式
@@ -228,14 +255,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
228 255
             if (hearDate != null) {
229 256
                 // 审理日期
230 257
                 String hearDateStr = sdf.format(hearDate);
258
+                datas.put("hearDate",hearDateStr);
231 259
                 // todo 线上仲裁/线下仲裁方式未选择
232 260
                 //线上开庭时
233 261
                 if (arbitratMethod == 1) {
234
-                    String replace = onLine.replace(onLineDate, hearDateStr);
262
+                    String replace = onLine.replace(onLineDate, Optional.ofNullable(hearDateStr).orElse(""));
235 263
                     datas.put("onLine", replace);
264
+
236 265
                 } else {
237 266
                     //书面仲裁时
238
-                    String replace = written.replace(writtenDate, hearDateStr);
267
+                    String replace = written.replace(writtenDate, Optional.ofNullable(hearDateStr).orElse(""));
239 268
                     datas.put("written", replace);
240 269
 
241 270
                 }
@@ -252,7 +281,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
252 281
             if (arbitratMethod == 1) {
253 282
                 if (isAbsence != null && isAbsence == 1) {
254 283
                     // 被申请人缺席
255
-                    String absentReplace = absent.replace("{{agentName}}", agentName);
284
+                    String absentReplace = absent.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
256 285
                     datas.put("absent",absentReplace);
257 286
                     // 被申请人缺席
258 287
                     String resAbsentReplace=resAbsent;
@@ -267,7 +296,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
267 296
                     datas.put("resAbsent",resAbsentReplace);
268 297
                 } else {
269 298
                     // 出席
270
-                    String attendReplace = attend.replace("{{agentName}}", agentName);
299
+                    String attendReplace = attend.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
271 300
                     datas.put("attend",attend);
272 301
                     // 被申请人证据
273 302
                     if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){
@@ -281,7 +310,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
281 310
                             for (CaseAttach caseAttach : caseAttaches) {
282 311
                                 stringBuilder.append(caseAttach.getAnnexName()).append("\n");
283 312
                             }
284
-                            resFileRplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", arbitrateRecordSelect.getApplicantOpinion());
313
+                            resFileRplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", Optional.ofNullable(arbitrateRecordSelect.getApplicantOpinion()).orElse(""));
285 314
                         }
286 315
                         datas.put("resFile",resFileRplace);
287 316
                     }else {
@@ -296,7 +325,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
296 325
                         for (CaseAttach caseAttach : caseAttaches) {
297 326
                             stringBuilder.append(caseAttach.getAnnexName()).append("\n");
298 327
                         }
299
-                         resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", arbitrateRecordSelect.getRespondentOpinion());
328
+                         resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", arbitrateRecordSelect.getRespondentOpinion()==null?"":arbitrateRecordSelect.getRespondentOpinion());
300 329
                     }
301 330
 
302 331
                     datas.put("resAttendOpinion",resAttendOpinionReplace);
@@ -306,13 +335,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
306 335
 
307 336
             String month = String.format("%02d", now.getMonthValue());
308 337
             String day = String.format("%02d", now.getDayOfMonth());
309
-            String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
310
-//             String modalFilePath = "D:/新裁决书模板.docx";
311
-            // todo 服务器路径
312
-            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
313
-//             String saveFolderPath = "D:/";
338
+            // todo
339
+//            String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
340
+             String modalFilePath = templatePath;
341
+            // todo
342
+//            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
343
+            String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
314 344
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
315
-            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
345
+            // todo
346
+//            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
347
+            String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
316 348
             String resultFilePath = saveFolderPath + "/" + fileName;
317 349
             // 创建日期目录
318 350
             File saveFolder = new File(saveFolderPath);

+ 123
- 110
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Visa fil

@@ -49,6 +49,13 @@ import com.tencentyun.TLSSigAPIv2;
49 49
 
50 50
 import org.apache.pdfbox.pdmodel.PDDocument;
51 51
 
52
+
53
+import org.apache.poi.hwpf.extractor.WordExtractor;
54
+import org.apache.poi.ooxml.POIXMLDocument;
55
+import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
56
+import org.apache.poi.openxml4j.opc.OPCPackage;
57
+import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
58
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
52 59
 import org.springframework.beans.factory.annotation.Autowired;
53 60
 import org.springframework.beans.factory.annotation.Value;
54 61
 import org.springframework.stereotype.Service;
@@ -1162,11 +1169,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1162 1169
             maxVersion = 1;
1163 1170
         }
1164 1171
         caseApplication.setVersion(maxVersion + 1);
1165
-        // 将修改提交状态改为未提交
1166
-        // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1167
-        // 修改案件表的版本号
1168
-        //   caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
1169
-
1170 1172
         // 异步新增案件日志
1171 1173
         ThreadPoolUtil.execute(() -> {
1172 1174
             try {
@@ -2882,6 +2884,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2882 2884
      * @param userId
2883 2885
      * @return
2884 2886
      */
2887
+    @Override
2885 2888
     public String generateUserSign(String userId) {
2886 2889
         TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, sdkSecretKey);
2887 2890
         return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
@@ -3023,7 +3026,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3023 3026
         if (unzipSuccess) {
3024 3027
             // 查询抓取规则
3025 3028
             // todo 批次需要再上传压缩包时用户填写
3026
-            List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(17L);
3029
+            List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
3027 3030
             if (CollectionUtil.isEmpty(fatchRuleList)) {
3028 3031
               return   error("未设置抓取规则");
3029 3032
             }
@@ -3041,14 +3044,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3041 3044
                 if (fatchMap.size() <= 0) {
3042 3045
                   return   error("从压缩包中未抓取到内容,请检查抓取字段配置");
3043 3046
                 }
3044
-                if (fatchMap.size() > 0) {
3045 3047
 
3046 3048
                     // todo 从压缩包中识别各字段填充到数据库
3047 3049
                     //调用新增案件的接口
3048 3050
                     CaseApplication caseApplication = new CaseApplication();
3049 3051
                     caseApplication.setTemplateId(templateId);
3050
-                    //默认案件标的 todo 案件标的是什么
3051
-                    caseApplication.setCaseSubjectAmount(new BigDecimal(1));
3052
+                    //默认案件标的 todo 案件标的是什么,默认写死
3053
+                    caseApplication.setCaseSubjectAmount(new BigDecimal(10000));
3052 3054
                     // todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
3053 3055
                     // 仲裁请求
3054 3056
                     caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
@@ -3159,14 +3161,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3159 3161
                     caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
3160 3162
                     // 申请人联系地址
3161 3163
                     caseAffiliate.setContactAddress(fatchMap.get("applicantAddress"));
3162
-//                        if(map.get("职务").size()>0) {
3163 3164
 //                            // 法定代表人职务
3164
-//                            caseAffiliate.setCompLegalperPost(map.get("职务").get(0));
3165
-//                            if(map.get("职务").size()>1) {
3166
-//                                // 代理人职务
3167
-//                                caseAffiliate.setAppliAgentTitle(map.get("职务").get(1));
3168
-//                            }
3169
-//                        }
3165
+                   caseAffiliate.setCompLegalperPost(fatchMap.get("compLegalperPost"));
3170 3166
                     // 委托代理人
3171 3167
                     caseAffiliate.setNameAgent(fatchMap.get("agentName"));
3172 3168
                     // 委托代理人联系电话
@@ -3228,7 +3224,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3228 3224
                     if (null != caseApplication.getId()) {
3229 3225
                         List<CaseAttach> caseAttachs = new ArrayList<>();
3230 3226
                         for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
3231
-                            if (entry.getValue().contains("证据材料") || entry.getValue().contains("申请书") || entry.getValue().contains("调解协议") || entry.getValue().contains("情况说明")) {
3232 3227
                                 String pdfUrl = entry.getValue();
3233 3228
                                 File file1 = new File(pdfUrl);
3234 3229
                                 CaseAttach caseAttach = new CaseAttach();
@@ -3238,7 +3233,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3238 3233
                                 // 申请人提供的证据材料
3239 3234
                                 caseAttach.setAnnexType(2);
3240 3235
                                 caseAttachs.add(caseAttach);
3241
-                            }
3236
+
3242 3237
                         }
3243 3238
                         if (CollectionUtil.isNotEmpty(caseAttachs)) {
3244 3239
                             // 新增申请人证据材料
@@ -3246,9 +3241,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3246 3241
                         }
3247 3242
                         return AjaxResult.success("导入成功");
3248 3243
                     }
3249
-                } else {
3250
-                    return AjaxResult.error("文件识别内容失败,请检查");
3251
-                }
3244
+
3252 3245
 
3253 3246
             } else {
3254 3247
                 // 没有找到符合条件的文件
@@ -3289,27 +3282,117 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3289 3282
         }
3290 3283
     }
3291 3284
 
3285
+    public static String readerTxtFile(String filePath){
3286
+        BufferedReader br=null;
3287
+        StringBuilder result=new StringBuilder();
3288
+        try {
3289
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(filePath)),"GBK"));
3290
+            String line=null;
3291
+            while ((line=br.readLine())!=null) {
3292
+                result.append(line).append("\n");
3293
+            }
3294
+        } catch (IOException e) {
3295
+          e.printStackTrace();
3296
+        } finally {
3297
+            if (null!=br){
3298
+                try {
3299
+                    br.close();
3300
+                } catch (IOException e) {
3301
+                    e.printStackTrace();
3302
+                }
3303
+            }
3304
+        }
3305
+        return result.toString();
3306
+    }
3307
+    public static String readWord(String filePath) throws Exception{
3308
+
3309
+        File file = new File(filePath);
3310
+        if(file.length()==0) return ""; // 需要操作原因是可能会空文件问题,如果不做处理,在下面读取中会报错
3311
+        StringBuffer sb = new StringBuffer();
3312
+        String buffer = "";
3313
+        try {
3314
+            if (filePath.endsWith(".doc")) {
3315
+                InputStream is = new FileInputStream(file);
3316
+                WordExtractor ex = new WordExtractor(is);
3317
+                buffer = ex.getText();
3318
+                if(buffer.length() > 0){
3319
+                    //使用回车换行符分割字符串
3320
+                    String [] arry = buffer.split("r\\n");
3321
+                    for (String string : arry) {
3322
+                        sb.append(string.trim());
3323
+                    }
3324
+                }
3325
+            } else if (filePath.endsWith(".docx")) {
3326
+                FileInputStream fis = new FileInputStream(file);
3327
+                XWPFDocument xdoc = new XWPFDocument(fis);
3328
+                XWPFWordExtractor extractor = new XWPFWordExtractor(xdoc);
3329
+                buffer = extractor.getText();
3330
+
3331
+
3332
+
3333
+//                OPCPackage opcPackage = POIXMLDocument.openPackage(filePath);
3334
+//                XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
3335
+//                buffer = extractor.getText();
3336
+                if(buffer.length() > 0){
3337
+                    //使用换行符分割字符串
3338
+                    String [] arry = buffer.split("\r\n");
3339
+                    for (String string : arry) {
3340
+                        sb.append(string.trim());
3341
+                    }
3342
+                }
3343
+            } else {
3344
+                return null;
3345
+            }
3346
+            return sb.toString();
3347
+        } catch (Exception e) {
3348
+            System.out.print("error---->"+filePath);
3349
+            e.printStackTrace();
3350
+            return null;
3351
+        }
3352
+    }
3353
+
3292 3354
     private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF,String mapKey,  Map<String, String> map, List<FatchRule> fatchRules) {
3293 3355
         String pdfUrl = andConvertPDF.get(mapKey);
3294 3356
 
3295 3357
         if(StrUtil.isNotEmpty(pdfUrl)) {
3296
-            //获取文件的页数
3297
-            int fileNumPage = getFileNumPage(pdfUrl);
3298
-            //文件转成base64
3299
-            String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
3300
-            if (base64 == null) {
3301
-                throw new ServiceException("文件转成base64,转码失败");
3302
-                //  return false;
3303
-            }
3304
-            StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
3305
-            for (int i = 1; i <= fileNumPage; i++) {
3306
-                //对接腾讯云接口.识别里面的数据
3307
-                String text = OCRUtils.pdfIdentifyText(base64, i , fatchRules);
3308
-                ocrText.append(text); // 拼接当前的字符串
3309
-            }
3310
-            if(StrUtil.isNotEmpty(ocrText)){
3311
-               OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map);
3358
+            if(pdfUrl.endsWith("txt")){
3359
+                String readerFile = readerTxtFile(pdfUrl);
3360
+                if(StrUtil.isNotEmpty(readerFile)){
3361
+                    OCRUtils.fatchRuleGetContent(readerFile, fatchRules,map);
3362
+                }
3363
+
3364
+            }else if(pdfUrl.endsWith("doc")||pdfUrl.endsWith("docx")){
3365
+                // doc,docx,text识别内容
3366
+                String readerFile = null;
3367
+                try {
3368
+                    readerFile = readWord(pdfUrl);
3369
+                } catch (Exception e) {
3370
+                    e.printStackTrace();
3371
+                }
3372
+                if(StrUtil.isNotEmpty(readerFile)){
3373
+                    OCRUtils.fatchRuleGetContent(readerFile, fatchRules,map);
3374
+                }
3375
+
3376
+            }else if(pdfUrl.endsWith("pdf")){
3377
+                //获取文件的页数
3378
+                int fileNumPage = getFileNumPage(pdfUrl);
3379
+                //文件转成base64
3380
+                String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
3381
+                if (base64 == null) {
3382
+                    throw new ServiceException("文件转成base64,转码失败");
3383
+                    //  return false;
3384
+                }
3385
+                StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
3386
+                for (int i = 1; i <= fileNumPage; i++) {
3387
+                    //对接腾讯云接口.识别里面的数据
3388
+                    String text = OCRUtils.pdfIdentifyText(base64, i, fatchRules);
3389
+                    ocrText.append(text); // 拼接当前的字符串
3390
+                    if(StrUtil.isNotEmpty(ocrText)){
3391
+                        OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map);
3392
+                    }
3393
+                }
3312 3394
             }
3395
+
3313 3396
         }
3314 3397
         return true;
3315 3398
     }
@@ -3374,33 +3457,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3374 3457
        Map<String,String> pdfPathMap= new HashMap<>();
3375 3458
         if (directory.isFile()) {
3376 3459
             String path = "";
3377
-            String fileName = "";
3378 3460
             // 如果传入的参数是一个文件
3379
-     //       if (directory.getName().contains("仲裁申请书")) {
3380
-                if (isPDF(directory)) {
3381
-                    // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
3382 3461
                     path = directory.getAbsolutePath();
3383
-                } else {
3384
-                    String extension = getFileExtension(directory);
3385
-                    if( extension.contains("doc")|| extension.contains("docx")) {
3386
-                        // 如果不是PDF格式,进行转换成PDF并返回路径
3387
-                        String pdfPath = convertToPDF(directory);
3388
-                        if (pdfPath != null) {
3389
-                            path = pdfPath;
3390
-                        }
3391
-                    }
3392
-                }
3393
-                    // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
3394
-                    // 如果是PDF格式,直接添加到列表中
3395
-//                    if(CollectionUtil.isNotEmpty(fatchRuleList)) {
3396
-//                        for (FatchRule fatchRule : fatchRuleList) {
3397
-//                            if(fatchRule.getFileName().contains(directory.getName())){
3398
-                                pdfPathMap.put(directory.getName(), path);
3399
-//                            }
3400
-//                        }
3401
-//
3402
-//                    }
3403
-         //   }
3462
+                    pdfPathMap.put(directory.getName(), path);
3463
+
3404 3464
         } else if (directory.isDirectory()) {
3405 3465
             searchAndConvertPDF(directory, pdfPathMap);
3406 3466
         } else {
@@ -3432,21 +3492,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3432 3492
                 }
3433 3493
                 if (file.isFile()) {
3434 3494
 
3435
-                    // 如果是文件且文件名包含"仲裁申请书"
3436
-                //    if (file.getName().contains("仲裁申请书")) {
3437
-                        if (isPDF(file)) {
3438
-                            // 如果是PDF格式,直接添加到列表中
3439
-                            pdfPathMap.put(file.getName(),file.getAbsolutePath());
3440
-                        } else {
3441
-                            // 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
3442
-                             String   pdfPath = convertToPDF(file);
3443
-                            if (pdfPath != null) {
3444
-                                // 如果是PDF格式,直接添加到列表中
3445
-                                pdfPathMap.put(file.getName(),pdfPath);
3446
-                            }
3447
-                        }
3448
-
3449
-                //    }
3495
+                    pdfPathMap.put(file.getName(),file.getAbsolutePath());
3450 3496
                 } else if (file.isDirectory()) {
3451 3497
                     // 如果是目录,递归查找
3452 3498
                     searchAndConvertPDF(file, pdfPathMap);
@@ -3455,39 +3501,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3455 3501
         }
3456 3502
     }
3457 3503
 
3458
-    private static String convertToPDF(File file) {
3459
-        String wordFilePath = file.getAbsolutePath();
3460
-        // todo
3461
-        String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/";
3462
-//        String pdfSaveDirectory = "D:/home/ruoyi/uploadPath/upload/wordToPDF/";
3463
-        File directory = new File(pdfSaveDirectory);
3464
-        if (!directory.exists()) {
3465
-            directory.mkdirs();
3466
-        }
3467
-        String name = file.getName();
3468
-        String nameWithoutExtension = name.substring(0, name.lastIndexOf("."));
3469
-
3470
-        String pdfFilePath = pdfSaveDirectory + nameWithoutExtension + ".pdf";
3471
-        File inputWord = new File(wordFilePath);
3472
-        if(!inputWord.exists()){
3473
-            throw new ServiceException("文件不存在wordFilePath:"+wordFilePath);
3474
-        }
3475
-        File outputFile = new File(pdfFilePath);
3476
-
3477
-        try {
3478
-            InputStream docxInputStream = new FileInputStream(inputWord);
3479
-            OutputStream outputStream = new FileOutputStream(outputFile);
3480
-            IConverter converter = LocalConverter.builder().build();
3481
-            converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
3482
-            docxInputStream.close();
3483
-            outputStream.close();
3484
-
3485
-        } catch (Exception e) {
3486
-            throw new ServiceException(e.getMessage()+"wordFilePath:"+wordFilePath+"pdfFilePath:"+pdfFilePath);
3487
-           // e.printStackTrace();
3488
-        }
3489
-        return pdfFilePath;
3490
-    }
3491 3504
 
3492 3505
     private static int getFileNumPage(String pdfUrl) {
3493 3506
         File pdfFile = new File(pdfUrl);

+ 1
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Visa fil

@@ -1432,7 +1432,7 @@
1432 1432
         c.disputes,
1433 1433
         c.loan_type,
1434 1434
         c.loan_term,
1435
-        c.mediation_agreement
1435
+        c.mediation_agreement,c.template_id templateId
1436 1436
         from case_application c
1437 1437
         LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
1438 1438
 

+ 3
- 3
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml Visa fil

@@ -19,7 +19,7 @@
19 19
 
20 20
     <select id="selectFatchRuleList" parameterType="FatchRule" resultMap="BaseResultMap">
21 21
         SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
22
-        f.`column` ,f.is_default ,f.columnName
22
+        f.`column` ,f.is_default ,f.`column_name`
23 23
         FROM template_fatch_rule tf
24 24
         left join template_manage t on tf.template_id  = t.id
25 25
         LEFT JOIN fatch_rule f on tf.fatch_rule_id  = f.id
@@ -65,7 +65,7 @@
65 65
 
66 66
     <select id="selectFatchRuleListIsDefault" parameterType="FatchRule" resultMap="BaseResultMap">
67 67
         SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
68
-        f.`column` ,f.is_default ,f.columnName
68
+        f.`column` ,f.is_default ,f.`column_name`
69 69
         FROM fatch_rule f
70 70
         <where>
71 71
             <if test="isDefault != null">
@@ -87,7 +87,7 @@
87 87
         <if test="startContent != null and startContent != ''">start_content,</if>
88 88
         <if test="endContent != null and endContent != ''">end_content,</if>
89 89
         <if test="column != null and column != ''">`column`,</if>
90
-        <if test="columnName != null and columnName != ''">columnName,</if>
90
+        <if test="columnName != null and columnName != ''">`column_name`,</if>
91 91
         <if test="isDefault != null">is_default</if>
92 92
         )values(
93 93
         <if test="fileName != null and fileName != ''">#{fileName},</if>