Commit 537c3508f49758baf88a91490b7a4d267a7c6490

Authored by Jiang
2 parents 6d2bef7b 17bd13d8

Merge branch 'dev' of http://git3.nong12.com/b2c/gateway into dev

Showing 18 changed files with 499 additions and 206 deletions
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/Constant.java
... ... @@ -121,6 +121,8 @@ 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 126 public static final int USER_TYPE_PERSONAL = 1;
125 127 public static final int USER_TYPE_COMPANY = 2;
126 128 public static final int USER_AUTH_RESULT_NOTAUTH = 100;//未认证
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/RedisKey.java
... ... @@ -15,20 +15,20 @@ public final class RedisKey {
15 15  
16 16 public static final int USER_SEND_VERICODE_EXPIRE_TIME = 10*60;//发送验证码失效时间,10分钟
17 17  
18   - public static final String PNR_GETWAY = "PNR_GETWAY";
  18 + public static final String ZDAPP_GETWAY = "ZDAPP_GETWAY";
19 19  
20 20 //登录信息
21   - public static final String USER_LOGININFO = PNR_GETWAY+":USER:LOGININFO";
22   - public static final String USER_DEVICEID = PNR_GETWAY+":USER:DEVICEID";
23   - public static final String USER_REGISTERNO = PNR_GETWAY+":USER:REGISTERNO";
  21 + public static final String USER_LOGININFO = ZDAPP_GETWAY+":USER:LOGININFO";
  22 + public static final String USER_DEVICEID = ZDAPP_GETWAY+":USER:DEVICEID";
  23 + public static final String USER_REGISTERNO = ZDAPP_GETWAY+":USER:REGISTERNO";
24 24  
25 25 //门卫登录信息
26   - public static final String GUARD_LOGININFO = PNR_GETWAY+":GUARD:LOGININFO";
  26 + public static final String GUARD_LOGININFO = ZDAPP_GETWAY+":GUARD:LOGININFO";
27 27  
28 28 //门卫登录session
29   - public static final String GUARD_SESSSION = PNR_GETWAY+":GUARD:SESSSION";
  29 + public static final String GUARD_SESSSION = ZDAPP_GETWAY+":GUARD:SESSSION";
30 30  
31   - public static final String USER = PNR_GETWAY+":USER";
  31 + public static final String USER = ZDAPP_GETWAY+":USER";
32 32 public static final String USER_AUTH_CODE_REGISTER = USER+":AUTH_CODE_REGISTER";//注册验证码
33 33 public static final String USER_AUTH_CODE_MODIFY_PWD_AND_PHONE = USER+":USER_AUTH_CODE_MODIFY_PWD_AND_PHONE";//修改密码
34 34  
... ... @@ -39,21 +39,21 @@ public final class RedisKey {
39 39 public static final String USER_AUTH_CODE = USER+":AUTH_CODE";
40 40  
41 41 //延迟退出 暂时未调用
42   - public static final String LOGOUT = PNR_GETWAY+":LOGOUT";
  42 + public static final String LOGOUT = ZDAPP_GETWAY+":LOGOUT";
43 43 //订单cookieValue
44   - public static final String COOKIE_VALUE = PNR_GETWAY+":COOKIE_VALUE";
  44 + public static final String COOKIE_VALUE = ZDAPP_GETWAY+":COOKIE_VALUE";
45 45  
46 46 //根据城市ID获取提货点
47 47 public static final int GETPICKUPLISTBYCITYID_TIME = 10*60;
48 48  
49 49 //专题标题
50 50 public static final int TOPIC_EXPIRE_TIME = 10;
51   - public static final String TOPIC_BAR = PNR_GETWAY+":TOPIC:BAR";
52   - public static final String TOPIC_CATEGORY = PNR_GETWAY+":TOPIC:CATEGORY";//专题标题
  51 + public static final String TOPIC_BAR = ZDAPP_GETWAY+":TOPIC:BAR";
  52 + public static final String TOPIC_CATEGORY = ZDAPP_GETWAY+":TOPIC:CATEGORY";//专题标题
53 53  
54 54 //商品缓存
55 55 public static final int PRODUCT_EXPIRE_TIME = 3*60;
56   - public static final String PRODUCT = PNR_GETWAY+":PRODUCT";
  56 + public static final String PRODUCT = ZDAPP_GETWAY+":PRODUCT";
57 57 public static final String PRODUCT_PRODUCTDETAIL = PRODUCT+":PRODUCT_DETAIL";
58 58 public static final String PRODUCT_CATEGORY = PRODUCT+":PRODUCT_CATEGORY";
59 59  
... ... @@ -61,7 +61,7 @@ public final class RedisKey {
61 61 * 订单缓存
62 62 */
63 63 public static final int ORDER_EXPIRE_TIME = 10;
64   - public static final String ORDER = PNR_GETWAY + ":ORDER";
  64 + public static final String ORDER = ZDAPP_GETWAY + ":ORDER";
65 65 public static final String ORDER_SUM_INFO = ORDER + ":SUM_INFO";
66 66 public static final String ORDER_AGREEMENT = ORDER + ":AGREEMENT";
67 67  
... ... @@ -69,7 +69,7 @@ public final class RedisKey {
69 69 * 配置缓存,config
70 70 */
71 71 public static final int CONFIG_EXPIRE_TIME = 3*60*60;
72   - public static final String CONFIG = PNR_GETWAY+":CONFIG";
  72 + public static final String CONFIG = ZDAPP_GETWAY+":CONFIG";
73 73 public static final String CONFIG_PROVINCE_CITY_ADDRESS = CONFIG+":PROVINCE_CITY_ADDRESS";
74 74 public static final String CONFIG_SYSTEM_CONFIG = CONFIG + ":SYSTEM_CONFIG";
75 75 public static final String CONFIG_SMS_CONTENT = CONFIG + ":SMS_CONTENT";
... ... @@ -94,7 +94,7 @@ public final class RedisKey {
94 94 * 店铺信息
95 95 */
96 96 public static final int SHOP_EXPIRE_TIME = 3*60;
97   - public static final String SHOP = PNR_GETWAY+":SHOP";
  97 + public static final String SHOP = ZDAPP_GETWAY+":SHOP";
98 98 public static final String SHOP_INFO = SHOP+"INFO";
99 99 public static final String SHOP_SEND_ADDRESS = SHOP+"SEND_ADDRESS";
100 100  
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/BaseReq.java
... ... @@ -58,6 +58,11 @@ public class BaseReq implements java.io.Serializable {
58 58 return token == null ? null:token.getUserId();
59 59 }
60 60  
  61 +
  62 + public Integer getUserRole() {
  63 + return token == null ? null:token.getUserRole();
  64 + }
  65 +
61 66 /**
62 67 *获取经度
63 68 * */
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/Token.java
1 1 package com.diligrp.mobsite.getway.domain.protocol;
2 2  
3 3 import com.diligrp.mobsite.getway.domain.common.enums.DeviceTypeEnum;
  4 +import io.swagger.annotations.ApiModelProperty;
4 5  
5 6  
6 7 /**
... ... @@ -17,6 +18,7 @@ public class Token {
17 18 /**
18 19 * 用户ID
19 20 */
  21 + @ApiModelProperty("用户ID")
20 22 private Long userId;
21 23 /**
22 24 * 当前终端所在市场ID
... ... @@ -25,18 +27,22 @@ public class Token {
25 27 /**
26 28 * 终端与服务端协定的密文
27 29 */
  30 + @ApiModelProperty("终端与服务端协定的密文")
28 31 private String secretkey;
29 32 /**
30 33 * 设备ID
31 34 */
  35 + @ApiModelProperty("设备ID")
32 36 private String deviceId;
33 37 /**
34 38 * app版本编号
35 39 */
  40 +
36 41 private String version;
37 42 /**
38 43 * 设备类型
39 44 */
  45 + @ApiModelProperty("设备ID:1-安卓,2-ios")
40 46 private Integer deviceType = DeviceTypeEnum.ANDROID_MOBILE.getType();
41 47 /**
42 48 * 手机系统版本
... ... @@ -46,12 +52,28 @@ public class Token {
46 52 /**
47 53 * 经度
48 54 */
  55 + @ApiModelProperty("经度")
49 56 private Double longitude;
50 57 /**
51 58 * 纬度
52 59 */
  60 + @ApiModelProperty("纬度")
53 61 private Double latitude;
54 62  
  63 + /**
  64 + * 用户角色
  65 + */
  66 + @ApiModelProperty("用户角色:10-买家,20-卖家")
  67 + private Integer userRole;
  68 +
  69 +
  70 + public Integer getUserRole() {
  71 + return userRole;
  72 + }
  73 +
  74 + public void setUserRole(Integer userRole) {
  75 + this.userRole = userRole;
  76 + }
55 77  
56 78 public Long getUserId() {
57 79 return userId;
... ...
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 */
... ... @@ -69,47 +40,21 @@ public class LoginResp extends BaseResp {
69 40 */
70 41 @ApiModelProperty(value = "手机号码")
71 42 private String mobile;
72   - ///**
73   - // * 邮箱地址
74   - // */
75   - //@ApiModelProperty(value = "邮箱")
76   - //private String email;
77   - ///**
78   - // * 1:个人用户, 2:企业用户
79   - // */
80   - //@ApiModelProperty(value = "用户类型:个人用户,2:企业用户")
81   - //private Integer userType;
82   - ///**
83   - // * 1 登入 -1 登出 (出场验货专用)
84   - // */
85   - //private Integer accountState;
86   - ///**
87   - // * 真实姓名
88   - // */
89   - //@ApiModelProperty(value = "真实姓名")
90   - //private String realName;
91   - /**
92   - * 登录之后,passport返回
93   - * 用于支付鉴权
94   - */
95   - @ApiModelProperty(value = "token")
96   - private String token;
  43 +
  44 +
97 45 /**
98 46 * 头像图片
99 47 */
100 48 @ApiModelProperty(value = "头像")
101 49 private String headImg;
102 50  
103   - /**
104   - * 用户信息是否完善:1-完善 0-不完善
105   - */
106   - @ApiModelProperty(value = "用户信息是否完善:1-完善 0-不完善")
107   - private Integer infoCompleteFlag;
  51 +
  52 +
108 53 /**
109 54 * get value of LoginResp.accountId
110 55 * @return the accountId
111 56 * @createTime Aug 13, 2014 9:58:39 AM
112   - * @author wujianjun
  57 + * @author weili
113 58 */
114 59 public Long getAccountId() {
115 60 return accountId;
... ... @@ -119,7 +64,7 @@ public class LoginResp extends BaseResp {
119 64 * set value of LoginResp.accountId
120 65 * @param accountId the accountId to set
121 66 * @createTime Aug 13, 2014 9:58:39 AM
122   - * @author wujianjun
  67 + * @author weili
123 68 */
124 69 public void setAccountId(Long accountId) {
125 70 this.accountId = accountId;
... ... @@ -129,7 +74,7 @@ public class LoginResp extends BaseResp {
129 74 * get value of LoginResp.accountName
130 75 * @return the accountName
131 76 * @createTime Aug 13, 2014 9:58:39 AM
132   - * @author wujianjun
  77 + * @author weili
133 78 */
134 79 public String getAccountName() {
135 80 return accountName;
... ... @@ -139,7 +84,7 @@ public class LoginResp extends BaseResp {
139 84 * set value of LoginResp.accountName
140 85 * @param accountName the accountName to set
141 86 * @createTime Aug 13, 2014 9:58:39 AM
142   - * @author wujianjun
  87 + * @author weili
143 88 */
144 89 public void setAccountName(String accountName) {
145 90 this.accountName = accountName;
... ... @@ -149,7 +94,7 @@ public class LoginResp extends BaseResp {
149 94 * get value of LoginResp.mobile
150 95 * @return the mobile
151 96 * @createTime Aug 13, 2014 9:58:39 AM
152   - * @author wujianjun
  97 + * @author weili
153 98 */
154 99 public String getMobile() {
155 100 return mobile;
... ... @@ -159,7 +104,7 @@ public class LoginResp extends BaseResp {
159 104 * set value of LoginResp.mobile
160 105 * @param mobile the mobile to set
161 106 * @createTime Aug 13, 2014 9:58:39 AM
162   - * @author wujianjun
  107 + * @author weili
163 108 */
164 109 public void setMobile(String mobile) {
165 110 this.mobile = mobile;
... ... @@ -167,30 +112,15 @@ public class LoginResp extends BaseResp {
167 112  
168 113  
169 114  
170   - public String getToken() {
171   - return token;
172   - }
173   -
174   -
175   - public void setToken(String token) {
176   - this.token = token;
177   - }
178   -
179   -
180 115 public String getHeadImg() {
181 116 return headImg;
182 117 }
183 118  
184   -
  119 +
185 120 public void setHeadImg(String headImg) {
186 121 this.headImg = headImg;
187 122 }
188 123  
189   - public Integer getInfoCompleteFlag() {
190   - return infoCompleteFlag;
191   - }
192 124  
193   - public void setInfoCompleteFlag(Integer infoCompleteFlag) {
194   - this.infoCompleteFlag = infoCompleteFlag;
195   - }
196   -}
  125 +
  126 + }
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/register/SellerRegisterReq.java
... ... @@ -15,13 +15,7 @@ import io.swagger.annotations.ApiModelProperty;
15 15 @ApiModel(value = "请求参数")
16 16 public class SellerRegisterReq extends BaseReq {
17 17  
18   - public static final int USER_TYPE_BUSINESS = 1;//市场商户,企业单位,个体经营,个人
19   -
20   - public static final int USER_TYPE_COMPANY = 2;
21 18  
22   - public static final int USER_TYPE_PERSONMANAGE = 3;
23   -
24   - public static final int USER_TYPE_PERSON = 4;
25 19  
26 20 public static final int APPTYPE_SHEQU = 1;
27 21  
... ... @@ -48,7 +42,7 @@ public class SellerRegisterReq extends BaseReq {
48 42 /**
49 43 * 手机验证码
50 44 */
51   - @ApiModelProperty(value = "app类型(1:社区店版,2:连锁店 ,默认1)")
  45 + @ApiModelProperty(value = "app类型(1:社区店版,2:连锁店 ,默认1)")
52 46 private Integer appType = APPTYPE_SHEQU;
53 47  
54 48  
... ...
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-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/shop/GetShopInfoResp.java
... ... @@ -10,6 +10,8 @@ import java.util.List;
10 10 * Created by xxxzzz on 2016/12/27.
11 11 */
12 12 public class GetShopInfoResp extends BaseResp {
  13 + @ApiModelProperty(value = "店铺id")
  14 + private Long shopId;
13 15  
14 16 @ApiModelProperty(value = "城市code")
15 17 private Long cityCode;
... ... @@ -51,6 +53,13 @@ public class GetShopInfoResp extends BaseResp {
51 53 private List<String> deliveryTime;
52 54  
53 55  
  56 + public Long getShopId() {
  57 + return shopId;
  58 + }
  59 +
  60 + public void setShopId(Long shopId) {
  61 + this.shopId = shopId;
  62 + }
54 63  
55 64 public Long getCityCode() {
56 65 return cityCode;
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetRegisterNoReq.java
... ... @@ -17,6 +17,17 @@ public class GetRegisterNoReq {
17 17 */
18 18 private Long userId;
19 19  
  20 + private Long userRole;
  21 +
  22 +
  23 + public Long getUserRole() {
  24 + return userRole;
  25 + }
  26 +
  27 + public void setUserRole(Long userRole) {
  28 + this.userRole = userRole;
  29 + }
  30 +
20 31 public Long getUserId() {
21 32 return userId;
22 33 }
... ...
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;
  5 +import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq;
  6 +import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp;
4 7 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq;
5 8 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp;
6 9 import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginResp;
... ... @@ -19,10 +22,13 @@ import java.util.Map;
19 22 */
20 23 public interface PassportRPC extends BaseService {
21 24  
22   - SellerLoginResp login(LoginReq req);
  25 + SellerLoginResp sellerLogin(LoginReq req);
23 26  
24 27 UserRegisterResp register(UserRegisterReq req);
25 28  
26 29 String modifyPwd(Map<String, String> params);
27   -
  30 +
  31 + SellerRegisterResp sellerRegister(SellerRegisterReq req);
  32 +
  33 + LoginResp buyerLogin(LoginReq req);
28 34 }
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/PassportRPCImpl.java
1 1 package com.diligrp.mobsite.getway.rpc.impl;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.diligrp.mobsite.getway.domain.common.Constant;
4 5 import com.diligrp.mobsite.getway.domain.common.RedisKey;
5 6 import com.diligrp.mobsite.getway.domain.common.ResultCode;
6 7 import com.diligrp.mobsite.getway.domain.except.ServiceException;
7 8 import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq;
8 9 import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp;
  10 +import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq;
  11 +import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp;
9 12 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq;
10 13 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp;
11 14 import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginResp;
... ... @@ -56,11 +59,11 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
56 59 }
57 60  
58 61 @Override
59   - public SellerLoginResp login(LoginReq req) {
  62 + public SellerLoginResp sellerLogin(LoginReq req) {
60 63 Map<String,String> params = new HashMap<String, String>();
61 64 params.put("userName", req.getAccountName());
62 65 params.put("password", req.getPassword());
63   - params.put("src", "1n4j");
  66 + params.put("src", "zadeapp");
64 67 BaseOutput<String> output = null;
65 68 try {
66 69 output = super.httpPost("/api/login/login.html", params, null,passportSign);
... ... @@ -88,40 +91,26 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
88 91 throw new ServiceException(ResultCode.BUSINESS_FAILED,msg);
89 92 }
90 93  
91   - resp.setToken(jsonBody.getString("token"));
  94 + //resp.setToken(jsonBody.getString("token"));
92 95 JSONObject jsonUser = jsonBody.getJSONObject("accountInfo");
93   - resp.setAccountId(jsonUser.getLong("accountId"));
94   - resp.setMobile(jsonUser.getString("mobile"));
95   - resp.setAccountName(jsonUser.getString("accountName"));
  96 + resp.setSellerId(jsonUser.getLong("accountId"));
  97 + resp.setPhone(jsonUser.getString("mobile"));
  98 + resp.setShopId(jsonUser.getLong("shopId"));
  99 + resp.setShopLogo("sds.jpg");
  100 + resp.setShopName("张三的水果店铺");
  101 + resp.setShopAuthCode(457854);
  102 + resp.setCode(code);
96 103 resp.setMsg(msg);
97   - resp.setHeadImg(jsonUser.getString("face"));
98   - if (Validator.isNull(jsonUser.getString("city"))){
99   - resp.setInfoCompleteFlag(LoginResp.USER_INFOCOMPLETEFLAG_NO);
100   - }else {
101   - resp.setInfoCompleteFlag(LoginResp.USER_INFOCOMPLETEFLAG_YES);
102   - }
103   -
104   - //if (Constant.USER_STATE_LOCKED == jsonUser.getInteger("accountState")) {
105   - //resp.setMsg(ErrorMessage.USER_STATE_LOCKED);
106   - //resp.setCode(PASSPORT_LOGIN_CODE_LOCKED);
107   - //}
108   -
109   - //if (Validator.isNull(resp.getAccountState())
110   - // || resp.getAccountState()!= LoginResp.ACCOUNT_STATE_NORMAL) {
111   - // throw new ServiceException(ResultCode.BUSINESS_FAILED,resp.getMsg());
112   - //}
113   -
114   - //登录redisKey=userId-deviceId
115 104  
116   - //String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, resp.getAccountId()+Constant.COMMON_DASH+req.getDeviceId());
117   - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, String.valueOf(resp.getAccountId()));
118   - redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(resp.getAccountId()), loginExpireTime);
  105 + //缓存userId
  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);
119 108  
120   - // 去掉登录设备排斥验证
121   - //if (!Validator.isNull(req.getDeviceId())) {
122   - // String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, String.valueOf(resp.getAccountId()));
123   - // redisUtil.setStringByExpire(onlyOneLoginRedisKey, req.getDeviceId(), loginExpireTime);
124   - //}
  109 + //缓存设备id,userId作为key
  110 + if (!Validator.isNull(req.getDeviceId())) {
  111 + String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SELLER+String.valueOf(resp.getSellerId()));
  112 + redisUtil.setStringByExpire(onlyOneLoginRedisKey, req.getDeviceId(), loginExpireTime);
  113 + }
125 114 return resp;
126 115 }
127 116  
... ... @@ -175,4 +164,40 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
175 164 return output.getData();
176 165 }
177 166  
  167 + @Override
  168 + public SellerRegisterResp sellerRegister(SellerRegisterReq req) {
  169 + Map<String,String> params = new HashMap<String, String>();
  170 + params.put("mobile", req.getMobile());
  171 + params.put("password", req.getPassword());
  172 + //BaseOutput<String> output = null;
  173 + //try {
  174 + // output = super.httpPost("/api/register/buyerRegister.html", params,null, passportSign);
  175 + //
  176 + //} catch (Exception e) {
  177 + // log.error("调用passport注册接口失败",e);
  178 + // throw new ServiceException();
  179 + //}
  180 + //
  181 + SellerRegisterResp resp = new SellerRegisterResp();
  182 + //JSONObject jsonBody = JSONObject.parseObject(output.getData());
  183 + //int code = jsonBody.getIntValue("code");
  184 + ////成功
  185 + //if(code == ResultCode.SUCCESS){
  186 + // resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS);
  187 + //}else{
  188 + // resp.setResultFlag(UserRegisterResp.RESULT_FLAG_FAILED);
  189 + //}
  190 + //resp.setMsg(jsonBody.getString("msg"));
  191 + //
  192 + //log.info("注册用户信息:msg={}"+jsonBody.getString("msg"));
  193 +
  194 + return resp;
  195 + }
  196 +
  197 + @Override
  198 + public LoginResp buyerLogin(LoginReq req) {
  199 +
  200 + return null;
  201 + }
  202 +
178 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,10 +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   - return null;
  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,req.getUserRole()+
  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 + }
  116 +
  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>();
  126 +
  127 + if (Validator.isNull(mappers)) {
  128 + mappers = new GetRegisterNoResp();
  129 + }
  130 + renolist.add(mapper);
  131 + mappers.setRegisterNos(renolist);
71 132 }
72 133  
  134 +
73 135 @Override
74 136 public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) {
75 137 SendVeriCodeResp resp = new SendVeriCodeResp();
... ... @@ -188,9 +250,73 @@ public class SellerUserServiceImpl implements SellerUserService {
188 250  
189 251 @Override
190 252 public SellerRegisterResp sellerRegister(SellerRegisterReq req) {
191   - return null;
  253 + SellerRegisterResp resp = new SellerRegisterResp();
  254 +
  255 + //手机号码和账号验证、验证码
  256 + if (!checkRegisterInfo( req)) {
  257 + return resp;
  258 + }
  259 +
  260 + resp = passportRPC.sellerRegister(req);
  261 +
  262 + return resp;
  263 + }
  264 +
  265 + /**
  266 + * 检测注册信息是否正确
  267 + * 1.电话号码
  268 + * 2.账号,会员名
  269 + * 3.验证码
  270 + * @createTime 2014年10月31日 下午2:37:16
  271 + * @author weili
  272 + */
  273 + private boolean checkRegisterInfo( SellerRegisterReq req){
  274 + if(!sellerRPC.checkMobile(req.getMobile())){
  275 + throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST);
  276 + }
  277 + //验证万能验证码
  278 + String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY);
  279 + if (req.getVeriCode().equals(passkey)) {
  280 + return true;
  281 + }
  282 +
  283 + checkVeriCode(req.getVeriCode(), req.getMobile(),SendVeriCodeReq.MSG_TYPE_REGISTER);
  284 +
  285 + return true;
192 286 }
193 287  
  288 + /**
  289 + * 根据验证码和电话号码,验证收到的验证码
  290 + *
  291 + * @param code
  292 + * @param mobile
  293 + * @return
  294 + * @createTime 2014年8月28日 下午5:44:48
  295 + * @author weili
  296 + */
  297 + private void checkVeriCode(String code, String mobile,Integer msgType) {
  298 +
  299 + String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile);
  300 +
  301 + String redisCode = redisUtil.getString(redisKey);
  302 +
  303 + if(Validator.isEmpty(code)){
  304 + throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_EMPTY);
  305 + }
  306 +
  307 + //验证码为空
  308 + if (Validator.isEmpty(redisCode)) {
  309 + throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_OVERTIME);
  310 + }
  311 +
  312 + //验证码不为空,并且和redis中的验证码相同
  313 + if (!code.equals(redisCode)) {
  314 + throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_WRONG);
  315 + }
  316 +
  317 + }
  318 +
  319 +
194 320 @Override
195 321 public LogoutResp logout(LogoutReq req) {
196 322 return null;
... ... @@ -205,4 +331,32 @@ public class SellerUserServiceImpl implements SellerUserService {
205 331 public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) {
206 332 return null;
207 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, 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 + }
208 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",
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/filter/LoginTimeoutInterceptor.java
... ... @@ -85,28 +85,28 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter {
85 85  
86 86 //登录redisKey=userId-deviceId
87 87 // String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, userId + Constant.COMMON_DASH + baseReq.getDeviceId());
88   -
89   - String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, String.valueOf(userId));
  88 + //登录排斥验证
  89 + String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, token.getUserRole()+String.valueOf(userId));
90 90 String loginValue = redisUtil.getString(loginKey);
91   - //String loginDevicedKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, String.valueOf(userId));
92   - //String loginDevicedValue = redisUtil.getString(loginDevicedKey);
93   -
94 91 if(Validator.isEmpty(loginValue) || !loginValue.equals(String.valueOf(userId))) {
95 92 log.error("用户没有登录请重新登录[userId={}]",userId);
96 93 WebContent.sendErrorInfo(ResultCode.LOGIN_FAILED, ErrorMessage.USER_NOT_LOGIN);
97 94 return false;
98 95 }
99   - //TODO 去掉了登录排斥验证
100   - //if (!Validator.isNull(baseReq.getDeviceId())) {
101   - // if(Validator.isEmpty(loginDevicedValue) || !loginDevicedValue.equals(baseReq.getDeviceId())) {
102   - // log.error("用户使用其他设备重新登录[userId={}]",userId);
103   - // WebContent.sendErrorInfo(ResultCode.LOGIN_MULTI, ErrorMessage.USER_LOGIN_MULTI);
104   - // return false;
105   - // }
106   - //}
  96 +
  97 + //登录设备排斥验证
  98 + String loginDevicedKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, token.getUserRole()+String.valueOf(userId));
  99 + String loginDevicedValue = redisUtil.getString(loginDevicedKey);
  100 + if (!Validator.isNull(baseReq.getDeviceId())) {
  101 + if(Validator.isEmpty(loginDevicedValue) || !loginDevicedValue.equals(baseReq.getDeviceId())) {
  102 + log.error("用户使用其他设备重新登录[userId={}]",userId);
  103 + WebContent.sendErrorInfo(ResultCode.LOGIN_MULTI, ErrorMessage.USER_LOGIN_MULTI);
  104 + return false;
  105 + }
  106 + }
107 107  
108 108 //登录延时
109   - logoutDelay(userId,baseReq.getDeviceId());
  109 + logoutDelay(userId,baseReq.getDeviceId(),token.getUserRole());
110 110  
111 111 return true;
112 112 }
... ... @@ -115,12 +115,10 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter {
115 115 * 延迟登录超时时间
116 116 * @param userId 用户ID
117 117 */
118   - private void logoutDelay(long userId,String deviceId) {
  118 + private void logoutDelay(long userId,String deviceId,Integer userRole) {
119 119 try {
120 120 //cookievalue的rediskey
121   -// String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, userId + Constant.COMMON_DASH + deviceId);
122   - //TODO 2.5之后版本需要加上
123   - String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, String.valueOf(userId));
  121 + String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, userRole+String.valueOf(userId));
124 122 //缓存cookievalue
125 123 redisUtil.setStringByExpire(loginKey, String.valueOf(userId), loginExpireTime);
126 124  
... ...
mobsite-getway-web/src/main/resources/spring-rpc.xml
... ... @@ -56,16 +56,16 @@
56 56 <!--<property name="DEFAULT_MAX_PER_ROUTE" value="20"></property>-->
57 57 <!--<property name="MAX_TOTAL" value="100"></property>-->
58 58 <!--</bean>-->
59   - <bean id="dataStoredConfig" class="com.dili.dataStored.sdk.common.DataStoredConfig">
60   - <property name="trackercount" value="${project.fastdfs.trackercount}"/>
61   - <property name="connectTimeout" value="${project.fastdfs.connectTimeout}"/>
62   - <property name="networkTimeout" value="${project.fastdfs.networkTimeout}"/>
63   - <property name="charset" value="${project.fastdfs.charset}"/>
64   - <property name="trackers" value="${project.fastdfs.trackers}"/>
65   - </bean>
66   - <bean id="dataStoredService" class="com.dili.dataStored.sdk.common.DataStoredServiceImpl">
67   - <constructor-arg index="0" ref="dataStoredConfig"/>
68   - </bean>
  59 + <!--<bean id="dataStoredConfig" class="com.dili.dataStored.sdk.common.DataStoredConfig">-->
  60 + <!--<property name="trackercount" value="${project.fastdfs.trackercount}"/>-->
  61 + <!--<property name="connectTimeout" value="${project.fastdfs.connectTimeout}"/>-->
  62 + <!--<property name="networkTimeout" value="${project.fastdfs.networkTimeout}"/>-->
  63 + <!--<property name="charset" value="${project.fastdfs.charset}"/>-->
  64 + <!--<property name="trackers" value="${project.fastdfs.trackers}"/>-->
  65 + <!--</bean>-->
  66 + <!--<bean id="dataStoredService" class="com.dili.dataStored.sdk.common.DataStoredServiceImpl">-->
  67 + <!--<constructor-arg index="0" ref="dataStoredConfig"/>-->
  68 + <!--</bean>-->
69 69  
70 70 <!-- ÉÏ´«Í¼Æ¬Â·¾¶ -->
71 71 <bean id="imageStoreUpload" class="com.diligrp.store.api.upload.DiliStoreUpload">
... ...