Commit b01020f8dcabfa50d03d48ee4db4bca423124238
Merge remote-tracking branch 'origin/dev' into dev
Showing
19 changed files
with
235 additions
and
493 deletions
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/detail/GetShopByIdReq.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/AuthLoginReq.java
... | ... | @@ -34,6 +34,14 @@ public class AuthLoginReq extends BaseReq { |
34 | 34 | private String registerNo; |
35 | 35 | |
36 | 36 | |
37 | + public String getAuthCode() { | |
38 | + return authCode; | |
39 | + } | |
40 | + | |
41 | + public void setAuthCode(String authCode) { | |
42 | + this.authCode = authCode; | |
43 | + } | |
44 | + | |
37 | 45 | public AuthLoginReq() { |
38 | 46 | } |
39 | 47 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/LoginResp.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeReq.java
... | ... | @@ -37,7 +37,7 @@ public class SendVeriCodeReq extends BaseReq { |
37 | 37 | /** |
38 | 38 | * 消息类型 |
39 | 39 | */ |
40 | - @ApiModelProperty(value = "消息类型:1登录,2注册,3找回密码,4修改新电话号码,5验证旧电话号码",required = true) | |
40 | + @ApiModelProperty(value = "消息类型:1登录,2注册,3找回密码",required = true) | |
41 | 41 | private Integer msgType; |
42 | 42 | |
43 | 43 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeResp.java
... | ... | @@ -30,11 +30,11 @@ public class SendVeriCodeResp extends BaseResp { |
30 | 30 | */ |
31 | 31 | @ApiModelProperty(value = "发送结果:1成功") |
32 | 32 | private Integer sendCode = SEND_CODE_ERROR; |
33 | - /** | |
34 | - * 万能验证码 | |
35 | - */ | |
36 | - @ApiModelProperty(value = "万能验证码") | |
37 | - private String passKey; | |
33 | + ///** | |
34 | + // * 万能验证码 | |
35 | + // */ | |
36 | + //@ApiModelProperty(value = "万能验证码") | |
37 | + //private String passKey; | |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * get value of SendVeriCodeResp.sendCode |
... | ... | @@ -59,12 +59,4 @@ public class SendVeriCodeResp extends BaseResp { |
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | - public String getPassKey() { | |
63 | - return passKey; | |
64 | - } | |
65 | - | |
66 | - | |
67 | - public void setPassKey(String passKey) { | |
68 | - this.passKey = passKey; | |
69 | - } | |
70 | 62 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/register/CheckMobileResp.java
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/PassportRPC.java
... | ... | @@ -2,15 +2,13 @@ package com.diligrp.mobsite.getway.rpc; |
2 | 2 | |
3 | 3 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
4 | 4 | import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; |
5 | +import com.diligrp.mobsite.getway.domain.protocol.login.AuthLoginReq; | |
5 | 6 | import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; |
6 | 7 | import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; |
7 | -import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp; | |
8 | 8 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
9 | -import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; | |
9 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
10 | 10 | import com.diligrp.mobsite.getway.rpc.base.BaseService; |
11 | 11 | |
12 | -import java.util.Map; | |
13 | - | |
14 | 12 | |
15 | 13 | /** |
16 | 14 | * <B>Description</B> Passport登陆 <br /> |
... | ... | @@ -24,11 +22,12 @@ public interface PassportRPC extends BaseService { |
24 | 22 | |
25 | 23 | SellerInfoOutput sellerLogin(LoginReq req); |
26 | 24 | |
27 | - UserRegisterResp register(UserRegisterReq req); | |
25 | + BuyerInfoOutput buyerRegister(UserRegisterReq req); | |
28 | 26 | |
29 | - String modifyPwd(Map<String, String> params); | |
27 | + boolean modifyPwdBuyer(ModifyPwdReq req); | |
28 | + boolean modifyPwdSeller(ModifyPwdReq req); | |
30 | 29 | |
31 | - SellerRegisterResp sellerRegister(SellerRegisterReq req); | |
30 | + SellerInfoOutput sellerRegister(SellerRegisterReq req); | |
32 | 31 | |
33 | 32 | BuyerInfoOutput buyerLogin(LoginReq req); |
34 | 33 | |
... | ... | @@ -41,4 +40,5 @@ public interface PassportRPC extends BaseService { |
41 | 40 | boolean verifyBuyerSmsCode(String mobile, String veriCode); |
42 | 41 | |
43 | 42 | |
43 | + BuyerInfoOutput authlogin(AuthLoginReq req); | |
44 | 44 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/SellerRPC.java
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/UserRPC.java
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 | -import com.alibaba.fastjson.JSONObject; | |
4 | 3 | import com.alibaba.fastjson.TypeReference; |
5 | 4 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
6 | 5 | import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; |
7 | 6 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
8 | 7 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
9 | 8 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
9 | +import com.diligrp.mobsite.getway.domain.protocol.login.AuthLoginReq; | |
10 | 10 | import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; |
11 | 11 | import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeReq; |
12 | 12 | import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; |
13 | -import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp; | |
14 | 13 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
15 | -import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; | |
14 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
16 | 15 | import com.diligrp.mobsite.getway.rpc.PassportRPC; |
17 | 16 | import com.diligrp.mobsite.getway.rpc.base.BaseOutput; |
18 | 17 | import com.diligrp.mobsite.getway.rpc.base.impl.BaseServiceImpl; |
... | ... | @@ -110,57 +109,72 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { |
110 | 109 | } |
111 | 110 | |
112 | 111 | @Override |
113 | - public UserRegisterResp register(UserRegisterReq req) { | |
112 | + public BuyerInfoOutput buyerRegister(UserRegisterReq req) { | |
114 | 113 | Map<String,String> params = new HashMap<String, String>(); |
115 | - params.put("mobile", req.getMobile()); | |
116 | - params.put("password", req.getPassword()); | |
117 | - // params.put("accountName", req.getAccountName()); | |
118 | - // params.put("source", PASSPORT_REGIST_SOURCE_PNR); | |
119 | - BaseOutput<String> output = null; | |
114 | + params.put("mobilePhone", req.getMobile()); | |
115 | + params.put("accountPwd", req.getPassword()); | |
116 | + params.put("validCode",req.getVeriCode()); | |
117 | + params.put("accountName",req.getMobile()); | |
118 | + BaseOutput<BuyerInfoOutput > output = null; | |
120 | 119 | try { |
121 | - output = super.httpPost("/api/register/buyerRegister.html", params,null); | |
122 | - | |
120 | + output = super.httpPost("/api/register/buyerRegister", params,new TypeReference<BaseOutput<BuyerInfoOutput>>(){}); | |
123 | 121 | } catch (Exception e) { |
124 | - log.error("error:调用passport注册接口失败",e); | |
122 | + log.error("error:调用passport卖家注册接口失败",e); | |
125 | 123 | throw new ServiceException(); |
126 | 124 | } |
127 | - | |
128 | - UserRegisterResp resp = new UserRegisterResp(); | |
129 | - JSONObject jsonBody = JSONObject.parseObject(output.getData()); | |
130 | - int code = jsonBody.getIntValue("code"); | |
131 | - //成功 | |
132 | - if(code == ResultCode.SUCCESS){ | |
133 | - resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
134 | - }else{ | |
135 | - resp.setResultFlag(UserRegisterResp.RESULT_FLAG_FAILED); | |
125 | + | |
126 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
127 | + log.error("error:调用passport卖家注册失败[mobile={},code={},msg={}]",new Object[]{req.getMobile(),output.getCode(),output.getResult()}); | |
128 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
136 | 129 | } |
137 | - resp.setMsg(jsonBody.getString("msg")); | |
138 | - | |
139 | - log.info("注册用户信息:msg={}"+jsonBody.getString("msg")); | |
140 | - | |
141 | - return resp; | |
130 | + return output.getData(); | |
142 | 131 | } |
143 | 132 | |
144 | 133 | @Override |
145 | - public String modifyPwd(Map<String,String> params){ | |
146 | - | |
147 | - BaseOutput<String> output = null; | |
134 | + public boolean modifyPwdBuyer(ModifyPwdReq req){ | |
135 | + Map<String,String> params = new HashMap<>(); | |
136 | + params.put("password", req.getPassword()); | |
137 | + params.put("phoneNumber", req.getAccountName()); | |
138 | + | |
139 | + BaseOutput<String> output = null; | |
148 | 140 | try { |
149 | - output = super.httpPost("/api/forgot/updateSellerPasswordByPhoneNumber", params,null); | |
141 | + output = super.httpPost("/api/forgot/updateBuyerPasswordByPhoneNumber", params,null); | |
150 | 142 | |
151 | 143 | } catch (Exception e) { |
152 | - log.error("error:调用passport修改密码接口失败",e); | |
144 | + log.error("error:调用passport买家修改密码接口失败",e); | |
153 | 145 | throw new ServiceException(); |
154 | 146 | } |
155 | - if (Validator.isNull(output)) { | |
156 | - log.error("error:调用passport修改密码接口失败"); | |
157 | - throw new ServiceException(ResultCode.BUSINESS_FAILED); | |
147 | + int code = output.getCode(); | |
148 | + if (code!=ResultCode.SUCCESS) { | |
149 | + log.error("error:调用passport买家修改密码接口失败[mobile={},password={}]",req.getAccountName(),req.getPassword()); | |
150 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
158 | 151 | } |
159 | - return output.getData(); | |
152 | + return code==ResultCode.SUCCESS; | |
153 | + } | |
154 | + | |
155 | + @Override | |
156 | + public boolean modifyPwdSeller(ModifyPwdReq req){ | |
157 | + Map<String,String> params = new HashMap<>(); | |
158 | + params.put("password", req.getPassword()); | |
159 | + params.put("phoneNumber", req.getAccountName()); | |
160 | + | |
161 | + BaseOutput<String> output = null; | |
162 | + try { | |
163 | + output = super.httpPost("/api/forgot/updateSellerPasswordByPhoneNumber", params,null); | |
164 | + | |
165 | + } catch (Exception e) { | |
166 | + log.error("error:调用passport卖家修改密码接口失败",e); | |
167 | + throw new ServiceException(); | |
168 | + } | |
169 | + if (output.getCode()!=ResultCode.SUCCESS) { | |
170 | + log.error("error:调用passport卖家修改密码接口失败[mobile={},password={}]",req.getAccountName(),req.getPassword()); | |
171 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
172 | + } | |
173 | + return output.getCode()==ResultCode.SUCCESS; | |
160 | 174 | } |
161 | 175 | |
162 | 176 | @Override |
163 | - public SellerRegisterResp sellerRegister(SellerRegisterReq req) { | |
177 | + public SellerInfoOutput sellerRegister(SellerRegisterReq req) { | |
164 | 178 | Map<String,String> params = new HashMap<String, String>(); |
165 | 179 | params.put("mobilePhone", req.getMobile()); |
166 | 180 | params.put("accountPwd", req.getPassword()); |
... | ... | @@ -174,17 +188,14 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { |
174 | 188 | throw new ServiceException(); |
175 | 189 | } |
176 | 190 | |
177 | - SellerRegisterResp resp = new SellerRegisterResp(); | |
178 | 191 | |
179 | 192 | if (output.getCode()!=ResultCode.SUCCESS){ |
180 | 193 | log.error("error:调用passport卖家注册失败[mobile=,code=,msg=]",new Object[]{req.getMobile(),output.getCode(),output.getResult()}); |
181 | 194 | throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); |
182 | 195 | } |
183 | - //成功 | |
184 | - resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
185 | 196 | |
186 | 197 | |
187 | - return resp; | |
198 | + return output.getData(); | |
188 | 199 | } |
189 | 200 | |
190 | 201 | |
... | ... | @@ -312,4 +323,30 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { |
312 | 323 | |
313 | 324 | return output.getCode().equals("200"); |
314 | 325 | } |
326 | + | |
327 | + @Override | |
328 | + public BuyerInfoOutput authlogin(AuthLoginReq req) { | |
329 | + Map<String,String> params = new HashMap<>(); | |
330 | + params.put("username", req.getAccountName()); | |
331 | + params.put("code", req.getAuthCode()); | |
332 | + BaseOutput<BuyerInfoOutput > output = null; | |
333 | + try { | |
334 | + output = super.httpPost("/api/login/buyerSMSLogin", params, new TypeReference<BaseOutput<BuyerInfoOutput>>(){}); | |
335 | + } catch (Exception e) { | |
336 | + log.error("error:调用passport买家验证码登录接口失败",e); | |
337 | + throw new ServiceException(); | |
338 | + } | |
339 | + BuyerInfoOutput buyerInfo = output.getData(); | |
340 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
341 | + log.error("error:调用passport买家验证码登录失败[mobile=,code=,msg=]",new Object[]{req.getAccountName(),output.getCode(),output.getResult()}); | |
342 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
343 | + } | |
344 | + | |
345 | + if (Validator.isNull(buyerInfo)||Validator.isNull(buyerInfo.getId())){ | |
346 | + log.error("error:买家验证码登录返回用户信息为空[accountName=]",req.getAccountName()); | |
347 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_NOT_EXIST); | |
348 | + } | |
349 | + return buyerInfo; | |
350 | + | |
351 | + } | |
315 | 352 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/SellerRPCImpl.java
1 | 1 | package com.diligrp.mobsite.getway.rpc.impl; |
2 | 2 | |
3 | -import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; | |
4 | 3 | import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; |
5 | -import com.b2c.myapp.common.api.shop.output.ShopOutput; | |
6 | 4 | import com.b2c.myapp.common.utils.BaseOutput; |
7 | 5 | import com.b2c.myapp.sdk.MyAppClient; |
8 | 6 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
9 | 7 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
10 | 8 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
11 | -import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
12 | -import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; | |
13 | 9 | import com.diligrp.mobsite.getway.rpc.GoodsRPC; |
14 | 10 | import com.diligrp.mobsite.getway.rpc.SellerRPC; |
15 | 11 | import com.diligrp.website.util.redis.RedisUtil; |
... | ... | @@ -20,7 +16,6 @@ import org.slf4j.LoggerFactory; |
20 | 16 | import org.springframework.stereotype.Service; |
21 | 17 | |
22 | 18 | import javax.annotation.Resource; |
23 | -import java.util.List; | |
24 | 19 | |
25 | 20 | |
26 | 21 | /** |
... | ... | @@ -51,9 +46,8 @@ public class SellerRPCImpl implements SellerRPC { |
51 | 46 | |
52 | 47 | |
53 | 48 | @Override |
54 | - public boolean checkMobile(String mobile) { | |
49 | + public SellerInfoOutput checkMobile(String mobile) { | |
55 | 50 | BaseOutput<SellerInfoOutput> output = null; |
56 | - boolean flag = false; | |
57 | 51 | try { |
58 | 52 | output = userClient.getSellerInfoService().getSellerInfoByMobilePhone(mobile); |
59 | 53 | } catch (Exception e) { |
... | ... | @@ -63,10 +57,9 @@ public class SellerRPCImpl implements SellerRPC { |
63 | 57 | |
64 | 58 | if (output==null||!output.getCode().equals("200")){ |
65 | 59 | logger.error("手机号查询卖家接口失败:[userId={},code={},result={}]",new Object[]{mobile,output.getCode(),output.getResult()}); |
66 | - throw new ServiceException(); | |
60 | + throw new ServiceException(output.getResult()); | |
67 | 61 | } |
68 | - flag = !Validator.isNull(output.getData()); | |
69 | - return flag; | |
62 | + return output.getData(); | |
70 | 63 | } |
71 | 64 | |
72 | 65 | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/UserRPCImpl.java
... | ... | @@ -54,9 +54,8 @@ public class UserRPCImpl implements UserRPC { |
54 | 54 | } |
55 | 55 | |
56 | 56 | @Override |
57 | - public boolean checkMobile(String mobile) { | |
57 | + public BuyerInfoOutput checkMobile(String mobile) { | |
58 | 58 | BaseOutput<BuyerInfoOutput> output = null; |
59 | - boolean flag = false; | |
60 | 59 | try { |
61 | 60 | output = myAppClient.getBuyerInfoService().getBuyerInfoByMobilePhone(mobile); |
62 | 61 | } catch (Exception e) { |
... | ... | @@ -66,15 +65,10 @@ public class UserRPCImpl implements UserRPC { |
66 | 65 | |
67 | 66 | if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ |
68 | 67 | logger.error("手机号查询买家接口失败:[userId={},code={},result={}]",new Object[]{mobile,output.getCode(),output.getResult()}); |
69 | - throw new ServiceException(); | |
70 | - } | |
71 | - flag = !Validator.isNull(output.getData()); | |
72 | - if(flag){ | |
73 | - logger.info("success:电话号码没有被注册:mobile={}",mobile); | |
74 | - }else { | |
75 | - logger.info("error:电话号码已经被注册:mobile={}",mobile); | |
68 | + throw new ServiceException(output.getResult()); | |
76 | 69 | } |
77 | - return flag; | |
70 | + | |
71 | + return output.getData(); | |
78 | 72 | } |
79 | 73 | |
80 | 74 | @Override | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/shop/impl/ShopServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.shop.impl; |
2 | 2 | |
3 | +import com.b2c.myapp.common.api.shop.output.ShopOutput; | |
4 | +import com.diligrp.mobsite.getway.domain.common.ErrorMessage; | |
5 | +import com.diligrp.mobsite.getway.domain.common.ResultCode; | |
6 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
3 | 7 | import com.diligrp.mobsite.getway.domain.protocol.detail.BindToShopReq; |
4 | 8 | import com.diligrp.mobsite.getway.domain.protocol.detail.BindToShopResp; |
5 | 9 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdReq; |
6 | 10 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdResp; |
11 | +import com.diligrp.mobsite.getway.rpc.impl.ShopRPCImpl; | |
7 | 12 | import com.diligrp.mobsite.getway.service.buyer.shop.ShopService; |
13 | +import com.diligrp.website.util.security.Validator; | |
14 | +import org.slf4j.Logger; | |
15 | +import org.slf4j.LoggerFactory; | |
8 | 16 | import org.springframework.stereotype.Service; |
9 | 17 | |
18 | +import javax.annotation.Resource; | |
19 | + | |
10 | 20 | |
11 | 21 | /** |
12 | 22 | * <B>Description</B> ShopServiceImpl <br /> |
... | ... | @@ -18,6 +28,13 @@ import org.springframework.stereotype.Service; |
18 | 28 | */ |
19 | 29 | @Service |
20 | 30 | public class ShopServiceImpl implements ShopService { |
31 | + | |
32 | + @Resource | |
33 | + private ShopRPCImpl shopRPC; | |
34 | + | |
35 | + | |
36 | + private Logger logger = LoggerFactory.getLogger(getClass()); | |
37 | + | |
21 | 38 | @Override |
22 | 39 | public BindToShopResp bindToShop(BindToShopReq req) { |
23 | 40 | return null; |
... | ... | @@ -25,6 +42,22 @@ public class ShopServiceImpl implements ShopService { |
25 | 42 | |
26 | 43 | @Override |
27 | 44 | public GetShopByIdResp getShopById(GetShopByIdReq req) { |
28 | - return null; | |
45 | + | |
46 | + ShopOutput shop = shopRPC.getShopByShopId(req.getId()); | |
47 | + if (Validator.isNull(shop)||Validator.isNull(shop.getId())){ | |
48 | + logger.error("查询买家绑定的店铺信息为空[buyerId=%s,shopId=%s]",req.getUserId(),req.getId()); | |
49 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.SHOP_NOT_EXIST); | |
50 | + } | |
51 | + GetShopByIdResp resp = new GetShopByIdResp(); | |
52 | + resp.setShopId(shop.getId()); | |
53 | + resp.setPhone(shop.getServiceTel()); | |
54 | + resp.setShopId(shop.getId()); | |
55 | + resp.setShopLogo(shop.getShopLogo()); | |
56 | + resp.setShopName(shop.getShopName()); | |
57 | + resp.setShopNotices(shop.getShopNotices()); | |
58 | + resp.setCityCode(shop.getAddressId()); | |
59 | + resp.setCityName(shop.getAddressText()); | |
60 | + resp.setShopAddr(shop.getAddressDetail()); | |
61 | + return resp; | |
29 | 62 | } |
30 | 63 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/UserService.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.user; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.login.*; |
4 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameReq; | |
5 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameResp; | |
6 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileReq; | |
7 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileResp; | |
8 | 4 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
9 | 5 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; |
10 | 6 | import com.diligrp.mobsite.getway.domain.protocol.user.*; |
... | ... | @@ -29,14 +25,6 @@ public interface UserService { |
29 | 25 | */ |
30 | 26 | LoginResp buyerlogin(LoginReq req); |
31 | 27 | |
32 | - /** | |
33 | - * 验证用户名是否合法 | |
34 | - * @param req | |
35 | - * @return | |
36 | - * @createTime 2014年8月26日 下午6:32:14 | |
37 | - * @author zhangshirui | |
38 | - */ | |
39 | - CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req); | |
40 | 28 | |
41 | 29 | /** |
42 | 30 | * 验证手机收到的验证码 |
... | ... | @@ -63,23 +51,6 @@ public interface UserService { |
63 | 51 | */ |
64 | 52 | UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); |
65 | 53 | |
66 | - /** | |
67 | - * | |
68 | - * @createTime 2014年8月28日 下午3:45:48 | |
69 | - * @author zhangshirui | |
70 | - * @param req | |
71 | - * @return | |
72 | - */ | |
73 | - CheckAccountNameResp checkAccountName(CheckAccountNameReq req); | |
74 | - | |
75 | - /** | |
76 | - * 验证手机号 | |
77 | - * @param req | |
78 | - * @return | |
79 | - * @createTime 2014年8月28日 下午4:03:59 | |
80 | - * @author zhangshirui | |
81 | - */ | |
82 | - CheckMobileResp checkMobile(CheckMobileReq req); | |
83 | 54 | |
84 | 55 | /** |
85 | 56 | *用户注册 |
... | ... | @@ -92,23 +63,6 @@ public interface UserService { |
92 | 63 | |
93 | 64 | GetUserInfoResp getUserIntroduction(GetUserInfoReq req); |
94 | 65 | |
95 | - UpdateMobileResp updateMobile(UpdateMobileReq req); | |
96 | - | |
97 | - SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req); | |
98 | - | |
99 | - SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req); | |
100 | - | |
101 | - GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req); | |
102 | - | |
103 | - GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req); | |
104 | - | |
105 | - DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req); | |
106 | - | |
107 | - DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req); | |
108 | - | |
109 | - GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req); | |
110 | - | |
111 | - GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req); | |
112 | 66 | |
113 | 67 | LogoutResp logout(LogoutReq req); |
114 | 68 | |
... | ... | @@ -121,37 +75,8 @@ public interface UserService { |
121 | 75 | */ |
122 | 76 | ModifyPwdResp modifyPwd(ModifyPwdReq req); |
123 | 77 | |
124 | - /** | |
125 | - * 查询用户认证信息 | |
126 | - * @param req | |
127 | - * @return | |
128 | - * @createTime 2015年7月9日 上午11:04:45 | |
129 | - * @author zhangshirui | |
130 | - */ | |
131 | - GetAuthInfoResp getAuthInfo(GetAuthInfoReq req); | |
132 | 78 | |
133 | 79 | /** |
134 | - * 删除收藏的信息 | |
135 | - * @param req | |
136 | - * @return | |
137 | - */ | |
138 | - DelFavoriteInfoResp delFavoriteInfo(DelFavoriteInfoReq req); | |
139 | - | |
140 | - /** | |
141 | - * 查询收藏的信息 | |
142 | - * @param req | |
143 | - * @return | |
144 | - */ | |
145 | - GetFavoriteInfoResp getFavoriteInfo(GetFavoriteInfoReq req); | |
146 | - | |
147 | - /** | |
148 | - * 添加收藏信息 | |
149 | - * @param req | |
150 | - * @return | |
151 | - */ | |
152 | - AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req); | |
153 | - | |
154 | - /** | |
155 | 80 | * 查询用户极光号 |
156 | 81 | * @param req |
157 | 82 | * @return |
... | ... | @@ -167,13 +92,11 @@ public interface UserService { |
167 | 92 | */ |
168 | 93 | GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req); |
169 | 94 | |
170 | - GetMemberListResp getMemberList(GetMemberListReq req); | |
171 | 95 | |
172 | - UpdateUserInfoResp completeUserInfo(CompleteUserInfoReq req); | |
173 | 96 | |
174 | 97 | GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req); |
175 | 98 | |
176 | - TradeRecordResp getTradeRecord(TradeRecordReq req); | |
99 | + | |
177 | 100 | |
178 | 101 | SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req); |
179 | 102 | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.user.impl; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSONObject; | |
4 | 3 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
5 | 4 | import com.diligrp.mobsite.getway.domain.RegisterNoMapper; |
6 | 5 | import com.diligrp.mobsite.getway.domain.common.Constant; |
... | ... | @@ -9,17 +8,16 @@ import com.diligrp.mobsite.getway.domain.common.RedisKey; |
9 | 8 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
10 | 9 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
11 | 10 | import com.diligrp.mobsite.getway.domain.protocol.login.*; |
12 | -import com.diligrp.mobsite.getway.domain.protocol.register.*; | |
11 | +import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; | |
12 | +import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; | |
13 | 13 | import com.diligrp.mobsite.getway.domain.protocol.user.*; |
14 | 14 | import com.diligrp.mobsite.getway.domain.protocol.user.model.RegisterNoPlatform; |
15 | 15 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; |
16 | -import com.diligrp.mobsite.getway.rpc.*; | |
17 | -import com.diligrp.mobsite.getway.rpc.utils.UserRedisUtil; | |
16 | +import com.diligrp.mobsite.getway.rpc.PassportRPC; | |
17 | +import com.diligrp.mobsite.getway.rpc.UserRPC; | |
18 | 18 | import com.diligrp.mobsite.getway.service.buyer.user.UserService; |
19 | -import com.diligrp.mobsite.getway.service.common.utils.PassportUtils; | |
20 | 19 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
21 | 20 | import com.diligrp.website.util.security.Validator; |
22 | -import com.diligrp.website.web.interfaces.domain.output.DataDictionaryResp; | |
23 | 21 | import org.slf4j.Logger; |
24 | 22 | import org.slf4j.LoggerFactory; |
25 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -46,24 +44,14 @@ public class UserServiceImpl implements UserService { |
46 | 44 | |
47 | 45 | @Resource |
48 | 46 | private UserRPC userRPC; |
49 | - @Resource | |
50 | - private GoodsRPC goodsRPC; | |
51 | 47 | @Autowired |
52 | 48 | private RedisUtilImpl redisUtil; |
53 | - @Autowired | |
54 | - private UserRedisUtil userRedisUtil; | |
55 | 49 | |
56 | 50 | @Resource |
57 | 51 | private RegisterNoMapperManager registerNoMapperManager; |
58 | 52 | @Resource |
59 | 53 | private PassportRPC passportRPC; |
60 | - @Resource | |
61 | - private ConfigRPC configRPC; | |
62 | 54 | |
63 | - @Resource | |
64 | - private ShopRPC shopRPC; | |
65 | - @Autowired | |
66 | - private MessageRPC messageRPC; | |
67 | 55 | |
68 | 56 | /** |
69 | 57 | * 登录超时时间:秒 |
... | ... | @@ -84,7 +72,7 @@ public class UserServiceImpl implements UserService { |
84 | 72 | logger.error("卖家登录激光推送id为空[userId=]",userInfo.getId()); |
85 | 73 | }else{ |
86 | 74 | //绑定用户激光推送id |
87 | - bindUserRegisterNo(userInfo.getId(),req); | |
75 | + bindUserRegisterNo(userInfo.getId(),req.getRegisterNo(),req.getDeviceType()); | |
88 | 76 | } |
89 | 77 | Long currentShopId = userInfo.getCurrentShopId(); |
90 | 78 | LoginResp resp = new LoginResp(); |
... | ... | @@ -100,7 +88,7 @@ public class UserServiceImpl implements UserService { |
100 | 88 | return resp; |
101 | 89 | } |
102 | 90 | |
103 | - private void bindUserRegisterNo(Long id, LoginReq req) { | |
91 | + private void bindUserRegisterNo(Long id,String registerNo,Integer deviceType) { | |
104 | 92 | // 缓存 |
105 | 93 | String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_BUYER+ |
106 | 94 | String.valueOf(id)); |
... | ... | @@ -109,11 +97,11 @@ public class UserServiceImpl implements UserService { |
109 | 97 | GetRegisterNoResp.class); |
110 | 98 | // 绑定极光ID |
111 | 99 | RegisterNoMapper mapper = new RegisterNoMapper(); |
112 | - mapper.setRegisterNo(req.getRegisterNo()); | |
100 | + mapper.setRegisterNo(registerNo); | |
113 | 101 | mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); |
114 | 102 | mapper.setUserid(id); |
115 | 103 | mapper.setUserType(Constant.USER_ROLE_BUYER); |
116 | - mapper.setDeviceType(req.getDeviceType()); | |
104 | + mapper.setDeviceType(deviceType); | |
117 | 105 | try { |
118 | 106 | //清除当前极光号userid缓存 |
119 | 107 | cleanOldredis(mapper); |
... | ... | @@ -187,78 +175,34 @@ public class UserServiceImpl implements UserService { |
187 | 175 | |
188 | 176 | |
189 | 177 | |
190 | - @Override | |
191 | - public CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req) { | |
192 | - return null; | |
193 | - } | |
194 | 178 | |
195 | 179 | @Override |
196 | 180 | public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { |
197 | - CheckVeriCodeResp resp = new CheckVeriCodeResp(); | |
198 | - | |
199 | - //checkVeriCode(req.getVeriCode(), req.getMobile(),req.getMsgType()); | |
181 | + passportRPC.verifyBuyerSmsCode(req.getMobile(),req.getVeriCode()); | |
200 | 182 | |
201 | - return resp; | |
183 | + return new CheckVeriCodeResp(); | |
202 | 184 | } |
203 | 185 | |
204 | 186 | @Override |
205 | 187 | public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { |
206 | - SendVeriCodeResp resp = new SendVeriCodeResp(); | |
207 | - | |
208 | 188 | String mobile = req.getMobile(); |
209 | - boolean existFlag = !userRPC.checkMobile(mobile); | |
210 | - | |
189 | + BuyerInfoOutput userinfo = userRPC.checkMobile(mobile); | |
211 | 190 | Integer msgType = req.getMsgType(); |
212 | - String code = null; | |
213 | - String message = null; | |
214 | - | |
215 | - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
216 | - String veriCode = redisUtil.getString(redisKey); | |
217 | - | |
218 | - if (Validator.isEmpty(veriCode)) { | |
219 | - //生成验证码 | |
220 | - veriCode = PassportUtils.generateMobileRandomNumber(); | |
221 | - redisUtil.setStringByExpire(redisKey, String.valueOf(veriCode), RedisKey.USER_SEND_VERICODE_EXPIRE_TIME); | |
222 | - } | |
223 | - | |
224 | - if (msgType==SendVeriCodeReq.MSG_TYPE_REGISTER) { | |
225 | - //注册,电话号码已经存在 | |
226 | - if(existFlag){ | |
227 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
228 | - } | |
229 | - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
230 | - resp.setPassKey(passkey); | |
231 | - | |
232 | - messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_ACCOUNT_REGISTRATION); | |
233 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
234 | - return resp; | |
235 | - }else if(msgType==SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) { | |
236 | - //找回密码,电话号码没有存在 | |
237 | - if (!existFlag) { | |
238 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST); | |
191 | + if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN||msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
192 | + if (Validator.isNull(userinfo)){ | |
193 | + if (Validator.isNull(userinfo)){ | |
194 | + throw new ServiceException(ErrorMessage.USER_MOBILE_NOT_EXIST); | |
239 | 195 | } |
240 | - messageRPC.sendSMSMsg(mobile, veriCode,Constant.SMS_CONTENT_RETRIEVE_PASSWORD); | |
241 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
242 | - return resp; | |
243 | - }else if(msgType==SendVeriCodeReq.MSG_TYPE_MODIFY_NEW_MOBILE) { | |
244 | - //修改手机号,电话号码已经存在 | |
245 | - if (existFlag) { | |
246 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST); | |
247 | - } | |
248 | - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
249 | - }else if (msgType==SendVeriCodeReq.MSG_TYPE_CHECK_OLD_MOBILE) { | |
250 | - //验证旧的手机号,手机不存在 | |
251 | - if (!existFlag) { | |
252 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST); | |
253 | - } | |
254 | - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
255 | 196 | } |
256 | - DataDictionaryResp dataDic = configRPC.getMessageTemplate(Constant.DIC_SMS_CONTENT); | |
257 | - message = dataDic.getValueByCode(code).getRemark().replace("{code}", veriCode); | |
258 | - | |
259 | - | |
197 | + } | |
198 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
199 | + if (!Validator.isNull(userinfo)){ | |
200 | + throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | |
201 | + } | |
202 | + } | |
203 | + passportRPC.sendVeriCodeOfBuyer(mobile,req.getMsgType()); | |
204 | + SendVeriCodeResp resp = new SendVeriCodeResp(); | |
260 | 205 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); |
261 | - | |
262 | 206 | return resp; |
263 | 207 | } |
264 | 208 | |
... | ... | @@ -267,134 +211,31 @@ public class UserServiceImpl implements UserService { |
267 | 211 | return null; |
268 | 212 | } |
269 | 213 | |
270 | - @Override | |
271 | - public CheckAccountNameResp checkAccountName(CheckAccountNameReq req) { | |
272 | - return null; | |
273 | - } | |
274 | 214 | |
275 | - @Override | |
276 | - public CheckMobileResp checkMobile(CheckMobileReq req) { | |
277 | - return null; | |
278 | - } | |
279 | 215 | |
280 | 216 | @Override |
281 | 217 | public UserRegisterResp userRegister(UserRegisterReq req) { |
282 | - UserRegisterResp resp = new UserRegisterResp(); | |
283 | - | |
284 | 218 | //手机号码和账号验证、验证码 |
285 | 219 | //if (!checkRegisterInfo(resp, req)) { |
286 | 220 | // return resp; |
287 | 221 | //} |
288 | - | |
289 | - resp = passportRPC.register(req); | |
290 | - | |
222 | + passportRPC.buyerRegister(req); | |
223 | + UserRegisterResp resp = new UserRegisterResp(); | |
224 | + resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
291 | 225 | return resp; |
292 | 226 | } |
293 | 227 | |
294 | 228 | |
295 | - /** | |
296 | - * 检测注册信息是否正确 | |
297 | - * 1.电话号码 | |
298 | - * 2.账号,会员名 | |
299 | - * 3.验证码 | |
300 | - * @createTime 2014年10月31日 下午2:37:16 | |
301 | - * @author zhangshirui | |
302 | - */ | |
303 | - private boolean checkRegisterInfo(UserRegisterResp resp, UserRegisterReq req){ | |
304 | - if(!userRPC.checkMobile(req.getMobile())){ | |
305 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST); | |
306 | - } | |
307 | - //验证万能验证码 | |
308 | - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
309 | - if (req.getVeriCode().equals(passkey)) { | |
310 | - return true; | |
311 | - } | |
312 | - | |
313 | - checkVeriCode(req.getVeriCode(), req.getMobile(),SendVeriCodeReq.MSG_TYPE_REGISTER); | |
314 | - | |
315 | - return true; | |
316 | - } | |
317 | - | |
318 | - /** | |
319 | - * 根据验证码和电话号码,验证收到的验证码 | |
320 | - * | |
321 | - * @param code | |
322 | - * @param mobile | |
323 | - * @return | |
324 | - * @createTime 2014年8月28日 下午5:44:48 | |
325 | - * @author zhangshirui | |
326 | - */ | |
327 | - private void checkVeriCode(String code, String mobile,Integer msgType) { | |
328 | - | |
329 | - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
330 | 229 | |
331 | - String redisCode = redisUtil.getString(redisKey); | |
332 | 230 | |
333 | - if(Validator.isEmpty(code)){ | |
334 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_EMPTY); | |
335 | - } | |
336 | 231 | |
337 | - //验证码为空 | |
338 | - if (Validator.isEmpty(redisCode)) { | |
339 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_OVERTIME); | |
340 | - } | |
341 | - | |
342 | - //验证码不为空,并且和redis中的验证码相同 | |
343 | - if (!code.equals(redisCode)) { | |
344 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_WRONG); | |
345 | - } | |
346 | - | |
347 | - } | |
348 | 232 | |
349 | 233 | @Override |
350 | 234 | public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { |
351 | 235 | return null; |
352 | 236 | } |
353 | 237 | |
354 | - @Override | |
355 | - public UpdateMobileResp updateMobile(UpdateMobileReq req) { | |
356 | - return null; | |
357 | - } | |
358 | 238 | |
359 | - @Override | |
360 | - public SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req) { | |
361 | - return null; | |
362 | - } | |
363 | - | |
364 | - @Override | |
365 | - public SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req) { | |
366 | - return null; | |
367 | - } | |
368 | - | |
369 | - @Override | |
370 | - public GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req) { | |
371 | - return null; | |
372 | - } | |
373 | - | |
374 | - @Override | |
375 | - public GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req) { | |
376 | - return null; | |
377 | - } | |
378 | - | |
379 | - @Override | |
380 | - public DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req) { | |
381 | - return null; | |
382 | - } | |
383 | - | |
384 | - @Override | |
385 | - public DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req) { | |
386 | - return null; | |
387 | - } | |
388 | - | |
389 | - @Override | |
390 | - public GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req) { | |
391 | - return null; | |
392 | - } | |
393 | - | |
394 | - @Override | |
395 | - public GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req) { | |
396 | - return null; | |
397 | - } | |
398 | 239 | |
399 | 240 | @Override |
400 | 241 | public LogoutResp logout(LogoutReq req) { |
... | ... | @@ -430,55 +271,22 @@ public class UserServiceImpl implements UserService { |
430 | 271 | public ModifyPwdResp modifyPwd(ModifyPwdReq req) { |
431 | 272 | BuyerInfoOutput userInfo = userRPC.getUserByMobile(req.getAccountName()); |
432 | 273 | Long userId = userInfo.getId(); |
433 | - | |
434 | - | |
435 | - Map<String,String> params = new HashMap<String, String>(); | |
436 | - params.put("password", req.getPassword()); | |
437 | - params.put("accountId", String.valueOf(userId)); | |
438 | - | |
439 | - | |
440 | - String result = passportRPC.modifyPwd(params); | |
441 | - | |
442 | - JSONObject jsonBody = JSONObject.parseObject(result); | |
443 | - int code = jsonBody.getIntValue("code"); | |
274 | + boolean result = passportRPC.modifyPwdBuyer(req); | |
444 | 275 | ModifyPwdResp resp = new ModifyPwdResp(); |
445 | - resp.setMsg(jsonBody.getString("msg")); | |
446 | - | |
447 | - if(code != ResultCode.SUCCESS){ | |
276 | + if(!result){ | |
448 | 277 | //失败 |
449 | 278 | resp.setCode(ResultCode.BUSINESS_FAILED); |
450 | 279 | resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); |
451 | 280 | return resp; |
452 | 281 | }else { |
453 | 282 | //修改成功,退出所有账号信息 |
454 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_BUYER+String.valueOf(userId)); | |
283 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(userId)); | |
455 | 284 | redisUtil.deleteByKey(cookieRedisKey); |
456 | 285 | } |
457 | - | |
458 | - logger.info("修改用户密码"+jsonBody.getString("msg")); | |
459 | - | |
460 | 286 | return resp; |
461 | 287 | } |
462 | 288 | |
463 | - @Override | |
464 | - public GetAuthInfoResp getAuthInfo(GetAuthInfoReq req) { | |
465 | - return null; | |
466 | - } | |
467 | - | |
468 | - @Override | |
469 | - public DelFavoriteInfoResp delFavoriteInfo(DelFavoriteInfoReq req) { | |
470 | - return null; | |
471 | - } | |
472 | - | |
473 | - @Override | |
474 | - public GetFavoriteInfoResp getFavoriteInfo(GetFavoriteInfoReq req) { | |
475 | - return null; | |
476 | - } | |
477 | 289 | |
478 | - @Override | |
479 | - public AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req) { | |
480 | - return null; | |
481 | - } | |
482 | 290 | |
483 | 291 | @Override |
484 | 292 | public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { |
... | ... | @@ -551,25 +359,13 @@ public class UserServiceImpl implements UserService { |
551 | 359 | return resp; |
552 | 360 | } |
553 | 361 | |
554 | - @Override | |
555 | - public GetMemberListResp getMemberList(GetMemberListReq req) { | |
556 | - return null; | |
557 | - } | |
558 | 362 | |
559 | - @Override | |
560 | - public UpdateUserInfoResp completeUserInfo(CompleteUserInfoReq req) { | |
561 | - return null; | |
562 | - } | |
563 | 363 | |
564 | 364 | @Override |
565 | 365 | public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) { |
566 | 366 | return null; |
567 | 367 | } |
568 | 368 | |
569 | - @Override | |
570 | - public TradeRecordResp getTradeRecord(TradeRecordReq req) { | |
571 | - return null; | |
572 | - } | |
573 | 369 | |
574 | 370 | @Override |
575 | 371 | public SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req) { |
... | ... | @@ -578,6 +374,27 @@ public class UserServiceImpl implements UserService { |
578 | 374 | |
579 | 375 | @Override |
580 | 376 | public LoginResp authlogin(AuthLoginReq req) { |
581 | - return null; | |
377 | + BuyerInfoOutput userInfo = passportRPC.authlogin(req); | |
378 | + | |
379 | + //缓存用户信息 | |
380 | + cacheUserInfo(userInfo.getId(),req.getDeviceId()); | |
381 | + if (Validator.isEmpty(req.getRegisterNo())){ | |
382 | + logger.error("卖家登录激光推送id为空[userId=]",userInfo.getId()); | |
383 | + }else{ | |
384 | + //绑定用户激光推送id | |
385 | + bindUserRegisterNo(userInfo.getId(),req.getRegisterNo(),req.getDeviceType()); | |
386 | + } | |
387 | + Long currentShopId = userInfo.getCurrentShopId(); | |
388 | + LoginResp resp = new LoginResp(); | |
389 | + if (Validator.isNull(currentShopId)){ | |
390 | + logger.info("用户未绑定店铺[buyerId=]",userInfo.getId()); | |
391 | + resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
392 | + } | |
393 | + resp.setBuyerId(userInfo.getId()); | |
394 | + resp.setHeadImg(userInfo.getFace()); | |
395 | + resp.setMobile(userInfo.getMobilePhone()); | |
396 | + resp.setAccountName(userInfo.getAccountName()); | |
397 | + resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
398 | + return resp; | |
582 | 399 | } |
583 | 400 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerUserService.java
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerUserServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.seller.impl; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSONObject; | |
4 | 3 | import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; |
5 | 4 | import com.b2c.myapp.common.api.shop.output.ShopOutput; |
6 | 5 | import com.diligrp.mobsite.getway.domain.RegisterNoMapper; |
... | ... | @@ -10,15 +9,16 @@ import com.diligrp.mobsite.getway.domain.common.RedisKey; |
10 | 9 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
11 | 10 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
12 | 11 | import com.diligrp.mobsite.getway.domain.protocol.login.*; |
13 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileReq; | |
14 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileResp; | |
15 | -import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; | |
16 | -import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp; | |
12 | +import com.diligrp.mobsite.getway.domain.protocol.register.*; | |
17 | 13 | import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginReq; |
18 | 14 | import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginResp; |
19 | -import com.diligrp.mobsite.getway.domain.protocol.user.*; | |
15 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoResp; | |
16 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
17 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdResp; | |
20 | 18 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; |
21 | -import com.diligrp.mobsite.getway.rpc.*; | |
19 | +import com.diligrp.mobsite.getway.rpc.PassportRPC; | |
20 | +import com.diligrp.mobsite.getway.rpc.SellerRPC; | |
21 | +import com.diligrp.mobsite.getway.rpc.ShopRPC; | |
22 | 22 | import com.diligrp.mobsite.getway.service.seller.SellerUserService; |
23 | 23 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
24 | 24 | import com.diligrp.website.util.security.Validator; |
... | ... | @@ -30,9 +30,7 @@ import org.springframework.stereotype.Service; |
30 | 30 | |
31 | 31 | import javax.annotation.Resource; |
32 | 32 | import java.util.ArrayList; |
33 | -import java.util.HashMap; | |
34 | 33 | import java.util.List; |
35 | -import java.util.Map; | |
36 | 34 | |
37 | 35 | |
38 | 36 | /** |
... | ... | @@ -48,8 +46,6 @@ public class SellerUserServiceImpl implements SellerUserService { |
48 | 46 | |
49 | 47 | @Resource |
50 | 48 | private SellerRPC sellerRPC; |
51 | - @Resource | |
52 | - private GoodsRPC goodsRPC; | |
53 | 49 | @Autowired |
54 | 50 | private RedisUtilImpl redisUtil; |
55 | 51 | |
... | ... | @@ -58,13 +54,9 @@ public class SellerUserServiceImpl implements SellerUserService { |
58 | 54 | private RegisterNoMapperManager registerNoMapperManager; |
59 | 55 | @Resource |
60 | 56 | private PassportRPC passportRPC; |
61 | - @Resource | |
62 | - private ConfigRPC configRPC; | |
63 | 57 | |
64 | 58 | @Resource |
65 | 59 | private ShopRPC shopRPC; |
66 | - @Autowired | |
67 | - private MessageRPC messageRPC; | |
68 | 60 | |
69 | 61 | /** |
70 | 62 | * 登录超时时间:秒 |
... | ... | @@ -184,21 +176,24 @@ public class SellerUserServiceImpl implements SellerUserService { |
184 | 176 | |
185 | 177 | @Override |
186 | 178 | public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { |
187 | - SendVeriCodeResp resp = new SendVeriCodeResp(); | |
188 | - | |
189 | 179 | String mobile = req.getMobile(); |
190 | - boolean existFlag = !sellerRPC.checkMobile(mobile); | |
180 | + SellerInfoOutput userinfo = sellerRPC.checkMobile(mobile); | |
191 | 181 | Integer msgType = req.getMsgType(); |
192 | - if (Validator.isNull(msgType)) { | |
193 | - | |
182 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
183 | + if (Validator.isNull(userinfo)){ | |
184 | + if (Validator.isNull(userinfo)){ | |
185 | + throw new ServiceException(ErrorMessage.USER_MOBILE_NOT_EXIST); | |
186 | + } | |
187 | + } | |
194 | 188 | } |
195 | - passportRPC.sendVeriCodeOfSeller(req.getMobile(),req.getMsgType()); | |
196 | - //验证旧的手机号,手机不存在 | |
197 | - //if (!existFlag) { | |
198 | - // throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST); | |
199 | - //} | |
189 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
190 | + if (!Validator.isNull(userinfo)){ | |
191 | + throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | |
192 | + } | |
193 | + } | |
194 | + passportRPC.sendVeriCodeOfSeller(mobile,req.getMsgType()); | |
195 | + SendVeriCodeResp resp = new SendVeriCodeResp(); | |
200 | 196 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); |
201 | - | |
202 | 197 | return resp; |
203 | 198 | } |
204 | 199 | |
... | ... | @@ -206,20 +201,20 @@ public class SellerUserServiceImpl implements SellerUserService { |
206 | 201 | |
207 | 202 | @Override |
208 | 203 | public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { |
209 | - CheckVeriCodeResp resp = null; | |
210 | - boolean ispass = passportRPC.verifySellerSmsCode(req.getMobile(),req.getVeriCode()); | |
204 | + passportRPC.verifySellerSmsCode(req.getMobile(),req.getVeriCode()); | |
211 | 205 | |
212 | - return null; | |
206 | + return new CheckVeriCodeResp(); | |
213 | 207 | } |
214 | 208 | |
215 | 209 | @Override |
216 | 210 | public CheckMobileResp checkMobile(CheckMobileReq req) { |
211 | + SellerInfoOutput userinfo = sellerRPC.checkMobile(req.getMobile()); | |
212 | + if (Validator.isNull(userinfo)){ | |
213 | + if (Validator.isNull(userinfo)){ | |
214 | + throw new ServiceException(ErrorMessage.USER_MOBILE_NOT_EXIST); | |
215 | + } | |
216 | + } | |
217 | 217 | CheckMobileResp resp = new CheckMobileResp(); |
218 | - | |
219 | - boolean flag = sellerRPC.checkMobile(req.getMobile()); | |
220 | - | |
221 | - resp.setCheckFlag(flag ? CheckMobileResp.CHECK_FLAG_OK : CheckMobileResp.CHECK_FLAG_ERROR); | |
222 | - | |
223 | 218 | return resp; |
224 | 219 | } |
225 | 220 | |
... | ... | @@ -227,21 +222,9 @@ public class SellerUserServiceImpl implements SellerUserService { |
227 | 222 | public ModifyPwdResp modifyPwd(ModifyPwdReq req) { |
228 | 223 | SellerInfoOutput userInfo = sellerRPC.getSellerByMobile(req.getAccountName()); |
229 | 224 | Long userId = userInfo.getId(); |
230 | - | |
231 | - | |
232 | - Map<String,String> params = new HashMap<String, String>(); | |
233 | - params.put("password", req.getPassword()); | |
234 | - params.put("phoneNumber", req.getAccountName()); | |
235 | - | |
236 | - | |
237 | - String result = passportRPC.modifyPwd(params); | |
238 | - | |
239 | - JSONObject jsonBody = JSONObject.parseObject(result); | |
240 | - int code = jsonBody.getIntValue("code"); | |
225 | + boolean result = passportRPC.modifyPwdSeller(req); | |
241 | 226 | ModifyPwdResp resp = new ModifyPwdResp(); |
242 | - resp.setMsg(jsonBody.getString("msg")); | |
243 | - | |
244 | - if(code != ResultCode.SUCCESS){ | |
227 | + if(!result){ | |
245 | 228 | //失败 |
246 | 229 | resp.setCode(ResultCode.BUSINESS_FAILED); |
247 | 230 | resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); |
... | ... | @@ -251,16 +234,16 @@ public class SellerUserServiceImpl implements SellerUserService { |
251 | 234 | String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(userId)); |
252 | 235 | redisUtil.deleteByKey(cookieRedisKey); |
253 | 236 | } |
254 | - | |
255 | - logger.info("修改用户密码"+jsonBody.getString("msg")); | |
256 | - | |
257 | 237 | return resp; |
258 | 238 | } |
259 | 239 | |
260 | 240 | @Override |
261 | 241 | public SellerRegisterResp sellerRegister(SellerRegisterReq req) { |
262 | - SellerRegisterResp resp = passportRPC.sellerRegister(req); | |
242 | + passportRPC.sellerRegister(req); | |
263 | 243 | |
244 | + //成功 | |
245 | + SellerRegisterResp resp = new SellerRegisterResp(); | |
246 | + resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
264 | 247 | return resp; |
265 | 248 | } |
266 | 249 | |
... | ... | @@ -296,41 +279,7 @@ public class SellerUserServiceImpl implements SellerUserService { |
296 | 279 | return resp; |
297 | 280 | } |
298 | 281 | |
299 | - @Override | |
300 | - public UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req) { | |
301 | - return null; | |
302 | - } | |
303 | - | |
304 | - @Override | |
305 | - public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { | |
306 | - return null; | |
307 | - } | |
308 | 282 | |
309 | 283 | |
310 | 284 | |
311 | - //public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | |
312 | - // GetRegisterNoResp resp = new GetRegisterNoResp(); | |
313 | - // if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserRole())) { | |
314 | - // resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | |
315 | - // resp.setMsg("用户ID和用户角色不能为空"); | |
316 | - // return resp; | |
317 | - // } | |
318 | - // //先从缓存取 | |
319 | - // String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, req.getUserRole()+String.valueOf(req.getUserId())); | |
320 | - // GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
321 | - // if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | |
322 | - // resp.setRegisterNos(recache.getRegisterNos()); | |
323 | - // }else { | |
324 | - // List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId()); | |
325 | - // if (!Validator.isEmpty(mapppers)) { | |
326 | - // | |
327 | - // resp.setRegisterNos(mapppers); | |
328 | - // redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | |
329 | - // }else { | |
330 | - // resp.setCode(ResultCode.BUSINESS_FAILED); | |
331 | - // resp.setMsg("该用户没有绑定极光号"); | |
332 | - // } | |
333 | - // } | |
334 | - // return resp; | |
335 | - //} | |
336 | 285 | } | ... | ... |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/user/UserController.java
... | ... | @@ -193,7 +193,7 @@ public class UserController extends BaseApiController { |
193 | 193 | * @createTime 2014年8月24日 下午10:55:03 |
194 | 194 | * @author weili |
195 | 195 | */ |
196 | - @ApiOperation(value = "找回密码-设置用户新密码", httpMethod = "POST" ,response = SendVeriCodeResp.class) | |
196 | + @ApiOperation(value = "找回密码-设置买家新密码", httpMethod = "POST" ,response = SendVeriCodeResp.class) | |
197 | 197 | @RequestMapping(value = "/modifyPwd",method = RequestMethod.POST) |
198 | 198 | @ResponseBody |
199 | 199 | public void modifyPwd(@RequestBody ModifyPwdReq temp){ | ... | ... |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/seller/user/SellerUserController.java
... | ... | @@ -95,7 +95,7 @@ public class SellerUserController extends BaseApiController { |
95 | 95 | |
96 | 96 | |
97 | 97 | /** |
98 | - * 验证手机号是否已经被注册 | |
98 | + * 找回密码:验证手机号是否已经被注册 | |
99 | 99 | * @createTime 2017年1月9日 下午3:41:02 |
100 | 100 | * @author weili |
101 | 101 | */ |
... | ... | @@ -106,11 +106,7 @@ public class SellerUserController extends BaseApiController { |
106 | 106 | CheckMobileReq req = super.getRequest(CheckMobileReq.class); |
107 | 107 | CheckMobileResp resp = null; |
108 | 108 | try { |
109 | - if(!Validator.isNull(req) && !Validator.isNull(req.getMobile())){ | |
110 | - resp = sellerUserService.checkMobile(req); | |
111 | - } else { | |
112 | - resp = new CheckMobileResp(); | |
113 | - } | |
109 | + resp = sellerUserService.checkMobile(req); | |
114 | 110 | super.sendSuccessResp(resp); |
115 | 111 | } catch (ServiceException e){ |
116 | 112 | log.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | ... | ... |