|
|
@@ -2,6 +2,7 @@ package com.zhongshu.card.server.core.service.org;
|
|
|
|
|
|
import com.github.microservice.auth.client.content.ResultState;
|
|
|
import com.github.microservice.auth.client.model.UserAuthModel;
|
|
|
+import com.github.microservice.auth.client.model.UserModel;
|
|
|
import com.github.microservice.auth.client.service.OrganizationUserService;
|
|
|
import com.github.microservice.auth.client.service.RoleService;
|
|
|
import com.github.microservice.auth.client.service.UserService;
|
|
|
@@ -260,12 +261,25 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
passWord = cardNumber.substring(12, 18);
|
|
|
passWord = passWord.toLowerCase().replace("x", "0");
|
|
|
}
|
|
|
- //权限中心:添加用户
|
|
|
- com.github.microservice.auth.client.content.ResultContent<String> addModelResult = userService.add(UserAuthModel.builder().loginType(LoginType.Phone).loginValue(loginName).passWord(passWord).build());
|
|
|
- if (addModelResult.getState() != ResultState.Success) {
|
|
|
- return ResultContent.buildFail(String.format("权限中心添加用户出错:%s", addModelResult.getMsg()));
|
|
|
+ String userId = "";
|
|
|
+ // 检查权限中心有这用户不
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<UserModel> queryContent = userService.queryFromLoginType(LoginType.Phone, loginName);
|
|
|
+ if (queryContent.getState() == ResultState.Success) {
|
|
|
+ UserModel userModel = queryContent.getContent();
|
|
|
+ if (ObjectUtils.isNotEmpty(userModel)) {
|
|
|
+ userId = userModel.getUserId();
|
|
|
+ }
|
|
|
}
|
|
|
- String userId = addModelResult.getContent();
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(userId)) {
|
|
|
+ //权限中心:添加用户
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<String> addModelResult = userService.add(UserAuthModel.builder().loginType(LoginType.Phone).loginValue(loginName).passWord(passWord).build());
|
|
|
+ if (addModelResult.getState() != ResultState.Success) {
|
|
|
+ return ResultContent.buildFail(String.format("权限中心添加用户出错:%s", addModelResult.getMsg()));
|
|
|
+ }
|
|
|
+ userId = addModelResult.getContent();
|
|
|
+ }
|
|
|
+
|
|
|
userAccount = new UserAccount();
|
|
|
|
|
|
BeanUtils.copyProperties(param, userAccount);
|