Commit a1e3cfe3 zshaohui

1.增加用户激活信息

2.登录验证语言展示错误处理
1 个父辈 9bbcc26b
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
......@@ -90,6 +91,15 @@ public class GlobalExceptionHandler {
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
}
@ExceptionHandler(value = InternalAuthenticationServiceException.class)
public ResponseEntity<ApiError> internalAuthenticationServiceException(HttpServletRequest servlet,ValidateException e){
// String language= servlet.getLocale().getLanguage();
// 打印堆栈信息
//log.error(ThrowableUtil.getStackTrace(e));
String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),servlet.getLocale() ,e.getDefaultMsg());
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
}
/**
* 处理所有接口数据验证异常
*/
......
......@@ -19,6 +19,9 @@ public class StorageSearchDto implements Serializable {
@ApiModelProperty("分组ID")
private String groupId = "";
@ApiModelProperty("分组名称")
private String groupName = "";
@ApiModelProperty("料仓类型")
private String type = "";
}
......@@ -66,6 +66,11 @@ public class Storage extends BasePo implements Serializable {
private String groupId = "";
/**
* 分组名称
*/
private String groupName = "";
/**
* 当前绑定的入库单名称
*/
private String inListName="";
......
......@@ -17,6 +17,8 @@ package com.neotel.smfcore.security.service;
import com.neotel.smfcore.common.exception.EntityNotFoundException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.Md5Utls;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.security.rest.bean.dto.JwtUserDto;
......@@ -57,21 +59,21 @@ public class UserDetailsServiceImpl implements UserDetailsService {
if (user == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"username", username});
} else {
// if(user.getEnabled()==null){
// throw new ValidateException("smfcore.notActivated","账号未激活");
// }
// if (!user.getEnabled()) {
// throw new ValidateException("smfcore.notActivated","账号未激活");
// }
// if(user.getUsername().equals(Constants.SUPER_USERNAME)){
//
// }else {
// //判断激活码是否正确
// String code = Md5Utls.getMd5(user.getId(), user.getCreateDate());
// if (!code.equals(user.getCheckCode())) {
// throw new ValidateException("smfcore.notActivated","账号未激活");
// }
// }
if(user.getEnabled()==null){
throw new ValidateException("smfcore.notActivated","账号未激活");
}
if (!user.getEnabled()) {
throw new ValidateException("smfcore.notActivated","账号未激活");
}
if(user.getUsername().equals(Constants.SUPER_USERNAME)){
}else {
//判断激活码是否正确
String code = Md5Utls.getMd5(user.getId(), user.getCreateDate());
if (!code.equals(user.getCheckCode())) {
throw new ValidateException("smfcore.notActivated","账号未激活");
}
}
List<Long> dataScopes = new ArrayList<>();
jwtUserDto = new JwtUserDto(
user,
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!