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
a571f762
Commit
a571f762
authored
Dec 16, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新修改gateway代码
parent
2e756f4b
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
249 additions
and
375 deletions
+249
-375
OpenApiRequest.java
...y/src/main/java/com/jz/dm/common/util/OpenApiRequest.java
+5
-5
GatewayController.java
...src/main/java/com/jz/dm/controller/GatewayController.java
+1
-0
CheckArgsFilter.java
...teway/src/main/java/com/jz/dm/filter/CheckArgsFilter.java
+14
-17
CheckPostSizeFilter.java
...y/src/main/java/com/jz/dm/filter/CheckPostSizeFilter.java
+6
-2
CheckTimestampFilter.java
.../src/main/java/com/jz/dm/filter/CheckTimestampFilter.java
+17
-22
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
-0
InvokeRouteFilter.java
...way/src/main/java/com/jz/dm/filter/InvokeRouteFilter.java
+18
-17
SignatureFilter.java
...teway/src/main/java/com/jz/dm/filter/SignatureFilter.java
+143
-143
VerifySignFilter.java
...eway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
+11
-58
DefaultOpenApiDispatcher.java
...main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
+3
-4
OpenApiDispatcher.java
...ay/src/main/java/com/jz/dm/gateway/OpenApiDispatcher.java
+3
-2
OpenApiService.java
...teway/src/main/java/com/jz/dm/gateway/OpenApiService.java
+1
-1
ApiWhiteServiceImpl.java
...main/java/com/jz/dm/gateway/impl/ApiWhiteServiceImpl.java
+0
-72
GatewayServiceImpl.java
.../main/java/com/jz/dm/gateway/impl/GatewayServiceImpl.java
+1
-0
DispatchContext.java
...ateway/src/main/java/com/jz/dm/model/DispatchContext.java
+6
-6
GatewayRequest.java
...gateway/src/main/java/com/jz/dm/model/GatewayRequest.java
+1
-13
GatewayResultCode.java
...rc/main/java/com/jz/dm/model/enums/GatewayResultCode.java
+1
-7
RouteType.java
...ateway/src/main/java/com/jz/dm/model/enums/RouteType.java
+9
-1
AccountAddService.java
...ay/src/main/java/com/jz/dm/service/AccountAddService.java
+5
-2
ParamNameAnnotationBinder.java
.../java/com/jz/dm/web/binder/ParamNameAnnotationBinder.java
+1
-0
application-test.yml
jz-dm-apigateway/src/main/resources/application-test.yml
+0
-2
application.yml
jz-dm-apigateway/src/main/resources/application.yml
+1
-0
No files found.
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/OpenApiRequest.java
View file @
a571f762
...
...
@@ -16,7 +16,7 @@ import java.util.Map;
*/
public
class
OpenApiRequest
{
private
String
app
Id
;
private
String
app
Key
;
private
String
openApiParams
;
...
...
@@ -40,12 +40,12 @@ public class OpenApiRequest {
}
}
public
String
getApp
Id
()
{
return
app
Id
;
public
String
getApp
Key
()
{
return
app
Key
;
}
public
void
setApp
Id
(
String
appId
)
{
this
.
app
Id
=
appId
;
public
void
setApp
Key
(
String
appKey
)
{
this
.
app
Key
=
appKey
;
}
@SuppressWarnings
(
"unchecked"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/GatewayController.java
View file @
a571f762
...
...
@@ -48,6 +48,7 @@ public class GatewayController {
RequestContext
requestContext
=
RequestContext
.
getCurrentContext
();
requestContext
.
setRequest
(
httpServletRequest
);
requestContext
.
setResponse
(
httpServletResponse
);
System
.
out
.
println
(
"经过了controller~~~~~~~~~~~~~~~~~~~~"
);
GatewayResponse
gatewayResponse
=
gatewayService
.
invoke
(
gatewayRequest
);
JSONObject
result
=
new
JSONObject
();
convertResponse
(
result
,
gatewayResponse
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckArgsFilter.java
View file @
a571f762
...
...
@@ -20,16 +20,25 @@ import java.nio.charset.Charset;
@Component
public
class
CheckArgsFilter
extends
AbstractFilter
{
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_2
;
}
@Override
public
String
getFilterName
()
{
return
"CheckArgsFilter"
;
}
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
// 校验参数非空
if
(
StringUtil
.
isEmpty
(
request
.
getAppKey
())
||
StringUtil
.
isEmpty
(
request
.
getMethod
())
||
StringUtil
.
isEmpty
(
request
.
getCharset
())
||
StringUtil
.
isEmpty
(
request
.
getSignType
())
||
StringUtil
.
isEmpty
(
request
.
getSign
())
||
StringUtil
.
isEmpty
(
request
.
getTimestamp
())
||
StringUtil
.
isEmpty
(
request
.
getVersion
())
||
StringUtil
.
isEmpty
(
request
.
getParams
()))
{
//无效参数
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
}
...
...
@@ -39,27 +48,15 @@ public class CheckArgsFilter extends AbstractFilter {
}
try
{
Format
.
valueOf
(
request
.
getFormat
());
Charset
.
forName
(
request
.
getCharset
());
SignType
.
valueOf
(
request
.
getSignType
());
Format
.
valueOf
(
request
.
getFormat
());
//格式,目前仅支持JSON
Charset
.
forName
(
request
.
getCharset
());
//请求使用的编码格式,如UTF-8,GBK,GB2312等
SignType
.
valueOf
(
request
.
getSignType
());
//生成签名字符串所使用的签名算法类型
}
catch
(
Exception
ex
)
{
//无效参数
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
}
chain
.
doFilter
(
request
,
response
);
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_2
;
}
@Override
public
String
getFilterName
()
{
return
"CheckArgsFilter"
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckPostSizeFilter.java
View file @
a571f762
...
...
@@ -12,12 +12,16 @@ import javax.servlet.http.HttpServletRequest;
/**
* 检查提交数据大小
*
*
@author key
*/
@Component
(
"CheckPostSizeFilter"
)
public
class
CheckPostSizeFilter
extends
AbstractFilter
{
/**
* 过滤器名称
* @return
*/
@Override
public
String
getFilterName
()
{
return
"CheckPostSizeFilter"
;
...
...
@@ -25,7 +29,7 @@ public class CheckPostSizeFilter extends AbstractFilter {
/**
*
@see org.springframework.core.Ordered#getOrder()
*
过滤器执行顺序
*/
@Override
public
int
getOrder
()
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckTimestampFilter.java
View file @
a571f762
...
...
@@ -15,42 +15,37 @@ import org.springframework.stereotype.Component;
@Component
public
class
CheckTimestampFilter
extends
AbstractFilter
{
//@Value("${api.skipFilter}")
private
boolean
skipFilter
;
/**
* 时间戳超时分钟,10分钟
*/
private
static
final
long
max
=
1000
*
60
*
10
;
//10分钟
//private static final long max = 1000 * 60 * 10; //10分钟
private
static
final
long
max
=
1000
*
60
*
60
*
24
;
//10分钟
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_3
;
}
@Override
public
String
getFilterName
()
{
return
"CheckTimestampFilter"
;
}
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
if
(!
skipFilter
)
{
String
timestamp
=
request
.
getTimestamp
();
long
time
=
0
;
try
{
time
=
Long
.
valueOf
(
timestamp
);
}
catch
(
Exception
ex
)
{
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
//无效参数
}
if
(
System
.
currentTimeMillis
()
-
time
>
max
)
{
//无效时间戳
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_TIMETEMP
);
}
}
//if (System.currentTimeMillis() - time > max) {
// throw new GatewayException(GatewayResultCode.ILLEGAL_TIMETEMP);//无效时间戳
//}
chain
.
doFilter
(
request
,
response
);
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_5
;
}
@Override
public
String
getFilterName
()
{
return
"CheckTimestampFilter"
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainFactory.java
View file @
a571f762
...
...
@@ -7,7 +7,7 @@ import java.util.List;
/**
* 过滤链工厂
*
*
@author key
*/
@Component
public
class
FilterChainFactory
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
View file @
a571f762
...
...
@@ -15,6 +15,7 @@ import java.util.List;
/**
* 过滤链
*
* @author key
*/
public
class
FilterChainImpl
implements
FilterChain
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/InvokeRouteFilter.java
View file @
a571f762
...
...
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Component;
/**
* 网关路由过滤器
*
* @author key
*/
@Component
public
class
InvokeRouteFilter
extends
AbstractFilter
{
...
...
@@ -27,6 +28,16 @@ public class InvokeRouteFilter extends AbstractFilter {
@Autowired
DefaultOpenApiDispatcher
defaultOpenApiDispatcher
;
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_6
;
}
@Override
public
String
getFilterName
()
{
return
"InvokeRouteFilter"
;
}
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
...
...
@@ -44,11 +55,13 @@ public class InvokeRouteFilter extends AbstractFilter {
}
DispatchContext
context
=
new
DispatchContext
();
context
.
setAppId
(
request
.
getAppKey
());
context
.
setApplication
(
openApi
.
getApplication
());
context
.
setOpenApiMethod
(
request
.
getMethod
());
context
.
setOpenApiParams
(
request
.
getParams
());
context
.
setOpenApiVersion
(
request
.
getVersion
());
context
.
setAppKey
(
request
.
getAppKey
());
//apiKey
context
.
setApplication
(
openApi
.
getApplication
());
//应用
//context.setApplication(openApi.getApplication());//应用
context
.
setOpenApiMethod
(
request
.
getMethod
());
//方法 例如:tradd.add
context
.
setOpenApiParams
(
request
.
getParams
());
//入参
context
.
setOpenApiVersion
(
request
.
getVersion
());
//版本号
//扩展参数
for
(
GatewayRequest
.
Attribute
attribute
:
request
.
getExtAttributes
().
values
())
{
if
(
attribute
!=
null
&&
attribute
.
isPass
)
{
context
.
setExtAttribute
(
attribute
.
name
,
attribute
.
value
);
...
...
@@ -67,17 +80,5 @@ public class InvokeRouteFilter extends AbstractFilter {
}
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_6
;
}
@Override
public
String
getFilterName
()
{
return
"InvokeRouteFilter"
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/SignatureFilter.java
View file @
a571f762
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
View file @
a571f762
...
...
@@ -22,74 +22,27 @@ public class VerifySignFilter extends AbstractFilter {
//@Autowired
//private IApiWhiteService apiWhiteService;
//@Value("${api.skipFilter}")
private
boolean
skipFilter
;
private
final
static
String
CHARSET
=
"UTF-8"
;
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_4
;
}
@Override
public
String
getFilterName
()
{
return
"VerifySignFilter"
;
}
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
HddHashMap
params
=
new
HddHashMap
();
params
.
put
(
"app_id"
,
request
.
getAppKey
());
params
.
put
(
"method"
,
request
.
getMethod
());
params
.
put
(
"charset"
,
request
.
getCharset
());
params
.
put
(
"sign"
,
request
.
getSign
());
params
.
put
(
"sign_type"
,
request
.
getSignType
());
params
.
put
(
"timestamp"
,
request
.
getTimestamp
());
params
.
put
(
"version"
,
request
.
getVersion
());
params
.
put
(
"params"
,
request
.
getParams
());
//ApiWhite apiWhite = apiWhiteService.byMerchantId(request.getAppId());
//if (apiWhite != null) {
// String publicKey = apiWhite.getSecretKey();
//
// if (!skipFilter) {
// boolean verify = SignatureUtil.verify(params, publicKey, request.getCharset(), SignType.valueOf(request.getSignType()));
// if (!verify) {
// throw new SignatureException(OpenApiResultCode.SIGN_VERIFY_ERROR);
// }
//
// //参数解密
// if (apiWhite.getIsEncrypt()) {
// String decryptParams = decryptParams(request.getParams(), publicKey);
// request.setParams(decryptParams);
// }
// }
//}
// 后期再扩展
OpenApi
openApi
=
new
OpenApi
();
openApi
.
setApplication
(
"HDD_API_GATEWAY"
);
openApi
.
setRouteType
(
RouteType
.
SRPING
);
openApi
.
setApplication
(
"JZ_API_GATEWAY"
);
//应用
openApi
.
setRouteType
(
RouteType
.
SPRINGBOOT
);
//漏油类型
//openApi.setRouteType(RouteType.SRPING);//漏油类型
RequestContext
.
getCurrentContext
().
set
(
"openApi"
,
openApi
);
chain
.
doFilter
(
request
,
response
);
}
private
String
decryptParams
(
String
params
,
String
publicKey
)
{
log
.
info
(
"解密前请求参数,{}"
,
params
);
try
{
RSAPublicKey
key
=
RSAUtils
.
getPublicKey
(
publicKey
);
String
decrypt
=
RSAUtils
.
publicDecrypt
(
params
,
key
);
log
.
info
(
"解密后请求参数,{}"
,
decrypt
);
return
decrypt
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_4
;
}
@Override
public
String
getFilterName
()
{
return
"VerifySignFilter"
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
View file @
a571f762
...
...
@@ -34,7 +34,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
/**
* 服务注入可参考: /openapi-demo/src/main/resources/META-INF/application-context.xml
* @param openApiServiceList
* @param openApiServiceList
* <pre>
* <!-- 定义开放接口服务 -->
* <bean id="addUserOpenApiService" class="com.xxx.openapi.demo.openapi.AddUserOpenApiService" />
...
...
@@ -44,8 +44,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
@Resource
public
void
setOpenApiServices
(
List
<
OpenApiService
>
openApiServiceList
)
{
for
(
OpenApiService
openApiService
:
openApiServiceList
)
{
String
openApiServiceKey
=
getOpenApiServiceKey
(
openApiService
.
getOpenApiMethod
(),
openApiService
.
getOpenApiVersion
());
String
openApiServiceKey
=
getOpenApiServiceKey
(
openApiService
.
getOpenApiMethod
(),
openApiService
.
getOpenApiVersion
());
openApiServices
.
put
(
openApiServiceKey
,
openApiService
);
}
}
...
...
@@ -69,7 +68,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
try
{
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
request
.
setApp
Id
(
context
.
getAppId
());
request
.
setApp
Key
(
context
.
getAppKey
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
openApiService
.
doService
(
request
,
response
);
}
catch
(
Throwable
ex
)
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/OpenApiDispatcher.java
View file @
a571f762
...
...
@@ -6,14 +6,15 @@ import com.jz.dm.model.DispatchContext;
/**
* openapi分发器
*
* @author key
*/
public
interface
OpenApiDispatcher
{
/**
* openapi dispatch
*
*
* @param context dispatch context
*
*
* @return
*/
public
String
doDispatch
(
DispatchContext
context
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/OpenApiService.java
View file @
a571f762
...
...
@@ -6,7 +6,7 @@ import com.jz.dm.common.util.OpenApiResponse;
/**
* openapi服务
*
*
@author key
*/
public
interface
OpenApiService
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/impl/ApiWhiteServiceImpl.java
deleted
100644 → 0
View file @
2e756f4b
/**
* Copyright (c) 2011-2019 All Rights Reserved.
*/
package
com
.
jz
.
dm
.
gateway
.
impl
;
/**
* API白名单表 服务实现类
*
* @author zengxx
* @version $Id: ApiWhiteServiceImpl.java 2020-04-02 $
*/
//@Service("apiWhiteService")
//public class ApiWhiteServiceImpl implements IApiWhiteService {
//@Resource
//private ApiWhiteMapper apiWhiteMapper;
//@Resource
//private MeasureRecordMapper measureRecordMapper;
//
//@Override
//public ApiWhite byMerchantId(String merchantId) throws TtyException {
// return apiWhiteMapper.byMerchantId(merchantId);
//}
//
//@Override
//@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
//public long adjustAmt(String merchantId, long amt) {
// if (amt == 0) {
// return amt;
// }
// BigDecimal adjustAmt = new BigDecimal(amt).divide(new BigDecimal(100));
// ApiWhite apiWhite = apiWhiteMapper.byMerchantId(merchantId);
// long result = apiWhiteMapper.adjustAmt(merchantId, adjustAmt);
// if (result != 1) {
// return 0;
// } else {
// MeasureRecord measure = new MeasureRecord();
// //已用金额
// BigDecimal sumUseAmt = apiWhiteMapper.sumUseAmt(merchantId);
// if (sumUseAmt == null) {
// sumUseAmt = BigDecimal.ZERO;
// }
// if (amt > 0) {
// measure.setChangType("0");
// measure.setUseAmount(sumUseAmt.subtract(adjustAmt));
// } else {
// measure.setChangType("1");
// measure.setUseAmount(sumUseAmt.add(adjustAmt.abs()));
// }
// measure.setChangeAmount(adjustAmt.abs());
// measure.setAfterAmount(apiWhite.getUsableAmount().add(adjustAmt));
//
// measure.setMerchantId(apiWhite.getMerchantId());
// measure.setName(apiWhite.getName());
// measure.setBeforeAmount(apiWhite.getUsableAmount());
// measure.setChangDate(LocalDateTime.now());
// measure.setCreateUser("API");
// measure.setCreateDate(LocalDateTime.now());
// //插入流水信息
// if (measureRecordMapper.insert(measure) > 0) {
// return 1;
// }
// }
// return 0;
//}
//@Override
//@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
//public void invoke3bcCount(String merchantId) {
// apiWhiteMapper.invoke3bcCount(merchantId);
//}
//}
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/impl/GatewayServiceImpl.java
View file @
a571f762
...
...
@@ -24,6 +24,7 @@ public class GatewayServiceImpl implements GatewayService {
@Override
public
GatewayResponse
invoke
(
GatewayRequest
gatewayRequest
)
{
GatewayResponse
gatewayResponse
=
new
GatewayResponse
();
System
.
out
.
println
(
"经过了网关服务~~~~~~~~~~~~~~~~~~~~"
);
FilterChain
filterChain
=
filterChainFactory
.
getFilterChain
();
filterChain
.
doFilter
(
gatewayRequest
,
gatewayResponse
);
return
gatewayResponse
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/DispatchContext.java
View file @
a571f762
...
...
@@ -17,7 +17,7 @@ public class DispatchContext implements Serializable {
/**
* 商户应用id
*/
private
String
app
Id
;
private
String
app
Key
;
/**
* 应用
...
...
@@ -49,17 +49,17 @@ public class DispatchContext implements Serializable {
*
* @return property value of appId
*/
public
String
getApp
Id
()
{
return
app
Id
;
public
String
getApp
Key
()
{
return
app
Key
;
}
/**
* Setter method for property <tt>appId</tt>.
*
* @param app
Id
value to be assigned to property appId
* @param app
Key
value to be assigned to property appId
*/
public
void
setApp
Id
(
String
appId
)
{
this
.
app
Id
=
appId
;
public
void
setApp
Key
(
String
appKey
)
{
this
.
app
Key
=
appKey
;
}
/**
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/GatewayRequest.java
View file @
a571f762
...
...
@@ -56,18 +56,6 @@ public class GatewayRequest implements Serializable {
*/
private
String
version
;
///**
// * 回调通知地址
// */
//@ParamName("notify_url")
//private String notifyUrl;
///**
// * 返回地址
// */
//@ParamName("return_url")
//private String returnUrl;
/**
* 请求参数,JSON格式
*/
...
...
@@ -312,7 +300,7 @@ public class GatewayRequest implements Serializable {
*/
@Override
public
String
toString
()
{
return
"GatewayRequest [app
Id
="
+
appKey
+
", method="
+
method
+
", format="
+
format
return
"GatewayRequest [app
Key
="
+
appKey
+
", method="
+
method
+
", format="
+
format
+
", charset="
+
charset
+
", signType="
+
signType
+
", sign="
+
sign
+
", timestamp="
+
timestamp
+
", version="
+
version
+
", params="
+
params
+
", extAttributes="
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/enums/GatewayResultCode.java
View file @
a571f762
...
...
@@ -54,13 +54,7 @@ public enum GatewayResultCode implements ResultCode {
POST_DATA_TOO_LARGE
(
"POST_DATA_TOO_LARGE"
,
"提交数据过大"
),
/** 调用转发异常 */
DISPATCHER_EXCEPTION
(
"DISPATCHER_EXCEPTION"
,
"调用转发异常"
),
/*账户不存在*/
ACCOUNT_EXIST
(
"ACCOUNT_EXIST"
,
"账户信息不存在"
);
;
DISPATCHER_EXCEPTION
(
"DISPATCHER_EXCEPTION"
,
"调用转发异常"
);
/**
* 初始化保存到map里方便根据code获取
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/enums/RouteType.java
View file @
a571f762
...
...
@@ -2,7 +2,15 @@ package com.jz.dm.model.enums;
/**
* 路由类型
* @author key
*/
public
enum
RouteType
{
SRPING
/**
* 漏油类型
*/
SRPING
,
/**
* 路由网关
*/
SPRINGBOOT
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/AccountAddService.java
View file @
a571f762
...
...
@@ -3,22 +3,25 @@ package com.jz.dm.service;
import
com.jz.dm.common.util.OpenApiRequest
;
import
com.jz.dm.common.util.OpenApiResponse
;
import
com.jz.dm.gateway.OpenApiService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
AccountAddService
implements
OpenApiService
{
@Override
public
String
getOpenApiMethod
()
{
return
"
account.add
"
;
return
"
query
"
;
}
@Override
public
String
getOpenApiVersion
()
{
return
"1.0.0"
;
return
"
V
1.0.0"
;
}
@Override
public
void
doService
(
OpenApiRequest
request
,
OpenApiResponse
response
)
{
System
.
out
.
println
(
"请求过来了。。。。。"
);
System
.
out
.
println
(
request
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/web/binder/ParamNameAnnotationBinder.java
View file @
a571f762
...
...
@@ -9,6 +9,7 @@ import java.util.Map;
/**
* 参数名注解绑定
*
* @author key
*/
public
class
ParamNameAnnotationBinder
extends
ExtendedServletRequestDataBinder
{
...
...
jz-dm-apigateway/src/main/resources/application-test.yml
View file @
a571f762
...
...
@@ -47,5 +47,3 @@ spring:
# 日志用的filter:log4j
# 防御sql注入的filter:wall
filters
:
stat
# ====================MybatisPlus====================
jz-dm-apigateway/src/main/resources/application.yml
View file @
a571f762
...
...
@@ -19,6 +19,7 @@ spring:
active
:
test
#默认使用的配置文件
# ====================MybatisPlus====================
mybatis-plus
:
# 如果是放在src/main/java目录下 classpath:/com/yourpackage/*/mapper/*Mapper.xml
# 如果是放在resource目录 classpath:/mapper/*Mapper.xml
...
...
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