浏览代码

fix 批量导入用户

he2802 3 年之前
父节点
当前提交
193847cf76

+ 12 - 13
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -627,24 +627,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         if(bo.getTel().length()!=11){
             throw new CustomException("手机号格式错误");
         }
-        if(bo.getIdCard()==null){
+        /*if(bo.getIdCard()==null){
             throw new CustomException("身份证不能为空");
-        }
-        if(bo.getIdCard().length()!=18){
+        }*/
+        /*if(bo.getIdCard().length()!=18){
             throw new CustomException("身份证格式错误");
         }
         if(bo.getRealname()==null){
             throw new CustomException("真实姓名不能为空");
-        }
+        }*/
         User user = getOne(new LambdaQueryWrapper<User>()
                 .eq(User::getTelphone,bo.getTel()).last("limit 1"));
         if(Validator.isNotNull(user)){
             throw new CustomException("该手机号已注册");
         }
-        User user2 = getOne(new LambdaQueryWrapper<User>()
-                .eq(User::getIdCard,bo.getIdCard()).last("limit 1"));
-        if(Validator.isNotNull(user2)){
-            throw new CustomException("该身份证已被使用");
+        if(Validator.isNotEmpty(bo.getIdCard())){
+            User user2 = getOne(new LambdaQueryWrapper<User>()
+                    .eq(User::getIdCard,bo.getIdCard()).last("limit 1"));
+            if(Validator.isNotNull(user2)){
+                throw new CustomException("该身份证已被使用");
+            }
         }
         User inertData = new User();
         inertData.setTelphone(bo.getTel());
@@ -858,9 +860,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             if(Validator.isEmpty(bo.getTelphone())){
                 throw new CustomException("用户手机号码缺失");
             }
-            if(Validator.isEmpty(bo.getRealname())){
-                throw new CustomException("用户姓名缺失");
-            }
             User user1 = getOne(new LambdaQueryWrapper<User>()
                     .eq(User::getTelphone,bo.getTelphone()).last("limit 1"));
             //手机号码存在
@@ -879,13 +878,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 list1.add(user);
                 continue;
             }else{
-                if(Validator.isNotEmpty(bo.getIdCard())){
+               /* if(Validator.isNotEmpty(bo.getIdCard())){
                     User user2 = getOne(new LambdaQueryWrapper<User>()
                             .eq(User::getIdCard,bo.getIdCard()).last("limit 1"));
                     if(Validator.isNotEmpty(user2)){
                         throw new CustomException(bo.getRealname()+"身份证号码已存在,创建失败");
                     }
-                }
+                }*/
                 UserSystemRegisterBo registerBo = BeanUtil.toBean(bo, UserSystemRegisterBo.class);
                 registerBo.setTel(bo.getTelphone());
                 registerBo.setRegisterPlat("4");