Commit e1ec2cb4 authored by chenhao's avatar chenhao

提交excle 导出时401权限的问题

parent e64c96dc
...@@ -89,7 +89,7 @@ public class ControllerAop { ...@@ -89,7 +89,7 @@ public class ControllerAop {
// 不需要校验token的接口直接返回 // 不需要校验token的接口直接返回
if (joinPoint.getSignature() instanceof MethodSignature) { if (joinPoint.getSignature() instanceof MethodSignature) {
if (!((MethodSignature) joinPoint.getSignature()).getMethod().getAnnotation(TycloudOperation.class).needAuth()) { if (!((MethodSignature) joinPoint.getSignature()).getMethod().getAnnotation(TycloudOperation.class).needAuth() && !request.getParameterMap().containsKey("token")) {
return; return;
} }
} }
...@@ -111,6 +111,7 @@ public class ControllerAop { ...@@ -111,6 +111,7 @@ public class ControllerAop {
if (userModel == null) { if (userModel == null) {
throw new Exception("无法获取用户信息"); throw new Exception("无法获取用户信息");
} }
RequestContext.setExeUserId(userModel.getUserId());
} catch (Exception e) { } catch (Exception e) {
//删除失效token缓存 //删除失效token缓存
redisUtils.getAndDeletePatternKeys(pattern); redisUtils.getAndDeletePatternKeys(pattern);
......
...@@ -211,8 +211,7 @@ public class ExcelServiceImpl { ...@@ -211,8 +211,7 @@ public class ExcelServiceImpl {
} }
public void commonExport(HttpServletResponse response, ExcelDto excelDto, Map par) { public void commonExport(HttpServletResponse response, ExcelDto excelDto, Map par) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); String bizOrgCode= getCurrentAllInfo().getPersonIdentity().getBizOrgCode();
String bizOrgCode= reginParams.getPersonIdentity().getBizOrgCode();
boolean authFalg= false; boolean authFalg= false;
if(org.apache.commons.lang3.StringUtils.isBlank(bizOrgCode)){ if(org.apache.commons.lang3.StringUtils.isBlank(bizOrgCode)){
authFalg=true; authFalg=true;
...@@ -1805,4 +1804,13 @@ public class ExcelServiceImpl { ...@@ -1805,4 +1804,13 @@ public class ExcelServiceImpl {
userModel.setRecDate(new Date()); userModel.setRecDate(new Date());
return userModel; return userModel;
} }
public ReginParams getCurrentAllInfo() {
BaseEntity userModel = new BaseEntity();
FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
AgencyUserModel userModel1 = agencyUserModel.getResult();
String keyString = userModel1.getUserId();
String token = RequestContext.getToken();
return JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(keyString, token)).toString(),
ReginParams.class);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment