Browse Source

[B端修改密码检查][新增]:检查是否同一个appId

release_toaliyun_real
Stormeye.Wu 7 years ago
parent
commit
675dd5ea79
4 changed files with 25 additions and 13 deletions
  1. +13
    -11
      mallinkBApi/src/main/java/com/simple/controller/WxMerchantBUserController.java
  2. +1
    -0
      mallinkService/src/main/java/com/simple/common/ErrorCode.java
  3. +1
    -1
      mallinkService/src/main/java/com/simple/service/WxMerchantBUserService.java
  4. +10
    -1
      mallinkService/src/main/java/com/simple/service/impl/WxMerchantBUserServiceImpl.java

+ 13
- 11
mallinkBApi/src/main/java/com/simple/controller/WxMerchantBUserController.java View File

@@ -165,28 +165,30 @@ public class WxMerchantBUserController extends BaseController

}


@AuthIgnore
@ApiOperation("修改密码")
@ApiOperation(value = "修改密码", notes = "{\"appId\",\"string\", \"phone\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}")
@PostMapping("/updatepwd")
public ResultData updatepwd(@RequestBody Map<String,String> params) {
// String phone,String code,String pwd
String appId = params.get("appId");
String phone=params.get("phone");
String code=params.get("code");
String pwd=params.get("pwd");
boolean blank = StringUtils.isBlank(phone);
if(blank){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"手机号不能为空");
if (StringUtils.isBlank(appId)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空");
}
blank = StringUtils.isBlank(code);
if(blank){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"验证码不能为空");
if (StringUtils.isBlank(phone)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空");
}
blank = StringUtils.isBlank(pwd);
if(blank){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"密码不能为空");
if (StringUtils.isBlank(code)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空");
}
if (StringUtils.isBlank(pwd)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空");
}

return wxMerchantBUserService.updatepwd(phone,code,pwd);
return wxMerchantBUserService.updatepwd(appId, phone, code, pwd);
}
}

+ 1
- 0
mallinkService/src/main/java/com/simple/common/ErrorCode.java View File

@@ -53,6 +53,7 @@ public enum ErrorCode{
LOGIN_USER_OR_PWD_ERROR(2002, "用户名或密码错误"),
USER_IS_LOCKED(2003, "用户已经被锁定不能登录,请与管理员联系"),
NEW_USER_FAILD(2004, "创建新用户失败"),
BUSER_NOT_IN_APP(2005, "用户不是此app用户"),

/**
* 商场/商户


+ 1
- 1
mallinkService/src/main/java/com/simple/service/WxMerchantBUserService.java View File

@@ -57,6 +57,6 @@ public interface WxMerchantBUserService {

boolean hasphone(String phone);

ResultData updatepwd(String phone, String code, String pwd);
ResultData updatepwd(String appId, String phone, String code, String pwd);

}

+ 10
- 1
mallinkService/src/main/java/com/simple/service/impl/WxMerchantBUserServiceImpl.java View File

@@ -7,9 +7,11 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.simple.common.ErrorCode;
import com.simple.common.ResultData;
import com.simple.domain.po.WxAppinfo;
import com.simple.domain.po.WxMerchantBUser;
import com.simple.domain.po.WxMsgValidationcode;
import com.simple.exception.MallinkException;
import com.simple.mapper.WxAppinfoMapper;
import com.simple.mapper.WxMerchantBUserMapper;
import com.simple.mapper.WxMsgValidationcodeMapper;
import com.simple.service.WxMerchantBUserService;
@@ -23,6 +25,8 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {

private Logger logger = Logger.getLogger(WxMerchantBUserServiceImpl.class);

@Autowired
WxAppinfoMapper wxAppinfoMapper;

@Autowired
WxMerchantBUserMapper wxMerchantBUserMapper;
@@ -90,7 +94,7 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
}

@Override
public ResultData updatepwd(String phone, String code, String pwd) {
public ResultData updatepwd(String appId, String phone, String code, String pwd) {
WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
wxMsgValidationcode.setPhone(phone);
wxMsgValidationcode.setCode(code);
@@ -105,6 +109,11 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser);
if(list.size()>0){
bUser = list.get(0);
if (bUser.getAppId().equalsIgnoreCase(appId))
{
logger.error("B端用户不是这个app的用户:" + appId);
throw new MallinkException(ErrorCode.BUSER_NOT_IN_APP);
}
bUser.setBUserPwd(pwd);
try{
wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser);


Loading…
Cancel
Save