Commit a087156247e7508e4fb0242aefc80b236c384f5b
1 parent
0c27395cb5
Exists in
master
and in
1 other branch
add data import :机构、部门、用户(医生)
Showing 1 changed file with 8 additions and 7 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java
View file @
a087156
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | import org.apache.commons.httpclient.NameValuePair; |
6 | 6 | import org.apache.commons.httpclient.methods.GetMethod; |
7 | 7 | import org.apache.commons.httpclient.methods.PostMethod; |
8 | +import org.apache.commons.lang.*; | |
8 | 9 | |
9 | 10 | import java.security.MessageDigest; |
10 | 11 | import java.security.NoSuchAlgorithmException; |
11 | 12 | |
... | ... | @@ -66,14 +67,14 @@ |
66 | 67 | public static String loginHospitalUser(String phone, String pwd, String typeId, String token) { |
67 | 68 | HttpClient client = new HttpClient(); |
68 | 69 | PostMethod post = new MessageUtil.UTF8PostMethod("http://passport.healthbaby.com.cn/v1/userLogin.action"); |
69 | - NameValuePair[] data = { | |
70 | - new NameValuePair("phone", phone), | |
71 | - new NameValuePair("typeId", typeId), | |
72 | - new NameValuePair("password", pwd) | |
73 | - }; | |
74 | - post.setRequestBody(data); | |
75 | - post.setRequestHeader("Authorization", token); | |
76 | 70 | try { |
71 | + NameValuePair[] data = { | |
72 | + new NameValuePair("phone", phone), | |
73 | + new NameValuePair("typeId", typeId), | |
74 | + new NameValuePair("password", org.apache.commons.lang.StringUtils.isBlank(pwd)?"p":md5(pwd)) | |
75 | + }; | |
76 | + post.setRequestBody(data); | |
77 | + post.setRequestHeader("Authorization", token); | |
77 | 78 | client.executeMethod(post); |
78 | 79 | int statusCode = post.getStatusCode(); |
79 | 80 | String result = new String(post.getResponseBodyAsString()); |