|
@@ -184,7 +184,7 @@ public class EsDeliveryEnterpriseServiceImpl extends ServiceImpl<EsDeliveryEnter
|
184
|
184
|
}
|
185
|
185
|
|
186
|
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
|
188
|
BigDecimal quantity=new BigDecimal(0.00);
|
189
|
189
|
Integer in =0;
|
190
|
190
|
Integer index = 6;
|
|
@@ -741,32 +741,50 @@ public class EsDeliveryEnterpriseServiceImpl extends ServiceImpl<EsDeliveryEnter
|
741
|
741
|
QueryWrapper<BizDict> queryWrapper1 = new QueryWrapper<>();
|
742
|
742
|
queryWrapper1.eq("DICT_LABEL",strings[1]);
|
743
|
743
|
List<BizDict> list1 = BizDictServiceImpl.list(queryWrapper1);
|
|
744
|
+ if(list1.isEmpty()){
|
|
745
|
+ throw new IndexOutOfBoundsException(strings[1]+"不是正确的");
|
|
746
|
+ }
|
744
|
747
|
EsNetworkEntry.setManagementAreaProvince(list1.get(0).getId());//归口管理地区-省
|
745
|
748
|
|
746
|
749
|
QueryWrapper<BizDict> queryWrapper2 = new QueryWrapper<>();
|
747
|
750
|
queryWrapper2.eq("DICT_LABEL",strings[2]);
|
748
|
751
|
List<BizDict> list2 = BizDictServiceImpl.list(queryWrapper2);
|
|
752
|
+ if(list2.isEmpty()){
|
|
753
|
+ throw new IndexOutOfBoundsException(strings[2]+"不是正确的");
|
|
754
|
+ }
|
749
|
755
|
EsNetworkEntry.setManagementAreaCity(list2.get(0).getId());//归口管理地区-市
|
750
|
756
|
|
751
|
757
|
QueryWrapper<BizDict> queryWrapper3 = new QueryWrapper<>();
|
752
|
758
|
queryWrapper3.eq("DICT_LABEL",strings[3]);
|
753
|
759
|
List<BizDict> list3 = BizDictServiceImpl.list(queryWrapper3);
|
|
760
|
+ if(list3.isEmpty()){
|
|
761
|
+ throw new IndexOutOfBoundsException(strings[3]+"不是正确的");
|
|
762
|
+ }
|
754
|
763
|
EsNetworkEntry.setManagementAreaCounty(list3.get(0).getId());//归口管理地区-县
|
755
|
764
|
|
756
|
|
-
|
757
|
|
- QueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
|
|
765
|
+ ueryWrapper<BizDict> queryWrapper4 = new QueryWrapper<>();
|
758
|
766
|
queryWrapper4.eq("DICT_LABEL",strings[4]);
|
759
|
767
|
List<BizDict> list4 = BizDictServiceImpl.list(queryWrapper4);
|
|
768
|
+ if(list4.isEmpty()){
|
|
769
|
+ throw new IndexOutOfBoundsException(strings[4]+"不是正确的")
|
|
770
|
+ Q;
|
|
771
|
+ }
|
760
|
772
|
EsNetworkEntry.setActualAddressProvince(list4.get(0).getId());//实际经营地址-省
|
761
|
773
|
|
762
|
774
|
QueryWrapper<BizDict> queryWrapper5 = new QueryWrapper<>();
|
763
|
775
|
queryWrapper5.eq("DICT_LABEL",strings[5]);
|
764
|
776
|
List<BizDict> list5 = BizDictServiceImpl.list(queryWrapper5);
|
|
777
|
+ if(list5.isEmpty()){
|
|
778
|
+ throw new IndexOutOfBoundsException(strings[5]+"不是正确的");
|
|
779
|
+ }
|
765
|
780
|
EsNetworkEntry.setActualAddressCity(list5.get(0).getId());//实际经营地址-市
|
766
|
781
|
|
767
|
782
|
QueryWrapper<BizDict> queryWrapper6 = new QueryWrapper<>();
|
768
|
783
|
queryWrapper6.eq("DICT_LABEL",strings[6]);
|
769
|
784
|
List<BizDict> list6 = BizDictServiceImpl.list(queryWrapper6);
|
|
785
|
+ if(list6.isEmpty()){
|
|
786
|
+ throw new IndexOutOfBoundsException(strings[6]+"不是正确的");
|
|
787
|
+ }
|
770
|
788
|
EsNetworkEntry.setActualAddressCounty(list6.get(0).getId());//实际经营地址-县
|
771
|
789
|
|
772
|
790
|
|
|
@@ -808,9 +826,48 @@ public class EsDeliveryEnterpriseServiceImpl extends ServiceImpl<EsDeliveryEnter
|
808
|
826
|
List<BizDict> list8 = BizDictServiceImpl.list(queryWrapper8);
|
809
|
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
|
873
|
EsNetworkEntry.setLegalRepresentative(strings[19]);//法人姓名
|