From c6d8ad33da26617315d90086a1f486bd08175329 Mon Sep 17 00:00:00 2001 From: jiangjiazhi Date: Thu, 16 Jun 2016 09:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lyms/platform/common/utils/LoginUtil.java | 44 ++++++---------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java index 4cab40a..117469a 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java @@ -33,19 +33,17 @@ public class LoginUtil { client.executeMethod(post); int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); - + logger.info("register result : "+result); post.releaseConnection(); stopWatch.stop(); if (200 == statusCode) { stopWatch.start("parse json"); LoginContext loginState = JsonUtil.str2Obj(result, LoginContext.class); stopWatch.stop(); -// if (0 == loginState.getErrorcode()) { return loginState; -// } } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e, "register error , " + e.getMessage()); } finally { logger.info(stopWatch.toString()); } @@ -70,7 +68,7 @@ public class LoginUtil { client.executeMethod(post); int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); - + logger.info("loginByAccount result : "+result); post.releaseConnection(); stopWatch.stop(); LoginContext loginState = new LoginContext(); @@ -81,7 +79,7 @@ public class LoginUtil { return loginState; } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e, "loginByAccount error , " + e.getMessage()); } finally { logger.info(stopWatch.toString()); } @@ -107,7 +105,7 @@ public class LoginUtil { client.executeMethod(post); int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); - + logger.info("aouHospitalUser result : "+result); post.releaseConnection(); stopWatch.stop(); if (200 == statusCode) { @@ -119,7 +117,7 @@ public class LoginUtil { } } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e, "aouHospitalUser error , " + e.getMessage()); } finally { logger.info(stopWatch.toString()); } @@ -144,7 +142,7 @@ public class LoginUtil { client.executeMethod(post); int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); - + logger.info("loginHospitalUser result : "+result); post.releaseConnection(); stopWatch.stop(); LoginContext loginState = new LoginContext(); @@ -155,7 +153,7 @@ public class LoginUtil { return loginState; } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e, "loginHospitalUser error , " + e.getMessage()); } finally { logger.info(stopWatch.toString()); } @@ -180,7 +178,7 @@ public class LoginUtil { client.executeMethod(post); int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); - + logger.info("loginByPhone result : "+result); post.releaseConnection(); stopWatch.stop(); @@ -192,7 +190,7 @@ public class LoginUtil { return loginState; } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e, "loginByPhone error , " + e.getMessage()); } finally { logger.info(stopWatch.toString()); } @@ -233,7 +231,7 @@ public class LoginUtil { return loginState; } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e, "sendVerCode error."); } finally { logger.info(stopWatch.toString()); } @@ -264,28 +262,10 @@ public class LoginUtil { return loginState; } } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.catchException(e,"checkLoginState error."); } finally { logger.info(stopWatch.toString()); } return loginState; } - -// -// public static void main(String[] args) { -// System.out.println(md5("123789456")); -// String a = "{\"id\":20,\"token\":\"ucefac93386a4c70a8a570da5bbfc24ad0\",\"errormsg\":\"成功\",\"errorcode\":3}"; -// -// -// System.out.println(a.matches(".*errorcode\":0.*")); -// -// Pattern pattern = Pattern.compile("token\":\"(.*?)\""); -// Matcher matcher = pattern.matcher(a); -// while(matcher.find()) { -// System.out.println(matcher.group(1)); -// } -// -// //3949ba59abbe56e057f20f88 -// } - } -- 1.8.3.1