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 8c8d079..4cab40a 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 @@ -5,20 +5,15 @@ import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.lang.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StopWatch; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - public class LoginUtil { private static Logger logger = LoggerFactory.getLogger("HTTP-INVOKE"); - - public static LoginContext register(String userId, String phone,String account, String pwd, String token, String typeId) { + public static LoginContext register(String userId, String phone, String account, String pwd, String token, String typeId) { StopWatch stopWatch = new StopWatch("aouHospitalUser"); stopWatch.start("init http client"); HttpClient client = new HttpClient(); @@ -45,13 +40,13 @@ public class LoginUtil { stopWatch.start("parse json"); LoginContext loginState = JsonUtil.str2Obj(result, LoginContext.class); stopWatch.stop(); - if (0 == loginState.getErrorcode()) { - return loginState; - } +// if (0 == loginState.getErrorcode()) { + return loginState; +// } } } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { logger.info(stopWatch.toString()); } return null; @@ -65,7 +60,7 @@ public class LoginUtil { NameValuePair[] data = { new NameValuePair("account", account), new NameValuePair("typeId", typeId), - new NameValuePair("password", org.apache.commons.lang.StringUtils.isBlank(pwd)?"p":MD5Utils.md5(pwd).toUpperCase()) + new NameValuePair("password", org.apache.commons.lang.StringUtils.isBlank(pwd) ? "p" : MD5Utils.md5(pwd).toUpperCase()) }; post.setRequestBody(data); post.setRequestHeader("Authorization", token); @@ -125,7 +120,7 @@ public class LoginUtil { } } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { logger.info(stopWatch.toString()); } return null; @@ -139,7 +134,7 @@ public class LoginUtil { NameValuePair[] data = { new NameValuePair("account", account), new NameValuePair("typeId", typeId), - new NameValuePair("password", org.apache.commons.lang.StringUtils.isBlank(pwd)?"p":MD5Utils.md5(pwd).toUpperCase()) + new NameValuePair("password", org.apache.commons.lang.StringUtils.isBlank(pwd) ? "p" : MD5Utils.md5(pwd).toUpperCase()) }; post.setRequestBody(data); post.setRequestHeader("Authorization", token); @@ -161,7 +156,7 @@ public class LoginUtil { } } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { logger.info(stopWatch.toString()); } return null; @@ -186,7 +181,8 @@ public class LoginUtil { int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); - post.releaseConnection();stopWatch.stop(); + post.releaseConnection(); + stopWatch.stop(); LoginContext loginState = new LoginContext(); if (200 == statusCode) { @@ -197,7 +193,7 @@ public class LoginUtil { } } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { logger.info(stopWatch.toString()); } return null; @@ -238,7 +234,7 @@ public class LoginUtil { } } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { logger.info(stopWatch.toString()); } return null; @@ -269,7 +265,7 @@ public class LoginUtil { } } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { logger.info(stopWatch.toString()); } return loginState;