瀏覽代碼

修改抓取规则保存功能

qitz 2 年之前
父節點
當前提交
f989831de2

+ 18
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

+ 39
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java 查看文件

@@ -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) {

+ 13
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml 查看文件

@@ -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 查看文件

@@ -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.columnName