Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄营
datax-cloud
Commits
c044641a
Commit
c044641a
authored
Apr 07, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.0项目初始化
parent
475ed253
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletions
+45
-1
ApiInterceptor.java
...x/service/data/market/api/call/config/ApiInterceptor.java
+11
-1
DataType.java
...java/cn/datax/service/data/market/api/enums/DataType.java
+34
-0
No files found.
datax-modules/data-market-service-parent/data-market-service-api-call/src/main/java/cn/datax/service/data/market/api/call/config/ApiInterceptor.java
View file @
c044641a
...
...
@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -84,6 +85,15 @@ public class ApiInterceptor implements HandlerInterceptor {
}
}
}
// 接收参数
String
bodyString
=
HttpUtil
.
getBodyString
(
request
);
Map
<
String
,
Object
>
params
=
JSON
.
parseObject
(
bodyString
);
dataApiEntity
.
getReqParams
().
stream
().
forEach
(
param
->
{
if
(
params
.
containsKey
(
param
.
getParamName
()))
{
Integer
dataType
=
param
.
getDataType
();
// 数据类型转换
}
});
String
apiName
=
dataApiEntity
.
getApiName
();
Integer
rateLimit
=
dataApiEntity
.
getRateLimit
();
rateLimit
=
Optional
.
ofNullable
(
rateLimit
).
orElse
(
DataConstant
.
TrueOrFalse
.
TRUE
.
getKey
());
...
...
@@ -117,7 +127,7 @@ public class ApiInterceptor implements HandlerInterceptor {
log
.
setCallerId
(
userId
);
log
.
setCallerIp
(
ipAddr
);
log
.
setCallerUrl
(
uri
);
log
.
setCallerParams
(
HttpUtil
.
getBodyString
(
request
)
);
log
.
setCallerParams
(
bodyString
);
log
.
setCallerDate
(
LocalDateTime
.
now
());
log
.
setTime
(
System
.
currentTimeMillis
());
log
.
setStatus
(
DataConstant
.
TrueOrFalse
.
TRUE
.
getKey
());
...
...
datax-modules/data-market-service-parent/data-market-service-api/src/main/java/cn/datax/service/data/market/api/enums/DataType.java
0 → 100644
View file @
c044641a
package
cn
.
datax
.
service
.
data
.
market
.
api
.
enums
;
public
enum
DataType
{
String
(
1
,
"字符串"
),
Integer
(
2
,
"整型"
),
Float
(
3
,
"浮点型"
),
Date
(
4
,
"时间"
),
List
(
5
,
"集合"
);
private
final
Integer
key
;
private
final
String
val
;
DataType
(
Integer
key
,
String
val
)
{
this
.
key
=
key
;
this
.
val
=
val
;
}
public
Integer
getKey
()
{
return
key
;
}
public
String
getVal
()
{
return
val
;
}
// public Object parse(Object obj) {
// if (obj == null) return null;
// switch (this) {
//
// }
// }
}
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