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
48a9ce55
Commit
48a9ce55
authored
Jan 07, 2021
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改重置盐值接口
parent
c050d053
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
243 additions
and
105 deletions
+243
-105
api_gateway.sql
database/zc/api_gateway.sql
+2
-2
pom.xml
jz-dm-apigateway/pom.xml
+6
-4
GatewayResultCode.java
...c/main/java/com/jz/dm/common/enums/GatewayResultCode.java
+0
-2
SignatureException.java
...n/java/com/jz/dm/common/exception/SignatureException.java
+51
-0
MapUtil.java
...igateway/src/main/java/com/jz/dm/common/util/MapUtil.java
+91
-14
OpenApiRequest.java
...y/src/main/java/com/jz/dm/common/util/OpenApiRequest.java
+3
-3
GatewayController.java
...src/main/java/com/jz/dm/controller/GatewayController.java
+1
-1
AuthFilter.java
...apigateway/src/main/java/com/jz/dm/filter/AuthFilter.java
+17
-2
CheckTimestampFilter.java
.../src/main/java/com/jz/dm/filter/CheckTimestampFilter.java
+4
-4
InvokeRouteFilter.java
...way/src/main/java/com/jz/dm/filter/InvokeRouteFilter.java
+1
-11
VerifySignFilter.java
...eway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
+32
-29
DefaultOpenApiDispatcher.java
...main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
+1
-1
DispatchContext.java
...src/main/java/com/jz/dm/models/enity/DispatchContext.java
+1
-1
SaltResetReq.java
...src/main/java/com/jz/dm/models/req/auth/SaltResetReq.java
+3
-3
AuthServiceImpl.java
...src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
+6
-2
ApiQueryService.java
.../main/java/com/jz/dm/service/request/ApiQueryService.java
+15
-13
application-test.yml
jz-dm-apigateway/src/main/resources/application-test.yml
+8
-12
UrlUtil.java
jz-dm-common/src/main/java/com/jz/common/utils/UrlUtil.java
+1
-1
No files found.
database/zc/api_gateway.sql
View file @
48a9ce55
...
@@ -6,7 +6,7 @@ CREATE TABLE `t_api_interface` (
...
@@ -6,7 +6,7 @@ CREATE TABLE `t_api_interface` (
`api_name`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'api名称'
,
`api_name`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'api名称'
,
`api_desc`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'api描述'
,
`api_desc`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'api描述'
,
`api_protocl`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'api请求协议:http,https'
,
`api_protocl`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'api请求协议:http,https'
,
`api_path`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'请求地址'
`api_path`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'请求地址'
,
`target_url`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'目标url'
,
`target_url`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'目标url'
,
`api_type`
varchar
(
50
)
NULL
DEFAULT
''
COMMENT
'api类型:1 数据银行制作API 2 数据银行制作数据包, 3 API实时接入 6 标签查询 9自定义'
,
`api_type`
varchar
(
50
)
NULL
DEFAULT
''
COMMENT
'api类型:1 数据银行制作API 2 数据银行制作数据包, 3 API实时接入 6 标签查询 9自定义'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
...
@@ -136,7 +136,7 @@ CREATE TABLE `t_api_req_log` (
...
@@ -136,7 +136,7 @@ CREATE TABLE `t_api_req_log` (
`trans_mode`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'传输方式:POST,GET'
,
`trans_mode`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'传输方式:POST,GET'
,
`request_token`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'客户请求token'
,
`request_token`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'客户请求token'
,
`request_time`
datetime
DEFAULT
NULL
COMMENT
'请求时间'
,
`request_time`
datetime
DEFAULT
NULL
COMMENT
'请求时间'
,
`
remark
`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'状态:SUCCEED 请求成功, FAIL 请求失败'
,
`
status
`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'状态:SUCCEED 请求成功, FAIL 请求失败'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`create_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'创建人'
,
`create_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'创建人'
,
...
...
jz-dm-apigateway/pom.xml
View file @
48a9ce55
...
@@ -96,11 +96,13 @@
...
@@ -96,11 +96,13 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
</dependency>
<!--<dependency>
<!-- 校验-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>spring-boot-starter-
data-redis
</artifactId>
<artifactId>
spring-boot-starter-
validation
</artifactId>
<version>2.2.5.RELEASE</version
>
</dependency
>
</dependency>-->
<dependency>
<dependency>
<groupId>
net.sf.json-lib
</groupId>
<groupId>
net.sf.json-lib
</groupId>
<artifactId>
json-lib
</artifactId>
<artifactId>
json-lib
</artifactId>
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/GatewayResultCode.java
View file @
48a9ce55
...
@@ -48,8 +48,6 @@ public enum GatewayResultCode implements ResultCode {
...
@@ -48,8 +48,6 @@ public enum GatewayResultCode implements ResultCode {
/** 无效路由类型 */
/** 无效路由类型 */
ILLEGAL_ROUTE_TYPE
(
"ILLEGAL_ROUTE_TYPE"
,
"无效路由类型"
),
ILLEGAL_ROUTE_TYPE
(
"ILLEGAL_ROUTE_TYPE"
,
"无效路由类型"
),
/** ip不允许访问 */
IP_NOT_ALLOW_ACCESS
(
"IP_NOT_ALLOW_ACCESS"
,
"ip不允许访问"
),
/** 提交数据过大 */
/** 提交数据过大 */
POST_DATA_TOO_LARGE
(
"POST_DATA_TOO_LARGE"
,
"提交数据过大"
),
POST_DATA_TOO_LARGE
(
"POST_DATA_TOO_LARGE"
,
"提交数据过大"
),
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/exception/SignatureException.java
0 → 100644
View file @
48a9ce55
package
com
.
jz
.
dm
.
common
.
exception
;
import
com.jz.dm.common.util.ResultCode
;
/**
* 签名异常
*
*/
public
class
SignatureException
extends
OpenApiException
{
private
static
final
long
serialVersionUID
=
6551962245794846748L
;
/**
* 构造函数
*
* @param resultCode
*/
public
SignatureException
(
ResultCode
resultCode
)
{
super
(
resultCode
);
}
/**
* 构造函数
* @param resultCode
* @param detailMessage
*/
public
SignatureException
(
ResultCode
resultCode
,
String
detailMessage
)
{
super
(
resultCode
,
detailMessage
);
}
/**
* 构造函数
* @param resultCode
* @param cause
*/
public
SignatureException
(
ResultCode
resultCode
,
Throwable
cause
)
{
super
(
resultCode
,
cause
);
}
/**
* 构造函数
* @param resultCode
* @param detailMessage
* @param cause
*/
public
SignatureException
(
ResultCode
resultCode
,
String
detailMessage
,
Throwable
cause
)
{
super
(
resultCode
,
detailMessage
,
cause
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/MapUtil.java
View file @
48a9ce55
...
@@ -3,8 +3,11 @@ package com.jz.dm.common.util;
...
@@ -3,8 +3,11 @@ package com.jz.dm.common.util;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
java.util.*
;
/**
/**
* @author ZC
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.util
* @PACKAGE_NAME: com.jz.dm.common.util
...
@@ -16,35 +19,59 @@ import java.util.*;
...
@@ -16,35 +19,59 @@ import java.util.*;
**/
**/
public
class
MapUtil
{
public
class
MapUtil
{
/**
/**
* 对参数进行字典排序
* 获取签名参数
* @param apiKey
* @param method
* @param signType
* @param timestamp
* @return
*/
public
static
String
getSignValue
(
String
apiKey
,
String
method
,
String
signType
,
String
timestamp
){
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"apiKey="
).
append
(
apiKey
).
append
(
"&"
)
.
append
(
"method="
).
append
(
method
).
append
(
"&"
)
.
append
(
"signType="
).
append
(
signType
).
append
(
"&"
)
.
append
(
"timestamp="
).
append
(
timestamp
);
return
builder
.
toString
();
}
/**
* 给map集合中的key实现字典排序
* @param map
* @param map
* @return
* @return
*/
*/
public
static
List
directSort
(
Map
map
){
public
Map
<
String
,
Object
>
MapKeySort
(
Map
<
String
,
Object
>
map
){
List
list
=
new
ArrayList
();
ArrayList
list
=
new
ArrayList
();
Iterator
iter
=
map
.
entrySet
().
iterator
();
//获得map的Iterator
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
())
{
while
(
iter
.
hasNext
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
iter
.
next
();
list
.
add
(
entry
.
getKey
());
list
.
add
(
entry
.
getKey
());
//System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
}
}
Collections
.
sort
(
list
);
return
list
;
}
HashMap
<
String
,
Object
>
newMap
=
new
HashMap
<
String
,
Object
>();
//运用Collections的sort()方法对其进行排序 sort()方法需要传 连个参数,一个是需要进行排序的Collection 另一个是一个Comparator
Collections
.
sort
(
list
,
new
SpellComparatorUtils
());
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
newMap
.
put
(
list
.
get
(
i
).
toString
()
,
map
.
get
(
list
.
get
(
i
).
toString
()));
}
return
newMap
;
}
/**
/**
* 将对象转成TreeMap,属性名为key,属性值为value
* 将对象转成TreeMap,属性名为key,属性值为value
* @param object 对象
*
* @param object 对象
* @return
* @return
* @throws IllegalAccessException
* @throws IllegalAccessException
*/
*/
public
static
TreeMap
<
String
,
Object
>
objToMap
(
Object
object
)
throws
IllegalAccessException
{
public
static
TreeMap
<
String
,
String
>
objToMap
(
Object
object
)
throws
IllegalAccessException
{
Class
clazz
=
object
.
getClass
();
Class
clazz
=
object
.
getClass
();
TreeMap
<
String
,
Object
>
treeMap
=
new
TreeMap
<
String
,
Object
>();
TreeMap
<
String
,
String
>
treeMap
=
new
TreeMap
<
String
,
String
>();
while
(
null
!=
clazz
.
getSuperclass
()
)
{
while
(
null
!=
clazz
.
getSuperclass
()
)
{
Field
[]
declaredFields1
=
clazz
.
getDeclaredFields
();
Field
[]
declaredFields1
=
clazz
.
getDeclaredFields
();
for
(
Field
field
:
declaredFields1
)
{
for
(
Field
field
:
declaredFields1
)
{
...
@@ -63,7 +90,7 @@ public class MapUtil {
...
@@ -63,7 +90,7 @@ public class MapUtil {
if
(
value
instanceof
List
)
{
if
(
value
instanceof
List
)
{
value
=
JSON
.
toJSONString
(
value
);
value
=
JSON
.
toJSONString
(
value
);
}
}
treeMap
.
put
(
name
,
value
);
treeMap
.
put
(
name
,
String
.
valueOf
(
value
)
);
}
}
}
}
...
@@ -74,6 +101,7 @@ public class MapUtil {
...
@@ -74,6 +101,7 @@ public class MapUtil {
/**
/**
* 按照指定的分割符将list转换为String
* 按照指定的分割符将list转换为String
*
* @param list
* @param list
* @param separator
* @param separator
* @return
* @return
...
@@ -90,4 +118,53 @@ public class MapUtil {
...
@@ -90,4 +118,53 @@ public class MapUtil {
}
}
return
sb
.
toString
();
return
sb
.
toString
();
}
}
/**
* * 把数组所有元素排序,并按照“参数=参数值”的模式用“&”字符拼接成字符串
* * @param params 需要排序并参与字符拼接的参数组
* * @return 拼接后字符串
* * @throws UnsupportedEncodingException
*/
public
static
String
createLinkStringByGet
(
Map
<
String
,
String
>
params
)
{
List
<
String
>
keys
=
new
ArrayList
<
String
>(
params
.
keySet
());
Collections
.
sort
(
keys
);
String
prestr
=
""
;
for
(
int
i
=
0
;
i
<
keys
.
size
();
i
++)
{
String
key
=
keys
.
get
(
i
);
String
value
=
params
.
get
(
key
);
try
{
value
=
URLEncoder
.
encode
(
value
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
if
(
i
==
keys
.
size
()
-
1
)
{
//拼接时,不包括最后一个&字符
prestr
=
prestr
+
key
+
"="
+
value
;
}
else
{
prestr
=
prestr
+
key
+
"="
+
value
+
"&"
;
}
}
return
prestr
;
}
class
SpellComparatorUtils
implements
Comparator
{
@Override
public
int
compare
(
Object
o1
,
Object
o2
)
{
try
{
// 取得比较对象的汉字编码,并将其转换成字符串
String
s1
=
new
String
(
o1
.
toString
().
getBytes
(
"GB2312"
),
"ISO-8859-1"
);
String
s2
=
new
String
(
o2
.
toString
().
getBytes
(
"GB2312"
),
"ISO-8859-1"
);
// 运用String类的 compareTo()方法对两对象进行比较
return
s1
.
compareTo
(
s2
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
0
;
}
}
public
static
void
main
(
String
[]
args
)
{
Map
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"name"
,
"hello"
);
map
.
put
(
"value"
,
"world"
);
System
.
out
.
println
(
createLinkStringByGet
(
map
));
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/OpenApiRequest.java
View file @
48a9ce55
...
@@ -40,12 +40,12 @@ public class OpenApiRequest {
...
@@ -40,12 +40,12 @@ public class OpenApiRequest {
}
}
}
}
public
String
getAp
p
Key
()
{
public
String
getAp
i
Key
()
{
return
apiKey
;
return
apiKey
;
}
}
public
void
setAp
pKey
(
String
app
Key
)
{
public
void
setAp
iKey
(
String
api
Key
)
{
this
.
apiKey
=
ap
p
Key
;
this
.
apiKey
=
ap
i
Key
;
}
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/GatewayController.java
View file @
48a9ce55
...
@@ -25,7 +25,7 @@ import java.util.Map;
...
@@ -25,7 +25,7 @@ import java.util.Map;
* @author zc
* @author zc
*/
*/
@RestController
@RestController
@RequestMapping
(
"api
/
"
)
@RequestMapping
(
"api"
)
@Api
(
tags
=
{
"api请求controller"
})
@Api
(
tags
=
{
"api请求controller"
})
public
class
GatewayController
{
public
class
GatewayController
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/AuthFilter.java
View file @
48a9ce55
...
@@ -9,6 +9,7 @@ import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
...
@@ -9,6 +9,7 @@ import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import
com.jz.dm.common.enums.org.OrgStatusEnum
;
import
com.jz.dm.common.enums.org.OrgStatusEnum
;
import
com.jz.dm.common.exception.GatewayException
;
import
com.jz.dm.common.exception.GatewayException
;
import
com.jz.dm.common.util.DateUtil
;
import
com.jz.dm.common.util.DateUtil
;
import
com.jz.dm.common.util.LogUtil
;
import
com.jz.dm.models.domian.ApiAuth
;
import
com.jz.dm.models.domian.ApiAuth
;
import
com.jz.dm.models.domian.ApiInterface
;
import
com.jz.dm.models.domian.ApiInterface
;
import
com.jz.dm.models.domian.ApiOrg
;
import
com.jz.dm.models.domian.ApiOrg
;
...
@@ -18,6 +19,8 @@ import com.jz.dm.service.ApiInterfaceService;
...
@@ -18,6 +19,8 @@ import com.jz.dm.service.ApiInterfaceService;
import
com.jz.dm.service.AuthService
;
import
com.jz.dm.service.AuthService
;
import
com.jz.dm.service.OrganizationManageService
;
import
com.jz.dm.service.OrganizationManageService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -38,6 +41,7 @@ import java.util.Date;
...
@@ -38,6 +41,7 @@ import java.util.Date;
@Component
(
"authFilter"
)
@Component
(
"authFilter"
)
@Slf4j
@Slf4j
public
class
AuthFilter
extends
AbstractFilter
{
public
class
AuthFilter
extends
AbstractFilter
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AuthFilter
.
class
);
@Autowired
@Autowired
private
AuthService
authService
;
private
AuthService
authService
;
...
@@ -86,11 +90,21 @@ public class AuthFilter extends AbstractFilter {
...
@@ -86,11 +90,21 @@ public class AuthFilter extends AbstractFilter {
}
}
checkBill
(
request
,
authCode
,
authAuth
,
apiOrg
);
checkBill
(
request
,
authCode
,
authAuth
,
apiOrg
);
}
}
chain
.
doFilter
(
request
,
response
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
e
instanceof
GatewayException
){
throw
(
GatewayException
)
e
;
}
log
.
error
(
"~~~~~~~~~~~~~~~~认证过滤异常~~~~~~~~~~~~~~~~~"
);
log
.
error
(
"~~~~~~~~~~~~~~~~认证过滤异常~~~~~~~~~~~~~~~~~"
);
log
.
error
(
"异常信息:{}"
,
e
.
getMessage
());
log
.
error
(
"异常信息:{}"
,
e
.
getMessage
());
LogUtil
.
error
(
LOGGER
,
e
,
"authFilter doFilter error. response="
+
response
.
getResponse
());
response
.
clearAttributes
();
response
.
setCode
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setMsg
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
}
}
chain
.
doFilter
(
request
,
response
);
}
}
/**
/**
...
@@ -127,6 +141,7 @@ public class AuthFilter extends AbstractFilter {
...
@@ -127,6 +141,7 @@ public class AuthFilter extends AbstractFilter {
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
log
.
error
(
"~~~~~~~~~~~~~~~~~~~~~~过滤计次信息异常~~~~~~~~~~~~~~~~~~~"
);
log
.
error
(
"~~~~~~~~~~~~~~~~~~~~~~过滤计次信息异常~~~~~~~~~~~~~~~~~~~"
);
log
.
error
(
"异常信息:{}"
,
ex
.
getMessage
());
log
.
error
(
"异常信息:{}"
,
ex
.
getMessage
());
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_LIMIT_EXCEPTION
);
}
}
break
;
break
;
case
"RECORD_TIME_MODE"
:
//按时间调用
case
"RECORD_TIME_MODE"
:
//按时间调用
...
@@ -135,7 +150,7 @@ public class AuthFilter extends AbstractFilter {
...
@@ -135,7 +150,7 @@ public class AuthFilter extends AbstractFilter {
Date
currentDate
=
dateFormat
.
parse
(
formatDate
);
Date
currentDate
=
dateFormat
.
parse
(
formatDate
);
Date
validEndTime
=
authAuth
.
getValidEndTime
();
Date
validEndTime
=
authAuth
.
getValidEndTime
();
//如果 date1 在 date2 之前,before 返回 true,否则返回 false
//如果 date1 在 date2 之前,before 返回 true,否则返回 false
if
(
currentDate
.
before
(
validEndTime
))
{
//超出时间
if
(
currentDate
.
after
(
validEndTime
))
{
//超出时间
throw
new
GatewayException
(
GatewayResultCode
.
RATE_LIMIT_EXCEEDED
);
throw
new
GatewayException
(
GatewayResultCode
.
RATE_LIMIT_EXCEEDED
);
}
}
break
;
break
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckTimestampFilter.java
View file @
48a9ce55
...
@@ -8,10 +8,10 @@ import com.jz.dm.common.enums.GatewayResultCode;
...
@@ -8,10 +8,10 @@ import com.jz.dm.common.enums.GatewayResultCode;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
*
时间戳校验过滤器
* @Description:
时间戳校验过滤器
*
* @Author: Mr.zhang
* @author key
* @Date: 2021-1-6
*/
*/
@Component
@Component
public
class
CheckTimestampFilter
extends
AbstractFilter
{
public
class
CheckTimestampFilter
extends
AbstractFilter
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/InvokeRouteFilter.java
View file @
48a9ce55
...
@@ -44,17 +44,8 @@ public class InvokeRouteFilter extends AbstractFilter {
...
@@ -44,17 +44,8 @@ public class InvokeRouteFilter extends AbstractFilter {
//当前系统时间戳
//当前系统时间戳
long
startTime
=
System
.
currentTimeMillis
();
long
startTime
=
System
.
currentTimeMillis
();
try
{
try
{
//OpenApi openApi = (OpenApi) RequestContext.getCurrentContext().get("openApi");
//if (openApi.getRouteType() == null) {
// throw new GatewayException(GatewayResultCode.ILLEGAL_ROUTE_TYPE);
//}
//if (openApi.getRouteType() != RouteType.SRPING) {
// chain.doFilter(request, response);
// return;
//}
DispatchContext
context
=
new
DispatchContext
();
DispatchContext
context
=
new
DispatchContext
();
context
.
setAp
p
Key
(
request
.
getApiKey
());
//apiKey
context
.
setAp
i
Key
(
request
.
getApiKey
());
//apiKey
context
.
setOpenApiMethod
(
request
.
getMethod
());
//方法 例如:tradd.add
context
.
setOpenApiMethod
(
request
.
getMethod
());
//方法 例如:tradd.add
context
.
setOpenApiParams
(
request
.
getParams
());
//入参
context
.
setOpenApiParams
(
request
.
getParams
());
//入参
context
.
setOpenApiVersion
(
request
.
getVersion
());
//版本号
context
.
setOpenApiVersion
(
request
.
getVersion
());
//版本号
...
@@ -64,7 +55,6 @@ public class InvokeRouteFilter extends AbstractFilter {
...
@@ -64,7 +55,6 @@ public class InvokeRouteFilter extends AbstractFilter {
context
.
setExtAttribute
(
attribute
.
name
,
attribute
.
value
);
context
.
setExtAttribute
(
attribute
.
name
,
attribute
.
value
);
}
}
}
}
openApiResponse
=
defaultOpenApiDispatcher
.
doDispatch
(
context
);
openApiResponse
=
defaultOpenApiDispatcher
.
doDispatch
(
context
);
JSONObject
jsonObject
=
(
JSONObject
)
JSON
.
parse
(
openApiResponse
);
JSONObject
jsonObject
=
(
JSONObject
)
JSON
.
parse
(
openApiResponse
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
View file @
48a9ce55
...
@@ -2,30 +2,30 @@ package com.jz.dm.filter;
...
@@ -2,30 +2,30 @@ package com.jz.dm.filter;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.constant.LoggingConstants
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.exception.GatewayException
;
import
com.jz.dm.common.exception.GatewayException
;
import
com.jz.dm.common.exception.SignatureException
;
import
com.jz.dm.common.util.LogUtil
;
import
com.jz.dm.common.util.MapUtil
;
import
com.jz.dm.common.util.MapUtil
;
import
com.jz.dm.common.util.Md5
;
import
com.jz.dm.common.util.Md5
;
import
com.jz.dm.models.domian.ApiAuth
;
import
com.jz.dm.models.domian.ApiAuth
;
import
com.jz.dm.models.enity.GatewayRequest
;
import
com.jz.dm.models.enity.GatewayRequest
;
import
com.jz.dm.models.enity.GatewayResponse
;
import
com.jz.dm.models.enity.GatewayResponse
;
import
com.jz.dm.service.ApiInterfaceService
;
import
com.jz.dm.service.ApiInterfaceService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.TreeMap
;
/**
/**
* 验签过滤器(验证签名信息)
* @Description: 验签过滤器(验证签名信息)
*/
* @Author: Mr.zhang
@Slf4j
* @Date: 2021-1-6
*/
@Component
@Component
public
class
VerifySignFilter
extends
AbstractFilter
{
public
class
VerifySignFilter
extends
AbstractFilter
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
VerifySignFilter
.
class
);
@Autowired
@Autowired
private
ApiInterfaceService
apiInterfaceService
;
private
ApiInterfaceService
apiInterfaceService
;
@Override
@Override
...
@@ -41,36 +41,39 @@ public class VerifySignFilter extends AbstractFilter {
...
@@ -41,36 +41,39 @@ public class VerifySignFilter extends AbstractFilter {
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
FilterChain
chain
)
{
try
{
try
{
TreeMap
<
String
,
Object
>
map
=
MapUtil
.
objToMap
(
request
);
String
signParams
=
MapUtil
.
getSignValue
(
request
.
getApiKey
(),
request
.
getMethod
(),
if
(
null
==
map
){
request
.
getSignType
(),
String
.
valueOf
(
request
.
getTimestamp
()));
log
.
info
(
"~~~~~~~~~~~~~~~签名数据转换map异常~~~~~~~~~~~~~~~~~~"
);
if
(
StringUtils
.
isNotBlank
(
signParams
)){
throw
new
GatewayException
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
);
}
List
signParams
=
MapUtil
.
directSort
(
map
);
if
(
CollectionUtils
.
isNotEmpty
(
signParams
)){
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
request
.
getParams
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
request
.
getParams
());
//需要传入授权码
//需要传入授权码
ApiAuth
apiAuthInfo
=
apiInterfaceService
.
getApiAuthInfo
(
request
.
getApiKey
(),
jsonObject
.
getString
(
"authCode"
));
ApiAuth
apiAuthInfo
=
apiInterfaceService
.
getApiAuthInfo
(
request
.
getApiKey
(),
jsonObject
.
getString
(
"authCode"
));
if
(
null
==
apiAuthInfo
){
if
(
null
==
apiAuthInfo
){
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
}
}
String
paramStr
=
MapUtil
.
listToString
(
signParams
,
LoggingConstants
.
AND_SPILT
);
String
salt
=
Md5
.
encrypt
(
signParams
,
apiAuthInfo
.
getSalt
());
String
salt
=
Md5
.
encrypt
(
paramStr
,
apiAuthInfo
.
getSalt
());
if
(!
request
.
getSign
().
equals
(
salt
)){
if
(!
request
.
getSign
().
equals
(
salt
)){
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
}
}
}
else
{
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
}
}
}
catch
(
Exception
e
)
{
chain
.
doFilter
(
request
,
response
);
log
.
error
(
"~~~~~~~~~~~~~~签名过滤异常~~~~~~~~~~~~~~~~~~"
);
}
catch
(
SignatureException
ex
)
{
log
.
error
(
"异常信息:{}"
,
e
.
getMessage
());
LogUtil
.
error
(
LOGGER
,
ex
,
"sign response error. response="
+
response
.
getResponse
());
response
.
clearAttributes
();
response
.
setCode
(
ex
.
getResultCode
().
getCode
());
response
.
setMsg
(
ex
.
getResultCode
().
getMsg
());
}
catch
(
Throwable
ex
)
{
if
(
ex
instanceof
GatewayException
){
throw
(
GatewayException
)
ex
;
}
LogUtil
.
error
(
LOGGER
,
ex
,
"signatureFilter doFilter error. response="
+
response
.
getResponse
());
response
.
clearAttributes
();
response
.
setCode
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setMsg
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
}
}
// 后期再扩展
//OpenApi openApi = new OpenApi();
//openApi.setApplication("JZ_API_GATEWAY");//应用
//openApi.setRouteType(RouteType.SRPING);//漏油类型
//RequestContext.getCurrentContext().set("openApi", openApi);
chain
.
doFilter
(
request
,
response
);
}
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
View file @
48a9ce55
...
@@ -68,7 +68,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
...
@@ -68,7 +68,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
try
{
try
{
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
request
.
setAp
pKey
(
context
.
getApp
Key
());
request
.
setAp
iKey
(
context
.
getApi
Key
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
openApiService
.
doService
(
request
,
response
);
openApiService
.
doService
(
request
,
response
);
}
catch
(
Throwable
ex
)
{
}
catch
(
Throwable
ex
)
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/enity/DispatchContext.java
View file @
48a9ce55
...
@@ -20,7 +20,7 @@ public class DispatchContext implements Serializable {
...
@@ -20,7 +20,7 @@ public class DispatchContext implements Serializable {
/**
/**
* api唯一标识
* api唯一标识
*/
*/
private
String
ap
p
Key
;
private
String
ap
i
Key
;
/**
/**
* openapi接口
* openapi接口
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/SaltResetReq.java
View file @
48a9ce55
...
@@ -19,9 +19,9 @@ import java.io.Serializable;
...
@@ -19,9 +19,9 @@ import java.io.Serializable;
@Data
@Data
@ApiModel
(
"盐值重置请求体"
)
@ApiModel
(
"盐值重置请求体"
)
public
class
SaltResetReq
implements
Serializable
{
public
class
SaltResetReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"
id
"
,
required
=
true
)
@ApiModelProperty
(
value
=
"
授权码
"
,
required
=
true
)
@NotNull
(
message
=
"
id
不能为空"
)
@NotNull
(
message
=
"
授权码
不能为空"
)
private
Long
id
;
private
String
authCode
;
/*@ApiModelProperty(value = "盐值",required = true)
/*@ApiModelProperty(value = "盐值",required = true)
@NotNull(message = "盐值不能为空")
@NotNull(message = "盐值不能为空")
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
View file @
48a9ce55
...
@@ -263,7 +263,11 @@ public class AuthServiceImpl implements AuthService {
...
@@ -263,7 +263,11 @@ public class AuthServiceImpl implements AuthService {
@Override
@Override
public
Result
updateSaltInfo
(
SaltResetReq
req
)
{
public
Result
updateSaltInfo
(
SaltResetReq
req
)
{
AuthUserResponse
response
=
new
AuthUserResponse
();
AuthUserResponse
response
=
new
AuthUserResponse
();
ApiAuth
apiAuth
=
apiAuthMapper
.
selectById
(
req
.
getId
());
QueryWrapper
<
ApiAuth
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"auth_code"
,
req
.
getAuthCode
());
query
.
eq
(
"is_deleted"
,
0
);
query
.
eq
(
"status"
,
GeneralStatusTypeEnum
.
VALID
);
ApiAuth
apiAuth
=
apiAuthMapper
.
selectOne
(
query
);
if
(
null
==
apiAuth
)
{
if
(
null
==
apiAuth
)
{
return
Result
.
of_error
(
"认证用户不存在"
);
return
Result
.
of_error
(
"认证用户不存在"
);
}
}
...
@@ -272,7 +276,7 @@ public class AuthServiceImpl implements AuthService {
...
@@ -272,7 +276,7 @@ public class AuthServiceImpl implements AuthService {
update
.
set
(
"salt"
,
salt
);
update
.
set
(
"salt"
,
salt
);
update
.
set
(
"create_date"
,
new
Date
());
update
.
set
(
"create_date"
,
new
Date
());
update
.
set
(
"create_user"
,
""
);
update
.
set
(
"create_user"
,
""
);
update
.
eq
(
"id"
,
req
.
getId
());
update
.
eq
(
"id"
,
apiAuth
.
getId
());
if
(
apiAuthMapper
.
update
(
null
,
update
)
>
0
)
{
if
(
apiAuthMapper
.
update
(
null
,
update
)
>
0
)
{
response
.
setSalt
(
salt
);
response
.
setSalt
(
salt
);
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
,
response
);
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
,
response
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/request/ApiQueryService.java
View file @
48a9ce55
...
@@ -60,10 +60,10 @@ public class ApiQueryService implements OpenApiService {
...
@@ -60,10 +60,10 @@ public class ApiQueryService implements OpenApiService {
String
selectType
=
parameter
.
getString
(
"selectType"
);
String
selectType
=
parameter
.
getString
(
"selectType"
);
String
reqParams
=
parameter
.
getString
(
"reqParams"
);
String
reqParams
=
parameter
.
getString
(
"reqParams"
);
Map
paramMap
=
null
;
Map
paramMap
=
null
;
if
(
StringUtils
.
isNotBlank
(
reqParams
)
)
{
if
(
null
!=
reqParams
&&
reqParams
.
length
()
>
0
)
{
paramMap
=
(
Map
)
JSONObject
.
parseObject
(
reqParams
);
paramMap
=
(
Map
)
JSONObject
.
parseObject
(
reqParams
);
}
}
String
apiInterface
=
redisUtils
.
get
(
request
.
getAp
p
Key
());
String
apiInterface
=
redisUtils
.
get
(
request
.
getAp
i
Key
());
if
(
StringUtils
.
isNotBlank
(
selectType
))
{
if
(
StringUtils
.
isNotBlank
(
selectType
))
{
try
{
try
{
switch
(
selectType
)
{
switch
(
selectType
)
{
...
@@ -77,7 +77,7 @@ public class ApiQueryService implements OpenApiService {
...
@@ -77,7 +77,7 @@ public class ApiQueryService implements OpenApiService {
String
targetUrl
=
jsonBigData
.
getString
(
"targetUrl"
);
String
targetUrl
=
jsonBigData
.
getString
(
"targetUrl"
);
rangRequestTarget
(
ApiInfoOutTypeEnum
.
JSON
.
name
(),
targetUrl
,
paramMap
,
response
);
rangRequestTarget
(
ApiInfoOutTypeEnum
.
JSON
.
name
(),
targetUrl
,
paramMap
,
response
);
}
else
{
//缓存中不存在 查询数据库
}
else
{
//缓存中不存在 查询数据库
ApiInterface
apiInfo
=
apiInterfaceService
.
getApiInfo
(
request
.
getAp
p
Key
());
ApiInterface
apiInfo
=
apiInterfaceService
.
getApiInfo
(
request
.
getAp
i
Key
());
if
(
apiInfo
==
null
){
if
(
apiInfo
==
null
){
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
}
}
...
@@ -91,7 +91,7 @@ public class ApiQueryService implements OpenApiService {
...
@@ -91,7 +91,7 @@ public class ApiQueryService implements OpenApiService {
rangRequestTarget
(
ApiInfoOutTypeEnum
.
JSON
.
name
(),
targetUrl
,
null
,
response
);
rangRequestTarget
(
ApiInfoOutTypeEnum
.
JSON
.
name
(),
targetUrl
,
null
,
response
);
}
else
{
//redis中不存在,查询数据库
}
else
{
//redis中不存在,查询数据库
ApiInterface
apiReqDto
=
ApiInterface
apiReqDto
=
apiInterfaceService
.
getReqTargetInfo
(
request
.
getAp
p
Key
());
apiInterfaceService
.
getReqTargetInfo
(
request
.
getAp
i
Key
());
if
(
null
==
apiReqDto
)
{
if
(
null
==
apiReqDto
)
{
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
}
}
...
@@ -106,7 +106,7 @@ public class ApiQueryService implements OpenApiService {
...
@@ -106,7 +106,7 @@ public class ApiQueryService implements OpenApiService {
rangRequestTarget
(
outputType
,
targetUrl
,
paramMap
,
response
);
rangRequestTarget
(
outputType
,
targetUrl
,
paramMap
,
response
);
}
else
{
//不存在查询数据库
}
else
{
//不存在查询数据库
ApiInterface
apiReqDto
=
ApiInterface
apiReqDto
=
apiInterfaceService
.
getReqTargetInfo
(
request
.
getAp
p
Key
());
apiInterfaceService
.
getReqTargetInfo
(
request
.
getAp
i
Key
());
if
(
null
==
apiReqDto
)
{
if
(
null
==
apiReqDto
)
{
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
}
}
...
@@ -121,7 +121,7 @@ public class ApiQueryService implements OpenApiService {
...
@@ -121,7 +121,7 @@ public class ApiQueryService implements OpenApiService {
rangRequestTarget
(
outputType
,
targetUrl
,
paramMap
,
response
);
rangRequestTarget
(
outputType
,
targetUrl
,
paramMap
,
response
);
}
else
{
//不存在查询数据库
}
else
{
//不存在查询数据库
ApiInterface
apiReqDto
=
ApiInterface
apiReqDto
=
apiInterfaceService
.
getReqTargetInfo
(
request
.
getAp
p
Key
());
apiInterfaceService
.
getReqTargetInfo
(
request
.
getAp
i
Key
());
if
(
null
==
apiReqDto
)
{
if
(
null
==
apiReqDto
)
{
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_INFO_UNEXIST
);
}
}
...
@@ -130,13 +130,14 @@ public class ApiQueryService implements OpenApiService {
...
@@ -130,13 +130,14 @@ public class ApiQueryService implements OpenApiService {
}
}
break
;
break
;
default
:
default
:
response
.
setCode
(
GatewayResultCode
.
ILLEGAL_REQUEST
.
getCode
());
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
response
.
setMsg
(
GatewayResultCode
.
ILLEGAL_REQUEST
.
getMsg
());
}
break
;
}
catch
(
Exception
ex
)
{
if
(
ex
instanceof
GatewayException
){
throw
(
GatewayException
)
ex
;
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"~~~~~~~~~~~~~~~请求api信息异常~~~~~~~~~~~~~"
);
log
.
error
(
"~~~~~~~~~~~~~~~请求api信息异常~~~~~~~~~~~~~"
);
log
.
error
(
"异常信息:{}"
,
e
.
getMessage
());
log
.
error
(
"异常信息:{}"
,
e
x
.
getMessage
());
response
.
setCode
(
GatewayResultCode
.
ILLEGAL_REQUEST
.
getCode
());
response
.
setCode
(
GatewayResultCode
.
ILLEGAL_REQUEST
.
getCode
());
response
.
setMsg
(
GatewayResultCode
.
ILLEGAL_REQUEST
.
getMsg
());
response
.
setMsg
(
GatewayResultCode
.
ILLEGAL_REQUEST
.
getMsg
());
}
}
...
@@ -147,8 +148,9 @@ public class ApiQueryService implements OpenApiService {
...
@@ -147,8 +148,9 @@ public class ApiQueryService implements OpenApiService {
if
(
ApiInfoOutTypeEnum
.
FLOW
.
name
().
equals
(
outputType
))
{
//文件流形式请求
if
(
ApiInfoOutTypeEnum
.
FLOW
.
name
().
equals
(
outputType
))
{
//文件流形式请求
// httpsUtils.doGetImg()TODO 流形式未实现
// httpsUtils.doGetImg()TODO 流形式未实现
}
else
if
(
ApiInfoOutTypeEnum
.
JSON
.
name
().
equals
(
outputType
))
{
}
else
if
(
ApiInfoOutTypeEnum
.
JSON
.
name
().
equals
(
outputType
))
{
String
respResult
=
httpsUtils
.
doGet
(
targetUrl
,
param
);
response
.
setAttribute
(
"调用成功!"
);
response
.
setAttribute
(
respResult
);
/*String respResult = httpsUtils.doGet(targetUrl, param);
response.setAttribute(respResult);*/
}
else
{
}
else
{
throw
new
GatewayException
(
GatewayResultCode
.
OUTPUT_TYPE_EXCEPTION
);
throw
new
GatewayException
(
GatewayResultCode
.
OUTPUT_TYPE_EXCEPTION
);
}
}
...
...
jz-dm-apigateway/src/main/resources/application-test.yml
View file @
48a9ce55
...
@@ -54,18 +54,14 @@ spring:
...
@@ -54,18 +54,14 @@ spring:
public-key
:
rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
public-key
:
rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis
:
redis
:
#database: 0
#database: 0
host
:
47.115.53.1
cluster
:
port
:
6379
nodes
:
password
:
123456
-
192.168.1.146:6379
#timeout: 5000
-
192.168.1.146:6380
# cluster:
-
192.168.1.146:6381
# nodes:
-
192.168.1.146:6382
# - 192.168.31.167:6379
-
192.168.1.146:6383
# - 192.168.31.167:6380
-
192.168.1.146:6384
# - 192.168.31.167:6381
# - 192.168.31.167:6382
# - 192.168.31.167:6383
# - 192.168.31.167:6384
#使用redis管理session设置为redis,否则none
#使用redis管理session设置为redis,否则none
session
:
session
:
store-type
:
none
store-type
:
none
...
...
jz-dm-common/src/main/java/com/jz/common/utils/UrlUtil.java
View file @
48a9ce55
...
@@ -24,7 +24,7 @@ public class UrlUtil {
...
@@ -24,7 +24,7 @@ public class UrlUtil {
int
port
=
request
.
getServerPort
();
int
port
=
request
.
getServerPort
();
// 访问项目名
// 访问项目名
String
contextPath
=
request
.
getContextPath
();
String
contextPath
=
request
.
getContextPath
();
String
url
=
"%s://%s%s%s
%s
"
;
String
url
=
"%s://%s%s%s"
;
String
portStr
=
""
;
String
portStr
=
""
;
if
(
port
!=
80
)
{
if
(
port
!=
80
)
{
portStr
+=
":"
+
port
;
portStr
+=
":"
+
port
;
...
...
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