Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
haoban3.0
haoban-manage3.0
Commits
7ed3130f
Commit
7ed3130f
authored
Feb 16, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a86ca16b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
26 deletions
+12
-26
WebInterceptor.java
...com/gic/haoban/manage/web/interceptor/WebInterceptor.java
+8
-26
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+4
-0
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/interceptor/WebInterceptor.java
View file @
7ed3130f
...
...
@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.haoban.auth.api.anno.MenuCheck
;
import
com.gic.haoban.auth.api.dto.UserRightDetailDTO
;
import
com.gic.haoban.auth.api.enums.RoleCodeEnum
;
import
com.gic.haoban.common.utils.AuthRequestUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.web.auth.AuthRequestUtil
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -54,7 +56,7 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
logger
.
info
(
"post-url:{}"
,
requestURI
);
Map
<
String
,
String
[]>
parameterMap
=
httpServletRequest
.
getParameterMap
();
logger
.
info
(
"post-params:{}"
,
JSONObject
.
toJSONString
(
parameterMap
));
UserRightDetailDTO
loginUser
=
(
UserRightDetailDT
O
)
AuthRequestUtil
.
getSessionUser
();
LoginVO
loginUser
=
(
LoginV
O
)
AuthRequestUtil
.
getSessionUser
();
if
(
loginUser
==
null
)
{
this
.
errorResult
(
httpServletResponse
,
HaoBanErrCode
.
ERR_4
);
...
...
@@ -69,31 +71,11 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
return
true
;
}
MenuCheck
methodAnnotation
=
method
.
getMethodAnnotation
(
MenuCheck
.
class
);
if
(
StringUtils
.
isNotBlank
(
loginUser
.
getEnterpriseId
()))
{
httpServletRequest
.
setAttribute
(
"enterpriseId"
,
loginUser
.
getEnterpriseId
());
}
if
(
StringUtils
.
isNotBlank
(
loginUser
.
getUserId
()))
{
httpServletRequest
.
setAttribute
(
"clerkId"
,
loginUser
.
getUserId
());
if
(
StringUtils
.
isNotBlank
(
loginUser
.
getWxEnterpriseId
()))
{
httpServletRequest
.
setAttribute
(
"wxEnterpriseId"
,
loginUser
.
getWxEnterpriseId
());
}
if
(
null
!=
methodAnnotation
)
{
String
value
=
methodAnnotation
.
value
();
RoleCodeEnum
[]
roleCodes
=
methodAnnotation
.
roleCodes
();
boolean
b
=
true
;
//权限判断
if
(
StringUtils
.
isNotBlank
(
value
))
{
b
=
loginUser
.
checkRight
(
value
);
}
//角色判读
if
(
b
)
{
if
(
roleCodes
.
length
>
0
)
{
b
=
Arrays
.
stream
(
roleCodes
).
anyMatch
(
codeEnum
->
loginUser
.
checkRole
(
codeEnum
.
getCode
()));
}
}
if
(!
b
)
{
logger
.
info
(
"缺少权限"
);
errorResult
(
httpServletResponse
,
HaoBanErrCode
.
ERR_7
);
}
return
b
;
if
(
loginUser
.
getStaffDTO
()
!=
null
)
{
httpServletRequest
.
setAttribute
(
"staffDTO"
,
loginUser
.
getStaffDTO
());
}
return
true
;
}
...
...
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
7ed3130f
...
...
@@ -29,4 +29,8 @@
<dubbo:reference
interface=
"com.gic.enterprise.api.service.DepartmentService"
id=
"departmentService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.DepartmentApiService"
id=
"departmentApiService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.StoreGroupService"
id=
"storeGroupService"
/>
<dubbo:reference
interface=
"com.gic.clerk.api.service.ClerkService"
id=
"clerkService"
/>
</beans>
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