From 35e31233c531b68b761c73fc0daf7444843b4059 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Wed, 10 Jan 2024 22:08:45 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Java开发手册(黄山版).pdf | Bin {code-style => .style}/license-header | 0 .../p3c-codestyle.xml | 850 ++++++++---------- README.md | 4 +- code-style/STYLE.md | 8 - .../config/SpringCacheConfiguration.java | 4 +- .../easyexcel/ExcelBaseEnumConverter.java | 16 +- .../config/jackson/BaseEnumDeserializer.java | 13 +- .../jackson/SimpleDeserializersWrapper.java | 5 +- .../mybatis/DataPermissionFilterImpl.java | 8 +- .../mybatis/MyBatisPlusMetaObjectHandler.java | 18 +- .../admin/common/model/resp/CaptchaResp.java | 3 +- .../admin/common/util/SecureUtils.java | 21 +- .../admin/common/util/helper/LoginHelper.java | 9 +- .../admin/monitor/config/LogDaoLocalImpl.java | 17 +- .../admin/monitor/mapper/LogMapper.java | 3 +- .../resp/DashboardGeoDistributionResp.java | 3 +- .../monitor/service/DashboardService.java | 3 +- .../admin/monitor/service/LogService.java | 21 +- .../service/impl/DashboardServiceImpl.java | 6 +- .../monitor/service/impl/LogServiceImpl.java | 24 +- .../admin/auth/model/req/AccountLoginReq.java | 3 +- .../admin/auth/model/resp/LoginResp.java | 3 +- .../admin/auth/model/resp/OnlineUserResp.java | 3 +- .../admin/auth/model/resp/UserInfoResp.java | 3 +- .../admin/auth/service/LoginService.java | 18 +- .../admin/auth/service/OnlineUserService.java | 12 +- .../admin/auth/service/PermissionService.java | 6 +- .../auth/service/impl/LoginServiceImpl.java | 14 +- .../service/impl/OnlineUserServiceImpl.java | 14 +- .../admin/system/config/FileRecorderImpl.java | 7 +- .../admin/system/enums/FileTypeEnum.java | 6 +- .../admin/system/mapper/DictItemMapper.java | 3 +- .../admin/system/mapper/MenuMapper.java | 6 +- .../admin/system/mapper/MessageMapper.java | 8 +- .../system/mapper/MessageUserMapper.java | 6 +- .../admin/system/mapper/RoleDeptMapper.java | 3 +- .../admin/system/mapper/RoleMenuMapper.java | 3 +- .../admin/system/mapper/UserMapper.java | 12 +- .../admin/system/mapper/UserRoleMapper.java | 3 +- .../admin/system/mapper/UserSocialMapper.java | 6 +- .../admin/system/model/entity/FileDO.java | 13 +- .../admin/system/model/req/RoleReq.java | 4 +- .../model/req/UserEmailUpdateRequest.java | 3 +- .../model/req/UserPasswordUpdateReq.java | 6 +- .../system/model/req/UserPhoneUpdateReq.java | 3 +- .../admin/system/model/resp/AvatarResp.java | 3 +- .../admin/system/model/resp/FileResp.java | 4 +- .../system/model/resp/RoleDetailResp.java | 4 +- .../admin/system/model/resp/RoleResp.java | 4 +- .../system/model/resp/UserDetailResp.java | 3 +- .../admin/system/model/resp/UserResp.java | 3 +- .../system/service/AnnouncementService.java | 3 +- .../admin/system/service/DictItemService.java | 9 +- .../admin/system/service/FileService.java | 12 +- .../admin/system/service/MenuService.java | 6 +- .../admin/system/service/MessageService.java | 12 +- .../system/service/MessageUserService.java | 15 +- .../admin/system/service/OptionService.java | 3 +- .../admin/system/service/RoleDeptService.java | 15 +- .../admin/system/service/RoleMenuService.java | 12 +- .../admin/system/service/RoleService.java | 12 +- .../admin/system/service/StorageService.java | 3 +- .../admin/system/service/UserRoleService.java | 15 +- .../admin/system/service/UserService.java | 63 +- .../system/service/UserSocialService.java | 24 +- .../service/impl/AnnouncementServiceImpl.java | 3 +- .../system/service/impl/DeptServiceImpl.java | 60 +- .../service/impl/DictItemServiceImpl.java | 20 +- .../system/service/impl/DictServiceImpl.java | 25 +- .../system/service/impl/FileServiceImpl.java | 6 +- .../system/service/impl/MenuServiceImpl.java | 19 +- .../service/impl/MessageServiceImpl.java | 3 +- .../service/impl/MessageUserServiceImpl.java | 9 +- .../service/impl/RoleDeptServiceImpl.java | 14 +- .../service/impl/RoleMenuServiceImpl.java | 14 +- .../system/service/impl/RoleServiceImpl.java | 33 +- .../service/impl/StorageServiceImpl.java | 34 +- .../service/impl/UserRoleServiceImpl.java | 14 +- .../system/service/impl/UserServiceImpl.java | 67 +- .../service/impl/UserSocialServiceImpl.java | 6 +- .../admin/tool/mapper/FieldConfigMapper.java | 3 +- .../tool/model/entity/FieldConfigDO.java | 4 +- .../admin/tool/model/entity/GenConfigDO.java | 3 +- .../admin/tool/service/GeneratorService.java | 33 +- .../service/impl/GeneratorServiceImpl.java | 78 +- .../admin/webapi/auth/AuthController.java | 3 +- .../webapi/common/CaptchaController.java | 44 +- .../admin/webapi/common/CommonController.java | 17 +- .../webapi/monitor/OnlineUserController.java | 4 +- .../webapi/system/AnnouncementController.java | 5 +- .../webapi/system/DictItemController.java | 3 +- .../webapi/system/StorageController.java | 3 +- .../webapi/system/UserCenterController.java | 20 +- .../webapi/tool/GeneratorController.java | 2 +- .../ContiNewAdminApplicationTests.java | 3 +- pom.xml | 7 +- 97 files changed, 861 insertions(+), 1127 deletions(-) rename {code-style => .style}/Java开发手册(黄山版).pdf (100%) rename {code-style => .style}/license-header (100%) rename code-style/code-formatter.xml => .style/p3c-codestyle.xml (69%) delete mode 100644 code-style/STYLE.md diff --git a/code-style/Java开发手册(黄山版).pdf b/.style/Java开发手册(黄山版).pdf similarity index 100% rename from code-style/Java开发手册(黄山版).pdf rename to .style/Java开发手册(黄山版).pdf diff --git a/code-style/license-header b/.style/license-header similarity index 100% rename from code-style/license-header rename to .style/license-header diff --git a/code-style/code-formatter.xml b/.style/p3c-codestyle.xml similarity index 69% rename from code-style/code-formatter.xml rename to .style/p3c-codestyle.xml index f92573ec..fb5f47f3 100644 --- a/code-style/code-formatter.xml +++ b/.style/p3c-codestyle.xml @@ -1,496 +1,380 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - + + + + + - - + - + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/README.md b/README.md index 53bd24dd..bb26dddd 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ ContiNew Admin(Continue New Admin)持续迭代优化的前后端分离中后 - 前后端统一异常拦截处理,统一输出异常信息,避免繁琐的异常判断 - 自动初始化数据:通过 Liquibase 管理数据库脚本版本记录,并在系统第一次启动时自动进行数据初始化,无须额外配置导入 - 提供多项实用基础配置,例如:Jackson 针对日期、通用枚举的序列化、反序列化配置,统一线程池配置等 -- 良好的代码、配置文件结构和命名,完善的代码注释甚至包括 Git Commit 信息、接口文档参数示例,遵循阿里巴巴 《Java开发手册(黄山版)》 的代码规范,保证代码质量和可维护性 +- 良好的代码、配置文件结构和命名,完善的代码注释甚至包括 Git Commit 信息、接口文档参数示例,遵循阿里巴巴 《Java开发手册(黄山版)》 的代码规范,保证代码质量和可维护性 - 更多细节及实践,敬请探索与关注 ## 系统功能 @@ -395,7 +395,7 @@ ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大 > **IMPORTANT** > 欢迎大家为 ContiNew Admin 贡献代码,我们非常感谢您的支持!为了更好地管理项目,维护者有一些要求: > -> 1. 请确保代码、配置文件的结构和命名规范良好,完善的代码注释甚至包括接口文档参数示例,并遵循阿里巴巴的 《Java开发手册(黄山版)》 中的代码规范,保证代码质量和可维护性 +> 1. 请确保代码、配置文件的结构和命名规范良好,完善的代码注释甚至包括接口文档参数示例,并遵循阿里巴巴的 《Java开发手册(黄山版)》 中的代码规范,保证代码质量和可维护性 > 2. 在提交代码前,请按照 [Angular 提交规范](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) 编写 commit 的 message(建议在 IntelliJ IDEA 中下载并安装 Git Commit Template 插件,以便按照规范进行 commit) > 3. 提交代码之前,请关闭所有代码窗口,执行 mvn compile 命令(项目已配置代码格式化插件,编译通过的同时也会自动进行代码格式化),编译通过后,不要再打开查看任何代码窗口,直接提交即可,以免不同的 IDE 配置会自动进行代码格式化 diff --git a/code-style/STYLE.md b/code-style/STYLE.md deleted file mode 100644 index 308f1bdc..00000000 --- a/code-style/STYLE.md +++ /dev/null @@ -1,8 +0,0 @@ -## 统一代码风格 - -如果要编辑本项目,一定要统一代码风格 - -### 统一方案 - -本工程代码遵守阿里巴巴 [p3c](https://github.com/alibaba/p3c) 规范,在代码开发前建议: -* 安装阿里巴巴规约插件,用于提早发现不规范代码,具体安装方法参照:[p3c](https://github.com/alibaba/p3c),里面有 Eclipse,IntelliJ IDEA 的安装方法 \ No newline at end of file diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/SpringCacheConfiguration.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/SpringCacheConfiguration.java index abcfe8d1..05438343 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/SpringCacheConfiguration.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/SpringCacheConfiguration.java @@ -58,8 +58,8 @@ public class SpringCacheConfiguration extends CachingConfigurerSupport { @Bean public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) { ObjectMapper objectMapperCopy = objectMapper.copy(); - objectMapperCopy.activateDefaultTyping(objectMapperCopy.getPolymorphicTypeValidator(), - ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + objectMapperCopy.activateDefaultTyping(objectMapperCopy + .getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())) .serializeValuesWith(RedisSerializationContext.SerializationPair diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java index 53030a74..57d6fdcd 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java @@ -52,8 +52,9 @@ public class ExcelBaseEnumConverter implements Converter> { * 转换为 Java 数据(读取 Excel) */ @Override - public IBaseEnum convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, - GlobalConfiguration globalConfiguration) { + public IBaseEnum convertToJavaData(ReadCellData cellData, + ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { return this.getEnum(IBaseEnum.class, Convert.toStr(cellData.getData())); } @@ -61,8 +62,9 @@ public class ExcelBaseEnumConverter implements Converter> { * 转换为 Excel 数据(写入 Excel) */ @Override - public WriteCellData convertToExcelData(IBaseEnum value, ExcelContentProperty contentProperty, - GlobalConfiguration globalConfiguration) { + public WriteCellData convertToExcelData(IBaseEnum value, + ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { if (null == value) { return new WriteCellData<>(StringConstants.EMPTY); } @@ -72,10 +74,8 @@ public class ExcelBaseEnumConverter implements Converter> { /** * 通过 value 获取枚举对象,获取不到时为 {@code null} * - * @param enumType - * 枚举类型 - * @param description - * 描述 + * @param enumType 枚举类型 + * @param description 描述 * @return 对应枚举 ,获取不到时为 {@code null} */ private IBaseEnum getEnum(Class enumType, String description) { diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java index f4aad395..214cdb99 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java @@ -43,8 +43,8 @@ public class BaseEnumDeserializer extends JsonDeserializer { public static final BaseEnumDeserializer SERIALIZER_INSTANCE = new BaseEnumDeserializer(); @Override - public IBaseEnum deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) - throws IOException { + public IBaseEnum deserialize(JsonParser jsonParser, + DeserializationContext deserializationContext) throws IOException { Class targetClass = jsonParser.getCurrentValue().getClass(); String fieldName = jsonParser.getCurrentName(); String value = jsonParser.getText(); @@ -54,12 +54,9 @@ public class BaseEnumDeserializer extends JsonDeserializer { /** * 通过某字段对应值获取枚举实例,获取不到时为 {@code null} * - * @param targetClass - * 目标类型 - * @param value - * 字段值 - * @param fieldName - * 字段名 + * @param targetClass 目标类型 + * @param value 字段值 + * @param fieldName 字段名 * @return 对应枚举实例 ,获取不到时为 {@code null} */ private IBaseEnum getEnum(Class targetClass, String value, String fieldName) { diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java index baa8f473..4617bd05 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java @@ -49,8 +49,9 @@ import com.fasterxml.jackson.databind.type.ClassKey; public class SimpleDeserializersWrapper extends SimpleDeserializers { @Override - public JsonDeserializer findEnumDeserializer(Class type, DeserializationConfig config, - BeanDescription beanDesc) throws JsonMappingException { + public JsonDeserializer findEnumDeserializer(Class type, + DeserializationConfig config, + BeanDescription beanDesc) throws JsonMappingException { JsonDeserializer deser = super.findEnumDeserializer(type, config, beanDesc); if (null != deser) { return deser; diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java index 01ae5430..fddb47d9 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java @@ -49,9 +49,11 @@ public class DataPermissionFilterImpl implements DataPermissionFilter { DataPermissionCurrentUser currentUser = new DataPermissionCurrentUser(); currentUser.setUserId(Convert.toStr(loginUser.getId())); currentUser.setDeptId(Convert.toStr(loginUser.getDeptId())); - currentUser.setRoles(loginUser.getRoles().stream() - .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), - DataScope.valueOf(r.getDataScope().name()))) + currentUser.setRoles(loginUser.getRoles() + .stream() + .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), DataScope.valueOf(r + .getDataScope() + .name()))) .collect(Collectors.toSet())); return currentUser; } diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java index 255bc574..f7c0a748 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java @@ -48,8 +48,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { /** * 插入数据时填充 * - * @param metaObject - * 元对象 + * @param metaObject 元对象 */ @Override public void insertFill(MetaObject metaObject) { @@ -77,8 +76,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { /** * 修改数据时填充 * - * @param metaObject - * 元对象 + * @param metaObject 元对象 */ @Override public void updateFill(MetaObject metaObject) { @@ -106,14 +104,10 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { /** * 填充字段值 * - * @param metaObject - * 元数据对象 - * @param fieldName - * 要填充的字段名 - * @param fillFieldValue - * 要填充的字段值 - * @param isOverride - * 如果字段值不为空,是否覆盖(true:覆盖;false:不覆盖) + * @param metaObject 元数据对象 + * @param fieldName 要填充的字段名 + * @param fillFieldValue 要填充的字段值 + * @param isOverride 如果字段值不为空,是否覆盖(true:覆盖;false:不覆盖) */ private void fillFieldValue(MetaObject metaObject, String fieldName, Object fillFieldValue, boolean isOverride) { if (metaObject.hasSetter(fieldName)) { diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/resp/CaptchaResp.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/resp/CaptchaResp.java index 04675ffe..8e3ba8ea 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/resp/CaptchaResp.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/resp/CaptchaResp.java @@ -47,7 +47,6 @@ public class CaptchaResp implements Serializable { /** * 验证码图片(Base64编码,带图片格式:data:image/gif;base64) */ - @Schema(description = "验证码图片(Base64编码,带图片格式:data:image/gif;base64)", - example = "data:image/png;base64,iVBORw0KGgoAAAAN...") + @Schema(description = "验证码图片(Base64编码,带图片格式:data:image/gif;base64)", example = "data:image/png;base64,iVBORw0KGgoAAAAN...") private String img; } diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java index 121e3d79..c3000813 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java @@ -38,10 +38,8 @@ public class SecureUtils { /** * 公钥加密 * - * @param data - * 要加密的内容 - * @param publicKey - * 公钥 + * @param data 要加密的内容 + * @param publicKey 公钥 * @return 公钥加密并 Base64 加密后的内容 */ public static String encryptByRsaPublicKey(String data, String publicKey) { @@ -51,8 +49,7 @@ public class SecureUtils { /** * 私钥解密 * - * @param data - * 要解密的内容(Base64 加密过) + * @param data 要解密的内容(Base64 加密过) * @return 解密后的内容 */ public static String decryptByRsaPrivateKey(String data) { @@ -64,10 +61,8 @@ public class SecureUtils { /** * 私钥解密 * - * @param data - * 要解密的内容(Base64 加密过) - * @param privateKey - * 私钥 + * @param data 要解密的内容(Base64 加密过) + * @param privateKey 私钥 * @return 解密后的内容 */ public static String decryptByRsaPrivateKey(String data, String privateKey) { @@ -77,10 +72,8 @@ public class SecureUtils { /** * MD5 加密 * - * @param data - * 要加密的内容 - * @param salt - * 盐 + * @param data 要加密的内容 + * @param salt 盐 * @return 加密后的内容 */ public static String md5Salt(String data, String salt) { diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java index 91d2a7ae..57755006 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java @@ -50,8 +50,7 @@ public class LoginHelper { /** * 用户登录并缓存用户信息 * - * @param loginUser - * 登录用户信息 + * @param loginUser 登录用户信息 * @return 令牌 */ public static String login(LoginUser loginUser) { @@ -93,8 +92,7 @@ public class LoginHelper { /** * 根据 Token 获取登录用户信息 * - * @param token - * 用户 Token + * @param token 用户 Token * @return 登录用户信息 */ public static LoginUser getLoginUser(String token) { @@ -135,8 +133,7 @@ public class LoginHelper { /** * 获取登录用户昵称 * - * @param userId - * 登录用户 ID + * @param userId 登录用户 ID * @return 登录用户昵称 */ public static String getNickname(Long userId) { diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java index 32adb104..79592392 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java @@ -66,8 +66,9 @@ public class LogDaoLocalImpl implements LogDao { LogDO logDO = new LogDO(); logDO.setDescription(logRecord.getDescription()); String module = logRecord.getModule(); - logDO.setModule( - StrUtil.isNotBlank(module) ? logRecord.getModule().replace("API", StringConstants.EMPTY).trim() : null); + logDO.setModule(StrUtil.isNotBlank(module) + ? logRecord.getModule().replace("API", StringConstants.EMPTY).trim() + : null); logDO.setCreateTime(LocalDateTime.ofInstant(logRecord.getTimestamp(), ZoneId.systemDefault())); logDO.setTimeTaken(logRecord.getTimeTaken().toMillis()); // 请求信息 @@ -105,16 +106,16 @@ public class LogDaoLocalImpl implements LogDao { logDO.setCreateUser(-1 != loginId ? loginId : null); } else if (result.isSuccess() && requestUri.startsWith(SysConstants.LOGIN_URI)) { AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); - logDO.setCreateUser( - ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); + logDO.setCreateUser(ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()) + .getId())); } } // 操作人 - if (!requestUri.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaderMap) - && requestHeaderMap.containsKey(HttpHeaders.AUTHORIZATION)) { + if (!requestUri.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaderMap) && requestHeaderMap + .containsKey(HttpHeaders.AUTHORIZATION)) { String authorization = requestHeaderMap.get(HttpHeaders.AUTHORIZATION); - String token = authorization.replace(SaManager.getConfig().getTokenPrefix() + StringConstants.SPACE, - StringConstants.EMPTY); + String token = authorization.replace(SaManager.getConfig() + .getTokenPrefix() + StringConstants.SPACE, StringConstants.EMPTY); logDO.setCreateUser(Convert.toLong(StpUtil.getLoginIdByToken(token))); } logMapper.insert(logDO); diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java index 324b94f1..a0e2e1a5 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java @@ -45,8 +45,7 @@ public interface LogMapper extends BaseMapper { /** * 查询仪表盘访问趋势信息 * - * @param days - * 日期数 + * @param days 日期数 * * @return 仪表盘访问趋势信息 */ diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/DashboardGeoDistributionResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/DashboardGeoDistributionResp.java index 6edc4440..42ffaa77 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/DashboardGeoDistributionResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/DashboardGeoDistributionResp.java @@ -47,7 +47,6 @@ public class DashboardGeoDistributionResp implements Serializable { /** * 地点 IP 统计信息 */ - @Schema(description = "地点 IP 统计信息", - example = "[{\"name\":\"中国北京北京市\",\"value\":1000},{\"name\":\"中国广东省深圳市\",\"value\": 500}]") + @Schema(description = "地点 IP 统计信息", example = "[{\"name\":\"中国北京北京市\",\"value\":1000},{\"name\":\"中国广东省深圳市\",\"value\": 500}]") private List> locationIpStatistics; } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/DashboardService.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/DashboardService.java index 4decab1b..f8b246b1 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/DashboardService.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/DashboardService.java @@ -42,8 +42,7 @@ public interface DashboardService { /** * 查询访问趋势信息 * - * @param days - * 日期数 + * @param days 日期数 * @return 访问趋势信息 */ List listAccessTrend(Integer days); diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/LogService.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/LogService.java index 2b718f40..c58b0d4b 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/LogService.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/LogService.java @@ -37,10 +37,8 @@ public interface LogService { /** * 分页查询操作日志列表 * - * @param query - * 查询条件 - * @param pageQuery - * 分页查询条件 + * @param query 查询条件 + * @param pageQuery 分页查询条件 * @return 操作日志分页信息 */ PageResp page(OperationLogQuery query, PageQuery pageQuery); @@ -48,10 +46,8 @@ public interface LogService { /** * 分页查询登录日志列表 * - * @param query - * 查询条件 - * @param pageQuery - * 分页查询条件 + * @param query 查询条件 + * @param pageQuery 分页查询条件 * @return 登录日志分页信息 */ PageResp page(LoginLogQuery query, PageQuery pageQuery); @@ -59,10 +55,8 @@ public interface LogService { /** * 分页查询系统日志列表 * - * @param query - * 查询条件 - * @param pageQuery - * 分页查询条件 + * @param query 查询条件 + * @param pageQuery 分页查询条件 * @return 系统日志分页信息 */ PageResp page(SystemLogQuery query, PageQuery pageQuery); @@ -70,8 +64,7 @@ public interface LogService { /** * 查看系统日志详情 * - * @param logId - * 日志 ID + * @param logId 日志 ID * @return 系统日志详情 */ SystemLogDetailResp get(Long logId); diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/DashboardServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/DashboardServiceImpl.java index 38f546c5..55c1edee 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/DashboardServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/DashboardServiceImpl.java @@ -59,7 +59,8 @@ public class DashboardServiceImpl implements DashboardService { Long todayPvCount = totalResp.getTodayPvCount(); Long yesterdayPvCount = totalResp.getYesterdayPvCount(); BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); - BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100) + BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) + ? BigDecimal.valueOf(100) : NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1); totalResp.setNewPvFromYesterday(newPvFromYesterday); return totalResp; @@ -78,7 +79,8 @@ public class DashboardServiceImpl implements DashboardService { Long todayPvCount = popularModule.getTodayPvCount(); Long yesterdayPvCount = popularModule.getYesterdayPvCount(); BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); - BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100) + BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) + ? BigDecimal.valueOf(100) : NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1); popularModule.setNewPvFromYesterday(newPvFromYesterday); } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java index b13a074f..cbe9b778 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java @@ -66,9 +66,10 @@ public class LogServiceImpl implements LogService { QueryWrapper queryWrapper = QueryHelper.build(query); // 限定查询信息 List fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogResp.class); - List columnNameList = - fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) - .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); + List columnNameList = fieldNameList.stream() + .filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) + .map(StrUtil::toUnderlineCase) + .collect(Collectors.toList()); queryWrapper.select(columnNameList); // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); @@ -89,9 +90,10 @@ public class LogServiceImpl implements LogService { queryWrapper.eq("module", "登录"); // 限定查询信息 List fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogResp.class); - List columnNameList = - fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) - .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); + List columnNameList = fieldNameList.stream() + .filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) + .map(StrUtil::toUnderlineCase) + .collect(Collectors.toList()); queryWrapper.select(columnNameList); // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); @@ -106,9 +108,10 @@ public class LogServiceImpl implements LogService { QueryWrapper queryWrapper = QueryHelper.build(query); // 限定查询信息 List fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogResp.class); - List columnNameList = - fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) - .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); + List columnNameList = fieldNameList.stream() + .filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) + .map(StrUtil::toUnderlineCase) + .collect(Collectors.toList()); queryWrapper.select(columnNameList); // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); @@ -150,8 +153,7 @@ public class LogServiceImpl implements LogService { /** * 填充数据 * - * @param logResp - * 日志信息 + * @param logResp 日志信息 */ private void fill(LogResp logResp) { Long createUser = logResp.getCreateUser(); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/req/AccountLoginReq.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/req/AccountLoginReq.java index e6bf0c3a..eb415ab6 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/req/AccountLoginReq.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/req/AccountLoginReq.java @@ -48,8 +48,7 @@ public class AccountLoginReq implements Serializable { /** * 密码(加密) */ - @Schema(description = "密码(加密)", - example = "HHwZoiBwCfh0xLdWOAd0bHOkEZlIMMOQKJyeFUw9T3ArrhL57od2i42s1o0sSXKkeHPJXvQsninhPFH2lArDDQ==") + @Schema(description = "密码(加密)", example = "HHwZoiBwCfh0xLdWOAd0bHOkEZlIMMOQKJyeFUw9T3ArrhL57od2i42s1o0sSXKkeHPJXvQsninhPFH2lArDDQ==") @NotBlank(message = "密码不能为空") private String password; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/LoginResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/LoginResp.java index fc9894ec..77b33dda 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/LoginResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/LoginResp.java @@ -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; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java index 2c199412..89c971ae 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java @@ -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; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/UserInfoResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/UserInfoResp.java index 8208b08e..a10d8fef 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/UserInfoResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/UserInfoResp.java @@ -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; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/LoginService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/LoginService.java index c8969066..3fe4c91e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/LoginService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/LoginService.java @@ -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 buildRouteTree(Long userId); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/OnlineUserService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/OnlineUserService.java index a07d5320..eb53b6f7 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/OnlineUserService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/OnlineUserService.java @@ -35,10 +35,8 @@ public interface OnlineUserService { /** * 分页查询列表 * - * @param query - * 查询条件 - * @param pageQuery - * 分页查询条件 + * @param query 查询条件 + * @param pageQuery 分页查询条件 * @return 分页列表信息 */ PageResp page(OnlineUserQuery query, PageQuery pageQuery); @@ -46,8 +44,7 @@ public interface OnlineUserService { /** * 查询列表 * - * @param query - * 查询条件 + * @param query 查询条件 * @return 列表信息 */ List list(OnlineUserQuery query); @@ -55,8 +52,7 @@ public interface OnlineUserService { /** * 根据角色 ID 清除 * - * @param roleId - * 角色 ID + * @param roleId 角色 ID */ void cleanByRoleId(Long roleId); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/PermissionService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/PermissionService.java index 551adb7d..5823e514 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/PermissionService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/PermissionService.java @@ -29,8 +29,7 @@ public interface PermissionService { /** * 根据用户 ID 查询权限码 * - * @param userId - * 用户 ID + * @param userId 用户 ID * @return 权限码集合 */ Set listPermissionByUserId(Long userId); @@ -38,8 +37,7 @@ public interface PermissionService { /** * 根据用户 ID 查询角色编码 * - * @param userId - * 用户 ID + * @param userId 用户 ID * @return 角色编码集合 */ Set listRoleCodeByUserId(Long userId); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java index 350e1890..f034824e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java @@ -162,8 +162,9 @@ public class LoginServiceImpl implements LoginService { } else { roleCodeSet.forEach(roleCode -> menuSet.addAll(menuService.listByRoleCode(roleCode))); } - List menuList = - menuSet.stream().filter(m -> !MenuTypeEnum.BUTTON.equals(m.getType())).collect(Collectors.toList()); + List 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(); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/OnlineUserServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/OnlineUserServiceImpl.java index a462aabb..19b2dcf6 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/OnlineUserServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/OnlineUserServiceImpl.java @@ -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 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; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/config/FileRecorderImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/config/FileRecorderImpl.java index 5ea49e08..a9ccc489 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/config/FileRecorderImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/config/FileRecorderImpl.java @@ -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 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)); } } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java index c1b4ba3f..7e5b015a 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java @@ -69,13 +69,13 @@ public enum FileTypeEnum implements IBaseEnum { /** * 根据扩展名查询 * - * @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); } } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java index 97fbe27c..96dd211d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java @@ -35,8 +35,7 @@ public interface DictItemMapper extends BaseMapper { /** * 根据字典编码查询 * - * @param dictCode - * 字典编码 + * @param dictCode 字典编码 * @return 字典项列表 */ List listByDictCode(@Param("dictCode") String dictCode); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java index fd26c79f..a7b99ffe 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java @@ -35,8 +35,7 @@ public interface MenuMapper extends BaseMapper { /** * 根据用户 ID 查询权限码 * - * @param userId - * 用户 ID + * @param userId 用户 ID * @return 权限码集合 */ Set selectPermissionByUserId(@Param("userId") Long userId); @@ -44,8 +43,7 @@ public interface MenuMapper extends BaseMapper { /** * 根据角色编码查询 * - * @param roleCode - * 角色编码 + * @param roleCode 角色编码 * @return 菜单列表 */ List selectListByRoleCode(@Param("roleCode") String roleCode); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java index 93f8668d..a0db2d39 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java @@ -37,12 +37,10 @@ public interface MessageMapper extends BaseMapper { /** * 分页查询列表 * - * @param page - * 分页查询条件 - * @param queryWrapper - * 查询条件 + * @param page 分页查询条件 + * @param queryWrapper 查询条件 * @return 分页信息 */ IPage selectPageByUserId(@Param("page") IPage page, - @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java index c9ee3041..c6e0fc7e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java @@ -32,10 +32,8 @@ public interface MessageUserMapper extends BaseMapper { /** * 根据用户 ID 和消息类型查询未读消息数量 * - * @param userId - * 用户 ID - * @param type - * 消息类型 + * @param userId 用户 ID + * @param type 消息类型 * @return 未读消息信息 */ Long selectUnreadCountByUserIdAndType(@Param("userId") Long userId, @Param("type") Integer type); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java index 32238858..efed6bfb 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java @@ -35,8 +35,7 @@ public interface RoleDeptMapper extends BaseMapper { /** * 根据角色 ID 查询 * - * @param roleId - * 角色 ID + * @param roleId 角色 ID * @return 部门 ID 列表 */ @Select("SELECT `dept_id` FROM `sys_role_dept` WHERE `role_id` = #{roleId}") diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java index 14a2bb80..ca95e55d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java @@ -32,8 +32,7 @@ public interface RoleMenuMapper extends BaseMapper { /** * 根据角色 ID 列表查询 * - * @param roleIds - * 角色 ID 列表 + * @param roleIds 角色 ID 列表 * @return 菜单 ID 列表 */ List selectMenuIdByRoleIds(List roleIds); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java index eaab379a..9cee82a3 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java @@ -33,8 +33,7 @@ public interface UserMapper extends DataPermissionMapper { /** * 根据用户名查询 * - * @param username - * 用户名 + * @param username 用户名 * @return 用户信息 */ @Select("SELECT * FROM `sys_user` WHERE `username` = #{username}") @@ -43,8 +42,7 @@ public interface UserMapper extends DataPermissionMapper { /** * 根据手机号查询 * - * @param phone - * 手机号 + * @param phone 手机号 * @return 用户信息 */ @Select("SELECT * FROM `sys_user` WHERE `phone` = #{phone}") @@ -53,8 +51,7 @@ public interface UserMapper extends DataPermissionMapper { /** * 根据邮箱查询 * - * @param email - * 邮箱 + * @param email 邮箱 * @return 用户信息 */ @Select("SELECT * FROM `sys_user` WHERE `email` = #{email}") @@ -63,8 +60,7 @@ public interface UserMapper extends DataPermissionMapper { /** * 根据 ID 查询昵称 * - * @param id - * ID + * @param id ID * @return 昵称 */ @Select("SELECT `nickname` FROM `sys_user` WHERE `id` = #{id}") diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java index 4468082d..28e09e61 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java @@ -35,8 +35,7 @@ public interface UserRoleMapper extends BaseMapper { /** * 根据用户 ID 查询 * - * @param userId - * 用户 ID + * @param userId 用户 ID * @return 角色 ID 列表 */ @Select("SELECT `role_id` FROM `sys_user_role` WHERE `user_id` = #{userId}") diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java index ec7b0daa..74a786be 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java @@ -32,10 +32,8 @@ public interface UserSocialMapper extends BaseMapper { /** * 根据来源和开放 ID 查询 * - * @param source - * 来源 - * @param openId - * 开放 ID + * @param source 来源 + * @param openId 开放 ID * @return 用户社会化关联信息 */ UserSocialDO selectBySourceAndOpenId(@Param("source") String source, @Param("openId") String openId); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java index 6e4fc521..910aab1d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java @@ -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; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/RoleReq.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/RoleReq.java index a87c2384..2e771e2e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/RoleReq.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/RoleReq.java @@ -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; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserEmailUpdateRequest.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserEmailUpdateRequest.java index b1d51fad..078b1c5a 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserEmailUpdateRequest.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserEmailUpdateRequest.java @@ -62,8 +62,7 @@ public class UserEmailUpdateRequest implements Serializable { /** * 当前密码(加密后) */ - @Schema(description = "当前密码(加密后)", - example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") + @Schema(description = "当前密码(加密后)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") @NotBlank(message = "当前密码不能为空") private String currentPassword; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPasswordUpdateReq.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPasswordUpdateReq.java index 345d6dd9..defa8e25 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPasswordUpdateReq.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPasswordUpdateReq.java @@ -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; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPhoneUpdateReq.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPhoneUpdateReq.java index 880976c3..511300b2 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPhoneUpdateReq.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/UserPhoneUpdateReq.java @@ -62,8 +62,7 @@ public class UserPhoneUpdateReq implements Serializable { /** * 当前密码(加密后) */ - @Schema(description = "当前密码(加密后)", - example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") + @Schema(description = "当前密码(加密后)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") @NotBlank(message = "当前密码不能为空") private String currentPassword; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/AvatarResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/AvatarResp.java index 6784fb57..8bed064d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/AvatarResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/AvatarResp.java @@ -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; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java index 62766f9f..263b0df4 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java @@ -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; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleDetailResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleDetailResp.java index 0beacd3e..efddea73 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleDetailResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleDetailResp.java @@ -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; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleResp.java index 75bdacea..2bd98d6e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/RoleResp.java @@ -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; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserDetailResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserDetailResp.java index 06c6d811..871a9900 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserDetailResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserDetailResp.java @@ -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; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserResp.java index 069e6232..69c56ad2 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/UserResp.java @@ -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; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/AnnouncementService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/AnnouncementService.java index ae306ee9..f02ddb77 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/AnnouncementService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/AnnouncementService.java @@ -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 { +public interface AnnouncementService extends BaseService { /** * 查询仪表盘公告列表 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java index 23110fe6..4203c9e9 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java @@ -36,8 +36,7 @@ public interface DictItemService extends BaseService listByDictId(Long dictId); @@ -45,8 +44,7 @@ public interface DictItemService extends BaseService listByDictCode(String dictCode); @@ -54,8 +52,7 @@ public interface DictItemService extends BaseService dictIds); } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java index ea0011f9..a885d02b 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java @@ -37,8 +37,7 @@ public interface FileService extends BaseService storageIds); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MenuService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MenuService.java index ced00bf9..ece18ca8 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MenuService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MenuService.java @@ -35,8 +35,7 @@ public interface MenuService extends BaseService listPermissionByUserId(Long userId); @@ -44,8 +43,7 @@ public interface MenuService extends BaseService listByRoleCode(String roleCode); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageService.java index 8a15b5dc..c164a24b 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageService.java @@ -35,10 +35,8 @@ public interface MessageService { /** * 分页查询列表 * - * @param query - * 查询条件 - * @param pageQuery - * 分页查询条件 + * @param query 查询条件 + * @param pageQuery 分页查询条件 * @return 分页列表信息 */ PageResp 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 userIdList); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageUserService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageUserService.java index 493a29f2..14db41ca 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageUserService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/MessageUserService.java @@ -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 userIdList); @@ -60,8 +56,7 @@ public interface MessageUserService { /** * 根据消息 ID 删除 * - * @param messageIds - * 消息 ID 列表 + * @param messageIds 消息 ID 列表 */ void deleteByMessageIds(List messageIds); } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/OptionService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/OptionService.java index ccb1aa88..1dd60d7b 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/OptionService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/OptionService.java @@ -34,8 +34,7 @@ public interface OptionService { /** * 查询列表 * - * @param query - * 查询条件 + * @param query 查询条件 * @return 列表信息 */ List list(OptionQuery query); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleDeptService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleDeptService.java index 7b106894..1bf1b471 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleDeptService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleDeptService.java @@ -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 deptIds, Long roleId); @@ -40,24 +38,21 @@ public interface RoleDeptService { /** * 根据角色 ID 删除 * - * @param roleIds - * 角色 ID 列表 + * @param roleIds 角色 ID 列表 */ void deleteByRoleIds(List roleIds); /** * 根据部门 ID 删除 * - * @param deptIds - * 部门 ID 列表 + * @param deptIds 部门 ID 列表 */ void deleteByDeptIds(List deptIds); /** * 根据角色 ID 查询 * - * @param roleId - * 角色 ID + * @param roleId 角色 ID * @return 部门 ID 列表 */ List listDeptIdByRoleId(Long roleId); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleMenuService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleMenuService.java index 72f26537..a18b5703 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleMenuService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleMenuService.java @@ -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 menuIds, Long roleId); @@ -40,16 +38,14 @@ public interface RoleMenuService { /** * 根据角色 ID 删除 * - * @param roleIds - * 角色 ID 列表 + * @param roleIds 角色 ID 列表 */ void deleteByRoleIds(List roleIds); /** * 根据角色 ID 查询 * - * @param roleIds - * 角色 ID 列表 + * @param roleIds 角色 ID 列表 * @return 菜单 ID 列表 */ List listMenuIdByRoleIds(List roleIds); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleService.java index e303373d..a013de11 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/RoleService.java @@ -39,8 +39,7 @@ public interface RoleService extends BaseService> buildDict(List list); @@ -57,8 +56,7 @@ public interface RoleService extends BaseService listCodeByUserId(Long userId); @@ -66,8 +64,7 @@ public interface RoleService extends BaseService listByUserId(Long userId); @@ -75,8 +72,7 @@ public interface RoleService extends BaseService roleIds, Long userId); @@ -40,16 +38,14 @@ public interface UserRoleService { /** * 根据用户 ID 删除 * - * @param userIds - * 用户 ID 列表 + * @param userIds 用户 ID 列表 */ void deleteByUserIds(List userIds); /** * 根据用户 ID 查询 * - * @param userId - * 用户 ID + * @param userId 用户 ID * @return 角色 ID 列表 */ List listRoleIdByUserId(Long userId); @@ -57,8 +53,7 @@ public interface UserRoleService { /** * 根据角色 ID 列表查询 * - * @param roleIds - * 角色 ID 列表 + * @param roleIds 角色 ID 列表 * @return 总记录数 */ Long countByRoleIds(List roleIds); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserService.java index 3aa6899f..8b09e03d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserService.java @@ -40,8 +40,7 @@ public interface UserService extends BaseService deptIds); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserSocialService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserSocialService.java index 105aa303..48131898 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserSocialService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/UserSocialService.java @@ -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 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); } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/AnnouncementServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/AnnouncementServiceImpl.java index 0d62382e..962e446e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/AnnouncementServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/AnnouncementServiceImpl.java @@ -40,8 +40,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; */ @Service @RequiredArgsConstructor -public class AnnouncementServiceImpl extends BaseServiceImpl implements AnnouncementService { +public class AnnouncementServiceImpl extends BaseServiceImpl implements AnnouncementService { @Override public List listDashboard() { diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java index f7573765..ec816ddc 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java @@ -54,8 +54,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; */ @Service @RequiredArgsConstructor -public class DeptServiceImpl extends BaseServiceImpl - implements DeptService { +public class DeptServiceImpl extends BaseServiceImpl implements DeptService { @Resource private UserService userService; @@ -88,13 +87,14 @@ public class DeptServiceImpl extends BaseServiceImpl 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 ids) { - List list = - baseMapper.lambdaQuery().select(DeptDO::getName, DeptDO::getIsSystem).in(DeptDO::getId, ids).list(); + List list = baseMapper.lambdaQuery() + .select(DeptDO::getName, DeptDO::getIsSystem) + .in(DeptDO::getId, ids) + .list(); Optional 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 listChildren(Long id) { @@ -205,12 +204,9 @@ public class DeptServiceImpl extends BaseServiceImpl children = this.listChildren(id); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java index 16bd44ef..bd16a757 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java @@ -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 - implements DictItemService { +public class DictItemServiceImpl extends BaseServiceImpl 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(); } } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java index 268cb08c..2df95580 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java @@ -49,8 +49,7 @@ import top.charles7c.continew.starter.file.excel.util.ExcelUtils; */ @Service @RequiredArgsConstructor -public class DictServiceImpl extends BaseServiceImpl - implements DictService { +public class DictServiceImpl extends BaseServiceImpl implements DictService { private final DictItemService dictItemService; @@ -79,11 +78,13 @@ public class DictServiceImpl extends BaseServiceImpl ids) { - List list = - baseMapper.lambdaQuery().select(DictDO::getName, DictDO::getIsSystem).in(DictDO::getId, ids).list(); + List list = baseMapper.lambdaQuery() + .select(DictDO::getName, DictDO::getIsSystem) + .in(DictDO::getId, ids) + .list(); Optional 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 - implements FileService { +public class FileServiceImpl extends BaseServiceImpl implements FileService { @Resource private StorageService storageService; @@ -107,7 +106,8 @@ public class FileServiceImpl extends BaseServiceImpl - implements MenuService { +public class MenuServiceImpl extends BaseServiceImpl implements MenuService { @Override @CacheEvict(allEntries = true) @@ -101,16 +100,16 @@ public class MenuServiceImpl extends BaseServiceImpl 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 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleDeptServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleDeptServiceImpl.java index 75a4bf7b..1d8feb1b 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleDeptServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleDeptServiceImpl.java @@ -46,16 +46,22 @@ public class RoleDeptServiceImpl implements RoleDeptService { @Transactional(rollbackFor = Exception.class) public boolean add(List deptIds, Long roleId) { // 检查是否有变更 - List oldDeptIdList = roleDeptMapper.lambdaQuery().select(RoleDeptDO::getDeptId) - .eq(RoleDeptDO::getRoleId, roleId).list().stream().map(RoleDeptDO::getDeptId).collect(Collectors.toList()); + List 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 roleDeptList = - deptIds.stream().map(deptId -> new RoleDeptDO(roleId, deptId)).collect(Collectors.toList()); + List roleDeptList = deptIds.stream() + .map(deptId -> new RoleDeptDO(roleId, deptId)) + .collect(Collectors.toList()); return roleDeptMapper.insertBatch(roleDeptList); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleMenuServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleMenuServiceImpl.java index be0af032..7a01353a 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleMenuServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleMenuServiceImpl.java @@ -47,16 +47,22 @@ public class RoleMenuServiceImpl implements RoleMenuService { @Transactional(rollbackFor = Exception.class) public boolean add(List menuIds, Long roleId) { // 检查是否有变更 - List oldMenuIdList = roleMenuMapper.lambdaQuery().select(RoleMenuDO::getMenuId) - .eq(RoleMenuDO::getRoleId, roleId).list().stream().map(RoleMenuDO::getMenuId).collect(Collectors.toList()); + List 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 roleMenuList = - menuIds.stream().map(menuId -> new RoleMenuDO(roleId, menuId)).collect(Collectors.toList()); + List roleMenuList = menuIds.stream() + .map(menuId -> new RoleMenuDO(roleId, menuId)) + .collect(Collectors.toList()); return roleMenuMapper.insertBatch(roleMenuList); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java index f27a7d22..67661585 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java @@ -55,8 +55,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; */ @Service @RequiredArgsConstructor -public class RoleServiceImpl extends BaseServiceImpl - implements RoleService { +public class RoleServiceImpl extends BaseServiceImpl implements RoleService { private final MenuService menuService; private final OnlineUserService onlineUserService; @@ -93,8 +92,8 @@ public class RoleServiceImpl extends BaseServiceImpl ids) { - List list = - baseMapper.lambdaQuery().select(RoleDO::getName, RoleDO::getIsSystem).in(RoleDO::getId, ids).list(); + List list = baseMapper.lambdaQuery() + .select(RoleDO::getName, RoleDO::getIsSystem) + .in(RoleDO::getId, ids) + .list(); Optional 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 - implements StorageService { +public class StorageServiceImpl extends BaseServiceImpl 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) { diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserRoleServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserRoleServiceImpl.java index 9bd9b16a..c89941bf 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserRoleServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserRoleServiceImpl.java @@ -46,16 +46,22 @@ public class UserRoleServiceImpl implements UserRoleService { @Transactional(rollbackFor = Exception.class) public boolean add(List roleIds, Long userId) { // 检查是否有变更 - List oldRoleIdList = userRoleMapper.lambdaQuery().select(UserRoleDO::getRoleId) - .eq(UserRoleDO::getUserId, userId).list().stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); + List 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 userRoleList = - roleIds.stream().map(roleId -> new UserRoleDO(userId, roleId)).collect(Collectors.toList()); + List userRoleList = roleIds.stream() + .map(roleId -> new UserRoleDO(userId, roleId)) + .collect(Collectors.toList()); return userRoleMapper.insertBatch(userRoleList); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java index 2f3c71b4..9eaaf99c 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java @@ -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 - implements UserService, CommonUserService { +public class UserServiceImpl extends BaseServiceImpl implements UserService, CommonUserService { @Resource private DeptService deptService; @@ -97,7 +96,9 @@ public class UserServiceImpl extends BaseServiceImpl disjunctionRoleIds = - CollUtil.disjunction(req.getRoleIds(), userRoleService.listRoleIdByUserId(id)); + CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置用户,不允许禁用", oldUser + .getNickname()); + Collection disjunctionRoleIds = CollUtil.disjunction(req.getRoleIds(), userRoleService + .listRoleIdByUserId(id)); CheckUtils.throwIfNotEmpty(disjunctionRoleIds, "[{}] 是系统内置用户,不允许变更所属角色", oldUser.getNickname()); } // 更新信息 @@ -134,11 +134,13 @@ public class UserServiceImpl extends BaseServiceImpl ids) { CheckUtils.throwIf(CollUtil.contains(ids, LoginHelper.getUserId()), "不允许删除当前用户"); - List list = - baseMapper.lambdaQuery().select(UserDO::getNickname, UserDO::getIsSystem).in(UserDO::getId, ids).list(); + List list = baseMapper.lambdaQuery() + .select(UserDO::getNickname, UserDO::getIsSystem) + .in(UserDO::getId, ids) + .list(); Optional 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 { /** * 根据表名称查询 * - * @param tableName - * 表名称 + * @param tableName 表名称 * @return 字段配置信息 */ @Select("SELECT * FROM `gen_field_config` WHERE `table_name` = #{tableName}") diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java index 081ca781..31f8558e 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java @@ -136,8 +136,8 @@ public class FieldConfigDO implements Serializable { /** * 查询方式 */ - @Schema(description = "查询方式", type = "Integer", - allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"}, example = "1") + @Schema(description = "查询方式", type = "Integer", allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9", + "10", "11", "12", "13", "14"}, example = "1") private QueryTypeEnum queryType; /** diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java index 81a37771..eb47bc06 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java @@ -144,7 +144,8 @@ public class GenConfigDO implements Serializable { public String getClassNamePrefix() { String rawClassName = StrUtil.isNotBlank(this.tablePrefix) - ? StrUtil.removePrefix(this.tableName, this.tablePrefix) : this.tableName; + ? StrUtil.removePrefix(this.tableName, this.tablePrefix) + : this.tableName; return StrUtil.upperFirst(StrUtil.toCamelCase(rawClassName)); } } diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/GeneratorService.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/GeneratorService.java index 71abc17b..7706813a 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/GeneratorService.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/GeneratorService.java @@ -39,34 +39,27 @@ public interface GeneratorService { /** * 分页查询表信息列表 * - * @param query - * 查询条件 - * @param pageQuery - * 分页查询条件 + * @param query 查询条件 + * @param pageQuery 分页查询条件 * @return 表信息分页列表 - * @throws SQLException - * / + * @throws SQLException / */ PageResp pageTable(TableQuery query, PageQuery pageQuery) throws SQLException; /** * 查询生成配置信息 * - * @param tableName - * 表名称 + * @param tableName 表名称 * @return 生成配置信息 - * @throws SQLException - * / + * @throws SQLException / */ GenConfigDO getGenConfig(String tableName) throws SQLException; /** * 查询字段配置列表 * - * @param tableName - * 表名称 - * @param requireSync - * 是否需要同步 + * @param tableName 表名称 + * @param requireSync 是否需要同步 * @return 字段配置列表 */ List listFieldConfig(String tableName, Boolean requireSync); @@ -74,18 +67,15 @@ public interface GeneratorService { /** * 保存代码生成配置信息 * - * @param req - * 代码生成配置信息 - * @param tableName - * 表名称 + * @param req 代码生成配置信息 + * @param tableName 表名称 */ void saveConfig(GenConfigReq req, String tableName); /** * 生成预览 * - * @param tableName - * 表名称 + * @param tableName 表名称 * @return 预览信息 */ List preview(String tableName); @@ -93,8 +83,7 @@ public interface GeneratorService { /** * 生成代码 * - * @param tableName - * 表名称 + * @param tableName 表名称 */ void generate(String tableName); } diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java index a8d8f4ef..f196c09a 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java @@ -86,17 +86,16 @@ public class GeneratorServiceImpl implements GeneratorService { if (StrUtil.isNotBlank(tableName)) { tableList.removeIf(table -> !StrUtil.containsAny(table.getTableName(), tableName)); } - tableList.removeIf( - table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties.getExcludeTables())); - CollUtil.sort(tableList, - Comparator.comparing(Table::getCreateTime) - .thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime())) - .reversed()); + tableList.removeIf(table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties + .getExcludeTables())); + CollUtil.sort(tableList, Comparator.comparing(Table::getCreateTime) + .thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime())) + .reversed()); List tableRespList = BeanUtil.copyToList(tableList, TableResp.class); PageResp pageResp = PageResp.build(pageQuery.getPage(), pageQuery.getSize(), tableRespList); for (TableResp tableResp : pageResp.getList()) { - long count = genConfigMapper.selectCount( - Wrappers.lambdaQuery(GenConfigDO.class).eq(GenConfigDO::getTableName, tableResp.getTableName())); + long count = genConfigMapper.selectCount(Wrappers.lambdaQuery(GenConfigDO.class) + .eq(GenConfigDO::getTableName, tableResp.getTableName())); tableResp.setIsConfiged(count > 0); } return pageResp; @@ -117,8 +116,9 @@ public class GeneratorServiceImpl implements GeneratorService { genConfig.setBusinessName(StrUtil.replace(table.getComment(), "表", StringConstants.EMPTY)); } // 默认作者名称(上次保存使用的作者名称) - GenConfigDO lastGenConfig = genConfigMapper.selectOne( - Wrappers.lambdaQuery(GenConfigDO.class).orderByDesc(GenConfigDO::getCreateTime).last("LIMIT 1")); + GenConfigDO lastGenConfig = genConfigMapper.selectOne(Wrappers.lambdaQuery(GenConfigDO.class) + .orderByDesc(GenConfigDO::getCreateTime) + .last("LIMIT 1")); if (null != lastGenConfig) { genConfig.setAuthor(lastGenConfig.getAuthor()); } @@ -151,8 +151,8 @@ public class GeneratorServiceImpl implements GeneratorService { FieldConfigDO fieldConfig = fieldConfigMap.get(column.getName()); if (null != fieldConfig) { // 更新已有字段配置 - String columnType = - StrUtil.splitToArray(column.getTypeName(), StringConstants.SPACE)[0].toLowerCase(); + String columnType = StrUtil.splitToArray(column.getTypeName(), StringConstants.SPACE)[0] + .toLowerCase(); fieldConfig.setColumnType(columnType); fieldConfig.setColumnSize(column.getSize()); fieldConfig.setComment(column.getComment()); @@ -219,8 +219,8 @@ public class GeneratorServiceImpl implements GeneratorService { Map genConfigMap = BeanUtil.beanToMap(genConfig); genConfigMap.put("date", DateUtil.date().toString("yyyy/MM/dd HH:mm")); String packageName = genConfig.getPackageName(); - String apiModuleName = - StrUtil.subSuf(packageName, StrUtil.lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); + String apiModuleName = StrUtil.subSuf(packageName, StrUtil + .lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); genConfigMap.put("apiModuleName", apiModuleName); genConfigMap.put("apiName", StrUtil.lowerFirst(genConfig.getClassNamePrefix())); // 渲染后端代码 @@ -274,19 +274,20 @@ public class GeneratorServiceImpl implements GeneratorService { // 例如:D:/continew-admin/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool List backendModuleChildPathList = CollUtil.newArrayList("src", "main", "java"); backendModuleChildPathList.addAll(StrUtil.split(packageName, StringConstants.DOT)); - File backendParentFile = - FileUtil.file(backendModuleFile, backendModuleChildPathList.toArray(new String[0])); + File backendParentFile = FileUtil.file(backendModuleFile, backendModuleChildPathList + .toArray(new String[0])); // 2.生成代码 - List backendCodePreviewList = - generatePreviewList.stream().filter(GeneratePreviewResp::isBackend).collect(Collectors.toList()); + List backendCodePreviewList = generatePreviewList.stream() + .filter(GeneratePreviewResp::isBackend) + .collect(Collectors.toList()); Map templateConfigMap = generatorProperties.getTemplateConfigs(); for (GeneratePreviewResp codePreview : backendCodePreviewList) { // 例如:D:/continew-admin/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/XxxServiceImpl.java - TemplateConfig templateConfig = - templateConfigMap.get(codePreview.getFileName().replace(classNamePrefix, StringConstants.EMPTY) - .replace(FileNameUtil.EXT_JAVA, StringConstants.EMPTY)); - File classParentFile = FileUtil.file(backendParentFile, - StrUtil.splitToArray(templateConfig.getPackageName(), StringConstants.DOT)); + TemplateConfig templateConfig = templateConfigMap.get(codePreview.getFileName() + .replace(classNamePrefix, StringConstants.EMPTY) + .replace(FileNameUtil.EXT_JAVA, StringConstants.EMPTY)); + File classParentFile = FileUtil.file(backendParentFile, StrUtil.splitToArray(templateConfig + .getPackageName(), StringConstants.DOT)); File classFile = new File(classParentFile, codePreview.getFileName()); // 如果已经存在,且不允许覆盖,则跳过 if (classFile.exists() && !isOverride) { @@ -299,11 +300,12 @@ public class GeneratorServiceImpl implements GeneratorService { if (StrUtil.isBlank(frontendPath)) { return; } - List frontendCodePreviewList = - generatePreviewList.stream().filter(p -> !p.isBackend()).collect(Collectors.toList()); + List frontendCodePreviewList = generatePreviewList.stream() + .filter(p -> !p.isBackend()) + .collect(Collectors.toList()); // 1.生成 api 代码 - String apiModuleName = - StrUtil.subSuf(packageName, StrUtil.lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); + String apiModuleName = StrUtil.subSuf(packageName, StrUtil + .lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); GeneratePreviewResp apiCodePreview = frontendCodePreviewList.get(0); // 例如:D:/continew-admin-ui List frontendSubPathList = StrUtil.split(frontendPath, "src"); @@ -318,8 +320,8 @@ public class GeneratorServiceImpl implements GeneratorService { // 2.生成 view 代码 GeneratePreviewResp viewCodePreview = frontendCodePreviewList.get(1); // 例如:D:/continew-admin-ui/src/views/tool/xxx/index.vue - File indexFile = - FileUtil.file(frontendPath, apiModuleName, StrUtil.lowerFirst(classNamePrefix), "index.vue"); + File indexFile = FileUtil.file(frontendPath, apiModuleName, StrUtil + .lowerFirst(classNamePrefix), "index.vue"); if (indexFile.exists() && !isOverride) { return; } @@ -333,15 +335,13 @@ public class GeneratorServiceImpl implements GeneratorService { /** * 预处理生成配置 * - * @param genConfigMap - * 生成配置 - * @param originFieldConfigList - * 原始字段配置列表 - * @param templateConfigEntry - * 模板配置 + * @param genConfigMap 生成配置 + * @param originFieldConfigList 原始字段配置列表 + * @param templateConfigEntry 模板配置 */ - private void pretreatment(Map genConfigMap, List originFieldConfigList, - Map.Entry templateConfigEntry) { + private void pretreatment(Map genConfigMap, + List originFieldConfigList, + Map.Entry templateConfigEntry) { TemplateConfig templateConfig = templateConfigEntry.getValue(); // 移除需要忽略的字段 List fieldConfigList = originFieldConfigList.stream() @@ -365,8 +365,8 @@ public class GeneratorServiceImpl implements GeneratorService { genConfigMap.put("hasRequiredField", true); } QueryTypeEnum queryType = fieldConfig.getQueryType(); - if (null != queryType && StrUtil.equalsAny(queryType.name(), QueryTypeEnum.IN.name(), - QueryTypeEnum.NOT_IN.name(), QueryTypeEnum.BETWEEN.name())) { + if (null != queryType && StrUtil.equalsAny(queryType.name(), QueryTypeEnum.IN.name(), QueryTypeEnum.NOT_IN + .name(), QueryTypeEnum.BETWEEN.name())) { genConfigMap.put("hasListQueryField", true); } } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java index cbf69f7b..4e2812a0 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java @@ -112,8 +112,7 @@ public class AuthController { } @Operation(summary = "用户退出", description = "注销用户的当前登录") - @Parameter(name = "Authorization", description = "令牌", required = true, example = "Bearer xxxx-xxxx-xxxx-xxxx", - in = ParameterIn.HEADER) + @Parameter(name = "Authorization", description = "令牌", required = true, example = "Bearer xxxx-xxxx-xxxx-xxxx", in = ParameterIn.HEADER) @PostMapping("/logout") public R logout() { Object loginId = StpUtil.getLoginId(-1L); diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java index a2233139..6d1fea37 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java @@ -113,9 +113,7 @@ public class CaptchaController { @Operation(summary = "获取邮箱验证码", description = "发送验证码到指定邮箱") @GetMapping("/mail") - public R getMailCaptcha( - @NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexConstants.EMAIL, message = "邮箱格式错误") String email) - throws MessagingException { + public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexConstants.EMAIL, message = "邮箱格式错误") String email) throws MessagingException { String limitKeyPrefix = CacheConstants.LIMIT_KEY_PREFIX; String captchaKeyPrefix = CacheConstants.CAPTCHA_KEY_PREFIX; String limitCaptchaKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, email); @@ -126,8 +124,9 @@ public class CaptchaController { String captcha = RandomUtil.randomNumbers(captchaMail.getLength()); // 发送验证码 Long expirationInMinutes = captchaMail.getExpirationInMinutes(); - String content = TemplateUtils.render(captchaMail.getTemplatePath(), - Dict.create().set("captcha", captcha).set("expiration", expirationInMinutes)); + String content = TemplateUtils.render(captchaMail.getTemplatePath(), Dict.create() + .set("captcha", captcha) + .set("expiration", expirationInMinutes)); MailUtils.sendHtml(email, String.format("【%s】邮箱验证码", projectProperties.getName()), content); // 保存验证码 String captchaKey = RedisUtils.formatKey(captchaKeyPrefix, email); @@ -138,13 +137,13 @@ public class CaptchaController { @Operation(summary = "获取短信验证码", description = "发送验证码到指定手机号") @GetMapping("/sms") - public R getSmsCaptcha( - @NotBlank(message = "手机号不能为空") @Pattern(regexp = RegexConstants.MOBILE, message = "手机号格式错误") String phone, - CaptchaVO captchaReq, HttpServletRequest request) { + public R getSmsCaptcha(@NotBlank(message = "手机号不能为空") @Pattern(regexp = RegexConstants.MOBILE, message = "手机号格式错误") String phone, + CaptchaVO captchaReq, + HttpServletRequest request) { // 行为验证码校验 ResponseModel verificationRes = captchaService.verification(captchaReq); - ValidationUtils.throwIfNotEqual(verificationRes.getRepCode(), RepCodeEnum.SUCCESS.getCode(), - verificationRes.getRepMsg()); + ValidationUtils.throwIfNotEqual(verificationRes.getRepCode(), RepCodeEnum.SUCCESS.getCode(), verificationRes + .getRepMsg()); CaptchaProperties.CaptchaSms captchaSms = captchaProperties.getSms(); String templateId = captchaSms.getTemplateId(); String limitKeyPrefix = CacheConstants.LIMIT_KEY_PREFIX; @@ -152,20 +151,19 @@ public class CaptchaController { String limitTemplateKeyPrefix = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix); // 限制短信发送频率 // 1.同一号码同一短信模板,1分钟2条,1小时8条,24小时20条,e.g. LIMIT:CAPTCHA:XXX:188xxxxx:1 - CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils.formatKey(limitTemplateKeyPrefix, "MIN", phone, templateId), - RateType.OVERALL, 2, 60), "验证码发送过于频繁,请稍后后再试"); - CheckUtils - .throwIf(!RedisUtils.rateLimit(RedisUtils.formatKey(limitTemplateKeyPrefix, "HOUR", phone, templateId), - RateType.OVERALL, 8, 60 * 60), "验证码发送过于频繁,请稍后后再试"); - CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils.formatKey(limitTemplateKeyPrefix, "DAY", phone, templateId), - RateType.OVERALL, 20, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试"); + CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils + .formatKey(limitTemplateKeyPrefix, "MIN", phone, templateId), RateType.OVERALL, 2, 60), "验证码发送过于频繁,请稍后后再试"); + CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils + .formatKey(limitTemplateKeyPrefix, "HOUR", phone, templateId), RateType.OVERALL, 8, 60 * 60), "验证码发送过于频繁,请稍后后再试"); + CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils + .formatKey(limitTemplateKeyPrefix, "DAY", phone, templateId), RateType.OVERALL, 20, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试"); // 2.同一号码所有短信模板 24 小时 100 条,e.g. LIMIT:CAPTCHA:188xxxxx String limitPhoneKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, phone); - CheckUtils.throwIf(!RedisUtils.rateLimit(limitPhoneKey, RateType.OVERALL, 100, 60 * 60 * 24), - "验证码发送过于频繁,请稍后后再试"); + CheckUtils.throwIf(!RedisUtils + .rateLimit(limitPhoneKey, RateType.OVERALL, 100, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试"); // 3.同一 IP 每分钟限制发送 30 条,e.g. LIMIT:CAPTCHA:PHONE:1xx.1xx.1xx.1xx - String limitIpKey = - RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, "PHONE", JakartaServletUtil.getClientIP(request)); + String limitIpKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, "PHONE", JakartaServletUtil + .getClientIP(request)); CheckUtils.throwIf(!RedisUtils.rateLimit(limitIpKey, RateType.OVERALL, 30, 60), "验证码发送过于频繁,请稍后后再试"); // 生成验证码 String captcha = RandomUtil.randomNumbers(captchaSms.getLength()); @@ -175,8 +173,8 @@ public class CaptchaController { Map messageMap = MapUtil.newHashMap(2, true); messageMap.put("captcha", captcha); messageMap.put("expirationInMinutes", String.valueOf(expirationInMinutes)); - SmsResponse smsResponse = - smsBlend.sendMessage(phone, captchaSms.getTemplateId(), (LinkedHashMap)messageMap); + SmsResponse smsResponse = smsBlend.sendMessage(phone, captchaSms + .getTemplateId(), (LinkedHashMap)messageMap); CheckUtils.throwIf(!smsResponse.isSuccess(), "验证码发送失败"); // 保存验证码 String captchaKey = RedisUtils.formatKey(captchaKeyPrefix, phone); diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java index 324570f0..917f13f5 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java @@ -124,30 +124,31 @@ public class CommonController { @GetMapping("/option") @Cacheable(cacheNames = CacheConstants.OPTION_KEY_PREFIX) public R> listOption(@Validated OptionQuery query) { - return R.ok(optionService.list(query).stream().map(option -> new LabelValueResp(option.getCode(), - StrUtil.nullToDefault(option.getValue(), option.getDefaultValue()))).collect(Collectors.toList())); + return R.ok(optionService.list(query) + .stream() + .map(option -> new LabelValueResp(option.getCode(), StrUtil.nullToDefault(option.getValue(), option + .getDefaultValue()))) + .collect(Collectors.toList())); } /** * 根据枚举类名查询 * - * @param enumClassName - * 枚举类名 + * @param enumClassName 枚举类名 * @return 枚举类型 */ private Optional> getEnumClassByName(String enumClassName) { Set> classSet = ClassUtil.scanPackageBySuper(projectProperties.getBasePackage(), IBaseEnum.class); return classSet.stream() - .filter( - c -> StrUtil.equalsAnyIgnoreCase(c.getSimpleName(), enumClassName, StrUtil.toCamelCase(enumClassName))) + .filter(c -> StrUtil.equalsAnyIgnoreCase(c.getSimpleName(), enumClassName, StrUtil + .toCamelCase(enumClassName))) .findFirst(); } /** * 查询枚举字典 * - * @param enumClass - * 枚举类型 + * @param enumClass 枚举类型 * @return 枚举字典 */ private List listEnumDict(Class enumClass) { diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java index e0bc624e..5a7cd80a 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java @@ -60,9 +60,7 @@ public class OnlineUserController { } @Operation(summary = "强退在线用户", description = "强退在线用户") - @Parameter(name = "token", description = "令牌", - example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE", - in = ParameterIn.PATH) + @Parameter(name = "token", description = "令牌", example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE", in = ParameterIn.PATH) @SaCheckPermission("monitor:online:user:delete") @DeleteMapping("/{token}") public R kickout(@PathVariable String token) { diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java index 2f57ae71..5042fa3b 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java @@ -45,8 +45,7 @@ import top.charles7c.continew.starter.extension.crud.model.resp.R; @Tag(name = "公告管理 API") @RestController @CrudRequestMapping("/system/announcement") -public class AnnouncementController extends - BaseController { +public class AnnouncementController extends BaseController { @Override @SaCheckPermission("system:announcement:add") @@ -58,7 +57,7 @@ public class AnnouncementController extends @Override @SaCheckPermission("system:announcement:update") public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementReq req, - @PathVariable Long id) { + @PathVariable Long id) { this.checkTime(req); return super.update(req, id); } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java index 46cb0a12..d84915cf 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java @@ -38,5 +38,4 @@ import top.charles7c.continew.starter.extension.crud.enums.Api; @Tag(name = "字典项管理 API") @RestController @CrudRequestMapping(value = "/system/dict/item", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE}) -public class DictItemController - extends BaseController {} \ No newline at end of file +public class DictItemController extends BaseController {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/StorageController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/StorageController.java index 86cfdb9f..477da733 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/StorageController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/StorageController.java @@ -37,5 +37,4 @@ import top.charles7c.continew.starter.extension.crud.base.BaseController; @Tag(name = "存储库管理 API") @RestController @CrudRequestMapping("/system/storage") -public class StorageController - extends BaseController {} \ No newline at end of file +public class StorageController extends BaseController {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java index dc42ed9c..7ba5b148 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java @@ -95,14 +95,14 @@ public class UserCenterController { @Operation(summary = "修改密码", description = "修改用户登录密码") @PatchMapping("/password") public R updatePassword(@Validated @RequestBody UserPasswordUpdateReq updateReq) { - String rawOldPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getOldPassword())); + String rawOldPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq + .getOldPassword())); ValidationUtils.throwIfNull(rawOldPassword, "当前密码解密失败"); - String rawNewPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getNewPassword())); + String rawNewPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq + .getNewPassword())); ValidationUtils.throwIfNull(rawNewPassword, "新密码解密失败"); - ValidationUtils.throwIf(!ReUtil.isMatch(RegexConstants.PASSWORD, rawNewPassword), - "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字"); + ValidationUtils.throwIf(!ReUtil + .isMatch(RegexConstants.PASSWORD, rawNewPassword), "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字"); userService.updatePassword(rawOldPassword, rawNewPassword, LoginHelper.getUserId()); return R.ok("修改成功"); } @@ -110,8 +110,8 @@ public class UserCenterController { @Operation(summary = "修改手机号", description = "修改手机号") @PatchMapping("/phone") public R updatePhone(@Validated @RequestBody UserPhoneUpdateReq updateReq) { - String rawCurrentPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getCurrentPassword())); + String rawCurrentPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq + .getCurrentPassword())); ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败"); String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, updateReq.getNewPhone()); String captcha = RedisUtils.get(captchaKey); @@ -125,8 +125,8 @@ public class UserCenterController { @Operation(summary = "修改邮箱", description = "修改用户邮箱") @PatchMapping("/email") public R updateEmail(@Validated @RequestBody UserEmailUpdateRequest updateReq) { - String rawCurrentPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getCurrentPassword())); + String rawCurrentPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq + .getCurrentPassword())); ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败"); String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, updateReq.getNewEmail()); String captcha = RedisUtils.get(captchaKey); diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java index 0ce6eaef..89d4dc23 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java @@ -73,7 +73,7 @@ public class GeneratorController { @SaCheckPermission("tool:generator:list") @GetMapping("/field/{tableName}") public R> listFieldConfig(@PathVariable String tableName, - @RequestParam(required = false, defaultValue = "false") Boolean requireSync) { + @RequestParam(required = false, defaultValue = "false") Boolean requireSync) { return R.ok(generatorService.listFieldConfig(tableName, requireSync)); } diff --git a/continew-admin-webapi/src/test/java/top/charles7c/ContiNewAdminApplicationTests.java b/continew-admin-webapi/src/test/java/top/charles7c/ContiNewAdminApplicationTests.java index fed2f43d..9a4879fd 100644 --- a/continew-admin-webapi/src/test/java/top/charles7c/ContiNewAdminApplicationTests.java +++ b/continew-admin-webapi/src/test/java/top/charles7c/ContiNewAdminApplicationTests.java @@ -23,5 +23,6 @@ import org.springframework.boot.test.context.SpringBootTest; class ContiNewAdminApplicationTests { @Test - void contextLoads() {} + void contextLoads() { + } } diff --git a/pom.xml b/pom.xml index 92215f3a..fabf9797 100644 --- a/pom.xml +++ b/pom.xml @@ -121,15 +121,12 @@ - - java,jakarta,lombok,io,org,com,cn,top.charles7c, - - code-style/code-formatter.xml + .style/p3c-codestyle.xml - code-style/license-header + .style/license-header