diff --git a/README.md b/README.md index d4287fac3..33699b2d9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Release -ContiNew Starter +ContiNew Starter Spring Boot @@ -229,7 +229,7 @@ public class DeptController extends BaseControllerArco Design | 2.56.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 | | TypeScript | 5.0.4 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 | | Vite | 5.1.5 | 下一代的前端工具链,为开发提供极速响应。 | -| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.8.0 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | +| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.8.1 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | | Spring Boot | 3.2.12 | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) | | Undertow | 2.3.17.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 | | Sa-Token + JWT | 1.39.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 | diff --git a/continew-module-system/src/main/java/top/continew/admin/system/enums/PasswordPolicyEnum.java b/continew-module-system/src/main/java/top/continew/admin/system/enums/PasswordPolicyEnum.java index 0ca4be9fa..cde757e56 100644 --- a/continew-module-system/src/main/java/top/continew/admin/system/enums/PasswordPolicyEnum.java +++ b/continew-module-system/src/main/java/top/continew/admin/system/enums/PasswordPolicyEnum.java @@ -18,7 +18,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; -import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; @@ -69,8 +69,9 @@ public void validateRange(int value, Map policyMap) { super.validateRange(value, policyMap); return; } - Integer passwordExpirationDays = ObjUtil.defaultIfNull(Convert.toInt(policyMap.get(PASSWORD_EXPIRATION_DAYS - .name())), SpringUtil.getBean(OptionService.class).getValueByCode2Int(PASSWORD_EXPIRATION_DAYS.name())); + Integer passwordExpirationDays = ObjectUtil.defaultIfNull(Convert.toInt(policyMap + .get(PASSWORD_EXPIRATION_DAYS.name())), SpringUtil.getBean(OptionService.class) + .getValueByCode2Int(PASSWORD_EXPIRATION_DAYS.name())); if (passwordExpirationDays > SysConstants.NO) { ValidationUtils.throwIf(value >= passwordExpirationDays, "密码到期前的提示时间应小于密码有效期"); return; diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java index 068338432..937d8bb01 100644 --- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java +++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java @@ -141,9 +141,8 @@ public void setTableName(String tableName) { */ @Schema(description = "类名前缀", example = "User") public String getClassNamePrefix() { - String tableName = this.getTableName(); - String rawClassName = StrUtils.blankToDefault(this.getTablePrefix(), tableName, prefix -> StrUtil - .removePrefix(tableName, prefix)); + String rawClassName = StrUtils.blankToDefault(this.getTablePrefix(), this.getTableName(), prefix -> StrUtil + .removePrefix(this.getTableName(), prefix)); return StrUtil.upperFirst(StrUtil.toCamelCase(rawClassName)); } } diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java index 8b72e6d2e..2ebd061ed 100644 --- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java +++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java @@ -28,10 +28,8 @@ import cn.hutool.extra.template.TemplateConfig; import cn.hutool.extra.template.TemplateEngine; import cn.hutool.extra.template.TemplateUtil; -import cn.hutool.extra.template.engine.freemarker.FreemarkerEngine; import cn.hutool.system.SystemUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import freemarker.ext.beans.BeansWrapper; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -291,10 +289,6 @@ private List preview(String tableName) { Map templateConfigMap = generatorProperties.getTemplateConfigs(); TemplateEngine engine = TemplateUtil .createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH)); - if (engine instanceof FreemarkerEngine freemarkerEngine) { - freemarkerEngine.getConfiguration() - .setSharedVariable("statics", BeansWrapper.getDefaultInstance().getStaticModels()); - } for (Map.Entry templateConfigEntry : templateConfigMap.entrySet()) { GeneratorProperties.TemplateConfig templateConfig = templateConfigEntry.getValue(); // 移除需要忽略的字段 diff --git a/continew-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java b/continew-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java index 27e491250..e4b74b0a1 100644 --- a/continew-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java +++ b/continew-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java @@ -41,7 +41,6 @@ import org.dromara.sms4j.api.entity.SmsResponse; import org.dromara.sms4j.comm.constant.SupplierConstant; import org.dromara.sms4j.core.factory.SmsFactory; -import org.redisson.api.RateIntervalUnit; import org.springframework.http.HttpHeaders; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -68,6 +67,7 @@ import java.time.LocalDateTime; import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; /** * 验证码 API @@ -141,11 +141,11 @@ public CaptchaResp getImageCaptcha() { @Operation(summary = "获取邮箱验证码", description = "发送验证码到指定邮箱") @GetMapping("/mail") @RateLimiters({ - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "MIN", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 2, interval = 1, unit = RateIntervalUnit.MINUTES, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "HOUR", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 8, interval = 1, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "DAY'", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 20, interval = 24, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#email", rate = 100, interval = 24, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#email", rate = 30, interval = 1, unit = RateIntervalUnit.MINUTES, type = LimitType.IP, message = "获取验证码操作太频繁,请稍后再试")}) + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "MIN", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 2, interval = 1, unit = TimeUnit.MINUTES, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "HOUR", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 8, interval = 1, unit = TimeUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "DAY'", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 20, interval = 24, unit = TimeUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#email", rate = 100, interval = 24, unit = TimeUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#email", rate = 30, interval = 1, unit = TimeUnit.MINUTES, type = LimitType.IP, message = "获取验证码操作太频繁,请稍后再试")}) public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexPool.EMAIL, message = "邮箱格式错误") String email, CaptchaVO captchaReq) throws MessagingException { // 行为验证码校验 @@ -188,11 +188,11 @@ public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regex @Operation(summary = "获取短信验证码", description = "发送验证码到指定手机号") @GetMapping("/sms") @RateLimiters({ - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "MIN", key = "#phone + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.sms.templateId')", rate = 2, interval = 1, unit = RateIntervalUnit.MINUTES, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "HOUR", key = "#phone + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.sms.templateId')", rate = 8, interval = 1, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "DAY'", key = "#phone + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.sms.templateId')", rate = 20, interval = 24, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#phone", rate = 100, interval = 24, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), - @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#phone", rate = 30, interval = 1, unit = RateIntervalUnit.MINUTES, type = LimitType.IP, message = "获取验证码操作太频繁,请稍后再试")}) + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "MIN", key = "#phone + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.sms.templateId')", rate = 2, interval = 1, unit = TimeUnit.MINUTES, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "HOUR", key = "#phone + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.sms.templateId')", rate = 8, interval = 1, unit = TimeUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "DAY'", key = "#phone + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.sms.templateId')", rate = 20, interval = 24, unit = TimeUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#phone", rate = 100, interval = 24, unit = TimeUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), + @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#phone", rate = 30, interval = 1, unit = TimeUnit.MINUTES, type = LimitType.IP, message = "获取验证码操作太频繁,请稍后再试")}) public R getSmsCaptcha(@NotBlank(message = "手机号不能为空") @Pattern(regexp = RegexPool.MOBILE, message = "手机号格式错误") String phone, CaptchaVO captchaReq) { // 行为验证码校验 diff --git a/continew-webapi/src/main/resources/banner.txt b/continew-webapi/src/main/resources/banner.txt index d4b9b07a3..f40ea21f6 100644 --- a/continew-webapi/src/main/resources/banner.txt +++ b/continew-webapi/src/main/resources/banner.txt @@ -5,5 +5,5 @@ \____|\___/ |_| |_| \__||_||_| \_| \___| \_/\_/ /_/ \_\\__,_||_| |_| |_||_||_| |_| :: ${project.name} :: v${project.version} - :: ContiNew Starter :: v2.8.0 + :: ContiNew Starter :: v2.8.1 :: Spring Boot :: v${spring-boot.version} diff --git a/pom.xml b/pom.xml index e76500907..40393608e 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ top.continew continew-starter - 2.8.0 + 2.8.1 top.continew