登录注册鉴权 优化

This commit is contained in:
Jack 2025-03-25 23:15:44 +08:00
parent d1f68b679c
commit 4a5252a6d8
7 changed files with 40 additions and 11 deletions

View File

@ -128,13 +128,13 @@ public class AccountUserBaseController extends BaseControllerImpl {
return accountUserBaseService.loadUserByUsername(user_account);
}
@ApiOperation(value = "登录以后返回token") // app pc 登录最好分开这样容易区分从哪个端进来方便处理逻辑验证码
@ApiOperation(value = "后台管理员和商家登录,登录后返回token") // app pc 登录最好分开这样容易区分从哪个端进来方便处理逻辑验证码
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
public CommonResult doLogin(@RequestParam(name = "user_account", required = false) String user_account,
@RequestParam(name = "user_password", required = false) String user_password,
@RequestParam(name = "verify_code") String verificationCode,
@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._("用户名或密码不能为空!"));
}
Map<String, String> params = new HashMap<>();

View File

@ -2786,6 +2786,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
/**
* 手机号登陆操作
* 使用到的后台管理员或商家登录
*
* @param user_mobile
* @return
@ -2805,7 +2806,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
params.put("client_id", AuthConstant.MOBILE_CLIENT_ID);
params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET);
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("password", password);
return login(params);
@ -2825,20 +2826,17 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
public CommonResult doMobileBindLogin(String user_mobile, boolean isMerch) {
// 查询绑定手机的商家账号
AccountUserBindConnect bind_row = accountUserBindConnectService.getBindByBindId(user_mobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
//bindConnectService.get(user_mobile);
AccountUserBase accountUserBase = null;
AccountUserBase accountUserBase;
if (bind_row != null) {
// 已经注册账号的绑定了手机的情况
Integer user_id = bind_row.getUser_id();
accountUserBase = get(user_id);
if (accountUserBase == null) {
// throw new ApiException(ResultCode.FAILED);
return CommonResult.failed("获取不到用户信息!");
}
if (ObjectUtil.notEqual(CommonConstant.USER_TYPE_MCH, accountUserBase.getUser_is_admin())) {
// 不是入驻商家的情况,已经有普通用户使用了手机号了提示已经被注册
// throw new ApiException(_("已被注册,请换一个手机号码!"));
return CommonResult.failed("已被注册,请换一个手机号码!");
}
} else {
@ -2857,9 +2855,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
if (accountUserBase == null) {
throw new ApiException(_("账号注册失败!"));
}
// TODO 发送短信通知用户告知用户随机密码尊敬的商家用户你们刚注册账号的账号密码为" + user_password + "请妥善保管以免丢失
// SMS_481085172 发送短信通知用户告知用户随机密码您已成功注册密码${password}该密码可用于登录商家APP登录后请尽快修改密码
Map<String, Object> smsArgs = new HashMap<>();
smsArgs.put("password", user_password);

View File

@ -158,6 +158,9 @@ public class ShopMerchEntry implements Serializable {
@ApiModelProperty(value = "合同签署状态0-无任何签署1-一方签署2-双方已签署;")
private Integer signed_status;
@ApiModelProperty(value = "店铺创建状态1-已启用入驻已审批合同已生成2-未启用")
private Integer store_status;
@ApiModelProperty(value = "该商家入驻记录是否有效0:无效1:有效")
private Integer status;

View File

@ -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);
}
//按照规则进行加密
String signData = timestamp + requestBody;
String mySignature = getSignature(signData, appSecret, "HmacSHA256", "UTF-8");
@ -296,7 +295,10 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
if (retPair.getFirst() > 0) {
// 更改合同记录表的店铺id
updateContractStoreId(esignContract.getMch_mobile(), retPair.getFirst());
// 填充合同模版表的店铺Id
esignContractFillingFileService.updateContractFillingStoreId(esignContract.getMch_mobile(), retPair.getFirst());
// 店铺创建状态已完成
shopMerchEntryService.updateMerchEntryStoreStatus(esignContract.getMch_mobile(), CommonConstant.Enable);
}
});

View File

@ -118,5 +118,14 @@ public interface ShopMerchEntryService {
*/
Boolean updateMerchEntrySignedStatusAndContractDownloadUrl(String loginMobile, Integer signedStatus, String contractDownloadUrl);
/**
* 更改店铺创建状态
*
* @param loginMobile
* @param storeStatus 1-已创建2-未创建
* @return
*/
Boolean updateMerchEntryStoreStatus(String loginMobile, Integer storeStatus);
}

View File

@ -631,4 +631,22 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
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);
}
}

View File

@ -1598,6 +1598,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
Map userInfo = new HashMap();
userInfo.put("user_account", user_account);
userInfo.put("user_password", user_password);
userInfo.put("user_is_admin", CommonConstant.USER_TYPE_MCH); // 入驻商家
// 账号和密码直接注册账号
CommonResult result = accountService.register(userInfo);
user_row = result.getFenResult(AccountUserBase.class);