Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

dev
jianjun 5 years ago
parent
commit
f6a3e3f932
  1. 7
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  2. 6
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  3. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java

7
epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java

@ -10,10 +10,7 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GovWebLoginFormDTO; import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.form.GovWebOperLoginFormDTO; import com.epmet.dto.form.GovWebOperLoginFormDTO;
import com.epmet.dto.form.LoginByPassWordFormDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.result.GovWebOperLoginResultDTO; import com.epmet.dto.result.GovWebOperLoginResultDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenProperties;
@ -65,7 +62,7 @@ public class GovWebServiceImpl implements GovWebService {
//2.验证码校验 //2.验证码校验
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
if (!flag) { if (!flag) {
logger.error(String.format("用户%s登录,验证码输入错误,暂时放行", formDTO.getPhone())); logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone()));
//开启验证码校验 //开启验证码校验
throw new RenException(EpmetErrorCode.ERR10019.getCode()); throw new RenException(EpmetErrorCode.ERR10019.getCode());
} }
@ -84,7 +81,7 @@ public class GovWebServiceImpl implements GovWebService {
//4.密码是否正确 //4.密码是否正确
//密码错误 //密码错误
if (!PasswordUtils.matches(formDTO.getPassword(), resultDTO.getPassWord())) { if (!PasswordUtils.matches(formDTO.getPassword(), resultDTO.getPassWord())) {
logger.error("登陆密码错误"); logger.warn("登陆密码错误");
throw new RenException(EpmetErrorCode.ERR10004.getCode()); throw new RenException(EpmetErrorCode.ERR10004.getCode());
} }

6
epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -293,9 +293,9 @@ public class LoginServiceImpl implements LoginService {
//1、验证码是否正确 //1、验证码是否正确
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
if (!flag) { if (!flag) {
logger.error(String.format("用户%s登录,验证码输入错误,暂时放行",formDTO.getPhone())); logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone()));
//2020-05-21去除验证码校验 TODO //2020-05-21去除验证码校验
//return new Result<UserTokenResultDTO>().error(EpmetErrorCode.ERR10019.getCode()); return new Result<UserTokenResultDTO>().error(EpmetErrorCode.ERR10019.getCode());
} }
//2、账号是否存在 //2、账号是否存在
//获取用户信息 //获取用户信息

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java

@ -11,9 +11,6 @@ package com.epmet.commons.tools.aspect;
import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO; import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO;
import com.epmet.commons.tools.dto.form.LoginUserInfoFormDTO;
import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO;
import com.epmet.commons.tools.dto.form.RoleOpeScopeResultDTO;
import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -30,11 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 每次请求过滤Api中配置的权限key出来并且判断是否具有该功能权限 * 每次请求过滤Api中配置的权限key出来并且判断是否具有该功能权限
* @Author wxz * @Author wxz
@ -89,8 +81,9 @@ public class RequirePermissionAspect {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
Boolean data = result.getData(); Boolean data = result.getData();
if (data == null || !data) { if (data == null || !data) {
log.error("操作权限不足"); log.warn("操作权限不足,key:{}", requirePermission);
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode());
} }
} }

Loading…
Cancel
Save