不同店铺之间员工账户可重复
This commit is contained in:
@@ -16,9 +16,12 @@
|
||||
package cn.ysk.cashier.config.security.rest;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.config.security.config.bean.LoginCodeEnum;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
@@ -75,6 +78,8 @@ public class AuthorizationController {
|
||||
private final AuthenticationManagerBuilder authenticationManagerBuilder;
|
||||
private final TbShopInfoRepository tbShopInfoRepository;
|
||||
private final TbPlussShopStaffRepository staffRepository;
|
||||
private final TbMerchantAccountRepository tbMerchantAccountRepository;
|
||||
|
||||
@Resource
|
||||
private LoginProperties loginProperties;
|
||||
|
||||
@@ -93,6 +98,21 @@ public class AuthorizationController {
|
||||
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
throw new BadRequestException("验证码错误");
|
||||
}
|
||||
|
||||
// 判断是否是员工登录
|
||||
if (authUser.getLoginType() != null && "staff".equals(authUser.getLoginType())) {
|
||||
if (StrUtil.isBlank(authUser.getMerchantName())) {
|
||||
throw new BadRequestException("商户名称不能为空");
|
||||
}
|
||||
|
||||
TbMerchantAccount merchant = tbMerchantAccountRepository.findByAccount(authUser.getMerchantName());
|
||||
if (merchant == null) {
|
||||
throw new BadRequestException("商户不存在");
|
||||
}
|
||||
|
||||
authUser.setUsername(merchant.getShopId() + "@" + authUser.getUsername());
|
||||
}
|
||||
|
||||
//生成token
|
||||
UsernamePasswordAuthenticationToken authenticationToken =
|
||||
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
|
||||
|
||||
@@ -33,6 +33,10 @@ public class AuthUserDto {
|
||||
@NotBlank
|
||||
private String password;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
private String loginType = "merchant";
|
||||
|
||||
private String code;
|
||||
|
||||
private String uuid = "";
|
||||
|
||||
@@ -116,6 +116,8 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
throw new BadRequestException("最大优惠金额过大");
|
||||
}
|
||||
|
||||
resources.setAccount(resources.getShopId() + "@" + resources.getAccount());
|
||||
|
||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||
|
||||
//添加收银系统后台账号
|
||||
|
||||
Reference in New Issue
Block a user