18792927508 2 лет назад
Родитель
Сommit
353b78d5cf

+ 16
- 11
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java Просмотреть файл

@@ -197,19 +197,24 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
197 197
                              */
198 198
                            // authentication.setUserName(loginUser.getUsername());
199 199
                           //  authentication.setUserId(loginUser.getUserId());
200
-                            authentication.setName(name);
200
+
201 201
                             authentication.setIdentityNo(idcardno);
202
-                            authentication.setCertificationTime(new Date());
203
-                            authentication.setCertificationStatus(0);
204
-                            authentication.setCreateBy(name);
205
-                          //  authentication.setCreateBy(loginUser.getUsername());
206
-                            try {
207
-                                identityAuthenticationMapper.insertIdentityAuthentication(authentication);
208
-                                authentication.setId(authentication.getId());
209
-                            } catch (Exception e) {
210
-                                System.out.println("认证记录新增失败");
202
+                            // 查询认证表是否已存在该身份证信息的认证,不存在则新增,存在不处理
203
+                            IdentityAuthentication identityAuthentication = identityAuthenticationMapper.selectIdentityAuthentication(authentication);
204
+                            if(identityAuthentication!=null) {
205
+                                return AjaxResult.success(identityAuthentication);
211 206
                             }
212
-
207
+                                authentication.setName(name);
208
+                                authentication.setCertificationTime(new Date());
209
+                                authentication.setCertificationStatus(0);
210
+                                authentication.setCreateBy(name);
211
+                                //  authentication.setCreateBy(loginUser.getUsername());
212
+                                try {
213
+                                    identityAuthenticationMapper.insertIdentityAuthentication(authentication);
214
+                                    authentication.setId(authentication.getId());
215
+                                } catch (Exception e) {
216
+                                    System.out.println("认证记录新增失败");
217
+                                }
213 218
                         }
214 219
 
215 220
                     }

+ 10
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/WeChatUserServiceImpl.java Просмотреть файл

@@ -115,10 +115,19 @@ public class WeChatUserServiceImpl implements WeChatUserService {
115 115
         }else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){
116 116
             return AjaxResult.warn("验证码校验失败");
117 117
         }
118
-        SysUser sysUserName=sysUserMapper.selectUserByUserName(ientityAuthentication.getUserName());
118
+        SysUser sysUserName=sysUserMapper.checkUserNameUnique(ientityAuthentication.getUserName());
119 119
         if(sysUserName!=null){
120 120
             return AjaxResult.warn("账号已存在");
121 121
         }
122
+        SysUser checkPhoneUnique = sysUserMapper.checkPhoneUnique(ientityAuthentication.getPhone());
123
+        if(checkPhoneUnique!=null){
124
+            return AjaxResult.warn("手机号已存在");
125
+        }
126
+        SysUser checkEmailUnique = sysUserMapper.checkEmailUnique(ientityAuthentication.getEmail());
127
+        if(checkEmailUnique!=null){
128
+            return AjaxResult.warn("邮箱已存在");
129
+        }
130
+
122 131
         // 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
123 132
         SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo());
124 133
 
@@ -133,8 +142,6 @@ public class WeChatUserServiceImpl implements WeChatUserService {
133 142
             ientityAuthentication.setUserId(sysUser.getUserId());
134 143
         }else {
135 144
             sysUser=new SysUser();
136
-            // 用户名设为电话号
137
-            sysUser.setUserName(ientityAuthentication.getPhone());
138 145
             sysUser.setIdCard(ientityAuthentication.getIdentityNo());
139 146
             sysUser.setNickName(ientityAuthentication.getName());
140 147
             sysUser.setUserName(ientityAuthentication.getUserName());

+ 3
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/IdentityAuthenticationMapper.xml Просмотреть файл

@@ -60,6 +60,9 @@
60 60
             <if test="userId != null   ">
61 61
                 AND i.user_id  = #{userId}
62 62
             </if>
63
+            <if test="identityNo != null  and identityNo != '' ">
64
+                AND i.identity_no  = #{identityNo}
65
+            </if>
63 66
         </where>
64 67
     </select>
65 68