|
@@ -144,6 +144,18 @@ public class TerminalUserController {
|
|
|
terminalUserDTO.setName(StudentNumberUtil.toChinese(serialNo, "教室"));
|
|
|
}
|
|
|
|
|
|
+ // 远程注册
|
|
|
+ String password = terminalUserDTO.getPassword();
|
|
|
+ APIResult<RemoteUser> remoteUserAPIResult = remoteUserProxy.register(code, password, HttpUtil.getClientIp(request), "0");
|
|
|
+ if (!remoteUserAPIResult.getSuccess()) {
|
|
|
+ log.error(JSON.toJSONString(remoteUserAPIResult));
|
|
|
+ return APIResult.error(UserServiceAPICode.REMOTE_USER_REGISTER_ERROR);
|
|
|
+ }else {
|
|
|
+ // 设置资源中心id为本地用户id
|
|
|
+ RemoteUser remoteUser = remoteUserAPIResult.getData();
|
|
|
+ terminalUserDTO.setId(remoteUser.getUid());
|
|
|
+ }
|
|
|
+
|
|
|
// 存储数据库
|
|
|
APIResult<TerminalUser> result = terminalUserService.create(terminalUserDTO);
|
|
|
if (!result.getSuccess()) {
|
|
@@ -153,16 +165,6 @@ public class TerminalUserController {
|
|
|
TerminalUser terminalUser = result.getData();
|
|
|
setUserInfo(terminalUser, campus, merchant);
|
|
|
|
|
|
- // 远程注册
|
|
|
- APIResult<RemoteUser> remoteUserAPIResult = remoteUserProxy.register(terminalUser, HttpUtil.getClientIp(request), "0");
|
|
|
- if (!remoteUserAPIResult.getSuccess()) {
|
|
|
- log.error(JSON.toJSONString(remoteUserAPIResult));
|
|
|
- return APIResult.error(UserServiceAPICode.REMOTE_USER_REGISTER_ERROR);
|
|
|
- }
|
|
|
-
|
|
|
- // 再存储远程uid
|
|
|
- terminalUserService.addUid(terminalUser.getId(), remoteUserAPIResult.getData().getUid());
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|