修改抓取规则保存功能

This commit is contained in:
qitz
2023-12-08 17:59:09 +08:00
parent 3cc3be3ee0
commit f989831de2
11 changed files with 136 additions and 1 deletions
@@ -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<ColumnValue> columnValues;
public List<ColumnValue> getColumnValues() {
return columnValues;
}
public void setColumnValues(List<ColumnValue> columnValues) {
this.columnValues = columnValues;
}
/**
* 案件附件列表
*/
@@ -24,5 +24,6 @@ public class FatchRule extends BaseEntity {
private Integer isDefault;
private Long templateId;
private String databaseName;
}
@@ -34,4 +34,6 @@ public class ColumnValue {
*/
private Long caseId;
private Integer isDefault;
}
@@ -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<ColumnValue> listByCaseId(@Param("caseId") Long caseId);
List<ColumnValue> queryColumnValueList(ColumnValue columnValue);
}
@@ -25,4 +25,8 @@ public interface FatchRuleMapper {
void deletebatchFatchRule(@Param("fatchRuleIds") List<Long> fatchRuleIds);
int insertFatchRule(FatchRule fatchRule);
List<FatchRule> selectColumnandComment(FatchRule fatchRuleselect);
FatchRule selectColumnbycomment(FatchRule fatchRule);
}
@@ -55,4 +55,8 @@ public interface IDeptIdentifyService {
List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage);
AjaxResult saveFatchRules(TemplateManage templateManage);
List<FatchRule> selectColumnandComment();
FatchRule selectColumnbycomment(FatchRule fatchRule);
}
@@ -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<ColumnValue> 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;
}
@@ -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<FatchRule> fatchRules = templateManage.getFatchRules();
Map<Object, Long> columnmap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumn(), Collectors.counting()));
Stream<Object> columnStream = columnmap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
List<String> strlist1 = new ArrayList<>();
columnStream.forEach(column -> {
strlist1.add(column.toString());
});
if(strlist1!=null&&strlist1.size()>0){
throw new ServiceException("字段' " + String.join(",", strlist1) + " '重复");
}
Map<Object, Long> columnNamemap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumnName(), Collectors.counting()));
Stream<Object> columnNameStream = columnNamemap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
List<String> 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<FatchRule> selectColumnandComment() {
List<FatchRule> 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) {