Bläddra i källkod

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

release_toaliyun_real
Stormeye.Wu 7 år sedan
förälder
incheckning
675dd5ea79
4 ändrade filer med 25 tillägg och 13 borttagningar
  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 Visa fil

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


} }



@AuthIgnore @AuthIgnore
@ApiOperation("修改密码")
@ApiOperation(value = "修改密码", notes = "{\"appId\",\"string\", \"phone\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}")
@PostMapping("/updatepwd") @PostMapping("/updatepwd")
public ResultData updatepwd(@RequestBody Map<String,String> params) { public ResultData updatepwd(@RequestBody Map<String,String> params) {
// String phone,String code,String pwd // String phone,String code,String pwd
String appId = params.get("appId");
String phone=params.get("phone"); String phone=params.get("phone");
String code=params.get("code"); String code=params.get("code");
String pwd=params.get("pwd"); 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 Visa fil

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


/** /**
* 商场/商户 * 商场/商户


+ 1
- 1
mallinkService/src/main/java/com/simple/service/WxMerchantBUserService.java Visa fil

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


boolean hasphone(String phone); 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 Visa fil

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


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


@Autowired
WxAppinfoMapper wxAppinfoMapper;


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


@Override @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 wxMsgValidationcode = new WxMsgValidationcode();
wxMsgValidationcode.setPhone(phone); wxMsgValidationcode.setPhone(phone);
wxMsgValidationcode.setCode(code); wxMsgValidationcode.setCode(code);
@@ -105,6 +109,11 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser); List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser);
if(list.size()>0){ if(list.size()>0){
bUser = list.get(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); bUser.setBUserPwd(pwd);
try{ try{
wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser); wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser);


Laddar…
Avbryt
Spara