mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
refactor: 根据 Sonar 建议调整,StrUtil => CharSequenceUtil
工具层调整以减少 Sonar 建议,应用层则可忽略,怎么用方便怎么来
This commit is contained in:
@@ -18,7 +18,7 @@ package top.charles7c.continew.starter.captcha.behavior.autoconfigure;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.anji.captcha.model.common.Const;
|
||||
import com.anji.captcha.service.CaptchaService;
|
||||
import com.anji.captcha.service.impl.CaptchaServiceFactory;
|
||||
@@ -81,8 +81,8 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
config.put(Const.CAPTCHA_FONT_TYPE, properties.getFontType());
|
||||
config.put(Const.CAPTCHA_TYPE, properties.getType().getCodeValue());
|
||||
config.put(Const.CAPTCHA_INTERFERENCE_OPTIONS, properties.getInterferenceOptions());
|
||||
config.put(Const.ORIGINAL_PATH_JIGSAW, StrUtil.emptyIfNull(properties.getJigsawBaseMapPath()));
|
||||
config.put(Const.ORIGINAL_PATH_PIC_CLICK, StrUtil.emptyIfNull(properties.getPicClickBaseMapPath()));
|
||||
config.put(Const.ORIGINAL_PATH_JIGSAW, CharSequenceUtil.emptyIfNull(properties.getJigsawBaseMapPath()));
|
||||
config.put(Const.ORIGINAL_PATH_PIC_CLICK, CharSequenceUtil.emptyIfNull(properties.getPicClickBaseMapPath()));
|
||||
config.put(Const.CAPTCHA_SLIP_OFFSET, properties.getSlipOffset());
|
||||
config.put(Const.CAPTCHA_AES_STATUS, String.valueOf(properties.getEnableAes()));
|
||||
config.put(Const.CAPTCHA_WATER_FONT, properties.getWaterFont());
|
||||
@@ -98,8 +98,8 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
config.put(Const.CAPTCHA_FONT_SIZE, properties.getFontSize());
|
||||
config.put(Const.CAPTCHA_FONT_STYLE, properties.getFontStyle());
|
||||
config.put(Const.CAPTCHA_WORD_COUNT, 4);
|
||||
if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || StrUtil.startWith(properties
|
||||
.getPicClickBaseMapPath(), "classpath:")) {
|
||||
if (CharSequenceUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || CharSequenceUtil
|
||||
.startWith(properties.getPicClickBaseMapPath(), "classpath:")) {
|
||||
// 自定义 resources 目录下初始化底图
|
||||
config.put(Const.CAPTCHA_INIT_ORIGINAL, true);
|
||||
initializeBaseMap(properties.getJigsawBaseMapPath(), properties.getPicClickBaseMapPath());
|
||||
|
@@ -17,7 +17,7 @@
|
||||
package top.charles7c.continew.starter.captcha.graphic.core;
|
||||
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import top.charles7c.continew.starter.captcha.graphic.autoconfigure.GraphicCaptchaProperties;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class GraphicCaptchaService {
|
||||
Captcha captcha = ReflectUtil.newInstance(properties.getType().getCaptchaImpl(), properties
|
||||
.getWidth(), properties.getHeight());
|
||||
captcha.setLen(properties.getLength());
|
||||
if (StrUtil.isNotBlank(properties.getFontName())) {
|
||||
if (CharSequenceUtil.isNotBlank(properties.getFontName())) {
|
||||
captcha.setFont(new Font(properties.getFontName(), Font.PLAIN, properties.getFontSize()));
|
||||
}
|
||||
return captcha;
|
||||
|
Reference in New Issue
Block a user