Commit 681717168b11f292877596ea8c91c5477a4395e6
1 parent
4c2380a3
登录接口和绑定激光推送号 ,T_REGISTER_NO_MAPPER 增加userType字段
Showing
9 changed files
with
85 additions
and
40 deletions
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/RegisterNoMapper.java
... | ... | @@ -23,6 +23,10 @@ public class RegisterNoMapper extends BaseDomain { |
23 | 23 | */ |
24 | 24 | private Long userid; |
25 | 25 | /** |
26 | + * 用户类型:10-买家,20-卖家 | |
27 | + */ | |
28 | + private Integer userType; | |
29 | + /** | |
26 | 30 | * 注册ID |
27 | 31 | */ |
28 | 32 | private String registerNo; |
... | ... | @@ -36,6 +40,15 @@ public class RegisterNoMapper extends BaseDomain { |
36 | 40 | */ |
37 | 41 | private Integer deviceType; |
38 | 42 | |
43 | + | |
44 | + public Integer getUserType() { | |
45 | + return userType; | |
46 | + } | |
47 | + | |
48 | + public void setUserType(Integer userType) { | |
49 | + this.userType = userType; | |
50 | + } | |
51 | + | |
39 | 52 | public void setUserid(Long userid) { |
40 | 53 | this.userid = userid; |
41 | 54 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/Constant.java
... | ... | @@ -121,8 +121,11 @@ public class Constant { |
121 | 121 | /** |
122 | 122 | * 用户 |
123 | 123 | */ |
124 | - public static final long USER_ROLE_BUYER = 10L;//买家 | |
125 | - public static final long USER_ROLE_SELLER = 20L;//卖家 | |
124 | + public static final int USER_ROLE_BUYER = 10;//买家 | |
125 | + public static final int USER_ROLE_SELLER = 20;//卖家 | |
126 | + | |
127 | + public static final String USER_ROLE_SIGN_BUYER = "buyer";//买家 | |
128 | + public static final String USER_ROLE_SIGN_SELLER = "seller";//卖家 | |
126 | 129 | public static final int USER_TYPE_PERSONAL = 1; |
127 | 130 | public static final int USER_TYPE_COMPANY = 2; |
128 | 131 | public static final int USER_AUTH_RESULT_NOTAUTH = 100;//未认证 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetRegisterNoReq.java
... | ... | @@ -21,15 +21,15 @@ public class GetRegisterNoReq { |
21 | 21 | private Long userId; |
22 | 22 | |
23 | 23 | @ApiModelProperty(value = "用户角色:10买家,20卖家") |
24 | - private Long userRole; | |
24 | + private Long userType; | |
25 | 25 | |
26 | 26 | |
27 | - public Long getUserRole() { | |
28 | - return userRole; | |
27 | + public Long getUserType() { | |
28 | + return userType; | |
29 | 29 | } |
30 | 30 | |
31 | - public void setUserRole(Long userRole) { | |
32 | - this.userRole = userRole; | |
31 | + public void setUserType(Long userType) { | |
32 | + this.userType = userType; | |
33 | 33 | } |
34 | 34 | |
35 | 35 | public Long getUserId() { | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetRegisterNobyUidsReq.java
... | ... | @@ -26,15 +26,15 @@ public class GetRegisterNobyUidsReq { |
26 | 26 | private Integer platform; |
27 | 27 | |
28 | 28 | @ApiModelProperty(value = "用户角色:10买家,20卖家") |
29 | - private Long userRole; | |
29 | + private Long userType; | |
30 | 30 | |
31 | 31 | |
32 | - public Long getUserRole() { | |
33 | - return userRole; | |
32 | + public Long getUserType() { | |
33 | + return userType; | |
34 | 34 | } |
35 | 35 | |
36 | - public void setUserRole(Long userRole) { | |
37 | - this.userRole = userRole; | |
36 | + public void setUserType(Long userType) { | |
37 | + this.userType = userType; | |
38 | 38 | } |
39 | 39 | |
40 | 40 | public List<Long> getUserIds() { | ... | ... |
mobsite-getway-manager/src/main/java/com/diligrp/mobsite/getway/manager/common/RegisterNoMapperManager.java
... | ... | @@ -32,12 +32,13 @@ public interface RegisterNoMapperManager { |
32 | 32 | RegisterNoMapper bindRegisterNo(RegisterNoMapper mapper); |
33 | 33 | void unBindRegisterNo(RegisterNoMapper mapper); |
34 | 34 | |
35 | - public List<RegisterNoMapper> getRegisterNo(Long userid); | |
35 | + // public List<RegisterNoMapper> getRegisterNo(Long userid); | |
36 | 36 | /** |
37 | 37 | * 批量查询 |
38 | 38 | * @param baseQuery |
39 | 39 | * @return |
40 | 40 | */ |
41 | 41 | public List<RegisterNoMapper> batchQuery(Map<String, Object> baseQuery); |
42 | - | |
42 | + | |
43 | + List<RegisterNoMapper> getRegisterNo(Long userType, Long userId); | |
43 | 44 | } | ... | ... |
mobsite-getway-manager/src/main/java/com/diligrp/mobsite/getway/manager/common/impl/RegisterNoMapperManagerImpl.java
... | ... | @@ -59,9 +59,11 @@ public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { |
59 | 59 | public RegisterNoMapper bindRegisterNo(RegisterNoMapper mapper) { |
60 | 60 | final List<RegisterNoMapper> registerNoMappers = registerNoMapperDao.listByConditionNoYn(new BaseQuery() |
61 | 61 | .addParam("registerNo", mapper.getRegisterNo()) |
62 | + .addParam("userType", mapper.getUserType()+"") | |
62 | 63 | .addParam("sysFlag", mapper.getSysFlag() + "")); |
63 | 64 | final List<RegisterNoMapper> otherRegisterNoMappers = findByQuery(new BaseQuery() |
64 | 65 | .addParam("userid", mapper.getUserid().toString()) |
66 | + .addParam("userType", mapper.getUserType()+"") | |
65 | 67 | .addParam("sysFlag", mapper.getSysFlag() + "")); |
66 | 68 | if (!Validator.isEmpty(otherRegisterNoMappers)) { |
67 | 69 | for (RegisterNoMapper registerNoMapper : otherRegisterNoMappers) { |
... | ... | @@ -75,8 +77,9 @@ public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { |
75 | 77 | if (!Validator.isEmpty(registerNoMappers)) { |
76 | 78 | oldMapper = registerNoMappers.get(0); |
77 | 79 | newMapper = new RegisterNoMapper(); |
78 | - newMapper.setUserid(mapper.getUserid()); | |
79 | 80 | newMapper.setId(oldMapper.getId()); |
81 | + newMapper.setUserid(mapper.getUserid()); | |
82 | + newMapper.setUserType(mapper.getUserType()); | |
80 | 83 | newMapper.setRegisterNo(mapper.getRegisterNo()); |
81 | 84 | newMapper.setSysFlag(mapper.getSysFlag()); |
82 | 85 | newMapper.setDeviceType(mapper.getDeviceType()); |
... | ... | @@ -87,17 +90,6 @@ public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { |
87 | 90 | }else { |
88 | 91 | return oldMapper; |
89 | 92 | } |
90 | -// if (mapper.getUserid().equals(oldMapper.getUserid())) { | |
91 | -// return null; | |
92 | -// }else { | |
93 | -// newMapper.setUserid(mapper.getUserid()); | |
94 | -// newMapper.setId(oldMapper.getId()); | |
95 | -// newMapper.setRegisterNo(mapper.getRegisterNo()); | |
96 | -// newMapper.setSysFlag(mapper.getSysFlag()); | |
97 | -// newMapper.setDeviceType(mapper.getDeviceType()); | |
98 | -// } | |
99 | -// update(newMapper); | |
100 | -// return oldMapper; | |
101 | 93 | } |
102 | 94 | save(mapper); |
103 | 95 | return null; |
... | ... | @@ -108,6 +100,7 @@ public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { |
108 | 100 | |
109 | 101 | final List<RegisterNoMapper> registerNoMappers = findByQuery(new BaseQuery() |
110 | 102 | .addParam("userid", mapper.getUserid().toString()) |
103 | + .addParam("userType", mapper.getUserType().toString()) | |
111 | 104 | .addParam("sysFlag", mapper.getSysFlag() + "")); |
112 | 105 | if (!Validator.isEmpty(registerNoMappers)) { |
113 | 106 | for (RegisterNoMapper registerNoMapper : registerNoMappers) { |
... | ... | @@ -117,11 +110,19 @@ public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { |
117 | 110 | } |
118 | 111 | } |
119 | 112 | |
120 | - @Override | |
121 | - public List<RegisterNoMapper> getRegisterNo(Long userid) { | |
122 | - return registerNoMapperDao.getByUserId(userid); | |
123 | - } | |
113 | + //@Override | |
114 | + //public List<RegisterNoMapper> getRegisterNo(Long userid) { | |
115 | + // return registerNoMapperDao.getByUserId(userid); | |
116 | + //} | |
124 | 117 | |
118 | + @Override | |
119 | + public List<RegisterNoMapper> getRegisterNo(Long userType, Long userId) { | |
120 | + final List<RegisterNoMapper> registerNoMappers = findByQuery(new BaseQuery() | |
121 | + .addParam("userid", userId+"") | |
122 | + .addParam("userType", userType+"") | |
123 | + ); | |
124 | + return registerNoMappers; | |
125 | + } | |
125 | 126 | |
126 | 127 | |
127 | 128 | @Override |
... | ... | @@ -130,4 +131,6 @@ public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { |
130 | 131 | return registerNoMapperDao.batchQuery(baseQuery); |
131 | 132 | } |
132 | 133 | |
134 | + | |
135 | + | |
133 | 136 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
... | ... | @@ -73,7 +73,7 @@ public class UserServiceImpl implements UserService { |
73 | 73 | |
74 | 74 | if (!Validator.isEmpty(req.getRegisterNo())) { |
75 | 75 | // 缓存 |
76 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_BUYER+ | |
76 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_BUYER+ | |
77 | 77 | String.valueOf(resp.getAccountId())); |
78 | 78 | |
79 | 79 | GetRegisterNoResp mappers = redisUtil.getObject(redisKey, |
... | ... | @@ -83,6 +83,7 @@ public class UserServiceImpl implements UserService { |
83 | 83 | mapper.setRegisterNo(req.getRegisterNo()); |
84 | 84 | mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); |
85 | 85 | mapper.setUserid(resp.getAccountId()); |
86 | + mapper.setUserType(Constant.USER_ROLE_BUYER); | |
86 | 87 | mapper.setDeviceType(req.getDeviceType()); |
87 | 88 | try { |
88 | 89 | //清除当前极光号userid缓存 |
... | ... | @@ -108,7 +109,7 @@ public class UserServiceImpl implements UserService { |
108 | 109 | RegisterNoMapper oldmapper = registerNoMapperManager |
109 | 110 | .bindRegisterNo(mapper); |
110 | 111 | if (!Validator.isNull(oldmapper)){ |
111 | - String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
112 | + String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_BUYER+ | |
112 | 113 | String.valueOf(oldmapper.getUserid())); |
113 | 114 | redisUtil.deleteByKey(oldKey); |
114 | 115 | } |
... | ... | @@ -357,12 +358,13 @@ public class UserServiceImpl implements UserService { |
357 | 358 | |
358 | 359 | String userId = req.getUserId().toString(); |
359 | 360 | //先清缓存再清数据库 |
360 | - String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_BUYER+userId); | |
361 | + String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_BUYER+userId); | |
361 | 362 | |
362 | 363 | RegisterNoMapper mapper = new RegisterNoMapper(); |
363 | 364 | mapper.setRegisterNo(req.getRegisterNo()); |
364 | 365 | mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); |
365 | 366 | mapper.setUserid(req.getUserId()); |
367 | + mapper.setUserType(Constant.USER_ROLE_BUYER); | |
366 | 368 | mapper.setDeviceType(req.getDeviceType()); |
367 | 369 | try { |
368 | 370 | redisUtil.deleteByKey(reNOCache); |
... | ... | @@ -433,18 +435,23 @@ public class UserServiceImpl implements UserService { |
433 | 435 | @Override |
434 | 436 | public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { |
435 | 437 | GetRegisterNoResp resp = new GetRegisterNoResp(); |
436 | - if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserRole())) { | |
438 | + if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserType())) { | |
437 | 439 | resp.setCode(ResultCode.REQUET_PARAMS_ERROR); |
438 | - resp.setMsg("用户ID和用户角色不能为空"); | |
440 | + resp.setMsg("用户ID和用户类型不能为空"); | |
439 | 441 | return resp; |
440 | 442 | } |
441 | 443 | //先从缓存取 |
442 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, req.getUserRole()+String.valueOf(req.getUserId())); | |
444 | + String redisKey=""; | |
445 | + if (req.getUserType()==Constant.USER_ROLE_BUYER){ | |
446 | + redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(req.getUserId())); | |
447 | + }else if (req.getUserType()==Constant.USER_ROLE_SELLER){ | |
448 | + redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(req.getUserId())); | |
449 | + } | |
443 | 450 | GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); |
444 | 451 | if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { |
445 | 452 | resp.setRegisterNos(recache.getRegisterNos()); |
446 | 453 | }else { |
447 | - List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId()); | |
454 | + List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserType(),req.getUserId()); | |
448 | 455 | if (!Validator.isEmpty(mapppers)) { |
449 | 456 | |
450 | 457 | resp.setRegisterNos(mapppers); |
... | ... | @@ -462,6 +469,7 @@ public class UserServiceImpl implements UserService { |
462 | 469 | GetRegisterNobyUidsResp resp = new GetRegisterNobyUidsResp(); |
463 | 470 | Map<String, Object> param = new HashMap<String, Object>(); |
464 | 471 | param.put("userids", req.getUserIds()); |
472 | + param.put("userType",req.getUserType()); | |
465 | 473 | if (!Validator.isNull(req.getPlatform())) { |
466 | 474 | param.put("device_type",req.getPlatform().toString()); |
467 | 475 | } | ... | ... |
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 | 74 | |
75 | 75 | if (!Validator.isEmpty(req.getRegisterNo())) { |
76 | 76 | // 缓存 |
77 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SELLER+ | |
77 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_SELLER+ | |
78 | 78 | String.valueOf(resp.getSellerId())); |
79 | 79 | |
80 | 80 | GetRegisterNoResp mappers = redisUtil.getObject(redisKey, |
... | ... | @@ -84,6 +84,7 @@ public class SellerUserServiceImpl implements SellerUserService { |
84 | 84 | mapper.setRegisterNo(req.getRegisterNo()); |
85 | 85 | mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); |
86 | 86 | mapper.setUserid(resp.getSellerId()); |
87 | + mapper.setUserType(Constant.USER_ROLE_SELLER); | |
87 | 88 | mapper.setDeviceType(req.getDeviceType()); |
88 | 89 | try { |
89 | 90 | //清除当前极光号userid缓存 |
... | ... | @@ -108,7 +109,7 @@ public class SellerUserServiceImpl implements SellerUserService { |
108 | 109 | RegisterNoMapper oldmapper = registerNoMapperManager |
109 | 110 | .bindRegisterNo(mapper); |
110 | 111 | if (!Validator.isNull(oldmapper)){ |
111 | - String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
112 | + String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_SELLER+ | |
112 | 113 | String.valueOf(oldmapper.getUserid())); |
113 | 114 | redisUtil.deleteByKey(oldKey); |
114 | 115 | } |
... | ... | @@ -327,12 +328,13 @@ public class SellerUserServiceImpl implements SellerUserService { |
327 | 328 | |
328 | 329 | String userId = req.getUserId().toString(); |
329 | 330 | //先清缓存再清数据库 |
330 | - String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SELLER+userId); | |
331 | + String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_SELLER+userId); | |
331 | 332 | |
332 | 333 | RegisterNoMapper mapper = new RegisterNoMapper(); |
333 | 334 | mapper.setRegisterNo(req.getRegisterNo()); |
334 | 335 | mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); |
335 | 336 | mapper.setUserid(req.getUserId()); |
337 | + mapper.setUserType(Constant.USER_ROLE_SELLER); | |
336 | 338 | mapper.setDeviceType(req.getDeviceType()); |
337 | 339 | try { |
338 | 340 | redisUtil.deleteByKey(reNOCache); | ... | ... |
mobsite-getway-web/src/main/resources/mybatis/sqlmap/RegisterNoMapperDao.xml
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | <result property="registerNo" column="register_no"/> |
8 | 8 | <result property="sysFlag" column="sys_flag"/> |
9 | 9 | <result property="deviceType" column="device_type"/> |
10 | + <result property="userType" column="user_type"/> | |
10 | 11 | <result property="yn" column="yn"/> |
11 | 12 | <result property="created" column="created"/> |
12 | 13 | <result property="modified" column="modified"/> |
... | ... | @@ -55,11 +56,13 @@ |
55 | 56 | ,register_no |
56 | 57 | ,sys_flag |
57 | 58 | ,device_type |
59 | + ,user_type | |
58 | 60 | ) VALUES( |
59 | 61 | #{userid} |
60 | 62 | ,#{registerNo} |
61 | 63 | ,#{sysFlag} |
62 | 64 | ,#{deviceType} |
65 | + ,#{userType} | |
63 | 66 | ) |
64 | 67 | ]]> |
65 | 68 | </insert> |
... | ... | @@ -88,6 +91,9 @@ |
88 | 91 | <if test="param.userid != null and param.userid != ''"> |
89 | 92 | and userid = #{param.userid} |
90 | 93 | </if> |
94 | + <if test="param.userType != null and param.userType != ''"> | |
95 | + and userType = #{param.userType} | |
96 | + </if> | |
91 | 97 | <if test="param.registerNo != null and param.registerNo != ''"> |
92 | 98 | and register_no = #{param.registerNo} |
93 | 99 | </if> |
... | ... | @@ -126,6 +132,9 @@ |
126 | 132 | <if test="param.userid != null and param.userid != ''"> |
127 | 133 | and userid = #{param.userid} |
128 | 134 | </if> |
135 | + <if test="param.userType != null and param.userType != ''"> | |
136 | + and userType = #{param.userType} | |
137 | + </if> | |
129 | 138 | <if test="param.registerNo != null and param.registerNo != ''"> |
130 | 139 | and register_no = #{param.registerNo} |
131 | 140 | </if> |
... | ... | @@ -170,6 +179,9 @@ |
170 | 179 | <if test="param.userid != null and param.userid != ''"> |
171 | 180 | and userid = #{param.userid} |
172 | 181 | </if> |
182 | + <if test="param.userType != null and param.userType != ''"> | |
183 | + and userType = #{param.userType} | |
184 | + </if> | |
173 | 185 | <if test="param.registerNo != null and param.registerNo != ''"> |
174 | 186 | and register_no = #{param.registerNo} |
175 | 187 | </if> |
... | ... | @@ -212,6 +224,9 @@ |
212 | 224 | #{userid} |
213 | 225 | </foreach> |
214 | 226 | </if> |
227 | + <if test="param.userType != null and param.userType != ''"> | |
228 | + and userType = #{param.userType} | |
229 | + </if> | |
215 | 230 | <if test="device_type != null and device_type != ''"> |
216 | 231 | and device_type = #{device_type} |
217 | 232 | </if> | ... | ... |