ソースを参照

添加新用户返回用户信息

wangmh 7 年 前
コミット
386f493085

+ 4 - 1
sso-common/src/main/java/com/uas/sso/util/AccountUtils.java

@@ -132,7 +132,7 @@ public class AccountUtils {
      * @param user
      * @throws Exception
      */
-    public static void addUser(Long spaceUU, UserView user) throws Exception {
+    public static UserView addUser(Long spaceUU, UserView user) throws Exception {
         String saveUrl = AccountConfig.getUserSaveUrl();
         if (!StringUtils.isEmpty(saveUrl)) {
             JSONObject formData = JSON.parseObject(JSON.toJSONString(user));
@@ -145,9 +145,12 @@ public class AccountUtils {
                 ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
                 if (!result.isSuccess()) {
                     throw new Exception(result.getErrMsg());
+                } else if (result.getContent() != null) {
+                    return JSON.parseObject(result.getContent().toString(), UserView.class);
                 }
             }
         }
+        return null;
     }
 
     /**

+ 6 - 2
sso-server/src/main/java/com/uas/sso/controller/UserManagerController.java

@@ -208,8 +208,12 @@ public class UserManagerController extends BaseController {
         if (StringUtils.isEmpty(user.getPassword())) {
             user.setPassword("111111");
         }
-        userService.register(user);
-        return success();
+        user = userService.register(user);
+
+        // 绑定企业
+        userService.bindUserspace(user.getUserUU(), spaceUU);
+
+        return success(user);
     }
 
     /**