Browse Source

获取企业信息接口bug,注册接口bug

wangmh 7 years ago
parent
commit
ce2c4ffd08

+ 7 - 1
sso-common/src/main/java/com/uas/sso/entity/UserSpaceView.java

@@ -1,5 +1,6 @@
 package com.uas.sso.entity;
 
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -7,9 +8,14 @@ import java.util.Date;
  * @create 2018-01-24 14:34
  * @desc 企业视图
  **/
-public class UserSpaceView {
+public class UserSpaceView implements Serializable {
 
 
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
     /**
      * 企业uu号
      */

+ 8 - 1
sso-common/src/main/java/com/uas/sso/entity/UserView.java

@@ -2,13 +2,20 @@ package com.uas.sso.entity;
 
 import com.alibaba.fastjson.annotation.JSONField;
 
+import java.io.Serializable;
+
 
 /**
  * @author wangmh
  * @create 2018-01-22 9:28
  * @desc 用户信息视图
  **/
-public class UserView {
+public class UserView implements Serializable {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
 
     /**
      * uu号

+ 13 - 2
sso-common/src/main/java/com/uas/sso/util/AccountUtils.java

@@ -224,7 +224,7 @@ public class AccountUtils {
             ModelMap formData = new ModelMap();
             saveUrl = saveUrl + "/info/name";
             formData.put("spaceName", spaceName);
-            HttpUtil.ResponseWrap res = HttpUtil.doPost(saveUrl, formData);
+            HttpUtil.ResponseWrap res = HttpUtil.doGet(saveUrl, formData);
             if (!res.isSuccess()) {
                 throw new Exception(res.getContent());
             } else {
@@ -965,16 +965,27 @@ public class AccountUtils {
 	 * @param userSpaceView 企业信息
 	 * @throws Exception
 	 */
-	public static void register(UserSpaceView userSpaceView) throws Exception {
+	public static UserSpaceView register(UserSpaceView userSpaceView, UserView admin) throws Exception {
 		String url = AccountConfig.getSpaceSaveUrl();
 		if (!StringUtils.isEmpty(url)) {
             url = url + "/register/other";
+            // 不把管理员设置成null会400
+            userSpaceView.setAdmin(null);
             JSONObject data = JSON.parseObject(JSON.toJSONString(userSpaceView));
+            data.putAll(JSON.parseObject(JSON.toJSONString(admin)));
             HttpUtil.ResponseWrap res = HttpUtil.doPost(url, data);
 			if (!res.isSuccess()) {
                 throw new Exception(res.getContent());
+            } else {
+                ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
+                if (!result.isSuccess()) {
+                    throw new Exception(result.getErrMsg());
+                } else {
+                    return JSON.parseObject(result.getContent().toString(), UserSpaceView.class);
+                }
             }
 		}
+		return null;
 	}
 
 	/**