Commit 2e6a7165d5f782cfbc4a1a312d96d747b1a8d97b
Merge remote-tracking branch 'origin/dev' into dev
Showing
8 changed files
with
97 additions
and
52 deletions
mobsite-getway-dao/pom.xml
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | </properties> | 11 | </properties> |
12 | <dependencies> | 12 | <dependencies> |
13 | <dependency> | 13 | <dependency> |
14 | - <groupId>com.diligrp.mobsite</groupId> | 14 | + <groupId>com.b2c.mobsite</groupId> |
15 | <artifactId>mobsite-getway-domain</artifactId> | 15 | <artifactId>mobsite-getway-domain</artifactId> |
16 | <version>0.0.1-SNAPSHOT</version> | 16 | <version>0.0.1-SNAPSHOT</version> |
17 | </dependency> | 17 | </dependency> |
mobsite-getway-domain/pom.xml
@@ -2,12 +2,14 @@ | @@ -2,12 +2,14 @@ | ||
2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" |
3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
4 | <modelVersion>4.0.0</modelVersion> | 4 | <modelVersion>4.0.0</modelVersion> |
5 | - <parent> | ||
6 | - <groupId>com.diligrp.mobsite</groupId> | ||
7 | - <artifactId>mobsite-getway</artifactId> | ||
8 | - <version>0.0.1-SNAPSHOT</version> | ||
9 | - </parent> | ||
10 | - <groupId>com.diligrp.mobsite</groupId> | 5 | + <!--<parent>--> |
6 | + <!--<groupId>com.diligrp.mobsite</groupId>--> | ||
7 | + <!--<artifactId>mobsite-getway</artifactId>--> | ||
8 | + <!--<version>0.0.1-SNAPSHOT</version>--> | ||
9 | + <!--</parent>--> | ||
10 | + | ||
11 | + | ||
12 | + <groupId>com.b2c.mobsite</groupId> | ||
11 | <artifactId>mobsite-getway-domain</artifactId> | 13 | <artifactId>mobsite-getway-domain</artifactId> |
12 | <version>0.0.1-SNAPSHOT</version> | 14 | <version>0.0.1-SNAPSHOT</version> |
13 | <name>mobsite-getway-domain</name> | 15 | <name>mobsite-getway-domain</name> |
@@ -15,12 +17,5 @@ | @@ -15,12 +17,5 @@ | ||
15 | <properties> | 17 | <properties> |
16 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 18 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
17 | </properties> | 19 | </properties> |
18 | - <dependencies> | ||
19 | - <dependency> | ||
20 | - <groupId>junit</groupId> | ||
21 | - <artifactId>junit</artifactId> | ||
22 | - <version>3.8.1</version> | ||
23 | - <scope>test</scope> | ||
24 | - </dependency> | ||
25 | - </dependencies> | 20 | + |
26 | </project> | 21 | </project> |
mobsite-getway-manager/pom.xml
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | <version>0.0.1-SNAPSHOT</version> | 25 | <version>0.0.1-SNAPSHOT</version> |
26 | </dependency> | 26 | </dependency> |
27 | <dependency> | 27 | <dependency> |
28 | - <groupId>com.diligrp.mobsite</groupId> | 28 | + <groupId>com.b2c.mobsite</groupId> |
29 | <artifactId>mobsite-getway-domain</artifactId> | 29 | <artifactId>mobsite-getway-domain</artifactId> |
30 | <version>0.0.1-SNAPSHOT</version> | 30 | <version>0.0.1-SNAPSHOT</version> |
31 | </dependency> | 31 | </dependency> |
mobsite-getway-rpc/pom.xml
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | </properties> | 17 | </properties> |
18 | <dependencies> | 18 | <dependencies> |
19 | <dependency> | 19 | <dependency> |
20 | - <groupId>com.diligrp.mobsite</groupId> | 20 | + <groupId>com.b2c.mobsite</groupId> |
21 | <artifactId>mobsite-getway-domain</artifactId> | 21 | <artifactId>mobsite-getway-domain</artifactId> |
22 | <version>0.0.1-SNAPSHOT</version> | 22 | <version>0.0.1-SNAPSHOT</version> |
23 | </dependency> | 23 | </dependency> |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/PassportRPCImpl.java
@@ -106,6 +106,8 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | @@ -106,6 +106,8 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | ||
106 | String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SELLER+String.valueOf(resp.getSellerId())); | 106 | String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SELLER+String.valueOf(resp.getSellerId())); |
107 | redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(resp.getSellerId()), loginExpireTime); | 107 | redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(resp.getSellerId()), loginExpireTime); |
108 | 108 | ||
109 | + | ||
110 | + | ||
109 | //缓存设备id,userId作为key | 111 | //缓存设备id,userId作为key |
110 | if (!Validator.isNull(req.getDeviceId())) { | 112 | if (!Validator.isNull(req.getDeviceId())) { |
111 | String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SELLER+String.valueOf(resp.getSellerId())); | 113 | String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SELLER+String.valueOf(resp.getSellerId())); |
mobsite-getway-service/pom.xml
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | <version>0.0.1-SNAPSHOT</version> | 28 | <version>0.0.1-SNAPSHOT</version> |
29 | </dependency> | 29 | </dependency> |
30 | <dependency> | 30 | <dependency> |
31 | - <groupId>com.diligrp.mobsite</groupId> | 31 | + <groupId>com.b2c.mobsite</groupId> |
32 | <artifactId>mobsite-getway-domain</artifactId> | 32 | <artifactId>mobsite-getway-domain</artifactId> |
33 | <version>0.0.1-SNAPSHOT</version> | 33 | <version>0.0.1-SNAPSHOT</version> |
34 | </dependency> | 34 | </dependency> |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
@@ -72,7 +72,7 @@ public class UserServiceImpl implements UserService { | @@ -72,7 +72,7 @@ public class UserServiceImpl implements UserService { | ||
72 | 72 | ||
73 | if (!Validator.isEmpty(req.getRegisterNo())) { | 73 | if (!Validator.isEmpty(req.getRegisterNo())) { |
74 | // 缓存 | 74 | // 缓存 |
75 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | 75 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_BUYER+ |
76 | String.valueOf(resp.getAccountId())); | 76 | String.valueOf(resp.getAccountId())); |
77 | 77 | ||
78 | GetRegisterNoResp mappers = redisUtil.getObject(redisKey, | 78 | GetRegisterNoResp mappers = redisUtil.getObject(redisKey, |
@@ -348,7 +348,31 @@ public class UserServiceImpl implements UserService { | @@ -348,7 +348,31 @@ public class UserServiceImpl implements UserService { | ||
348 | 348 | ||
349 | @Override | 349 | @Override |
350 | public LogoutResp logout(LogoutReq req) { | 350 | public LogoutResp logout(LogoutReq req) { |
351 | - return null; | 351 | + LogoutResp resp = new LogoutResp(); |
352 | + | ||
353 | + | ||
354 | + // 解除绑定极光ID | ||
355 | + if(!Validator.isEmpty(req.getRegisterNo())){ | ||
356 | + | ||
357 | + String userId = req.getUserId().toString(); | ||
358 | + //先清缓存再清数据库 | ||
359 | + String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_BUYER+userId); | ||
360 | + | ||
361 | + RegisterNoMapper mapper = new RegisterNoMapper(); | ||
362 | + mapper.setRegisterNo(req.getRegisterNo()); | ||
363 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | ||
364 | + mapper.setUserid(req.getUserId()); | ||
365 | + mapper.setDeviceType(req.getDeviceType()); | ||
366 | + try { | ||
367 | + redisUtil.deleteByKey(reNOCache); | ||
368 | + registerNoMapperManager.unBindRegisterNo(mapper); | ||
369 | + } | ||
370 | + catch(Exception e) { | ||
371 | + logger.error("解除极光推送系统绑定的注册号失败",e); | ||
372 | + } | ||
373 | + } | ||
374 | + | ||
375 | + return resp; | ||
352 | } | 376 | } |
353 | 377 | ||
354 | @Override | 378 | @Override |
@@ -376,7 +400,7 @@ public class UserServiceImpl implements UserService { | @@ -376,7 +400,7 @@ public class UserServiceImpl implements UserService { | ||
376 | return resp; | 400 | return resp; |
377 | }else { | 401 | }else { |
378 | //修改成功,退出所有账号信息 | 402 | //修改成功,退出所有账号信息 |
379 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, String.valueOf(userId)); | 403 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_BUYER+String.valueOf(userId)); |
380 | redisUtil.deleteByKey(cookieRedisKey); | 404 | redisUtil.deleteByKey(cookieRedisKey); |
381 | } | 405 | } |
382 | 406 | ||
@@ -408,13 +432,13 @@ public class UserServiceImpl implements UserService { | @@ -408,13 +432,13 @@ public class UserServiceImpl implements UserService { | ||
408 | @Override | 432 | @Override |
409 | public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | 433 | public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { |
410 | GetRegisterNoResp resp = new GetRegisterNoResp(); | 434 | GetRegisterNoResp resp = new GetRegisterNoResp(); |
411 | - if (Validator.isNull(req.getUserId())) { | 435 | + if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserRole())) { |
412 | resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | 436 | resp.setCode(ResultCode.REQUET_PARAMS_ERROR); |
413 | - resp.setMsg("用户ID不能为空"); | 437 | + resp.setMsg("用户ID和用户角色不能为空"); |
414 | return resp; | 438 | return resp; |
415 | } | 439 | } |
416 | //先从缓存取 | 440 | //先从缓存取 |
417 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, String.valueOf(req.getUserId())); | 441 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, req.getUserRole()+String.valueOf(req.getUserId())); |
418 | GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | 442 | GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); |
419 | if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | 443 | if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { |
420 | resp.setRegisterNos(recache.getRegisterNos()); | 444 | resp.setRegisterNos(recache.getRegisterNos()); |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerUserServiceImpl.java
@@ -74,7 +74,7 @@ public class SellerUserServiceImpl implements SellerUserService { | @@ -74,7 +74,7 @@ public class SellerUserServiceImpl implements SellerUserService { | ||
74 | 74 | ||
75 | if (!Validator.isEmpty(req.getRegisterNo())) { | 75 | if (!Validator.isEmpty(req.getRegisterNo())) { |
76 | // 缓存 | 76 | // 缓存 |
77 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,req.getUserRole()+ | 77 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SELLER+ |
78 | String.valueOf(resp.getSellerId())); | 78 | String.valueOf(resp.getSellerId())); |
79 | 79 | ||
80 | GetRegisterNoResp mappers = redisUtil.getObject(redisKey, | 80 | GetRegisterNoResp mappers = redisUtil.getObject(redisKey, |
@@ -239,7 +239,7 @@ public class SellerUserServiceImpl implements SellerUserService { | @@ -239,7 +239,7 @@ public class SellerUserServiceImpl implements SellerUserService { | ||
239 | return resp; | 239 | return resp; |
240 | }else { | 240 | }else { |
241 | //修改成功,退出所有账号信息 | 241 | //修改成功,退出所有账号信息 |
242 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, String.valueOf(userId)); | 242 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SELLER+String.valueOf(userId)); |
243 | redisUtil.deleteByKey(cookieRedisKey); | 243 | redisUtil.deleteByKey(cookieRedisKey); |
244 | } | 244 | } |
245 | 245 | ||
@@ -319,7 +319,31 @@ public class SellerUserServiceImpl implements SellerUserService { | @@ -319,7 +319,31 @@ public class SellerUserServiceImpl implements SellerUserService { | ||
319 | 319 | ||
320 | @Override | 320 | @Override |
321 | public LogoutResp logout(LogoutReq req) { | 321 | public LogoutResp logout(LogoutReq req) { |
322 | - return null; | 322 | + LogoutResp resp = new LogoutResp(); |
323 | + | ||
324 | + | ||
325 | + // 解除绑定极光ID | ||
326 | + if(!Validator.isEmpty(req.getRegisterNo())){ | ||
327 | + | ||
328 | + String userId = req.getUserId().toString(); | ||
329 | + //先清缓存再清数据库 | ||
330 | + String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SELLER+userId); | ||
331 | + | ||
332 | + RegisterNoMapper mapper = new RegisterNoMapper(); | ||
333 | + mapper.setRegisterNo(req.getRegisterNo()); | ||
334 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | ||
335 | + mapper.setUserid(req.getUserId()); | ||
336 | + mapper.setDeviceType(req.getDeviceType()); | ||
337 | + try { | ||
338 | + redisUtil.deleteByKey(reNOCache); | ||
339 | + registerNoMapperManager.unBindRegisterNo(mapper); | ||
340 | + } | ||
341 | + catch(Exception e) { | ||
342 | + logger.error("解除极光推送系统绑定的注册号失败",e); | ||
343 | + } | ||
344 | + } | ||
345 | + | ||
346 | + return resp; | ||
323 | } | 347 | } |
324 | 348 | ||
325 | @Override | 349 | @Override |
@@ -334,29 +358,29 @@ public class SellerUserServiceImpl implements SellerUserService { | @@ -334,29 +358,29 @@ public class SellerUserServiceImpl implements SellerUserService { | ||
334 | 358 | ||
335 | 359 | ||
336 | 360 | ||
337 | - public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | ||
338 | - GetRegisterNoResp resp = new GetRegisterNoResp(); | ||
339 | - if (Validator.isNull(req.getUserId())) { | ||
340 | - resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | ||
341 | - resp.setMsg("用户ID不能为空"); | ||
342 | - return resp; | ||
343 | - } | ||
344 | - //先从缓存取 | ||
345 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, req.getUserRole()+String.valueOf(req.getUserId())); | ||
346 | - GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | ||
347 | - if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | ||
348 | - resp.setRegisterNos(recache.getRegisterNos()); | ||
349 | - }else { | ||
350 | - List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId()); | ||
351 | - if (!Validator.isEmpty(mapppers)) { | ||
352 | - | ||
353 | - resp.setRegisterNos(mapppers); | ||
354 | - redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | ||
355 | - }else { | ||
356 | - resp.setCode(ResultCode.BUSINESS_FAILED); | ||
357 | - resp.setMsg("该用户没有绑定极光号"); | ||
358 | - } | ||
359 | - } | ||
360 | - return resp; | ||
361 | - } | 361 | + //public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { |
362 | + // GetRegisterNoResp resp = new GetRegisterNoResp(); | ||
363 | + // if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserRole())) { | ||
364 | + // resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | ||
365 | + // resp.setMsg("用户ID和用户角色不能为空"); | ||
366 | + // return resp; | ||
367 | + // } | ||
368 | + // //先从缓存取 | ||
369 | + // String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, req.getUserRole()+String.valueOf(req.getUserId())); | ||
370 | + // GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | ||
371 | + // if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | ||
372 | + // resp.setRegisterNos(recache.getRegisterNos()); | ||
373 | + // }else { | ||
374 | + // List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId()); | ||
375 | + // if (!Validator.isEmpty(mapppers)) { | ||
376 | + // | ||
377 | + // resp.setRegisterNos(mapppers); | ||
378 | + // redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | ||
379 | + // }else { | ||
380 | + // resp.setCode(ResultCode.BUSINESS_FAILED); | ||
381 | + // resp.setMsg("该用户没有绑定极光号"); | ||
382 | + // } | ||
383 | + // } | ||
384 | + // return resp; | ||
385 | + //} | ||
362 | } | 386 | } |