Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
0407e421
Commit
0407e421
authored
Jun 27, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改json序列化
parent
253180d8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
15 deletions
+25
-15
base-manager/src/main/java/com/mortals/xhx/base/login/interceptor/AuthJsonInterceptor.java
...rtals/xhx/base/login/interceptor/AuthJsonInterceptor.java
+12
-6
base-manager/src/main/resources/bootstrap.yml
base-manager/src/main/resources/bootstrap.yml
+5
-3
base-manager/src/test/java/com/mortals/httpclient/http-client.env.json
...src/test/java/com/mortals/httpclient/http-client.env.json
+1
-1
portal-manager/src/main/java/com/mortals/xhx/module/user/web/UserController.java
.../java/com/mortals/xhx/module/user/web/UserController.java
+2
-3
portal-manager/src/main/resources/bootstrap.yml
portal-manager/src/main/resources/bootstrap.yml
+5
-2
No files found.
base-manager/src/main/java/com/mortals/xhx/base/login/interceptor/AuthJsonInterceptor.java
View file @
0407e421
package
com.mortals.xhx.base.login.interceptor
;
import
com.mortals.
xhx.base.framework.config.InterceptorConfig
;
import
com.mortals.
framework.annotation.UnAuth
;
import
com.mortals.framework.ap.CookieService
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.model.CookieInfo
;
...
...
@@ -9,13 +9,15 @@ import com.mortals.framework.util.AESUtil;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.web.interceptor.BaseInterceptor
;
import
com.mortals.xhx.base.framework.config.InterceptorConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.
stereotype.Component
;
import
org.springframework.
web.method.HandlerMethod
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
@Order
(
1
)
//@Component
public
class
AuthJsonInterceptor
extends
BaseInterceptor
{
...
...
@@ -35,13 +37,17 @@ public class AuthJsonInterceptor extends BaseInterceptor {
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
try
{
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
Method
method
=
handlerMethod
.
getMethod
();
UnAuth
annotation
=
method
.
getAnnotation
(
UnAuth
.
class
);
if
(
annotation
!=
null
)
{
//取消校验
return
true
;
}
String
uri
=
request
.
getServletPath
();
//校验配置的请求路径是否需要检查权限
if
(
config
.
needCheckAuth
(
uri
))
{
//需要校验权限
boolean
auth
=
this
.
checkAuth
(
request
,
uri
,
config
.
getSecurityKey
());
if
(!
auth
)
{
//不存在时候 如果是管理员也不做拦截
CookieInfo
cookie
=
CookieService
.
getLoginCookie
(
request
,
config
.
getSecurityKey
());
if
(
cookie
==
null
||
cookie
.
getUser
()
==
null
)
{
writeJsonResponse
(
response
,
HttpServletResponse
.
SC_FORBIDDEN
,
"用户未登录或登录失效,请重新登录"
);
...
...
base-manager/src/main/resources/bootstrap.yml
View file @
0407e421
...
...
@@ -11,9 +11,11 @@ spring:
max-file-size
:
500MB
max-request-size
:
5000MB
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
default-property-inclusion
:
non_null
serialization
:
WRITE_DATES_AS_TIMESTAMPS
:
true
default-property-inclusion
:
NON_NULL
# time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss
dao
:
exceptiontranslation
:
enabled
:
false
...
...
base-manager/src/test/java/com/mortals/httpclient/http-client.env.json
View file @
0407e421
...
...
@@ -6,6 +6,6 @@
"baseUrl"
:
"http://192.168.0.217:17211/base"
},
"base-test"
:
{
"baseUrl"
:
"http://192.168.0.98:11071/
zwfw
"
"baseUrl"
:
"http://192.168.0.98:11071/
base
"
}
}
\ No newline at end of file
portal-manager/src/main/java/com/mortals/xhx/module/user/web/UserController.java
View file @
0407e421
...
...
@@ -96,9 +96,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
@Override
public
Rest
<
Map
<
String
,
Object
>
>
list
(
UserEntity
query
)
{
public
Rest
<
Object
>
list
(
UserEntity
query
)
{
Map
<
String
,
Object
>
model
=
new
HashMap
();
Rest
<
Map
<
String
,
Object
>
>
ret
=
new
Rest
<>();
Rest
<
Object
>
ret
=
new
Rest
<>();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
int
code
;
...
...
@@ -119,7 +119,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
this
.
init
(
model
,
context
);
ret
.
setCode
(
code
);
ret
.
setData
(
model
);
ret
.
setDict
(
model
.
get
(
KEY_RESULT_DICT
)==
null
?
null
:(
Map
<
String
,
Object
>)
model
.
remove
(
KEY_RESULT_DICT
));
ret
.
setMsg
(
model
.
get
(
MESSAGE_INFO
)==
null
?
""
:
model
.
remove
(
MESSAGE_INFO
).
toString
());
return
ret
;
}
...
...
portal-manager/src/main/resources/bootstrap.yml
View file @
0407e421
...
...
@@ -11,8 +11,11 @@ spring:
max-file-size
:
500MB
max-request-size
:
5000MB
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
serialization
:
WRITE_DATES_AS_TIMESTAMPS
:
true
default-property-inclusion
:
NON_NULL
# time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss
dao
:
exceptiontranslation
:
enabled
:
false
...
...
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