Commit c6d8ad33da26617315d90086a1f486bd08175329
1 parent
613fb3f95b
Exists in
master
and in
8 other branches
增加
Showing 1 changed file with 12 additions and 32 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java
View file @
c6d8ad3
| ... | ... | @@ -33,19 +33,17 @@ |
| 33 | 33 | client.executeMethod(post); |
| 34 | 34 | int statusCode = post.getStatusCode(); |
| 35 | 35 | String result = new String(post.getResponseBodyAsString()); |
| 36 | - | |
| 36 | + logger.info("register result : "+result); | |
| 37 | 37 | post.releaseConnection(); |
| 38 | 38 | stopWatch.stop(); |
| 39 | 39 | if (200 == statusCode) { |
| 40 | 40 | stopWatch.start("parse json"); |
| 41 | 41 | LoginContext loginState = JsonUtil.str2Obj(result, LoginContext.class); |
| 42 | 42 | stopWatch.stop(); |
| 43 | -// if (0 == loginState.getErrorcode()) { | |
| 44 | 43 | return loginState; |
| 45 | -// } | |
| 46 | 44 | } |
| 47 | 45 | } catch (Exception e) { |
| 48 | - e.printStackTrace(); | |
| 46 | + ExceptionUtils.catchException(e, "register error , " + e.getMessage()); | |
| 49 | 47 | } finally { |
| 50 | 48 | logger.info(stopWatch.toString()); |
| 51 | 49 | } |
| ... | ... | @@ -70,7 +68,7 @@ |
| 70 | 68 | client.executeMethod(post); |
| 71 | 69 | int statusCode = post.getStatusCode(); |
| 72 | 70 | String result = new String(post.getResponseBodyAsString()); |
| 73 | - | |
| 71 | + logger.info("loginByAccount result : "+result); | |
| 74 | 72 | post.releaseConnection(); |
| 75 | 73 | stopWatch.stop(); |
| 76 | 74 | LoginContext loginState = new LoginContext(); |
| ... | ... | @@ -81,7 +79,7 @@ |
| 81 | 79 | return loginState; |
| 82 | 80 | } |
| 83 | 81 | } catch (Exception e) { |
| 84 | - e.printStackTrace(); | |
| 82 | + ExceptionUtils.catchException(e, "loginByAccount error , " + e.getMessage()); | |
| 85 | 83 | } finally { |
| 86 | 84 | logger.info(stopWatch.toString()); |
| 87 | 85 | } |
| ... | ... | @@ -107,7 +105,7 @@ |
| 107 | 105 | client.executeMethod(post); |
| 108 | 106 | int statusCode = post.getStatusCode(); |
| 109 | 107 | String result = new String(post.getResponseBodyAsString()); |
| 110 | - | |
| 108 | + logger.info("aouHospitalUser result : "+result); | |
| 111 | 109 | post.releaseConnection(); |
| 112 | 110 | stopWatch.stop(); |
| 113 | 111 | if (200 == statusCode) { |
| ... | ... | @@ -119,7 +117,7 @@ |
| 119 | 117 | } |
| 120 | 118 | } |
| 121 | 119 | } catch (Exception e) { |
| 122 | - e.printStackTrace(); | |
| 120 | + ExceptionUtils.catchException(e, "aouHospitalUser error , " + e.getMessage()); | |
| 123 | 121 | } finally { |
| 124 | 122 | logger.info(stopWatch.toString()); |
| 125 | 123 | } |
| ... | ... | @@ -144,7 +142,7 @@ |
| 144 | 142 | client.executeMethod(post); |
| 145 | 143 | int statusCode = post.getStatusCode(); |
| 146 | 144 | String result = new String(post.getResponseBodyAsString()); |
| 147 | - | |
| 145 | + logger.info("loginHospitalUser result : "+result); | |
| 148 | 146 | post.releaseConnection(); |
| 149 | 147 | stopWatch.stop(); |
| 150 | 148 | LoginContext loginState = new LoginContext(); |
| ... | ... | @@ -155,7 +153,7 @@ |
| 155 | 153 | return loginState; |
| 156 | 154 | } |
| 157 | 155 | } catch (Exception e) { |
| 158 | - e.printStackTrace(); | |
| 156 | + ExceptionUtils.catchException(e, "loginHospitalUser error , " + e.getMessage()); | |
| 159 | 157 | } finally { |
| 160 | 158 | logger.info(stopWatch.toString()); |
| 161 | 159 | } |
| ... | ... | @@ -180,7 +178,7 @@ |
| 180 | 178 | client.executeMethod(post); |
| 181 | 179 | int statusCode = post.getStatusCode(); |
| 182 | 180 | String result = new String(post.getResponseBodyAsString()); |
| 183 | - | |
| 181 | + logger.info("loginByPhone result : "+result); | |
| 184 | 182 | post.releaseConnection(); |
| 185 | 183 | stopWatch.stop(); |
| 186 | 184 | |
| ... | ... | @@ -192,7 +190,7 @@ |
| 192 | 190 | return loginState; |
| 193 | 191 | } |
| 194 | 192 | } catch (Exception e) { |
| 195 | - e.printStackTrace(); | |
| 193 | + ExceptionUtils.catchException(e, "loginByPhone error , " + e.getMessage()); | |
| 196 | 194 | } finally { |
| 197 | 195 | logger.info(stopWatch.toString()); |
| 198 | 196 | } |
| ... | ... | @@ -233,7 +231,7 @@ |
| 233 | 231 | return loginState; |
| 234 | 232 | } |
| 235 | 233 | } catch (Exception e) { |
| 236 | - e.printStackTrace(); | |
| 234 | + ExceptionUtils.catchException(e, "sendVerCode error."); | |
| 237 | 235 | } finally { |
| 238 | 236 | logger.info(stopWatch.toString()); |
| 239 | 237 | } |
| 240 | 238 | |
| ... | ... | @@ -264,29 +262,11 @@ |
| 264 | 262 | return loginState; |
| 265 | 263 | } |
| 266 | 264 | } catch (Exception e) { |
| 267 | - e.printStackTrace(); | |
| 265 | + ExceptionUtils.catchException(e,"checkLoginState error."); | |
| 268 | 266 | } finally { |
| 269 | 267 | logger.info(stopWatch.toString()); |
| 270 | 268 | } |
| 271 | 269 | return loginState; |
| 272 | 270 | } |
| 273 | - | |
| 274 | -// | |
| 275 | -// public static void main(String[] args) { | |
| 276 | -// System.out.println(md5("123789456")); | |
| 277 | -// String a = "{\"id\":20,\"token\":\"ucefac93386a4c70a8a570da5bbfc24ad0\",\"errormsg\":\"成功\",\"errorcode\":3}"; | |
| 278 | -// | |
| 279 | -// | |
| 280 | -// System.out.println(a.matches(".*errorcode\":0.*")); | |
| 281 | -// | |
| 282 | -// Pattern pattern = Pattern.compile("token\":\"(.*?)\""); | |
| 283 | -// Matcher matcher = pattern.matcher(a); | |
| 284 | -// while(matcher.find()) { | |
| 285 | -// System.out.println(matcher.group(1)); | |
| 286 | -// } | |
| 287 | -// | |
| 288 | -// //3949ba59abbe56e057f20f88 | |
| 289 | -// } | |
| 290 | - | |
| 291 | 271 | } |