|
|
@@ -123,10 +123,10 @@ public class WeChatUserServiceImpl implements WeChatUserService {
|
|
123
|
123
|
// 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
|
|
124
|
124
|
SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo());
|
|
125
|
125
|
// 查询角色
|
|
126
|
|
- Long roleIdByName = roleMapper.selectRoleIdByName("被申请人");
|
|
127
|
|
- if(roleIdByName==null){
|
|
128
|
|
- return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色");
|
|
129
|
|
- }
|
|
|
126
|
+ Long roleIdByName =ientityAuthentication.getRoleId();
|
|
|
127
|
+// if(roleIdByName==null){
|
|
|
128
|
+// return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色");
|
|
|
129
|
+// }
|
|
130
|
130
|
if(sysUser!=null){
|
|
131
|
131
|
sysUser.setIdCard(ientityAuthentication.getIdentityNo());
|
|
132
|
132
|
sysUser.setNickName(ientityAuthentication.getName());
|
|
|
@@ -137,7 +137,7 @@ public class WeChatUserServiceImpl implements WeChatUserService {
|
|
137
|
137
|
sysUserMapper.updateUser(sysUser);
|
|
138
|
138
|
ientityAuthentication.setUserId(sysUser.getUserId());
|
|
139
|
139
|
int count=0;
|
|
140
|
|
- if(CollectionUtil.isNotEmpty(sysUser.getRoles()) ){
|
|
|
140
|
+ if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){
|
|
141
|
141
|
|
|
142
|
142
|
for (SysRole role : sysUser.getRoles()) {
|
|
143
|
143
|
if(Objects.equals(role.getRoleId(), roleIdByName)){
|
|
|
@@ -147,8 +147,10 @@ public class WeChatUserServiceImpl implements WeChatUserService {
|
|
147
|
147
|
}
|
|
148
|
148
|
}
|
|
149
|
149
|
if(CollectionUtil.isEmpty(sysUser.getRoles())||count==0){
|
|
|
150
|
+ if(roleIdByName!=null) {
|
|
150
|
151
|
// 用户未关联被申请人角色,关联角色
|
|
151
|
152
|
userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName);
|
|
|
153
|
+ }
|
|
152
|
154
|
}
|
|
153
|
155
|
|
|
154
|
156
|
}else {
|
|
|
@@ -164,8 +166,10 @@ public class WeChatUserServiceImpl implements WeChatUserService {
|
|
164
|
166
|
if(row<1) {
|
|
165
|
167
|
return AjaxResult.warn("注册失败");
|
|
166
|
168
|
}
|
|
167
|
|
- // 用户关联被申请人角色
|
|
168
|
|
- userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName);
|
|
|
169
|
+ if(roleIdByName!=null) {
|
|
|
170
|
+ // 用户关联被申请人角色
|
|
|
171
|
+ userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName);
|
|
|
172
|
+ }
|
|
169
|
173
|
}
|
|
170
|
174
|
|
|
171
|
175
|
ientityAuthentication.setUserId(sysUser.getUserId());
|