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