Commit b144e6937291f1686461cc5c003b4baf3f4b528a

Authored by jiangchengyong
2 parents 47a22cf4 e148564e

Merge remote-tracking branch 'origin/dev' into dev

mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/Token.java
... ... @@ -27,7 +27,7 @@ public class Token {
27 27 /**
28 28 * 终端与服务端协定的密文
29 29 */
30   - @ApiModelProperty("终端与服务端协定的密文")
  30 + @ApiModelProperty("终端与服务端协定的密文:__diligrp_mobsite_getway__")
31 31 private String secretkey;
32 32 /**
33 33 * 设备ID
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/CheckVeriCodeReq.java
... ... @@ -26,10 +26,7 @@ public class CheckVeriCodeReq extends BaseReq {
26 26 */
27 27 @ApiModelProperty(value = "手机号码",required = true)
28 28 private String mobile;
29   - /**
30   - * 消息类型
31   - */
32   - private Integer msgType = SendVeriCodeReq.MSG_TYPE_DEFAULT;
  29 +
33 30  
34 31 /**
35 32 * get value of CheckVeriCodeReq.veriCode
... ... @@ -73,12 +70,5 @@ public class CheckVeriCodeReq extends BaseReq {
73 70 this.mobile = mobile;
74 71 }
75 72  
76   - public Integer getMsgType() {
77   - return msgType;
78   - }
79   -
80   - public void setMsgType(Integer msgType) {
81   - this.msgType = msgType;
82   - }
83 73  
84 74 }
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeReq.java
... ... @@ -17,12 +17,13 @@ public class SendVeriCodeReq extends BaseReq {
17 17 /**
18 18 *
19 19 * 发送校验码类别
  20 + * 1.登录
20 21 * 2.注册
21 22 * 3.找回密码
22 23 * 4.修改新手机号
23 24 * 5.验证旧的手机号
24 25 */
25   - public static final int MSG_TYPE_DEFAULT = 1;
  26 + public static final int MSG_TYPE_LOGIN = 1;
26 27 public static final int MSG_TYPE_REGISTER = 2;
27 28 public static final int MSG_TYPE_RETRIEVE_PASSWORD = 3;
28 29 public static final int MSG_TYPE_MODIFY_NEW_MOBILE = 4;
... ... @@ -36,7 +37,7 @@ public class SendVeriCodeReq extends BaseReq {
36 37 /**
37 38 * 消息类型
38 39 */
39   - @ApiModelProperty(value = "消息类型:1保留,2注册,3找回密码,4修改新电话号码,5验证旧电话号码",required = true)
  40 + @ApiModelProperty(value = "消息类型:1登录,2注册,3找回密码,4修改新电话号码,5验证旧电话号码",required = true)
40 41 private Integer msgType;
41 42  
42 43  
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/PassportRPC.java
... ... @@ -31,4 +31,10 @@ public interface PassportRPC extends BaseService {
31 31 SellerRegisterResp sellerRegister(SellerRegisterReq req);
32 32  
33 33 LoginResp buyerLogin(LoginReq req);
  34 +
  35 + boolean sendVeriCodeOfSeller(String mobile,Integer msgType);
  36 +
  37 + boolean sendVeriCodeOfBuyer(String mobile,Integer msgType);
  38 +
  39 + boolean verifySellerSmsCode(String mobile, String veriCode);
34 40 }
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/base/impl/BaseServiceImpl.java
1 1 package com.diligrp.mobsite.getway.rpc.base.impl;
2 2  
3   -import org.slf4j.Logger;
4   -import org.slf4j.LoggerFactory;
5   -
6 3 import com.alibaba.fastjson.JSON;
7 4 import com.alibaba.fastjson.TypeReference;
8   -import com.diligrp.mobsite.getway.domain.common.ResultCode;
9 5 import com.diligrp.mobsite.getway.rpc.base.BaseOutput;
10 6 import com.diligrp.mobsite.getway.rpc.base.BaseService;
11 7 import com.github.kevinsawicki.http.HttpRequest;
  8 +import org.apache.commons.beanutils.PropertyUtilsBean;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +
  12 +import java.beans.PropertyDescriptor;
  13 +import java.util.HashMap;
  14 +import java.util.Map;
12 15  
13 16 /**
14 17 * base
... ... @@ -21,39 +24,42 @@ import com.github.kevinsawicki.http.HttpRequest;
21 24 @SuppressWarnings("unused")
22 25 private String token="";
23 26 private String baseUrl;
24   -
  27 +
25 28 public BaseServiceImpl(String token,String baseUrl){
26 29 this.token = token;
27 30 this.baseUrl = baseUrl;
28 31 LOGGER = LoggerFactory.getLogger(this.getClass());
29 32 }
30   - protected <T extends BaseOutput<?>> T httpGet(String url, Object paramObj, TypeReference<T> type,String sign){
31   - return execute(url, paramObj, type, "GET",sign);
  33 + protected <T extends BaseOutput<?>> T httpGet(String url, Object paramObj, TypeReference<T> type){
  34 + return execute(url, paramObj, type, "GET");
32 35 }
33   - protected <T extends BaseOutput<?>> T httpPost(String url, Object paramObj, TypeReference<T> type,String sign){
34   - return execute(url, paramObj, type, "POST",sign);
  36 + protected <T extends BaseOutput<?>> T httpPost(String url, Object paramObj, TypeReference<T> type){
  37 + return execute(url, paramObj, type, "POST");
35 38 }
36 39  
37 40 @SuppressWarnings({ "unchecked", "rawtypes" })
38   - private <T extends BaseOutput> T execute(String url, Object paramObj, TypeReference<T> type,String httpMethod,String sign){
  41 + private <T extends BaseOutput> T execute(String url, Object paramObj, TypeReference<T> type,String httpMethod){
39 42 T output= (T) new BaseOutput();
40 43 HttpRequest request = null;
41 44 if("POST".equalsIgnoreCase(httpMethod)){
42 45 request = HttpRequest.post(baseUrl + url);
  46 + request.connectTimeout(TIMEOUT);
  47 + request.readTimeout(TIMEOUT * 10000);
  48 + request.header("Content-Type", "application/json;charset=utf-8");
  49 + //request.header("sign", sign);
  50 + String data=JSON.toJSONString(paramObj);
  51 + request.send(data);
43 52 }else{
44   - request = HttpRequest.get(baseUrl + url);
  53 + request = HttpRequest.get(baseUrl + url,beanToMap(paramObj),Boolean.TRUE);
45 54 }
46   - request.connectTimeout(TIMEOUT);
47   - request.readTimeout(TIMEOUT * 10000);
48   - request.header("Content-Type", "application/json;charset=utf-8");
49   - request.header("sign", sign);
50   - String data=JSON.toJSONString(paramObj);
51   - request.send(data);
  55 +
52 56 int code = request.code();
53 57 if (code != 200) {
54   - output.setCode(ResultCode.BUSINESS_FAILED);
55   - output.setResult("http code:"+code +";"+request.message());
  58 + output.setCode(code);
  59 + output.setResult(request.message());
56 60 } else {
  61 + output.setCode(code);
  62 + output.setResult(request.message());
57 63 String result = request.body();
58 64 if (type != null) {
59 65 output = JSON.parseObject(result, type);
... ... @@ -63,5 +69,28 @@ import com.github.kevinsawicki.http.HttpRequest;
63 69 }
64 70 return output;
65 71 }
66   -
  72 +
  73 + //将javabean实体类转为map类型,然后返回一个map类型的值
  74 + public static Map<String, Object> beanToMap(Object obj) {
  75 + if(obj instanceof Map){
  76 + return (Map<String, Object>)obj;
  77 + }
  78 + Map<String, Object> params = new HashMap<String, Object>(0);
  79 + try {
  80 + PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
  81 + PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(obj);
  82 + for (int i = 0; i < descriptors.length; i++) {
  83 + String name = descriptors[i].getName();
  84 + if (!"class".equals(name)) {
  85 + Object value = propertyUtilsBean.getNestedProperty(obj, name);
  86 + if(null != value){
  87 + params.put(name, value);
  88 + }
  89 + }
  90 + }
  91 + } catch (Exception e) {
  92 + e.printStackTrace();
  93 + }
  94 + return params;
  95 + }
67 96 }
... ...
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.alibaba.fastjson.TypeReference;
4 5 import com.diligrp.mobsite.getway.domain.common.Constant;
5 6 import com.diligrp.mobsite.getway.domain.common.RedisKey;
6 7 import com.diligrp.mobsite.getway.domain.common.ResultCode;
7 8 import com.diligrp.mobsite.getway.domain.except.ServiceException;
8 9 import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq;
9 10 import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp;
  11 +import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeReq;
10 12 import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq;
11 13 import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp;
12 14 import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq;
... ... @@ -66,7 +68,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
66 68 params.put("src", "zadeapp");
67 69 BaseOutput<String> output = null;
68 70 try {
69   - output = super.httpPost("/api/login/login.html", params, null,passportSign);
  71 + output = super.httpPost("/api/login/login.html", params, null);
70 72 } catch (Exception e) {
71 73 log.error("调用passport用户验证接口失败",e);
72 74 throw new ServiceException();
... ... @@ -128,7 +130,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
128 130 // params.put("source", PASSPORT_REGIST_SOURCE_PNR);
129 131 BaseOutput<String> output = null;
130 132 try {
131   - output = super.httpPost("/api/register/buyerRegister.html", params,null, passportSign);
  133 + output = super.httpPost("/api/register/buyerRegister.html", params,null);
132 134  
133 135 } catch (Exception e) {
134 136 log.error("调用passport注册接口失败",e);
... ... @@ -156,7 +158,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
156 158  
157 159 BaseOutput<String> output = null;
158 160 try {
159   - output = super.httpPost("/api/account/initAccountPwd.html", params,null, passportSign);
  161 + output = super.httpPost("/api/forgot/updateSellerPasswordByPhoneNumber", params,null);
160 162  
161 163 } catch (Exception e) {
162 164 log.error("调用passport修改密码接口失败",e);
... ... @@ -170,31 +172,33 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
170 172 }
171 173  
172 174 @Override
173   - public SellerRegisterResp sellerRegister(SellerRegisterReq req) {
  175 + public SellerRegisterResp sellerRegister(SellerRegisterReq req) {
174 176 Map<String,String> params = new HashMap<String, String>();
175   - params.put("mobile", req.getMobile());
176   - params.put("password", req.getPassword());
177   - //BaseOutput<String> output = null;
178   - //try {
179   - // output = super.httpPost("/api/register/buyerRegister.html", params,null, passportSign);
180   - //
181   - //} catch (Exception e) {
182   - // log.error("调用passport注册接口失败",e);
183   - // throw new ServiceException();
184   - //}
185   - //
  177 + params.put("mobilePhone", req.getMobile());
  178 + params.put("accountPwd", req.getPassword());
  179 + params.put("validCode",req.getVeriCode());
  180 + params.put("appType",req.getAppType()+"");
  181 + BaseOutput<String> output = null;
  182 + try {
  183 + output = super.httpPost("/api/register/sellerRegister", params,null);
  184 +
  185 + } catch (Exception e) {
  186 + log.error("调用passport注册接口失败",e);
  187 + throw new ServiceException();
  188 + }
  189 +
186 190 SellerRegisterResp resp = new SellerRegisterResp();
187   - //JSONObject jsonBody = JSONObject.parseObject(output.getData());
188   - //int code = jsonBody.getIntValue("code");
189   - ////成功
190   - //if(code == ResultCode.SUCCESS){
191   - // resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS);
192   - //}else{
193   - // resp.setResultFlag(UserRegisterResp.RESULT_FLAG_FAILED);
194   - //}
195   - //resp.setMsg(jsonBody.getString("msg"));
196   - //
197   - //log.info("注册用户信息:msg={}"+jsonBody.getString("msg"));
  191 + JSONObject jsonBody = JSONObject.parseObject(output.getData());
  192 + int code = jsonBody.getIntValue("code");
  193 + //成功
  194 + if(code == ResultCode.SUCCESS){
  195 + resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS);
  196 + }else{
  197 + resp.setResultFlag(UserRegisterResp.RESULT_FLAG_FAILED);
  198 + }
  199 + resp.setMsg(jsonBody.getString("msg"));
  200 +
  201 + log.info("注册用户信息:msg={}"+jsonBody.getString("msg"));
198 202  
199 203 return resp;
200 204 }
... ... @@ -208,7 +212,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
208 212 params.put("src", "zadeapp");
209 213 BaseOutput<String> output = null;
210 214 try {
211   - output = super.httpPost("/api/login/login.html", params, null,passportSign);
  215 + output = super.httpPost("/api/login/login.html", params, null);
212 216 } catch (Exception e) {
213 217 log.error("调用passport用户验证接口失败",e);
214 218 throw new ServiceException();
... ... @@ -272,4 +276,78 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC {
272 276 return resp;
273 277 }
274 278  
  279 + @Override
  280 + public boolean sendVeriCodeOfSeller(String mobile,Integer msgType) {
  281 + BaseOutput<String> output = null;
  282 + TypeReference<BaseOutput<Integer>> type = new TypeReference<BaseOutput<Integer>>() {
  283 + };
  284 + try {
  285 + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){
  286 + output = super.httpGet("/api/register/sendSellerRegisterSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){} );
  287 + }
  288 + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){
  289 + output = super.httpGet("/api/forgot/sendSellerForgotPasswordSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){} );
  290 + }
  291 + } catch (Exception e) {
  292 + log.error("调用passport用户验证接口失败",e);
  293 + throw new ServiceException();
  294 + }
  295 +
  296 + if (output.getCode()!= 200){
  297 + log.error("调用passport用户验证接口失败[mobile=,msg=]",mobile,output.getResult());
  298 + throw new ServiceException(output.getCode(),output.getResult());
  299 + }
  300 +
  301 + return output.getCode().equals("200");
  302 + }
  303 +
  304 +
  305 + @Override
  306 + public boolean sendVeriCodeOfBuyer(String mobile,Integer msgType) {
  307 + BaseOutput<String> output = null;
  308 + try {
  309 + if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN){
  310 + output = super.httpGet("/api/login/sendSMS/"+mobile, null, null);
  311 + }
  312 + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){
  313 + output = super.httpGet("/api/register/sendBuyerRegisterSMS/"+mobile, null, null);
  314 + }
  315 + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){
  316 + output = super.httpGet("/api/forgot/sendBuyerForgotPasswordSMS/"+mobile, null, null);
  317 + }
  318 + } catch (Exception e) {
  319 + log.error("调用passport用户验证接口失败",e);
  320 + throw new ServiceException();
  321 + }
  322 +
  323 + if (output.getCode()!= 200){
  324 + log.error("调用passport用户验证接口失败[mobile=,msg=]",mobile,output.getResult());
  325 + throw new ServiceException(output.getCode(),output.getResult());
  326 + }
  327 +
  328 + return output.getCode().equals("200");
  329 + }
  330 +
  331 + @Override
  332 + public boolean verifySellerSmsCode(String mobile, String veriCode) {
  333 + BaseOutput<String> output = null;
  334 + Map<String,String> params = new HashMap<String, String>();
  335 + params.put("phoneNumber", mobile);
  336 + params.put("code", veriCode);
  337 + try {
  338 + output = super.httpPost("/api/forgot/verifySellerSmsCode", params, null);
  339 + } catch (Exception e) {
  340 + log.error("调用passport用户验证接口失败",e);
  341 + throw new ServiceException();
  342 + }
  343 +
  344 + if (output.getCode()!= 200){
  345 + log.error("调用passport用户验证接口失败[mobile=,msg=]",mobile,output.getResult());
  346 + throw new ServiceException(output.getCode(),output.getResult());
  347 + }
  348 +
  349 + return output.getCode().equals("200");
  350 + }
  351 +
  352 +
275 353 }
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/SellerRPCImpl.java
... ... @@ -60,16 +60,11 @@ public class SellerRPCImpl implements SellerRPC {
60 60 throw new ServiceException();
61 61 }
62 62  
63   - if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){
  63 + if (output==null||!output.getCode().equals("200")){
64 64 logger.error("手机号查询卖家接口失败:[userId={},code={},result={}]",new Object[]{mobile,output.getCode(),output.getResult()});
65 65 throw new ServiceException();
66 66 }
67 67 flag = !Validator.isNull(output.getData());
68   - if(flag){
69   - logger.info("success:电话号码没有被注册:mobile={}",mobile);
70   - }else {
71   - logger.info("error:电话号码已经被注册:mobile={}",mobile);
72   - }
73 68 return flag;
74 69 }
75 70  
... ... @@ -158,12 +153,12 @@ public class SellerRPCImpl implements SellerRPC {
158 153 try {
159 154 output = userClient.getSellerInfoService().getSellerInfoByMobilePhone(accountName);
160 155 } catch (Exception e) {
161   - logger.error("检测电话号码接口挂掉:msg={}",e.getMessage());
  156 + logger.error("调用手机号查询卖家接口挂掉:msg={}",e.getMessage());
162 157 throw new ServiceException();
163 158 }
164 159  
165 160 if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){
166   - logger.error("手机号查询家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()});
  161 + logger.error("手机号查询家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()});
167 162 throw new ServiceException();
168 163 }
169 164  
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/StationMsgRPCImpl.java
... ... @@ -49,7 +49,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
49 49 params.put("userId", req.getUserId().toString());
50 50 BaseOutput<String> output = null;
51 51 try {
52   - output = super.httpPost("/messages/readAllByGroup.do", params, null,null);
  52 + output = super.httpPost("/messages/readAllByGroup.do", params, null);
53 53 } catch (Exception e) {
54 54 log.error("调用标识站内信息接口失败",e);
55 55 throw new ServiceException();
... ... @@ -90,7 +90,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
90 90 params.put("groupCode",req.getGroupType());
91 91 BaseOutput<String> output = null;
92 92 try {
93   - output = super.httpPost("/messages.do", params, null,null);
  93 + output = super.httpPost("/messages.do", params, null);
94 94 } catch (Exception e) {
95 95 log.error("调用获取站内信列表接口失败",e);
96 96 throw new ServiceException();
... ... @@ -184,7 +184,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
184 184 params.put("userId", userid.toString());
185 185 BaseOutput<String> output = null;
186 186 try {
187   - output = super.httpPost("/messages/unRead.do", params, null,null);
  187 + output = super.httpPost("/messages/unRead.do", params, null);
188 188 } catch (Exception e) {
189 189 log.error("调用获取站内信未读信息接口失败",e);
190 190 throw new ServiceException();
... ... @@ -218,7 +218,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
218 218 params.put("userId", req.getUserId().toString());
219 219 BaseOutput<String> output = null;
220 220 try {
221   - output = super.httpPost("/groupedMessage.do", params, null,null);
  221 + output = super.httpPost("/groupedMessage.do", params, null);
222 222 } catch (Exception e) {
223 223 log.error("调用站内信首页分组接口失败",e);
224 224 throw new ServiceException("调用站内信首页分组失败");
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
... ... @@ -143,7 +143,7 @@ public class UserServiceImpl implements UserService {
143 143 public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) {
144 144 CheckVeriCodeResp resp = new CheckVeriCodeResp();
145 145  
146   - checkVeriCode(req.getVeriCode(), req.getMobile(),req.getMsgType());
  146 + //checkVeriCode(req.getVeriCode(), req.getMobile(),req.getMsgType());
147 147  
148 148 return resp;
149 149 }
... ... @@ -168,7 +168,6 @@ public class UserServiceImpl implements UserService {
168 168 redisUtil.setStringByExpire(redisKey, String.valueOf(veriCode), RedisKey.USER_SEND_VERICODE_EXPIRE_TIME);
169 169 }
170 170  
171   - if (!Validator.isNull(msgType) && msgType != SendVeriCodeReq.MSG_TYPE_DEFAULT) {
172 171 if (msgType==SendVeriCodeReq.MSG_TYPE_REGISTER) {
173 172 //注册,电话号码已经存在
174 173 if(existFlag){
... ... @@ -203,11 +202,7 @@ public class UserServiceImpl implements UserService {
203 202 }
204 203 DataDictionaryResp dataDic = configRPC.getMessageTemplate(Constant.DIC_SMS_CONTENT);
205 204 message = dataDic.getValueByCode(code).getRemark().replace("{code}", veriCode);
206   - }else {
207   - message = Constant.SMS_CONTENT_DEFAULT.replace("{code}", veriCode);
208   - }
209 205  
210   - messageRPC.sendSMS(mobile, message);
211 206  
212 207 resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS);
213 208  
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerUserService.java
... ... @@ -31,6 +31,9 @@ public interface SellerUserService {
31 31  
32 32 SendVeriCodeResp sendVeriCode(SendVeriCodeReq req);
33 33  
  34 +
  35 +
  36 +
34 37 CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req);
35 38  
36 39 CheckMobileResp checkMobile(CheckMobileReq req);
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerUserServiceImpl.java
... ... @@ -4,23 +4,23 @@ import com.alibaba.fastjson.JSONObject;
4 4 import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput;
5 5 import com.diligrp.mobsite.getway.domain.RegisterNoMapper;
6 6 import com.diligrp.mobsite.getway.domain.common.Constant;
7   -import com.diligrp.mobsite.getway.domain.common.ErrorMessage;
8 7 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.CheckMobileReq;
  12 +import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileResp;
  13 +import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq;
  14 +import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp;
13 15 import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginReq;
14 16 import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginResp;
15 17 import com.diligrp.mobsite.getway.domain.protocol.user.*;
16 18 import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager;
17 19 import com.diligrp.mobsite.getway.rpc.*;
18 20 import com.diligrp.mobsite.getway.rpc.utils.UserRedisUtil;
19   -import com.diligrp.mobsite.getway.service.common.utils.PassportUtils;
20 21 import com.diligrp.mobsite.getway.service.seller.SellerUserService;
21 22 import com.diligrp.website.util.redis.impl.RedisUtilImpl;
22 23 import com.diligrp.website.util.security.Validator;
23   -import com.diligrp.website.web.interfaces.domain.output.DataDictionaryResp;
24 24 import org.slf4j.Logger;
25 25 import org.slf4j.LoggerFactory;
26 26 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -139,68 +139,27 @@ public class SellerUserServiceImpl implements SellerUserService {
139 139  
140 140 String mobile = req.getMobile();
141 141 boolean existFlag = !sellerRPC.checkMobile(mobile);
142   -
143 142 Integer msgType = req.getMsgType();
144   - String code = null;
145   - String message = null;
146   -
147   - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile);
148   - String veriCode = redisUtil.getString(redisKey);
  143 + if (Validator.isNull(msgType)) {
149 144  
150   - if (Validator.isEmpty(veriCode)) {
151   - //生成验证码
152   - veriCode = PassportUtils.generateMobileRandomNumber();
153   - redisUtil.setStringByExpire(redisKey, String.valueOf(veriCode), RedisKey.USER_SEND_VERICODE_EXPIRE_TIME);
154 145 }
155   -
156   - if (!Validator.isNull(msgType) && msgType != SendVeriCodeReq.MSG_TYPE_DEFAULT) {
157   - if (msgType==SendVeriCodeReq.MSG_TYPE_REGISTER) {
158   - //注册,电话号码已经存在
159   - if(existFlag){
160   - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST);
161   - }
162   - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY);
163   - resp.setPassKey(passkey);
164   -
165   - messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_ACCOUNT_REGISTRATION);
166   - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS);
167   - return resp;
168   - }else if(msgType==SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) {
169   - //找回密码,电话号码没有存在
170   - if (!existFlag) {
171   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST);
172   - }
173   - messageRPC.sendSMSMsg(mobile, veriCode,Constant.SMS_CONTENT_RETRIEVE_PASSWORD);
174   - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS);
175   - return resp;
176   - }else if(msgType==SendVeriCodeReq.MSG_TYPE_MODIFY_NEW_MOBILE) {
177   - //修改手机号,电话号码已经存在
178   - if (existFlag) {
179   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST);
180   - }
181   - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE;
182   - }else if (msgType==SendVeriCodeReq.MSG_TYPE_CHECK_OLD_MOBILE) {
183   - //验证旧的手机号,手机不存在
184   - if (!existFlag) {
185   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST);
186   - }
187   - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE;
188   - }
189   - DataDictionaryResp dataDic = configRPC.getMessageTemplate(Constant.DIC_SMS_CONTENT);
190   - message = dataDic.getValueByCode(code).getRemark().replace("{code}", veriCode);
191   - }else {
192   - message = Constant.SMS_CONTENT_DEFAULT.replace("{code}", veriCode);
193   - }
194   -
195   - messageRPC.sendSMS(mobile, message);
196   -
  146 + passportRPC.sendVeriCodeOfSeller(req.getMobile(),req.getMsgType());
  147 + //验证旧的手机号,手机不存在
  148 + //if (!existFlag) {
  149 + // throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST);
  150 + //}
197 151 resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS);
198 152  
199 153 return resp;
200 154 }
201 155  
  156 +
  157 +
202 158 @Override
203 159 public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) {
  160 + CheckVeriCodeResp resp = null;
  161 + boolean ispass = passportRPC.verifySellerSmsCode(req.getMobile(),req.getVeriCode());
  162 +
204 163 return null;
205 164 }
206 165  
... ... @@ -223,7 +182,7 @@ public class SellerUserServiceImpl implements SellerUserService {
223 182  
224 183 Map<String,String> params = new HashMap<String, String>();
225 184 params.put("password", req.getPassword());
226   - params.put("accountId", String.valueOf(userId));
  185 + params.put("phoneNumber", req.getAccountName());
227 186  
228 187  
229 188 String result = passportRPC.modifyPwd(params);
... ... @@ -240,7 +199,7 @@ public class SellerUserServiceImpl implements SellerUserService {
240 199 return resp;
241 200 }else {
242 201 //修改成功,退出所有账号信息
243   - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SELLER+String.valueOf(userId));
  202 + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(userId));
244 203 redisUtil.deleteByKey(cookieRedisKey);
245 204 }
246 205  
... ... @@ -251,71 +210,11 @@ public class SellerUserServiceImpl implements SellerUserService {
251 210  
252 211 @Override
253 212 public SellerRegisterResp sellerRegister(SellerRegisterReq req) {
254   - SellerRegisterResp resp = new SellerRegisterResp();
255   -
256   - //手机号码和账号验证、验证码
257   - if (!checkRegisterInfo( req)) {
258   - return resp;
259   - }
260   -
261   - resp = passportRPC.sellerRegister(req);
  213 + SellerRegisterResp resp = passportRPC.sellerRegister(req);
262 214  
263 215 return resp;
264 216 }
265 217  
266   - /**
267   - * 检测注册信息是否正确
268   - * 1.电话号码
269   - * 2.账号,会员名
270   - * 3.验证码
271   - * @createTime 2014年10月31日 下午2:37:16
272   - * @author weili
273   - */
274   - private boolean checkRegisterInfo( SellerRegisterReq req){
275   - if(!sellerRPC.checkMobile(req.getMobile())){
276   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST);
277   - }
278   - //验证万能验证码
279   - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY);
280   - if (req.getVeriCode().equals(passkey)) {
281   - return true;
282   - }
283   -
284   - checkVeriCode(req.getVeriCode(), req.getMobile(),SendVeriCodeReq.MSG_TYPE_REGISTER);
285   -
286   - return true;
287   - }
288   -
289   - /**
290   - * 根据验证码和电话号码,验证收到的验证码
291   - *
292   - * @param code
293   - * @param mobile
294   - * @return
295   - * @createTime 2014年8月28日 下午5:44:48
296   - * @author weili
297   - */
298   - private void checkVeriCode(String code, String mobile,Integer msgType) {
299   -
300   - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile);
301   -
302   - String redisCode = redisUtil.getString(redisKey);
303   -
304   - if(Validator.isEmpty(code)){
305   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_EMPTY);
306   - }
307   -
308   - //验证码为空
309   - if (Validator.isEmpty(redisCode)) {
310   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_OVERTIME);
311   - }
312   -
313   - //验证码不为空,并且和redis中的验证码相同
314   - if (!code.equals(redisCode)) {
315   - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_WRONG);
316   - }
317   -
318   - }
319 218  
320 219  
321 220 @Override
... ...
mobsite-getway-web/pom.xml
... ... @@ -92,10 +92,13 @@
92 92 <project.sms.webchina.SMSKey>2cf3264488ee3beef224</project.sms.webchina.SMSKey>
93 93 <project.sms.webchina.userName>itly</project.sms.webchina.userName>
94 94 <project.sms.webchina.postURL>http://gbk.sms.webchinese.cn</project.sms.webchina.postURL>
95   -
96 95  
97 96  
98 97  
  98 + <website.websiteClient.baseUrl>http://manweb.zandeapp.com/</website.websiteClient.baseUrl>
  99 + <website.websiteClient.token>token</website.websiteClient.token>
  100 +
  101 +
99 102 <!-- interface stationmsg -->
100 103 <website.stationmsg.baseUrl>http://message.zandeapp.com/api</website.stationmsg.baseUrl>
101 104 <website.stationmsg.token>token</website.stationmsg.token>
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/seller/user/SellerUserController.java
... ... @@ -151,7 +151,7 @@ public class SellerUserController extends BaseApiController {
151 151 * @createTime 2014年8月24日 下午10:55:03
152 152 * @author weili
153 153 */
154   - @ApiOperation(value = "验证手机号和验证码", httpMethod = "POST" , notes = "验证手机收到的验证码",response = CheckVeriCodeResp.class)
  154 + @ApiOperation(value = "忘记密码:验证手机号和验证码", httpMethod = "POST" , notes = "验证手机收到的验证码",response = CheckVeriCodeResp.class)
155 155 @RequestMapping(value = "/checkAuthCode",method = RequestMethod.POST)
156 156 @ResponseBody
157 157 public void checkAuthCode(@RequestBody CheckVeriCodeReq temp){
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/filter/LoginTimeoutInterceptor.java
... ... @@ -49,9 +49,9 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter {
49 49 }
50 50  
51 51 //检测token信息
52   - if (!checkTokenInfo(body,request)) {
53   - return false;
54   - }
  52 + //if (!checkTokenInfo(body,request)) {
  53 + // return false;
  54 + //}
55 55  
56 56 return super.preHandle(request, response, handler);
57 57 }
... ...
mobsite-getway-web/src/main/resources/spring-rpc.xml
... ... @@ -23,8 +23,8 @@
23 23  
24 24  
25 25 <bean id="myAppClient" class="com.b2c.myapp.sdk.MyAppClient">
26   - <constructor-arg name="token" value="${website.user.token}"/>
27   - <constructor-arg name="baseUrl" value="${website.user.baseUrl}"/>
  26 + <constructor-arg name="token" value="token"/>
  27 + <constructor-arg name="baseUrl" value="${project.shop.url}"/>
28 28 </bean>
29 29  
30 30 <bean id="websiteClient" class="com.diligrp.website.web.interfaces.WebsiteClient">
... ...