Ver código fonte

生成裁决书修改

18792927508 2 anos atrás
pai
commit
ba6237853e

+ 8
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java Ver arquivo

@@ -28,6 +28,14 @@ public class Constants
28 28
      * http请求
29 29
      */
30 30
     public static final String HTTP = "http://";
31
+    /**
32
+     * br标签
33
+     */
34
+    public static final String BR = "</br>";
35
+    /**
36
+     * pdf拼接符
37
+     */
38
+    public static final String PDFSTR = "∰";
31 39
 
32 40
     /**
33 41
      * https请求

+ 16
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/ArbitrateRecord.java Ver arquivo

@@ -38,6 +38,22 @@ public class ArbitrateRecord     extends BaseEntity {
38 38
     private Integer appliIsAbsen;
39 39
     /** 被申请人质证意见 */
40 40
     private String responDefenOpini;
41
+    /**
42
+     * 本案争议焦点
43
+     */
44
+    private String caseFocus;
45
+    /**
46
+     * 本案事实
47
+     */
48
+    private String caseFacts;
49
+    /**
50
+     * 被申请人对上述材料的质证意见
51
+     */
52
+    private String respondentOpinion;
53
+    /**
54
+     * 申请人对上述材料的质证意见
55
+     */
56
+    private String applicantOpinion;
41 57
 
42 58
 
43 59
 

+ 13
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAffiliate.java Ver arquivo

@@ -61,6 +61,19 @@ public class CaseAffiliate   extends BaseEntity {
61 61
      */
62 62
     private String changeColumn;
63 63
 
64
+    /**
65
+     * 代理人邮箱
66
+     */
67
+    private String agentEmail;
68
+
69
+    public String getAgentEmail() {
70
+        return agentEmail;
71
+    }
72
+
73
+    public void setAgentEmail(String agentEmail) {
74
+        this.agentEmail = agentEmail;
75
+    }
76
+
64 77
     public String getChangeColumn() {
65 78
         return changeColumn;
66 79
     }
@@ -126,9 +139,6 @@ public class CaseAffiliate   extends BaseEntity {
126 139
         this.responSex = responSex;
127 140
     }
128 141
 
129
-
130
-
131
-
132 142
     /** 身份证号 */
133 143
     @Excel(name = "身份证号")
134 144
     private String identityNum;

+ 152
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java Ver arquivo

@@ -829,6 +829,16 @@ public class CaseApplication  extends BaseEntity {
829 829
      * 修改案件的提交状态,0-未提交,1-已提交,2-同意,3-拒绝,4-撤销
830 830
      */
831 831
     private Integer updateSubmitStatus;
832
+    /** 合同名称 */
833
+    private String contractName;
834
+
835
+    public String getContractName() {
836
+        return contractName;
837
+    }
838
+
839
+    public void setContractName(String contractName) {
840
+        this.contractName = contractName;
841
+    }
832 842
 
833 843
     public Integer getVersion() {
834 844
         return version;
@@ -1180,10 +1190,152 @@ public class CaseApplication  extends BaseEntity {
1180 1190
         this.caseAffiliates = caseAffiliates;
1181 1191
     }
1182 1192
 
1193
+    /**
1194
+     * 事实和理由
1195
+     */
1196
+    private String facts;
1197
+    /**
1198
+     * 合同甲方
1199
+     */
1200
+    private String partyA;
1201
+    /**
1202
+     * 利率
1203
+     */
1204
+    private String interestRate;
1205
+    /**
1206
+     * 待还金额
1207
+     */
1208
+    private String outstandingMoney;
1209
+    /**
1210
+     * 调解达成协议内容
1211
+     */
1212
+    private String mediationAgreement;
1213
+    /**
1214
+     * 金融消费纠纷基本情况
1215
+     */
1216
+    private String disputes;
1217
+    /**
1218
+     * 贷款类型
1219
+     */
1220
+    private String loanType;
1221
+    /**
1222
+     * 贷款期限
1223
+     */
1224
+    private String loanTerm;
1225
+    /**
1226
+     * 本案争议焦点
1227
+     */
1228
+    private String caseFocus;
1229
+    /**
1230
+     * 本案事实
1231
+     */
1232
+    private String caseFacts;
1233
+    /**
1234
+     * 被申请人对上述材料的质证意见
1235
+     */
1236
+    private String respondentOpinion;
1237
+    /**
1238
+     * 申请人对上述材料的质证意见
1239
+     */
1240
+    private String applicantOpinion;
1241
+
1242
+    public String getCaseFocus() {
1243
+        return caseFocus;
1244
+    }
1245
+
1246
+    public void setCaseFocus(String caseFocus) {
1247
+        this.caseFocus = caseFocus;
1248
+    }
1249
+
1250
+    public String getCaseFacts() {
1251
+        return caseFacts;
1252
+    }
1253
+
1254
+    public void setCaseFacts(String caseFacts) {
1255
+        this.caseFacts = caseFacts;
1256
+    }
1257
+
1258
+    public String getRespondentOpinion() {
1259
+        return respondentOpinion;
1260
+    }
1261
+
1262
+    public void setRespondentOpinion(String respondentOpinion) {
1263
+        this.respondentOpinion = respondentOpinion;
1264
+    }
1265
+
1266
+    public String getApplicantOpinion() {
1267
+        return applicantOpinion;
1268
+    }
1269
+
1270
+    public void setApplicantOpinion(String applicantOpinion) {
1271
+        this.applicantOpinion = applicantOpinion;
1272
+    }
1273
+
1274
+    public String getDisputes() {
1275
+        return disputes;
1276
+    }
1277
+
1278
+    public void setDisputes(String disputes) {
1279
+        this.disputes = disputes;
1280
+    }
1281
+
1282
+    public String getLoanType() {
1283
+        return loanType;
1284
+    }
1285
+
1286
+    public void setLoanType(String loanType) {
1287
+        this.loanType = loanType;
1288
+    }
1289
+
1290
+    public String getLoanTerm() {
1291
+        return loanTerm;
1292
+    }
1293
+
1294
+    public void setLoanTerm(String loanTerm) {
1295
+        this.loanTerm = loanTerm;
1296
+    }
1297
+
1298
+    public String getMediationAgreement() {
1299
+        return mediationAgreement;
1300
+    }
1301
+
1302
+    public void setMediationAgreement(String mediationAgreement) {
1303
+        this.mediationAgreement = mediationAgreement;
1304
+    }
1305
+
1306
+    public static long getSerialVersionUID() {
1307
+        return serialVersionUID;
1308
+    }
1309
+
1310
+    public String getFacts() {
1311
+        return facts;
1312
+    }
1183 1313
 
1314
+    public void setFacts(String facts) {
1315
+        this.facts = facts;
1316
+    }
1184 1317
 
1318
+    public String getPartyA() {
1319
+        return partyA;
1320
+    }
1185 1321
 
1322
+    public void setPartyA(String partyA) {
1323
+        this.partyA = partyA;
1324
+    }
1186 1325
 
1326
+    public String getInterestRate() {
1327
+        return interestRate;
1328
+    }
1187 1329
 
1330
+    public void setInterestRate(String interestRate) {
1331
+        this.interestRate = interestRate;
1332
+    }
1333
+
1334
+    public String getOutstandingMoney() {
1335
+        return outstandingMoney;
1336
+    }
1188 1337
 
1338
+    public void setOutstandingMoney(String outstandingMoney) {
1339
+        this.outstandingMoney = outstandingMoney;
1340
+    }
1189 1341
 }

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java Ver arquivo

@@ -10,6 +10,7 @@ import java.util.List;
10 10
 @Mapper
11 11
 public interface CaseAttachMapper {
12 12
     int save(CaseAttach caseAttach);
13
+    int batchSave(@Param("list") List<CaseAttach> caseAttach);
13 14
 
14 15
     List<CaseAttach>  queryAnnexPathByCaseId(Long id);
15 16
 

+ 87
- 33
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Ver arquivo

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3 3
 import cn.hutool.core.collection.CollectionUtil;
4
+import cn.hutool.core.util.StrUtil;
4 5
 import com.alibaba.fastjson.JSON;
5 6
 import com.alibaba.fastjson.JSONObject;
6 7
 import com.deepoove.poi.data.PictureRenderData;
@@ -31,12 +32,14 @@ import org.springframework.stereotype.Service;
31 32
 import org.springframework.transaction.annotation.Transactional;
32 33
 
33 34
 import java.io.*;
35
+import java.math.BigDecimal;
34 36
 import java.net.HttpURLConnection;
35 37
 import java.net.URL;
36 38
 import java.net.URLEncoder;
37 39
 import java.nio.file.Files;
38 40
 import java.nio.file.Path;
39 41
 import java.nio.file.StandardCopyOption;
42
+import java.text.NumberFormat;
40 43
 import java.text.SimpleDateFormat;
41 44
 import java.time.LocalDate;
42 45
 import java.util.*;
@@ -92,12 +95,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
92 95
             CaseAffiliate caseAffiliate = new CaseAffiliate();
93 96
             caseAffiliate.setCaseAppliId(id);
94 97
             List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
98
+            String applicantName="";
99
+            String debtorName = "";
95 100
             List<String> nameAgentList = new ArrayList<>();
96 101
             if (caseAffiliates != null && caseAffiliates.size() > 0) {
97 102
                 for (CaseAffiliate affiliate : caseAffiliates) {
98 103
                     //获取身份类型
99 104
                     int identityType = affiliate.getIdentityType();
100 105
                     if (identityType == 1) {    //申请人
106
+                        applicantName=affiliate.getName();
101 107
                         datas.put("appName", affiliate.getName());
102 108
                         datas.put("appAddress", affiliate.getResidenAffili());
103 109
                         datas.put("appContactAddress", affiliate.getContactAddress());
@@ -107,6 +113,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
107 113
                         datas.put("appAgentTitle", affiliate.getAppliAgentTitle());
108 114
                         nameAgentList.add(affiliate.getNameAgent());
109 115
                     } else if (identityType == 2) {  //被申请人
116
+                        debtorName=affiliate.getName();
110 117
                         datas.put("resName", affiliate.getName());
111 118
                         datas.put("resAddress", affiliate.getResidenAffili());
112 119
                         String responSex = affiliate.getResponSex();
@@ -119,7 +126,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
119 126
                         }
120 127
                         Date responBirth = affiliate.getResponBirth();
121 128
                         if (responBirth != null) {
122
-                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
129
+                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
123 130
                             String responBirthStr = sdf.format(responBirth);
124 131
                             datas.put("resDateOfBirth", responBirthStr);
125 132
                         }
@@ -129,7 +136,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
129 136
                 }
130 137
             }
131 138
             Date createTime = caseApplication1.getCreateTime();
132
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
139
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
133 140
             // 将日期格式化为字符串
134 141
             String createTimeStr = sdf.format(createTime);
135 142
             datas.put("submissionDate", createTimeStr);
@@ -176,6 +183,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
176 183
             Date hearDate = caseApplication1.getHearDate();
177 184
             if (hearDate != null) {
178 185
                 String hearDateStr = sdf.format(hearDate);
186
+
187
+
179 188
                 //线上开庭时
180 189
                 if (arbitratMethod == 1) {
181 190
                     String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
@@ -192,6 +201,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
192 201
                     datas.put("written2", written2);
193 202
                 }
194 203
             }
204
+
195 205
             Integer isAbsence = caseApplication1.getIsAbsence();
196 206
             if (isAbsence == null) {
197 207
                 datas.put("absent1", null);
@@ -246,7 +256,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
246 256
                 datas.put("attend5", attend5);
247 257
                 datas.put("attend6", attend6);
248 258
                 datas.put("attend7", attend7);
249
-                datas.put("responCrossOpin", caseApplication1.getResponCrossOpin());
259
+                datas.put("responCrossOpin", arbitrateRecord1.getRespondentOpinion());
250 260
                 datas.put("appAgentName2", nameAgentList.get(0));
251 261
                 datas.put("resAgentName", nameAgentList.get(1));
252 262
                 if (arbitratMethod == 1) {
@@ -261,51 +271,93 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
261 271
                     datas.put("attend9", attend9);
262 272
                 }
263 273
             }
264
-            datas.put("claims", caseApplication1.getArbitratClaims());
265
-            datas.put("request", caseApplication1.getRequestRule());
274
+            // 申请人的仲裁请求及事实和理由   申请人称  在事实与理由抓取
275
+            datas.put("claims", caseApplication1.getFacts());
276
+//            datas.put("request", caseApplication1.getRequestRule());
266 277
             CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
278
+            // todo 合同编号
279
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
280
+          //  datas.put("partyA", caseApplication2.getContractNumber());
281
+         //   Date loanStartDate = caseApplication2.getLoanStartDate();
282
+          //  datas.put("lonStartDate",simpleDateFormat.format(loanStartDate));
283
+          //  datas.put("contractNumber",caseApplication2.getContractNumber());
284
+            // 合同名称
285
+           // datas.put("contractName",caseApplication2.getContractName());
286
+            // todo 查询该批号的裁决内容模板
287
+            String template="一、被申请人{1}应于{2}前向申请人{3}一次性支付剩余贷款{4}元。\n" +
288
+                    "二、本案仲裁费人民币{5}元(已由申请人预缴),由申请人{6}承担\n";
289
+            Date loanEndDate = caseApplication2.getLoanEndDate();
290
+
291
+            String outstandingMoney = caseApplication2.getOutstandingMoney();
292
+            NumberFormat format = NumberFormat.getInstance();
293
+            String outstandingMoneyFormat="";
294
+
295
+            if(StrUtil.isNotEmpty(outstandingMoney)) {
296
+                 outstandingMoneyFormat = format.format(new BigDecimal(outstandingMoney));
297
+            }
298
+            String rulingFollows = template.replace("{1}", debtorName).replace("{2}", simpleDateFormat.format(loanEndDate))
299
+                    .replace("{3}", applicantName).replace("{4}", outstandingMoneyFormat)
300
+                    .replace("{5}", String.valueOf(caseApplication2.getFeePayable()))
301
+                    .replace("{6}", applicantName);
302
+            // 请求仲裁庭裁决
303
+            datas.put("request", caseApplication1.getArbitratClaims());
267 304
             List<CaseAttach> caseAttachList1 = caseApplication2.getCaseAttachList();
268 305
             if (caseAttachList1 != null && caseAttachList1.size() > 0) {
306
+                StringBuilder debtorFiles=new StringBuilder();
307
+                StringBuilder applicantFiles=new StringBuilder();
269 308
                 for (CaseAttach caseAttach : caseAttachList1) {
270 309
                     if (caseAttach.getAnnexType() == 6) {   //被申请人证据材料
271
-                        String annexName = caseAttach.getAnnexName();
272
-                        boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
273
-                        if (isImageFile) {
274
-                            String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
275
-                            System.out.println("路径是===========" + annexPath);
276
-                            PictureRenderData pictureRenderData = WordUtil
277
-                                    .rebuildImageContent(100, 100, null, annexPath);
278
-                            datas.put("resEvidenceMaterial", pictureRenderData);
279
-                        }
310
+                        debtorFiles.append(caseAttach.getAnnexName()).append("\r\n");
311
+//                        boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
312
+//                        if (isImageFile) {
313
+//                            String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
314
+//                            System.out.println("路径是===========" + annexPath);
315
+//                            PictureRenderData pictureRenderData = WordUtil
316
+//                                    .rebuildImageContent(100, 100, null, annexPath);
317
+//                            datas.put("resEvidenceMaterial", pictureRenderData);
318
+//                        }
319
+
280 320
                     } else if (caseAttach.getAnnexType() == 2) {   //申请人证据材料
281
-                        String annexName = caseAttach.getAnnexName();
282
-                        boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
283
-                        if (isImageFile) {
284
-                            String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
285
-                            System.out.println("路径是===========" + annexPath);
286
-                            PictureRenderData pictureRenderData = WordUtil
287
-                                    .rebuildImageContent(100, 100, null, annexPath);
288
-                            //申请人证据材料
289
-                            datas.put("appEvidenceMaterial", pictureRenderData);
290
-                        }
321
+//                        String annexName = caseAttach.getAnnexName();
322
+//                        boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
323
+//                        if (isImageFile) {
324
+//                            String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
325
+//                            System.out.println("路径是===========" + annexPath);
326
+//                            PictureRenderData pictureRenderData = WordUtil
327
+//                                    .rebuildImageContent(100, 100, null, annexPath);
328
+//                            //申请人证据材料
329
+//                            datas.put("appEvidenceMaterial", pictureRenderData);
330
+//                        }
331
+                        applicantFiles.append(caseAttach.getAnnexName()).append("\r\n");
332
+
291 333
                     }
292 334
                 }
335
+                // //被申请人证据材料
336
+                datas.put("resEvidenceMaterial", debtorFiles.toString());
337
+                //申请人证据材料
338
+                datas.put("appEvidenceMaterial", applicantFiles.toString());
293 339
             }
294
-            datas.put("applicaCrossOpin", "被申请人证据不足,无法说明事实");
295
-
296
-            datas.put("factDetermi", "被申请人欠款属实");
297
-            datas.put("arbitrateThink", " 被申请人应按约定还款");
298
-            datas.put("rulingFollows", "被申请人依法偿还申请人欠款");
340
+            // 申请人对上述材料的质证意见为
341
+            datas.put("applicaCrossOpin", arbitrateRecord1.getApplicantOpinion());
342
+            // 仲裁庭经审理,查明本案事实如下:
343
+            datas.put("factDetermi", arbitrateRecord1.getCaseFacts());
344
+            // 关于本案争议焦点
345
+            datas.put("arbitrateThink", arbitrateRecord1.getCaseFocus());
346
+//            datas.put("rulingFollows", "被申请人依法偿还申请人欠款");
347
+            // 最终裁决
348
+            datas.put("rulingFollows", rulingFollows);
299 349
 
300 350
             LocalDate now = LocalDate.now();
301 351
             String year = Integer.toString(now.getYear());
302 352
             datas.put("year", year);
303 353
             String month = String.format("%02d", now.getMonthValue());
304 354
             String day = String.format("%02d", now.getDayOfMonth());
305
-            String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
306
-            // String modalFilePath = "D:/develop/新裁决书模板.docx";
307
-            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
308
-            // String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
355
+            // todo 服务器路径
356
+//            String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
357
+             String modalFilePath = "D:/新裁决书模板.docx";
358
+            // todo 服务器路径
359
+         //   String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
360
+             String saveFolderPath = "D:/";
309 361
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
310 362
             String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
311 363
             String resultFilePath = saveFolderPath + "/" + fileName;
@@ -1045,4 +1097,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
1045 1097
             return s;
1046 1098
         }
1047 1099
     }
1100
+
1101
+
1048 1102
 }

+ 425
- 82
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Ver arquivo

@@ -17,6 +17,7 @@ import com.google.gson.JsonObject;
17 17
 import com.ruoyi.common.annotation.DataScope;
18 18
 import com.ruoyi.common.config.RuoYiConfig;
19 19
 import com.ruoyi.common.constant.CaseApplicationConstants;
20
+import com.ruoyi.common.constant.Constants;
20 21
 import com.ruoyi.common.core.domain.AjaxResult;
21 22
 import com.ruoyi.common.core.domain.entity.*;
22 23
 import com.ruoyi.common.core.domain.model.LoginUser;
@@ -66,11 +67,14 @@ import java.math.RoundingMode;
66 67
 import java.nio.file.Files;
67 68
 import java.nio.file.Path;
68 69
 import java.nio.file.StandardCopyOption;
70
+import java.text.NumberFormat;
71
+import java.text.ParseException;
69 72
 import java.text.SimpleDateFormat;
70 73
 import java.time.LocalDate;
71 74
 import java.time.ZoneId;
72 75
 import java.util.*;
73 76
 import java.util.function.Function;
77
+import java.util.regex.Matcher;
74 78
 import java.util.regex.Pattern;
75 79
 import java.util.stream.Collectors;
76 80
 import java.util.zip.ZipEntry;
@@ -389,8 +393,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
389 393
         if (file.isEmpty()) {
390 394
             return AjaxResult.error("请选择要上传的文件");
391 395
         }
392
-        String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
393
-        // String targetPath = "D:\\home\\unzip\\";
396
+        // todo 服务器上要放开
397
+//        String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
398
+         String targetPath = "D:/zip";
394 399
         File zipFile = null;
395 400
         InputStream ins = null;
396 401
         try {
@@ -407,7 +412,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
407 412
         String zipName = file.getOriginalFilename();
408 413
         String subzipName = zipName.substring(0, zipName.indexOf(".zip"));
409 414
 //        String zipPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile\\"+subzipName;
410
-        String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName;
415
+        // todo 服务器上要放开
416
+//        String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName;
417
+        String zipPath = "D:/" + subzipName;
411 418
 
412 419
         File dirUnzipPath = new File(zipPath);
413 420
         List<File> allFiles = new ArrayList<>();
@@ -1360,7 +1367,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1360 1367
     public int deletecaseApplicationByIds(List<Long> ids) {
1361 1368
         int rows = caseApplicationMapper.batchDeletecaseApplication(ids);
1362 1369
         caseAffiliateMapper.batchDeletecaseAffiliate(ids);
1363
-        caseApplicationLogMapper.batchDeleteLog(ids);
1370
+      //  caseApplicationLogMapper.batchDeleteLog(ids);
1364 1371
         return rows;
1365 1372
     }
1366 1373
 
@@ -2296,14 +2303,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2296 2303
         if (createBy != null) {
2297 2304
             arbitrateRecordselect.setCreateBy(createBy);
2298 2305
         }
2299
-
2306
+        //
2300 2307
         CaseApplication caseApplicationupdate = new CaseApplication();
2301 2308
         caseApplicationupdate.setId(arbitrateRecordselect.getCaseAppliId());
2302 2309
         caseApplicationupdate.setIsAbsence(arbitrateRecordselect.getIsAbsence());
2303 2310
         caseApplicationupdate.setAppliIsAbsen(arbitrateRecordselect.getAppliIsAbsen());
2304
-        caseApplicationupdate.setResponCrossOpin(arbitrateRecordselect.getResponCrossOpin());
2305
-        caseApplicationupdate.setApplicaCrossOpin(arbitrateRecordselect.getApplicaCrossOpin());
2306
-        caseApplicationupdate.setResponDefenOpini(arbitrateRecordselect.getResponDefenOpini());
2311
+        caseApplicationupdate.setRespondentOpinion(arbitrateRecordselect.getRespondentOpinion());
2312
+        caseApplicationupdate.setApplicantOpinion(arbitrateRecordselect.getApplicantOpinion());
2313
+        caseApplicationupdate.setCaseFacts(arbitrateRecordselect.getCaseFacts());
2314
+        caseApplicationupdate.setCaseFocus(arbitrateRecordselect.getCaseFocus());
2307 2315
         caseApplicationMapper.submitCaseApplication(caseApplicationupdate);
2308 2316
 
2309 2317
         //先判断案件是否已经提交过仲裁结果
@@ -2914,15 +2922,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2914 2922
             return AjaxResult.error("请选择要上传的文件");
2915 2923
         }
2916 2924
         UUID uuid = UUID.randomUUID();
2917
-        String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
2918
-        //String targetPath = "D:/home/unzip/" + uuid + "/";
2925
+        // todo 服务器上要放开
2926
+//        String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
2927
+        String targetPath = "D:/zip";
2919 2928
         File zipFile = null;
2920 2929
         InputStream ins = null;
2921 2930
         try {
2922 2931
             ins = file.getInputStream();
2923 2932
             //上传的压缩包保存的路径
2924
-            String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
2925
-           //String savePath = "D:/home/zipFile/";
2933
+            // todo 服务器上要放开
2934
+//            String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
2935
+           String savePath = "D:/zip/";
2926 2936
             String saveName = uuid + "_" + file.getOriginalFilename();
2927 2937
             zipFile = new File(savePath + saveName);
2928 2938
             inputChangeToFile(ins, zipFile);
@@ -2933,96 +2943,204 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2933 2943
         boolean unzipSuccess = UnZipFileUtils.unZipFile(zipFile, targetPath);
2934 2944
         if (unzipSuccess) {
2935 2945
             File directory = new File(targetPath);
2936
-            List<String> andConvertPDF = findAndConvertPDF(directory);
2946
+           Map<String,String>  andConvertPDF = findAndConvertPDF(directory);
2937 2947
             if (andConvertPDF != null && andConvertPDF.size() > 0) {
2938
-                //遍历路径
2939
-                for (String pdfUrl : andConvertPDF) {
2940
-                    //获取文件的页数
2941
-                    System.out.println("这是查到的符合条件的文件路径====="+pdfUrl);
2942
-                    int fileNumPage = getFileNumPage(pdfUrl);
2943
-                    //文件转成base64
2944
-                    String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
2945
-                    if (base64 == null){
2948
+                   Map<String, List<String>> map = new HashMap<>();
2949
+                    // oc识别pdf并组装数据
2950
+                    // 抓取申请书
2951
+                    if(!OCRAndBuildInfo(andConvertPDF, "仲裁申请书", map)){
2946 2952
                         return AjaxResult.error("文件转base64编码有误,请检查");
2947 2953
                     }
2948
-                    StringBuilder stringBuilder = new StringBuilder(); // 创建一个StringBuilder对象
2949
-                    for (int i = 0; i < fileNumPage; i++) {
2950
-                        //对接腾讯云接口.识别里面的数据
2951
-                        String text = OCRUtils.pdfIdentifyText(base64, i + 1);
2952
-                        if (stringBuilder.length() > 0) {
2953
-                            stringBuilder.append(","); // 在已有内容的情况下添加逗号分隔符
2954
-                        }
2955
-                        stringBuilder.append(text); // 拼接当前的字符串
2956
-                    }
2957
-                    // 将字符串按逗号分隔符切割
2958
-                    String[] fields = stringBuilder.toString().split(",");
2959
-                    Map<String, List<String>> map = new HashMap<>();
2960
-                    for (String field : fields) {
2961
-                        // 对于每个字段,再按冒号分隔符拆分出键和值
2962
-                        String[] keyValue = field.split(":");
2963
-                        if (keyValue.length >= 2) {
2964
-                            String key = keyValue[0];
2965
-                            String value = keyValue[1];
2966
-                            // 判断Map中是否已存在该键
2967
-                            if (map.containsKey(key)) {
2968
-                                // 如果已存在,获取该键对应的值,并将新的值添加到集合中
2969
-                                List<String> values = map.get(key);
2970
-                                values.add(value);
2971
-                            } else {
2972
-                                // 如果不存在,创建一个新的集合,并将值添加到集合中
2973
-                                List<String> values = new ArrayList<>();
2974
-                                values.add(value);
2975
-                                map.put(key, values);
2976
-                            }
2977
-                        }
2978
-                    }
2979
-                    if (map.size()>0){
2954
+                    // 抓取调节协议书
2955
+                if(!OCRAndBuildInfo(andConvertPDF, "调解协议", map)){
2956
+                    return AjaxResult.error("文件转base64编码有误,请检查");
2957
+                }
2958
+                // 抓取合同
2959
+                if(!OCRAndBuildInfo(andConvertPDF, "合同", map)){
2960
+                    return AjaxResult.error("文件转base64编码有误,请检查");
2961
+                }
2962
+                if(!OCRAndBuildInfo(andConvertPDF, "授权委托书", map)){
2963
+                    return AjaxResult.error("文件转base64编码有误,请检查");
2964
+                }
2965
+
2966
+                if (map.size()>0){
2967
+                    // todo 从压缩包中识别各字段填充到数据库
2980 2968
                         //调用新增案件的接口
2981 2969
                         CaseApplication caseApplication = new CaseApplication();
2982
-                        //默认案件标的
2970
+                        //默认案件标的 todo 案件标的是什么
2983 2971
                         caseApplication.setCaseSubjectAmount(new BigDecimal(1));
2984 2972
                         caseApplication.setApplicationOrganId(map.get("统一社会信用代码").get(0));
2985 2973
                         caseApplication.setArbitratClaims(map.get("仲裁请求").get(0));
2974
+                        caseApplication.setFacts(map.get("事实和理由").get(0));
2975
+                    String contractNumber = map.get("合同编号").get(0);
2976
+                    // 提取字母和数字
2977
+                  String regx="[^a-zA-Z0-9]";
2978
+                    String replaceAll = contractNumber.replaceAll(regx, "");
2979
+
2980
+                    caseApplication.setContractNumber(replaceAll.toUpperCase());
2981
+                    String lonStartDate = map.get("或委托代理人签字:").get(0);
2982
+                    SimpleDateFormat sdf = new SimpleDateFormat();
2983
+                    sdf.applyPattern("yyyy年MM月dd日");
2984
+                    try {
2985
+                        caseApplication.setLoanStartDate( sdf.parse(lonStartDate));
2986
+                    } catch (ParseException e) {
2987
+                        e.printStackTrace();
2988
+                    }
2989
+                    // todo 查询同一批号的模板
2990
+                    // 金融消费纠纷基本情况
2991
+                    String disputes = map.get("金融消费纠纷基本情况").get(0);
2992
+                    String disputesTemplate="本案当事人甲{1}(下称“甲方”)于{2}向本案当事人乙{3}(下称“乙方”)申请{3}贷款,贷款金额人民币{4}元,贷款期限{5}期。截至{6},甲方尚欠乙方金额总计人民币{7}元。因甲方诉求与乙方进行协商还款。乙方为妥善解决纠纷,故申请调解中心进行调解。";
2993
+                    List<String> disputeList = getReplaceList(disputesTemplate, disputes);
2994
+                    if(CollectionUtil.isNotEmpty(disputeList)){
2995
+                        if(disputeList.size()>3){
2996
+                        caseApplication.setLoanType(disputeList.get(3));
2997
+                        }
2998
+                        if(disputeList.size()>4) {
2999
+                            String claimPrinciOwed = disputeList.get(4);
3000
+                            // 金额格式化
3001
+                            try {
3002
+                                Double.parseDouble(claimPrinciOwed);
3003
+
3004
+                                caseApplication.setClaimPrinciOwed(new BigDecimal(claimPrinciOwed));
3005
+                            } catch (NumberFormatException e) {
3006
+
3007
+                                String regEx = "[^0-9]";
3008
+                                Pattern p = Pattern.compile(regEx);
3009
+                                Matcher m = p.matcher(claimPrinciOwed);
3010
+                                String result = m.replaceAll("").trim();
3011
+                                BigDecimal bigDecimal = null;
3012
+                                if (claimPrinciOwed.contains("百")) {
3013
+                                    bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100"));
3014
+                                } else if (claimPrinciOwed.contains("千")) {
3015
+                                    bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000"));
3016
+                                } else if (claimPrinciOwed.contains("万")) {
3017
+                                    bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000"));
3018
+                                } else if (claimPrinciOwed.contains("百万")) {
3019
+                                    bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000000"));
3020
+                                } else if (claimPrinciOwed.contains("千万")) {
3021
+                                    bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000000"));
3022
+                                } else if (claimPrinciOwed.contains("亿")) {
3023
+                                    bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100000000"));
3024
+                                }
3025
+                                // todo  生产裁决书时金额格式增加千分位
3026
+                              //  NumberFormat format = NumberFormat.getInstance();
3027
+                              //  String format1 = format.format(bigDecimal);
3028
+
3029
+                                caseApplication.setClaimPrinciOwed(bigDecimal);
3030
+                            }
3031
+                        }
3032
+
3033
+                        if(disputeList.size()>5){
3034
+                            caseApplication.setLoanTerm(disputeList.get(5));
3035
+                        }
3036
+                    }
3037
+                    // 调解协议
3038
+                    String mediationAgreement = map.get("经调解,双方自愿达成如下协议").get(0);
3039
+                    caseApplication.setMediationAgreement(mediationAgreement);
3040
+                    String mediationAgreementTemplate="1、乙方从维系客户的角度出发,同意为甲方申请停催至{1},停催期间正常计息,且征信影响由甲方自行承担。2、甲方应于{2}停催到期前向乙方申请费息减免业务,并按人民币{3}元一次性结清剩余贷款。3、今后双方无涉,就此结案。";
3041
+                    // 对比模板和pdf识别的内容,取出占位符对应的值
3042
+                    List<String> mediationAgreementList = getReplaceList(mediationAgreementTemplate, mediationAgreement);
3043
+                    if(CollectionUtil.isNotEmpty(mediationAgreementList)){
3044
+                        // 截止日期
3045
+                        String lonEndDate = mediationAgreementList.get(0);
3046
+                        try {
3047
+                            caseApplication.setLoanEndDate( sdf.parse(lonEndDate));
3048
+                        } catch (ParseException e) {
3049
+                            e.printStackTrace();
3050
+                        }
3051
+                        if(mediationAgreementList.size()>2){
3052
+                            // 待还金额
3053
+                            caseApplication.setOutstandingMoney(mediationAgreementList.get(2));
3054
+                        }
3055
+                    }
3056
+                        // 合同甲方
3057
+                        caseApplication.setPartyA(map.get("甲方(贷款人)").get(0));
2986 3058
                         List<CaseAffiliate> caseAffiliates = new ArrayList<>();
2987 3059
                         CaseAffiliate caseAffiliate = new CaseAffiliate();
2988 3060
                         caseAffiliate.setIdentityType(1);
2989 3061
                         caseAffiliate.setName(map.get("申请人").get(0));
2990 3062
                         caseAffiliate.setIdentityNum(map.get("统一社会信用代码").get(0));
2991 3063
                         caseAffiliate.setCompLegalPerson(map.get("负责人").get(0));
3064
+                        if(map.get("职务").size()>0) {
3065
+                            // 法定代表人职务
3066
+                            caseAffiliate.setCompLegalperPost(map.get("职务").get(0));
3067
+                            if(map.get("职务").size()>1) {
3068
+                                // 代理人职务
3069
+                                caseAffiliate.setAppliAgentTitle(map.get("职务").get(1));
3070
+                            }
3071
+                        }
2992 3072
                         caseAffiliate.setNameAgent(map.get("委托代理人").get(0));
2993 3073
                         caseAffiliate.setContactTelphoneAgent(map.get("联系电话").get(0));
2994 3074
                         caseAffiliate.setResidenAffili(map.get("住所").get(0));
2995 3075
                         caseAffiliate.setContactAddress(map.get("联系地址").get(0));
2996
-                        caseAffiliate.setEmail(map.get("电子邮件").get(0).replaceAll("\\s", ""));
3076
+                        caseAffiliate.setAgentEmail(map.get("电子邮件").get(0).replaceAll("\\s", ""));
3077
+
3078
+
2997 3079
                         //设置默认代理人的身份证号码,暂时写死 要不然新增方法报错
2998 3080
                   //      caseAffiliate.setIdentityNumAgent("610423199603171716");
2999 3081
                         caseAffiliates.add(caseAffiliate);
3000 3082
                         CaseAffiliate caseAffiliate1 = new CaseAffiliate();
3001 3083
                         caseAffiliate1.setIdentityType(2);
3002 3084
                         caseAffiliate1.setName(map.get("被申请人").get(0));
3003
-                        caseAffiliate1.setIdentityNum(map.get("居民身份证号码").get(0));
3085
+                        // 被申请人身份证
3086
+                        String identityNum = map.get("居民身份证号码").get(0);
3087
+                        caseAffiliate1.setIdentityNum(identityNum);
3088
+                        // 被申请人电子邮件
3089
+                    if(map.get("乙方确认有效的电子信箱地址为").size()>1) {
3090
+                        if(map.get("乙方确认有效的电子信箱地址为").get(0).contains("/")) {
3091
+                            caseAffiliate1.setEmail(map.get("乙方确认有效的电子信箱地址为").get(1).replaceAll("\\s", ""));
3092
+                        }else {
3093
+                            caseAffiliate1.setEmail(map.get("乙方确认有效的电子信箱地址为").get(0).replaceAll("\\s", ""));
3094
+                        }
3095
+                    }
3096
+                        // 出生年月日,从身份证抓取
3097
+                        if(StrUtil.isNotEmpty(identityNum)) {
3098
+                            Map<String, String> identityNumMap = getBirAgeSex(identityNum);
3099
+                            String birthday = identityNumMap.get("birthday");
3100
+                            if(StrUtil.isNotEmpty(birthday)) {
3101
+                                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
3102
+                                Date birthdayDate = null;
3103
+                                try {
3104
+                                    birthdayDate = simpleDateFormat.parse(birthday);
3105
+                                } catch (Exception e) {
3106
+                                    e.printStackTrace();
3107
+                                }
3108
+                                caseAffiliate1.setResponBirth(birthdayDate);
3109
+                            }
3110
+                            //从身份证抓取性别
3111
+                            caseAffiliate1.setResponSex(identityNumMap.get("sexCode"));
3112
+                        }
3004 3113
                         caseAffiliate1.setContactTelphone(map.get("联系电话").get(1));
3005 3114
                         caseAffiliate1.setResidenAffili(map.get("住所").get(1));
3006
-                        //设置默认的性别   2代表未知
3007
-                        caseAffiliate1.setResponSex("2");
3115
+
3008 3116
                         caseAffiliates.add(caseAffiliate1);
3009 3117
                         caseApplication.setCaseAffiliates(caseAffiliates);
3010 3118
                         this.insertcaseApplication(caseApplication);
3011 3119
                         if (null != caseApplication.getId()) {
3012
-                            // 绑定案件与申请书
3013
-                            File file1 = new File(pdfUrl);
3014
-                            CaseAttach caseAttach = new CaseAttach();
3015
-                            caseAttach.setCaseAppliId(caseApplication.getId());
3016
-                            caseAttach.setAnnexPath(file1.getPath());
3017
-                            caseAttach.setAnnexName(file1.getName());
3018
-                            caseAttach.setAnnexType(1);
3019
-                            caseAttachMapper.save(caseAttach);
3120
+                            List<CaseAttach> caseAttachs=new ArrayList<>();
3121
+                            for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
3122
+                                if(entry.getValue().contains("证据材料")){
3123
+                                    String pdfUrl = entry.getValue();
3124
+                                    File file1 = new File(pdfUrl);
3125
+                                    CaseAttach caseAttach = new CaseAttach();
3126
+                                    caseAttach.setCaseAppliId(caseApplication.getId());
3127
+                                    caseAttach.setAnnexPath(file1.getPath());
3128
+                                    caseAttach.setAnnexName(file1.getName());
3129
+                                    // 申请人提供的证据材料
3130
+                                    caseAttach.setAnnexType(2);
3131
+                                    caseAttachs.add(caseAttach);
3132
+                                }
3133
+                            }
3134
+                            if(CollectionUtil.isNotEmpty(caseAttachs)) {
3135
+                                // 新增申请人证据材料
3136
+                                caseAttachMapper.batchSave(caseAttachs);
3137
+                            }
3020 3138
                             return AjaxResult.success("导入成功");
3021 3139
                         }
3022 3140
                     }else{
3023 3141
                         return AjaxResult.error("文件识别内容失败,请检查");
3024 3142
                     }
3025
-                }
3143
+
3026 3144
             } else {
3027 3145
                 // 没有找到符合条件的文件
3028 3146
                 return AjaxResult.error("未找到符合条件的文件");
@@ -3034,6 +3152,95 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3034 3152
         return null;
3035 3153
     }
3036 3154
 
3155
+    private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF, String mapKey, Map<String, List<String>> map) {
3156
+        String pdfUrl = andConvertPDF.get(mapKey);
3157
+        if(StrUtil.isEmpty(pdfUrl)){
3158
+            return false;
3159
+        }
3160
+        //获取文件的页数
3161
+        int fileNumPage = getFileNumPage(pdfUrl);
3162
+        //文件转成base64
3163
+        String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
3164
+        if (base64 == null){
3165
+            return false;
3166
+        }
3167
+        StringBuilder stringBuilder = new StringBuilder(); // 创建一个StringBuilder对象
3168
+        for (int i = 0; i < fileNumPage; i++) {
3169
+            //对接腾讯云接口.识别里面的数据
3170
+            String text = OCRUtils.pdfIdentifyText(base64, i + 1,mapKey);
3171
+            if (stringBuilder.length() > 0) {
3172
+                stringBuilder.append(Constants.BR); // 在已有内容的情况下添加逗号分隔符
3173
+            }
3174
+            stringBuilder.append(text); // 拼接当前的字符串
3175
+        }
3176
+        // 将字符串按逗号分隔符切割
3177
+        String[] fields = stringBuilder.toString().split(Constants.BR);
3178
+        for (String field : fields) {
3179
+            // 对于每个字段,再按冒号分隔符拆分出键和值
3180
+            String[] keyValue = field.split(Constants.PDFSTR);
3181
+            if (keyValue.length >= 2) {
3182
+                String key = keyValue[0];
3183
+                String value = keyValue[1];
3184
+                // 判断Map中是否已存在该键
3185
+                if (map.containsKey(key)) {
3186
+                    // 如果已存在,获取该键对应的值,并将新的值添加到集合中
3187
+                    List<String> values = map.get(key);
3188
+                    values.add(value);
3189
+                } else {
3190
+                    // 如果不存在,创建一个新的集合,并将值添加到集合中
3191
+                    List<String> values = new ArrayList<>();
3192
+                    values.add(value);
3193
+                    map.put(key, values);
3194
+                }
3195
+            }
3196
+        }
3197
+        return true;
3198
+    }
3199
+
3200
+    /**
3201
+     * 通过身份证号码获取出生日期、性别、年龄
3202
+     * @param certificateNo
3203
+     * @return 返回的出生日期格式:1990-01-01   性别格式:1-女,0-男
3204
+     */
3205
+    public static Map<String, String> getBirAgeSex(String certificateNo) {
3206
+        String birthday = "";
3207
+        String age = "";
3208
+        String sexCode = "";
3209
+
3210
+        int year = Calendar.getInstance().get(Calendar.YEAR);
3211
+        char[] number = certificateNo.toCharArray();
3212
+        boolean flag = true;
3213
+        if (number.length == 15) {
3214
+            for (int x = 0; x < number.length; x++) {
3215
+                if (!flag) return new HashMap<String, String>();
3216
+                flag = Character.isDigit(number[x]);
3217
+            }
3218
+        } else if (number.length == 18) {
3219
+            for (int x = 0; x < number.length - 1; x++) {
3220
+                if (!flag) return new HashMap<String, String>();
3221
+                flag = Character.isDigit(number[x]);
3222
+            }
3223
+        }
3224
+        if (flag && certificateNo.length() == 15) {
3225
+            birthday = "19" + certificateNo.substring(6, 8) + "-"
3226
+                    + certificateNo.substring(8, 10) + "-"
3227
+                    + certificateNo.substring(10, 12);
3228
+            sexCode = Integer.parseInt(certificateNo.substring(certificateNo.length() - 3, certificateNo.length())) % 2 == 0 ? "1" : "0";
3229
+            age = (year - Integer.parseInt("19" + certificateNo.substring(6, 8))) + "";
3230
+        } else if (flag && certificateNo.length() == 18) {
3231
+            birthday = certificateNo.substring(6, 10) + "-"
3232
+                    + certificateNo.substring(10, 12) + "-"
3233
+                    + certificateNo.substring(12, 14);
3234
+            sexCode = Integer.parseInt(certificateNo.substring(certificateNo.length() - 4, certificateNo.length() - 1)) % 2 == 0 ? "1" : "0";
3235
+            age = (year - Integer.parseInt(certificateNo.substring(6, 10))) + "";
3236
+        }
3237
+        Map<String, String> map = new HashMap<String, String>();
3238
+        map.put("birthday", birthday);
3239
+        map.put("age", age);
3240
+        map.put("sexCode", sexCode);
3241
+        return map;
3242
+    }
3243
+
3037 3244
     /**
3038 3245
      * 根据附件id修改案件id
3039 3246
      * @param caseAttach
@@ -3045,12 +3252,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3045 3252
         return success();
3046 3253
     }
3047 3254
 
3048
-    public static List<String> findAndConvertPDF(File directory) {
3049
-        List<String> pdfPaths = new ArrayList<>();
3255
+    public static Map<String,String> findAndConvertPDF(File directory) {
3256
+       Map<String,String> pdfPathMap= new HashMap<>();
3050 3257
         if (directory.isFile()) {
3051 3258
             String path = "";
3259
+            String fileName = "";
3052 3260
             // 如果传入的参数是一个文件
3053
-            if (directory.getName().contains("仲裁申请书")) {
3261
+     //       if (directory.getName().contains("仲裁申请书")) {
3054 3262
                 if (isPDF(directory)) {
3055 3263
                     // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
3056 3264
                     path = directory.getAbsolutePath();
@@ -3062,17 +3270,53 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3062 3270
                     }
3063 3271
                 }
3064 3272
                 if (path != null) {
3065
-                    pdfPaths.add(path);
3273
+                    // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
3274
+                    // 如果是PDF格式,直接添加到列表中
3275
+                    String name="";
3276
+                    if (directory.getName().contains("仲裁申请书")) {
3277
+                        name="仲裁申请书";
3278
+                    }
3279
+                    if (directory.getName().contains("调解协议")) {
3280
+                        name="调解协议";
3281
+                    }
3282
+                    if (directory.getName().contains("情况说明")) {
3283
+                        name="情况说明";
3284
+                    }
3285
+                    if (directory.getName().contains("贷款合同")) {
3286
+                        name="贷款合同";
3287
+                    }
3288
+                    if (directory.getName().contains("营业执照")) {
3289
+                        name="营业执照";
3290
+                    }
3291
+                    if (directory.getName().contains("负责人证明")) {
3292
+                        name="负责人证明";
3293
+                    }
3294
+                    if (directory.getName().contains("负责人身份证")) {
3295
+                        name="负责人身份证";
3296
+                    }
3297
+                    if (directory.getName().contains("授权委托书")) {
3298
+                        name="授权委托书";
3299
+                    }
3300
+                    if (directory.getName().contains("经办人员的劳动合同")) {
3301
+                        name="经办人员的劳动合同";
3302
+                    }
3303
+                    if (directory.getName().contains("经办人员身份证")) {
3304
+                        name="经办人员的身份证";
3305
+                    }
3306
+                    if (directory.getName().contains("自然人身份证")) {
3307
+                        name="自然人身份证";
3308
+                    }
3309
+
3310
+                    pdfPathMap.put(name,path);
3066 3311
                 }
3067
-            }
3312
+         //   }
3068 3313
         } else if (directory.isDirectory()) {
3069
-            searchAndConvertPDF(directory, pdfPaths);
3314
+            searchAndConvertPDF(directory, pdfPathMap);
3070 3315
         } else {
3071 3316
             return null;
3072 3317
         }
3073
-        return pdfPaths;
3318
+        return pdfPathMap;
3074 3319
     }
3075
-
3076 3320
     public static boolean isPDF(File file) {
3077 3321
         String extension = getFileExtension(file);
3078 3322
         return extension.equalsIgnoreCase("pdf");
@@ -3088,27 +3332,66 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3088 3332
         }
3089 3333
     }
3090 3334
 
3091
-    public static void searchAndConvertPDF(File directory, List<String> pdfPaths) {
3335
+    public static void searchAndConvertPDF(File directory, Map<String,String> pdfPathMap) {
3092 3336
         File[] files = directory.listFiles();
3093 3337
         if (files != null) {
3094 3338
             for (File file : files) {
3339
+                if(file.getName().contains("zip")|| file.getName().contains("rar")){
3340
+                    continue;
3341
+                }
3095 3342
                 if (file.isFile()) {
3096
-                    // 如果是文件且文件名包含"仲裁申请书"
3343
+                    String name="";
3097 3344
                     if (file.getName().contains("仲裁申请书")) {
3345
+                        name="仲裁申请书";
3346
+                    }
3347
+                    if (file.getName().contains("调解协议")) {
3348
+                        name="调解协议";
3349
+                    }
3350
+                    if (file.getName().contains("情况说明")) {
3351
+                        name="情况说明";
3352
+                    }
3353
+                    if (file.getName().contains("贷款合同")) {
3354
+                        name="贷款合同";
3355
+                    }
3356
+                    if (file.getName().contains("营业执照")) {
3357
+                        name="营业执照";
3358
+                    }
3359
+                    if (file.getName().contains("负责人证明")) {
3360
+                        name="负责人证明";
3361
+                    }
3362
+                    if (file.getName().contains("负责人身份证")) {
3363
+                        name="负责人身份证";
3364
+                    }
3365
+                    if (file.getName().contains("授权委托书")) {
3366
+                        name="授权委托书";
3367
+                    }
3368
+                    if (file.getName().contains("经办人员的劳动合同")) {
3369
+                        name="经办人员的劳动合同";
3370
+                    }
3371
+                    if (file.getName().contains("经办人员的身份证")) {
3372
+                        name="经办人员身份证";
3373
+                    }
3374
+                    if (file.getName().contains("自然人身份证")) {
3375
+                        name="自然人身份证";
3376
+                    }
3377
+                    // 如果是文件且文件名包含"仲裁申请书"
3378
+                //    if (file.getName().contains("仲裁申请书")) {
3098 3379
                         if (isPDF(file)) {
3099 3380
                             // 如果是PDF格式,直接添加到列表中
3100
-                            pdfPaths.add(file.getAbsolutePath());
3381
+                            pdfPathMap.put(name,file.getAbsolutePath());
3101 3382
                         } else {
3102 3383
                             // 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
3103
-                            String pdfPath = convertToPDF(file);
3384
+                        String   pdfPath = convertToPDF(file);
3104 3385
                             if (pdfPath != null) {
3105
-                                pdfPaths.add(pdfPath);
3386
+                                // 如果是PDF格式,直接添加到列表中
3387
+                                pdfPathMap.put(name,pdfPath);
3106 3388
                             }
3107 3389
                         }
3108
-                    }
3390
+
3391
+                //    }
3109 3392
                 } else if (file.isDirectory()) {
3110 3393
                     // 如果是目录,递归查找
3111
-                    searchAndConvertPDF(file, pdfPaths);
3394
+                    searchAndConvertPDF(file, pdfPathMap);
3112 3395
                 }
3113 3396
             }
3114 3397
         }
@@ -3151,6 +3434,66 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3151 3434
         }
3152 3435
         return pageCount;
3153 3436
     }
3437
+
3438
+    /**
3439
+     * 获取模板和正文中替换符的内容
3440
+     * @param a
3441
+     * @param b
3442
+     * @return
3443
+     */
3444
+    public static List<String> getReplaceList(String a,String b){
3445
+        String aTmpe = filterString(a);
3446
+        String bTmpe = filterString(b);
3447
+        String regex = "(\\{[^}}]*})";
3448
+        String[] ptTemplate = aTmpe.replaceAll(regex, "@=").split("@=");
3449
+        String replace = "";
3450
+        for (int i = 0; i < ptTemplate.length; i++) {
3451
+            if(ptTemplate[i]==null || ptTemplate[i].equals(" "))continue;
3452
+            if(replace.equals("")){
3453
+                replace = bTmpe.replace(ptTemplate[i], "@=");
3454
+            }else {
3455
+                replace = replace.replace(ptTemplate[i], "@=");
3456
+            }
3457
+        }
3458
+        List<String> aList = new ArrayList<>();
3459
+        String[] split = replace.split("@=");
3460
+        for (int i =0; i<split.length; i++){
3461
+            if(split[i] == "" || split[i].equals("")) continue;
3462
+            aList.add(split[i]);
3463
+        }
3464
+        return aList;
3465
+    }
3466
+
3467
+    // 去掉内容中的换行符
3468
+    public static String filterString(String  str){
3469
+        if(str == null || str.equals("")) return null;
3470
+        String regEx= "[\\r\\n]";
3471
+        Pattern   p   =   Pattern.compile(regEx);
3472
+        Matcher   m   =   p.matcher(str);
3473
+        return m.replaceAll(" ").trim();
3474
+    }
3475
+
3476
+    // 检索时,转换特殊字符
3477
+    public static String escapeQueryChars(String s) {
3478
+        if (StringUtils.isBlank(s)) {
3479
+            return s;
3480
+        }
3481
+        StringBuilder sb = new StringBuilder();
3482
+        for (int i = 0; i < s.length(); i++) {
3483
+            char c = s.charAt(i);
3484
+            // These characters are part of the query syntax and must be escaped
3485
+            if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')'
3486
+                    || c == ':' || c == '^' || c == '[' || c == ']' || c == '\"'
3487
+                    || c == '{' || c == '}' || c == '~' || c == '*' || c == '?'
3488
+                    || c == '|' || c == '&' || c == ';' || c == '/' || c == '.'
3489
+                    || c == '$' || Character.isWhitespace(c)) {
3490
+                sb.append('\\');
3491
+            }
3492
+            sb.append(c);
3493
+        }
3494
+        return sb.toString();
3495
+    }
3496
+
3154 3497
 }
3155 3498
 
3156 3499
 

+ 32
- 6
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java Ver arquivo

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.wisdomarbitrate.utils;
2 2
 
3
+import com.ruoyi.common.constant.Constants;
3 4
 import com.tencentcloudapi.bsca.v20210811.models.LicenseSummary;
4 5
 import com.tencentcloudapi.common.Credential;
5 6
 import com.tencentcloudapi.common.exception.TencentCloudSDKException;
@@ -23,8 +24,26 @@ public class OCRUtils {
23 24
     private static final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp";
24 25
     //API的SecretKey
25 26
     private static final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V";
27
+    // 仲裁申请书识别字段
28
+    private static final String[] applicantName = {"申请人", "统一社会信用代码", "负责人", "住所", "联系地址"
29
+            , "委托代理人", "联系电话", "电子邮件", "被申请人", "居民身份证号码", "仲裁请求", "事实和理由"};
30
+    // 贷款合同识别字段
31
+    private static final String[] contractName = {
32
+            "合同编号","甲方(贷款人)" ,"或委托代理人签字:","本合同的初始贷款年利率为","乙方确认有效的电子信箱地址为"};
33
+    // 调解协议识别字段
34
+    private static final String[] accordName = {"金融消费纠纷基本情况","经调解,双方自愿达成如下协议"};
35
+    // 授权委托书识别字段
36
+    private static final String[] powerAttorneyName = {"职务"};
26 37
 
27
-    public static String pdfIdentifyText(String imageBase64, Integer pageNumber) {
38
+
39
+    /**
40
+     * pdf识别成文字
41
+     * @param imageBase64
42
+     * @param pageNumber
43
+     * @param type pdf类型
44
+     * @return
45
+     */
46
+    public static String pdfIdentifyText(String imageBase64, Integer pageNumber,String type) {
28 47
         try {
29 48
             // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
30 49
             // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
@@ -43,9 +62,16 @@ public class OCRUtils {
43 62
             req.setImageBase64(imageBase64);
44 63
             req.setIsPdf(true);
45 64
             req.setPdfPageNumber(pageNumber.longValue());
46
-            String[] itemNames1 = {"申请人", "统一社会信用代码", "负责人", "住所", "联系地址"
47
-                    , "委托代理人", "联系电话", "电子邮件", "被申请人", "居民身份证号码", "仲裁请求", "事实和理由"};
48
-            req.setItemNames(itemNames1);
65
+            if(type.contains("申请书")){
66
+                req.setItemNames(applicantName);
67
+            }else if(type.contains("调解协议")){
68
+             //   req.setItemNames(accordName);
69
+            }else if(type.contains("合同")){
70
+                req.setItemNames(contractName);
71
+            }else if(type.contains("授权委托书")){
72
+                req.setItemNames(powerAttorneyName);
73
+            }
74
+
49 75
             // 返回的resp是一个SmartStructuralOCRV2Response的实例,与请求对象对应
50 76
             SmartStructuralOCRV2Response resp = client.SmartStructuralOCRV2(req);
51 77
             // 输出json格式的字符串回包
@@ -67,9 +93,9 @@ public class OCRUtils {
67 93
                         JSONObject value = line.getJSONObject("Value");
68 94
                         String autoName = key.getString("AutoName");
69 95
                         String autoContent = value.getString("AutoContent");
70
-                        String text = autoName + ":" + autoContent;
96
+                        String text = autoName + Constants.PDFSTR + autoContent;
71 97
                         if (stringBuilder.length() > 0) {
72
-                            stringBuilder.append(","); // 在已有内容的情况下添加逗号分隔符
98
+                            stringBuilder.append(Constants.BR); // 在已有内容的情况下添加逗号分隔符
73 99
                         }
74 100
                         stringBuilder.append(text); // 拼接当前的字符串
75 101
                     }

+ 17
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitrateRecordMapper.xml Ver arquivo

@@ -14,6 +14,10 @@
14 14
         <result property="verificaOpinion"       column="verifica_opinion"       />
15 15
         <result property="checkOpinion"     column="check_opinion"     />
16 16
         <result property="annexId"     column="annex_id"     />
17
+        <result property="caseFocus"     column="case_focus"     />
18
+        <result property="caseFacts"     column="case_facts"     />
19
+        <result property="respondentOpinion"     column="respondent_opinion"     />
20
+        <result property="applicantOpinion"     column="applicant_opinion"     />
17 21
 
18 22
     </resultMap>
19 23
 
@@ -29,6 +33,10 @@
29 33
 
30 34
         <if test="checkOpinion != null and checkOpinion != ''">check_opinion,</if>
31 35
         <if test="createBy != null  and createBy != ''">create_by,</if>
36
+        case_focus,
37
+        case_facts,
38
+        respondent_opinion,
39
+        applicant_opinion,
32 40
         create_time
33 41
         )values(
34 42
         <if test="caseAppliId != null ">#{caseAppliId},</if>
@@ -40,6 +48,10 @@
40 48
         <if test="arbitrateThink != null and arbitrateThink != ''">#{arbitrateThink},</if>
41 49
         <if test="checkOpinion != null and checkOpinion != ''">#{checkOpinion},</if>
42 50
         <if test="createBy != null  and createBy != ''">#{createBy},</if>
51
+        #{caseFocus},
52
+        #{caseFacts},
53
+        #{respondentOpinion},
54
+        #{applicantOpinion},
43 55
         sysdate()
44 56
         )
45 57
     </insert>
@@ -57,6 +69,10 @@
57 69
             <if test="checkOpinion != null and checkOpinion != ''">check_opinion = #{checkOpinion},</if>
58 70
             <if test="annexId != null ">annex_id = #{annexId},</if>
59 71
             <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
72
+            <if test="caseFocus != null  and caseFocus != ''">case_focus = #{caseFocus},</if>
73
+            <if test="caseFacts != null  and caseFacts != ''">case_facts = #{caseFacts},</if>
74
+            <if test="respondentOpinion != null  and respondentOpinion != ''">respondent_opinion = #{respondentOpinion},</if>
75
+            <if test="applicantOpinion != null  and applicantOpinion != ''">applicant_opinion = #{applicantOpinion},</if>
60 76
             update_time = sysdate()
61 77
         </set>
62 78
         where id = #{id}
@@ -65,7 +81,7 @@
65 81
 
66 82
     <select id="selectArbitrateRecord" parameterType="ArbitrateRecord" resultMap="ArbitrateRecordResult">
67 83
         SELECT a.id ,a.case_appli_id ,a.eviden_determi ,a.fact_determi ,a.case_sketch ,a.arbitrate_think ,a.ruling_follows ,
68
-        a.verifica_opinion ,a.check_opinion,a.annex_id
84
+        a.verifica_opinion ,a.check_opinion,a.annex_id,a.case_focus,a.case_facts,a.respondent_opinion,a.applicant_opinion
69 85
         from arbitrate_record a
70 86
         <where>
71 87
             <if test="caseAppliId != null ">

+ 7
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateLogMapper.xml Ver arquivo

@@ -33,6 +33,7 @@
33 33
         <result property="email"     column="email"    />
34 34
         <result property="sendEmail"     column="send_email"    />
35 35
         <result property="applicantAgentUserId"     column="applicant_agent_user_id"    />
36
+        <result property="agentEmail"     column="agent_email"    />
36 37
     </resultMap>
37 38
 
38 39
     <select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult">
@@ -66,7 +67,7 @@
66 67
         contact_address,work_address,work_telphone ,name_agent,identity_num_agent,contact_telphone_agent,
67 68
         comp_legal_person,comp_legalper_post,respon_sex ,respon_birth,
68 69
         residen_affili,appli_agent_title,
69
-        contact_address_agent,email , send_email,track_num,applicant_agent_user_id) values
70
+        contact_address_agent,email , send_email,track_num,applicant_agent_user_id,agent_email) values
70 71
         <foreach item="item" index="index" collection="list" separator=",">
71 72
             (#{item.caseAppliLogId},#{item.identityType},#{item.applicationOrganId},#{item.applicationOrganName},#{item.name},#{item.identityNum},#{item.contactTelphone},
72 73
             #{item.contactAddress},#{item.workAddress},#{item.workTelphone},  #{item.nameAgent},#{item.identityNumAgent},#{item.contactTelphoneAgent},
@@ -76,7 +77,8 @@
76 77
             #{item.email},
77 78
             #{item.sendEmail},
78 79
             #{item.trackNum},
79
-            #{item.applicantAgentUserId}
80
+            #{item.applicantAgentUserId},
81
+            #{item.agentEmail}
80 82
             )
81 83
         </foreach>
82 84
     </insert>
@@ -113,6 +115,9 @@
113 115
         residen_affili=#{residenAffili},
114 116
         appli_agent_title=#{appliAgentTitle}
115 117
 
118
+        <if test="agentEmail !=null and agentEmail!=''">
119
+            ,agent_email=#{agentEmail}
120
+        </if>
116 121
         where id = #{id}
117 122
 
118 123
     </update>

+ 12
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml Ver arquivo

@@ -33,6 +33,7 @@
33 33
         <result property="email"     column="email"    />
34 34
         <result property="sendEmail"     column="send_email"    />
35 35
         <result property="applicantAgentUserId"     column="applicant_agent_user_id"    />
36
+        <result property="agentEmail"     column="agent_email"    />
36 37
     </resultMap>
37 38
 
38 39
     <select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult">
@@ -83,7 +84,7 @@
83 84
         contact_address,work_address,work_telphone ,name_agent,identity_num_agent,contact_telphone_agent,
84 85
         comp_legal_person,comp_legalper_post,respon_sex ,respon_birth,
85 86
         residen_affili,appli_agent_title,
86
-        contact_address_agent,email, send_email,track_num,applicant_agent_user_id) values
87
+        contact_address_agent,email, send_email,track_num,applicant_agent_user_id,agent_email) values
87 88
         <foreach item="item" index="index" collection="list" separator=",">
88 89
             (#{item.caseAppliId},#{item.identityType},#{item.applicationOrganId},#{item.applicationOrganName},#{item.name},#{item.identityNum},#{item.contactTelphone},
89 90
             #{item.contactAddress},#{item.workAddress},#{item.workTelphone},  #{item.nameAgent},#{item.identityNumAgent},#{item.contactTelphoneAgent},
@@ -93,7 +94,8 @@
93 94
             #{item.email},
94 95
              #{item.sendEmail},
95 96
              #{item.trackNum},
96
-             #{item.applicantAgentUserId}
97
+             #{item.applicantAgentUserId},
98
+             #{item.agentEmail}
97 99
              )
98 100
         </foreach>
99 101
     </insert>
@@ -128,6 +130,10 @@
128 130
             respon_birth=#{responBirth},
129 131
             residen_affili=#{residenAffili},
130 132
             appli_agent_title=#{appliAgentTitle}
133
+
134
+        <if test="agentEmail !=null and agentEmail!=''">
135
+            ,agent_email=#{agentEmail}
136
+        </if>
131 137
         where id = #{id}
132 138
 
133 139
     </update>
@@ -161,6 +167,10 @@
161 167
                 respon_birth=#{item.responBirth},
162 168
                 residen_affili=#{item.residenAffili},
163 169
                 appli_agent_title=#{item.appliAgentTitle}
170
+
171
+                <if test="agentEmail !=null and agentEmail!=''">
172
+                    ,agent_email=#{agentEmail}
173
+                </if>
164 174
             </set>
165 175
         where case_appli_id = #{caseAppliId} and   identity_type= #{item.identityType};
166 176
         </foreach>

+ 55
- 4
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationLogMapper.xml Ver arquivo

@@ -49,6 +49,14 @@
49 49
         <result property="version"   column="version"  />
50 50
         <result property="updateSubmitStatus"   column="update_submit_status"  />
51 51
         <result property="properPreser"   column="proper_preser"  />
52
+        <result property="interestRate"   column="interest_rate"  />
53
+        <result property="outstandingMoney"   column="outstanding_money"  />
54
+        <result property="facts"   column="facts"  />
55
+        <result property="partyA"   column="party_a"  />
56
+        <result property="disputes"   column="disputes"  />
57
+        <result property="loanType"   column="loan_type"  />
58
+        <result property="loanTerm"   column="loan_term"  />
59
+        <result property="mediationAgreement"   column="mediation_agreement"  />
52 60
     </resultMap>
53 61
     <insert id="insert" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" useGeneratedKeys="true" keyProperty="id">
54 62
         insert into case_application_log(
@@ -71,6 +79,14 @@
71 79
         <if test="version != null ">version,</if>
72 80
         <if test="updateSubmitStatus != null ">update_submit_status,</if>
73 81
         <if test="properPreser != null ">proper_preser,</if>
82
+        interest_rate,
83
+        outstanding_money,
84
+        facts,
85
+        party_a,
86
+        disputes,
87
+        loan_type,
88
+        loan_term,
89
+        mediation_agreement,
74 90
         create_time
75 91
         )values(
76 92
         <if test="caseAppliId != null">#{caseAppliId},</if>
@@ -92,6 +108,14 @@
92 108
         <if test="version != null ">#{version},</if>
93 109
         <if test="updateSubmitStatus != null ">#{updateSubmitStatus},</if>
94 110
         <if test="properPreser != null ">#{properPreser},</if>
111
+        #{interestRate},
112
+        #{outstandingMoney},
113
+        #{facts},
114
+        #{partyA},
115
+        #{disputes},
116
+        #{loanType},
117
+        #{loanTerm},
118
+        #{mediationAgreement},
95 119
         sysdate()
96 120
         )
97 121
     </insert>
@@ -121,7 +145,13 @@
121 145
             #{id}
122 146
         </foreach>
123 147
         );
124
-
148
+        delete a from case_attach_log  a
149
+        join case_application_log l on l.id=a.case_appli_log_id
150
+        where l.id in (
151
+        <foreach collection="ids" item="id" separator=",">
152
+            #{id}
153
+        </foreach>
154
+        );
125 155
         delete from case_application_log l where l.id in (
126 156
         <foreach collection="ids" item="id" separator=",">
127 157
             #{id}
@@ -133,7 +163,14 @@
133 163
     <select id="selectByCaseIdAndVersion" resultMap="CaseApplicationResult">
134 164
         SELECT case_appli_id id,id caseLogId,case_appli_id caseAppliId ,case_name,case_num,case_subject_amount,arbitrat_claims,request_rule,loan_start_date,
135 165
                loan_end_date,claim_princi_owed,claim_interest_owed,claim_liquid_damag,fee_payable,contract_number,
136
-               create_by,version,update_submit_status,create_time,proper_preser
166
+               create_by,version,update_submit_status,create_time,proper_preser,  interest_rate,
167
+        outstanding_money,
168
+        facts,
169
+        party_a,
170
+        disputes,
171
+        loan_type,
172
+        loan_term,
173
+        mediation_agreement
137 174
         FROM case_application_log
138 175
         WHERE case_appli_id = #{caseAppliId} and version=#{version}
139 176
     </select>
@@ -141,7 +178,14 @@
141 178
     <select id="selectLatestCase" resultMap="CaseApplicationResult">
142 179
         SELECT id caseLogId,case_appli_id caseAppliId ,case_name,case_num,case_subject_amount,arbitrat_claims,request_rule,loan_start_date,
143 180
                loan_end_date,claim_princi_owed,claim_interest_owed,claim_liquid_damag,fee_payable,contract_number,
144
-               create_by,version,update_submit_status,create_time,proper_preser
181
+               create_by,version,update_submit_status,create_time,proper_preser,  interest_rate,
182
+        outstanding_money,
183
+        facts,
184
+        party_a,
185
+        disputes,
186
+        loan_type,
187
+        loan_term,
188
+        mediation_agreement
145 189
         FROM case_application_log
146 190
         WHERE case_appli_id = #{caseAppliId} ORDER BY version DESC limit 1
147 191
     </select>
@@ -159,7 +203,14 @@
159 203
     <select id="selectBeforeCase" resultMap="CaseApplicationResult">
160 204
         SELECT case_appli_id id,id caseLogId,case_appli_id caseAppliId ,case_name,case_num,case_subject_amount,arbitrat_claims,request_rule,loan_start_date,
161 205
                loan_end_date,claim_princi_owed,claim_interest_owed,claim_liquid_damag,fee_payable,contract_number,
162
-               create_by,version,update_submit_status,create_time,proper_preser
206
+               create_by,version,update_submit_status,create_time,proper_preser,  interest_rate,
207
+        outstanding_money,
208
+        facts,
209
+        party_a,
210
+        disputes,
211
+        loan_type,
212
+        loan_term,
213
+        mediation_agreement
163 214
         FROM case_application_log
164 215
         WHERE case_appli_id = #{caseId} and version &lt; #{version} and update_submit_status not in ( 4, 5 ) order by version desc limit 1
165 216
     </select>

+ 42
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Ver arquivo

@@ -46,6 +46,14 @@
46 46
         <result property="properPreser"   column="proper_preser"  />
47 47
         <result property="adjudicaCounter"   column="adjudica_counter"  />
48 48
         <result property="lockStatus"   column="lock_status"  />
49
+        <result property="interestRate"   column="interest_rate"  />
50
+        <result property="outstandingMoney"   column="outstanding_money"  />
51
+        <result property="facts"   column="facts"  />
52
+        <result property="partyA"   column="party_a"  />
53
+        <result property="disputes"   column="disputes"  />
54
+        <result property="loanType"   column="loan_type"  />
55
+        <result property="loanTerm"   column="loan_term"  />
56
+        <result property="mediationAgreement"   column="mediation_agreement"  />
49 57
     </resultMap>
50 58
 
51 59
 
@@ -1374,6 +1382,14 @@
1374 1382
         <if test="createBy != null  and createBy != ''">create_by,</if>
1375 1383
         <if test="importFlag != null ">import_flag,</if>
1376 1384
         <if test="version != null ">version,</if>
1385
+        interest_rate,
1386
+        outstanding_money,
1387
+        facts,
1388
+        party_a,
1389
+        disputes,
1390
+        loan_type,
1391
+        loan_term,
1392
+        mediation_agreement,
1377 1393
         create_time
1378 1394
         )values(
1379 1395
         <if test="caseName != null and caseName != ''">#{caseName},</if>
@@ -1403,6 +1419,14 @@
1403 1419
         <if test="createBy != null  and createBy != ''">#{createBy},</if>
1404 1420
         <if test="importFlag != null ">#{importFlag},</if>
1405 1421
         <if test="version != null ">#{version},</if>
1422
+        #{interestRate},
1423
+        #{outstandingMoney},
1424
+        #{facts},
1425
+        #{partyA},
1426
+        #{disputes},
1427
+        #{loanType},
1428
+        #{loanTerm},
1429
+        #{mediationAgreement},
1406 1430
         sysdate()
1407 1431
         )
1408 1432
     </insert>
@@ -1435,7 +1459,15 @@
1435 1459
 
1436 1460
             <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
1437 1461
             <if test="caseNum != null and caseNum != ''">case_num = #{caseNum},</if>
1438
-            <if test="version != null and version != ''">version = #{version},</if>
1462
+            <if test="version != null ">version = #{version},</if>
1463
+            <if test="interestRate != null and interestRate != ''">interest_rate = #{interestRate},</if>
1464
+            <if test="outstandingMoney != null and outstandingMoney != ''">outstanding_money = #{outstandingMoney},</if>
1465
+            <if test="facts != null and facts != ''">facts = #{facts},</if>
1466
+            <if test="partyA != null and partyA != ''">party_a = #{partyA},</if>
1467
+            <if test="disputes != null and disputes != ''">disputes = #{disputes},</if>
1468
+            <if test="loanType != null and loanType != ''">loan_type = #{loanType},</if>
1469
+            <if test="loanTerm != null and loanTerm != ''">loan_term = #{loanTerm},</if>
1470
+            <if test="mediationAgreement != null and mediationAgreement != ''">mediation_agreement = #{mediationAgreement},</if>
1439 1471
             update_time = sysdate()
1440 1472
         </set>
1441 1473
         where id = #{id}
@@ -1517,7 +1549,15 @@
1517 1549
         c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
1518 1550
         c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.request_rule,c.adjudica_counter,c.proper_preser,
1519 1551
         c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
1520
-        c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId ,ca.application_organ_name as applicantName
1552
+        c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId ,ca.application_organ_name as applicantName,
1553
+        c.interest_rate,
1554
+        c.outstanding_money,
1555
+        c.facts,
1556
+        c.party_a,
1557
+        c.disputes,
1558
+        c.loan_type,
1559
+        c.loan_term,
1560
+        c.mediation_agreement
1521 1561
         from case_application c
1522 1562
         LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
1523 1563
 

+ 8
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml Ver arquivo

@@ -18,6 +18,14 @@
18 18
         INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
19 19
         VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName},#{sealStatus},#{isBatchUpload})
20 20
     </insert>
21
+    <insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId">
22
+        INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
23
+        <foreach item="item" index="index" collection="list" separator=",">
24
+
25
+        VALUES
26
+         (#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.userId},#{item.userName},#{item.sealStatus},#{item.isBatchUpload})
27
+        </foreach>
28
+    </insert>
21 29
     <delete id="deleteByFileIds">
22 30
         delete from case_attach
23 31
         where annex_id in