验证码开启升级

This commit is contained in:
xijue 2025-08-25 09:41:03 +08:00
parent 684039cc20
commit 7df50a2d1c
7 changed files with 41 additions and 66 deletions

View File

@ -9,6 +9,7 @@ import com.sxpcwlkj.common.code.entity.CaptchaEntity;
import com.sxpcwlkj.common.code.entity.ConfigEntity; import com.sxpcwlkj.common.code.entity.ConfigEntity;
import com.sxpcwlkj.common.constant.Constants; import com.sxpcwlkj.common.constant.Constants;
import com.sxpcwlkj.common.enums.ConfigKeyNum; import com.sxpcwlkj.common.enums.ConfigKeyNum;
import com.sxpcwlkj.common.enums.SystemCommonEnum;
import com.sxpcwlkj.common.properties.CaptchaProperties; import com.sxpcwlkj.common.properties.CaptchaProperties;
import com.sxpcwlkj.common.utils.DataUtil; import com.sxpcwlkj.common.utils.DataUtil;
import com.sxpcwlkj.redis.RedisUtil; import com.sxpcwlkj.redis.RedisUtil;
@ -22,6 +23,7 @@ import java.time.Duration;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@Slf4j @Slf4j
@ -45,12 +47,12 @@ public class CaptchaServiceImpl implements CaptchaService {
} }
convert.forEach(smsConfigEntity -> { convert.forEach(smsConfigEntity -> {
if("sys_base_captcha_state".equals(smsConfigEntity.getConfigKey())){ if("sys_base_captcha_state".equals(smsConfigEntity.getConfigKey())){
if(Convert.toInt(smsConfigEntity.getConfigValue()) == 1){ if(Objects.equals(Convert.toInt(smsConfigEntity.getConfigValue()), SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())){
isOpen.set(true); isOpen.set(true);
} }
} }
}); });
if (!captchaProperties.isStatus()||!isOpen.get()) { if (!isOpen.get()) {
data.put(CaptchaEntity.CODE.CAPTCHA_MSG.getValue(), "系统验证码未开启!"); data.put(CaptchaEntity.CODE.CAPTCHA_MSG.getValue(), "系统验证码未开启!");
return data; return data;
} }

View File

@ -1,8 +1,3 @@
--- # 项目基础信息
sxpcwlkj:
# 开启验证码: true开启 false 关闭
isOpenCaptcha: false
--- # powerjob 配置 --- # powerjob 配置
powerjob: powerjob:
worker: worker:
@ -10,7 +5,6 @@ powerjob:
enabled: false enabled: false
# 需要先在 powerjob 登录页执行应用注册后才能使用 # 需要先在 powerjob 登录页执行应用注册后才能使用
app-name: mms app-name: mms
enable-test-mode: false
max-appended-wf-context-length: 4096 max-appended-wf-context-length: 4096
max-result-length: 4096 max-result-length: 4096
# 28080 端口 随着主应用端口飘逸 避免集群冲突 # 28080 端口 随着主应用端口飘逸 避免集群冲突
@ -44,22 +38,25 @@ spring:
primary: master primary: master
# 严格模式 匹配不到数据源则报错 # 严格模式 匹配不到数据源则报错
strict: true strict: true
public-key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJssgtfcBfc+d8Et0FBGQRBonRRQBD8jB1UHTRbk3diOliGlec9lJxbGR/qp7Jp8uYozCr96lvpnIIJM59fNoeUCAwEAAQ==
# 账号密码
datasource: datasource:
# 主库数据源 # 主库数据源
master: master:
type: ${spring.datasource.type} type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true url: jdbc:mysql://119.28.10.247:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
username: root username: mms
password: 123456 # 由GeneratePassword.java 生成, public-key 和 password 要匹配
# 从库数据源 password: ENC(c6FYwkk1dtKxfAcOED4g4mAgzCoK6XTr6+VTXVfQYly9I02yiND8aK5vTeYJ+oJCGH4beQyZLl9H2kt1ZCXqJg==)
slave: # # 从库数据源
lazy: true # slave:
type: ${spring.datasource.type} # lazy: true
driverClassName: com.mysql.cj.jdbc.Driver # type: ${spring.datasource.type}
url: jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true # driverClassName: com.mysql.cj.jdbc.Driver
username: root # url: jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
password: 123456 # username: root
# password: 123456
# oracle: # oracle:
# type: ${spring.datasource.type} # type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver # driverClassName: oracle.jdbc.OracleDriver

View File

@ -1,8 +1,3 @@
--- # 项目基础信息
sxpcwlkj:
# 开启验证码: true开启 false 关闭
isOpenCaptcha: false
--- # powerjob 配置 --- # powerjob 配置
powerjob: powerjob:
worker: worker:
@ -43,8 +38,7 @@ spring:
primary: master primary: master
# 严格模式 匹配不到数据源则报错 # 严格模式 匹配不到数据源则报错
strict: true strict: true
# 账号加密,公钥 # 账号密码
datasource: datasource:
# 主库数据源 # 主库数据源
master: master:

View File

@ -1,8 +1,3 @@
--- # 项目基础信息
sxpcwlkj:
# 开启验证码: true开启 false 关闭
isOpenCaptcha: true
--- # powerjob 配置 --- # powerjob 配置
powerjob: powerjob:
worker: worker:
@ -10,7 +5,6 @@ powerjob:
enabled: false enabled: false
# 需要先在 powerjob 登录页执行应用注册后才能使用 # 需要先在 powerjob 登录页执行应用注册后才能使用
app-name: mms app-name: mms
enable-test-mode: false
max-appended-wf-context-length: 4096 max-appended-wf-context-length: 4096
max-result-length: 4096 max-result-length: 4096
# 28080 端口 随着主应用端口飘逸 避免集群冲突 # 28080 端口 随着主应用端口飘逸 避免集群冲突

View File

@ -12,8 +12,6 @@ sxpcwlkj:
copyrightYear: 2018 copyrightYear: 2018
# 机构团队 # 机构团队
organization: 陕西品创网络 organization: 陕西品创网络
# 开启验证码: true开启 false 关闭
isOpenCaptcha: false
# 演示模式配置 # 演示模式配置
demo: demo:
@ -23,12 +21,11 @@ demo:
allowed-users: # 白名单用户 allowed-users: # 白名单用户
- admin - admin
allowed-methods: allowed-methods:
- initSign
- updateIpById - updateIpById
--- # 验证码配置 --- # 验证码配置
captcha: captcha:
# 是否开启验证码: true 开启 false 关闭
status: true
# 页面 <参数设置> 可开启关闭 验证码校验 # 页面 <参数设置> 可开启关闭 验证码校验
# 线段干扰 LINE 圆圈干扰 CIRCLE 扭曲干扰 SHEAR 计算题型 CALCULATE # 线段干扰 LINE 圆圈干扰 CIRCLE 扭曲干扰 SHEAR 计算题型 CALCULATE
type: LINE type: LINE

View File

@ -14,12 +14,6 @@ import org.springframework.stereotype.Component;
@Component @Component
@ConfigurationProperties(prefix = "captcha") @ConfigurationProperties(prefix = "captcha")
public class CaptchaProperties { public class CaptchaProperties {
/**
* 是否开启验证码
*/
private boolean status;
/** /**
* 验证码类型 * 验证码类型
*/ */

View File

@ -33,8 +33,5 @@ public class MsProperties {
* 机构组织 * 机构组织
*/ */
private String organization; private String organization;
/**
* 是否开启验证码
*/
private Boolean isOpenCaptcha;
} }