验证码开启升级

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

View File

@ -1,8 +1,3 @@
--- # 项目基础信息
sxpcwlkj:
# 开启验证码: true开启 false 关闭
isOpenCaptcha: false
--- # powerjob 配置
powerjob:
worker:
@ -10,7 +5,6 @@ powerjob:
enabled: false
# 需要先在 powerjob 登录页执行应用注册后才能使用
app-name: mms
enable-test-mode: false
max-appended-wf-context-length: 4096
max-result-length: 4096
# 28080 端口 随着主应用端口飘逸 避免集群冲突
@ -44,42 +38,45 @@ spring:
primary: master
# 严格模式 匹配不到数据源则报错
strict: true
public-key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJssgtfcBfc+d8Et0FBGQRBonRRQBD8jB1UHTRbk3diOliGlec9lJxbGR/qp7Jp8uYozCr96lvpnIIJM59fNoeUCAwEAAQ==
# 账号密码
datasource:
# 主库数据源
master:
type: ${spring.datasource.type}
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
username: root
password: 123456
# 从库数据源
slave:
lazy: true
type: ${spring.datasource.type}
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
username: root
password: 123456
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# hikari:
# connectionTestQuery: SELECT 1 FROM DUAL
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: root
# sqlserver:
# type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA
# password: root
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: mms
# 由GeneratePassword.java 生成, public-key 和 password 要匹配
password: ENC(c6FYwkk1dtKxfAcOED4g4mAgzCoK6XTr6+VTXVfQYly9I02yiND8aK5vTeYJ+oJCGH4beQyZLl9H2kt1ZCXqJg==)
# # 从库数据源
# slave:
# lazy: true
# type: ${spring.datasource.type}
# 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
# username: root
# password: 123456
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# hikari:
# connectionTestQuery: SELECT 1 FROM DUAL
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: root
# sqlserver:
# type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA
# password: root
hikari:
# 最大连接池数量
maxPoolSize: 20

View File

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

View File

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

View File

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

View File

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

View File

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