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
e5ac3d62
Commit
e5ac3d62
authored
Jan 05, 2021
by
ysongq
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dm_dev' into dm_dev
parents
f680ff94
7ecbcfde
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
170 additions
and
71 deletions
+170
-71
api_gateway.sql
database/zc/api_gateway.sql
+5
-2
ApiDirectionController.java
...ain/java/com/jz/dm/controller/ApiDirectionController.java
+2
-2
ProducerController.java
...rc/main/java/com/jz/dm/controller/ProducerController.java
+3
-2
ApiInterface.java
...y/src/main/java/com/jz/dm/models/domian/ApiInterface.java
+17
-1
ApiInterfaceCustom.java
...main/java/com/jz/dm/models/domian/ApiInterfaceCustom.java
+5
-5
ApiInterfaceFile.java
...c/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
+5
-5
ApiInterfaceReq.java
.../main/java/com/jz/dm/models/req/make/ApiInterfaceReq.java
+3
-7
MakeDataBankApiReq.java
...in/java/com/jz/dm/models/req/make/MakeDataBankApiReq.java
+14
-3
ApiDirectionService.java
.../src/main/java/com/jz/dm/service/ApiDirectionService.java
+2
-2
ProducerService.java
...eway/src/main/java/com/jz/dm/service/ProducerService.java
+2
-1
ApiDirectionServiceImpl.java
.../java/com/jz/dm/service/impl/ApiDirectionServiceImpl.java
+14
-8
ProducerServiceImpl.java
...main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
+65
-28
ApiQueryService.java
.../main/java/com/jz/dm/service/request/ApiQueryService.java
+24
-0
TestHttpReq.java
...y/src/test/java/com/jz/dm/gateway/orther/TestHttpReq.java
+1
-0
TestMakeApi.java
...y/src/test/java/com/jz/dm/gateway/orther/TestMakeApi.java
+6
-3
ResultMsg.java
...ommon/src/main/java/com/jz/common/constant/ResultMsg.java
+2
-2
No files found.
database/zc/api_gateway.sql
View file @
e5ac3d62
...
@@ -6,12 +6,15 @@ CREATE TABLE `t_api_interface` (
...
@@ -6,12 +6,15 @@ 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
'请求地址'
`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 实时接入 2 数据银行制作API, 3 数据银行制作数据包 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
'接口功能'
,
`join_type`
varchar
(
50
)
NULL
DEFAULT
NULL
COMMENT
'接入类型:字典表对应key值'
,
`join_type`
varchar
(
50
)
NULL
DEFAULT
NULL
COMMENT
'接入类型:字典表对应key值'
,
`test_example`
varchar
(
255
)
NULL
DEFAULT
NULL
COMMENT
'测试实例'
;
`test_example`
varchar
(
255
)
NULL
DEFAULT
NULL
COMMENT
'测试实例'
;
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`output_type`
varchar
(
50
)
NULL
DEFAULT
'JSON'
COMMENT
'输出类型:flow 流形式输出, json格式输出'
,
`page`
tinyint
(
2
)
NULL
DEFAULT
'0'
COMMENT
'是否分页:0 false ,1 true'
,
`version`
varchar
(
20
)
DEFAULT
'1.0'
COMMENT
'版本号'
,
`version`
varchar
(
20
)
DEFAULT
'1.0'
COMMENT
'版本号'
,
`sign_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'加密方式: MD5 RSA'
,
`sign_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'加密方式: MD5 RSA'
,
`timeout`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'超时时间'
,
`timeout`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'超时时间'
,
...
@@ -39,6 +42,7 @@ CREATE TABLE `t_api_interface_custom` (
...
@@ -39,6 +42,7 @@ CREATE TABLE `t_api_interface_custom` (
`req_headers`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'请求头'
,
`req_headers`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'请求头'
,
`resp_code`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'响应状态码'
,
`resp_code`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'响应状态码'
,
`api_example`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'api返回样例'
,
`api_example`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'api返回样例'
,
`inbox_param`
varchar
(
300
)
NULL
DEFAULT
NULL
COMMENT
'固定参数'
,
`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
'创建人'
,
...
@@ -54,7 +58,6 @@ CREATE TABLE `t_api_interface_file` (
...
@@ -54,7 +58,6 @@ CREATE TABLE `t_api_interface_file` (
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api文件表自增ID'
,
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api文件表自增ID'
,
`project_id`
bigint
(
20
)
NOT
NULL
COMMENT
'项目编号'
,
`project_id`
bigint
(
20
)
NOT
NULL
COMMENT
'项目编号'
,
`file_source`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件来源:,1 dmp, 2 数据银行'
,
`file_source`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件来源:,1 dmp, 2 数据银行'
,
`file_type`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'文件类型:1 文件夹 ,2 文件'
,
`file_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件名称'
,
`file_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件名称'
,
`file_en_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件英文名称'
,
`file_en_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件英文名称'
,
`parent_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'父类id'
,
`parent_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'父类id'
,
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ApiDirectionController.java
View file @
e5ac3d62
...
@@ -36,8 +36,8 @@ public class ApiDirectionController {
...
@@ -36,8 +36,8 @@ public class ApiDirectionController {
*/
*/
@ApiOperation
(
"api类型列表"
)
@ApiOperation
(
"api类型列表"
)
@PostMapping
(
value
=
"/getApiTypeList"
)
@PostMapping
(
value
=
"/getApiTypeList"
)
public
Mono
<
Result
>
getApiTypeList
(
@RequestParam
(
name
=
"parent
Code"
)
String
parentCode
)
{
public
Mono
<
Result
>
getApiTypeList
(
@RequestParam
(
name
=
"parent
Key"
)
String
parentKey
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiDirectionService
.
getApiType
(
parent
Code
)));
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiDirectionService
.
getApiType
(
parent
Key
)));
}
}
/**
/**
* @Description:查询某个类型的字典值
* @Description:查询某个类型的字典值
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ProducerController.java
View file @
e5ac3d62
...
@@ -36,9 +36,10 @@ public class ProducerController {
...
@@ -36,9 +36,10 @@ public class ProducerController {
*/
*/
@ApiOperation
(
"Api制作(获取文件夹列表)"
)
@ApiOperation
(
"Api制作(获取文件夹列表)"
)
@GetMapping
(
value
=
"/getFileCatalog"
)
@GetMapping
(
value
=
"/getFileCatalog"
)
public
Mono
<
Result
>
getFileCatalog
(
@RequestParam
(
name
=
"pageNum"
,
defaultValue
=
"1"
,
required
=
false
)
String
pageNum
,
public
Mono
<
Result
>
getFileCatalog
(
@RequestParam
(
name
=
"projectId"
)
Long
projectId
,
@RequestParam
(
name
=
"pageNum"
,
defaultValue
=
"1"
,
required
=
false
)
String
pageNum
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
,
required
=
false
)
String
pageSize
)
{
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
,
required
=
false
)
String
pageSize
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getFileCatalog
(
pageNum
,
pageSize
)));
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getFileCatalog
(
p
rojectId
,
p
ageNum
,
pageSize
)));
}
}
/**
/**
* @Description:Api制作(自定义)
* @Description:Api制作(自定义)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterface.java
View file @
e5ac3d62
...
@@ -49,10 +49,16 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -49,10 +49,16 @@ public class ApiInterface extends BaseObject implements Serializable {
private
String
apiProtocl
;
private
String
apiProtocl
;
/**
/**
* api类型:1
实时接入 2 数据银行制作API, 3 数据银行制作数据包 6
标签查询 9自定义'
* api类型:1
数据银行制作API 2 数据银行制作数据包, 3 API实时接入 6
标签查询 9自定义'
*/
*/
@TableField
(
"api_type"
)
@TableField
(
"api_type"
)
private
String
apiType
;
private
String
apiType
;
/**
* 请求地址
*/
@TableField
(
"api_path"
)
private
String
apiPath
;
/**
/**
* 目标url
* 目标url
*/
*/
...
@@ -68,6 +74,16 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -68,6 +74,16 @@ public class ApiInterface extends BaseObject implements Serializable {
*/
*/
@TableField
(
"test_example"
)
@TableField
(
"test_example"
)
private
String
testExample
;
private
String
testExample
;
/**
* '输出类型:flow 流形式输出, json格式输出',
*/
@TableField
(
"output_type"
)
private
String
outputType
;
/**
* 是否分页:0 false ,1 true
*/
@TableField
(
"page"
)
private
Boolean
page
;
/**
/**
* 状态(1-草稿 2-发布 3-过时 4-冻结 5-失效)
* 状态(1-草稿 2-发布 3-过时 4-冻结 5-失效)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceCustom.java
View file @
e5ac3d62
...
@@ -36,11 +36,6 @@ public class ApiInterfaceCustom extends BaseObject implements Serializable {
...
@@ -36,11 +36,6 @@ public class ApiInterfaceCustom extends BaseObject implements Serializable {
@TableField
(
"api_interface_id"
)
@TableField
(
"api_interface_id"
)
private
Long
apiInterfaceId
;
private
Long
apiInterfaceId
;
/**
* api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6标签查询 9自定义'
*/
@TableField
(
"api_type"
)
private
String
apiType
;
/**
/**
* api请求参数
* api请求参数
...
@@ -69,5 +64,10 @@ public class ApiInterfaceCustom extends BaseObject implements Serializable {
...
@@ -69,5 +64,10 @@ public class ApiInterfaceCustom extends BaseObject implements Serializable {
*/
*/
@TableField
(
"api_example"
)
@TableField
(
"api_example"
)
private
String
apiExample
;
private
String
apiExample
;
/**
* 固定参数
*/
@TableField
(
"inbox_param"
)
private
String
inboxParam
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
View file @
e5ac3d62
...
@@ -36,11 +36,11 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
...
@@ -36,11 +36,11 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
@TableField
(
"file_source"
)
@TableField
(
"file_source"
)
private
String
fileSource
;
private
String
fileSource
;
/**
/
//
**
* 文件类型:1 文件夹 ,2 文件
//
* 文件类型:1 文件夹 ,2 文件
*/
//
*/
@TableField
(
"file_type"
)
//
@TableField("file_type")
private
String
fileType
;
//
private String fileType;
/**
/**
* 文件名称
* 文件名称
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/ApiInterfaceReq.java
View file @
e5ac3d62
...
@@ -22,10 +22,6 @@ public class ApiInterfaceReq {
...
@@ -22,10 +22,6 @@ public class ApiInterfaceReq {
@NotNull
(
message
=
"api类型不能为空"
)
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
public
String
apiType
;
/* @ApiModelProperty(value = "apiId 等价于apiKey",required = true)
@NotNull(message = "apiId不能为空")
public String apiId;*/
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
public
String
apiDesc
;
...
@@ -53,9 +49,9 @@ public class ApiInterfaceReq {
...
@@ -53,9 +49,9 @@ public class ApiInterfaceReq {
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
public
String
apiFunction
;
public
String
apiFunction
;
@ApiModelProperty
(
value
=
"
文件Id
"
,
required
=
true
)
@ApiModelProperty
(
value
=
"
父类文件id,一级文件夹传入0
"
,
required
=
true
)
@NotNull
(
message
=
"文件id不能为空"
)
@NotNull
(
message
=
"
父类id
文件id不能为空"
)
public
Long
file
Id
;
public
Long
parent
Id
;
@ApiModelProperty
(
value
=
"项目id"
,
required
=
true
)
@ApiModelProperty
(
value
=
"项目id"
,
required
=
true
)
@NotNull
(
message
=
"项目id不能为空"
)
@NotNull
(
message
=
"项目id不能为空"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeDataBankApiReq.java
View file @
e5ac3d62
...
@@ -20,9 +20,9 @@ import java.io.Serializable;
...
@@ -20,9 +20,9 @@ import java.io.Serializable;
@ApiModel
(
"数据银行api制作"
)
@ApiModel
(
"数据银行api制作"
)
public
class
MakeDataBankApiReq
implements
Serializable
{
public
class
MakeDataBankApiReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6
标签查询 9自定义"
,
required
=
true
)
//@ApiModelProperty(value = "api类型:1 数据银行制作API 2 数据银行制作数据包, 3 API实时接入 6
标签查询 9自定义",required = true)
@NotNull
(
message
=
"api类型不能为空"
)
//
@NotNull(message = "api类型不能为空")
public
String
apiType
;
//
public String apiType;
@ApiModelProperty
(
value
=
"传输方式(1为HTTPS,2为HTTP)"
,
required
=
true
)
@ApiModelProperty
(
value
=
"传输方式(1为HTTPS,2为HTTP)"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
@NotNull
(
message
=
"传输方式不能为空"
)
...
@@ -36,6 +36,17 @@ public class MakeDataBankApiReq implements Serializable {
...
@@ -36,6 +36,17 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull
(
message
=
"接入类型不能为空"
)
@NotNull
(
message
=
"接入类型不能为空"
)
public
String
joinType
;
public
String
joinType
;
@ApiModelProperty
(
value
=
"输出类型:flow 流,json json形式"
,
required
=
true
)
@NotNull
(
message
=
"输出类型不能为空"
)
public
String
outputType
;
@ApiModelProperty
(
value
=
"是否分页:"
,
required
=
false
)
//@NotNull(message = "是否分页不能为空")
public
Boolean
page
;
@ApiModelProperty
(
value
=
"请求地址"
,
required
=
false
)
public
String
apiPath
;
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
public
String
apiDesc
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/ApiDirectionService.java
View file @
e5ac3d62
...
@@ -17,10 +17,10 @@ public interface ApiDirectionService {
...
@@ -17,10 +17,10 @@ public interface ApiDirectionService {
/**
/**
* 根据类型获取API类型信息
* 根据类型获取API类型信息
* @param parent
Code
* @param parent
Key
* @return
* @return
*/
*/
List
<
ApiDirection
>
getApiType
(
String
parent
Code
);
List
<
ApiDirection
>
getApiType
(
String
parent
Key
);
/**
/**
* 查询code值信息
* 查询code值信息
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/ProducerService.java
View file @
e5ac3d62
...
@@ -93,7 +93,8 @@ public interface ProducerService {
...
@@ -93,7 +93,8 @@ public interface ProducerService {
* 获取文件列表
* 获取文件列表
* @param pageNum
* @param pageNum
* @param pageSize
* @param pageSize
* @param projectId
* @return
* @return
*/
*/
IPage
<
ApiInterfaceFile
>
getFileCatalog
(
String
pageNum
,
String
pageSize
);
IPage
<
ApiInterfaceFile
>
getFileCatalog
(
Long
projectId
,
String
pageNum
,
String
pageSize
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ApiDirectionServiceImpl.java
View file @
e5ac3d62
...
@@ -29,25 +29,31 @@ public class ApiDirectionServiceImpl implements ApiDirectionService {
...
@@ -29,25 +29,31 @@ public class ApiDirectionServiceImpl implements ApiDirectionService {
private
ApiDirectionMapper
apiDirectionMapper
;
private
ApiDirectionMapper
apiDirectionMapper
;
@Override
@Override
public
List
<
ApiDirection
>
getApiType
(
String
parent
Code
)
{
public
List
<
ApiDirection
>
getApiType
(
String
parent
Key
)
{
QueryWrapper
<
ApiDirection
>
query
=
new
QueryWrapper
<>();
QueryWrapper
<
ApiDirection
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"parent"
,
parent
Code
);
//父类下的所有子类
query
.
eq
(
"parent"
,
parent
Key
);
//父类下的所有子类
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
return
apiDirectionMapper
.
selectList
(
query
);
List
<
ApiDirection
>
apiDirections
=
apiDirectionMapper
.
selectList
(
query
);
apiDirections
.
forEach
((
x
)->{
if
(
null
==
x
.
getParent
())
{
apiDirections
.
remove
(
x
.
getId
());
}
});
return
apiDirections
;
}
}
@Override
@Override
public
List
<
ApiDirection
>
getDirectionVal
(
String
key
,
String
code
)
{
public
List
<
ApiDirection
>
getDirectionVal
(
String
key
,
String
code
)
{
QueryWrapper
<
ApiDirection
>
query
=
new
QueryWrapper
<>();
QueryWrapper
<
ApiDirection
>
query
=
new
QueryWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
key
)
&&
StringUtils
.
isNotBlank
(
code
)){
if
(
StringUtils
.
isNotBlank
(
key
)
&&
StringUtils
.
isNotBlank
(
code
)){
query
.
eq
(
"
key
"
,
key
);
query
.
eq
(
"
`key`
"
,
key
);
query
.
eq
(
"
code
"
,
code
);
query
.
eq
(
"
`code`
"
,
code
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
}
else
if
(
StringUtils
.
isNotBlank
(
code
)){
}
else
if
(
StringUtils
.
isNotBlank
(
key
)){
query
.
eq
(
"
key
"
,
key
);
query
.
eq
(
"
`key`
"
,
key
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
}
else
{
}
else
{
query
.
eq
(
"
code
"
,
code
);
query
.
eq
(
"
`code`
"
,
code
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
}
}
return
apiDirectionMapper
.
selectList
(
query
);
return
apiDirectionMapper
.
selectList
(
query
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
e5ac3d62
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/java/com/jz/dm/service/request/ApiQueryService.java
View file @
e5ac3d62
package
com
.
jz
.
dm
.
service
.
request
;
package
com
.
jz
.
dm
.
service
.
request
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.utils.HttpsUtils
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.util.OpenApiRequest
;
import
com.jz.dm.common.util.OpenApiRequest
;
import
com.jz.dm.common.util.OpenApiResponse
;
import
com.jz.dm.common.util.OpenApiResponse
;
...
@@ -15,6 +17,8 @@ import org.springframework.stereotype.Service;
...
@@ -15,6 +17,8 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Map
;
/**
/**
* @author ZC
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.request
* @PACKAGE_NAME: com.jz.dm.service.request
...
@@ -39,6 +43,10 @@ public class ApiQueryService implements OpenApiService {
...
@@ -39,6 +43,10 @@ public class ApiQueryService implements OpenApiService {
@Autowired
@Autowired
private
ApiInterfaceService
apiInterfaceService
;
private
ApiInterfaceService
apiInterfaceService
;
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
HttpsUtils
httpsUtils
;
@Override
@Override
@ApiLogAspect
(
description
=
"API请求日志"
)
@ApiLogAspect
(
description
=
"API请求日志"
)
@AccessLimit
(
limit
=
10000
,
sec
=
1
)
@AccessLimit
(
limit
=
10000
,
sec
=
1
)
...
@@ -57,6 +65,22 @@ public class ApiQueryService implements OpenApiService {
...
@@ -57,6 +65,22 @@ public class ApiQueryService implements OpenApiService {
break
;
break
;
case
"CUSTOM_QUERY"
:
//自定义查询(三方查询)
case
"CUSTOM_QUERY"
:
//自定义查询(三方查询)
break
;
break
;
case
"DATA_BANK_QUERY"
:
//数据银行查询
String
reqParams
=
parameter
.
getString
(
"reqParams"
);
if
(
StringUtils
.
isNotBlank
(
reqParams
)){
String
apiInterface
=
redisUtils
.
get
(
request
.
getAppKey
());
if
(
null
!=
apiInterface
){
//存在
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
apiInterface
);
String
requestParam
=
jsonObject
.
getString
(
"requestParam"
);
String
targetUrl
=
jsonObject
.
getString
(
"targetUrl"
);
Map
param
=
(
Map
)
JSONObject
.
parseObject
(
requestParam
);
String
respResult
=
httpsUtils
.
doGet
(
targetUrl
,
param
);
response
.
setAttribute
(
respResult
);
}
else
{
//不存在查询数据库
//apiInterfaceService.getReqTargetInfo(request.getAppKey());
}
}
break
;
case
"DATA_BAG_QUERY"
:
//数据包查询
case
"DATA_BAG_QUERY"
:
//数据包查询
break
;
break
;
default
:
default
:
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestHttpReq.java
View file @
e5ac3d62
...
@@ -39,6 +39,7 @@ public class TestHttpReq extends SpringTestCase {
...
@@ -39,6 +39,7 @@ public class TestHttpReq extends SpringTestCase {
headers
.
put
(
"Charsert"
,
"UTF-8"
);
headers
.
put
(
"Charsert"
,
"UTF-8"
);
headers
.
put
(
"Accept"
,
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
);
headers
.
put
(
"Accept"
,
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
);
String
response
=
httpsUtils
.
submitPost
(
baseUrlPost
,
jsonObject
,
headers
);
String
response
=
httpsUtils
.
submitPost
(
baseUrlPost
,
jsonObject
,
headers
);
System
.
out
.
println
(
response
);
System
.
out
.
println
(
response
);
}
}
}
}
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestMakeApi.java
View file @
e5ac3d62
package
com
.
jz
.
dm
.
gateway
.
orther
;
package
com
.
jz
.
dm
.
gateway
.
orther
;
import
com.jz.common.utils.WebUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.utils.HttpsUtils
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.service.ProducerService
;
import
com.jz.dm.service.ProducerService
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -23,19 +24,21 @@ public class TestMakeApi extends SpringTestCase {
...
@@ -23,19 +24,21 @@ public class TestMakeApi extends SpringTestCase {
@Autowired
@Autowired
private
ProducerService
producerService
;
private
ProducerService
producerService
;
@Autowired
private
HttpsUtils
httpsUtils
;
@Test
@Test
public
void
testApiMake
()
{
public
void
testApiMake
()
{
Map
headers
=
new
HashMap
<
String
,
String
>();
Map
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
put
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
put
(
"User-Agent"
,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
);
headers
.
put
(
"User-Agent"
,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
);
Map
params
=
new
HashMap
<
String
,
String
>
();
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"apiType"
,
"2"
);
params
.
put
(
"apiType"
,
"2"
);
params
.
put
(
"apiKey"
,
"www.q99sss9"
);
params
.
put
(
"apiKey"
,
"www.q99sss9"
);
params
.
put
(
"apiProtocl"
,
"HTTPS"
);
params
.
put
(
"apiProtocl"
,
"HTTPS"
);
params
.
put
(
"type"
,
"1"
);
params
.
put
(
"type"
,
"1"
);
try
{
try
{
String
result
=
WebUtils
.
p
ost
(
url
,
params
,
headers
);
String
result
=
httpsUtils
.
submitP
ost
(
url
,
params
,
headers
);
System
.
out
.
println
(
"接受到的结果为:"
+
result
);
System
.
out
.
println
(
"接受到的结果为:"
+
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
jz-dm-common/src/main/java/com/jz/common/constant/ResultMsg.java
View file @
e5ac3d62
...
@@ -78,9 +78,9 @@ public enum ResultMsg {
...
@@ -78,9 +78,9 @@ public enum ResultMsg {
*/
*/
INVALID_USER
(
"用户错误"
),
INVALID_USER
(
"用户错误"
),
/**
/**
* 用户
已报备
* 用户
未登录
*/
*/
USER_
REPORTED
(
"用户已报备
"
),
USER_
NOT_LOGIN
(
"用户未登录
"
),
/**
/**
* 用户名错误
* 用户名错误
...
...
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