From f989831de203fdbfc12e7a98d64746850c4f73d7 Mon Sep 17 00:00:00 2001 From: qitz <18810291185@163.com> Date: Fri, 8 Dec 2023 17:59:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=93=E5=8F=96?= =?UTF-8?q?=E8=A7=84=E5=88=99=E4=BF=9D=E5=AD=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeptIdentifyController.java | 18 +++++++++ .../domain/CaseApplication.java | 13 ++++++ .../wisdomarbitrate/domain/FatchRule.java | 1 + .../domain/vo/ColumnValue.java | 2 + .../mapper/ColumnValueMapper.java | 2 + .../mapper/FatchRuleMapper.java | 4 ++ .../service/IDeptIdentifyService.java | 4 ++ .../impl/CaseApplicationServiceImpl.java | 7 ++++ .../service/impl/DeptIdentifyServiceImpl.java | 40 ++++++++++++++++++- .../wisdomarbitrate/ColumnValueMapper.xml | 13 ++++++ .../wisdomarbitrate/FatchRuleMapper.xml | 33 +++++++++++++++ 11 files changed, 136 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java index 963f31d..7c9fd50 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java @@ -199,7 +199,25 @@ public class DeptIdentifyController extends BaseController { return deptIdentifyService.saveFatchRules(templateManage); } + /** + * 查询column和注释 + * @return + */ + @PostMapping("/selectColumnandComment") + public AjaxResult selectColumnandComment(){ + List fatchRuleList = deptIdentifyService.selectColumnandComment(); + return AjaxResult.success(fatchRuleList); + } + /** + * 查询column + * @return + */ + @PostMapping("/selectColumnbycomment") + public AjaxResult selectColumnbycomment(@RequestBody FatchRule fatchRule){ + FatchRule fatchRulesel = deptIdentifyService.selectColumnbycomment(fatchRule); + return AjaxResult.success(fatchRulesel); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index dfa3323..7276d54 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -3,6 +3,8 @@ package com.ruoyi.wisdomarbitrate.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; + import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -31,6 +33,7 @@ public class CaseApplication extends BaseEntity { private Long templateId; + /** 立案日期 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date registerDate; @@ -621,6 +624,16 @@ public class CaseApplication extends BaseEntity { this.annexTypeList = annexTypeList; } + private List columnValues; + + public List getColumnValues() { + return columnValues; + } + + public void setColumnValues(List columnValues) { + this.columnValues = columnValues; + } + /** * 案件附件列表 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java index 3d4eca3..aa0f5ee 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java @@ -24,5 +24,6 @@ public class FatchRule extends BaseEntity { private Integer isDefault; private Long templateId; + private String databaseName; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java index 19dc288..09a247d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java @@ -34,4 +34,6 @@ public class ColumnValue { */ private Long caseId; + private Integer isDefault; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java index 11b380e..592665a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java @@ -1,5 +1,6 @@ package com.ruoyi.wisdomarbitrate.mapper; +import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.FatchRule; import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; import org.apache.ibatis.annotations.Param; @@ -25,4 +26,5 @@ public interface ColumnValueMapper { */ List listByCaseId(@Param("caseId") Long caseId); + List queryColumnValueList(ColumnValue columnValue); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java index 4961bbf..b331854 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java @@ -25,4 +25,8 @@ public interface FatchRuleMapper { void deletebatchFatchRule(@Param("fatchRuleIds") List fatchRuleIds); int insertFatchRule(FatchRule fatchRule); + + List selectColumnandComment(FatchRule fatchRuleselect); + + FatchRule selectColumnbycomment(FatchRule fatchRule); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java index a5f0fd8..251820b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java @@ -55,4 +55,8 @@ public interface IDeptIdentifyService { List getFatchRuleByTemplateid(TemplateManage templateManage); AjaxResult saveFatchRules(TemplateManage templateManage); + + List selectColumnandComment(); + + FatchRule selectColumnbycomment(FatchRule fatchRule); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 31454c5..39dde64 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -1395,6 +1395,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { arbitrateRecord.setCaseAppliId(caseApplication.getId()); ArbitrateRecord arbitrateRecordselect = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord); + ColumnValue columnValue = new ColumnValue(); + columnValue.setIsDefault(1); + columnValue.setCaseId(caseApplication.getId()); + List columnValueList = columnValueMapper.queryColumnValueList(columnValue); + caseApplicationselect.setColumnValues(columnValueList); + // CaseAttach caseAttachSelect = new CaseAttach(); // caseAttachSelect.setCaseAppliId(caseApplication.getId()); // caseAttachSelect.setAnnexType(2); @@ -1449,6 +1455,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationselect.setRespondentName(respondentName.toString()); caseApplicationselect.setCaseAffiliates(caseAffiliatListeselect); caseApplicationselect.setArbitrateRecord(arbitrateRecordselect); + } return caseApplicationselect; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index cb270e0..29f3e83 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.EsignDemoException; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SealUtil; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.system.domain.SysUserPost; @@ -36,6 +37,7 @@ import java.io.IOException; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; import static com.ruoyi.common.utils.PageUtils.startPage; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -558,10 +560,30 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId()); List fatchRules = templateManage.getFatchRules(); + + Map columnmap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumn(), Collectors.counting())); + Stream columnStream = columnmap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()); + List strlist1 = new ArrayList<>(); + columnStream.forEach(column -> { + strlist1.add(column.toString()); + }); + if(strlist1!=null&&strlist1.size()>0){ + throw new ServiceException("字段' " + String.join(",", strlist1) + " '重复"); + } + + Map columnNamemap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumnName(), Collectors.counting())); + Stream columnNameStream = columnNamemap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()); + List strlist2 = new ArrayList<>(); + columnNameStream.forEach(column -> { + strlist2.add(column.toString()); + }); + if(strlist2!=null&&strlist2.size()>0){ + throw new ServiceException("字段' " + String.join(",", strlist2) + " '重复"); + } + if(fatchRules!=null&&fatchRules.size()>0){ for (FatchRule fatchRule : fatchRules) { //保存抓取规则数据 - fatchRule.setIsDefault(0); fatchRuleMapper.insertFatchRule(fatchRule); //保存模板抓取规则关联关系 Long fatchRuleId = fatchRule.getId(); @@ -575,6 +597,22 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { return AjaxResult.error(); } + @Override + public List selectColumnandComment() { + List fatchRules = new ArrayList<>(); + FatchRule fatchRuleselect = new FatchRule(); + fatchRuleselect.setDatabaseName("test_smart_arbitration"); + fatchRules = fatchRuleMapper.selectColumnandComment(fatchRuleselect); + return fatchRules; + } + + @Override + public FatchRule selectColumnbycomment(FatchRule fatchRule) { + fatchRule.setDatabaseName("test_smart_arbitration"); + FatchRule fatchRulesel = fatchRuleMapper.selectColumnbycomment(fatchRule); + return fatchRulesel; + } + private String getFileExtension(String fileName) { int lastDotIndex = fileName.lastIndexOf("."); if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) { diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml index 6f55b7a..919d8f7 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml @@ -22,5 +22,18 @@ select * from column_value where case_id=#{caseId} + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml index 9c9316b..4761af6 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml @@ -30,6 +30,39 @@ + + + + +