Ver código fonte

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

qtz 2 anos atrás
pai
commit
dc498364ae

+ 18
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Ver arquivo

@@ -199,7 +199,25 @@ public class DeptIdentifyController extends BaseController {
199 199
         return deptIdentifyService.saveFatchRules(templateManage);
200 200
     }
201 201
 
202
+    /**
203
+     * 查询column和注释
204
+     * @return
205
+     */
206
+    @PostMapping("/selectColumnandComment")
207
+    public AjaxResult selectColumnandComment(){
208
+        List<FatchRule> fatchRuleList = deptIdentifyService.selectColumnandComment();
209
+        return AjaxResult.success(fatchRuleList);
210
+    }
202 211
 
212
+    /**
213
+     * 查询column
214
+     * @return
215
+     */
216
+    @PostMapping("/selectColumnbycomment")
217
+    public AjaxResult selectColumnbycomment(@RequestBody  FatchRule fatchRule){
218
+        FatchRule fatchRulesel = deptIdentifyService.selectColumnbycomment(fatchRule);
219
+        return AjaxResult.success(fatchRulesel);
220
+    }
203 221
 
204 222
 
205 223
 

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

@@ -3,6 +3,8 @@ package com.ruoyi.wisdomarbitrate.domain;
3 3
 import com.fasterxml.jackson.annotation.JsonFormat;
4 4
 import com.ruoyi.common.annotation.Excel;
5 5
 import com.ruoyi.common.core.domain.BaseEntity;
6
+import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
7
+
6 8
 import java.math.BigDecimal;
7 9
 import java.util.Date;
8 10
 import java.util.List;
@@ -31,6 +33,7 @@ public class CaseApplication  extends BaseEntity {
31 33
     private Long templateId;
32 34
 
33 35
 
36
+
34 37
     /** 立案日期 */
35 38
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
36 39
     private Date registerDate;
@@ -621,6 +624,16 @@ public class CaseApplication  extends BaseEntity {
621 624
         this.annexTypeList = annexTypeList;
622 625
     }
623 626
 
627
+    private List<ColumnValue> columnValues;
628
+
629
+    public List<ColumnValue> getColumnValues() {
630
+        return columnValues;
631
+    }
632
+
633
+    public void setColumnValues(List<ColumnValue> columnValues) {
634
+        this.columnValues = columnValues;
635
+    }
636
+
624 637
     /**
625 638
      * 案件附件列表
626 639
      */

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java Ver arquivo

@@ -24,5 +24,6 @@ public class FatchRule extends BaseEntity {
24 24
     private Integer isDefault;
25 25
 
26 26
     private Long templateId;
27
+    private String databaseName;
27 28
 
28 29
 }

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java Ver arquivo

@@ -34,4 +34,6 @@ public class ColumnValue {
34 34
      */
35 35
     private Long caseId;
36 36
 
37
+    private Integer isDefault;
38
+
37 39
 }

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java Ver arquivo

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.wisdomarbitrate.mapper;
2 2
 
3
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
3 4
 import com.ruoyi.wisdomarbitrate.domain.FatchRule;
4 5
 import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
5 6
 import org.apache.ibatis.annotations.Param;
@@ -25,4 +26,5 @@ public interface ColumnValueMapper {
25 26
      */
26 27
     List<ColumnValue> listByCaseId(@Param("caseId") Long caseId);
27 28
 
29
+    List<ColumnValue> queryColumnValueList(ColumnValue columnValue);
28 30
 }

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java Ver arquivo

@@ -25,4 +25,8 @@ public interface FatchRuleMapper {
25 25
    void deletebatchFatchRule(@Param("fatchRuleIds")  List<Long> fatchRuleIds);
26 26
 
27 27
    int insertFatchRule(FatchRule fatchRule);
28
+
29
+   List<FatchRule> selectColumnandComment(FatchRule fatchRuleselect);
30
+
31
+   FatchRule selectColumnbycomment(FatchRule fatchRule);
28 32
 }

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java Ver arquivo

@@ -55,4 +55,8 @@ public interface IDeptIdentifyService {
55 55
     List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage);
56 56
 
57 57
     AjaxResult saveFatchRules(TemplateManage templateManage);
58
+
59
+    List<FatchRule> selectColumnandComment();
60
+
61
+    FatchRule selectColumnbycomment(FatchRule fatchRule);
58 62
 }

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

@@ -1397,6 +1397,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1397 1397
         arbitrateRecord.setCaseAppliId(caseApplication.getId());
1398 1398
         ArbitrateRecord arbitrateRecordselect = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
1399 1399
 
1400
+        ColumnValue columnValue = new ColumnValue();
1401
+        columnValue.setIsDefault(1);
1402
+        columnValue.setCaseId(caseApplication.getId());
1403
+        List<ColumnValue> columnValueList = columnValueMapper.queryColumnValueList(columnValue);
1404
+        caseApplicationselect.setColumnValues(columnValueList);
1405
+
1400 1406
 //        CaseAttach caseAttachSelect = new CaseAttach();
1401 1407
 //        caseAttachSelect.setCaseAppliId(caseApplication.getId());
1402 1408
 //        caseAttachSelect.setAnnexType(2);
@@ -1451,6 +1457,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1451 1457
             caseApplicationselect.setRespondentName(respondentName.toString());
1452 1458
             caseApplicationselect.setCaseAffiliates(caseAffiliatListeselect);
1453 1459
             caseApplicationselect.setArbitrateRecord(arbitrateRecordselect);
1460
+
1454 1461
         }
1455 1462
         return caseApplicationselect;
1456 1463
     }

+ 39
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Ver arquivo

@@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
12 12
 import com.ruoyi.common.core.domain.entity.SysDept;
13 13
 import com.ruoyi.common.core.domain.entity.SysUser;
14 14
 import com.ruoyi.common.exception.EsignDemoException;
15
+import com.ruoyi.common.exception.ServiceException;
15 16
 import com.ruoyi.common.utils.SealUtil;
16 17
 import com.ruoyi.common.utils.file.FileUploadUtils;
17 18
 import com.ruoyi.system.domain.SysUserPost;
@@ -36,6 +37,7 @@ import java.io.IOException;
36 37
 import java.time.LocalDate;
37 38
 import java.util.*;
38 39
 import java.util.stream.Collectors;
40
+import java.util.stream.Stream;
39 41
 
40 42
 import static com.ruoyi.common.utils.PageUtils.startPage;
41 43
 import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@@ -558,10 +560,30 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
558 560
         templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId());
559 561
 
560 562
         List<FatchRule> fatchRules = templateManage.getFatchRules();
563
+
564
+        Map<Object, Long> columnmap  = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumn(), Collectors.counting()));
565
+        Stream<Object> columnStream = columnmap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
566
+        List<String> strlist1 = new ArrayList<>();
567
+        columnStream.forEach(column -> {
568
+            strlist1.add(column.toString());
569
+        });
570
+        if(strlist1!=null&&strlist1.size()>0){
571
+            throw new ServiceException("字段' " + String.join(",", strlist1)  + " '重复");
572
+        }
573
+
574
+        Map<Object, Long> columnNamemap  = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumnName(), Collectors.counting()));
575
+        Stream<Object> columnNameStream = columnNamemap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
576
+        List<String> strlist2 = new ArrayList<>();
577
+        columnNameStream.forEach(column -> {
578
+            strlist2.add(column.toString());
579
+        });
580
+        if(strlist2!=null&&strlist2.size()>0){
581
+            throw new ServiceException("字段' " + String.join(",", strlist2) + " '重复");
582
+        }
583
+
561 584
         if(fatchRules!=null&&fatchRules.size()>0){
562 585
             for (FatchRule fatchRule : fatchRules) {
563 586
                 //保存抓取规则数据
564
-                fatchRule.setIsDefault(0);
565 587
                 fatchRuleMapper.insertFatchRule(fatchRule);
566 588
                 //保存模板抓取规则关联关系
567 589
                 Long fatchRuleId = fatchRule.getId();
@@ -575,6 +597,22 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
575 597
         return AjaxResult.error();
576 598
     }
577 599
 
600
+    @Override
601
+    public List<FatchRule> selectColumnandComment() {
602
+        List<FatchRule>  fatchRules = new ArrayList<>();
603
+        FatchRule fatchRuleselect = new FatchRule();
604
+        fatchRuleselect.setDatabaseName("test_smart_arbitration");
605
+        fatchRules = fatchRuleMapper.selectColumnandComment(fatchRuleselect);
606
+        return fatchRules;
607
+    }
608
+
609
+    @Override
610
+    public FatchRule selectColumnbycomment(FatchRule fatchRule) {
611
+        fatchRule.setDatabaseName("test_smart_arbitration");
612
+        FatchRule fatchRulesel = fatchRuleMapper.selectColumnbycomment(fatchRule);
613
+        return fatchRulesel;
614
+    }
615
+
578 616
     private String getFileExtension(String fileName) {
579 617
         int lastDotIndex = fileName.lastIndexOf(".");
580 618
         if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {

+ 54
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/ZipFileUtils.java Ver arquivo

@@ -0,0 +1,54 @@
1
+package com.ruoyi.wisdomarbitrate.utils;
2
+
3
+import java.io.File;
4
+import java.io.FileInputStream;
5
+import java.io.FileOutputStream;
6
+import java.io.IOException;
7
+import java.util.zip.ZipEntry;
8
+import java.util.zip.ZipOutputStream;
9
+
10
+public class ZipFileUtils {
11
+
12
+    public static void main(String[] args) {
13
+        String filePath1 = "/path/to/file1.txt";
14
+        String filePath2 = "/path/to/file2.txt";
15
+
16
+        // ZIP文件的输出路径
17
+        String zipOutPath = "/path/to/output.zip";
18
+
19
+        try {
20
+            FileOutputStream fous = new FileOutputStream(zipOutPath);
21
+            ZipOutputStream zipOutstream = new ZipOutputStream(fous);
22
+            FileInputStream fis1 = new FileInputStream(filePath1);
23
+            FileInputStream fis2 = new FileInputStream(filePath2);
24
+
25
+            zipFile(filePath1, fis1, zipOutstream);
26
+
27
+            zipFile(filePath2, fis2, zipOutstream);
28
+
29
+            System.out.println("文件成功打包成ZIP文件!");
30
+        } catch (IOException e) {
31
+            e.printStackTrace();
32
+        }
33
+    }
34
+
35
+
36
+
37
+
38
+
39
+
40
+    private static void zipFile(String zipfilePath, FileInputStream zipFileinsteam, ZipOutputStream zipfileOut)
41
+            throws IOException {
42
+        ZipEntry zipfileEntry = new ZipEntry(new File(zipfilePath).getName());
43
+        zipfileOut.putNextEntry(zipfileEntry);
44
+
45
+        // 从输入流读取数据并写入ZIP文件
46
+        byte[] bytes = new byte[1024];
47
+        int length;
48
+        while ((length = zipFileinsteam.read(bytes)) >= 0) {
49
+            zipfileOut.write(bytes, 0, length);
50
+        }
51
+        zipfileOut.closeEntry();
52
+        zipFileinsteam.close();
53
+    }
54
+}

+ 13
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml Ver arquivo

@@ -22,5 +22,18 @@
22 22
         select * from column_value where case_id=#{caseId}
23 23
     </select>
24 24
 
25
+    <select id="queryColumnValueList"  parameterType="ColumnValue"  resultMap="BaseResultMap">
26
+        select * from column_value c
27
+        <where>
28
+            <if test="caseId != null">
29
+                AND c.case_id  = #{caseId}
30
+            </if>
31
+            <if test="isDefault != null">
32
+                AND c.is_default  = #{isDefault}
33
+            </if>
34
+
35
+        </where>
36
+    </select>
37
+
25 38
 
26 39
 </mapper>

+ 33
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml Ver arquivo

@@ -30,6 +30,39 @@
30 30
         </where>
31 31
     </select>
32 32
 
33
+    <select id="selectColumnandComment"  parameterType="FatchRule"  resultMap="BaseResultMap">
34
+        select
35
+            a.COLUMN_name as `column`,
36
+            a.COLumn_comment as column_name
37
+        from
38
+            information_schema.COLUMNS a
39
+        where
40
+            TABLE_schema =  #{databaseName}
41
+            and TABLE_name in('case_application','case_affiliate')
42
+            and COLUMN_NAME  not in('id','case_appli_id','case_num','case_subject_amount',
43
+        'register_date','arbitrat_method','case_status','hear_date','begin_video_date',
44
+        'online_video_person','create_time','update_by','update_time','create_by',
45
+        'arbitrator_id','arbitrator_name','pended_trial_arbitorid','pending_appoint_arbotrar',
46
+        'case_name','case_result','is_agree_pend_tral','objection_add_eviden','open_court_hear',
47
+        'paid_expenses','filearbitra_url','pay_type','adjudica_counter','proper_preser','objecti_juris',
48
+        'is_absence','respon_cross_opin','applica_cross_opin','respon_defen_opini','appli_is_absen',
49
+        'lock_status','room_id','import_flag','version','batch_number','template_id','applicant_agent_user_id','contract_number','identity_type','application_organ_id')
50
+
51
+    </select>
52
+
53
+    <select id="selectColumnbycomment"  parameterType="FatchRule"  resultMap="BaseResultMap">
54
+        select
55
+              COLUMN_NAME
56
+        from
57
+            information_schema.COLUMNS
58
+        where
59
+            TABLE_schema =  #{databaseName}
60
+            and TABLE_name in('case_application','case_affiliate')
61
+            and  COLumn_comment  = #{columnName}
62
+
63
+    </select>
64
+
65
+
33 66
     <select id="selectFatchRuleListIsDefault" parameterType="FatchRule" resultMap="BaseResultMap">
34 67
         SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
35 68
         f.`column` ,f.is_default ,f.`column_name`