Pārlūkot izejas kodu

裁决书修改

18792927508 2 gadus atpakaļ
vecāks
revīzija
aa36758066

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueLogMapper.java Parādīt failu

@@ -20,10 +20,10 @@ public interface ColumnValueLogMapper {
20 20
 
21 21
     /**
22 22
      * 根据案件id查询字段及值
23
-     * @param caseId
23
+     * @param caseAppliLogId
24 24
      * @return
25 25
      */
26
-    List<ColumnValue> listBycaseAppliLogId(@Param("caseId") Long caseId);
26
+    List<ColumnValue> listBycaseAppliLogId(@Param("caseAppliLogId") Long caseAppliLogId);
27 27
 
28 28
     List<ColumnValue> queryColumnValueList(ColumnValue columnValue);
29 29
 }

+ 25
- 9
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Parādīt failu

@@ -9,6 +9,7 @@ import com.ruoyi.common.constant.CaseApplicationConstants;
9 9
 import com.ruoyi.common.core.domain.AjaxResult;
10 10
 import com.ruoyi.common.core.domain.entity.SysDictData;
11 11
 import com.ruoyi.common.core.redis.RedisCache;
12
+import com.ruoyi.common.exception.ServiceException;
12 13
 import com.ruoyi.common.utils.*;
13 14
 import com.ruoyi.system.mapper.SysDictDataMapper;
14 15
 import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
@@ -157,6 +158,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
157 158
                 return AjaxResult.error("请先指定裁决书模板");
158 159
             }
159 160
             templatePath = templateManages.get(0).getTemOrigPath();
161
+            // todo 部署放开
162
+            if(templatePath!=null){
163
+                templatePath="/home/ruoyi/" +templatePath;
164
+            }
160 165
             templateName = templateManages.get(0).getFileName();
161 166
             // 查询案件相关表信息
162 167
             CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -228,12 +233,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
228 233
             // todo
229 234
 //            String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
230 235
             // todo
231
-//            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
232
-            String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
236
+            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
237
+//            String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
233 238
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
234 239
             // todo
235
-//            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
236
-            String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
240
+            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
241
+//            String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
237 242
             // 将word中的标签替换掉,生成新的word
238 243
             String docFilePath =  wordChangeText(templatePath,datas,saveFolderPath,fileName);
239 244
 
@@ -1277,23 +1282,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
1277 1282
     public List<String> getBookmarkByDocx(String path){
1278 1283
         XWPFDocument xwpfDocument = null;
1279 1284
         try {
1285
+            log.error("path===="+path);
1280 1286
             FileInputStream fileInputStream = new FileInputStream(path);
1287
+            log.error("fileInputStream====");
1281 1288
             xwpfDocument = new XWPFDocument(fileInputStream);
1289
+            log.error("xwpfDocument===="+xwpfDocument);
1282 1290
         } catch (IOException e) {
1283 1291
             e.printStackTrace();
1284 1292
         }
1293
+        if(xwpfDocument==null){
1294
+            return new ArrayList<>();
1295
+        }
1285 1296
         List<XWPFParagraph> paragraphs = xwpfDocument.getParagraphs();
1297
+        if(CollectionUtil.isEmpty( xwpfDocument.getParagraphs())){
1298
+            return new ArrayList<>();
1299
+        }
1286 1300
         String regex = "\\{\\{.*?\\}\\}"; // 定义占位符的正则表达式
1287 1301
         Pattern pattern = Pattern.compile(regex);
1288 1302
         List<String> bookmarkList=new ArrayList<>();
1289 1303
         for (XWPFParagraph paragraph : paragraphs) {
1290 1304
             String text = paragraph.getText();
1291
-            Matcher matcher = pattern.matcher(text);
1305
+            if(StrUtil.isNotEmpty(text)) {
1306
+                Matcher matcher = pattern.matcher(text);
1292 1307
 
1293
-            while (matcher.find()) {
1294
-                String placeholder = matcher.group();
1295
-                String keyword = placeholder.substring(2, placeholder.length() - 2);
1296
-                bookmarkList.add(keyword);
1308
+                while (matcher.find()) {
1309
+                    String placeholder = matcher.group();
1310
+                    String keyword = placeholder.substring(2, placeholder.length() - 2);
1311
+                    bookmarkList.add(keyword);
1312
+                }
1297 1313
             }
1298 1314
         }
1299 1315
         return bookmarkList;

+ 24
- 11
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Parādīt failu

@@ -1447,9 +1447,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1447 1447
                 String annexName = caseAttach.getAnnexName();
1448 1448
                 String prefix = "/profile";
1449 1449
                 int startIndex = annexName.indexOf(prefix);
1450
+                if(startIndex!=-1) {
1450 1451
                 startIndex += prefix.length();
1451
-                String annexPath = "/uploadPath" + annexName.substring(startIndex);
1452
-                caseAttach.setAnnexPath(annexPath);
1452
+
1453
+                    String annexPath = "/uploadPath" + annexName.substring(startIndex);
1454
+                    caseAttach.setAnnexPath(annexPath);
1455
+                }
1453 1456
                 int startIndexnew = annexName.lastIndexOf("/");
1454 1457
                 if (startIndexnew != -1) {
1455 1458
                     String annexNamenew = annexName.substring(startIndexnew + 1);
@@ -2307,8 +2310,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2307 2310
             Date startDate = messageVO.getScheduleStartTime();
2308 2311
             Date endDate = messageVO.getScheduleEndTime();
2309 2312
             SimpleDateFormat sdf = new SimpleDateFormat(format);
2310
-            startFormat = sdf.format(startDate);
2311
-            endFormat = sdf.format(endDate);
2313
+            if(startDate!=null) {
2314
+                startFormat = sdf.format(startDate);
2315
+            }
2316
+            if(endDate!=null) {
2317
+                endFormat = sdf.format(endDate);
2318
+            }
2312 2319
             // 预约会议短信模板
2313 2320
             request.setTemplateId("1983711");
2314 2321
 
@@ -3093,7 +3100,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3093 3100
                     CaseApplication caseApplication = new CaseApplication();
3094 3101
                     caseApplication.setTemplateId(templateId);
3095 3102
                     //默认案件标的 todo 案件标的是什么,默认写死
3096
-                    caseApplication.setCaseSubjectAmount(new BigDecimal(10000));
3103
+                    caseApplication.setCaseSubjectAmount(new BigDecimal(100000));
3097 3104
                 // todo 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
3098 3105
                 // 抓取规则,0-内置字段,1-自定义字段
3099 3106
                 Map<Integer, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
@@ -3105,7 +3112,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3105 3112
                         ColumnValue columnValue = new ColumnValue();
3106 3113
                         columnValue.setColumn(columnRule.getColumn());
3107 3114
                         columnValue.setName(columnRule.getColumnName());
3108
-                        columnValue.setValue(fatchMap.get(columnRule.getColumnName())); columnValue.setIsDefault(columnRule.getIsDefault());
3115
+                        columnValue.setValue(fatchMap.get(columnRule.getColumnName()));
3116
+                        columnValue.setIsDefault(1);
3109 3117
                         columnValueList.add(columnValue);
3110 3118
                     });
3111 3119
                 }
@@ -3139,12 +3147,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3139 3147
                     if (null != caseApplication.getId()) {
3140 3148
                         List<CaseAttach> caseAttachs = new ArrayList<>();
3141 3149
                         for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
3142
-                                String pdfUrl = entry.getValue();
3143
-                                File file1 = new File(pdfUrl);
3144
-                                CaseAttach caseAttach = new CaseAttach();
3150
+                                String fileUrl = entry.getValue();
3151
+                            // 上传
3152
+                            String filePath = RuoYiConfig.getUploadPath();
3153
+
3154
+                            CaseAttach caseAttach = new CaseAttach();
3145 3155
                                 caseAttach.setCaseAppliId(caseApplication.getId());
3146
-                                caseAttach.setAnnexPath(file1.getPath());
3147
-                                caseAttach.setAnnexName(file1.getName());
3156
+                                caseAttach.setAnnexPath(filePath);
3157
+                                if(StrUtil.isNotEmpty(fileUrl)) {
3158
+                                    String fileName = fileUrl.replace(filePath, "/profile/upload");
3159
+                                    caseAttach.setAnnexName(fileName);
3160
+                                }
3148 3161
                                 // 申请人提供的证据材料
3149 3162
                                 caseAttach.setAnnexType(2);
3150 3163
                                 caseAttachs.add(caseAttach);

+ 5
- 5
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java Parādīt failu

@@ -186,14 +186,14 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
186 186
                         CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
187 187
                     }
188 188
                 }
189
-                Boolean aBoolean1 = generateAward(caseId);
190
-                if (aBoolean1) {
189
+                // 生成裁决书
190
+                CaseApplication application = new CaseApplication();
191
+                application.setId(caseId);
192
+                adjudicationService.createDocument(application);
191 193
                     //修改案件状态
192 194
                     caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
193 195
                     int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
194
-                }else {
195
-                    return AjaxResult.error("裁决书生成失败");
196
-                }
196
+
197 197
             }
198 198
             return AjaxResult.success("审理成功");
199 199
         }

+ 80
- 12
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java Parādīt failu

@@ -222,17 +222,18 @@ public class OCRUtils {
222 222
             for (FatchRule fatchRule : fatchRules) {
223 223
                 // 从后往前抓取
224 224
                 if (fatchRule.getFatchOrder() != null && fatchRule.getFatchOrder() == 1) {
225
-//                    String reverseText = StrUtil.reverse(ocrText);
226
-//                    if (StrUtil.isEmpty(fatchRule.getStartContent()) && StrUtil.isEmpty(fatchRule.getEndContent())) {
227
-//                        fatchMap.put(fatchRule.getColumnName(), trimStr(text));
228
-//                    } else if(StrUtil.isEmpty(fatchRule.getStartContent())&&StrUtil.isNotEmpty(fatchRule.getEndContent())){
229
-//                        // 开始字段为空,结束字段不为空
230
-//                        String endReverseText = StrUtil.reverse(fatchRule.getEndContent());
231
-//                        int endContIndex = StrUtil.ordinalIndexOf(reverseText, endReverseText, fatchRule.getEndContentRepeatOrder());
232
-//                        if (endContIndex != -1) {
233
-//                            String substring = text.substring(0, endContIndex);
234
-//                            fatchMap.put(fatchRule.getColumnName(), trimStr(StrUtil.reverse(substring)));
235
-//                        }
225
+                    String reverseText = StrUtil.reverse(ocrText);
226
+                    if (StrUtil.isEmpty(fatchRule.getStartContent()) && StrUtil.isEmpty(fatchRule.getEndContent())) {
227
+                        fatchMap.put(fatchRule.getColumnName(), trimStr(text));
228
+                    } else if(StrUtil.isEmpty(fatchRule.getStartContent())&&StrUtil.isNotEmpty(fatchRule.getEndContent())) {
229
+                        // 开始字段为空,结束字段不为空
230
+                        String endReverseText = StrUtil.reverse(fatchRule.getEndContent());
231
+                        int endContIndex = StrUtil.ordinalIndexOf(reverseText, endReverseText, fatchRule.getEndContentRepeatOrder());
232
+                        if (endContIndex != -1) {
233
+                            String substring = text.substring(0, endContIndex);
234
+                            fatchMap.put(fatchRule.getColumnName(), trimStr(StrUtil.reverse(substring)));
235
+                        }
236
+                    }
236 237
 //
237 238
 //
238 239
 //                    }else if(StrUtil.isNotEmpty(fatchRule.getStartContent())&&StrUtil.isEmpty(fatchRule.getEndContent())){
@@ -277,7 +278,7 @@ public class OCRUtils {
277 278
                             } else {
278 279
                                 // 开始不为空结束不为空
279 280
                                 int endContIndex = StrUtil.ordinalIndexOf(text, fatchRule.getEndContent(), fatchRule.getEndContentRepeatOrder());
280
-                                if (endContIndex != -1 && (startContIndex + fatchRule.getStartContent().length()) <= text.length()) {
281
+                                if (endContIndex != -1 && (startContIndex + fatchRule.getStartContent().length()) <= text.length()&&(startContIndex + fatchRule.getStartContent().length())<=endContIndex ) {
281 282
                                     String substring = text.substring(startContIndex + fatchRule.getStartContent().length(), endContIndex);
282 283
                                     // 去除\n
283 284
                                     fatchMap.put(fatchRule.getColumnName(), trimStr(substring));
@@ -317,4 +318,71 @@ public class OCRUtils {
317 318
 
318 319
     }
319 320
 
321
+    public static void main(String[] args) {
322
+        String text="和 解 协 议\n" +
323
+                "\n" +
324
+                "\n" +
325
+                "甲方:上海维信荟智金融科技有限公司\n" +
326
+                "地址:上海市虹口区乍浦路89号办公楼1幢2801室\n" +
327
+                "电子邮箱【shaoyijie01@vcredit.com】\n" +
328
+                "\n" +
329
+                "乙方:【马旭】\n" +
330
+                "地址:【重庆市城口县蓼子乡长元路109号】\n" +
331
+                "手机号:【13585580076】\n" +
332
+                "身份证号:【500229198908244338】\n" +
333
+                "电子邮箱:【feiwen@vcredit.com】\n" +
334
+                "\n" +
335
+                "鉴于:\n" +
336
+                "乙方于【2023】年【3】月【1】日至【2023】年【4】月【26】日通过甲方旗下平台申请总计【2】笔贷款,本金合计【18000】元。乙方已于2023年4月31日结清上述2笔贷款。2023年10月6日,乙方称其对上述2笔贷款的担保合同、担保咨询服务合同(个人贷款委托担保合同:DD181b16j22010315099-1、担保服务合同:DD18qe30023020066644-1、担保咨询服务合同:DD18qe30023020066644-7)中约定的担保费、担保服务费不知情,向甲方要求退还上述担保费、担保服务费。甲方认为甲乙双方之间的上述合同真实有效,其中明确约定了上述担保费、担保服务费。双方因此产生纠纷。现甲方出于业务考虑,同意乙方履行保密义务的前提下,甲方给予特殊和解方案;乙方确认其充分知晓并理解本《和解协议》(下称“本协议”)中全部条款的实质含义及其相应的法律后果,并基于此种理解,履行相应义务,签署本协议。本协议于签署当日生效,对甲、乙双方具有同等法律拘束力。\n" +
337
+                "\n" +
338
+                "一、仲裁条款\n" +
339
+                "1、为了确保本协议的充分履行,甲乙双方达成一致:将本协议共同提交上海仲裁委员会予以立案确认其效力并作出裁决。由甲方作为仲裁案件申请人,乙方作为仲裁案件的被申请人。双方同意由甲方承担全部仲裁费。仲裁费以上海仲裁委员会实际出具的缴费通知书为准。双方均同意,上海仲裁委员会受理案件后,可通过电话或邮件的方式告知双方案件已受理的情况,无需再发送其他纸质书面的材料。(包括但不限于仲裁通知书、规则、名册、其他程序性文件以及本案仲裁申请书、证据材料等)。本案仲裁申请书、证据材料双方已经于提起仲裁前确认收到。\n" +
340
+                "\n" +
341
+                "双方同意本案适用快速程序,确认委托上海仲裁委员会主任指定一名仲裁员成立仲裁庭进行书面审理,并依法根据本协议作出裁决书,事实与理由从简。双方均同意放弃相应的答辩、举证等期限权利。双方同意由仲裁庭决定以其认为合适的方式,从简、从速处理本案。\n" +
342
+                "\n" +
343
+                "双方同意上海仲裁委员会通过电子送达方式向双方送达包括裁决书在内的各类仲裁法律文书,裁决书及各类仲裁法律文书发送至双方当事人所确认之电子邮箱的日期即为送达日期。双方确认本协议首部所载电子邮箱、联系地址和联系电话均为有效的送达信息。\n" +
344
+                "\n" +
345
+                "二、甲方郑重承诺\n" +
346
+                "1、甲方是独立线上消费金融服务提供商,合作方均为持牌金融机构。旗下各平台所经营的所有产品均合法合规,不存在任何违法、违规经营情形。\n" +
347
+                "2、甲方出于业务考虑,在乙方履行保密义务的前提下,给予乙方以下方案:【甲方于签署本协议之日起5日内给予乙方1000元补偿金】。\n" +
348
+                "\n" +
349
+                "三、乙方郑重承诺\n" +
350
+                "1、乙方接受甲方在本协议第二条项下所给予的和解方案,并在【3】个工作日内撤销对甲方及在甲方平台办理贷款涉及的所有资金方、担保方和其他相关方(上述公司的关联公司)的一切投诉,再无其他任何异议或主张,包括但不限于诉讼、信访、投诉、媒体平台举报等任何不利于甲方、资金方、担保方和其他相关方的言行或举动等。\n" +
351
+                "2、乙方承诺对本协议承担无限期保密义务,任何情况下不得将本协议内容泄露给任意第三方。\n" +
352
+                "3、若乙方违反上述任一承诺,则构成根本违约,应当退还甲方给予的全部补偿金,并承担违约责任。\n" +
353
+                "\n" +
354
+                "四、违约责任\n" +
355
+                "如果乙方违反本协议第三条项下任一承诺内容,则应当退还甲方给予的全部补偿金【1000】元,并向甲方一次性支付违约金【1000】元,上述金额共计【2000】元。同时,乙方应立即纠正违约行为并采取一切必要手段消除/挽回/弥补甲方因此遭受的损失或影响。\n" +
356
+                "\n" +
357
+                "\n" +
358
+                "\n" +
359
+                "甲方(盖章):                           乙方(签字):\n" +
360
+                "\n" +
361
+                "日期:2023年11月3日                                  日期:\n" +
362
+                "\n";
363
+        String[] split = text.split("日期:");
364
+        int order=1;
365
+        String s1 = spiltRtoL(text);
366
+        String substring = s1.substring(0, StrUtil.ordinalIndexOf(s1, StrUtil.reverse("日期:"), 2) + "日期:".length());
367
+
368
+        if(split.length>0){
369
+            String s = split[split.length - order];
370
+        }
371
+
372
+    }
373
+    public static String spiltRtoL(String s) {
374
+
375
+        StringBuffer sb = new StringBuffer();
376
+        int length = s.length();
377
+        char[] c = new char[length];
378
+        for (int i = 0; i < length; i++) {
379
+            c[i] = s.charAt(i);
380
+        }
381
+        for (int i = length - 1; i >= 0; i--) {
382
+            sb.append(c[i]);
383
+        }
384
+
385
+        return sb.toString();
386
+    }
387
+
320 388
 }

+ 2
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueLogMapper.xml Parādīt failu

@@ -11,11 +11,11 @@
11 11
         <result column="case_appli_log_id" property="caseAppliLogId" />
12 12
     </resultMap>
13 13
     <insert id="batchSave">
14
-        INSERT INTO column_value_log ( `COLUMN`, `NAME`, `VALUE`, case_appli_log_id )
14
+        INSERT INTO column_value_log ( `COLUMN`, `NAME`, `VALUE`, case_appli_log_id,is_default )
15 15
         values
16 16
         <foreach item="item" index="index" collection="list" separator=",">
17 17
 
18
-        (#{item.column},#{item.name},#{item.value},#{item.caseAppliLogId})
18
+        (#{item.column},#{item.name},#{item.value},#{item.caseAppliLogId},#{item.isDefault})
19 19
         </foreach>
20 20
     </insert>
21 21
     <select id="listBycaseAppliLogId" resultMap="BaseResultMap">

+ 3
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml Parādīt failu

@@ -9,13 +9,14 @@
9 9
         <result column="name" property="name" />
10 10
         <result column="value" property="value" />
11 11
         <result column="case_id" property="caseId" />
12
+        <result column="is_default" property="isDefault" />
12 13
     </resultMap>
13 14
     <insert id="batchSave">
14
-        INSERT INTO column_value ( `COLUMN`, `NAME`, `VALUE`, case_id )
15
+        INSERT INTO column_value ( `COLUMN`, `NAME`, `VALUE`, case_id,is_default )
15 16
         values
16 17
         <foreach item="item" index="index" collection="list" separator=",">
17 18
 
18
-        (#{item.column},#{item.name},#{item.value},#{item.caseId})
19
+        (#{item.column},#{item.name},#{item.value},#{item.caseId},#{item.isDefault})
19 20
         </foreach>
20 21
     </insert>
21 22
     <update id="batchUpdate">