Browse Source

应急导入校验

ZeroLiYi 3 months ago
parent
commit
3021c4dae7

+ 31 - 14
unis-plugin/unis-plugin-biz/src/main/java/com/unis/emergencySupport/modular/es/controller/EsDeliveryEnterpriseController.java

@@ -150,25 +150,42 @@ public class EsDeliveryEnterpriseController {
150
             @ApiImplicitParam(name = "file", value = "文件对象集合")
150
             @ApiImplicitParam(name = "file", value = "文件对象集合")
151
     })
151
     })
152
     @PostMapping(value= "/emergencySupport/esDeliveryEnterprise/importByEntity", headers= "content-type= multipart/form-data", consumes= "multipart/*")
152
     @PostMapping(value= "/emergencySupport/esDeliveryEnterprise/importByEntity", headers= "content-type= multipart/form-data", consumes= "multipart/*")
153
-    public CommonResult<Map<String,Object>> importByEntity(@RequestParam(value= "file", required = true) MultipartFile file) throws IOException {
153
+    public CommonResult<Map<String,Object>> importByEntity(@RequestParam(value= "file", required = true) MultipartFile file) throws Exception {
154
 
154
 
155
         Map<String,Object> map = new HashMap<String,Object>();
155
         Map<String,Object> map = new HashMap<String,Object>();
156
-        if(file== null){
157
-            map.put("massage","无文件数据");
158
-            map.put("status","500");
159
-            return CommonResult.data(map);
160
-        }
161
-        //获得文件名
162
-        String fileName = file.getOriginalFilename();
163
-        //判断文件是否是excel文件
164
-        if (!fileName.endsWith("xls") && !fileName.endsWith("xlsx")) {
165
-            map.put("massage","请使用正确的导入模板");
166
-            map.put("status","500");
156
+
157
+        try {
158
+            // Check if file is null
159
+            if (file == null) {
160
+                map.put("message", "无文件数据"); // Note: corrected the typo from "massage" to "message"
161
+                map.put("status", "500");
162
+                return CommonResult.data(map);
163
+            }
164
+
165
+            // Get the file name
166
+            String fileName = file.getOriginalFilename();
167
+
168
+            // Check if the file is an Excel file
169
+            if (fileName == null || (!fileName.endsWith("xls") && !fileName.endsWith("xlsx"))) {
170
+                map.put("message", "请使用正确的导入模板"); // Note: corrected the typo from "massage" to "message"
171
+                map.put("status", "500");
172
+                return CommonResult.data(map);
173
+            }
174
+
175
+            // Process the file using the service
176
+            return CommonResult.data(esDeliveryEnterpriseService.importByEntityResult(file,map));
177
+        } catch (Exception e) {
178
+            // Handle exceptions
179
+            map.put("message", "文件处理失败: " + e.getMessage());
180
+            map.put("status", "500");
167
             return CommonResult.data(map);
181
             return CommonResult.data(map);
168
         }
182
         }
169
 
183
 
170
-        return CommonResult.data(esDeliveryEnterpriseService.importByEntityResult(file,map));
171
-
172
     }
184
     }
173
 
185
 
186
+
187
+
188
+
189
+
190
+
174
 }
191
 }

+ 1 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/emergencySupport/modular/es/service/EsDeliveryEnterpriseService.java

@@ -81,5 +81,5 @@ public interface EsDeliveryEnterpriseService extends IService<EsDeliveryEnterpri
81
 
81
 
82
     List<EsDeliveryEnterpriseCountVO> selectCount(EsDeliveryEnterpriseCountParam esDeliveryEnterpriseCountParam);
82
     List<EsDeliveryEnterpriseCountVO> selectCount(EsDeliveryEnterpriseCountParam esDeliveryEnterpriseCountParam);
83
 
83
 
84
-    Map<String, Object> importByEntityResult(MultipartFile file, Map<String, Object> map) throws IOException;
84
+    Map<String, Object> importByEntityResult(MultipartFile file, Map<String, Object> map) throws Exception;
85
 }
85
 }

+ 62 - 5
unis-plugin/unis-plugin-biz/src/main/java/com/unis/emergencySupport/modular/es/service/impl/EsDeliveryEnterpriseServiceImpl.java

@@ -184,7 +184,7 @@ public class EsDeliveryEnterpriseServiceImpl extends ServiceImpl<EsDeliveryEnter
184
     }
184
     }
185
 
185
 
186
     @Override
186
     @Override
187
-    public Map<String, Object> importByEntityResult(MultipartFile file, Map<String, Object> map) throws IOException {
187
+    public Map<String, Object> importByEntityResult(MultipartFile file, Map<String, Object> map) throws Exception {
188
         BigDecimal quantity=new BigDecimal(0.00);
188
         BigDecimal quantity=new BigDecimal(0.00);
189
         Integer in =0;
189
         Integer in =0;
190
         Integer index = 6;
190
         Integer index = 6;
@@ -741,32 +741,50 @@ public class EsDeliveryEnterpriseServiceImpl extends ServiceImpl<EsDeliveryEnter
741
         QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
741
         QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
742
         queryWrapper1.eq("DICT_LABEL",strings[1]);
742
         queryWrapper1.eq("DICT_LABEL",strings[1]);
743
         List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
743
         List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
744
+        if(list1.isEmpty()){
745
+            throw new IndexOutOfBoundsException(strings[1]+"不是正确的");
746
+        }
744
         EsNetworkEntry.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
747
         EsNetworkEntry.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
745
 
748
 
746
         QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
749
         QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
747
         queryWrapper2.eq("DICT_LABEL",strings[2]);
750
         queryWrapper2.eq("DICT_LABEL",strings[2]);
748
         List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
751
         List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
752
+        if(list2.isEmpty()){
753
+            throw new IndexOutOfBoundsException(strings[2]+"不是正确的");
754
+        }
749
         EsNetworkEntry.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
755
         EsNetworkEntry.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
750
 
756
 
751
         QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
757
         QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
752
         queryWrapper3.eq("DICT_LABEL",strings[3]);
758
         queryWrapper3.eq("DICT_LABEL",strings[3]);
753
         List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
759
         List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
760
+        if(list3.isEmpty()){
761
+            throw new IndexOutOfBoundsException(strings[3]+"不是正确的");
762
+        }
754
         EsNetworkEntry.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
763
         EsNetworkEntry.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
755
 
764
 
756
-
757
-        QueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
765
+        ueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
758
         queryWrapper4.eq("DICT_LABEL",strings[4]);
766
         queryWrapper4.eq("DICT_LABEL",strings[4]);
759
         List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
767
         List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
768
+        if(list4.isEmpty()){
769
+            throw new IndexOutOfBoundsException(strings[4]+"不是正确的")
770
+        Q;
771
+        }
760
         EsNetworkEntry.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
772
         EsNetworkEntry.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
761
 
773
 
762
         QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
774
         QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
763
         queryWrapper5.eq("DICT_LABEL",strings[5]);
775
         queryWrapper5.eq("DICT_LABEL",strings[5]);
764
         List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
776
         List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
777
+        if(list5.isEmpty()){
778
+            throw new IndexOutOfBoundsException(strings[5]+"不是正确的");
779
+        }
765
         EsNetworkEntry.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
780
         EsNetworkEntry.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
766
 
781
 
767
         QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
782
         QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
768
         queryWrapper6.eq("DICT_LABEL",strings[6]);
783
         queryWrapper6.eq("DICT_LABEL",strings[6]);
769
         List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
784
         List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
785
+        if(list6.isEmpty()){
786
+            throw new IndexOutOfBoundsException(strings[6]+"不是正确的");
787
+        }
770
         EsNetworkEntry.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
788
         EsNetworkEntry.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
771
 
789
 
772
 
790
 
@@ -808,9 +826,48 @@ public class EsDeliveryEnterpriseServiceImpl extends ServiceImpl<EsDeliveryEnter
808
         List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
826
         List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
809
         EsNetworkEntry.setEnterpriseType(strings[16]);//企业类型
827
         EsNetworkEntry.setEnterpriseType(strings[16]);//企业类型
810
 
828
 
811
-        EsNetworkEntry.setLongitude(new BigDecimal(strings[17]));//经度
829
+        if (strings[17] != null && !strings[17].isEmpty()) {
830
+            try {
831
+                BigDecimal longitude = new BigDecimal(strings[17]);
832
+                // 进行范围检查
833
+                if (longitude.compareTo(BigDecimal.valueOf(-180)) < 0 || longitude.compareTo(BigDecimal.valueOf(180)) > 0) {
834
+                    throw new IllegalArgumentException("经度超出有效范围");
835
+                }
836
+                // 进行精度和小数位数检查
837
+                if (longitude.scale() > 6) { // 假设精度不能超过6位小数
838
+                    throw new IllegalArgumentException("经度小数位数过多");
839
+                }
840
+                EsNetworkEntry.setLongitude(longitude);
841
+            } catch (NumberFormatException e) {
842
+                throw new NumberFormatException(strings[17] + " 经度格式不正确");
843
+            } catch (IllegalArgumentException e) {
844
+                throw new IllegalArgumentException(strings[17] + " " + e.getMessage());
845
+            }
846
+        } else {
847
+            throw new NumberFormatException(strings[17] + " 经度格式不正确");
848
+        }
849
+
850
+        if (strings[18] != null && !strings[18].isEmpty()) {
851
+            try {
852
+                BigDecimal latitude = new BigDecimal(strings[18]);
853
+                // 进行范围检查
854
+                if (latitude.compareTo(BigDecimal.valueOf(-90)) < 0 || latitude.compareTo(BigDecimal.valueOf(90)) > 0) {
855
+                    throw new IllegalArgumentException("纬度超出有效范围");
856
+                }
857
+                // 进行精度和小数位数检查
858
+                if (latitude.scale() > 6) { // 假设精度不能超过6位小数
859
+                    throw new IllegalArgumentException("纬度小数位数过多");
860
+                }
861
+                EsNetworkEntry.setLatitude(latitude);
862
+            } catch (NumberFormatException e) {
863
+                throw new NumberFormatException(strings[18] + " 纬度格式不正确");
864
+            } catch (IllegalArgumentException e) {
865
+                throw new IllegalArgumentException(strings[18] + " " + e.getMessage());
866
+            }
867
+        } else {
868
+            throw new NumberFormatException(strings[18] + " 纬度格式不正确");
869
+        }
812
 
870
 
813
-        EsNetworkEntry.setLatitude(new BigDecimal(strings[18]));//纬度
814
 
871
 
815
 
872
 
816
         EsNetworkEntry.setLegalRepresentative(strings[19]);//法人姓名
873
         EsNetworkEntry.setLegalRepresentative(strings[19]);//法人姓名

+ 60 - 2
unis-plugin/unis-plugin-biz/src/main/java/com/unis/emergencySupport/modular/es/service/impl/EsNetworkEntryServiceImpl.java

@@ -590,32 +590,50 @@ public class EsNetworkEntryServiceImpl extends ServiceImpl<EsNetworkEntryMapper,
590
         QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
590
         QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
591
         queryWrapper1.eq("DICT_LABEL",strings[1]);
591
         queryWrapper1.eq("DICT_LABEL",strings[1]);
592
         List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
592
         List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
593
+        if(list1.isEmpty()){
594
+            throw new IndexOutOfBoundsException(strings[1]+"不是正确的");
595
+        }
593
         EsNetworkEntry.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
596
         EsNetworkEntry.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
594
 
597
 
595
         QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
598
         QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
596
         queryWrapper2.eq("DICT_LABEL",strings[2]);
599
         queryWrapper2.eq("DICT_LABEL",strings[2]);
597
         List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
600
         List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
601
+        if(list2.isEmpty()){
602
+            throw new IndexOutOfBoundsException(strings[2]+"不是正确的");
603
+        }
598
         EsNetworkEntry.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
604
         EsNetworkEntry.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
599
 
605
 
600
         QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
606
         QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
601
         queryWrapper3.eq("DICT_LABEL",strings[3]);
607
         queryWrapper3.eq("DICT_LABEL",strings[3]);
602
         List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
608
         List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
609
+        if(list3.isEmpty()){
610
+            throw new IndexOutOfBoundsException(strings[3]+"不是正确的");
611
+        }
603
         EsNetworkEntry.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
612
         EsNetworkEntry.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
604
 
613
 
605
 
614
 
606
         QueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
615
         QueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
607
         queryWrapper4.eq("DICT_LABEL",strings[4]);
616
         queryWrapper4.eq("DICT_LABEL",strings[4]);
608
         List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
617
         List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
618
+        if(list4.isEmpty()){
619
+            throw new IndexOutOfBoundsException(strings[4]+"不是正确的");
620
+        }
609
         EsNetworkEntry.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
621
         EsNetworkEntry.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
610
 
622
 
611
         QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
623
         QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
612
         queryWrapper5.eq("DICT_LABEL",strings[5]);
624
         queryWrapper5.eq("DICT_LABEL",strings[5]);
613
         List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
625
         List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
626
+        if(list5.isEmpty()){
627
+            throw new IndexOutOfBoundsException(strings[5]+"不是正确的");
628
+        }
614
         EsNetworkEntry.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
629
         EsNetworkEntry.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
615
 
630
 
616
         QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
631
         QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
617
         queryWrapper6.eq("DICT_LABEL",strings[6]);
632
         queryWrapper6.eq("DICT_LABEL",strings[6]);
618
         List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
633
         List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
634
+        if(list6.isEmpty()){
635
+            throw new IndexOutOfBoundsException(strings[6]+"不是正确的");
636
+        }
619
         EsNetworkEntry.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
637
         EsNetworkEntry.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
620
 
638
 
621
 
639
 
@@ -657,9 +675,49 @@ public class EsNetworkEntryServiceImpl extends ServiceImpl<EsNetworkEntryMapper,
657
         List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
675
         List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
658
         EsNetworkEntry.setEnterpriseType(strings[16]);//企业类型
676
         EsNetworkEntry.setEnterpriseType(strings[16]);//企业类型
659
 
677
 
660
-        EsNetworkEntry.setLongitude(new BigDecimal(strings[17]));//经度
678
+        if (strings[17] != null && !strings[17].isEmpty()) {
679
+            try {
680
+                BigDecimal longitude = new BigDecimal(strings[17]);
681
+                // 进行范围检查
682
+                if (longitude.compareTo(BigDecimal.valueOf(-180)) < 0 || longitude.compareTo(BigDecimal.valueOf(180)) > 0) {
683
+                    throw new IllegalArgumentException("经度超出有效范围");
684
+                }
685
+                // 进行精度和小数位数检查
686
+                if (longitude.scale() > 6) { // 假设精度不能超过6位小数
687
+                    throw new IllegalArgumentException("经度小数位数过多");
688
+                }
689
+                EsNetworkEntry.setLongitude(longitude);
690
+            } catch (NumberFormatException e) {
691
+                throw new NumberFormatException(strings[17] + " 经度格式不正确");
692
+            } catch (IllegalArgumentException e) {
693
+                throw new IllegalArgumentException(strings[17] + " " + e.getMessage());
694
+            }
695
+        } else {
696
+            throw new NumberFormatException(strings[17] + " 经度格式不正确");
697
+        }
698
+
699
+        if (strings[18] != null && !strings[18].isEmpty()) {
700
+            try {
701
+                BigDecimal latitude = new BigDecimal(strings[18]);
702
+                // 进行范围检查
703
+                if (latitude.compareTo(BigDecimal.valueOf(-90)) < 0 || latitude.compareTo(BigDecimal.valueOf(90)) > 0) {
704
+                    throw new IllegalArgumentException("纬度超出有效范围");
705
+                }
706
+                // 进行精度和小数位数检查
707
+                if (latitude.scale() > 6) { // 假设精度不能超过6位小数
708
+                    throw new IllegalArgumentException("纬度小数位数过多");
709
+                }
710
+                EsNetworkEntry.setLatitude(latitude);
711
+            } catch (NumberFormatException e) {
712
+                throw new NumberFormatException(strings[18] + " 纬度格式不正确");
713
+            } catch (IllegalArgumentException e) {
714
+                throw new IllegalArgumentException(strings[18] + " " + e.getMessage());
715
+            }
716
+        } else {
717
+            throw new NumberFormatException(strings[18] + " 纬度格式不正确");
718
+        }
719
+
661
 
720
 
662
-        EsNetworkEntry.setLatitude(new BigDecimal(strings[18]));//纬度
663
 
721
 
664
 
722
 
665
         EsNetworkEntry.setLegalRepresentative(strings[19]);//法人姓名
723
         EsNetworkEntry.setLegalRepresentative(strings[19]);//法人姓名

+ 59 - 8
unis-plugin/unis-plugin-biz/src/main/java/com/unis/emergencySupport/modular/es/service/impl/EsProcessEnterpriseServiceImpl.java

@@ -841,12 +841,6 @@ public class EsProcessEnterpriseServiceImpl extends ServiceImpl<EsProcessEnterpr
841
                             esProcessEnterpriseGrainService.save(EsProcessEnterpriseGrain);
841
                             esProcessEnterpriseGrainService.save(EsProcessEnterpriseGrain);
842
                         }
842
                         }
843
 
843
 
844
-
845
-
846
-
847
-
848
-
849
-
850
                         res = 1;
844
                         res = 1;
851
                         if(res>0){
845
                         if(res>0){
852
                             insertNum+= 1;
846
                             insertNum+= 1;
@@ -882,32 +876,50 @@ public class EsProcessEnterpriseServiceImpl extends ServiceImpl<EsProcessEnterpr
882
         QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
876
         QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
883
         queryWrapper1.eq("DICT_LABEL",strings[1]);
877
         queryWrapper1.eq("DICT_LABEL",strings[1]);
884
         List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
878
         List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
879
+        if(list1.isEmpty()){
880
+            throw new IndexOutOfBoundsException(strings[1]+"不是正确的");
881
+        }
885
         EsProcessEnterprise.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
882
         EsProcessEnterprise.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
886
 
883
 
887
         QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
884
         QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
888
         queryWrapper2.eq("DICT_LABEL",strings[2]);
885
         queryWrapper2.eq("DICT_LABEL",strings[2]);
889
         List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
886
         List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
887
+        if(list2.isEmpty()){
888
+            throw new IndexOutOfBoundsException(strings[2]+"不是正确的");
889
+        }
890
         EsProcessEnterprise.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
890
         EsProcessEnterprise.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
891
 
891
 
892
         QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
892
         QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
893
         queryWrapper3.eq("DICT_LABEL",strings[3]);
893
         queryWrapper3.eq("DICT_LABEL",strings[3]);
894
         List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
894
         List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
895
+        if(list3.isEmpty()){
896
+            throw new IndexOutOfBoundsException(strings[3]+"不是正确的");
897
+        }
895
         EsProcessEnterprise.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
898
         EsProcessEnterprise.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
896
 
899
 
897
 
900
 
898
         QueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
901
         QueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
899
         queryWrapper4.eq("DICT_LABEL",strings[4]);
902
         queryWrapper4.eq("DICT_LABEL",strings[4]);
900
         List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
903
         List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
904
+        if(list4.isEmpty()){
905
+            throw new IndexOutOfBoundsException(strings[4]+"不是正确的");
906
+        }
901
         EsProcessEnterprise.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
907
         EsProcessEnterprise.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
902
 
908
 
903
         QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
909
         QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
904
         queryWrapper5.eq("DICT_LABEL",strings[5]);
910
         queryWrapper5.eq("DICT_LABEL",strings[5]);
905
         List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
911
         List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
912
+        if(list5.isEmpty()){
913
+            throw new IndexOutOfBoundsException(strings[5]+"不是正确的");
914
+        }
906
         EsProcessEnterprise.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
915
         EsProcessEnterprise.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
907
 
916
 
908
         QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
917
         QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
909
         queryWrapper6.eq("DICT_LABEL",strings[6]);
918
         queryWrapper6.eq("DICT_LABEL",strings[6]);
910
         List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
919
         List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
920
+        if(list6.isEmpty()){
921
+            throw new IndexOutOfBoundsException(strings[6]+"不是正确的");
922
+        }
911
         EsProcessEnterprise.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
923
         EsProcessEnterprise.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
912
 
924
 
913
 
925
 
@@ -949,9 +961,48 @@ public class EsProcessEnterpriseServiceImpl extends ServiceImpl<EsProcessEnterpr
949
         List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
961
         List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
950
         EsProcessEnterprise.setEnterpriseType(strings[16]);//企业类型
962
         EsProcessEnterprise.setEnterpriseType(strings[16]);//企业类型
951
 
963
 
952
-        EsProcessEnterprise.setLongitude(new BigDecimal(strings[17]));//经度
964
+        if (strings[17] != null && !strings[17].isEmpty()) {
965
+            try {
966
+                BigDecimal longitude = new BigDecimal(strings[17]);
967
+                // 进行范围检查
968
+                if (longitude.compareTo(BigDecimal.valueOf(-180)) < 0 || longitude.compareTo(BigDecimal.valueOf(180)) > 0) {
969
+                    throw new IllegalArgumentException("经度超出有效范围");
970
+                }
971
+                // 进行精度和小数位数检查
972
+                if (longitude.scale() > 6) { // 假设精度不能超过6位小数
973
+                    throw new IllegalArgumentException("经度小数位数过多");
974
+                }
975
+                EsProcessEnterprise.setLongitude(longitude);
976
+            } catch (NumberFormatException e) {
977
+                throw new NumberFormatException(strings[17] + " 经度格式不正确");
978
+            } catch (IllegalArgumentException e) {
979
+                throw new IllegalArgumentException(strings[17] + " " + e.getMessage());
980
+            }
981
+        } else {
982
+            throw new NumberFormatException(strings[17] + " 经度格式不正确");
983
+        }
984
+
985
+        if (strings[18] != null && !strings[18].isEmpty()) {
986
+            try {
987
+                BigDecimal latitude = new BigDecimal(strings[18]);
988
+                // 进行范围检查
989
+                if (latitude.compareTo(BigDecimal.valueOf(-90)) < 0 || latitude.compareTo(BigDecimal.valueOf(90)) > 0) {
990
+                    throw new IllegalArgumentException("纬度超出有效范围");
991
+                }
992
+                // 进行精度和小数位数检查
993
+                if (latitude.scale() > 6) { // 假设精度不能超过6位小数
994
+                    throw new IllegalArgumentException("纬度小数位数过多");
995
+                }
996
+                EsProcessEnterprise.setLatitude(latitude);
997
+            } catch (NumberFormatException e) {
998
+                throw new NumberFormatException(strings[18] + " 纬度格式不正确");
999
+            } catch (IllegalArgumentException e) {
1000
+                throw new IllegalArgumentException(strings[18] + " " + e.getMessage());
1001
+            }
1002
+        } else {
1003
+            throw new NumberFormatException(strings[18] + " 纬度格式不正确");
1004
+        }
953
 
1005
 
954
-        EsProcessEnterprise.setLatitude(new BigDecimal(strings[18]));//纬度
955
 
1006
 
956
 
1007
 
957
         EsProcessEnterprise.setLegalRepresentative(strings[19]);//法人姓名
1008
         EsProcessEnterprise.setLegalRepresentative(strings[19]);//法人姓名