|
|
@@ -77,6 +77,16 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
|
|
return StringUtils.EMPTY;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 注册开关
|
|
|
+ *
|
|
|
+ * @return true开启,false关闭
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean selectRegisterUser() {
|
|
|
+ return getBoolValue("sys.account.registerUser");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取验证码开关
|
|
|
*
|
|
|
@@ -84,11 +94,7 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean selectCaptchaOnOff() {
|
|
|
- String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff");
|
|
|
- if (StringUtils.isEmpty(captchaOnOff)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return Convert.toBool(captchaOnOff);
|
|
|
+ return getBoolValue("sys.account.captchaOnOff");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -186,9 +192,9 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
|
|
*/
|
|
|
@Override
|
|
|
public String checkConfigKeyUnique(SysConfig config) {
|
|
|
- Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
|
|
+ long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
|
|
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
|
|
- if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) {
|
|
|
+ if (StringUtils.isNotNull(info) && info.getConfigId() != configId) {
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
}
|
|
|
return UserConstants.UNIQUE;
|
|
|
@@ -203,4 +209,17 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
|
|
private String getCacheKey(String configKey) {
|
|
|
return Constants.SYS_CONFIG_KEY + configKey;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取Bool类型的系统配置
|
|
|
+ * @param configKey 参数键
|
|
|
+ * @return true开启,false关闭
|
|
|
+ */
|
|
|
+ private boolean getBoolValue(String configKey){
|
|
|
+ String captchaOnOff = selectConfigByKey(configKey);
|
|
|
+ if (StringUtils.isEmpty(captchaOnOff)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return Convert.toBool(captchaOnOff);
|
|
|
+ }
|
|
|
}
|