diff --git a/wfc-auth/pom.xml b/wfc-auth/pom.xml
index e3fe88c..eac8bac 100644
--- a/wfc-auth/pom.xml
+++ b/wfc-auth/pom.xml
@@ -51,6 +51,11 @@
org.wfc
wfc-common-security
+
+
+ org.wfc
+ wfc-common-swagger
+
diff --git a/wfc-auth/src/main/java/org/wfc/auth/service/SysLoginService.java b/wfc-auth/src/main/java/org/wfc/auth/service/SysLoginService.java
index 597b37c..aa18841 100644
--- a/wfc-auth/src/main/java/org/wfc/auth/service/SysLoginService.java
+++ b/wfc-auth/src/main/java/org/wfc/auth/service/SysLoginService.java
@@ -48,7 +48,7 @@ public class SysLoginService
if (StringUtils.isAnyBlank(username, password))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
- throw new ServiceException("用户/密码必须填写");
+ throw new ServiceException("user.password.not.blank");
}
// 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
@@ -132,7 +132,7 @@ public class SysLoginService
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password))
{
- throw new ServiceException("用户/密码必须填写");
+ throw new ServiceException("user.password.not.blank");
}
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
diff --git a/wfc-auth/src/main/java/org/wfc/auth/service/SysPasswordService.java b/wfc-auth/src/main/java/org/wfc/auth/service/SysPasswordService.java
index 0e9509f..a4455fc 100644
--- a/wfc-auth/src/main/java/org/wfc/auth/service/SysPasswordService.java
+++ b/wfc-auth/src/main/java/org/wfc/auth/service/SysPasswordService.java
@@ -1,15 +1,17 @@
package org.wfc.auth.service;
-import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.Constants;
import org.wfc.common.core.exception.ServiceException;
+import org.wfc.common.core.exception.user.UserPasswordNotMatchException;
import org.wfc.common.redis.service.RedisService;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.system.api.domain.SysUser;
+import java.util.concurrent.TimeUnit;
+
/**
* 登录密码方法
*
@@ -62,7 +64,7 @@ public class SysPasswordService
retryCount = retryCount + 1;
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
- throw new ServiceException("用户不存在/密码错误");
+ throw new UserPasswordNotMatchException();
}
else
{
diff --git a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/CaptchaException.java b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/CaptchaException.java
index 05c4ffd..c38c46c 100644
--- a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/CaptchaException.java
+++ b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/CaptchaException.java
@@ -1,14 +1,20 @@
package org.wfc.common.core.exception;
+import org.wfc.common.core.exception.user.UserException;
+
/**
* 验证码错误异常类
*
* @author ruoyi
*/
-public class CaptchaException extends RuntimeException
+public class CaptchaException extends UserException
{
private static final long serialVersionUID = 1L;
+ public CaptchaException() {
+ super("user.jcaptcha.error");
+ }
+
public CaptchaException(String msg)
{
super(msg);
diff --git a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/ServiceException.java b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/ServiceException.java
index b666cbb..06023d4 100644
--- a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/ServiceException.java
+++ b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/ServiceException.java
@@ -1,5 +1,8 @@
package org.wfc.common.core.exception;
+import org.wfc.common.core.utils.MessageUtils;
+import org.wfc.common.core.utils.StringUtils;
+
/**
* 业务异常
*
@@ -52,7 +55,14 @@ public final class ServiceException extends RuntimeException
@Override
public String getMessage()
{
- return message;
+ String mes = null;
+ if (!StringUtils.isEmpty(message)) {
+ mes = MessageUtils.message(message);
+ }
+ if (mes == null) {
+ mes = detailMessage;
+ }
+ return mes;
}
public Integer getCode()
@@ -71,4 +81,5 @@ public final class ServiceException extends RuntimeException
this.detailMessage = detailMessage;
return this;
}
+
}
\ No newline at end of file
diff --git a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/base/BaseException.java b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/base/BaseException.java
index 92c980f..05a4cec 100644
--- a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/base/BaseException.java
+++ b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/base/BaseException.java
@@ -1,5 +1,8 @@
package org.wfc.common.core.exception.base;
+import org.wfc.common.core.utils.MessageUtils;
+import org.wfc.common.core.utils.StringUtils;
+
/**
* 基础异常
*
@@ -76,4 +79,16 @@ public class BaseException extends RuntimeException
{
return defaultMessage;
}
+
+ @Override
+ public String getMessage() {
+ String message = null;
+ if (!StringUtils.isEmpty(code)) {
+ message = MessageUtils.message(code, args);
+ }
+ if (message == null) {
+ message = defaultMessage;
+ }
+ return message;
+ }
}
diff --git a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/user/UserException.java b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/user/UserException.java
index 22cc6e6..e782400 100644
--- a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/user/UserException.java
+++ b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/exception/user/UserException.java
@@ -11,7 +11,7 @@ public class UserException extends BaseException
{
private static final long serialVersionUID = 1L;
- public UserException(String code, Object[] args)
+ public UserException(String code, Object... args)
{
super("user", code, args, null);
}
diff --git a/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/utils/MessageUtils.java b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/utils/MessageUtils.java
new file mode 100644
index 0000000..08b443e
--- /dev/null
+++ b/wfc-common/wfc-common-core/src/main/java/org/wfc/common/core/utils/MessageUtils.java
@@ -0,0 +1,33 @@
+package org.wfc.common.core.utils;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.springframework.context.MessageSource;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.context.i18n.LocaleContextHolder;
+
+/**
+ * 获取i18n资源文件
+ *
+ * @author Lion Li
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class MessageUtils {
+
+ private static final MessageSource MESSAGE_SOURCE = SpringUtils.getBean(MessageSource.class);
+
+ /**
+ * 根据消息键和参数 获取消息 委托给spring messageSource
+ *
+ * @param code 消息键
+ * @param args 参数
+ * @return 获取国际化翻译值
+ */
+ public static String message(String code, Object... args) {
+ try {
+ return MESSAGE_SOURCE.getMessage(code, args, LocaleContextHolder.getLocale());
+ } catch (NoSuchMessageException e) {
+ return code;
+ }
+ }
+}
diff --git a/wfc-common/wfc-common-core/src/main/resources/application.yml b/wfc-common/wfc-common-core/src/main/resources/application.yml
new file mode 100644
index 0000000..f1cc778
--- /dev/null
+++ b/wfc-common/wfc-common-core/src/main/resources/application.yml
@@ -0,0 +1,5 @@
+spring:
+ # 资源信息
+ messages:
+ # 国际化资源文件路径
+ basename: i18n/messages
\ No newline at end of file
diff --git a/wfc-common/wfc-common-core/src/main/resources/i18n/messages.properties b/wfc-common/wfc-common-core/src/main/resources/i18n/messages.properties
new file mode 100644
index 0000000..e69de29
diff --git a/wfc-common/wfc-common-core/src/main/resources/i18n/messages_en_US.properties b/wfc-common/wfc-common-core/src/main/resources/i18n/messages_en_US.properties
new file mode 100644
index 0000000..2343b2d
--- /dev/null
+++ b/wfc-common/wfc-common-core/src/main/resources/i18n/messages_en_US.properties
@@ -0,0 +1,62 @@
+#错误消息
+not.null=* Required fill in
+user.jcaptcha.error=Captcha error
+user.jcaptcha.not.blank=Captcha cannot be blank
+user.jcaptcha.expire=Captcha invalid
+user.not.exists=Sorry, your account: {0} does not exist
+user.password.not.match=User does not exist/Password error
+user.password.retry.limit.count=Password input error {0} times
+user.password.retry.limit.exceed=Password input error {0} times, account locked for {1} minutes
+user.password.delete=Sorry, your account:{0} has been deleted
+user.blocked=Sorry, your account: {0} has been disabled. Please contact the administrator
+role.blocked=Role disabled,please contact administrators
+user.logout.success=Exit successful
+length.not.valid=The length must be between {min} and {max} characters
+user.username.not.blank=Username cannot be blank
+user.username.not.valid=* 2 to 20 chinese characters, letters, numbers or underscores, and must start with a non number
+user.username.length.valid=Account length must be between {min} and {max} characters
+user.password.not.blank=Username/Password cannot be empty
+user.password.length.valid=Password length must be between {min} and {max} characters
+user.password.not.valid=* 5-50 characters
+user.email.not.valid=Mailbox format error
+user.email.not.blank=Mailbox cannot be blank
+user.phonenumber.not.blank=Phone number cannot be blank
+user.mobile.phone.number.not.valid=Phone number format error
+user.login.success=Login successful
+user.register.success=Register successful
+user.register.save.error=Failed to save user {0}, The registered account already exists
+user.register.error=Register failed, please contact system administrator
+user.notfound=Please login again
+user.forcelogout=The administrator is forced to exit,please login again
+user.unknown.error=Unknown error, please login again
+auth.grant.type.error=Auth grant type error
+auth.grant.type.blocked=Auth grant type disabled
+auth.grant.type.not.blank=Auth grant type cannot be blank
+auth.clientid.not.blank=Auth clientid cannot be blank
+##文件上传消息
+upload.exceed.maxSize=The uploaded file size exceeds the limit file size!
the maximum allowed file size is:{0}MB!
+upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters
+##权限
+no.permission=You do not have permission to the data,please contact your administrator to add permissions [{0}]
+no.create.permission=You do not have permission to create data,please contact your administrator to add permissions [{0}]
+no.update.permission=You do not have permission to modify data,please contact your administrator to add permissions [{0}]
+no.delete.permission=You do not have permission to delete data,please contact your administrator to add permissions [{0}]
+no.export.permission=You do not have permission to export data,please contact your administrator to add permissions [{0}]
+no.view.permission=You do not have permission to view data,please contact your administrator to add permissions [{0}]
+repeat.submit.message=Repeat submit is not allowed, please try again later
+rate.limiter.message=Visit too frequently, please try again later
+sms.code.not.blank=Sms code cannot be blank
+sms.code.retry.limit.count=Sms code input error {0} times
+sms.code.retry.limit.exceed=Sms code input error {0} times, account locked for {1} minutes
+email.code.not.blank=Email code cannot be blank
+email.code.retry.limit.count=Email code input error {0} times
+email.code.retry.limit.exceed=Email code input error {0} times, account locked for {1} minutes
+xcx.code.not.blank=Mini program [code] cannot be blank
+social.source.not.blank=Social login platform [source] cannot be blank
+social.code.not.blank=Social login platform [code] cannot be blank
+social.state.not.blank=Social login platform [state] cannot be blank
+##租户
+tenant.number.not.blank=Tenant number cannot be blank
+tenant.not.exists=Sorry, your tenant does not exist. Please contact the administrator
+tenant.blocked=Sorry, your tenant is disabled. Please contact the administrator
+tenant.expired=Sorry, your tenant has expired. Please contact the administrator.
diff --git a/wfc-common/wfc-common-core/src/main/resources/i18n/messages_zh_CN.properties b/wfc-common/wfc-common-core/src/main/resources/i18n/messages_zh_CN.properties
new file mode 100644
index 0000000..54c838d
--- /dev/null
+++ b/wfc-common/wfc-common-core/src/main/resources/i18n/messages_zh_CN.properties
@@ -0,0 +1,62 @@
+#错误消息
+not.null=* 必须填写
+user.jcaptcha.error=验证码错误
+user.jcaptcha.not.blank=验证码不能为空
+user.jcaptcha.expire=验证码已失效
+user.not.exists=对不起, 您的账号:{0} 不存在.
+user.password.not.match=用户不存在/密码错误
+user.password.retry.limit.count=密码输入错误{0}次
+user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
+user.password.delete=对不起,您的账号:{0} 已被删除
+user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员
+role.blocked=角色已封禁,请联系管理员
+user.logout.success=退出成功
+length.not.valid=长度必须在{min}到{max}个字符之间
+user.username.not.blank=用户名不能为空
+user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
+user.username.length.valid=账户长度必须在{min}到{max}个字符之间
+user.password.not.blank=用户/密码不能为空
+user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
+user.password.not.valid=* 5-50个字符
+user.email.not.valid=邮箱格式错误
+user.email.not.blank=邮箱不能为空
+user.phonenumber.not.blank=用户手机号不能为空
+user.mobile.phone.number.not.valid=手机号格式错误
+user.login.success=登录成功
+user.register.success=注册成功
+user.register.save.error=保存用户 {0} 失败,注册账号已存在
+user.register.error=注册失败,请联系系统管理人员
+user.notfound=请重新登录
+user.forcelogout=管理员强制退出,请重新登录
+user.unknown.error=未知错误,请重新登录
+auth.grant.type.error=认证权限类型错误
+auth.grant.type.blocked=认证权限类型已禁用
+auth.grant.type.not.blank=认证权限类型不能为空
+auth.clientid.not.blank=认证客户端id不能为空
+##文件上传消息
+upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB!
+upload.filename.exceed.length=上传的文件名最长{0}个字符
+##权限
+no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
+no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
+no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
+no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
+no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
+no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
+repeat.submit.message=不允许重复提交,请稍候再试
+rate.limiter.message=访问过于频繁,请稍候再试
+sms.code.not.blank=短信验证码不能为空
+sms.code.retry.limit.count=短信验证码输入错误{0}次
+sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟
+email.code.not.blank=邮箱验证码不能为空
+email.code.retry.limit.count=邮箱验证码输入错误{0}次
+email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟
+xcx.code.not.blank=小程序[code]不能为空
+social.source.not.blank=第三方登录平台[source]不能为空
+social.code.not.blank=第三方登录平台[code]不能为空
+social.state.not.blank=第三方登录平台[state]不能为空
+##租户
+tenant.number.not.blank=租户编号不能为空
+tenant.not.exists=对不起, 您的租户不存在,请联系管理员
+tenant.blocked=对不起,您的租户已禁用,请联系管理员
+tenant.expired=对不起,您的租户已过期,请联系管理员
diff --git a/wfc-common/wfc-common-swagger/src/main/java/org/wfc/common/swagger/config/I18nConfig.java b/wfc-common/wfc-common-swagger/src/main/java/org/wfc/common/swagger/config/I18nConfig.java
new file mode 100644
index 0000000..2f6f49c
--- /dev/null
+++ b/wfc-common/wfc-common-swagger/src/main/java/org/wfc/common/swagger/config/I18nConfig.java
@@ -0,0 +1,21 @@
+package org.wfc.common.swagger.config;
+
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.servlet.LocaleResolver;
+
+/**
+ * 国际化配置
+ *
+ * @author Lion Li
+ */
+@AutoConfiguration(before = WebMvcAutoConfiguration.class)
+public class I18nConfig {
+
+ @Bean
+ public LocaleResolver localeResolver() {
+ return new I18nLocaleResolver();
+ }
+
+}
diff --git a/wfc-common/wfc-common-swagger/src/main/java/org/wfc/common/swagger/config/I18nLocaleResolver.java b/wfc-common/wfc-common-swagger/src/main/java/org/wfc/common/swagger/config/I18nLocaleResolver.java
new file mode 100644
index 0000000..c6c8e8a
--- /dev/null
+++ b/wfc-common/wfc-common-swagger/src/main/java/org/wfc/common/swagger/config/I18nLocaleResolver.java
@@ -0,0 +1,31 @@
+package org.wfc.common.swagger.config;
+
+import org.springframework.web.servlet.LocaleResolver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Locale;
+
+/**
+ * 获取请求头国际化信息
+ *
+ * @author Lion Li
+ */
+public class I18nLocaleResolver implements LocaleResolver {
+
+ @Override
+ public Locale resolveLocale(HttpServletRequest httpServletRequest) {
+ String language = httpServletRequest.getHeader("content-language");
+ Locale locale = Locale.getDefault();
+ if (language != null && language.length() > 0) {
+ String[] split = language.split("-");
+ locale = new Locale(split[0], split[1]);
+ }
+ return locale;
+ }
+
+ @Override
+ public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) {
+
+ }
+}
diff --git a/wfc-common/wfc-common-swagger/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/wfc-common/wfc-common-swagger/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 40ee468..e37b1dd 100644
--- a/wfc-common/wfc-common-swagger/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ b/wfc-common/wfc-common-swagger/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1 +1,2 @@
-org.wfc.common.swagger.config.SpringDocAutoConfiguration
\ No newline at end of file
+org.wfc.common.swagger.config.SpringDocAutoConfiguration
+org.wfc.common.swagger.config.I18nConfig
\ No newline at end of file
diff --git a/wfc-gateway/src/main/java/org/wfc/gateway/filter/GlobalI18nFilter.java b/wfc-gateway/src/main/java/org/wfc/gateway/filter/GlobalI18nFilter.java
new file mode 100644
index 0000000..bf70727
--- /dev/null
+++ b/wfc-gateway/src/main/java/org/wfc/gateway/filter/GlobalI18nFilter.java
@@ -0,0 +1,41 @@
+package org.wfc.gateway.filter;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.cloud.gateway.filter.GatewayFilterChain;
+import org.springframework.cloud.gateway.filter.GlobalFilter;
+import org.springframework.context.i18n.LocaleContextHolder;
+import org.springframework.context.i18n.SimpleLocaleContext;
+import org.springframework.core.Ordered;
+import org.springframework.stereotype.Component;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+import java.util.Locale;
+
+/**
+ * 全局国际化处理
+ *
+ * @author caiyuchao
+ */
+@Slf4j
+@Component
+public class GlobalI18nFilter implements GlobalFilter, Ordered {
+
+ @Override
+ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
+ String language = exchange.getRequest().getHeaders().getFirst("content-language");
+ Locale locale = Locale.getDefault();
+ if (language != null && language.length() > 0) {
+ String[] split = language.split("-");
+ locale = new Locale(split[0], split[1]);
+ }
+ LocaleContextHolder.setLocaleContext(new SimpleLocaleContext(locale), true);
+ return chain.filter(exchange);
+ }
+
+ @Override
+ public int getOrder() {
+ return Ordered.HIGHEST_PRECEDENCE;
+ }
+
+}
diff --git a/wfc-gateway/src/main/java/org/wfc/gateway/service/impl/ValidateCodeServiceImpl.java b/wfc-gateway/src/main/java/org/wfc/gateway/service/impl/ValidateCodeServiceImpl.java
index 597de97..084b8d5 100644
--- a/wfc-gateway/src/main/java/org/wfc/gateway/service/impl/ValidateCodeServiceImpl.java
+++ b/wfc-gateway/src/main/java/org/wfc/gateway/service/impl/ValidateCodeServiceImpl.java
@@ -1,16 +1,9 @@
package org.wfc.gateway.service.impl;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Resource;
-import javax.imageio.ImageIO;
+import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.FastByteArrayOutputStream;
-import com.google.code.kaptcha.Producer;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.Constants;
import org.wfc.common.core.exception.CaptchaException;
@@ -22,6 +15,14 @@ import org.wfc.common.redis.service.RedisService;
import org.wfc.gateway.config.properties.CaptchaProperties;
import org.wfc.gateway.service.ValidateCodeService;
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
/**
* 验证码实现处理
*
@@ -105,18 +106,18 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
{
if (StringUtils.isEmpty(code))
{
- throw new CaptchaException("验证码不能为空");
+ throw new CaptchaException("user.jcaptcha.not.blank");
}
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisService.getCacheObject(verifyKey);
if (captcha == null)
{
- throw new CaptchaException("验证码已失效");
+ throw new CaptchaException();
}
redisService.deleteObject(verifyKey);
if (!code.equalsIgnoreCase(captcha))
{
- throw new CaptchaException("验证码错误");
+ throw new CaptchaException();
}
}
}
diff --git a/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysUserController.java b/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysUserController.java
index 3b6d2a3..b012a35 100644
--- a/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysUserController.java
+++ b/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysUserController.java
@@ -1,6 +1,20 @@
package org.wfc.system.controller;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.MessageSource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
import org.wfc.common.core.domain.R;
+import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
@@ -16,12 +30,12 @@ import org.wfc.system.api.domain.SysDept;
import org.wfc.system.api.domain.SysRole;
import org.wfc.system.api.domain.SysUser;
import org.wfc.system.api.model.LoginUser;
-import org.wfc.system.service.*;
-import org.apache.commons.lang3.ArrayUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
+import org.wfc.system.service.ISysConfigService;
+import org.wfc.system.service.ISysDeptService;
+import org.wfc.system.service.ISysPermissionService;
+import org.wfc.system.service.ISysPostService;
+import org.wfc.system.service.ISysRoleService;
+import org.wfc.system.service.ISysUserService;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -61,6 +75,18 @@ public class SysUserController extends BaseController
@Autowired
private TokenService tokenService;
+ @Autowired
+ private MessageSource messageSource;
+
+ /**
+ * 获取用户列表
+ */
+ @GetMapping("/test")
+ public String test()
+ {
+ return MessageUtils.message("user.jcaptcha.error");
+ }
+
/**
* 获取用户列表
*/