Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv-springboot
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bsoft
sv-springboot
Commits
d2c90297
Commit
d2c90297
authored
Nov 21, 2019
by
Suvalue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口入参拦截器
parent
51669d17
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
220 additions
and
25 deletions
+220
-25
bsoft-api/src/main/java/com/bsoft/api/common/aspect/RequestMappingAspect.java
+48
-0
bsoft-api/src/main/java/com/bsoft/api/common/configurations/LoginConfigure.java
+3
-3
bsoft-api/src/main/java/com/bsoft/api/common/intercepters/LoginInterceptor.java
+5
-5
bsoft-api/src/main/java/com/bsoft/api/common/utils/TokenUtil.java
+5
-1
bsoft-api/src/main/java/com/bsoft/api/controller/ExcelController.java
+4
-3
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/BlockValues.java
+21
-12
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/BlockValuesNew.java
+8
-0
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/CodeAndPwd.java
+8
-0
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/Disease.java
+19
-0
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/DiseaseDoc.java
+9
-0
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/ExportReq.java
+23
-0
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/ReqDimValue.java
+9
-0
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/BlockValue.java
+8
-0
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/DimValue.java
+8
-0
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/DiseaseLevel.java
+15
-1
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/ListPage.java
+11
-0
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/SysMenuList.java
+7
-0
bsoft-api/src/main/java/com/bsoft/api/service/LoginService.java
+9
-0
No files found.
bsoft-api/src/main/java/com/bsoft/api/common/aspect/RequestMappingAspect.java
0 → 100644
View file @
d2c90297
package
com
.
bsoft
.
api
.
common
.
aspect
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.slf4j.Logger
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
import
java.util.List
;
@Aspect
@Component
@Order
(
2
)
@Profile
({
"test"
,
"prod"
})
public
class
RequestMappingAspect
{
@Pointcut
(
"@annotation(org.springframework.web.bind.annotation.GetMapping)"
)
public
void
getMappingAspect
(){}
@Pointcut
(
"@annotation(org.springframework.web.bind.annotation.PostMapping)"
)
public
void
postMappingAspect
(){}
@Around
(
"getMappingAspect()"
)
public
Object
get
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
return
request
(
joinPoint
);
}
@Around
(
"postMappingAspect()"
)
public
Object
post
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
return
request
(
joinPoint
);
}
private
Object
request
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
joinPoint
.
getTarget
().
getClass
());
Object
result
=
joinPoint
.
proceed
();
String
uri
=
request
.
getRequestURI
();
Object
[]
params
=
joinPoint
.
getArgs
();
List
<
Object
>
paramsList
=
Arrays
.
asList
(
params
);
logger
.
debug
(
"URL:"
+
uri
+
"入参参数:"
+
paramsList
+
"返回结果:"
+
result
);
return
result
;
}
}
bsoft-api/src/main/java/com/bsoft/api/common/configurations/LoginConfigure.java
View file @
d2c90297
package
com
.
bsoft
.
api
.
common
.
configurations
;
import
com.bsoft.api.common.intercepters.LoginIntercept
e
r
;
import
com.bsoft.api.common.intercepters.LoginIntercept
o
r
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -38,7 +38,7 @@ public class LoginConfigure implements WebMvcConfigurer {
}
@Bean
public
LoginIntercept
e
r
loginIntercepter
(){
return
new
LoginIntercept
e
r
();
public
LoginIntercept
o
r
loginIntercepter
(){
return
new
LoginIntercept
o
r
();
}
}
bsoft-api/src/main/java/com/bsoft/api/common/intercepters/LoginIntercept
e
r.java
→
bsoft-api/src/main/java/com/bsoft/api/common/intercepters/LoginIntercept
o
r.java
View file @
d2c90297
...
...
@@ -12,11 +12,11 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.io.PrintWriter
;
public
class
LoginIntercept
e
r
implements
HandlerInterceptor
{
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
LoginIntercept
e
r
.
class
);
public
class
LoginIntercept
o
r
implements
HandlerInterceptor
{
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
LoginIntercept
o
r
.
class
);
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
System
.
out
.
println
(
"LoginIntercept
e
r----------->preHandle"
);
System
.
out
.
println
(
"LoginIntercept
o
r----------->preHandle"
);
String
token
=
request
.
getHeader
(
Constants
.
TOKEN_KEY
);
if
(!
TokenUtil
.
checkToken
(
token
)){
...
...
@@ -45,7 +45,7 @@ public class LoginIntercepter implements HandlerInterceptor {
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
throws
Exception
{
System
.
out
.
println
(
"LoginIntercept
e
r----------->postHandle"
);
System
.
out
.
println
(
"LoginIntercept
o
r----------->postHandle"
);
...
...
@@ -55,7 +55,7 @@ public class LoginIntercepter implements HandlerInterceptor {
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
throws
Exception
{
System
.
out
.
println
(
"LoginIntercept
e
r------->afterCompletion"
);
System
.
out
.
println
(
"LoginIntercept
o
r------->afterCompletion"
);
HandlerInterceptor
.
super
.
afterCompletion
(
request
,
response
,
handler
,
ex
);
...
...
bsoft-api/src/main/java/com/bsoft/api/common/utils/TokenUtil.java
View file @
d2c90297
...
...
@@ -43,6 +43,10 @@ public class TokenUtil {
*/
public
static
boolean
checkToken
(
String
token
){
SysUser
user
=
(
SysUser
)
RedisUtil
.
get
(
token
);
return
user
!=
null
&&
JWTUtil
.
verifier
(
token
,
user
.
getPassword
());
boolean
result
=
user
!=
null
&&
JWTUtil
.
verifier
(
token
,
user
.
getPassword
());
if
(
result
){
RedisUtil
.
expire
(
token
,
TOKEN_TIME_OUT
);
}
return
result
;
}
}
bsoft-api/src/main/java/com/bsoft/api/controller/ExcelController.java
View file @
d2c90297
...
...
@@ -3,9 +3,11 @@ package com.bsoft.api.controller;
import
com.bsoft.api.common.Result
;
import
com.bsoft.api.common.annotations.Token
;
import
com.bsoft.api.common.handlers.GlobalExceptionHandler
;
import
com.bsoft.api.model.reqmodel.ExportReq
;
import
com.bsoft.api.service.ExcelService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringEscapeUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,12 +28,11 @@ public class ExcelController {
@PostMapping
(
"export"
)
@Token
@ApiOperation
(
"将Table转换为Xls"
)
public
Object
tableToXls
(
HttpServletRequest
request
,
@RequestBody
String
tableStr
){
public
Object
tableToXls
(
HttpServletRequest
request
,
@RequestBody
ExportReq
info
){
String
tableStr
=
StringEscapeUtils
.
unescapeHtml4
(
info
.
getTabaleStr
());
log
.
info
(
"table参数:"
+
tableStr
);
String
realPath
=
request
.
getSession
().
getServletContext
().
getRealPath
(
"/"
);
String
fileUrl
=
excelService
.
tableToXls
(
realPath
,
tableStr
);
return
Result
.
success
(
fileUrl
);
}
}
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/BlockValues.java
View file @
d2c90297
...
...
@@ -7,7 +7,17 @@ import javax.validation.constraints.NotNull;
@ApiModel
(
description
=
"调用blockValues请求的数据"
)
public
class
BlockValues
{
@ApiModelProperty
(
value
=
"pageCode"
,
required
=
true
)
private
Integer
pageCode
;
@ApiModelProperty
(
"病组"
)
private
Integer
disease
;
@ApiModelProperty
(
"科室"
)
private
Integer
department
;
@ApiModelProperty
(
"医生"
)
private
Integer
doctor
;
@ApiModelProperty
(
"时间"
)
@NotNull
(
message
=
"time 参数必传"
)
private
Integer
time
;
public
Integer
getPageCode
()
{
return
pageCode
;
...
...
@@ -49,15 +59,14 @@ public class BlockValues {
this
.
time
=
time
;
}
@ApiModelProperty
(
value
=
"pageCode"
,
required
=
true
)
private
Integer
pageCode
;
@ApiModelProperty
(
"病组"
)
private
Integer
disease
;
@ApiModelProperty
(
"科室"
)
private
Integer
department
;
@ApiModelProperty
(
"医生"
)
private
Integer
doctor
;
@ApiModelProperty
(
"时间"
)
@NotNull
(
message
=
"time 参数必传"
)
private
Integer
time
;
@Override
public
String
toString
()
{
return
"BlockValues{"
+
"pageCode="
+
pageCode
+
", disease="
+
disease
+
", department="
+
department
+
", doctor="
+
doctor
+
", time="
+
time
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/BlockValuesNew.java
View file @
d2c90297
...
...
@@ -27,4 +27,12 @@ public class BlockValuesNew {
public
void
setDim
(
Map
<
String
,
String
>
dim
)
{
this
.
dim
=
dim
;
}
@Override
public
String
toString
()
{
return
"BlockValuesNew{"
+
"pageCode="
+
pageCode
+
", dim="
+
dim
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/CodeAndPwd.java
View file @
d2c90297
...
...
@@ -29,4 +29,12 @@ public class CodeAndPwd {
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
@Override
public
String
toString
()
{
return
"CodeAndPwd{"
+
"loginName='"
+
loginName
+
'\''
+
", password='"
+
password
+
'\''
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/Disease.java
View file @
d2c90297
...
...
@@ -62,6 +62,17 @@ public class Disease {
public
void
setDept
(
String
dept
)
{
this
.
dept
=
dept
;
}
@Override
public
String
toString
()
{
return
"DiseaseIDorLevel{"
+
"date='"
+
date
+
'\''
+
", disease='"
+
disease
+
'\''
+
", level="
+
level
+
", doctor='"
+
doctor
+
'\''
+
", dept='"
+
dept
+
'\''
+
'}'
;
}
}
/**
...
...
@@ -90,6 +101,14 @@ public class Disease {
public
void
setMdcName
(
String
mdcName
)
{
this
.
mdcName
=
mdcName
;
}
@Override
public
String
toString
()
{
return
"DiseaseName{"
+
"date='"
+
date
+
'\''
+
", mdcName='"
+
mdcName
+
'\''
+
'}'
;
}
}
}
...
...
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/DiseaseDoc.java
View file @
d2c90297
...
...
@@ -53,4 +53,13 @@ public class DiseaseDoc {
this
.
deptCode
=
deptCode
;
}
@Override
public
String
toString
()
{
return
"DiseaseDoc{"
+
"docCode='"
+
docCode
+
'\''
+
", mdcCode='"
+
mdcCode
+
'\''
+
", deptCode='"
+
deptCode
+
'\''
+
", date='"
+
date
+
'\''
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/ExportReq.java
0 → 100644
View file @
d2c90297
package
com
.
bsoft
.
api
.
model
.
reqmodel
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
ExportReq
{
@ApiModelProperty
(
"Table Html"
)
private
String
tableStr
;
public
String
getTabaleStr
()
{
return
tableStr
;
}
public
void
setTableStr
(
String
tableStr
)
{
this
.
tableStr
=
tableStr
;
}
@Override
public
String
toString
()
{
return
"ExportReq{"
+
"tableStr='"
+
tableStr
+
'\''
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/ReqDimValue.java
View file @
d2c90297
...
...
@@ -38,4 +38,13 @@ public class ReqDimValue {
public
void
setDate
(
String
date
)
{
this
.
date
=
date
;
}
@Override
public
String
toString
()
{
return
"ReqDimValue{"
+
"pageCode='"
+
pageCode
+
'\''
+
", orgId="
+
orgId
+
", date='"
+
date
+
'\''
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/BlockValue.java
View file @
d2c90297
...
...
@@ -29,4 +29,12 @@ public class BlockValue {
public
void
setBody
(
List
<
Map
<
String
,
Object
>>
body
)
{
this
.
body
=
body
;
}
@Override
public
String
toString
()
{
return
"BlockValue{"
+
"blockId="
+
blockId
+
", body="
+
body
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/DimValue.java
View file @
d2c90297
...
...
@@ -26,4 +26,12 @@ public class DimValue {
public
void
setDimValues
(
List
<
SerDimValue
>
dimValues
)
{
this
.
dimValues
=
dimValues
;
}
@Override
public
String
toString
()
{
return
"DimValue{"
+
"dicDim="
+
dicDim
+
", dimValues="
+
dimValues
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/DiseaseLevel.java
View file @
d2c90297
...
...
@@ -96,5 +96,19 @@ public class DiseaseLevel {
this
.
diseaseLevelList
=
diseaseLevelList
;
}
@Override
public
String
toString
()
{
return
"DiseaseLevel{"
+
"id="
+
id
+
", mdcCode='"
+
mdcCode
+
'\''
+
", mdcName='"
+
mdcName
+
'\''
+
", date="
+
date
+
", mdcNum="
+
mdcNum
+
", parentId="
+
parentId
+
", level="
+
level
+
", orgId="
+
orgId
+
", orgName='"
+
orgName
+
'\''
+
", diseaseLevelList="
+
diseaseLevelList
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/ListPage.java
View file @
d2c90297
...
...
@@ -65,4 +65,15 @@ public class ListPage<T> {
public
void
setListData
(
List
<
T
>
listData
)
{
this
.
listData
=
listData
;
}
@Override
public
String
toString
()
{
return
"ListPage{"
+
"totalCount="
+
totalCount
+
", totalPageCount="
+
totalPageCount
+
", curPageIndex="
+
curPageIndex
+
", pageSize="
+
pageSize
+
", listData="
+
listData
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/SysMenuList.java
View file @
d2c90297
...
...
@@ -15,6 +15,13 @@ public class SysMenuList extends SysMenu {
public
List
<
SysMenuList
>
getSysMenuList
()
{
return
this
.
sysMenuList
;
}
@Override
public
String
toString
()
{
return
"SysMenuList{"
+
"sysMenuList="
+
sysMenuList
+
'}'
;
}
}
bsoft-api/src/main/java/com/bsoft/api/service/LoginService.java
View file @
d2c90297
...
...
@@ -58,5 +58,14 @@ public interface LoginService {
public
void
setOrg
(
List
<
DicOrg
>
org
)
{
this
.
org
=
org
;
}
@Override
public
String
toString
()
{
return
"LoginInfo{"
+
"token='"
+
token
+
'\''
+
", user="
+
user
+
", org="
+
org
+
'}'
;
}
}
}
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