Commit f1407fd089161e2c01e2592b3863c7ddc70e5212

Authored by weiliwhereareyou@163.com
1 parent 6929451b

卖家登录接口开发

mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/LoginResp.java
... ... @@ -11,42 +11,13 @@ import io.swagger.annotations.ApiModelProperty;
11 11 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
12 12 * <B>Company</B> 地利集团
13 13 * @createTime Aug 12, 2014 7:57:28 PM
14   - * @author wujianjun
  14 + * @author weili
15 15 */
16 16 @SuppressWarnings("serial")
17 17 @ApiModel("返回参数")
18 18 public class LoginResp extends BaseResp {
19 19  
20   - /**
21   - * 个人用户
22   - */
23   - public static final Integer USER_TYPE_PERSONAL = 1;
24   - /**
25   - * 企业用户
26   - */
27   - public static final Integer USER_TYPE_COMPANY = 2;
28   -
29   -
30   - /**
31   - * 账户状态-正常
32   - */
33   - public static final Integer ACCOUNT_STATE_NORMAL = 1;
34   - /**
35   - * 账户状态-锁定
36   - */
37   - public static final Integer ACCOUNT_STATE_LOCK = 2;
38   - /**
39   - * 账户状态-未激活
40   - */
41   - public static final Integer ACCOUNT_STATE_INACTIVE = 3;
42   - /**
43   - * 账户状态-用户名或密码错误
44   - */
45   - public static final Integer ACCOUNT_STATE_PWD_ERROR = 4;
46   - /**
47   - * 账户状态-卖家没有开通店铺
48   - */
49   - public static final Integer ACCOUNT_STATE_NO_SHOP = 11;
  20 +
50 21 /**
51 22 * 用户信息是否完善:1-完善 0-不完善
52 23 */
... ... @@ -78,23 +49,12 @@ public class LoginResp extends BaseResp {
78 49 private String headImg;
79 50  
80 51  
81   - ///**
82   - // * 登录之后,passport返回
83   - // * 用于支付鉴权
84   - // */
85   - //@ApiModelProperty(value = "token")
86   - //private String token;
87   -
88   - ///**
89   - // * 用户信息是否完善:1-完善 0-不完善
90   - // */
91   - //@ApiModelProperty(value = "用户信息是否完善:1-完善 0-不完善")
92   - //private Integer infoCompleteFlag;
  52 +
93 53 /**
94 54 * get value of LoginResp.accountId
95 55 * @return the accountId
96 56 * @createTime Aug 13, 2014 9:58:39 AM
97   - * @author wujianjun
  57 + * @author weili
98 58 */
99 59 public Long getAccountId() {
100 60 return accountId;
... ... @@ -104,7 +64,7 @@ public class LoginResp extends BaseResp {
104 64 * set value of LoginResp.accountId
105 65 * @param accountId the accountId to set
106 66 * @createTime Aug 13, 2014 9:58:39 AM
107   - * @author wujianjun
  67 + * @author weili
108 68 */
109 69 public void setAccountId(Long accountId) {
110 70 this.accountId = accountId;
... ... @@ -114,7 +74,7 @@ public class LoginResp extends BaseResp {
114 74 * get value of LoginResp.accountName
115 75 * @return the accountName
116 76 * @createTime Aug 13, 2014 9:58:39 AM
117   - * @author wujianjun
  77 + * @author weili
118 78 */
119 79 public String getAccountName() {
120 80 return accountName;
... ... @@ -124,7 +84,7 @@ public class LoginResp extends BaseResp {
124 84 * set value of LoginResp.accountName
125 85 * @param accountName the accountName to set
126 86 * @createTime Aug 13, 2014 9:58:39 AM
127   - * @author wujianjun
  87 + * @author weili
128 88 */
129 89 public void setAccountName(String accountName) {
130 90 this.accountName = accountName;
... ... @@ -134,7 +94,7 @@ public class LoginResp extends BaseResp {
134 94 * get value of LoginResp.mobile
135 95 * @return the mobile
136 96 * @createTime Aug 13, 2014 9:58:39 AM
137   - * @author wujianjun
  97 + * @author weili
138 98 */
139 99 public String getMobile() {
140 100 return mobile;
... ... @@ -144,7 +104,7 @@ public class LoginResp extends BaseResp {
144 104 * set value of LoginResp.mobile
145 105 * @param mobile the mobile to set
146 106 * @createTime Aug 13, 2014 9:58:39 AM
147   - * @author wujianjun
  107 + * @author weili
148 108 */
149 109 public void setMobile(String mobile) {
150 110 this.mobile = mobile;
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/saler/user/SellerLoginResp.java
1 1 package com.diligrp.mobsite.getway.domain.protocol.saler.user;
2 2  
3   -import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp;
  3 +import com.diligrp.mobsite.getway.domain.protocol.BaseResp;
  4 +import io.swagger.annotations.ApiModelProperty;
4 5  
5 6  
6 7 /**
... ... @@ -12,56 +13,83 @@ import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp;
12 13 * @author zhangshirui
13 14 */
14 15 @SuppressWarnings("serial")
15   -public class SellerLoginResp extends LoginResp {
  16 +public class SellerLoginResp extends BaseResp {
16 17  
17   - /**
18   - * 店铺id
19   - */
  18 +
  19 +
  20 + @ApiModelProperty(value = "卖家id" )
  21 + private Long sellerId;
  22 + @ApiModelProperty(value = "店铺id" )
20 23 private Long shopId;
21   - /**
22   - * 店铺名称
23   - */
  24 + @ApiModelProperty(value = "店铺名称")
24 25 private String shopName;
25 26  
26   - /**
27   - * 店铺状态
28   - */
29   - private Integer shopState;
  27 + @ApiModelProperty(value = "店铺logo")
  28 + private String shopLogo;
  29 +
  30 + @ApiModelProperty(value = "店铺地址")
  31 + private String shopAddr;
30 32  
31   - /**
32   - * 店铺来源
33   - */
34   - private Integer shopSourceId;
  33 + @ApiModelProperty(value = "客服电话")
  34 + private String phone;
  35 +
  36 + @ApiModelProperty(value = "店铺分享码" )
  37 + private Integer shopAuthCode;
  38 +
  39 +
  40 + public Long getSellerId() {
  41 + return sellerId;
  42 + }
  43 +
  44 + public void setSellerId(Long sellerId) {
  45 + this.sellerId = sellerId;
  46 + }
35 47  
36 48 public Long getShopId() {
37 49 return shopId;
38 50 }
39   -
  51 +
40 52 public void setShopId(Long shopId) {
41 53 this.shopId = shopId;
42 54 }
43   -
  55 +
44 56 public String getShopName() {
45 57 return shopName;
46 58 }
47   -
  59 +
48 60 public void setShopName(String shopName) {
49 61 this.shopName = shopName;
50 62 }
51 63  
52   - public Integer getShopState() {
53   - return shopState;
  64 + public String getShopLogo() {
  65 + return shopLogo;
  66 + }
  67 +
  68 + public void setShopLogo(String shopLogo) {
  69 + this.shopLogo = shopLogo;
54 70 }
55 71  
56   - public void setShopState(Integer shopState) {
57   - this.shopState = shopState;
  72 + public String getShopAddr() {
  73 + return shopAddr;
58 74 }
59 75  
60   - public Integer getShopSourceId() {
61   - return shopSourceId;
62   - }
  76 + public void setShopAddr(String shopAddr) {
  77 + this.shopAddr = shopAddr;
  78 + }
  79 +
  80 + public String getPhone() {
  81 + return phone;
  82 + }
63 83  
64   - public void setShopSourceId(Integer shopSourceId) {
65   - this.shopSourceId = shopSourceId;
66   - }
  84 + public void setPhone(String phone) {
  85 + this.phone = phone;
  86 + }
  87 +
  88 + public Integer getShopAuthCode() {
  89 + return shopAuthCode;
  90 + }
  91 +
  92 + public void setShopAuthCode(Integer shopAuthCode) {
  93 + this.shopAuthCode = shopAuthCode;
  94 + }
67 95 }
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/PassportRPC.java
1 1 package com.diligrp.mobsite.getway.rpc;
2 2  
3 3 import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq;
  4 +import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp;
4 5 import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq;
5 6 import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp;
6 7 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq;
... ... @@ -21,11 +22,13 @@ import java.util.Map;
21 22 */
22 23 public interface PassportRPC extends BaseService {
23 24  
24   - SellerLoginResp login(LoginReq req);
  25 + SellerLoginResp sellerLogin(LoginReq req);
25 26  
26 27 UserRegisterResp register(UserRegisterReq req);
27 28  
28 29 String modifyPwd(Map<String, String> params);
29 30  
30 31 SellerRegisterResp sellerRegister(SellerRegisterReq req);
  32 +
  33 + LoginResp buyerLogin(LoginReq req);
31 34 }
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/PassportRPCImpl.java
... ... @@ -6,6 +6,7 @@ import com.diligrp.mobsite.getway.domain.common.RedisKey;
6 6 import com.diligrp.mobsite.getway.domain.common.ResultCode;
7 7 import com.diligrp.mobsite.getway.domain.except.ServiceException;
8 8 import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq;
  9 +import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp;
9 10 import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq;
10 11 import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp;
11 12 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq;
... ... @@ -58,7 +59,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
58 59 }
59 60  
60 61 @Override
61   - public SellerLoginResp login(LoginReq req) {
  62 + public SellerLoginResp sellerLogin(LoginReq req) {
62 63 Map<String,String> params = new HashMap<String, String>();
63 64 params.put("userName", req.getAccountName());
64 65 params.put("password", req.getPassword());
... ... @@ -92,21 +93,22 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
92 93  
93 94 //resp.setToken(jsonBody.getString("token"));
94 95 JSONObject jsonUser = jsonBody.getJSONObject("accountInfo");
95   - resp.setAccountId(jsonUser.getLong("accountId"));
96   - resp.setMobile(jsonUser.getString("mobile"));
97   - resp.setAccountName(jsonUser.getString("accountName"));
98   - resp.setMsg(msg);
99   - resp.setHeadImg(jsonUser.getString("face"));
  96 + resp.setSellerId(jsonUser.getLong("accountId"));
  97 + resp.setPhone(jsonUser.getString("mobile"));
100 98 resp.setShopId(jsonUser.getLong("shopId"));
101   -
  99 + resp.setShopLogo("sds.jpg");
  100 + resp.setShopName("张三的水果店铺");
  101 + resp.setShopAuthCode(457854);
  102 + resp.setCode(code);
  103 + resp.setMsg(msg);
102 104  
103 105 //缓存userId
104   - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SELLER+String.valueOf(resp.getAccountId()));
105   - redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(resp.getAccountId()), loginExpireTime);
  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);
106 108  
107 109 //缓存设备id,userId作为key
108 110 if (!Validator.isNull(req.getDeviceId())) {
109   - String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SELLER+String.valueOf(resp.getAccountId()));
  111 + String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SELLER+String.valueOf(resp.getSellerId()));
110 112 redisUtil.setStringByExpire(onlyOneLoginRedisKey, req.getDeviceId(), loginExpireTime);
111 113 }
112 114 return resp;
... ... @@ -192,4 +194,10 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
192 194 return resp;
193 195 }
194 196  
  197 + @Override
  198 + public LoginResp buyerLogin(LoginReq req) {
  199 +
  200 + return null;
  201 + }
  202 +
195 203 }
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.diligrp.mobsite.getway.service.buyer.user.impl;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput;
  5 +import com.diligrp.mobsite.getway.domain.RegisterNoMapper;
5 6 import com.diligrp.mobsite.getway.domain.common.Constant;
6 7 import com.diligrp.mobsite.getway.domain.common.ErrorMessage;
7 8 import com.diligrp.mobsite.getway.domain.common.RedisKey;
... ... @@ -24,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
24 25 import org.springframework.stereotype.Service;
25 26  
26 27 import javax.annotation.Resource;
  28 +import java.util.ArrayList;
27 29 import java.util.HashMap;
  30 +import java.util.List;
28 31 import java.util.Map;
29 32  
30 33 /**
... ... @@ -65,9 +68,70 @@ public class UserServiceImpl implements UserService {
65 68  
66 69 @Override
67 70 public LoginResp login(LoginReq req) {
68   - return null;
  71 + LoginResp resp = (LoginResp) passportRPC.buyerLogin(req);
  72 +
  73 + if (!Validator.isEmpty(req.getRegisterNo())) {
  74 + // 缓存
  75 + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,
  76 + String.valueOf(resp.getAccountId()));
  77 +
  78 + GetRegisterNoResp mappers = redisUtil.getObject(redisKey,
  79 + GetRegisterNoResp.class);
  80 + // 绑定极光ID
  81 + RegisterNoMapper mapper = new RegisterNoMapper();
  82 + mapper.setRegisterNo(req.getRegisterNo());
  83 + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH);
  84 + mapper.setUserid(resp.getAccountId());
  85 + mapper.setDeviceType(req.getDeviceType());
  86 + try {
  87 + //清除当前极光号userid缓存
  88 + cleanOldredis(mapper);
  89 + //构建缓存信息
  90 + buildRedisInfo(mappers, mapper);
  91 + redisUtil.setObjectByExpire(redisKey, mappers,
  92 + RedisKey.REGISTERNO_EXPIRE_TIME);
  93 + } catch (Exception e) {
  94 + throw new ServiceException(ResultCode.PUSH_MESSAGE_NO,
  95 + "绑定极光推送系统注册号失败");
  96 + }
  97 + }
  98 + return resp;
69 99 }
70 100  
  101 +
  102 + /**
  103 + * 清除当前极光号下userid缓存
  104 + * @param mapper
  105 + */
  106 + private void cleanOldredis(RegisterNoMapper mapper) {
  107 + RegisterNoMapper oldmapper = registerNoMapperManager
  108 + .bindRegisterNo(mapper);
  109 + if (!Validator.isNull(oldmapper)){
  110 + String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,
  111 + String.valueOf(oldmapper.getUserid()));
  112 + redisUtil.deleteByKey(oldKey);
  113 + }
  114 + }
  115 +
  116 + /**
  117 + * 建立缓存信息
  118 + * @param mappers
  119 + * @param mapper
  120 + */
  121 + private void buildRedisInfo(GetRegisterNoResp mappers,
  122 + RegisterNoMapper mapper) {
  123 + // 如果缓存没有重新建
  124 + List<RegisterNoMapper> renolist = new ArrayList<RegisterNoMapper>();
  125 +
  126 + if (Validator.isNull(mappers)) {
  127 + mappers = new GetRegisterNoResp();
  128 + }
  129 + renolist.add(mapper);
  130 + mappers.setRegisterNos(renolist);
  131 + }
  132 +
  133 +
  134 +
71 135 @Override
72 136 public CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req) {
73 137 return null;
... ... @@ -343,7 +407,29 @@ public class UserServiceImpl implements UserService {
343 407  
344 408 @Override
345 409 public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) {
346   - return null;
  410 + GetRegisterNoResp resp = new GetRegisterNoResp();
  411 + if (Validator.isNull(req.getUserId())) {
  412 + resp.setCode(ResultCode.REQUET_PARAMS_ERROR);
  413 + resp.setMsg("用户ID不能为空");
  414 + return resp;
  415 + }
  416 + //先从缓存取
  417 + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, String.valueOf(req.getUserId()));
  418 + GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class);
  419 + if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) {
  420 + resp.setRegisterNos(recache.getRegisterNos());
  421 + }else {
  422 + List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId());
  423 + if (!Validator.isEmpty(mapppers)) {
  424 +
  425 + resp.setRegisterNos(mapppers);
  426 + redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME);
  427 + }else {
  428 + resp.setCode(ResultCode.BUSINESS_FAILED);
  429 + resp.setMsg("该用户没有绑定极光号");
  430 + }
  431 + }
  432 + return resp;
347 433 }
348 434  
349 435 @Override
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerUserService.java
... ... @@ -24,7 +24,7 @@ public interface SellerUserService {
24 24 * @createTime 2015年4月16日 下午4:33:09
25 25 * @author duanyugen
26 26 */
27   - SellerLoginResp login(SellerLoginReq req) throws RuntimeException;
  27 + SellerLoginResp sellerLogin(SellerLoginReq req) throws RuntimeException;
28 28  
29 29  
30 30  
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerUserServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.diligrp.mobsite.getway.service.seller.impl;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput;
  5 +import com.diligrp.mobsite.getway.domain.RegisterNoMapper;
5 6 import com.diligrp.mobsite.getway.domain.common.Constant;
6 7 import com.diligrp.mobsite.getway.domain.common.ErrorMessage;
7 8 import com.diligrp.mobsite.getway.domain.common.RedisKey;
... ... @@ -26,7 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired;
26 27 import org.springframework.stereotype.Service;
27 28  
28 29 import javax.annotation.Resource;
  30 +import java.util.ArrayList;
29 31 import java.util.HashMap;
  32 +import java.util.List;
30 33 import java.util.Map;
31 34  
32 35  
... ... @@ -66,14 +69,69 @@ public class SellerUserServiceImpl implements SellerUserService {
66 69 private static Logger logger = LoggerFactory.getLogger(SellerUserServiceImpl.class);
67 70  
68 71 @Override
69   - public SellerLoginResp login(SellerLoginReq req) throws RuntimeException {
70   - SellerLoginResp resp = passportRPC.login(req);
  72 + public SellerLoginResp sellerLogin(SellerLoginReq req) throws RuntimeException {
  73 + SellerLoginResp resp = passportRPC.sellerLogin(req);
  74 +
  75 + if (!Validator.isEmpty(req.getRegisterNo())) {
  76 + // 缓存
  77 + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,
  78 + String.valueOf(resp.getSellerId()));
  79 +
  80 + GetRegisterNoResp mappers = redisUtil.getObject(redisKey,
  81 + GetRegisterNoResp.class);
  82 + // 绑定极光ID
  83 + RegisterNoMapper mapper = new RegisterNoMapper();
  84 + mapper.setRegisterNo(req.getRegisterNo());
  85 + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH);
  86 + mapper.setUserid(resp.getSellerId());
  87 + mapper.setDeviceType(req.getDeviceType());
  88 + try {
  89 + //清除当前极光号userid缓存
  90 + cleanOldredis(mapper);
  91 + //构建缓存信息
  92 + buildRedisInfo(mappers, mapper);
  93 + redisUtil.setObjectByExpire(redisKey, mappers,
  94 + RedisKey.REGISTERNO_EXPIRE_TIME);
  95 + } catch (Exception e) {
  96 + throw new ServiceException(ResultCode.PUSH_MESSAGE_NO,
  97 + "绑定极光推送系统注册号失败");
  98 + }
  99 + }
  100 + return resp;
  101 + }
  102 +
  103 + /**
  104 + * 清除当前极光号下userid缓存
  105 + * @param mapper
  106 + */
  107 + private void cleanOldredis(RegisterNoMapper mapper) {
  108 + RegisterNoMapper oldmapper = registerNoMapperManager
  109 + .bindRegisterNo(mapper);
  110 + if (!Validator.isNull(oldmapper)){
  111 + String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,
  112 + String.valueOf(oldmapper.getUserid()));
  113 + redisUtil.deleteByKey(oldKey);
  114 + }
  115 + }
71 116  
72   - //判断卖家是否创建店铺
  117 + /**
  118 + * 建立缓存信息
  119 + * @param mappers
  120 + * @param mapper
  121 + */
  122 + private void buildRedisInfo(GetRegisterNoResp mappers,
  123 + RegisterNoMapper mapper) {
  124 + // 如果缓存没有重新建
  125 + List<RegisterNoMapper> renolist = new ArrayList<RegisterNoMapper>();
73 126  
74   - return resp;
  127 + if (Validator.isNull(mappers)) {
  128 + mappers = new GetRegisterNoResp();
  129 + }
  130 + renolist.add(mapper);
  131 + mappers.setRegisterNos(renolist);
75 132 }
76 133  
  134 +
77 135 @Override
78 136 public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) {
79 137 SendVeriCodeResp resp = new SendVeriCodeResp();
... ... @@ -273,4 +331,32 @@ public class SellerUserServiceImpl implements SellerUserService {
273 331 public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) {
274 332 return null;
275 333 }
  334 +
  335 +
  336 +
  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, 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 + }
276 362 }
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/user/UserController.java
... ... @@ -388,6 +388,29 @@ public class UserController extends BaseApiController {
388 388  
389 389  
390 390 ///**
  391 + // * 查询极光推送号
  392 + // *
  393 + // * getRegisterNo
  394 + // */
  395 + //@RequestMapping("/getRegisterNo")
  396 + //@ResponseBody
  397 + //public void getRegisterNo() {
  398 + // GetRegisterNoReq req = getRequest(GetRegisterNoReq.class);
  399 + // try {
  400 + // GetRegisterNoResp resp = userService.getRegisterNo(req);
  401 + // sendSuccessResp(resp);
  402 + // } catch (ServiceException e){
  403 + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s",
  404 + // e.getCode(), e.getMessage()), e);
  405 + // sendError(e.getCode(), e.getMessage());
  406 + // } catch (Exception e) {
  407 + // LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e);
  408 + // sendError(e.getMessage());
  409 + // }
  410 + //}
  411 +
  412 +
  413 + ///**
391 414 // * 查看交易记录
392 415 // * @createTime 2016年8月24日 下午10:55:03
393 416 // * @author weili
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/seller/user/SellerUserController.java
... ... @@ -55,7 +55,7 @@ public class SellerUserController extends BaseApiController {
55 55 public void sellerLogin(@RequestBody SellerLoginReq temp){
56 56 SellerLoginReq req = super.getRequest(SellerLoginReq.class);
57 57 try {
58   - SellerLoginResp resp = sellerUserService.login(req);
  58 + SellerLoginResp resp = sellerUserService.sellerLogin(req);
59 59 super.sendSuccessResp(resp);
60 60 } catch (ServiceException e){
61 61 log.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s",
... ... @@ -81,7 +81,7 @@ public class SellerUserController extends BaseApiController {
81 81 try {
82 82 BeanValidator.validator(req);
83 83 req.setPassword(decodeStr(req.getPassword()));
84   - SellerLoginResp resp = sellerUserService.login(req);
  84 + SellerLoginResp resp = sellerUserService.sellerLogin(req);
85 85 super.sendSuccessResp(resp);
86 86 } catch (ServiceException e){
87 87 log.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s",
... ...