Merge branch 'cocacola' into dev
Showing
2 changed files
with
20 additions
and
1 deletions
@@ -11,4 +11,23 @@ public class RandomUtil { | @@ -11,4 +11,23 @@ public class RandomUtil { | ||
11 | sb.append("yh"); | 11 | sb.append("yh"); |
12 | return sb.toString(); | 12 | return sb.toString(); |
13 | } | 13 | } |
14 | + | ||
15 | + /** | ||
16 | + * java生成随机数字和字母组合 | ||
17 | + * @param length[生成随机数的长度] | ||
18 | + * @return | ||
19 | + */ | ||
20 | + public static String getCharAndNumr(int numLength,int charLength) { | ||
21 | + String val = ""; | ||
22 | + Random random = new Random(); | ||
23 | + for (int i = 0; i < 6; i++) { | ||
24 | + // 输出字母还是数字 | ||
25 | + val += String.valueOf(random.nextInt(10)); | ||
26 | + } | ||
27 | + for(int j=0;j<2;j++){ | ||
28 | + int choice = random.nextInt(2) % 2 == 0 ? 65 : 97; | ||
29 | + val += (char) (choice + random.nextInt(26)); | ||
30 | + } | ||
31 | + return val; | ||
32 | + } | ||
14 | } | 33 | } |
@@ -231,7 +231,7 @@ public class CocacolaServiceImpl implements ICocacolaService { | @@ -231,7 +231,7 @@ public class CocacolaServiceImpl implements ICocacolaService { | ||
231 | RegisterReqBO registerReqBO = new RegisterReqBO(); | 231 | RegisterReqBO registerReqBO = new RegisterReqBO(); |
232 | registerReqBO.setArea(area); | 232 | registerReqBO.setArea(area); |
233 | registerReqBO.setProfile(mobile); | 233 | registerReqBO.setProfile(mobile); |
234 | - registerReqBO.setPassword(RandomUtil.autoGetPassword()); | 234 | + registerReqBO.setPassword(RandomUtil.getCharAndNumr(6, 2)); |
235 | registerReqBO.setClient_type(client_type); | 235 | registerReqBO.setClient_type(client_type); |
236 | RegisterRspBO model = null; | 236 | RegisterRspBO model = null; |
237 | try { | 237 | try { |
-
Please register or login to post a comment