Преглед изворни кода

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

wangqiong123 пре 2 година
родитељ
комит
4bc2940f9e

+ 8
- 8
ruoyi-admin/src/main/resources/application.yml Прегледај датотеку

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

+ 19
- 0
ruoyi-common/pom.xml Прегледај датотеку

@@ -18,7 +18,26 @@
18 18
 
19 19
     <dependencies>
20 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>
21 35
 
36
+        <dependency>
37
+            <groupId>commons-io</groupId>
38
+            <artifactId>commons-io</artifactId>
39
+            <version>2.6</version>
40
+        </dependency>
22 41
         <dependency>
23 42
             <groupId>org.jodconverter</groupId>
24 43
             <artifactId>jodconverter-core</artifactId>

+ 0
- 119
ruoyi-common/src/main/java/com/ruoyi/common/utils/LibreOfficeUtil.java Прегледај датотеку

@@ -1,119 +0,0 @@
1
-package com.ruoyi.common.utils;
2
-
3
-import cn.hutool.extra.spring.SpringUtil;
4
-
5
-import com.artofsolving.jodconverter.DocumentConverter;
6
-import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
7
-import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
8
-import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
9
-import com.ruoyi.common.exception.ServiceException;
10
-import lombok.extern.slf4j.Slf4j;
11
-import org.jodconverter.document.DocumentFormat;
12
-import org.jodconverter.office.OfficeException;
13
-import org.springframework.beans.factory.annotation.Value;
14
-import org.springframework.http.MediaType;
15
-
16
-
17
-import java.io.File;
18
-import java.io.IOException;
19
-import java.io.InputStream;
20
-import java.io.OutputStream;
21
-
22
-/**
23
- * LibreOffice工具类,用于将word,excel,ppt等格式文件转为pdf预览
24
- *
25
- * @author xuyuxiang
26
- * @date 2020/7/6 14:55
27
- */
28
-@Slf4j
29
-public class LibreOfficeUtil {
30
-    @Value("${jodconverter.local.office-home}")
31
-    private long OpenOffice_HOME;
32
-
33
-    private static DocumentConverter documentConverter;
34
-
35
-    private static void init() {
36
-        try {
37
-            documentConverter = SpringUtil.getBean(DocumentConverter.class);
38
-        } catch (Exception e) {
39
-            throw new ServiceException();
40
-        }
41
-    }
42
-
43
-
44
-    public static boolean doc2pdf(File docFile, File pdfFile) {
45
-        boolean result = false;// 转换结果
46
-        if (docFile.exists()) {
47
-            if (!pdfFile.exists()) {
48
-                OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
49
-                try {
50
-                    connection.connect();
51
-                    DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
52
-                    converter.convert(docFile, pdfFile);
53
-                    // 关闭连接
54
-                    connection.disconnect();
55
-                    result = true;
56
-
57
-                    log.info("****pdf转换成功,PDF输出:" + pdfFile.getPath() + "****");
58
-                } catch (java.net.ConnectException e) {
59
-                    log.error("openoffice服务未启动", e);
60
-                } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) {
61
-                    log.error("读取转换文件失败", e);
62
-                } catch (Exception e) {
63
-                    log.error("转换失败", e);
64
-                }
65
-            } else {
66
-                result = true;
67
-                log.info("****已经转换为pdf,不需要再进行转化****");
68
-            }
69
-        } else {
70
-            log.info("****需要转换的文档不存在,无法转换****");
71
-        }
72
-        return result;
73
-    }
74
-    /**
75
-     * doc转pdf(程序启动openoffice)
76
-     *
77
-     * @param inputFile 输入文件
78
-     * @param outputFile 输出文件
79
-     * @return
80
-     */
81
-    public static boolean doc2pdf2(File inputFile, File outputFile) {
82
-        boolean result = false;
83
-        // OpenOffice的安装目录
84
-        String OpenOffice_HOME = "D:\\app\\libreOffice";
85
-        if (OpenOffice_HOME.charAt(OpenOffice_HOME.length() - 1) != '/') {
86
-            OpenOffice_HOME += "/";
87
-        }
88
-        Process process = null;
89
-        try {
90
-            // 启动OpenOffice的服务
91
-            String command = OpenOffice_HOME
92
-                    + "program/soffice.exe -headless -accept=\"socket,host=127.0.0.1,port=8100;urp;\"";
93
-            process = Runtime.getRuntime().exec(command);
94
-            // 连接 OpenOffice实例,运行在8100端口
95
-            OpenOfficeConnection connection = new SocketOpenOfficeConnection("127.0.0.1", 8100);
96
-            connection.connect();
97
-
98
-            // 转换
99
-            DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
100
-            converter.convert(inputFile, outputFile);
101
-
102
-            // 关闭连接
103
-            connection.disconnect();
104
-            // 销毁OpenOffice服务的进程
105
-            process.destroy();
106
-
107
-            log.info("****pdf转换成功,PDF输出:" + outputFile.getPath() + "****");
108
-            return true;
109
-        } catch (Exception e) {
110
-            log.error("pdf转换失败", e);
111
-        } finally {
112
-            if (process != null) {
113
-                process.destroy();
114
-            }
115
-        }
116
-        return result;
117
-    }
118
-
119
-}

+ 20
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Прегледај датотеку

@@ -176,6 +176,7 @@ 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) {
@@ -229,6 +230,23 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
229 230
             if (objectiJuris!=null&&objectiJuris == 1) {
230 231
                 datas.put("jurisdictionalObjection", jurisdictionalObjection);
231 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
+
232 250
             // 仲裁员名称
233 251
             datas.put("arbitratorName", caseApplicationById.getArbitratorName());
234 252
             // 审理方式
@@ -237,11 +255,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
237 255
             if (hearDate != null) {
238 256
                 // 审理日期
239 257
                 String hearDateStr = sdf.format(hearDate);
258
+                datas.put("hearDate",hearDateStr);
240 259
                 // todo 线上仲裁/线下仲裁方式未选择
241 260
                 //线上开庭时
242 261
                 if (arbitratMethod == 1) {
243 262
                     String replace = onLine.replace(onLineDate, Optional.ofNullable(hearDateStr).orElse(""));
244 263
                     datas.put("onLine", replace);
264
+
245 265
                 } else {
246 266
                     //书面仲裁时
247 267
                     String replace = written.replace(writtenDate, Optional.ofNullable(hearDateStr).orElse(""));

+ 123
- 114
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Прегледај датотеку

@@ -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 {
@@ -2875,6 +2877,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2875 2877
      * @param userId
2876 2878
      * @return
2877 2879
      */
2880
+    @Override
2878 2881
     public String generateUserSign(String userId) {
2879 2882
         TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, sdkSecretKey);
2880 2883
         return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
@@ -3016,7 +3019,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3016 3019
         if (unzipSuccess) {
3017 3020
             // 查询抓取规则
3018 3021
             // todo 批次需要再上传压缩包时用户填写
3019
-            List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(18L);
3022
+            List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
3020 3023
             if (CollectionUtil.isEmpty(fatchRuleList)) {
3021 3024
               return   error("未设置抓取规则");
3022 3025
             }
@@ -3034,14 +3037,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3034 3037
                 if (fatchMap.size() <= 0) {
3035 3038
                   return   error("从压缩包中未抓取到内容,请检查抓取字段配置");
3036 3039
                 }
3037
-                if (fatchMap.size() > 0) {
3038 3040
 
3039 3041
                     // todo 从压缩包中识别各字段填充到数据库
3040 3042
                     //调用新增案件的接口
3041 3043
                     CaseApplication caseApplication = new CaseApplication();
3042 3044
                     caseApplication.setTemplateId(templateId);
3043
-                    //默认案件标的 todo 案件标的是什么
3044
-                    caseApplication.setCaseSubjectAmount(new BigDecimal(1));
3045
+                    //默认案件标的 todo 案件标的是什么,默认写死
3046
+                    caseApplication.setCaseSubjectAmount(new BigDecimal(10000));
3045 3047
                     // todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
3046 3048
                     // 仲裁请求
3047 3049
                     caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
@@ -3152,14 +3154,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3152 3154
                     caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
3153 3155
                     // 申请人联系地址
3154 3156
                     caseAffiliate.setContactAddress(fatchMap.get("applicantAddress"));
3155
-//                        if(map.get("职务").size()>0) {
3156 3157
 //                            // 法定代表人职务
3157
-//                            caseAffiliate.setCompLegalperPost(map.get("职务").get(0));
3158
-//                            if(map.get("职务").size()>1) {
3159
-//                                // 代理人职务
3160
-//                                caseAffiliate.setAppliAgentTitle(map.get("职务").get(1));
3161
-//                            }
3162
-//                        }
3158
+                   caseAffiliate.setCompLegalperPost(fatchMap.get("compLegalperPost"));
3163 3159
                     // 委托代理人
3164 3160
                     caseAffiliate.setNameAgent(fatchMap.get("agentName"));
3165 3161
                     // 委托代理人联系电话
@@ -3221,7 +3217,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3221 3217
                     if (null != caseApplication.getId()) {
3222 3218
                         List<CaseAttach> caseAttachs = new ArrayList<>();
3223 3219
                         for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
3224
-                            if (entry.getValue().contains("证据材料") || entry.getValue().contains("申请书") || entry.getValue().contains("调解协议") || entry.getValue().contains("情况说明")) {
3225 3220
                                 String pdfUrl = entry.getValue();
3226 3221
                                 File file1 = new File(pdfUrl);
3227 3222
                                 CaseAttach caseAttach = new CaseAttach();
@@ -3231,7 +3226,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3231 3226
                                 // 申请人提供的证据材料
3232 3227
                                 caseAttach.setAnnexType(2);
3233 3228
                                 caseAttachs.add(caseAttach);
3234
-                            }
3229
+
3235 3230
                         }
3236 3231
                         if (CollectionUtil.isNotEmpty(caseAttachs)) {
3237 3232
                             // 新增申请人证据材料
@@ -3239,9 +3234,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3239 3234
                         }
3240 3235
                         return AjaxResult.success("导入成功");
3241 3236
                     }
3242
-                } else {
3243
-                    return AjaxResult.error("文件识别内容失败,请检查");
3244
-                }
3237
+
3245 3238
 
3246 3239
             } else {
3247 3240
                 // 没有找到符合条件的文件
@@ -3282,27 +3275,117 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3282 3275
         }
3283 3276
     }
3284 3277
 
3278
+    public static String readerTxtFile(String filePath){
3279
+        BufferedReader br=null;
3280
+        StringBuilder result=new StringBuilder();
3281
+        try {
3282
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(filePath)),"GBK"));
3283
+            String line=null;
3284
+            while ((line=br.readLine())!=null) {
3285
+                result.append(line).append("\n");
3286
+            }
3287
+        } catch (IOException e) {
3288
+          e.printStackTrace();
3289
+        } finally {
3290
+            if (null!=br){
3291
+                try {
3292
+                    br.close();
3293
+                } catch (IOException e) {
3294
+                    e.printStackTrace();
3295
+                }
3296
+            }
3297
+        }
3298
+        return result.toString();
3299
+    }
3300
+    public static String readWord(String filePath) throws Exception{
3301
+
3302
+        File file = new File(filePath);
3303
+        if(file.length()==0) return ""; // 需要操作原因是可能会空文件问题,如果不做处理,在下面读取中会报错
3304
+        StringBuffer sb = new StringBuffer();
3305
+        String buffer = "";
3306
+        try {
3307
+            if (filePath.endsWith(".doc")) {
3308
+                InputStream is = new FileInputStream(file);
3309
+                WordExtractor ex = new WordExtractor(is);
3310
+                buffer = ex.getText();
3311
+                if(buffer.length() > 0){
3312
+                    //使用回车换行符分割字符串
3313
+                    String [] arry = buffer.split("r\\n");
3314
+                    for (String string : arry) {
3315
+                        sb.append(string.trim());
3316
+                    }
3317
+                }
3318
+            } else if (filePath.endsWith(".docx")) {
3319
+                FileInputStream fis = new FileInputStream(file);
3320
+                XWPFDocument xdoc = new XWPFDocument(fis);
3321
+                XWPFWordExtractor extractor = new XWPFWordExtractor(xdoc);
3322
+                buffer = extractor.getText();
3323
+
3324
+
3325
+
3326
+//                OPCPackage opcPackage = POIXMLDocument.openPackage(filePath);
3327
+//                XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
3328
+//                buffer = extractor.getText();
3329
+                if(buffer.length() > 0){
3330
+                    //使用换行符分割字符串
3331
+                    String [] arry = buffer.split("\r\n");
3332
+                    for (String string : arry) {
3333
+                        sb.append(string.trim());
3334
+                    }
3335
+                }
3336
+            } else {
3337
+                return null;
3338
+            }
3339
+            return sb.toString();
3340
+        } catch (Exception e) {
3341
+            System.out.print("error---->"+filePath);
3342
+            e.printStackTrace();
3343
+            return null;
3344
+        }
3345
+    }
3346
+
3285 3347
     private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF,String mapKey,  Map<String, String> map, List<FatchRule> fatchRules) {
3286 3348
         String pdfUrl = andConvertPDF.get(mapKey);
3287 3349
 
3288 3350
         if(StrUtil.isNotEmpty(pdfUrl)) {
3289
-            //获取文件的页数
3290
-            int fileNumPage = getFileNumPage(pdfUrl);
3291
-            //文件转成base64
3292
-            String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
3293
-            if (base64 == null) {
3294
-                throw new ServiceException("文件转成base64,转码失败pdfUrl:"+pdfUrl);
3295
-                //  return false;
3296
-            }
3297
-            StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
3298
-            for (int i = 1; i <= fileNumPage; i++) {
3299
-                //对接腾讯云接口.识别里面的数据
3300
-                String text = OCRUtils.pdfIdentifyText(base64, i , fatchRules);
3301
-                ocrText.append(text); // 拼接当前的字符串
3302
-            }
3303
-            if(StrUtil.isNotEmpty(ocrText)){
3304
-               OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map);
3351
+            if(pdfUrl.endsWith("txt")){
3352
+                String readerFile = readerTxtFile(pdfUrl);
3353
+                if(StrUtil.isNotEmpty(readerFile)){
3354
+                    OCRUtils.fatchRuleGetContent(readerFile, fatchRules,map);
3355
+                }
3356
+
3357
+            }else if(pdfUrl.endsWith("doc")||pdfUrl.endsWith("docx")){
3358
+                // doc,docx,text识别内容
3359
+                String readerFile = null;
3360
+                try {
3361
+                    readerFile = readWord(pdfUrl);
3362
+                } catch (Exception e) {
3363
+                    e.printStackTrace();
3364
+                }
3365
+                if(StrUtil.isNotEmpty(readerFile)){
3366
+                    OCRUtils.fatchRuleGetContent(readerFile, fatchRules,map);
3367
+                }
3368
+
3369
+            }else if(pdfUrl.endsWith("pdf")){
3370
+                //获取文件的页数
3371
+                int fileNumPage = getFileNumPage(pdfUrl);
3372
+                //文件转成base64
3373
+                String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
3374
+                if (base64 == null) {
3375
+                    throw new ServiceException("文件转成base64,转码失败");
3376
+                    //  return false;
3377
+                }
3378
+                StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
3379
+                for (int i = 1; i <= fileNumPage; i++) {
3380
+                    //对接腾讯云接口.识别里面的数据
3381
+                    String text = OCRUtils.pdfIdentifyText(base64, i, fatchRules);
3382
+                    ocrText.append(text); // 拼接当前的字符串
3383
+                    if(StrUtil.isNotEmpty(ocrText)){
3384
+                        OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map);
3385
+                    }
3386
+                }
3305 3387
             }
3388
+
3306 3389
         }
3307 3390
         return true;
3308 3391
     }
@@ -3367,33 +3450,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3367 3450
        Map<String,String> pdfPathMap= new HashMap<>();
3368 3451
         if (directory.isFile()) {
3369 3452
             String path = "";
3370
-            String fileName = "";
3371 3453
             // 如果传入的参数是一个文件
3372
-     //       if (directory.getName().contains("仲裁申请书")) {
3373
-                if (isPDF(directory)) {
3374
-                    // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
3375 3454
                     path = directory.getAbsolutePath();
3376
-                } else {
3377
-                    String extension = getFileExtension(directory);
3378
-                    if( extension.contains("doc")|| extension.contains("docx")) {
3379
-                        // 如果不是PDF格式,进行转换成PDF并返回路径
3380
-                        String pdfPath = convertToPDF(directory);
3381
-                        if (pdfPath != null) {
3382
-                            path = pdfPath;
3383
-                        }
3384
-                    }
3385
-                }
3386
-                    // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
3387
-                    // 如果是PDF格式,直接添加到列表中
3388
-//                    if(CollectionUtil.isNotEmpty(fatchRuleList)) {
3389
-//                        for (FatchRule fatchRule : fatchRuleList) {
3390
-//                            if(fatchRule.getFileName().contains(directory.getName())){
3391
-                                pdfPathMap.put(directory.getName(), path);
3392
-//                            }
3393
-//                        }
3394
-//
3395
-//                    }
3396
-         //   }
3455
+                    pdfPathMap.put(directory.getName(), path);
3456
+
3397 3457
         } else if (directory.isDirectory()) {
3398 3458
             searchAndConvertPDF(directory, pdfPathMap);
3399 3459
         } else {
@@ -3425,21 +3485,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3425 3485
                 }
3426 3486
                 if (file.isFile()) {
3427 3487
 
3428
-                    // 如果是文件且文件名包含"仲裁申请书"
3429
-                //    if (file.getName().contains("仲裁申请书")) {
3430
-                        if (isPDF(file)) {
3431
-                            // 如果是PDF格式,直接添加到列表中
3432
-                            pdfPathMap.put(file.getName(),file.getAbsolutePath());
3433
-                        } else {
3434
-                            // 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
3435
-                             String   pdfPath = convertToPDF(file);
3436
-                            if (pdfPath != null) {
3437
-                                // 如果是PDF格式,直接添加到列表中
3438
-                                pdfPathMap.put(file.getName(),pdfPath);
3439
-                            }
3440
-                        }
3441
-
3442
-                //    }
3488
+                    pdfPathMap.put(file.getName(),file.getAbsolutePath());
3443 3489
                 } else if (file.isDirectory()) {
3444 3490
                     // 如果是目录,递归查找
3445 3491
                     searchAndConvertPDF(file, pdfPathMap);
@@ -3448,43 +3494,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3448 3494
         }
3449 3495
     }
3450 3496
 
3451
-    private static String convertToPDF(File file) {
3452
-        String wordFilePath = file.getAbsolutePath();
3453
-        // todo
3454
-        String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/";
3455
-//        String pdfSaveDirectory = "D:/home/ruoyi/uploadPath/upload/wordToPDF/";
3456
-        File directory = new File(pdfSaveDirectory);
3457
-        if (!directory.exists()) {
3458
-            directory.mkdirs();
3459
-        }
3460
-        String name = file.getName();
3461
-        String nameWithoutExtension = name.substring(0, name.lastIndexOf("."));
3462
-
3463
-        String pdfFilePath = pdfSaveDirectory + nameWithoutExtension + ".pdf";
3464
-        File inputWord = new File(wordFilePath);
3465
-        if(!inputWord.exists()){
3466
-            throw new ServiceException("文件不存在wordFilePath:"+wordFilePath);
3467
-        }
3468
-        File outputFile = new File(pdfFilePath);
3469
-
3470
-        try {
3471
-            LibreOfficeUtil.doc2pdf2(inputWord,outputFile);
3472
-
3473
-
3474
-//
3475
-//            InputStream docxInputStream = new FileInputStream(inputWord);
3476
-//            OutputStream outputStream = new FileOutputStream(outputFile);
3477
-//            IConverter converter = LocalConverter.builder().build();
3478
-//            converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
3479
-//            docxInputStream.close();
3480
-//            outputStream.close();
3481
-
3482
-        } catch (Exception e) {
3483
-            throw new ServiceException(e.getMessage()+"wordFilePath:"+wordFilePath+"pdfFilePath:"+pdfFilePath);
3484
-           // e.printStackTrace();
3485
-        }
3486
-        return pdfFilePath;
3487
-    }
3488 3497
 
3489 3498
     private static int getFileNumPage(String pdfUrl) {
3490 3499
         File pdfFile = new File(pdfUrl);

+ 3
- 3
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml Прегледај датотеку

@@ -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
@@ -32,7 +32,7 @@
32 32
 
33 33
     <select id="selectFatchRuleListIsDefault" parameterType="FatchRule" resultMap="BaseResultMap">
34 34
         SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
35
-        f.`column` ,f.is_default ,f.columnName
35
+        f.`column` ,f.is_default ,f.`column_name`
36 36
         FROM fatch_rule f
37 37
         <where>
38 38
             <if test="isDefault != null">
@@ -54,7 +54,7 @@
54 54
         <if test="startContent != null and startContent != ''">start_content,</if>
55 55
         <if test="endContent != null and endContent != ''">end_content,</if>
56 56
         <if test="column != null and column != ''">`column`,</if>
57
-        <if test="columnName != null and columnName != ''">columnName,</if>
57
+        <if test="columnName != null and columnName != ''">`column_name`,</if>
58 58
         <if test="isDefault != null">is_default</if>
59 59
         )values(
60 60
         <if test="fileName != null and fileName != ''">#{fileName},</if>