parent
b5e80c0fc1
commit
2a909f7b26
|
|
@ -12,6 +12,9 @@ import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,6 +42,8 @@ public class ControllerAspect {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
if (args[i] instanceof HttpServletRequest) {
|
if (args[i] instanceof HttpServletRequest) {
|
||||||
args[i] = null;
|
args[i] = null;
|
||||||
|
}else if (args[i] instanceof MultipartFile) {
|
||||||
|
args[i] = "上传图片";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,12 @@ import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
public record SysLoginDTO(
|
public record SysLoginDTO(
|
||||||
|
/*
|
||||||
|
商户账号
|
||||||
|
*/
|
||||||
@NotEmpty(message = "用户名不为空")
|
@NotEmpty(message = "用户名不为空")
|
||||||
String username, // 用户名
|
String username,
|
||||||
|
String staffUserName,
|
||||||
@NotEmpty(message = "密码不为空")
|
@NotEmpty(message = "密码不为空")
|
||||||
String password, // 密码
|
String password, // 密码
|
||||||
@NotEmpty(message = "验证码不为空")
|
@NotEmpty(message = "验证码不为空")
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class ShopStaffAddDTO {
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 登录账号
|
* 登录账号 账号前缀会加上店铺id@
|
||||||
*/
|
*/
|
||||||
@NotEmpty(message = "登录账号不为空")
|
@NotEmpty(message = "登录账号不为空")
|
||||||
private String accountName;
|
private String accountName;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.czg.account.entity.*;
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
import com.czg.account.vo.LoginVO;
|
import com.czg.account.vo.LoginVO;
|
||||||
import com.czg.config.RedisCst;
|
import com.czg.config.RedisCst;
|
||||||
|
import com.czg.enums.StatusEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
|
|
@ -65,7 +66,20 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
// throw new ApiNotPrintException("验证码错误");
|
// throw new ApiNotPrintException("验证码错误");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
SysUser user = sysUserService.queryChain().eq(SysUser::getAccount,loginDTO.username()).one();
|
SysUser user;
|
||||||
|
// 员工账号登录
|
||||||
|
if (StrUtil.isNotBlank(loginDTO.staffUserName())) {
|
||||||
|
// 查询主账号
|
||||||
|
SysUser sysUser = sysUserService.queryChain().eq(SysUser::getAccount, loginDTO.username()).one();
|
||||||
|
if (StatusEnum.DISABLE.value() == sysUser.getStauts()) {
|
||||||
|
throw new ApiNotPrintException("账户未启用");
|
||||||
|
}
|
||||||
|
|
||||||
|
user = sysUserService.queryChain().eq(SysUser::getAccount, sysUser.getId() + loginDTO.staffUserName()).one();
|
||||||
|
}else {
|
||||||
|
user = sysUserService.queryChain().eq(SysUser::getAccount,loginDTO.username()).one();
|
||||||
|
}
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new ApiNotPrintException("账户不存在");
|
throw new ApiNotPrintException("账户不存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(ShopStaffAddDTO shopStaffAddDTO) {
|
public Boolean add(ShopStaffAddDTO shopStaffAddDTO) {
|
||||||
SysUser sysUser = sysUserService.addUser(shopStaffAddDTO.getName(), shopStaffAddDTO.getAccountName(), shopStaffAddDTO.getAccountPwd(), shopStaffAddDTO.getPhone(), shopStaffAddDTO.getRoleId());
|
SysUser sysUser = sysUserService.addUser(shopStaffAddDTO.getName(), StpKit.USER.getLoginIdAsString() + "@" +shopStaffAddDTO.getAccountName(),
|
||||||
|
shopStaffAddDTO.getAccountPwd(), shopStaffAddDTO.getPhone(), shopStaffAddDTO.getRoleId());
|
||||||
ShopStaff shopStaff = BeanUtil.copyProperties(shopStaffAddDTO, ShopStaff.class);
|
ShopStaff shopStaff = BeanUtil.copyProperties(shopStaffAddDTO, ShopStaff.class);
|
||||||
shopStaff.setShopId(StpKit.USER.getLoginIdAsLong());
|
shopStaff.setShopId(StpKit.USER.getLoginIdAsLong());
|
||||||
shopStaff.setId(sysUser.getId());
|
shopStaff.setId(sysUser.getId());
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.czg.account.entity.SysRole;
|
||||||
import com.czg.account.entity.SysUser;
|
import com.czg.account.entity.SysUser;
|
||||||
import com.czg.account.entity.SysUsersRoles;
|
import com.czg.account.entity.SysUsersRoles;
|
||||||
import com.czg.account.service.SysUserService;
|
import com.czg.account.service.SysUserService;
|
||||||
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.account.mapper.SysRoleMapper;
|
import com.czg.service.account.mapper.SysRoleMapper;
|
||||||
|
|
@ -32,6 +33,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysUser addUser(String nickname, String accountName, String accountPwd, String phone, Long roleId) {
|
public SysUser addUser(String nickname, String accountName, String accountPwd, String phone, Long roleId) {
|
||||||
|
long count = queryChain().eq(SysUser::getAccount, accountName).count();
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ApiNotPrintException("账号已存在");
|
||||||
|
}
|
||||||
// 添加系统账号
|
// 添加系统账号
|
||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
sysUser.setAccount(accountName);
|
sysUser.setAccount(accountName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue