Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
2695da52
Commit
2695da52
authored
Dec 21, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
436ffdf8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
15 deletions
+121
-15
MybatisPlusConfig.java
...way/src/main/java/com/jz/dm/config/MybatisPlusConfig.java
+11
-11
FilterChainFactory.java
...ay/src/main/java/com/jz/dm/filter/FilterChainFactory.java
+1
-1
FilterChainImpl.java
...teway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
+1
-1
FilterFactory.java
...gateway/src/main/java/com/jz/dm/filter/FilterFactory.java
+1
-0
VerifySignFilter.java
...eway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
+0
-2
DateFormatTest.java
...test/java/com/jz/dm/gateway/apigetway/DateFormatTest.java
+60
-0
OpenApiTest.java
...rc/test/java/com/jz/dm/gateway/apigetway/OpenApiTest.java
+46
-0
pom.xml
pom.xml
+1
-0
No files found.
jz-dm-apigateway/src/main/java/com/jz/dm/config/MybatisPlusConfig.java
View file @
2695da52
...
...
@@ -18,17 +18,17 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@MapperScan
(
"com.jz.dm.mapper"
)
public
class
MybatisPlusConfig
{
//
@Bean
//
public PaginationInterceptor paginationInterceptor() {
//
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
//
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
//
// paginationInterceptor.setOverflow(false);
//
// 设置最大单页限制数量,默认 500 条,-1 不受限制
//
paginationInterceptor.setLimit(500);
//
// 开启 count 的 join 优化,只针对部分 left join
// paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true
));
//
return paginationInterceptor;
//
}
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInterceptor
.
setLimit
(
500
);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor
.
setCountSqlParser
(
new
JsqlParserCountOptimize
(
));
return
paginationInterceptor
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainFactory.java
View file @
2695da52
...
...
@@ -7,7 +7,7 @@ import java.util.List;
/**
* 过滤链工厂
* @author
key
* @author
zc
*/
@Component
public
class
FilterChainFactory
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
View file @
2695da52
...
...
@@ -15,7 +15,7 @@ import java.util.List;
/**
* 过滤链
*
* @author
key
* @author
zc
*/
public
class
FilterChainImpl
implements
FilterChain
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterFactory.java
View file @
2695da52
...
...
@@ -9,6 +9,7 @@ import java.util.List;
/**
* 过滤器工厂
*
* @author key
*/
@Component
public
class
FilterFactory
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
View file @
2695da52
...
...
@@ -19,8 +19,6 @@ import java.security.interfaces.RSAPublicKey;
@Component
public
class
VerifySignFilter
extends
AbstractFilter
{
//@Autowired
//private IApiWhiteService apiWhiteService;
private
final
static
String
CHARSET
=
"UTF-8"
;
@Override
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/apigetway/DateFormatTest.java
0 → 100644
View file @
2695da52
package
com
.
jz
.
dm
.
gateway
.
apigetway
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.apigetway
* @PROJECT_NAME: jz-dm-parent
* @NAME: DateFormatTest
* @USER: key
* @DATE: 2020-12-15/18:16
* @DAY_NAME_SHORT: 周二
* @Description:
**/
public
class
DateFormatTest
{
public
static
void
main
(
String
[]
args
)
{
try
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
currentTime
=
df
.
parse
(
"2020-12-16 13:31:40"
);
//当前系统时间
Date
firstTime
=
df
.
parse
(
"2020-01-02 11:30:24"
);
//查询的数据时间
String
str
=
getTime
(
currentTime
,
firstTime
);
System
.
out
.
println
(
"获取的年月日时分秒时间差为:"
+
str
);;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
//获取时间差方法
public
static
String
getTime
(
Date
currentTime
,
Date
firstTime
){
long
diff
=
currentTime
.
getTime
()
-
firstTime
.
getTime
();
//这样得到的差值是微秒级别
Calendar
currentTimes
=
dataToCalendar
(
currentTime
);
//当前系统时间转Calendar类型
Calendar
firstTimes
=
dataToCalendar
(
firstTime
);
//查询的数据时间转Calendar类型
int
year
=
currentTimes
.
get
(
Calendar
.
YEAR
)
-
firstTimes
.
get
(
Calendar
.
YEAR
);
//获取年
int
month
=
currentTimes
.
get
(
Calendar
.
MONTH
)
-
firstTimes
.
get
(
Calendar
.
MONTH
);
int
day
=
currentTimes
.
get
(
Calendar
.
DAY_OF_MONTH
)
-
firstTimes
.
get
(
Calendar
.
DAY_OF_MONTH
);
if
(
day
<
0
)
{
month
-=
1
;
currentTimes
.
add
(
Calendar
.
MONTH
,
-
1
);
day
=
day
+
currentTimes
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
);
//获取日
}
if
(
month
<
0
)
{
month
=
(
month
+
12
)
%
12
;
//获取月
year
--;
}
long
days
=
diff
/
(
1000
*
60
*
60
*
24
);
long
hours
=
(
diff
-
days
*(
1000
*
60
*
60
*
24
))/(
1000
*
60
*
60
);
//获取时
long
minutes
=
(
diff
-
days
*(
1000
*
60
*
60
*
24
)-
hours
*(
1000
*
60
*
60
))/(
1000
*
60
);
//获取分钟
long
s
=(
diff
/
1000
-
days
*
24
*
60
*
60
-
hours
*
60
*
60
-
minutes
*
60
);
//获取秒
String
CountTime
=
""
+
year
+
"年"
+
month
+
"月"
+
day
+
"天"
+
hours
+
"小时"
+
minutes
+
"分"
+
s
+
"秒"
;
return
CountTime
;
}
//Date类型转Calendar类型
public
static
Calendar
dataToCalendar
(
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
return
calendar
;
}
}
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/apigetway/OpenApiTest.java
0 → 100644
View file @
2695da52
package
com
.
jz
.
dm
.
gateway
.
apigetway
;
import
com.alibaba.fastjson.JSON
;
import
com.jz.dm.common.util.WebUtils
;
import
java.lang.String
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.apigetway
* @PROJECT_NAME: jz-dm-parent
* @NAME: OpenApiTest
* @USER: key
* @DATE: 2020-12-6/12:53
* @DAY_NAME_SHORT: 周日
* @Description:
**/
public
class
OpenApiTest
{
private
static
String
uri
=
"http://localhost:8088/gateway"
;
public
static
void
main
(
String
[]
args
)
{
TestApi
();
}
protected
static
void
TestApi
(){
try
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appKey"
,
"202013114ss"
);
map
.
put
(
"method"
,
"query"
);
map
.
put
(
"charset"
,
"UTF-8"
);
map
.
put
(
"signType"
,
"MD5"
);
map
.
put
(
"timestamp"
,
java
.
lang
.
String
.
valueOf
(
System
.
currentTimeMillis
()));
map
.
put
(
"version"
,
"V1.0.0"
);
map
.
put
(
"sign"
,
"fgsvoivhiao114356"
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"account_no"
,
"12345667"
);
params
.
put
(
"account_type"
,
"WBANK"
);
map
.
put
(
"params"
,
JSON
.
toJSONString
(
params
));
WebUtils
.
post
(
uri
,
map
);
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
}
}
pom.xml
View file @
2695da52
...
...
@@ -265,6 +265,7 @@
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
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