登录注册鉴权 优化
This commit is contained in:
parent
d1f68b679c
commit
4a5252a6d8
@ -128,13 +128,13 @@ public class AccountUserBaseController extends BaseControllerImpl {
|
|||||||
return accountUserBaseService.loadUserByUsername(user_account);
|
return accountUserBaseService.loadUserByUsername(user_account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "登录以后返回token") // app 和 pc 的 登录最好分开,这样容易区分从哪个端进来,方便处理逻辑(验证码)
|
@ApiOperation(value = "后台管理员和商家登录,登录后返回token") // app 和 pc 的 登录最好分开,这样容易区分从哪个端进来,方便处理逻辑(验证码)
|
||||||
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
|
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
|
||||||
public CommonResult doLogin(@RequestParam(name = "user_account", required = false) String user_account,
|
public CommonResult doLogin(@RequestParam(name = "user_account", required = false) String user_account,
|
||||||
@RequestParam(name = "user_password", required = false) String user_password,
|
@RequestParam(name = "user_password", required = false) String user_password,
|
||||||
@RequestParam(name = "verify_code") String verificationCode,
|
@RequestParam(name = "verify_code") String verificationCode,
|
||||||
@RequestParam(name = "verify_token") String verify_token) {
|
@RequestParam(name = "verify_token") String verify_token) {
|
||||||
if (StrUtil.isEmpty(user_account) || StrUtil.isEmpty(user_password)) {
|
if (StrUtil.isBlank(user_account) || StrUtil.isBlank(user_password)) {
|
||||||
return CommonResult.failed(I18nUtil._("用户名或密码不能为空!"));
|
return CommonResult.failed(I18nUtil._("用户名或密码不能为空!"));
|
||||||
}
|
}
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
|
|||||||
@ -2786,6 +2786,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号登陆操作
|
* 手机号登陆操作
|
||||||
|
* 使用到的:后台管理员或商家登录
|
||||||
*
|
*
|
||||||
* @param user_mobile
|
* @param user_mobile
|
||||||
* @return
|
* @return
|
||||||
@ -2805,7 +2806,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
params.put("client_id", AuthConstant.MOBILE_CLIENT_ID);
|
params.put("client_id", AuthConstant.MOBILE_CLIENT_ID);
|
||||||
params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET);
|
params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET);
|
||||||
params.put("grant_type", "password");
|
params.put("grant_type", "password");
|
||||||
params.put("verify_pwd", StrUtil.isEmpty(password) ? "1001" : "1002"); // 是否验证密码 1001:不验证;1002:验证(内部登录没有用户明文密码,只能不验证)
|
params.put("verify_pwd", StrUtil.isBlank(password) ? "1001" : "1002"); // 是否验证密码 1001:不验证;1002:验证(内部登录没有用户明文密码,只能不验证)
|
||||||
params.put("username", user_base_row.getUser_account());
|
params.put("username", user_base_row.getUser_account());
|
||||||
params.put("password", password);
|
params.put("password", password);
|
||||||
return login(params);
|
return login(params);
|
||||||
@ -2825,20 +2826,17 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
public CommonResult doMobileBindLogin(String user_mobile, boolean isMerch) {
|
public CommonResult doMobileBindLogin(String user_mobile, boolean isMerch) {
|
||||||
// 查询绑定手机的商家账号
|
// 查询绑定手机的商家账号
|
||||||
AccountUserBindConnect bind_row = accountUserBindConnectService.getBindByBindId(user_mobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
|
AccountUserBindConnect bind_row = accountUserBindConnectService.getBindByBindId(user_mobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
|
||||||
//bindConnectService.get(user_mobile);
|
AccountUserBase accountUserBase;
|
||||||
AccountUserBase accountUserBase = null;
|
|
||||||
if (bind_row != null) {
|
if (bind_row != null) {
|
||||||
// 已经注册账号的,绑定了手机的情况,
|
// 已经注册账号的,绑定了手机的情况,
|
||||||
Integer user_id = bind_row.getUser_id();
|
Integer user_id = bind_row.getUser_id();
|
||||||
accountUserBase = get(user_id);
|
accountUserBase = get(user_id);
|
||||||
if (accountUserBase == null) {
|
if (accountUserBase == null) {
|
||||||
// throw new ApiException(ResultCode.FAILED);
|
|
||||||
return CommonResult.failed("获取不到用户信息!");
|
return CommonResult.failed("获取不到用户信息!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.notEqual(CommonConstant.USER_TYPE_MCH, accountUserBase.getUser_is_admin())) {
|
if (ObjectUtil.notEqual(CommonConstant.USER_TYPE_MCH, accountUserBase.getUser_is_admin())) {
|
||||||
// 不是入驻商家的情况,已经有普通用户使用了手机号了,提示已经被注册。
|
// 不是入驻商家的情况,已经有普通用户使用了手机号了,提示已经被注册。
|
||||||
// throw new ApiException(_("已被注册,请换一个手机号码!"));
|
|
||||||
return CommonResult.failed("已被注册,请换一个手机号码!");
|
return CommonResult.failed("已被注册,请换一个手机号码!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2858,8 +2856,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
throw new ApiException(_("账号注册失败!"));
|
throw new ApiException(_("账号注册失败!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO 发送短信通知用户,告知用户随机密码:尊敬的商家用户,你们刚注册账号的账号密码为:" + user_password + ",请妥善保管,以免丢失。
|
|
||||||
// SMS_481085172 发送短信通知用户,告知用户随机密码:您已成功注册!密码:${password},该密码可用于登录商家APP,登录后请尽快修改密码。
|
// SMS_481085172 发送短信通知用户,告知用户随机密码:您已成功注册!密码:${password},该密码可用于登录商家APP,登录后请尽快修改密码。
|
||||||
Map<String, Object> smsArgs = new HashMap<>();
|
Map<String, Object> smsArgs = new HashMap<>();
|
||||||
smsArgs.put("password", user_password);
|
smsArgs.put("password", user_password);
|
||||||
|
|||||||
@ -158,6 +158,9 @@ public class ShopMerchEntry implements Serializable {
|
|||||||
@ApiModelProperty(value = "合同签署状态:0-无任何签署;1-一方签署;2-双方已签署;")
|
@ApiModelProperty(value = "合同签署状态:0-无任何签署;1-一方签署;2-双方已签署;")
|
||||||
private Integer signed_status;
|
private Integer signed_status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店铺创建状态:1-已启用(入驻已审批,合同已生成);2-未启用")
|
||||||
|
private Integer store_status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "该商家入驻记录是否有效,0:无效,1:有效")
|
@ApiModelProperty(value = "该商家入驻记录是否有效,0:无效,1:有效")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|||||||
@ -248,7 +248,6 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
|
|||||||
return new ResponseEntity<>(new JSONObject().put("code", 400).put("msg", "appId 有误").toString(), HttpStatus.INTERNAL_SERVER_ERROR);
|
return new ResponseEntity<>(new JSONObject().put("code", 400).put("msg", "appId 有误").toString(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//按照规则进行加密
|
//按照规则进行加密
|
||||||
String signData = timestamp + requestBody;
|
String signData = timestamp + requestBody;
|
||||||
String mySignature = getSignature(signData, appSecret, "HmacSHA256", "UTF-8");
|
String mySignature = getSignature(signData, appSecret, "HmacSHA256", "UTF-8");
|
||||||
@ -296,7 +295,10 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
|
|||||||
if (retPair.getFirst() > 0) {
|
if (retPair.getFirst() > 0) {
|
||||||
// 更改合同记录表的店铺id
|
// 更改合同记录表的店铺id
|
||||||
updateContractStoreId(esignContract.getMch_mobile(), retPair.getFirst());
|
updateContractStoreId(esignContract.getMch_mobile(), retPair.getFirst());
|
||||||
|
// 填充合同模版表的店铺Id
|
||||||
esignContractFillingFileService.updateContractFillingStoreId(esignContract.getMch_mobile(), retPair.getFirst());
|
esignContractFillingFileService.updateContractFillingStoreId(esignContract.getMch_mobile(), retPair.getFirst());
|
||||||
|
// 店铺创建状态已完成
|
||||||
|
shopMerchEntryService.updateMerchEntryStoreStatus(esignContract.getMch_mobile(), CommonConstant.Enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -118,5 +118,14 @@ public interface ShopMerchEntryService {
|
|||||||
*/
|
*/
|
||||||
Boolean updateMerchEntrySignedStatusAndContractDownloadUrl(String loginMobile, Integer signedStatus, String contractDownloadUrl);
|
Boolean updateMerchEntrySignedStatusAndContractDownloadUrl(String loginMobile, Integer signedStatus, String contractDownloadUrl);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改店铺创建状态
|
||||||
|
*
|
||||||
|
* @param loginMobile
|
||||||
|
* @param storeStatus 1-已创建;2-未创建;
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateMerchEntryStoreStatus(String loginMobile, Integer storeStatus);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -631,4 +631,22 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
|||||||
|
|
||||||
return update(updateWrapper);
|
return update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改店铺创建状态
|
||||||
|
*
|
||||||
|
* @param loginMobile
|
||||||
|
* @param storeStatus 1-已创建;2-未创建;
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateMerchEntryStoreStatus(String loginMobile, Integer storeStatus) {
|
||||||
|
if (StrUtil.isBlank(loginMobile) && ObjectUtil.isEmpty(storeStatus)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateWrapper<ShopMerchEntry> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("login_mobile", loginMobile).set("store_status", storeStatus);
|
||||||
|
return update(updateWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1598,6 +1598,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
Map userInfo = new HashMap();
|
Map userInfo = new HashMap();
|
||||||
userInfo.put("user_account", user_account);
|
userInfo.put("user_account", user_account);
|
||||||
userInfo.put("user_password", user_password);
|
userInfo.put("user_password", user_password);
|
||||||
|
userInfo.put("user_is_admin", CommonConstant.USER_TYPE_MCH); // 入驻商家
|
||||||
// 账号和密码,直接注册账号
|
// 账号和密码,直接注册账号
|
||||||
CommonResult result = accountService.register(userInfo);
|
CommonResult result = accountService.register(userInfo);
|
||||||
user_row = result.getFenResult(AccountUserBase.class);
|
user_row = result.getFenResult(AccountUserBase.class);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user