he2802 2 年之前
父节点
当前提交
36ad07f96e

+ 15 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -494,13 +494,13 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         String keyValue = bo.getKeyValue();
         if (Validator.isNotEmpty(keyValue)) {
             Map<String, String> maps = JSONObject.parseObject(keyValue, Map.class);
-            String recent_photos, idcard_face_photo, idcard_national_photo,work_unit,idcard,name,education,apply_post;
+            String recent_photos, idcard_face_photo, idcard_national_photo,work_unit,idcard,name,education,apply_post,telphone;
             LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
             objectLambdaUpdateWrapper.eq(User::getUserId, bo.getUserId());
+            UserVo user = iUserService.queryById(bo.getUserId());
             if (maps.containsKey("idcard")) {
                 idcard = JSONObject.parseObject(String.valueOf(maps.get("idcard")), UserProfileFit.class).getValue();
                 if(Validator.isNotEmpty(idcard)){
-                    UserVo user = iUserService.queryById(bo.getUserId());
                     if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getIdCard())){ //身份证为空是覆盖
                         User user2 = iUserService.getOne(new LambdaQueryWrapper<User>()
                                 .eq(User::getIdCard, EncryptHandler.encrypt(idcard)).last("limit 1"));
@@ -511,10 +511,22 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
                     }
                 }
             }
+            if (maps.containsKey("telphone")) {
+                telphone = JSONObject.parseObject(String.valueOf(maps.get("telphone")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(telphone)){
+                    if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getTelphone())){ //身份证为空是覆盖
+                        User user2 = iUserService.getOne(new LambdaQueryWrapper<User>()
+                                .eq(User::getTelphone, EncryptHandler.encrypt(telphone)).last("limit 1"));
+                        if(Validator.isNotEmpty(user2)){
+                            throw new CustomException("手机号码已存在,创建失败");
+                        }
+                        objectLambdaUpdateWrapper.set(User::getTelphone, telphone);
+                    }
+                }
+            }
             if (maps.containsKey("name")) {
                 name = JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue();
                 if(Validator.isNotEmpty(name)){
-                    UserVo user = iUserService.queryById(bo.getUserId());
                     if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getRealname())) { //姓名为空是覆盖
                         objectLambdaUpdateWrapper.set(User::getRealname, name);
                     }