浏览代码

完善登录失败返回失败信息

lirong 3 年之前
父节点
当前提交
0dfa50bd10

+ 14 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java

@@ -484,9 +484,20 @@ public class RestUtil {
 		JSONObject result = new JSONObject();
 		try {
 			JSONObject queryCriteria = JSON.parseObject(param);
-			JSONObject object = PersonUtil.Login(queryCriteria);
-			result.put("Content", object);
-			result.put("Result", "success");
+			String post_result = PersonUtil.Login(queryCriteria);
+			String respMsg=JSON.parseObject(post_result).getString("respMsg");
+			JSONObject resultJSON = JSON.parseObject(post_result).getJSONObject("content");
+			result.put("Content", resultJSON);
+			if(respMsg.equals("success"))
+			{
+				result.put("Result", "success");
+			}
+			else
+			{
+				result.put("Result", "failure");
+				result.put("ResultMsg", respMsg);
+				result.put("ResultCode", JSON.parseObject(post_result).getString("respCode"));
+			}
 		} catch (Exception e) {
 			log.error(e.getMessage(), e);
 			String message = LogUtil.GetExceptionStackTrace(e);

+ 2 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/PersonUtil.java

@@ -12,13 +12,12 @@ import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 public class PersonUtil {
-    public static JSONObject Login(JSONObject queryCriteria) throws Exception {
+    public static String Login(JSONObject queryCriteria) throws Exception {
         RepositoryImpl Repository = RepositoryContainer.instance;
         String groupCode = RepositoryContainer.RepositoryProject.groupCode;
         queryCriteria.put("groupCode",groupCode);
         String post_result = HttpClientUtil.instance("person_center").post(Constant.person_center_url + "/user/login", queryCriteria.toJSONString());
-        JSONObject resultJSON = JSON.parseObject(post_result).getJSONObject("content");
-        return resultJSON;
+        return post_result;
     }
 
     public static Tuple getCaptcha() throws Exception {