mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-31 00:57:13 +08:00
style: 优化全局代码格式
This commit is contained in:
@@ -48,8 +48,7 @@ public class AccountLoginReq implements Serializable {
|
||||
/**
|
||||
* 密码(加密)
|
||||
*/
|
||||
@Schema(description = "密码(加密)",
|
||||
example = "HHwZoiBwCfh0xLdWOAd0bHOkEZlIMMOQKJyeFUw9T3ArrhL57od2i42s1o0sSXKkeHPJXvQsninhPFH2lArDDQ==")
|
||||
@Schema(description = "密码(加密)", example = "HHwZoiBwCfh0xLdWOAd0bHOkEZlIMMOQKJyeFUw9T3ArrhL57od2i42s1o0sSXKkeHPJXvQsninhPFH2lArDDQ==")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ public class LoginResp implements Serializable {
|
||||
/**
|
||||
* 令牌
|
||||
*/
|
||||
@Schema(description = "令牌",
|
||||
example = "eyJ0eXAiOiJlV1QiLCJhbGciqiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb29pbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiSjd4SUljYnU5cmNwU09vQ3Uyc1ND1BYYTYycFRjcjAifQ.KUPOYm-2wfuLUSfEEAbpGE527fzmkAJG7sMNcQ0pUZ8")
|
||||
@Schema(description = "令牌", example = "eyJ0eXAiOiJlV1QiLCJhbGciqiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb29pbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiSjd4SUljYnU5cmNwU09vQ3Uyc1ND1BYYTYycFRjcjAifQ.KUPOYm-2wfuLUSfEEAbpGE527fzmkAJG7sMNcQ0pUZ8")
|
||||
private String token;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,7 @@ public class OnlineUserResp implements Serializable {
|
||||
/**
|
||||
* 令牌
|
||||
*/
|
||||
@Schema(description = "令牌",
|
||||
example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE")
|
||||
@Schema(description = "令牌", example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE")
|
||||
private String token;
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,8 +84,7 @@ public class UserInfoResp implements Serializable {
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Schema(description = "头像地址",
|
||||
example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
@Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,10 +33,8 @@ public interface LoginService {
|
||||
/**
|
||||
* 账号登录
|
||||
*
|
||||
* @param username
|
||||
* 用户名
|
||||
* @param password
|
||||
* 密码
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 令牌
|
||||
*/
|
||||
String accountLogin(String username, String password);
|
||||
@@ -44,8 +42,7 @@ public interface LoginService {
|
||||
/**
|
||||
* 手机号登录
|
||||
*
|
||||
* @param phone
|
||||
* 手机号
|
||||
* @param phone 手机号
|
||||
* @return 令牌
|
||||
*/
|
||||
String phoneLogin(String phone);
|
||||
@@ -53,8 +50,7 @@ public interface LoginService {
|
||||
/**
|
||||
* 邮箱登录
|
||||
*
|
||||
* @param email
|
||||
* 邮箱
|
||||
* @param email 邮箱
|
||||
* @return 令牌
|
||||
*/
|
||||
String emailLogin(String email);
|
||||
@@ -62,8 +58,7 @@ public interface LoginService {
|
||||
/**
|
||||
* 三方账号登录
|
||||
*
|
||||
* @param authUser
|
||||
* 三方账号信息
|
||||
* @param authUser 三方账号信息
|
||||
* @return 令牌
|
||||
*/
|
||||
String socialLogin(AuthUser authUser);
|
||||
@@ -71,8 +66,7 @@ public interface LoginService {
|
||||
/**
|
||||
* 构建路由树
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 路由树
|
||||
*/
|
||||
List<RouteResp> buildRouteTree(Long userId);
|
||||
|
||||
@@ -35,10 +35,8 @@ public interface OnlineUserService {
|
||||
/**
|
||||
* 分页查询列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param pageQuery
|
||||
* 分页查询条件
|
||||
* @param query 查询条件
|
||||
* @param pageQuery 分页查询条件
|
||||
* @return 分页列表信息
|
||||
*/
|
||||
PageResp<OnlineUserResp> page(OnlineUserQuery query, PageQuery pageQuery);
|
||||
@@ -46,8 +44,7 @@ public interface OnlineUserService {
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param query 查询条件
|
||||
* @return 列表信息
|
||||
*/
|
||||
List<LoginUser> list(OnlineUserQuery query);
|
||||
@@ -55,8 +52,7 @@ public interface OnlineUserService {
|
||||
/**
|
||||
* 根据角色 ID 清除
|
||||
*
|
||||
* @param roleId
|
||||
* 角色 ID
|
||||
* @param roleId 角色 ID
|
||||
*/
|
||||
void cleanByRoleId(Long roleId);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ public interface PermissionService {
|
||||
/**
|
||||
* 根据用户 ID 查询权限码
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 权限码集合
|
||||
*/
|
||||
Set<String> listPermissionByUserId(Long userId);
|
||||
@@ -38,8 +37,7 @@ public interface PermissionService {
|
||||
/**
|
||||
* 根据用户 ID 查询角色编码
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 角色编码集合
|
||||
*/
|
||||
Set<String> listRoleCodeByUserId(Long userId);
|
||||
|
||||
@@ -162,8 +162,9 @@ public class LoginServiceImpl implements LoginService {
|
||||
} else {
|
||||
roleCodeSet.forEach(roleCode -> menuSet.addAll(menuService.listByRoleCode(roleCode)));
|
||||
}
|
||||
List<MenuResp> menuList =
|
||||
menuSet.stream().filter(m -> !MenuTypeEnum.BUTTON.equals(m.getType())).collect(Collectors.toList());
|
||||
List<MenuResp> menuList = menuSet.stream()
|
||||
.filter(m -> !MenuTypeEnum.BUTTON.equals(m.getType()))
|
||||
.collect(Collectors.toList());
|
||||
// 构建路由树
|
||||
TreeField treeField = MenuResp.class.getDeclaredAnnotation(TreeField.class);
|
||||
TreeNodeConfig treeNodeConfig = TreeUtils.genTreeNodeConfig(treeField);
|
||||
@@ -189,8 +190,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
/**
|
||||
* 登录并缓存用户信息
|
||||
*
|
||||
* @param user
|
||||
* 用户信息
|
||||
* @param user 用户信息
|
||||
* @return 令牌
|
||||
*/
|
||||
private String login(UserDO user) {
|
||||
@@ -205,8 +205,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
/**
|
||||
* 检查用户状态
|
||||
*
|
||||
* @param user
|
||||
* 用户信息
|
||||
* @param user 用户信息
|
||||
*/
|
||||
private void checkUserStatus(UserDO user) {
|
||||
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, user.getStatus(), "此账号已被禁用,如有疑问,请联系管理员");
|
||||
@@ -217,8 +216,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
/**
|
||||
* 发送系统消息
|
||||
*
|
||||
* @param user
|
||||
* 用户信息
|
||||
* @param user 用户信息
|
||||
*/
|
||||
private void sendSystemMsg(UserDO user) {
|
||||
MessageReq req = new MessageReq();
|
||||
|
||||
@@ -97,25 +97,23 @@ public class OnlineUserServiceImpl implements OnlineUserService {
|
||||
/**
|
||||
* 是否符合查询条件
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param loginUser
|
||||
* 登录用户信息
|
||||
* @param query 查询条件
|
||||
* @param loginUser 登录用户信息
|
||||
* @return 是否符合查询条件
|
||||
*/
|
||||
private boolean isMatchQuery(OnlineUserQuery query, LoginUser loginUser) {
|
||||
boolean flag1 = true;
|
||||
String nickname = query.getNickname();
|
||||
if (StrUtil.isNotBlank(nickname)) {
|
||||
flag1 = StrUtil.contains(loginUser.getUsername(), nickname)
|
||||
|| StrUtil.contains(LoginHelper.getNickname(loginUser.getId()), nickname);
|
||||
flag1 = StrUtil.contains(loginUser.getUsername(), nickname) || StrUtil.contains(LoginHelper
|
||||
.getNickname(loginUser.getId()), nickname);
|
||||
}
|
||||
|
||||
boolean flag2 = true;
|
||||
List<Date> loginTime = query.getLoginTime();
|
||||
if (CollUtil.isNotEmpty(loginTime)) {
|
||||
flag2 =
|
||||
DateUtil.isIn(DateUtil.date(loginUser.getLoginTime()).toJdkDate(), loginTime.get(0), loginTime.get(1));
|
||||
flag2 = DateUtil.isIn(DateUtil.date(loginUser.getLoginTime()).toJdkDate(), loginTime.get(0), loginTime
|
||||
.get(1));
|
||||
}
|
||||
return flag1 && flag2;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ public class FileRecorderImpl implements FileRecorder {
|
||||
FileDO file = new FileDO();
|
||||
String originalFilename = EscapeUtil.unescape(fileInfo.getOriginalFilename());
|
||||
file.setName(StrUtil.contains(originalFilename, StringConstants.DOT)
|
||||
? StrUtil.subBefore(originalFilename, StringConstants.DOT, true) : originalFilename);
|
||||
? StrUtil.subBefore(originalFilename, StringConstants.DOT, true)
|
||||
: originalFilename);
|
||||
file.setSize(fileInfo.getSize());
|
||||
file.setUrl(fileInfo.getUrl());
|
||||
file.setExtension(fileInfo.getExt());
|
||||
@@ -95,6 +96,8 @@ public class FileRecorderImpl implements FileRecorder {
|
||||
private FileDO getFileByUrl(String url) {
|
||||
Optional<FileDO> fileOptional = fileMapper.lambdaQuery().eq(FileDO::getUrl, url).oneOpt();
|
||||
return fileOptional.orElseGet(() -> fileMapper.lambdaQuery()
|
||||
.eq(FileDO::getUrl, StrUtil.subAfter(url, StringConstants.SLASH, true)).oneOpt().orElse(null));
|
||||
.eq(FileDO::getUrl, StrUtil.subAfter(url, StringConstants.SLASH, true))
|
||||
.oneOpt()
|
||||
.orElse(null));
|
||||
}
|
||||
}
|
||||
@@ -69,13 +69,13 @@ public enum FileTypeEnum implements IBaseEnum<Integer> {
|
||||
/**
|
||||
* 根据扩展名查询
|
||||
*
|
||||
* @param extension
|
||||
* 扩展名
|
||||
* @param extension 扩展名
|
||||
* @return 文件类型
|
||||
*/
|
||||
public static FileTypeEnum getByExtension(String extension) {
|
||||
return Arrays.stream(FileTypeEnum.values())
|
||||
.filter(t -> t.getExtensions().contains(StrUtil.emptyIfNull(extension).toLowerCase())).findFirst()
|
||||
.filter(t -> t.getExtensions().contains(StrUtil.emptyIfNull(extension).toLowerCase()))
|
||||
.findFirst()
|
||||
.orElse(FileTypeEnum.UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ public interface DictItemMapper extends BaseMapper<DictItemDO> {
|
||||
/**
|
||||
* 根据字典编码查询
|
||||
*
|
||||
* @param dictCode
|
||||
* 字典编码
|
||||
* @param dictCode 字典编码
|
||||
* @return 字典项列表
|
||||
*/
|
||||
List<LabelValueResp> listByDictCode(@Param("dictCode") String dictCode);
|
||||
|
||||
@@ -35,8 +35,7 @@ public interface MenuMapper extends BaseMapper<MenuDO> {
|
||||
/**
|
||||
* 根据用户 ID 查询权限码
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 权限码集合
|
||||
*/
|
||||
Set<String> selectPermissionByUserId(@Param("userId") Long userId);
|
||||
@@ -44,8 +43,7 @@ public interface MenuMapper extends BaseMapper<MenuDO> {
|
||||
/**
|
||||
* 根据角色编码查询
|
||||
*
|
||||
* @param roleCode
|
||||
* 角色编码
|
||||
* @param roleCode 角色编码
|
||||
* @return 菜单列表
|
||||
*/
|
||||
List<MenuDO> selectListByRoleCode(@Param("roleCode") String roleCode);
|
||||
|
||||
@@ -37,12 +37,10 @@ public interface MessageMapper extends BaseMapper<MessageDO> {
|
||||
/**
|
||||
* 分页查询列表
|
||||
*
|
||||
* @param page
|
||||
* 分页查询条件
|
||||
* @param queryWrapper
|
||||
* 查询条件
|
||||
* @param page 分页查询条件
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 分页信息
|
||||
*/
|
||||
IPage<MessageResp> selectPageByUserId(@Param("page") IPage<Object> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<MessageDO> queryWrapper);
|
||||
@Param(Constants.WRAPPER) QueryWrapper<MessageDO> queryWrapper);
|
||||
}
|
||||
@@ -32,10 +32,8 @@ public interface MessageUserMapper extends BaseMapper<MessageUserDO> {
|
||||
/**
|
||||
* 根据用户 ID 和消息类型查询未读消息数量
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param type
|
||||
* 消息类型
|
||||
* @param userId 用户 ID
|
||||
* @param type 消息类型
|
||||
* @return 未读消息信息
|
||||
*/
|
||||
Long selectUnreadCountByUserIdAndType(@Param("userId") Long userId, @Param("type") Integer type);
|
||||
|
||||
@@ -35,8 +35,7 @@ public interface RoleDeptMapper extends BaseMapper<RoleDeptDO> {
|
||||
/**
|
||||
* 根据角色 ID 查询
|
||||
*
|
||||
* @param roleId
|
||||
* 角色 ID
|
||||
* @param roleId 角色 ID
|
||||
* @return 部门 ID 列表
|
||||
*/
|
||||
@Select("SELECT `dept_id` FROM `sys_role_dept` WHERE `role_id` = #{roleId}")
|
||||
|
||||
@@ -32,8 +32,7 @@ public interface RoleMenuMapper extends BaseMapper<RoleMenuDO> {
|
||||
/**
|
||||
* 根据角色 ID 列表查询
|
||||
*
|
||||
* @param roleIds
|
||||
* 角色 ID 列表
|
||||
* @param roleIds 角色 ID 列表
|
||||
* @return 菜单 ID 列表
|
||||
*/
|
||||
List<Long> selectMenuIdByRoleIds(List<Long> roleIds);
|
||||
|
||||
@@ -33,8 +33,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> {
|
||||
/**
|
||||
* 根据用户名查询
|
||||
*
|
||||
* @param username
|
||||
* 用户名
|
||||
* @param username 用户名
|
||||
* @return 用户信息
|
||||
*/
|
||||
@Select("SELECT * FROM `sys_user` WHERE `username` = #{username}")
|
||||
@@ -43,8 +42,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> {
|
||||
/**
|
||||
* 根据手机号查询
|
||||
*
|
||||
* @param phone
|
||||
* 手机号
|
||||
* @param phone 手机号
|
||||
* @return 用户信息
|
||||
*/
|
||||
@Select("SELECT * FROM `sys_user` WHERE `phone` = #{phone}")
|
||||
@@ -53,8 +51,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> {
|
||||
/**
|
||||
* 根据邮箱查询
|
||||
*
|
||||
* @param email
|
||||
* 邮箱
|
||||
* @param email 邮箱
|
||||
* @return 用户信息
|
||||
*/
|
||||
@Select("SELECT * FROM `sys_user` WHERE `email` = #{email}")
|
||||
@@ -63,8 +60,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> {
|
||||
/**
|
||||
* 根据 ID 查询昵称
|
||||
*
|
||||
* @param id
|
||||
* ID
|
||||
* @param id ID
|
||||
* @return 昵称
|
||||
*/
|
||||
@Select("SELECT `nickname` FROM `sys_user` WHERE `id` = #{id}")
|
||||
|
||||
@@ -35,8 +35,7 @@ public interface UserRoleMapper extends BaseMapper<UserRoleDO> {
|
||||
/**
|
||||
* 根据用户 ID 查询
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 角色 ID 列表
|
||||
*/
|
||||
@Select("SELECT `role_id` FROM `sys_user_role` WHERE `user_id` = #{userId}")
|
||||
|
||||
@@ -32,10 +32,8 @@ public interface UserSocialMapper extends BaseMapper<UserSocialDO> {
|
||||
/**
|
||||
* 根据来源和开放 ID 查询
|
||||
*
|
||||
* @param source
|
||||
* 来源
|
||||
* @param openId
|
||||
* 开放 ID
|
||||
* @param source 来源
|
||||
* @param openId 开放 ID
|
||||
* @return 用户社会化关联信息
|
||||
*/
|
||||
UserSocialDO selectBySourceAndOpenId(@Param("source") String source, @Param("openId") String openId);
|
||||
|
||||
@@ -80,21 +80,22 @@ public class FileDO extends BaseDO {
|
||||
/**
|
||||
* 转换为 X-File-Storage 文件信息对象
|
||||
*
|
||||
* @param storageCode
|
||||
* 存储库编码
|
||||
* @param storageCode 存储库编码
|
||||
* @return X-File-Storage 文件信息对象
|
||||
*/
|
||||
public FileInfo toFileInfo(String storageCode) {
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
fileInfo.setOriginalFilename(
|
||||
StrUtil.isNotBlank(this.extension) ? this.name + StringConstants.DOT + this.extension : this.name);
|
||||
fileInfo.setOriginalFilename(StrUtil.isNotBlank(this.extension)
|
||||
? this.name + StringConstants.DOT + this.extension
|
||||
: this.name);
|
||||
fileInfo.setSize(this.size);
|
||||
fileInfo.setUrl(this.url);
|
||||
fileInfo.setExt(this.extension);
|
||||
fileInfo.setBasePath(StringConstants.EMPTY);
|
||||
fileInfo.setPath(StringConstants.EMPTY);
|
||||
fileInfo.setFilename(
|
||||
URLUtils.isHttpUrl(this.url) ? StrUtil.subAfter(this.url, StringConstants.SLASH, true) : this.url);
|
||||
fileInfo.setFilename(URLUtils.isHttpUrl(this.url)
|
||||
? StrUtil.subAfter(this.url, StringConstants.SLASH, true)
|
||||
: this.url);
|
||||
fileInfo.setPlatform(storageCode);
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ public class RoleReq extends BaseReq {
|
||||
/**
|
||||
* 数据权限
|
||||
*/
|
||||
@Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer",
|
||||
allowableValues = {"1", "2", "3", "4", "5"}, example = "5")
|
||||
@Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", allowableValues = {
|
||||
"1", "2", "3", "4", "5"}, example = "5")
|
||||
private DataScopeEnum dataScope;
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,8 +62,7 @@ public class UserEmailUpdateRequest implements Serializable {
|
||||
/**
|
||||
* 当前密码(加密后)
|
||||
*/
|
||||
@Schema(description = "当前密码(加密后)",
|
||||
example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==")
|
||||
@Schema(description = "当前密码(加密后)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==")
|
||||
@NotBlank(message = "当前密码不能为空")
|
||||
private String currentPassword;
|
||||
}
|
||||
|
||||
@@ -41,15 +41,13 @@ public class UserPasswordUpdateReq implements Serializable {
|
||||
/**
|
||||
* 当前密码(加密后)
|
||||
*/
|
||||
@Schema(description = "当前密码(加密后)",
|
||||
example = "E7c72TH+LDxKTwavjM99W1MdI9Lljh79aPKiv3XB9MXcplhm7qJ1BJCj28yaflbdVbfc366klMtjLIWQGqb0qw==")
|
||||
@Schema(description = "当前密码(加密后)", example = "E7c72TH+LDxKTwavjM99W1MdI9Lljh79aPKiv3XB9MXcplhm7qJ1BJCj28yaflbdVbfc366klMtjLIWQGqb0qw==")
|
||||
private String oldPassword;
|
||||
|
||||
/**
|
||||
* 新密码(加密后)
|
||||
*/
|
||||
@Schema(description = "新密码(加密后)",
|
||||
example = "Gzc78825P5baH190lRuZFb9KJxRt/psN2jiyOMPoc5WRcCvneCwqDm3Q33BZY56EzyyVy7vQu7jQwYTK4j1+5w==")
|
||||
@Schema(description = "新密码(加密后)", example = "Gzc78825P5baH190lRuZFb9KJxRt/psN2jiyOMPoc5WRcCvneCwqDm3Q33BZY56EzyyVy7vQu7jQwYTK4j1+5w==")
|
||||
@NotBlank(message = "新密码不能为空")
|
||||
private String newPassword;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,7 @@ public class UserPhoneUpdateReq implements Serializable {
|
||||
/**
|
||||
* 当前密码(加密后)
|
||||
*/
|
||||
@Schema(description = "当前密码(加密后)",
|
||||
example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==")
|
||||
@Schema(description = "当前密码(加密后)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==")
|
||||
@NotBlank(message = "当前密码不能为空")
|
||||
private String currentPassword;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ public class AvatarResp implements Serializable {
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Schema(description = "头像地址",
|
||||
example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
@Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
private String avatar;
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ public class FileResp extends BaseDetailResp {
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Schema(description = "类型(1:其他;2:图片;3:文档;4:视频;5:音频)", type = "Integer", allowableValues = {"1", "2", "3", "4", "5"},
|
||||
example = "2")
|
||||
@Schema(description = "类型(1:其他;2:图片;3:文档;4:视频;5:音频)", type = "Integer", allowableValues = {"1", "2", "3", "4",
|
||||
"5"}, example = "2")
|
||||
private FileTypeEnum type;
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,8 +62,8 @@ public class RoleDetailResp extends BaseDetailResp {
|
||||
/**
|
||||
* 数据权限
|
||||
*/
|
||||
@Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer",
|
||||
allowableValues = {"1", "2", "3", "4", "5"}, example = "5")
|
||||
@Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", allowableValues = {
|
||||
"1", "2", "3", "4", "5"}, example = "5")
|
||||
@ExcelProperty(value = "数据权限", converter = ExcelBaseEnumConverter.class)
|
||||
private DataScopeEnum dataScope;
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ public class RoleResp extends BaseResp {
|
||||
/**
|
||||
* 数据权限
|
||||
*/
|
||||
@Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer",
|
||||
allowableValues = {"1", "2", "3", "4", "5"}, example = "5")
|
||||
@Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", allowableValues = {
|
||||
"1", "2", "3", "4", "5"}, example = "5")
|
||||
private DataScopeEnum dataScope;
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,8 +86,7 @@ public class UserDetailResp extends BaseDetailResp {
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Schema(description = "头像地址",
|
||||
example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
@Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
@ExcelProperty(value = "头像地址")
|
||||
private String avatar;
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@ public class UserResp extends BaseResp {
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Schema(description = "头像地址",
|
||||
example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
@Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,8 +31,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseService;
|
||||
* @author Charles7c
|
||||
* @since 2023/8/20 10:55
|
||||
*/
|
||||
public interface AnnouncementService
|
||||
extends BaseService<AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> {
|
||||
public interface AnnouncementService extends BaseService<AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> {
|
||||
|
||||
/**
|
||||
* 查询仪表盘公告列表
|
||||
|
||||
@@ -36,8 +36,7 @@ public interface DictItemService extends BaseService<DictItemResp, DictItemDetai
|
||||
/**
|
||||
* 根据字典 ID 查询
|
||||
*
|
||||
* @param dictId
|
||||
* 字典 ID
|
||||
* @param dictId 字典 ID
|
||||
* @return 字典项列表
|
||||
*/
|
||||
List<DictItemDetailResp> listByDictId(Long dictId);
|
||||
@@ -45,8 +44,7 @@ public interface DictItemService extends BaseService<DictItemResp, DictItemDetai
|
||||
/**
|
||||
* 根据字典编码查询
|
||||
*
|
||||
* @param dictCode
|
||||
* 字典编码
|
||||
* @param dictCode 字典编码
|
||||
* @return 字典项列表
|
||||
*/
|
||||
List<LabelValueResp> listByDictCode(String dictCode);
|
||||
@@ -54,8 +52,7 @@ public interface DictItemService extends BaseService<DictItemResp, DictItemDetai
|
||||
/**
|
||||
* 根据字典 ID 列表删除
|
||||
*
|
||||
* @param dictIds
|
||||
* 字典 ID 列表
|
||||
* @param dictIds 字典 ID 列表
|
||||
*/
|
||||
void deleteByDictIds(List<Long> dictIds);
|
||||
}
|
||||
@@ -37,8 +37,7 @@ public interface FileService extends BaseService<FileResp, FileResp, FileQuery,
|
||||
/**
|
||||
* 上传到默认存储库
|
||||
*
|
||||
* @param file
|
||||
* 文件信息
|
||||
* @param file 文件信息
|
||||
* @return 文件信息
|
||||
*/
|
||||
default FileInfo upload(MultipartFile file) {
|
||||
@@ -48,10 +47,8 @@ public interface FileService extends BaseService<FileResp, FileResp, FileQuery,
|
||||
/**
|
||||
* 上传到指定存储库
|
||||
*
|
||||
* @param file
|
||||
* 文件信息
|
||||
* @param storageCode
|
||||
* 存储库编码
|
||||
* @param file 文件信息
|
||||
* @param storageCode 存储库编码
|
||||
* @return 文件信息
|
||||
*/
|
||||
FileInfo upload(MultipartFile file, String storageCode);
|
||||
@@ -59,8 +56,7 @@ public interface FileService extends BaseService<FileResp, FileResp, FileQuery,
|
||||
/**
|
||||
* 根据存储库 ID 列表查询
|
||||
*
|
||||
* @param storageIds
|
||||
* 存储库 ID 列表
|
||||
* @param storageIds 存储库 ID 列表
|
||||
* @return 文件数量
|
||||
*/
|
||||
Long countByStorageIds(List<Long> storageIds);
|
||||
|
||||
@@ -35,8 +35,7 @@ public interface MenuService extends BaseService<MenuResp, MenuResp, MenuQuery,
|
||||
/**
|
||||
* 根据用户 ID 查询
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 权限码集合
|
||||
*/
|
||||
Set<String> listPermissionByUserId(Long userId);
|
||||
@@ -44,8 +43,7 @@ public interface MenuService extends BaseService<MenuResp, MenuResp, MenuQuery,
|
||||
/**
|
||||
* 根据角色编码查询
|
||||
*
|
||||
* @param roleCode
|
||||
* 角色编码
|
||||
* @param roleCode 角色编码
|
||||
* @return 菜单列表
|
||||
*/
|
||||
List<MenuResp> listByRoleCode(String roleCode);
|
||||
|
||||
@@ -35,10 +35,8 @@ public interface MessageService {
|
||||
/**
|
||||
* 分页查询列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param pageQuery
|
||||
* 分页查询条件
|
||||
* @param query 查询条件
|
||||
* @param pageQuery 分页查询条件
|
||||
* @return 分页列表信息
|
||||
*/
|
||||
PageResp<MessageResp> page(MessageQuery query, PageQuery pageQuery);
|
||||
@@ -46,10 +44,8 @@ public interface MessageService {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param req
|
||||
* 新增信息
|
||||
* @param userIdList
|
||||
* 接收人列表
|
||||
* @param req 新增信息
|
||||
* @param userIdList 接收人列表
|
||||
*/
|
||||
void add(MessageReq req, List<Long> userIdList);
|
||||
|
||||
|
||||
@@ -31,10 +31,8 @@ public interface MessageUserService {
|
||||
/**
|
||||
* 根据用户 ID 查询未读消息数量
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param isDetail
|
||||
* 是否查询详情
|
||||
* @param userId 用户 ID
|
||||
* @param isDetail 是否查询详情
|
||||
* @return 未读消息信息
|
||||
*/
|
||||
MessageUnreadResp countUnreadMessageByUserId(Long userId, Boolean isDetail);
|
||||
@@ -42,10 +40,8 @@ public interface MessageUserService {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param messageId
|
||||
* 消息 ID
|
||||
* @param userIdList
|
||||
* 用户 ID 列表
|
||||
* @param messageId 消息 ID
|
||||
* @param userIdList 用户 ID 列表
|
||||
*/
|
||||
void add(Long messageId, List<Long> userIdList);
|
||||
|
||||
@@ -60,8 +56,7 @@ public interface MessageUserService {
|
||||
/**
|
||||
* 根据消息 ID 删除
|
||||
*
|
||||
* @param messageIds
|
||||
* 消息 ID 列表
|
||||
* @param messageIds 消息 ID 列表
|
||||
*/
|
||||
void deleteByMessageIds(List<Long> messageIds);
|
||||
}
|
||||
@@ -34,8 +34,7 @@ public interface OptionService {
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param query 查询条件
|
||||
* @return 列表信息
|
||||
*/
|
||||
List<OptionResp> list(OptionQuery query);
|
||||
|
||||
@@ -29,10 +29,8 @@ public interface RoleDeptService {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param deptIds
|
||||
* 部门 ID 列表
|
||||
* @param roleId
|
||||
* 角色 ID
|
||||
* @param deptIds 部门 ID 列表
|
||||
* @param roleId 角色 ID
|
||||
* @return true:成功;false:无变更/失败
|
||||
*/
|
||||
boolean add(List<Long> deptIds, Long roleId);
|
||||
@@ -40,24 +38,21 @@ public interface RoleDeptService {
|
||||
/**
|
||||
* 根据角色 ID 删除
|
||||
*
|
||||
* @param roleIds
|
||||
* 角色 ID 列表
|
||||
* @param roleIds 角色 ID 列表
|
||||
*/
|
||||
void deleteByRoleIds(List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 根据部门 ID 删除
|
||||
*
|
||||
* @param deptIds
|
||||
* 部门 ID 列表
|
||||
* @param deptIds 部门 ID 列表
|
||||
*/
|
||||
void deleteByDeptIds(List<Long> deptIds);
|
||||
|
||||
/**
|
||||
* 根据角色 ID 查询
|
||||
*
|
||||
* @param roleId
|
||||
* 角色 ID
|
||||
* @param roleId 角色 ID
|
||||
* @return 部门 ID 列表
|
||||
*/
|
||||
List<Long> listDeptIdByRoleId(Long roleId);
|
||||
|
||||
@@ -29,10 +29,8 @@ public interface RoleMenuService {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param menuIds
|
||||
* 菜单 ID 列表
|
||||
* @param roleId
|
||||
* 角色 ID
|
||||
* @param menuIds 菜单 ID 列表
|
||||
* @param roleId 角色 ID
|
||||
* @return true:成功;false:无变更/失败
|
||||
*/
|
||||
boolean add(List<Long> menuIds, Long roleId);
|
||||
@@ -40,16 +38,14 @@ public interface RoleMenuService {
|
||||
/**
|
||||
* 根据角色 ID 删除
|
||||
*
|
||||
* @param roleIds
|
||||
* 角色 ID 列表
|
||||
* @param roleIds 角色 ID 列表
|
||||
*/
|
||||
void deleteByRoleIds(List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 根据角色 ID 查询
|
||||
*
|
||||
* @param roleIds
|
||||
* 角色 ID 列表
|
||||
* @param roleIds 角色 ID 列表
|
||||
* @return 菜单 ID 列表
|
||||
*/
|
||||
List<Long> listMenuIdByRoleIds(List<Long> roleIds);
|
||||
|
||||
@@ -39,8 +39,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ
|
||||
/**
|
||||
* 构建字典
|
||||
*
|
||||
* @param list
|
||||
* 原始列表数据
|
||||
* @param list 原始列表数据
|
||||
* @return 字典列表
|
||||
*/
|
||||
List<LabelValueResp<Long>> buildDict(List<RoleResp> list);
|
||||
@@ -57,8 +56,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ
|
||||
/**
|
||||
* 根据用户 ID 查询角色编码
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 角色编码集合
|
||||
*/
|
||||
Set<String> listCodeByUserId(Long userId);
|
||||
@@ -66,8 +64,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ
|
||||
/**
|
||||
* 根据用户 ID 查询角色
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 角色集合
|
||||
*/
|
||||
Set<RoleDTO> listByUserId(Long userId);
|
||||
@@ -75,8 +72,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ
|
||||
/**
|
||||
* 根据角色编码查询
|
||||
*
|
||||
* @param code
|
||||
* 角色编码
|
||||
* @param code 角色编码
|
||||
* @return 角色信息
|
||||
*/
|
||||
RoleDO getByCode(String code);
|
||||
|
||||
@@ -41,8 +41,7 @@ public interface StorageService extends BaseService<StorageResp, StorageDetailRe
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code
|
||||
* 编码
|
||||
* @param code 编码
|
||||
* @return 存储库信息
|
||||
*/
|
||||
StorageDO getByCode(String code);
|
||||
|
||||
@@ -29,10 +29,8 @@ public interface UserRoleService {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param roleIds
|
||||
* 角色 ID 列表
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param roleIds 角色 ID 列表
|
||||
* @param userId 用户 ID
|
||||
* @return true:成功;false:无变更/失败
|
||||
*/
|
||||
boolean add(List<Long> roleIds, Long userId);
|
||||
@@ -40,16 +38,14 @@ public interface UserRoleService {
|
||||
/**
|
||||
* 根据用户 ID 删除
|
||||
*
|
||||
* @param userIds
|
||||
* 用户 ID 列表
|
||||
* @param userIds 用户 ID 列表
|
||||
*/
|
||||
void deleteByUserIds(List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 根据用户 ID 查询
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 角色 ID 列表
|
||||
*/
|
||||
List<Long> listRoleIdByUserId(Long userId);
|
||||
@@ -57,8 +53,7 @@ public interface UserRoleService {
|
||||
/**
|
||||
* 根据角色 ID 列表查询
|
||||
*
|
||||
* @param roleIds
|
||||
* 角色 ID 列表
|
||||
* @param roleIds 角色 ID 列表
|
||||
* @return 总记录数
|
||||
*/
|
||||
Long countByRoleIds(List<Long> roleIds);
|
||||
|
||||
@@ -40,8 +40,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param user
|
||||
* 用户信息
|
||||
* @param user 用户信息
|
||||
* @return ID
|
||||
*/
|
||||
Long add(UserDO user);
|
||||
@@ -49,10 +48,8 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
|
||||
/**
|
||||
* 上传头像
|
||||
*
|
||||
* @param avatar
|
||||
* 头像文件
|
||||
* @param id
|
||||
* ID
|
||||
* @param avatar 头像文件
|
||||
* @param id ID
|
||||
* @return 新头像路径
|
||||
*/
|
||||
String uploadAvatar(MultipartFile avatar, Long id);
|
||||
@@ -60,72 +57,57 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
|
||||
/**
|
||||
* 修改基础信息
|
||||
*
|
||||
* @param updateReq
|
||||
* 修改信息
|
||||
* @param id
|
||||
* ID
|
||||
* @param updateReq 修改信息
|
||||
* @param id ID
|
||||
*/
|
||||
void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id);
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param oldPassword
|
||||
* 当前密码
|
||||
* @param newPassword
|
||||
* 新密码
|
||||
* @param id
|
||||
* ID
|
||||
* @param oldPassword 当前密码
|
||||
* @param newPassword 新密码
|
||||
* @param id ID
|
||||
*/
|
||||
void updatePassword(String oldPassword, String newPassword, Long id);
|
||||
|
||||
/**
|
||||
* 修改手机号
|
||||
*
|
||||
* @param newPhone
|
||||
* 新手机号
|
||||
* @param currentPassword
|
||||
* 当前密码
|
||||
* @param id
|
||||
* ID
|
||||
* @param newPhone 新手机号
|
||||
* @param currentPassword 当前密码
|
||||
* @param id ID
|
||||
*/
|
||||
void updatePhone(String newPhone, String currentPassword, Long id);
|
||||
|
||||
/**
|
||||
* 修改邮箱
|
||||
*
|
||||
* @param newEmail
|
||||
* 新邮箱
|
||||
* @param currentPassword
|
||||
* 当前密码
|
||||
* @param id
|
||||
* ID
|
||||
* @param newEmail 新邮箱
|
||||
* @param currentPassword 当前密码
|
||||
* @param id ID
|
||||
*/
|
||||
void updateEmail(String newEmail, String currentPassword, Long id);
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param id
|
||||
* ID
|
||||
* @param id ID
|
||||
*/
|
||||
void resetPassword(Long id);
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*
|
||||
* @param updateReq
|
||||
* 修改信息
|
||||
* @param id
|
||||
* ID
|
||||
* @param updateReq 修改信息
|
||||
* @param id ID
|
||||
*/
|
||||
void updateRole(UserRoleUpdateReq updateReq, Long id);
|
||||
|
||||
/**
|
||||
* 根据用户名查询
|
||||
*
|
||||
* @param username
|
||||
* 用户名
|
||||
* @param username 用户名
|
||||
* @return 用户信息
|
||||
*/
|
||||
UserDO getByUsername(String username);
|
||||
@@ -133,8 +115,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
|
||||
/**
|
||||
* 根据手机号查询
|
||||
*
|
||||
* @param phone
|
||||
* 手机号
|
||||
* @param phone 手机号
|
||||
* @return 用户信息
|
||||
*/
|
||||
UserDO getByPhone(String phone);
|
||||
@@ -142,8 +123,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
|
||||
/**
|
||||
* 根据邮箱查询
|
||||
*
|
||||
* @param email
|
||||
* 邮箱
|
||||
* @param email 邮箱
|
||||
* @return 用户信息
|
||||
*/
|
||||
UserDO getByEmail(String email);
|
||||
@@ -151,8 +131,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
|
||||
/**
|
||||
* 根据部门 ID 列表查询
|
||||
*
|
||||
* @param deptIds
|
||||
* 部门 ID 列表
|
||||
* @param deptIds 部门 ID 列表
|
||||
* @return 用户数量
|
||||
*/
|
||||
Long countByDeptIds(List<Long> deptIds);
|
||||
|
||||
@@ -33,10 +33,8 @@ public interface UserSocialService {
|
||||
/**
|
||||
* 根据来源和开放 ID 查询
|
||||
*
|
||||
* @param source
|
||||
* 来源
|
||||
* @param openId
|
||||
* 开放 ID
|
||||
* @param source 来源
|
||||
* @param openId 开放 ID
|
||||
* @return 用户社会化关联信息
|
||||
*/
|
||||
UserSocialDO getBySourceAndOpenId(String source, String openId);
|
||||
@@ -44,16 +42,14 @@ public interface UserSocialService {
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param userSocial
|
||||
* 用户社会化关联信息
|
||||
* @param userSocial 用户社会化关联信息
|
||||
*/
|
||||
void saveOrUpdate(UserSocialDO userSocial);
|
||||
|
||||
/**
|
||||
* 根据用户 ID 查询
|
||||
*
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param userId 用户 ID
|
||||
* @return 用户社会化关联信息
|
||||
*/
|
||||
List<UserSocialDO> listByUserId(Long userId);
|
||||
@@ -61,20 +57,16 @@ public interface UserSocialService {
|
||||
/**
|
||||
* 绑定
|
||||
*
|
||||
* @param authUser
|
||||
* 三方账号信息
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param authUser 三方账号信息
|
||||
* @param userId 用户 ID
|
||||
*/
|
||||
void bind(AuthUser authUser, Long userId);
|
||||
|
||||
/**
|
||||
* 根据来源和用户 ID 删除
|
||||
*
|
||||
* @param source
|
||||
* 来源
|
||||
* @param userId
|
||||
* 用户 ID
|
||||
* @param source 来源
|
||||
* @param userId 用户 ID
|
||||
*/
|
||||
void deleteBySourceAndUserId(String source, Long userId);
|
||||
}
|
||||
@@ -40,8 +40,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementResp,
|
||||
AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> implements AnnouncementService {
|
||||
public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> implements AnnouncementService {
|
||||
|
||||
@Override
|
||||
public List<DashboardAnnouncementResp> listDashboard() {
|
||||
|
||||
@@ -54,8 +54,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptResp, DeptDetailResp, DeptQuery, DeptReq>
|
||||
implements DeptService {
|
||||
public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptResp, DeptDetailResp, DeptQuery, DeptReq> implements DeptService {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@@ -88,13 +87,14 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
||||
// 启用/禁用部门
|
||||
if (ObjectUtil.notEqual(newStatus, oldDept.getStatus())) {
|
||||
List<DeptDO> children = this.listChildren(id);
|
||||
long enabledChildrenCount =
|
||||
children.stream().filter(d -> DisEnableStatusEnum.ENABLE.equals(d.getStatus())).count();
|
||||
CheckUtils.throwIf(DisEnableStatusEnum.DISABLE.equals(newStatus) && enabledChildrenCount > 0,
|
||||
"禁用 [{}] 前,请先禁用其所有下级部门", oldName);
|
||||
long enabledChildrenCount = children.stream()
|
||||
.filter(d -> DisEnableStatusEnum.ENABLE.equals(d.getStatus()))
|
||||
.count();
|
||||
CheckUtils.throwIf(DisEnableStatusEnum.DISABLE
|
||||
.equals(newStatus) && enabledChildrenCount > 0, "禁用 [{}] 前,请先禁用其所有下级部门", oldName);
|
||||
DeptDO oldParentDept = this.getByParentId(oldParentId);
|
||||
CheckUtils.throwIf(DisEnableStatusEnum.ENABLE.equals(newStatus)
|
||||
&& DisEnableStatusEnum.DISABLE.equals(oldParentDept.getStatus()), "启用 [{}] 前,请先启用其所有上级部门", oldName);
|
||||
CheckUtils.throwIf(DisEnableStatusEnum.ENABLE.equals(newStatus) && DisEnableStatusEnum.DISABLE
|
||||
.equals(oldParentDept.getStatus()), "启用 [{}] 前,请先启用其所有上级部门", oldName);
|
||||
}
|
||||
// 变更上级部门
|
||||
if (ObjectUtil.notEqual(req.getParentId(), oldParentId)) {
|
||||
@@ -110,11 +110,13 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> ids) {
|
||||
List<DeptDO> list =
|
||||
baseMapper.lambdaQuery().select(DeptDO::getName, DeptDO::getIsSystem).in(DeptDO::getId, ids).list();
|
||||
List<DeptDO> list = baseMapper.lambdaQuery()
|
||||
.select(DeptDO::getName, DeptDO::getIsSystem)
|
||||
.in(DeptDO::getId, ids)
|
||||
.list();
|
||||
Optional<DeptDO> isSystemData = list.stream().filter(DeptDO::getIsSystem).findFirst();
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选部门 [{}] 是系统内置部门,不允许删除",
|
||||
isSystemData.orElseGet(DeptDO::new).getName());
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选部门 [{}] 是系统内置部门,不允许删除", isSystemData.orElseGet(DeptDO::new)
|
||||
.getName());
|
||||
CheckUtils.throwIf(this.countChildren(ids) > 0, "所选部门存在下级部门,不允许删除");
|
||||
CheckUtils.throwIf(userService.countByDeptIds(ids) > 0, "所选部门存在用户关联,请解除关联后重试");
|
||||
// 删除角色和部门关联
|
||||
@@ -137,24 +139,23 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
||||
/**
|
||||
* 名称是否存在
|
||||
*
|
||||
* @param name
|
||||
* 名称
|
||||
* @param parentId
|
||||
* 上级 ID
|
||||
* @param id
|
||||
* ID
|
||||
* @param name 名称
|
||||
* @param parentId 上级 ID
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isNameExists(String name, Long parentId, Long id) {
|
||||
return baseMapper.lambdaQuery().eq(DeptDO::getName, name).eq(DeptDO::getParentId, parentId)
|
||||
.ne(null != id, DeptDO::getId, id).exists();
|
||||
return baseMapper.lambdaQuery()
|
||||
.eq(DeptDO::getName, name)
|
||||
.eq(DeptDO::getParentId, parentId)
|
||||
.ne(null != id, DeptDO::getId, id)
|
||||
.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取祖级列表
|
||||
*
|
||||
* @param parentId
|
||||
* 上级部门
|
||||
* @param parentId 上级部门
|
||||
* @return 祖级列表
|
||||
*/
|
||||
private String getAncestors(Long parentId) {
|
||||
@@ -165,8 +166,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
||||
/**
|
||||
* 根据上级部门 ID 查询
|
||||
*
|
||||
* @param parentId
|
||||
* 上级部门 ID
|
||||
* @param parentId 上级部门 ID
|
||||
* @return 上级部门信息
|
||||
*/
|
||||
private DeptDO getByParentId(Long parentId) {
|
||||
@@ -178,8 +178,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
||||
/**
|
||||
* 查询子部门列表
|
||||
*
|
||||
* @param id
|
||||
* ID
|
||||
* @param id ID
|
||||
* @return 子部门列表
|
||||
*/
|
||||
private List<DeptDO> listChildren(Long id) {
|
||||
@@ -205,12 +204,9 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
||||
/**
|
||||
* 更新子部门祖级列表
|
||||
*
|
||||
* @param newAncestors
|
||||
* 新祖级列表
|
||||
* @param oldAncestors
|
||||
* 原祖级列表
|
||||
* @param id
|
||||
* ID
|
||||
* @param newAncestors 新祖级列表
|
||||
* @param oldAncestors 原祖级列表
|
||||
* @param id ID
|
||||
*/
|
||||
private void updateChildrenAncestors(String newAncestors, String oldAncestors, Long id) {
|
||||
List<DeptDO> children = this.listChildren(id);
|
||||
|
||||
@@ -46,9 +46,7 @@ import top.charles7c.continew.starter.extension.crud.model.query.SortQuery;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = CacheConstants.DICT_KEY_PREFIX)
|
||||
public class DictItemServiceImpl
|
||||
extends BaseServiceImpl<DictItemMapper, DictItemDO, DictItemResp, DictItemDetailResp, DictItemQuery, DictItemReq>
|
||||
implements DictItemService {
|
||||
public class DictItemServiceImpl extends BaseServiceImpl<DictItemMapper, DictItemDO, DictItemResp, DictItemDetailResp, DictItemQuery, DictItemReq> implements DictItemService {
|
||||
|
||||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
@@ -91,16 +89,16 @@ public class DictItemServiceImpl
|
||||
/**
|
||||
* 字典值是否存在
|
||||
*
|
||||
* @param value
|
||||
* 字典值
|
||||
* @param id
|
||||
* ID
|
||||
* @param dictId
|
||||
* 字典 ID
|
||||
* @param value 字典值
|
||||
* @param id ID
|
||||
* @param dictId 字典 ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isValueExists(String value, Long id, Long dictId) {
|
||||
return baseMapper.lambdaQuery().eq(DictItemDO::getValue, value).eq(DictItemDO::getDictId, dictId)
|
||||
.ne(null != id, DictItemDO::getId, id).exists();
|
||||
return baseMapper.lambdaQuery()
|
||||
.eq(DictItemDO::getValue, value)
|
||||
.eq(DictItemDO::getDictId, dictId)
|
||||
.ne(null != id, DictItemDO::getId, id)
|
||||
.exists();
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,7 @@ import top.charles7c.continew.starter.file.excel.util.ExcelUtils;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictResp, DictDetailResp, DictQuery, DictReq>
|
||||
implements DictService {
|
||||
public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictResp, DictDetailResp, DictQuery, DictReq> implements DictService {
|
||||
|
||||
private final DictItemService dictItemService;
|
||||
|
||||
@@ -79,11 +78,13 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> ids) {
|
||||
List<DictDO> list =
|
||||
baseMapper.lambdaQuery().select(DictDO::getName, DictDO::getIsSystem).in(DictDO::getId, ids).list();
|
||||
List<DictDO> list = baseMapper.lambdaQuery()
|
||||
.select(DictDO::getName, DictDO::getIsSystem)
|
||||
.in(DictDO::getId, ids)
|
||||
.list();
|
||||
Optional<DictDO> isSystemData = list.stream().filter(DictDO::getIsSystem).findFirst();
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选字典 [{}] 是系统内置字典,不允许删除",
|
||||
isSystemData.orElseGet(DictDO::new).getName());
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选字典 [{}] 是系统内置字典,不允许删除", isSystemData.orElseGet(DictDO::new)
|
||||
.getName());
|
||||
dictItemService.deleteByDictIds(ids);
|
||||
super.delete(ids);
|
||||
}
|
||||
@@ -106,10 +107,8 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes
|
||||
/**
|
||||
* 名称是否存在
|
||||
*
|
||||
* @param name
|
||||
* 名称
|
||||
* @param id
|
||||
* ID
|
||||
* @param name 名称
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isNameExists(String name, Long id) {
|
||||
@@ -119,10 +118,8 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes
|
||||
/**
|
||||
* 编码是否存在
|
||||
*
|
||||
* @param code
|
||||
* 编码
|
||||
* @param id
|
||||
* ID
|
||||
* @param code 编码
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isCodeExists(String code, Long id) {
|
||||
|
||||
@@ -56,8 +56,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileResp, FileResp, FileQuery, FileReq>
|
||||
implements FileService {
|
||||
public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileResp, FileResp, FileQuery, FileReq> implements FileService {
|
||||
|
||||
@Resource
|
||||
private StorageService storageService;
|
||||
@@ -107,7 +106,8 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes
|
||||
// 处理本地存储文件 URL
|
||||
FileInfo fileInfo = uploadPretreatment.upload();
|
||||
fileInfo.setUrl(StorageTypeEnum.LOCAL.equals(storage.getType())
|
||||
? URLUtil.normalize(storage.getDomain() + StringConstants.SLASH + fileInfo.getUrl()) : fileInfo.getUrl());
|
||||
? URLUtil.normalize(storage.getDomain() + StringConstants.SLASH + fileInfo.getUrl())
|
||||
: fileInfo.getUrl());
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = CacheConstants.MENU_KEY_PREFIX)
|
||||
public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuResp, MenuResp, MenuQuery, MenuReq>
|
||||
implements MenuService {
|
||||
public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuResp, MenuResp, MenuQuery, MenuReq> implements MenuService {
|
||||
|
||||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
@@ -101,16 +100,16 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes
|
||||
/**
|
||||
* 名称是否存在
|
||||
*
|
||||
* @param name
|
||||
* 名称
|
||||
* @param parentId
|
||||
* 上级 ID
|
||||
* @param id
|
||||
* ID
|
||||
* @param name 名称
|
||||
* @param parentId 上级 ID
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isNameExists(String name, Long parentId, Long id) {
|
||||
return baseMapper.lambdaQuery().eq(MenuDO::getTitle, name).eq(MenuDO::getParentId, parentId)
|
||||
.ne(null != id, MenuDO::getId, id).exists();
|
||||
return baseMapper.lambdaQuery()
|
||||
.eq(MenuDO::getTitle, name)
|
||||
.eq(MenuDO::getParentId, parentId)
|
||||
.ne(null != id, MenuDO::getId, id)
|
||||
.exists();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +86,7 @@ public class MessageServiceImpl implements MessageService {
|
||||
/**
|
||||
* 填充数据
|
||||
*
|
||||
* @param message
|
||||
* 待填充信息
|
||||
* @param message 待填充信息
|
||||
*/
|
||||
private void fill(MessageResp message) {
|
||||
Long createUser = message.getCreateUser();
|
||||
|
||||
@@ -84,9 +84,12 @@ public class MessageUserServiceImpl implements MessageUserService {
|
||||
|
||||
@Override
|
||||
public void readMessage(List<Long> ids) {
|
||||
baseMapper.lambdaUpdate().set(MessageUserDO::getIsRead, true)
|
||||
.set(MessageUserDO::getReadTime, LocalDateTime.now()).eq(MessageUserDO::getIsRead, false)
|
||||
.in(CollUtil.isNotEmpty(ids), MessageUserDO::getMessageId, ids).update();
|
||||
baseMapper.lambdaUpdate()
|
||||
.set(MessageUserDO::getIsRead, true)
|
||||
.set(MessageUserDO::getReadTime, LocalDateTime.now())
|
||||
.eq(MessageUserDO::getIsRead, false)
|
||||
.in(CollUtil.isNotEmpty(ids), MessageUserDO::getMessageId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,16 +46,22 @@ public class RoleDeptServiceImpl implements RoleDeptService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean add(List<Long> deptIds, Long roleId) {
|
||||
// 检查是否有变更
|
||||
List<Long> oldDeptIdList = roleDeptMapper.lambdaQuery().select(RoleDeptDO::getDeptId)
|
||||
.eq(RoleDeptDO::getRoleId, roleId).list().stream().map(RoleDeptDO::getDeptId).collect(Collectors.toList());
|
||||
List<Long> oldDeptIdList = roleDeptMapper.lambdaQuery()
|
||||
.select(RoleDeptDO::getDeptId)
|
||||
.eq(RoleDeptDO::getRoleId, roleId)
|
||||
.list()
|
||||
.stream()
|
||||
.map(RoleDeptDO::getDeptId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(CollUtil.disjunction(deptIds, oldDeptIdList))) {
|
||||
return false;
|
||||
}
|
||||
// 删除原有关联
|
||||
roleDeptMapper.lambdaUpdate().eq(RoleDeptDO::getRoleId, roleId).remove();
|
||||
// 保存最新关联
|
||||
List<RoleDeptDO> roleDeptList =
|
||||
deptIds.stream().map(deptId -> new RoleDeptDO(roleId, deptId)).collect(Collectors.toList());
|
||||
List<RoleDeptDO> roleDeptList = deptIds.stream()
|
||||
.map(deptId -> new RoleDeptDO(roleId, deptId))
|
||||
.collect(Collectors.toList());
|
||||
return roleDeptMapper.insertBatch(roleDeptList);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,16 +47,22 @@ public class RoleMenuServiceImpl implements RoleMenuService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean add(List<Long> menuIds, Long roleId) {
|
||||
// 检查是否有变更
|
||||
List<Long> oldMenuIdList = roleMenuMapper.lambdaQuery().select(RoleMenuDO::getMenuId)
|
||||
.eq(RoleMenuDO::getRoleId, roleId).list().stream().map(RoleMenuDO::getMenuId).collect(Collectors.toList());
|
||||
List<Long> oldMenuIdList = roleMenuMapper.lambdaQuery()
|
||||
.select(RoleMenuDO::getMenuId)
|
||||
.eq(RoleMenuDO::getRoleId, roleId)
|
||||
.list()
|
||||
.stream()
|
||||
.map(RoleMenuDO::getMenuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(CollUtil.disjunction(menuIds, oldMenuIdList))) {
|
||||
return false;
|
||||
}
|
||||
// 删除原有关联
|
||||
roleMenuMapper.lambdaUpdate().eq(RoleMenuDO::getRoleId, roleId).remove();
|
||||
// 保存最新关联
|
||||
List<RoleMenuDO> roleMenuList =
|
||||
menuIds.stream().map(menuId -> new RoleMenuDO(roleId, menuId)).collect(Collectors.toList());
|
||||
List<RoleMenuDO> roleMenuList = menuIds.stream()
|
||||
.map(menuId -> new RoleMenuDO(roleId, menuId))
|
||||
.collect(Collectors.toList());
|
||||
return roleMenuMapper.insertBatch(roleMenuList);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleResp, RoleDetailResp, RoleQuery, RoleReq>
|
||||
implements RoleService {
|
||||
public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleResp, RoleDetailResp, RoleQuery, RoleReq> implements RoleService {
|
||||
|
||||
private final MenuService menuService;
|
||||
private final OnlineUserService onlineUserService;
|
||||
@@ -93,8 +92,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
DataScopeEnum oldDataScope = oldRole.getDataScope();
|
||||
String oldCode = oldRole.getCode();
|
||||
if (Boolean.TRUE.equals(oldRole.getIsSystem())) {
|
||||
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, req.getStatus(), "[{}] 是系统内置角色,不允许禁用",
|
||||
oldRole.getName());
|
||||
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, req.getStatus(), "[{}] 是系统内置角色,不允许禁用", oldRole
|
||||
.getName());
|
||||
CheckUtils.throwIfNotEqual(req.getCode(), oldCode, "[{}] 是系统内置角色,不允许修改角色编码", oldRole.getName());
|
||||
CheckUtils.throwIfNotEqual(req.getDataScope(), oldDataScope, "[{}] 是系统内置角色,不允许修改角色数据权限", oldRole.getName());
|
||||
}
|
||||
@@ -107,8 +106,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
// 保存角色和部门关联
|
||||
boolean isSaveDeptSuccess = roleDeptService.add(req.getDeptIds(), id);
|
||||
// 如果角色编码、功能权限或数据权限有变更,则清除关联的在线用户(重新登录以获取最新角色权限)
|
||||
if (ObjectUtil.notEqual(req.getCode(), oldCode) || ObjectUtil.notEqual(req.getDataScope(), oldDataScope)
|
||||
|| isSaveMenuSuccess || isSaveDeptSuccess) {
|
||||
if (ObjectUtil.notEqual(req.getCode(), oldCode) || ObjectUtil.notEqual(req
|
||||
.getDataScope(), oldDataScope) || isSaveMenuSuccess || isSaveDeptSuccess) {
|
||||
onlineUserService.cleanByRoleId(id);
|
||||
}
|
||||
}
|
||||
@@ -117,11 +116,13 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> ids) {
|
||||
List<RoleDO> list =
|
||||
baseMapper.lambdaQuery().select(RoleDO::getName, RoleDO::getIsSystem).in(RoleDO::getId, ids).list();
|
||||
List<RoleDO> list = baseMapper.lambdaQuery()
|
||||
.select(RoleDO::getName, RoleDO::getIsSystem)
|
||||
.in(RoleDO::getId, ids)
|
||||
.list();
|
||||
Optional<RoleDO> isSystemData = list.stream().filter(RoleDO::getIsSystem).findFirst();
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选角色 [{}] 是系统内置角色,不允许删除",
|
||||
isSystemData.orElseGet(RoleDO::new).getName());
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选角色 [{}] 是系统内置角色,不允许删除", isSystemData.orElseGet(RoleDO::new)
|
||||
.getName());
|
||||
CheckUtils.throwIf(userRoleService.countByRoleIds(ids) > 0, "所选角色存在用户关联,请解除关联后重试");
|
||||
// 删除角色和菜单关联
|
||||
roleMenuService.deleteByRoleIds(ids);
|
||||
@@ -183,10 +184,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
/**
|
||||
* 名称是否存在
|
||||
*
|
||||
* @param name
|
||||
* 名称
|
||||
* @param id
|
||||
* ID
|
||||
* @param name 名称
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isNameExists(String name, Long id) {
|
||||
@@ -196,10 +195,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
/**
|
||||
* 编码是否存在
|
||||
*
|
||||
* @param code
|
||||
* 编码
|
||||
* @param id
|
||||
* ID
|
||||
* @param code 编码
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isCodeExists(String code, Long id) {
|
||||
|
||||
@@ -60,9 +60,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StorageServiceImpl
|
||||
extends BaseServiceImpl<StorageMapper, StorageDO, StorageResp, StorageDetailResp, StorageQuery, StorageReq>
|
||||
implements StorageService {
|
||||
public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO, StorageResp, StorageDetailResp, StorageQuery, StorageReq> implements StorageService {
|
||||
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
@@ -84,9 +82,8 @@ public class StorageServiceImpl
|
||||
CheckUtils.throwIf(this.isCodeExists(code, id), "修改失败,[{}] 已存在", code);
|
||||
DisEnableStatusEnum newStatus = req.getStatus();
|
||||
StorageDO oldStorage = super.getById(id);
|
||||
CheckUtils.throwIf(
|
||||
Boolean.TRUE.equals(oldStorage.getIsDefault()) && DisEnableStatusEnum.DISABLE.equals(newStatus),
|
||||
"[{}] 是默认存储库,不允许禁用", oldStorage.getName());
|
||||
CheckUtils.throwIf(Boolean.TRUE.equals(oldStorage.getIsDefault()) && DisEnableStatusEnum.DISABLE
|
||||
.equals(newStatus), "[{}] 是默认存储库,不允许禁用", oldStorage.getName());
|
||||
DisEnableStatusEnum oldStatus = oldStorage.getStatus();
|
||||
if (DisEnableStatusEnum.ENABLE.equals(oldStatus) || DisEnableStatusEnum.DISABLE.equals(newStatus)) {
|
||||
this.unload(BeanUtil.copyProperties(oldStorage, StorageReq.class));
|
||||
@@ -133,13 +130,13 @@ public class StorageServiceImpl
|
||||
ValidationUtils.throwIfBlank(bucketName, "存储路径不能为空");
|
||||
ValidationUtils.throwIfBlank(domain, "自定义域名不能为空");
|
||||
ValidationUtils.throwIf(!URLUtils.isHttpUrl(domain), "自定义域名格式错误");
|
||||
req.setBucketName(StrUtil.appendIfMissing(
|
||||
bucketName.replace(StringConstants.BACKSLASH, StringConstants.SLASH), StringConstants.SLASH));
|
||||
req.setBucketName(StrUtil.appendIfMissing(bucketName
|
||||
.replace(StringConstants.BACKSLASH, StringConstants.SLASH), StringConstants.SLASH));
|
||||
FileStorageProperties.LocalPlusConfig config = new FileStorageProperties.LocalPlusConfig();
|
||||
config.setPlatform(req.getCode());
|
||||
config.setStoragePath(bucketName);
|
||||
fileStorageList
|
||||
.addAll(FileStorageServiceBuilder.buildLocalPlusFileStorage(Collections.singletonList(config)));
|
||||
fileStorageList.addAll(FileStorageServiceBuilder.buildLocalPlusFileStorage(Collections
|
||||
.singletonList(config)));
|
||||
SpringUtils.registerResourceHandler(MapUtil.of(URLUtil.url(req.getDomain()).getPath(), bucketName));
|
||||
}
|
||||
case S3 -> {
|
||||
@@ -157,8 +154,8 @@ public class StorageServiceImpl
|
||||
config.setEndPoint(endpoint);
|
||||
config.setBucketName(bucketName);
|
||||
config.setDomain(domain);
|
||||
fileStorageList.addAll(
|
||||
FileStorageServiceBuilder.buildAmazonS3FileStorage(Collections.singletonList(config), null));
|
||||
fileStorageList.addAll(FileStorageServiceBuilder.buildAmazonS3FileStorage(Collections
|
||||
.singletonList(config), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,22 +172,21 @@ public class StorageServiceImpl
|
||||
/**
|
||||
* 默认存储库是否存在
|
||||
*
|
||||
* @param id
|
||||
* ID
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isDefaultExists(Long id) {
|
||||
return baseMapper.lambdaQuery().eq(StorageDO::getIsDefault, Boolean.TRUE).ne(null != id, StorageDO::getId, id)
|
||||
return baseMapper.lambdaQuery()
|
||||
.eq(StorageDO::getIsDefault, Boolean.TRUE)
|
||||
.ne(null != id, StorageDO::getId, id)
|
||||
.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码是否存在
|
||||
*
|
||||
* @param code
|
||||
* 编码
|
||||
* @param id
|
||||
* ID
|
||||
* @param code 编码
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isCodeExists(String code, Long id) {
|
||||
|
||||
@@ -46,16 +46,22 @@ public class UserRoleServiceImpl implements UserRoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean add(List<Long> roleIds, Long userId) {
|
||||
// 检查是否有变更
|
||||
List<Long> oldRoleIdList = userRoleMapper.lambdaQuery().select(UserRoleDO::getRoleId)
|
||||
.eq(UserRoleDO::getUserId, userId).list().stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
|
||||
List<Long> oldRoleIdList = userRoleMapper.lambdaQuery()
|
||||
.select(UserRoleDO::getRoleId)
|
||||
.eq(UserRoleDO::getUserId, userId)
|
||||
.list()
|
||||
.stream()
|
||||
.map(UserRoleDO::getRoleId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(CollUtil.disjunction(roleIds, oldRoleIdList))) {
|
||||
return false;
|
||||
}
|
||||
// 删除原有关联
|
||||
userRoleMapper.lambdaUpdate().eq(UserRoleDO::getUserId, userId).remove();
|
||||
// 保存最新关联
|
||||
List<UserRoleDO> userRoleList =
|
||||
roleIds.stream().map(roleId -> new UserRoleDO(userId, roleId)).collect(Collectors.toList());
|
||||
List<UserRoleDO> userRoleList = roleIds.stream()
|
||||
.map(roleId -> new UserRoleDO(userId, roleId))
|
||||
.collect(Collectors.toList());
|
||||
return userRoleMapper.insertBatch(userRoleList);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,7 @@ import top.charles7c.continew.starter.extension.crud.base.CommonUserService;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = CacheConstants.USER_KEY_PREFIX)
|
||||
public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserResp, UserDetailResp, UserQuery, UserReq>
|
||||
implements UserService, CommonUserService {
|
||||
public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserResp, UserDetailResp, UserQuery, UserReq> implements UserService, CommonUserService {
|
||||
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
@@ -97,7 +96,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
Long userId = super.add(req);
|
||||
baseMapper.lambdaUpdate()
|
||||
.set(UserDO::getPassword, SecureUtils.md5Salt(SysConstants.DEFAULT_PASSWORD, userId.toString()))
|
||||
.set(UserDO::getPwdResetTime, LocalDateTime.now()).eq(UserDO::getId, userId).update();
|
||||
.set(UserDO::getPwdResetTime, LocalDateTime.now())
|
||||
.eq(UserDO::getId, userId)
|
||||
.update();
|
||||
// 保存用户和角色关联
|
||||
userRoleService.add(req.getRoleIds(), userId);
|
||||
return userId;
|
||||
@@ -113,15 +114,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
String phone = req.getPhone();
|
||||
CheckUtils.throwIf(StrUtil.isNotBlank(phone) && this.isPhoneExists(phone, id), "修改失败,[{}] 已存在", phone);
|
||||
DisEnableStatusEnum newStatus = req.getStatus();
|
||||
CheckUtils.throwIf(
|
||||
DisEnableStatusEnum.DISABLE.equals(newStatus) && ObjectUtil.equal(id, LoginHelper.getUserId()),
|
||||
"不允许禁用当前用户");
|
||||
CheckUtils.throwIf(DisEnableStatusEnum.DISABLE.equals(newStatus) && ObjectUtil.equal(id, LoginHelper
|
||||
.getUserId()), "不允许禁用当前用户");
|
||||
UserDO oldUser = super.getById(id);
|
||||
if (oldUser.getIsSystem()) {
|
||||
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置用户,不允许禁用",
|
||||
oldUser.getNickname());
|
||||
Collection<Long> disjunctionRoleIds =
|
||||
CollUtil.disjunction(req.getRoleIds(), userRoleService.listRoleIdByUserId(id));
|
||||
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置用户,不允许禁用", oldUser
|
||||
.getNickname());
|
||||
Collection<Long> disjunctionRoleIds = CollUtil.disjunction(req.getRoleIds(), userRoleService
|
||||
.listRoleIdByUserId(id));
|
||||
CheckUtils.throwIfNotEmpty(disjunctionRoleIds, "[{}] 是系统内置用户,不允许变更所属角色", oldUser.getNickname());
|
||||
}
|
||||
// 更新信息
|
||||
@@ -134,11 +134,13 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> ids) {
|
||||
CheckUtils.throwIf(CollUtil.contains(ids, LoginHelper.getUserId()), "不允许删除当前用户");
|
||||
List<UserDO> list =
|
||||
baseMapper.lambdaQuery().select(UserDO::getNickname, UserDO::getIsSystem).in(UserDO::getId, ids).list();
|
||||
List<UserDO> list = baseMapper.lambdaQuery()
|
||||
.select(UserDO::getNickname, UserDO::getIsSystem)
|
||||
.in(UserDO::getId, ids)
|
||||
.list();
|
||||
Optional<UserDO> isSystemData = list.stream().filter(UserDO::getIsSystem).findFirst();
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选用户 [{}] 是系统内置用户,不允许删除",
|
||||
isSystemData.orElseGet(UserDO::new).getNickname());
|
||||
CheckUtils.throwIf(isSystemData::isPresent, "所选用户 [{}] 是系统内置用户,不允许删除", isSystemData.orElseGet(UserDO::new)
|
||||
.getNickname());
|
||||
// 删除用户和角色关联
|
||||
userRoleService.deleteByUserIds(ids);
|
||||
// 删除用户
|
||||
@@ -161,8 +163,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
public String uploadAvatar(MultipartFile avatarFile, Long id) {
|
||||
String avatarImageType = FileNameUtil.extName(avatarFile.getOriginalFilename());
|
||||
String[] avatarSupportImgTypes = FileConstants.AVATAR_SUPPORTED_IMG_TYPES;
|
||||
CheckUtils.throwIf(!StrUtil.equalsAnyIgnoreCase(avatarImageType, avatarSupportImgTypes), "头像仅支持 {} 格式的图片",
|
||||
String.join(StringConstants.CHINESE_COMMA, avatarSupportImgTypes));
|
||||
CheckUtils.throwIf(!StrUtil
|
||||
.equalsAnyIgnoreCase(avatarImageType, avatarSupportImgTypes), "头像仅支持 {} 格式的图片", String
|
||||
.join(StringConstants.CHINESE_COMMA, avatarSupportImgTypes));
|
||||
// 上传新头像
|
||||
UserDO user = super.getById(id);
|
||||
FileInfo fileInfo = fileService.upload(avatarFile);
|
||||
@@ -180,8 +183,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
@Override
|
||||
public void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id) {
|
||||
super.getById(id);
|
||||
baseMapper.lambdaUpdate().set(UserDO::getNickname, updateReq.getNickname())
|
||||
.set(UserDO::getGender, updateReq.getGender()).eq(UserDO::getId, id).update();
|
||||
baseMapper.lambdaUpdate()
|
||||
.set(UserDO::getNickname, updateReq.getNickname())
|
||||
.set(UserDO::getGender, updateReq.getGender())
|
||||
.eq(UserDO::getId, id)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,8 +200,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
}
|
||||
// 更新密码和密码重置时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
baseMapper.lambdaUpdate().set(UserDO::getPassword, SecureUtils.md5Salt(newPassword, id.toString()))
|
||||
.set(UserDO::getPwdResetTime, now).eq(UserDO::getId, id).update();
|
||||
baseMapper.lambdaUpdate()
|
||||
.set(UserDO::getPassword, SecureUtils.md5Salt(newPassword, id.toString()))
|
||||
.set(UserDO::getPwdResetTime, now)
|
||||
.eq(UserDO::getId, id)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -265,10 +274,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
/**
|
||||
* 名称是否存在
|
||||
*
|
||||
* @param name
|
||||
* 名称
|
||||
* @param id
|
||||
* ID
|
||||
* @param name 名称
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isNameExists(String name, Long id) {
|
||||
@@ -278,10 +285,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
/**
|
||||
* 邮箱是否存在
|
||||
*
|
||||
* @param email
|
||||
* 邮箱
|
||||
* @param id
|
||||
* ID
|
||||
* @param email 邮箱
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isEmailExists(String email, Long id) {
|
||||
@@ -291,10 +296,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
|
||||
/**
|
||||
* 手机号码是否存在
|
||||
*
|
||||
* @param phone
|
||||
* 手机号码
|
||||
* @param id
|
||||
* ID
|
||||
* @param phone 手机号码
|
||||
* @param id ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isPhoneExists(String phone, Long id) {
|
||||
|
||||
@@ -57,9 +57,11 @@ public class UserSocialServiceImpl implements UserSocialService {
|
||||
if (null == userSocial.getCreateTime()) {
|
||||
baseMapper.insert(userSocial);
|
||||
} else {
|
||||
baseMapper.lambdaUpdate().set(UserSocialDO::getMetaJson, userSocial.getMetaJson())
|
||||
baseMapper.lambdaUpdate()
|
||||
.set(UserSocialDO::getMetaJson, userSocial.getMetaJson())
|
||||
.set(UserSocialDO::getLastLoginTime, userSocial.getLastLoginTime())
|
||||
.eq(UserSocialDO::getSource, userSocial.getSource()).eq(UserSocialDO::getOpenId, userSocial.getOpenId())
|
||||
.eq(UserSocialDO::getSource, userSocial.getSource())
|
||||
.eq(UserSocialDO::getOpenId, userSocial.getOpenId())
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user