Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
60204813
Commit
60204813
authored
Jun 25, 2021
by
郭武斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)删除冗余代码
parent
3b7d53fa
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
69 deletions
+69
-69
BaseController.java
...ejoin/amos/boot/biz/common/controller/BaseController.java
+0
-0
ControllerAop.java
...m/yeejoin/amos/boot/module/jcs/biz/aop/ControllerAop.java
+0
-0
FeignAop.java
...va/com/yeejoin/amos/boot/module/jcs/biz/aop/FeignAop.java
+69
-69
UserController.java
...n/amos/boot/module/jcs/biz/controller/UserController.java
+0
-0
RemoteSecurityService.java
...ot/module/jcs/biz/service/impl/RemoteSecurityService.java
+0
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/controller/BaseController.java
View file @
60204813
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/aop/ControllerAop.java
View file @
60204813
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/aop/FeignAop.java
View file @
60204813
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
aop
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.AfterReturning
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
/**
* feign请求header设置
* @author DELL
*
*/
@Aspect
@Component
public
class
FeignAop
{
@Pointcut
(
"execution(public * com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService.*(..))"
)
public
void
webLog
(){}
/**
* 前置通知:在连接点之前执行的通知
* @param joinPoint
* @throws Throwable
*/
@Before
(
"webLog()"
)
public
void
doBefore
(
JoinPoint
joinPoint
)
throws
Throwable
{
// 接收到请求,记录请求内容
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
//不需要添加请求头的接口
String
[]
url
=
new
String
[]{
"/api/user/mobile/login"
};
//获取请求路径
if
(
Arrays
.
asList
(
url
).
contains
(
request
.
getRequestURI
())){
//暂无需要
}
else
{
String
token
=
request
.
getHeader
(
"token"
);
String
product
=
request
.
getHeader
(
"product"
);
String
appKey
=
request
.
getHeader
(
"appKey"
);
if
(
token
==
null
||
product
==
null
||
appKey
==
null
||
""
.
equals
(
token
)||
""
.
equals
(
product
)||
""
.
equals
(
appKey
)){
//没有请求头信息直接转异常到403
throw
new
RuntimeException
(
"非法异常请求!请重新登录!"
);
}
RequestContext
.
setToken
(
token
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
}
}
@AfterReturning
(
returning
=
"ret"
,
pointcut
=
"webLog()"
)
public
void
doAfterReturning
(
Object
ret
)
throws
Throwable
{
}
}
//
package com.yeejoin.amos.boot.module.jcs.biz.aop;
//
//
//
import org.aspectj.lang.JoinPoint;
//
import org.aspectj.lang.annotation.AfterReturning;
//
import org.aspectj.lang.annotation.Aspect;
//
import org.aspectj.lang.annotation.Before;
//
import org.aspectj.lang.annotation.Pointcut;
//
import org.springframework.stereotype.Component;
//
import org.springframework.web.context.request.RequestContextHolder;
//
import org.springframework.web.context.request.ServletRequestAttributes;
//
import org.typroject.tyboot.core.foundation.context.RequestContext;
//
//
import javax.servlet.http.HttpServletRequest;
//
import java.util.Arrays;
//
//
/
//
**
//
* feign请求header设置
//
* @author DELL
//
*
//
*/
//
@Aspect
//
@Component
//
public class FeignAop {
//
//
//
//
@Pointcut("execution(public * com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService.*(..))")
//
public void webLog(){}
//
//
/**
//
* 前置通知:在连接点之前执行的通知
//
* @param joinPoint
//
* @throws Throwable
//
*/
//
@Before("webLog()")
//
public void doBefore(JoinPoint joinPoint) throws Throwable {
//
// 接收到请求,记录请求内容
//
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
//
HttpServletRequest request = attributes.getRequest();
//
//不需要添加请求头的接口
//
String[] url=new String[]{"/api/user/mobile/login"};
//
//获取请求路径
//
if(Arrays.asList(url).contains(request.getRequestURI())){
//
//暂无需要
//
}else{
//
//
String token = request.getHeader("token");
//
String product = request.getHeader("product");
//
String appKey = request.getHeader("appKey");
//
if(token==null||product==null||appKey==null||"".equals(token)||"".equals(product)||"".equals(appKey)){
//
//没有请求头信息直接转异常到403
//
throw new RuntimeException("非法异常请求!请重新登录!");
//
}
//
RequestContext.setToken(token);
//
RequestContext.setProduct(product);
//
RequestContext.setAppKey(appKey);
//
}
//
//
//
//
}
//
//
@AfterReturning(returning = "ret",pointcut = "webLog()")
//
public void doAfterReturning(Object ret) throws Throwable {
//
}
//
}
//
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/UserController.java
View file @
60204813
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/RemoteSecurityService.java
View file @
60204813
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment