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
da3c8b94
Commit
da3c8b94
authored
Jan 29, 2021
by
ysongq
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dm_dev' into dm_dev
parents
deb9ea2e
86d6f621
Changes
54
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
54 changed files
with
2142 additions
and
899 deletions
+2142
-899
api_gateway.sql
database/zc/api_gateway.sql
+13
-15
TagConstants.java
...src/main/java/com/jz/dm/common/constant/TagConstants.java
+6
-0
GatewayResultCode.java
...c/main/java/com/jz/dm/common/enums/GatewayResultCode.java
+9
-1
AuthTypeEnum.java
...c/main/java/com/jz/dm/common/enums/auth/AuthTypeEnum.java
+1
-1
DateUtil.java
...gateway/src/main/java/com/jz/dm/common/util/DateUtil.java
+18
-0
RandomUtil.java
...teway/src/main/java/com/jz/dm/common/util/RandomUtil.java
+5
-0
HttpDownload.java
.../main/java/com/jz/dm/common/util/stream/HttpDownload.java
+108
-6
ApiInterfaceController.java
...ain/java/com/jz/dm/controller/ApiInterfaceController.java
+29
-12
AuthController.java
...ay/src/main/java/com/jz/dm/controller/AuthController.java
+10
-0
GatewayController.java
...src/main/java/com/jz/dm/controller/GatewayController.java
+3
-1
OrganizationManageController.java
...va/com/jz/dm/controller/OrganizationManageController.java
+0
-10
ProducerController.java
...rc/main/java/com/jz/dm/controller/ProducerController.java
+77
-43
AuthFilter.java
...apigateway/src/main/java/com/jz/dm/filter/AuthFilter.java
+28
-18
FilterChainImpl.java
...teway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
+6
-5
VerifySignFilter.java
...eway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
+24
-20
DefaultOpenApiDispatcher.java
...main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
+8
-8
ApiInterfaceMapper.java
...ay/src/main/java/com/jz/dm/mapper/ApiInterfaceMapper.java
+27
-1
ApiAuth.java
...ateway/src/main/java/com/jz/dm/models/domian/ApiAuth.java
+9
-0
ApiInterface.java
...y/src/main/java/com/jz/dm/models/domian/ApiInterface.java
+16
-32
ApiInterfaceCustom.java
...main/java/com/jz/dm/models/domian/ApiInterfaceCustom.java
+14
-0
ApiInterfaceFile.java
...c/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
+1
-7
ApiOrg.java
...gateway/src/main/java/com/jz/dm/models/domian/ApiOrg.java
+7
-0
ApiServiceApplyDto.java
...rc/main/java/com/jz/dm/models/dto/ApiServiceApplyDto.java
+44
-0
GatewayRequest.java
.../src/main/java/com/jz/dm/models/enity/GatewayRequest.java
+4
-0
AuthUserApiReq.java
...c/main/java/com/jz/dm/models/req/auth/AuthUserApiReq.java
+2
-2
ServiceAuthReq.java
...c/main/java/com/jz/dm/models/req/auth/ServiceAuthReq.java
+30
-0
CreateFolderReq.java
...ain/java/com/jz/dm/models/req/folder/CreateFolderReq.java
+40
-0
MakeBigDataApiReq.java
...ain/java/com/jz/dm/models/req/make/MakeBigDataApiReq.java
+0
-83
OrganizationManageAddReq.java
...dels/req/organizationManage/OrganizationManageAddReq.java
+15
-9
OrganizationManageListQueryReq.java
...eq/organizationManage/OrganizationManageListQueryReq.java
+5
-0
ApiInterfaceReq.java
...n/java/com/jz/dm/models/req/producer/ApiInterfaceReq.java
+113
-0
MakeBigDataApiReq.java
...java/com/jz/dm/models/req/producer/MakeBigDataApiReq.java
+81
-0
MakeDataBankApiReq.java
...ava/com/jz/dm/models/req/producer/MakeDataBankApiReq.java
+18
-7
MakeRealCustomApiReq.java
...a/com/jz/dm/models/req/producer/MakeRealCustomApiReq.java
+1
-1
ServiceIssueReq.java
...n/java/com/jz/dm/models/req/producer/ServiceIssueReq.java
+31
-0
SourceConfigReq.java
...n/java/com/jz/dm/models/req/producer/SourceConfigReq.java
+1
-1
ApiInterfaceService.java
.../src/main/java/com/jz/dm/service/ApiInterfaceService.java
+27
-6
AuthService.java
...igateway/src/main/java/com/jz/dm/service/AuthService.java
+7
-0
OrganizationManageService.java
...ain/java/com/jz/dm/service/OrganizationManageService.java
+0
-6
ProducerService.java
...eway/src/main/java/com/jz/dm/service/ProducerService.java
+45
-28
ApiInterfaceServiceImpl.java
.../java/com/jz/dm/service/impl/ApiInterfaceServiceImpl.java
+70
-25
AuthServiceImpl.java
...src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
+50
-32
OrganizationManageImpl.java
...n/java/com/jz/dm/service/impl/OrganizationManageImpl.java
+98
-96
ProducerServiceImpl.java
...main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
+510
-304
ApiQueryService.java
.../main/java/com/jz/dm/service/request/ApiQueryService.java
+247
-54
ApiQueryTestService.java
...n/java/com/jz/dm/service/request/ApiQueryTestService.java
+93
-0
SystemLogAspect.java
...y/src/main/java/com/jz/dm/web/aspect/SystemLogAspect.java
+34
-30
application-test.yml
jz-dm-apigateway/src/main/resources/application-test.yml
+18
-11
ApiInterfaceMapper.xml
...igateway/src/main/resources/mapper/ApiInterfaceMapper.xml
+39
-6
ApiReqTest.java
...teway/src/test/java/com/jz/dm/gateway/api/ApiReqTest.java
+3
-4
TestOrganizationManage.java
...st/java/com/jz/dm/gateway/org/TestOrganizationManage.java
+2
-4
TestRedisUserSave.java
...test/java/com/jz/dm/gateway/orther/TestRedisUserSave.java
+3
-3
TestStr.java
...teway/src/test/java/com/jz/dm/gateway/orther/TestStr.java
+90
-5
TestStreamReq.java
...src/test/java/com/jz/dm/gateway/orther/TestStreamReq.java
+2
-2
No files found.
database/zc/api_gateway.sql
View file @
da3c8b94
...
@@ -4,24 +4,20 @@ CREATE TABLE `t_api_interface` (
...
@@ -4,24 +4,20 @@ CREATE TABLE `t_api_interface` (
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api 信息表自增ID'
,
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api 信息表自增ID'
,
`api_key`
varchar
(
200
)
NOT
NULL
COMMENT
'api唯一标识'
,
`api_key`
varchar
(
200
)
NOT
NULL
COMMENT
'api唯一标识'
,
`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_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 数据银行制作数据包,3,数据银行制作自定义API 4 API实时接入 6 标签查询 9自定义'
,
`api_type`
varchar
(
50
)
NULL
DEFAULT
''
COMMENT
'接入类型:字典表对应key值'
,
`req_type`
varchar
(
20
)
NULL
DEFAULT
NULL
COMMENT
'请求方式: GET, POST'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
`join_type`
varchar
(
50
)
NULL
DEFAULT
NULL
COMMENT
'接入类型:字典表对应key值'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`test_example`
varchar
(
255
)
NULL
DEFAULT
NULL
COMMENT
'测试实例'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`output_type`
varchar
(
50
)
NULL
DEFAULT
'JSON'
COMMENT
'输出类型:flow 流形式输出, json格式输出'
,
`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
'v1.0'
COMMENT
'版本号'
,
`version`
varchar
(
20
)
DEFAULT
'v1.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
'超时时间'
,
`file_id`
bigint
(
20
)
NO
T
NULL
COMMENT
'文件夹id'
,
`file_id`
bigint
(
20
)
DEFAUL
T
NULL
COMMENT
'文件夹id'
,
`
req
_type`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'限流类型:DAY 按天,MONTH 按月, YEAR 按年'
,
`
limit
_type`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'限流类型:DAY 按天,MONTH 按月, YEAR 按年'
,
`req_frequency`
bigint
(
20
)
DEFAULT
'100'
COMMENT
'限制次数'
,
`req_frequency`
bigint
(
20
)
DEFAULT
'100'
COMMENT
'限制次数'
,
`is_
test`
tinyint
(
2
)
NOT
NULL
DEFAULT
'0'
COMMENT
'是否测试数据:0 否,1 是'
,
`is_
send_bank`
tinyint
(
2
)
NULL
DEFAULT
0
COMMENT
'是否发送到数据银行: 0 false ,1 true '
`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
'创建人'
,
...
@@ -37,24 +33,24 @@ DROP TABLE IF EXISTS `t_api_interface_custom`;
...
@@ -37,24 +33,24 @@ DROP TABLE IF EXISTS `t_api_interface_custom`;
CREATE
TABLE
`t_api_interface_custom`
(
CREATE
TABLE
`t_api_interface_custom`
(
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api 信息表自增ID'
,
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api 信息表自增ID'
,
`api_key`
varchar
(
200
)
NOT
NULL
COMMENT
'api唯一标识'
,
`api_key`
varchar
(
200
)
NOT
NULL
COMMENT
'api唯一标识'
,
`api_interface_id`
bigint
(
20
)
NOT
NULL
COMMENT
'api表自增id'
,
`api_type`
varchar
(
50
)
DEFAULT
''
COMMENT
'api类型:1 数据银行制作大数据表 2 数据银行制作数据包,3,数据银行制作自定义API 4 API实时接入 5 DMP标签查询 6.DMP大数据表查询 7 DMP自定义'
,
`api_type`
varchar
(
50
)
DEFAULT
''
COMMENT
'api类型:1 数据银行制作大数据表 2 数据银行制作数据包,3,数据银行制作自定义API 4 API实时接入 5 DMP标签查询 6.DMP大数据表查询 7 DMP自定义'
,
`es_data_source`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'数据源id'
,
`es_data_source`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'数据源id'
,
`es_data_base`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'源数据库名称'
,
`es_data_base`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'源数据库名称'
,
`es_table`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'源数据表名称'
,
`es_table`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'源数据表名称'
,
`handle_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'处理类型'
,
`request_param`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'请求参数'
,
`request_param`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'请求参数'
,
`response_param`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'响应参数'
,
`response_param`
varchar
(
300
)
DEFAULT
NULL
COMMENT
'响应参数'
,
`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
'固定参数'
,
`inbox_param`
varchar
(
300
)
NULL
DEFAULT
NULL
COMMENT
'固定参数'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`page_num`
int
(
10
)
NULL
DEFAULT
1000000
COMMENT
'最大行数'
,
`page_size`
int
(
10
)
NULL
DEFAULT
1000
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
'创建人'
,
`update_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'修改时间'
,
`update_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'修改时间'
,
`update_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'更新人'
,
`update_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'更新人'
,
`is_deleted`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'是否删除'
,
`is_deleted`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
),
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`API_ID_UNIQ_INDEX`
(
`api_interface_id`
)
USING
BTREE
UNIQUE
KEY
`API_ID_UNIQ_INDEX`
(
`api_interface_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api自定义信息表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api自定义信息表'
;
...
@@ -64,7 +60,7 @@ DROP TABLE IF EXISTS `t_api_interface_file`;
...
@@ -64,7 +60,7 @@ DROP TABLE IF EXISTS `t_api_interface_file`;
CREATE
TABLE
`t_api_interface_file`
(
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
API制做,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'
,
...
@@ -91,6 +87,7 @@ CREATE TABLE `t_api_org` (
...
@@ -91,6 +87,7 @@ CREATE TABLE `t_api_org` (
`org_type`
varchar
(
20
)
NULL
DEFAULT
NULL
COMMENT
'组织类型:OUT 外部组织, IN 内部组织'
,
`org_type`
varchar
(
20
)
NULL
DEFAULT
NULL
COMMENT
'组织类型:OUT 外部组织, IN 内部组织'
,
`status`
tinyint
(
2
)
DEFAULT
'1'
COMMENT
'状态: 0- 注销 1- 正常'
,
`status`
tinyint
(
2
)
DEFAULT
'1'
COMMENT
'状态: 0- 注销 1- 正常'
,
`org_mail`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'组织邮箱'
,
`org_mail`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'组织邮箱'
,
`org_folder_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'组织所在文件夹id'
,
`org_sort`
int
(
10
)
DEFAULT
'999'
COMMENT
'组织排序'
,
`org_sort`
int
(
10
)
DEFAULT
'999'
COMMENT
'组织排序'
,
`parent_id`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'父类组织编码'
,
`parent_id`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'父类组织编码'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
...
@@ -118,6 +115,7 @@ CREATE TABLE `t_api_auth` (
...
@@ -118,6 +115,7 @@ CREATE TABLE `t_api_auth` (
`auth_mode`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用 PERMANENT_TIME_MODE 永久有效'
,
`auth_mode`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用 PERMANENT_TIME_MODE 永久有效'
,
`valid_start_time`
datetime
DEFAULT
NULL
COMMENT
'开始时间'
,
`valid_start_time`
datetime
DEFAULT
NULL
COMMENT
'开始时间'
,
`valid_end_time`
datetime
DEFAULT
NULL
COMMENT
'结束时间'
,
`valid_end_time`
datetime
DEFAULT
NULL
COMMENT
'结束时间'
,
`valid_expr_date`
datetime
DEFAULT
NULL
COMMENT
'有效截止时间'
,
`handler`
tinyint
(
2
)
NULL
DEFAULT
'0'
COMMENT
'处理状态:0 未处理, 1 已处理'
,
`handler`
tinyint
(
2
)
NULL
DEFAULT
'0'
COMMENT
'处理状态:0 未处理, 1 已处理'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(VALID-正常 UN_VALID-无效)'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(VALID-正常 UN_VALID-无效)'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/constant/TagConstants.java
View file @
da3c8b94
...
@@ -30,4 +30,10 @@ public class TagConstants {
...
@@ -30,4 +30,10 @@ public class TagConstants {
//redis限流相关
//redis限流相关
public
static
final
String
OPEN_API_REDIS_LIMIT_KEY
=
"jz:openapi:redis:limit:"
;
public
static
final
String
OPEN_API_REDIS_LIMIT_KEY
=
"jz:openapi:redis:limit:"
;
//API缓存Key
public
static
final
String
OPEN_API_CACHE_KEY
=
"jz:openapi:cache:"
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/GatewayResultCode.java
View file @
da3c8b94
...
@@ -37,7 +37,6 @@ public enum GatewayResultCode implements ResultCode {
...
@@ -37,7 +37,6 @@ public enum GatewayResultCode implements ResultCode {
ILLEGAL_TIMETEMP
(
"ILLEGAL_TIMETEMP"
,
"无效时间戳"
),
ILLEGAL_TIMETEMP
(
"ILLEGAL_TIMETEMP"
,
"无效时间戳"
),
/** 请求次数受限 */
/** 请求次数受限 */
REQUEST_LIMIT_EXCEPTION
(
"REQUEST_LIMIT_EXCEPTION"
,
"请求次数受限"
),
REQUEST_LIMIT_EXCEPTION
(
"REQUEST_LIMIT_EXCEPTION"
,
"请求次数受限"
),
...
@@ -60,6 +59,12 @@ public enum GatewayResultCode implements ResultCode {
...
@@ -60,6 +59,12 @@ public enum GatewayResultCode implements ResultCode {
/** API状态异常 */
/** API状态异常 */
API_STATUS_EXCEPTION
(
"API_STATUS_EXCEPTION"
,
"API状态异常"
),
API_STATUS_EXCEPTION
(
"API_STATUS_EXCEPTION"
,
"API状态异常"
),
/** API类型错误 */
API_TYPE_ERROR
(
"API_TYPE_ERROR"
,
"API类型错误"
),
/** 文件地址不存在 */
DATA_BIG_ADDR_UNEXIST
(
"DATA_BIG_ADDR_UNEXIST"
,
"文件地址不存在!"
),
/** 请求组织状态异常 */
/** 请求组织状态异常 */
ORG_STATE_EXCEPTION
(
"ORG_STATE_EXCEPTION"
,
"请求组织状态异常"
),
ORG_STATE_EXCEPTION
(
"ORG_STATE_EXCEPTION"
,
"请求组织状态异常"
),
/** 请求信息不存在 */
/** 请求信息不存在 */
...
@@ -70,6 +75,9 @@ public enum GatewayResultCode implements ResultCode {
...
@@ -70,6 +75,9 @@ public enum GatewayResultCode implements ResultCode {
/** 单次调用金额不足 */
/** 单次调用金额不足 */
CALL_AMOUNT_NOT_ENOUGH
(
"CALL_AMOUNT_NOT_ENOUGH"
,
"单次调用金额不足"
),
CALL_AMOUNT_NOT_ENOUGH
(
"CALL_AMOUNT_NOT_ENOUGH"
,
"单次调用金额不足"
),
/** 认证API已过有效期 */
AUTH_EXCEED_TIME
(
"AUTH_EXCEED_TIME"
,
"认证API已过有效期"
),
/** 输出类型错误 */
/** 输出类型错误 */
OUTPUT_TYPE_EXCEPTION
(
"OUTPUT_TYPE_EXCEPTION"
,
"输出类型错误!"
);
OUTPUT_TYPE_EXCEPTION
(
"OUTPUT_TYPE_EXCEPTION"
,
"输出类型错误!"
);
/**
/**
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/auth/AuthTypeEnum.java
View file @
da3c8b94
...
@@ -30,7 +30,7 @@ public enum AuthTypeEnum {
...
@@ -30,7 +30,7 @@ public enum AuthTypeEnum {
return
text
;
return
text
;
}
}
public
static
AuthTypeEnum
fromTypeName
(
String
typeName
)
{
public
static
AuthTypeEnum
from
Auth
TypeName
(
String
typeName
)
{
for
(
AuthTypeEnum
type
:
AuthTypeEnum
.
values
())
{
for
(
AuthTypeEnum
type
:
AuthTypeEnum
.
values
())
{
if
(
type
.
name
().
equals
(
typeName
))
{
if
(
type
.
name
().
equals
(
typeName
))
{
return
type
;
return
type
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/DateUtil.java
View file @
da3c8b94
...
@@ -43,6 +43,24 @@ public class DateUtil {
...
@@ -43,6 +43,24 @@ public class DateUtil {
c
.
set
(
Calendar
.
SECOND
,
59
);
c
.
set
(
Calendar
.
SECOND
,
59
);
return
(
c
.
getTimeInMillis
()
-
System
.
currentTimeMillis
())
/
1000
;
return
(
c
.
getTimeInMillis
()
-
System
.
currentTimeMillis
())
/
1000
;
}
}
/**
* 获取指定年份的时间
* @param year
* @return
*/
public
static
Date
getAssignYearDate
(
Integer
year
){
Calendar
cal
=
Calendar
.
getInstance
();
/* int year =cal.get(Calendar.YEAR)+1;
int month=cal.get(Calendar.MONTH)+1;
cal.add(Calendar.MONTH, 0);*/
//Date date = cal.getTime(); //结果
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
cal
.
set
(
Calendar
.
YEAR
,
cal
.
get
(
Calendar
.
YEAR
)+
year
);
Date
date
=
cal
.
getTime
();
System
.
out
.
println
(
sdf
.
format
(
date
));
return
date
;
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//System.out.println(calculateNowResidueTime());
//System.out.println(calculateNowResidueTime());
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/RandomUtil.java
View file @
da3c8b94
...
@@ -125,6 +125,11 @@ public class RandomUtil {
...
@@ -125,6 +125,11 @@ public class RandomUtil {
builder
.
append
(
userNum
);
builder
.
append
(
userNum
);
}
}
coding
=
getCodeInfo
(
userId
,
coding
,
builder
,
month
,
day
,
hour
,
minute
,
second
);
coding
=
getCodeInfo
(
userId
,
coding
,
builder
,
month
,
day
,
hour
,
minute
,
second
);
}
else
{
//无内外部之分
if
(
StringUtils
.
isBlank
(
orgCode
))
{
return
""
;
}
coding
=
getCodeInfo
(
orgCode
,
coding
,
builder
,
month
,
day
,
hour
,
minute
,
second
);
}
}
return
coding
;
return
coding
;
}
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/stream/HttpDownload.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
common
.
util
.
stream
;
package
com
.
jz
.
dm
.
common
.
util
.
stream
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.*
;
import
org.apache.http.*
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
java.io.File
;
import
java.io.File
;
...
@@ -14,6 +19,7 @@ import java.text.MessageFormat;
...
@@ -14,6 +19,7 @@ import java.text.MessageFormat;
import
static
com
.
jz
.
common
.
utils
.
HttpClientPool
.
getHttpClient
;
import
static
com
.
jz
.
common
.
utils
.
HttpClientPool
.
getHttpClient
;
/**
/**
* @author ZC
* @author ZC
* @PACKAGE_NAME: com.sentinel.project.util
* @PACKAGE_NAME: com.sentinel.project.util
...
@@ -48,8 +54,90 @@ public class HttpDownload {
...
@@ -48,8 +54,90 @@ public class HttpDownload {
* @param url
* @param url
* @return
* @return
*/
*/
public
static
void
download
(
String
url
)
{
public
static
void
getDownload
(
String
url
)
{
download
(
url
,
null
);
download
(
url
,
null
);
}
/**
* 根据url下载文件,文件名从response header头中获取
*
* @param url
* @param params
*/
public
static
void
postDownload
(
String
url
,
JSONObject
params
)
{
postDownloadFolder
(
url
,
params
,
null
);
}
/**
* 根据url下载文件,保存到filepath中
*
* @param url
* @param params
* @param filepath
*/
private
static
void
postDownloadFolder
(
String
url
,
JSONObject
params
,
String
filepath
)
{
CloseableHttpClient
httpClient
=
getHttpClient
();
InputStream
is
=
null
;
FileOutputStream
fileOut
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
HttpPost
httpPost
=
new
HttpPost
(
url
);
httpPost
.
setHeader
(
"Content-Type"
,
"application/json"
);
if
(
StringUtils
.
isNotBlank
(
params
.
toString
()))
{
httpPost
.
setEntity
(
new
StringEntity
(
params
.
toString
(),
Consts
.
UTF_8
));
}
response
=
httpClient
.
execute
(
httpPost
);
Header
[]
allHeaders
=
response
.
getAllHeaders
();
for
(
Header
header
:
allHeaders
)
{
System
.
out
.
println
(
MessageFormat
.
format
(
"header:{0}={1}"
,
header
.
getName
(),
header
.
getValue
()));
}
String
fileName
=
response
.
getHeaders
(
"Content-Disposition"
)[
0
].
getValue
().
split
(
"filename="
)[
1
];
System
.
out
.
println
(
"文件名为"
+
fileName
);
HttpEntity
entity
=
response
.
getEntity
();
is
=
entity
.
getContent
();
if
(
fileName
==
null
)
{
fileName
=
getFilePath
(
response
);
}
if
(
filepath
!=
null
)
{
fileName
=
filepath
+
splash
+
fileName
;
}
else
{
fileName
=
splash
+
fileName
;
}
File
file
=
new
File
(
fileName
);
file
.
getParentFile
().
mkdirs
();
fileOut
=
new
FileOutputStream
(
file
);
/**
* 根据实际运行效果 设置缓冲区大小
*/
byte
[]
buffer
=
new
byte
[
cache
];
int
ch
=
0
;
while
((
ch
=
is
.
read
(
buffer
))
!=
-
1
)
{
fileOut
.
write
(
buffer
,
0
,
ch
);
}
fileOut
.
flush
();
log
.
info
(
"文件下载成功!"
);
}
catch
(
Exception
e
)
{
log
.
info
(
"数据下载异常:{}"
,
e
.
getMessage
());
e
.
printStackTrace
();
}
finally
{
if
(
is
!=
null
)
{
try
{
is
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
null
!=
fileOut
)
{
try
{
fileOut
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
/**
/**
...
@@ -81,8 +169,8 @@ public class HttpDownload {
...
@@ -81,8 +169,8 @@ public class HttpDownload {
}
}
if
(
filepath
!=
null
)
{
if
(
filepath
!=
null
)
{
fileName
=
filepath
+
splash
+
fileName
;
fileName
=
filepath
+
splash
+
fileName
;
}
else
{
}
else
{
fileName
=
splash
+
fileName
;
fileName
=
splash
+
fileName
;
}
}
File
file
=
new
File
(
fileName
);
File
file
=
new
File
(
fileName
);
file
.
getParentFile
().
mkdirs
();
file
.
getParentFile
().
mkdirs
();
...
@@ -185,8 +273,22 @@ public class HttpDownload {
...
@@ -185,8 +273,22 @@ public class HttpDownload {
String
docx
=
"http://192.168.1.140:8090/api/download/docx"
;
String
docx
=
"http://192.168.1.140:8090/api/download/docx"
;
String
pdf
=
"http://192.168.1.140:8090/api/download/pdf"
;
String
pdf
=
"http://192.168.1.140:8090/api/download/pdf"
;
String
xlsx
=
"http://192.168.1.140:8090/api/download/xlsx"
;
String
xlsx
=
"http://192.168.1.140:8090/api/download/xlsx"
;
String
getDownload
=
"http://192.168.1.140:8082/api/data/query/streaming?datasourceId=2&query_database=product&query_table=table1&request_fileds=%7b%22flelds1%22:%20%22xxxx%22,%20%22field2%22:%22xxxx%22%7d&response_fields=field1,field2,field3,field4&data_size=100"
;
String
postDownload
=
"http://192.168.1.140:8082/api/data/query/streaming1"
;
//String filepath = "C:\\Users\\key\\Desktop\\ideaIU-2019.3.3";
//HttpDownload.download(xlsx, null);
//getDownload(getDownload);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"datasourceId"
,
1
);
jsonObject
.
put
(
"query_database"
,
"product"
);
jsonObject
.
put
(
"query_table"
,
"table1"
);
JSONObject
jsonObject1
=
new
JSONObject
();
jsonObject1
.
put
(
"flelds1"
,
"xxxxx"
);
jsonObject1
.
put
(
"field2"
,
"xxxxx"
);
jsonObject
.
put
(
"request_fileds"
,
jsonObject1
);
jsonObject
.
put
(
"response_fields"
,
"field1,field2,field3,field4"
);
jsonObject
.
put
(
"data_size"
,
100
);
String
filepath
=
"C:\\Users\\key\\Desktop\\ideaIU-2019.3.3"
;
postDownloadFolder
(
postDownload
,
jsonObject
,
null
);
HttpDownload
.
download
(
xlsx
,
filepath
);
}
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ApiInterfaceController.java
View file @
da3c8b94
...
@@ -31,18 +31,26 @@ public class ApiInterfaceController {
...
@@ -31,18 +31,26 @@ public class ApiInterfaceController {
/**
/**
* @Description:API列表查询
* @Description:API列表查询
* @return: API列表
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-24
* @Date: 2020-12-24
*/
*/
@ApiOperation
(
"API列表查询"
)
@ApiOperation
(
"API
---(已调用列表)
列表查询"
)
@PostMapping
(
value
=
"/listApiInterface"
)
@PostMapping
(
value
=
"/listApiInterface"
)
public
Mono
<
Result
>
getApiInterfaceCallList
(
@RequestBody
@Valid
ApiInterfaceInfoListReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiInterfaceService
.
listCallApiInterface
(
req
)));
}
/**
* @Description:API列表查询
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation
(
"API---(未调用列表)列表查询"
)
@PostMapping
(
value
=
"/listUnCallApiInterface"
)
public
Mono
<
Result
>
getApiInterfaceList
(
@RequestBody
@Valid
ApiInterfaceInfoListReq
req
)
{
public
Mono
<
Result
>
getApiInterfaceList
(
@RequestBody
@Valid
ApiInterfaceInfoListReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiInterfaceService
.
listApiInterface
(
req
)));
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiInterfaceService
.
list
UnCall
ApiInterface
(
req
)));
}
}
/**
/**
* @Description:API详情查询
* @Description:API详情查询
* @return: API详情查询
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-24
* @Date: 2020-12-24
*/
*/
...
@@ -53,7 +61,6 @@ public class ApiInterfaceController {
...
@@ -53,7 +61,6 @@ public class ApiInterfaceController {
}
}
/**
/**
* @Description:API删除
* @Description:API删除
* @return: API删除
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-24
* @Date: 2020-12-24
*/
*/
...
@@ -64,7 +71,6 @@ public class ApiInterfaceController {
...
@@ -64,7 +71,6 @@ public class ApiInterfaceController {
}
}
/**
/**
* @Description:DMP-API删除
* @Description:DMP-API删除
* @return: DMP-API删除
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-24
* @Date: 2020-12-24
*/
*/
...
@@ -74,16 +80,27 @@ public class ApiInterfaceController {
...
@@ -74,16 +80,27 @@ public class ApiInterfaceController {
@RequestParam
(
name
=
"apiKey"
)
String
apiKey
)
{
@RequestParam
(
name
=
"apiKey"
)
String
apiKey
)
{
return
Mono
.
fromSupplier
(()
->
apiInterfaceService
.
dmpDeleteAuth
(
type
,
apiKey
));
return
Mono
.
fromSupplier
(()
->
apiInterfaceService
.
dmpDeleteAuth
(
type
,
apiKey
));
}
}
/**
* @Description:数据修改发送状态接口
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation
(
"数据修改发送状态接口"
)
@GetMapping
(
value
=
"/updateSendStatus"
)
public
Mono
<
Result
>
updateApiSendStatus
(
@RequestParam
(
name
=
"apiKey"
)
String
apiKey
)
{
return
Mono
.
fromSupplier
(()
->
apiInterfaceService
.
updateApiSendStatus
(
apiKey
));
}
/**
/**
* @Description:API测试调用
* @Description: 已发送到数据银行API列表
* @return: DMP-API删除
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-24
* @Date: 2020-12-24
*/
*/
@ApiOperation
(
"API调用测试接口"
)
@ApiOperation
(
"已发送到数据银行API列表"
)
@GetMapping
(
value
=
"/apiTestApiInterface"
)
@GetMapping
(
value
=
"/listSendDataBank"
)
public
Mono
<
Result
>
apiTestApiInterface
(
@RequestParam
(
name
=
"apiKey"
)
String
apiKey
)
{
public
Mono
<
Result
>
listSendDataBank
(
@RequestParam
(
name
=
"pageNum"
,
defaultValue
=
"1"
,
required
=
false
)
String
pageNum
,
return
Mono
.
fromSupplier
(()
->
apiInterfaceService
.
apiTestInterface
(
apiKey
));
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"20"
,
required
=
false
)
String
pageSize
)
{
return
Mono
.
fromSupplier
(()
->
apiInterfaceService
.
getSendDataBankList
(
pageNum
,
pageSize
));
}
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/controller/AuthController.java
View file @
da3c8b94
...
@@ -29,6 +29,16 @@ public class AuthController {
...
@@ -29,6 +29,16 @@ public class AuthController {
@Autowired
@Autowired
private
AuthService
authService
;
private
AuthService
authService
;
/**
* @Description:服务授权列表
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation
(
"服务授权列表"
)
@PostMapping
(
value
=
"/getServiceAuthList"
)
public
Mono
<
Result
>
getServiceAuthList
(
@RequestBody
@Valid
ServiceAuthReq
req
)
{
return
Mono
.
fromSupplier
(()
->
authService
.
getServiceAuthList
(
req
));
}
/**
/**
* @Description:商城用户API认证
* @Description:商城用户API认证
* @return: 商城用户API认证
* @return: 商城用户API认证
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/GatewayController.java
View file @
da3c8b94
...
@@ -12,6 +12,7 @@ import io.swagger.annotations.Api;
...
@@ -12,6 +12,7 @@ import io.swagger.annotations.Api;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -32,7 +33,8 @@ public class GatewayController {
...
@@ -32,7 +33,8 @@ public class GatewayController {
@Autowired
@Autowired
private
GatewayService
gatewayService
;
private
GatewayService
gatewayService
;
@RequestMapping
(
value
=
"/gateway"
,
consumes
=
"application/json"
)
//@RequestMapping(value = "/gateway", consumes = "application/json")
@PostMapping
(
value
=
"/gateway"
,
consumes
=
"application/json"
)
public
String
gateway
(
@RequestBody
String
json
,
HttpServletRequest
httpServletRequest
,
public
String
gateway
(
@RequestBody
String
json
,
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
)
{
HttpServletResponse
httpServletResponse
)
{
GatewayRequest
gatewayRequest
=
JSON
.
parseObject
(
json
,
GatewayRequest
.
class
);
GatewayRequest
gatewayRequest
=
JSON
.
parseObject
(
json
,
GatewayRequest
.
class
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/OrganizationManageController.java
View file @
da3c8b94
...
@@ -62,16 +62,6 @@ public class OrganizationManageController {
...
@@ -62,16 +62,6 @@ public class OrganizationManageController {
public
Mono
<
Result
>
add
(
@RequestBody
@Valid
OrganizationManageAddReq
req
)
{
public
Mono
<
Result
>
add
(
@RequestBody
@Valid
OrganizationManageAddReq
req
)
{
return
Mono
.
fromSupplier
(()
->
organizationManageService
.
add
(
req
));
return
Mono
.
fromSupplier
(()
->
organizationManageService
.
add
(
req
));
}
}
/**
* @Description:更新组织信息
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
/* @ApiOperation("更新组织信息")
@PostMapping(value = "/update")
public Mono<Result> update(@RequestBody @Valid OrganizationManageUpdateReq req) {
return Mono.fromSupplier(() -> organizationManageService.update(req));
}*/
/**
/**
* @Description:注销组织
* @Description:注销组织
* @Author: Mr.zhang
* @Author: Mr.zhang
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ProducerController.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
controller
;
package
com
.
jz
.
dm
.
controller
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.models.req.make.*
;
import
com.jz.dm.models.req.folder.CreateFolderReq
;
import
com.jz.dm.models.req.producer.ApiInterfaceReq
;
import
com.jz.dm.models.req.producer.ServiceIssueReq
;
import
com.jz.dm.service.ProducerService
;
import
com.jz.dm.service.ProducerService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -46,115 +48,147 @@ public class ProducerController {
...
@@ -46,115 +48,147 @@ public class ProducerController {
*/
*/
@ApiOperation
(
"创建项目文件夹"
)
@ApiOperation
(
"创建项目文件夹"
)
@PostMapping
(
value
=
"/createProjectFolder"
)
@PostMapping
(
value
=
"/createProjectFolder"
)
public
Mono
<
Result
>
createProjectFolder
(
@RequestParam
(
name
=
"projectId"
)
Long
projectId
,
public
Mono
<
Result
>
createProjectFolder
(
@RequestBody
@Valid
CreateFolderReq
req
)
{
@RequestParam
(
name
=
"parentId"
)
Long
parentId
,
return
Mono
.
fromSupplier
(()
->
producerService
.
createProjectFolder
(
req
));
@RequestParam
(
name
=
"currentUser"
)
String
currentUser
)
{
return
Mono
.
fromSupplier
(()
->
producerService
.
createProjectFolder
(
projectId
,
parentId
,
currentUser
));
}
}
/**
/**
* @Description:
Api制作(自定义DMP)
* @Description:
服务发布列表
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"
Api制作(自定义DMP)
"
)
@ApiOperation
(
"
服务发布列表
"
)
@PostMapping
(
value
=
"/
addCustomApi
"
)
@PostMapping
(
value
=
"/
getServiceIssueList
"
)
public
Mono
<
Result
>
makeCustomApi
(
@RequestBody
@Valid
ApiInterfac
eReq
req
)
{
public
Mono
<
Result
>
getServiceIssueList
(
@RequestBody
@Valid
ServiceIssu
eReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
addCustomApi
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
getServiceIssueList
(
req
));
}
}
/**
/**
* @Description:
Api制作(数据银行)
* @Description:
服务发布/服务取消
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"Api制作(数据银行)"
)
@ApiOperation
(
"服务发布/服务取消"
)
@PostMapping
(
value
=
"/addDataBankApiInfo"
)
@GetMapping
(
value
=
"/optionApiIssueStatus"
)
public
Mono
<
Result
>
addDataBankApiInfo
(
@RequestBody
@Valid
MakeDataBankApiReq
req
)
{
public
Mono
<
Result
>
optionApiIssueStatus
(
@RequestParam
(
name
=
"id"
)
Long
id
,
return
Mono
.
fromSupplier
(()
->
producerService
.
addDataBankApiInfo
(
req
));
@RequestParam
(
name
=
"optStatus"
)
Boolean
optStatus
)
{
return
Mono
.
fromSupplier
(()
->
producerService
.
optionApiIssueStatus
(
id
,
optStatus
));
}
}
/**
/**
* @Description:
Api制作(实时接入)
* @Description:
获取APIID
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"Api制作(
实时接入
)"
)
@ApiOperation
(
"Api制作(
获取ApiId
)"
)
@PostMapping
(
value
=
"/
realMakeApi
"
)
@PostMapping
(
value
=
"/
getCustomApiId
"
)
public
Mono
<
Result
>
realCustomApi
(
@RequestBody
@Valid
MakeRealCustomApiReq
req
)
{
public
Mono
<
Result
>
getCustomApiId
(
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
addRealCustomApi
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
getCustomApiId
(
));
}
}
/**
/**
* @Description:Api制作(大数据查询/标签查询)
* @Description:Api制作(第三方)
* @return:
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"Api制作(
大数据查询/标签查询
)"
)
@ApiOperation
(
"Api制作(
第三方
)"
)
@PostMapping
(
value
=
"/
makeBigData
Api"
)
@PostMapping
(
value
=
"/
addCustom
Api"
)
public
Mono
<
Result
>
bigDataMakeApi
(
@RequestBody
@Valid
MakeBigDataApi
Req
req
)
{
public
Mono
<
Result
>
makeCustomApi
(
@RequestBody
@Valid
ApiInterface
Req
req
)
{
return
Mono
.
fromSupplier
(()
->
producerService
.
addBigDataMakeApi
(
req
));
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
saveInterfaceAPi
(
req
)
));
}
}
/**
/**
* @Description:保存API基本信息/自定义API
* @Description:Api制作(数据查询/标签查询)
* @return: (保存API基本信息)
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"
保存API基本信息
"
)
@ApiOperation
(
"
Api制作(数据查询/标签查询)
"
)
@PostMapping
(
value
=
"/
saveInterface
"
)
@PostMapping
(
value
=
"/
addDataTableSelect
"
)
public
Mono
<
Result
>
saveInsetInterface
(
@RequestBody
@Valid
ApiInterfaceReq
req
)
{
public
Mono
<
Result
>
bigDataMakeApi
(
@RequestBody
@Valid
ApiInterfaceReq
req
)
{
return
Mono
.
fromSupplier
(()
->
producerService
.
saveInterfaceAP
i
(
req
));
return
Mono
.
fromSupplier
(()
->
producerService
.
addBigDataMakeAp
i
(
req
));
}
}
/**
/**
* @Description:Api制作(大数据查询/标签查询)保存修改的api信息
* @Description:Api制作(大数据查询/标签查询)保存修改的api信息
* @return: (自定义更新同时使用)
* @return: (自定义更新同时使用)
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"保存修改的api信息"
)
/*
@ApiOperation("保存修改的api信息")
@PostMapping(value = "/saveUpdate")
@PostMapping(value = "/saveUpdate")
public Mono<Result> saveUpdateAPiInfo(@RequestBody @Valid ApiInterfaceReq req) {
public Mono<Result> saveUpdateAPiInfo(@RequestBody @Valid ApiInterfaceReq req) {
return Mono.fromSupplier(() -> producerService.saveUpdateAPiInfo(req));
return Mono.fromSupplier(() -> producerService.saveUpdateAPiInfo(req));
}*/
/* *//**
* @Description:Api制作(数据银行)
* @Author: Mr.zhang
* @Date: 2020-12-26
*//*
@ApiOperation("Api制作(数据银行)")
@PostMapping(value = "/addDataBankApiInfo")
public Mono<Result> addDataBankApiInfo(@RequestBody @Valid MakeDataBankApiReq req) {
return Mono.fromSupplier(() -> producerService.addDataBankApiInfo(req));
}
}
*//**
* @Description:Api制作(实时接入)
* @Author: Mr.zhang
* @Date: 2020-12-26
*//*
@ApiOperation("Api制作(实时接入)")
@PostMapping(value = "/realMakeApi")
public Mono<Result> realCustomApi(@RequestBody @Valid MakeRealCustomApiReq req) {
return Mono.fromSupplier(() -> Result.of_success(producerService.addRealCustomApi(req)));
}*/
/**
/**
* @Description:保存API基本信息/自定义API
* @return: (保存API基本信息)
* @Author: Mr.zhang
* @Date: 2020-12-26
*//*
@ApiOperation("保存API基本信息")
@PostMapping(value = "/saveInterface")
public Mono<Result> saveInsetInterface(@RequestBody @Valid ApiInterfaceReq req) {
return Mono.fromSupplier(() -> producerService.saveInterfaceAPi(req));
}*/
/*
*//**
* @Description:获取数据源配置
* @Description:获取数据源配置
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
/*
@ApiOperation("获取数据源配置")
@ApiOperation("获取数据源配置")
@PostMapping(value = "/getSourceConfig")
@PostMapping(value = "/getSourceConfig")
public Mono<Result> getSourceConfig(@RequestBody @Valid SourceConfigReq req) {
public Mono<Result> getSourceConfig(@RequestBody @Valid SourceConfigReq req) {
return Mono.fromSupplier(() -> producerService.getSourceConfig(req));
return Mono.fromSupplier(() -> producerService.getSourceConfig(req));
}
}
/**
*/
/**
* @Description:获取索引
* @Description:获取索引
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
/*
@ApiOperation("获取索引")
@ApiOperation("获取索引")
@GetMapping(value = "/getIndicess")
@GetMapping(value = "/getIndicess")
public Mono<Result> getSourceWarehouseList(@RequestParam(name = "id") Long id) {
public Mono<Result> getSourceWarehouseList(@RequestParam(name = "id") Long id) {
return Mono.fromSupplier(() -> producerService.getSourceWarehouseList(id));
return Mono.fromSupplier(() -> producerService.getSourceWarehouseList(id));
}
}
/**
*/
/**
* @Description:获取某个索引下的type
* @Description:获取某个索引下的type
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
/*
@ApiOperation("获取某个索引下的type")
@ApiOperation("获取某个索引下的type")
@GetMapping(value = "/getIndicesTypes")
@GetMapping(value = "/getIndicesTypes")
public Mono<Result> getIndicesTypes(@RequestParam(name = "indices") String indices,
public Mono<Result> getIndicesTypes(@RequestParam(name = "indices") String indices,
@RequestParam(name = "id") Long id) {
@RequestParam(name = "id") Long id) {
return Mono.fromSupplier(() -> producerService.getIndicesTypes(indices,id));
return Mono.fromSupplier(() -> producerService.getIndicesTypes(indices,id));
}
}
/**
*/
/**
* @Description:获取某个索引 type的fields
* @Description:获取某个索引 type的fields
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
/*
@ApiOperation("获取某个索引 type的fields")
@ApiOperation("获取某个索引 type的fields")
@GetMapping(value = "/getIndicesTypesFields")
@GetMapping(value = "/getIndicesTypesFields")
public Mono<Result> getIndicesTypesFields(@RequestParam(name = "indices") String indices,
public Mono<Result> getIndicesTypesFields(@RequestParam(name = "indices") String indices,
...
@@ -174,5 +208,5 @@ public class ProducerController {
...
@@ -174,5 +208,5 @@ public class ProducerController {
@GetMapping(value = "/getRedisObj")
@GetMapping(value = "/getRedisObj")
public Result getObjOnRedis() {
public Result getObjOnRedis() {
return producerService.getObjOnRedis();
return producerService.getObjOnRedis();
}
}
*/
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/AuthFilter.java
View file @
da3c8b94
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import
com.jz.common.utils.HttpsUtils
;
import
com.jz.common.utils.HttpsUtils
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.constant.TagConstants
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.auth.AuthReqTypeEnum
;
import
com.jz.dm.common.enums.auth.AuthReqTypeEnum
;
...
@@ -89,7 +90,11 @@ public class AuthFilter extends AbstractFilter {
...
@@ -89,7 +90,11 @@ public class AuthFilter extends AbstractFilter {
}
}
}
}
JSONObject
parameter
=
JSONObject
.
parseObject
(
request
.
getParams
());
JSONObject
parameter
=
JSONObject
.
parseObject
(
request
.
getParams
());
if
(
null
!=
parameter
)
{
if
(
null
==
parameter
)
{
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_PARAM_EMPTY
);
}
Boolean
isTest
=
parameter
.
getBoolean
(
"isTest"
);
if
(!
isTest
)
{
//是否测试数据
String
authCode
=
parameter
.
getString
(
"authCode"
);
String
authCode
=
parameter
.
getString
(
"authCode"
);
ApiAuth
authAuth
=
authService
.
getAuthUser
(
authCode
,
apiInterface
.
getId
());
ApiAuth
authAuth
=
authService
.
getAuthUser
(
authCode
,
apiInterface
.
getId
());
if
(
null
==
authAuth
)
{
if
(
null
==
authAuth
)
{
...
@@ -107,7 +112,7 @@ public class AuthFilter extends AbstractFilter {
...
@@ -107,7 +112,7 @@ public class AuthFilter extends AbstractFilter {
if
(!
apiOrg
.
getStatus
())
{
if
(!
apiOrg
.
getStatus
())
{
throw
new
GatewayException
(
GatewayResultCode
.
ORG_STATE_EXCEPTION
);
throw
new
GatewayException
(
GatewayResultCode
.
ORG_STATE_EXCEPTION
);
}
}
checkBill
(
request
,
authCode
,
authAuth
,
apiOrg
);
checkBill
(
request
,
authCode
,
authAuth
);
}
}
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -121,7 +126,6 @@ public class AuthFilter extends AbstractFilter {
...
@@ -121,7 +126,6 @@ public class AuthFilter extends AbstractFilter {
response
.
clearAttributes
();
response
.
clearAttributes
();
response
.
setCode
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setCode
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setMsg
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
response
.
setMsg
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
}
}
}
}
...
@@ -132,19 +136,24 @@ public class AuthFilter extends AbstractFilter {
...
@@ -132,19 +136,24 @@ public class AuthFilter extends AbstractFilter {
* @param request
* @param request
* @param authCode
* @param authCode
* @param authAuth
* @param authAuth
* @param apiOrg
* @throws ParseException
* @throws ParseException
*/
*/
private
void
checkBill
(
GatewayRequest
request
,
String
authCode
,
private
void
checkBill
(
GatewayRequest
request
,
String
authCode
,
ApiAuth
authAuth
,
ApiOrg
apiOrg
)
throws
ParseException
{
ApiAuth
authAuth
)
throws
ParseException
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
Constants
.
DATE_TIME_FORMAT
);
String
formatDate
=
dateFormat
.
format
(
new
Date
());
Date
currentDate
=
dateFormat
.
parse
(
formatDate
);
switch
(
authAuth
.
getAuthMode
())
{
switch
(
authAuth
.
getAuthMode
())
{
case
"POWER_CALL_MODE"
:
//按次调用
case
"POWER_CALL_MODE"
:
//按次调用
//查询数据银行银行余额是否充足
Date
validExprDate
=
authAuth
.
getValidExprDate
();
getDataAmountResult
(
request
);
if
(
currentDate
.
after
(
validExprDate
))
{
//超出时间
throw
new
GatewayException
(
GatewayResultCode
.
AUTH_EXCEED_TIME
);
}
try
{
//记录请求次数(每天限制请求次数)
try
{
//记录请求次数(每天限制请求次数)
// String limitKey = TagConstants.OPEN_API_REDIS_LIMIT_KEY + authCode;
//查询数据银行银行余额是否充足
String
limitKey
=
authCode
;
getDataAmountResult
(
request
);
String
reqValue
=
(
String
)
redisUtils
.
getObj
(
limitKey
);
String
limitKey
=
TagConstants
.
OPEN_API_REDIS_LIMIT_KEY
+
authCode
;
Integer
reqValue
=
(
Integer
)
redisUtils
.
getObj
(
limitKey
);
long
timeOut
=
0
;
long
timeOut
=
0
;
if
(
AuthReqTypeEnum
.
DAY
.
name
().
equals
(
authAuth
.
getReqType
()))
{
//按天
if
(
AuthReqTypeEnum
.
DAY
.
name
().
equals
(
authAuth
.
getReqType
()))
{
//按天
timeOut
=
DateUtil
.
calculateNowResidueTime
();
timeOut
=
DateUtil
.
calculateNowResidueTime
();
...
@@ -154,11 +163,11 @@ public class AuthFilter extends AbstractFilter {
...
@@ -154,11 +163,11 @@ public class AuthFilter extends AbstractFilter {
//暂时不支持年
//暂时不支持年
}
}
if
(
null
!=
reqValue
)
{
if
(
null
!=
reqValue
)
{
Integer
value
=
Integer
.
valueOf
(
reqValue
);
/* Integer value = Integer.valueOf(reqValue);*/
if
(
v
alue
>
authAuth
.
getReqFrequency
())
{
//超出最大请求次数
if
(
reqV
alue
>
authAuth
.
getReqFrequency
())
{
//超出最大请求次数
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_LIMIT_EXCEPTION
);
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_LIMIT_EXCEPTION
);
}
else
if
(
v
alue
<=
authAuth
.
getReqFrequency
())
{
}
else
if
(
reqV
alue
<=
authAuth
.
getReqFrequency
())
{
redisUtils
.
delAndAdd
(
limitKey
,
limitKey
,
v
alue
+
1
,
timeOut
);
redisUtils
.
delAndAdd
(
limitKey
,
limitKey
,
reqV
alue
+
1
,
timeOut
);
}
}
}
else
{
}
else
{
redisUtils
.
set
(
limitKey
,
1
,
timeOut
);
redisUtils
.
set
(
limitKey
,
1
,
timeOut
);
...
@@ -170,9 +179,6 @@ public class AuthFilter extends AbstractFilter {
...
@@ -170,9 +179,6 @@ public class AuthFilter extends AbstractFilter {
}
}
break
;
break
;
case
"RECORD_TIME_MODE"
:
//按时间调用
case
"RECORD_TIME_MODE"
:
//按时间调用
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
Constants
.
DATE_TIME_FORMAT
);
String
formatDate
=
dateFormat
.
format
(
new
Date
());
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
.
after
(
validEndTime
))
{
//超出时间
if
(
currentDate
.
after
(
validEndTime
))
{
//超出时间
...
@@ -181,6 +187,10 @@ public class AuthFilter extends AbstractFilter {
...
@@ -181,6 +187,10 @@ public class AuthFilter extends AbstractFilter {
}
}
break
;
break
;
case
"PERMANENT_TIME_MODE"
:
//永久有效(直接跳出)
case
"PERMANENT_TIME_MODE"
:
//永久有效(直接跳出)
Date
validExpr
=
authAuth
.
getValidExprDate
();
if
(
currentDate
.
after
(
validExpr
))
{
//超出时间
throw
new
GatewayException
(
GatewayResultCode
.
AUTH_EXCEED_TIME
);
}
break
;
break
;
default
:
default
:
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
...
@@ -217,7 +227,7 @@ public class AuthFilter extends AbstractFilter {
...
@@ -217,7 +227,7 @@ public class AuthFilter extends AbstractFilter {
pObject
.
put
(
"assetsId"
,
assetsId
);
pObject
.
put
(
"assetsId"
,
assetsId
);
pObject
.
put
(
"userId"
,
userId
);
pObject
.
put
(
"userId"
,
userId
);
pObject
.
put
(
"dataPrice"
,
dataPrice
);
pObject
.
put
(
"dataPrice"
,
dataPrice
);
String
respResult
=
httpUtils
.
submitPost
(
balanceUrl
+
"/mall/financeCustomerAssets/findAssets"
,
pObject
.
toString
());
String
respResult
=
httpUtils
.
submitPost
(
balanceUrl
+
"/mall/financeCustomerAssets/findAssets"
,
pObject
.
toString
());
JSONObject
result
=
JSONObject
.
parseObject
(
respResult
);
JSONObject
result
=
JSONObject
.
parseObject
(
respResult
);
if
(
null
!=
result
)
{
if
(
null
!=
result
)
{
if
(
200
!=
result
.
getInteger
(
"code"
))
{
if
(
200
!=
result
.
getInteger
(
"code"
))
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
filter
;
package
com
.
jz
.
dm
.
filter
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.exception.OpenApiException
;
import
com.jz.dm.common.exception.OpenApiException
;
import
com.jz.dm.common.util.LogUtil
;
import
com.jz.dm.common.util.LogUtil
;
import
com.jz.dm.common.util.ResultCode
;
import
com.jz.dm.common.util.ResultCode
;
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.common.enums.GatewayResultCode
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -19,13 +19,14 @@ import java.util.List;
...
@@ -19,13 +19,14 @@ import java.util.List;
*/
*/
public
class
FilterChainImpl
implements
FilterChain
{
public
class
FilterChainImpl
implements
FilterChain
{
private
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
private
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
private
int
pos
=
0
;
private
int
pos
=
0
;
private
final
List
<
Filter
>
filters
=
new
ArrayList
<
Filter
>();
private
final
List
<
Filter
>
filters
=
new
ArrayList
<
Filter
>();
public
FilterChainImpl
()
{
}
public
FilterChainImpl
()
{
}
public
FilterChainImpl
(
List
<
Filter
>
filters
)
{
public
FilterChainImpl
(
List
<
Filter
>
filters
)
{
addFilters
(
filters
);
addFilters
(
filters
);
...
@@ -42,7 +43,7 @@ public class FilterChainImpl implements FilterChain {
...
@@ -42,7 +43,7 @@ public class FilterChainImpl implements FilterChain {
}
catch
(
OpenApiException
ex
)
{
}
catch
(
OpenApiException
ex
)
{
ResultCode
resultCode
=
ex
.
getResultCode
();
ResultCode
resultCode
=
ex
.
getResultCode
();
LogUtil
.
error
(
LOGGER
,
ex
,
"doFilter occur exception,code="
+
resultCode
.
getCode
()
LogUtil
.
error
(
LOGGER
,
ex
,
"doFilter occur exception,code="
+
resultCode
.
getCode
()
+
",msg="
+
resultCode
.
getMsg
()
+
",request="
+
request
);
+
",msg="
+
resultCode
.
getMsg
()
+
",request="
+
request
);
response
.
setCode
(
ex
.
getResultCode
().
getCode
());
response
.
setCode
(
ex
.
getResultCode
().
getCode
());
response
.
setMsg
(
ex
.
getResultCode
().
getMsg
());
response
.
setMsg
(
ex
.
getResultCode
().
getMsg
());
}
catch
(
Throwable
ex
)
{
}
catch
(
Throwable
ex
)
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
View file @
da3c8b94
...
@@ -19,15 +19,16 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -19,15 +19,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
* @Description: 验签过滤器(验证签名信息)
* @Description: 验签过滤器(验证签名信息)
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2021-1-6
* @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
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
VerifySignFilter
.
class
);
@Autowired
@Autowired
private
ApiInterfaceService
apiInterfaceService
;
private
ApiInterfaceService
apiInterfaceService
;
@Override
@Override
public
int
getOrder
()
{
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_3
;
return
Constants
.
FILTER_ORDER_3
;
...
@@ -37,26 +38,29 @@ public class VerifySignFilter extends AbstractFilter {
...
@@ -37,26 +38,29 @@ public class VerifySignFilter extends AbstractFilter {
public
String
getFilterName
()
{
public
String
getFilterName
()
{
return
"VerifySignFilter"
;
return
"VerifySignFilter"
;
}
}
@Override
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
FilterChain
chain
)
{
try
{
try
{
//对签约参数进行字典排序
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
request
.
getParams
());
String
signParams
=
MapUtil
.
getSignValue
(
request
.
getApiKey
(),
request
.
getMethod
(),
request
.
getSignType
());
if
(!
jsonObject
.
getBoolean
(
"isTest"
))
{
//是否测试调用
if
(
StringUtils
.
isNotBlank
(
signParams
)){
//对签约参数进行字典排序
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
request
.
getParams
());
String
signParams
=
MapUtil
.
getSignValue
(
request
.
getApiKey
(),
request
.
getMethod
(),
request
.
getSignType
());
String
authCode
=
jsonObject
.
getString
(
"authCode"
);
if
(
StringUtils
.
isNotBlank
(
signParams
))
{
//需要传入授权码
String
authCode
=
jsonObject
.
getString
(
"authCode"
);
ApiAuth
apiAuthInfo
=
apiInterfaceService
.
getApiAuthInfo
(
request
.
getApiKey
(),
authCode
);
//需要传入授权码
if
(
null
==
apiAuthInfo
){
ApiAuth
apiAuthInfo
=
apiInterfaceService
.
getApiAuthInfo
(
request
.
getApiKey
(),
authCode
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
if
(
null
==
apiAuthInfo
)
{
}
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_REQUEST
);
String
sign
=
Md5
.
encrypt
(
signParams
,
apiAuthInfo
.
getSalt
());
}
if
(!
request
.
getSign
().
equals
(
sign
)){
String
sign
=
Md5
.
encrypt
(
signParams
,
apiAuthInfo
.
getSalt
());
if
(!
request
.
getSign
().
equals
(
sign
))
{
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
}
}
else
{
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
}
}
}
else
{
throw
new
GatewayException
(
GatewayResultCode
.
SIGN_ERROR
);
}
}
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
catch
(
SignatureException
ex
)
{
}
catch
(
SignatureException
ex
)
{
...
@@ -66,8 +70,8 @@ public class VerifySignFilter extends AbstractFilter {
...
@@ -66,8 +70,8 @@ public class VerifySignFilter extends AbstractFilter {
response
.
setCode
(
ex
.
getResultCode
().
getCode
());
response
.
setCode
(
ex
.
getResultCode
().
getCode
());
response
.
setMsg
(
ex
.
getResultCode
().
getMsg
());
response
.
setMsg
(
ex
.
getResultCode
().
getMsg
());
}
catch
(
Throwable
ex
)
{
}
catch
(
Throwable
ex
)
{
if
(
ex
instanceof
GatewayException
)
{
if
(
ex
instanceof
GatewayException
)
{
throw
(
GatewayException
)
ex
;
throw
(
GatewayException
)
ex
;
}
}
LogUtil
.
error
(
LOGGER
,
ex
,
LogUtil
.
error
(
LOGGER
,
ex
,
"signatureFilter doFilter error. response="
+
response
.
getResponse
());
"signatureFilter doFilter error. response="
+
response
.
getResponse
());
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
gateway
;
package
com
.
jz
.
dm
.
gateway
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.jz.dm.common.exception.GatewayException
;
import
com.jz.dm.common.exception.OpenApiException
;
import
com.jz.dm.common.exception.OpenApiException
;
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
;
...
@@ -65,18 +66,17 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
...
@@ -65,18 +66,17 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
response
.
setMsg
(
OpenApiResultCode
.
ILLEGAL_INTERFACE
.
getMsg
());
response
.
setMsg
(
OpenApiResultCode
.
ILLEGAL_INTERFACE
.
getMsg
());
return
JSON
.
toJSONString
(
response
.
getAttributes
());
return
JSON
.
toJSONString
(
response
.
getAttributes
());
}
}
try
{
try
{
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
request
.
setApiKey
(
context
.
getApiKey
());
request
.
setApiKey
(
context
.
getApiKey
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
openApiService
.
doService
(
request
,
response
);
openApiService
.
doService
(
request
,
response
);
}
catch
(
Throwable
ex
)
{
}
catch
(
Throwable
ex
)
{
if
(
ex
instanceof
OpenApiException
)
{
if
(
ex
instanceof
OpenApiException
)
{
OpenApiException
oae
=
(
OpenApiException
)
ex
;
throw
(
OpenApiException
)
ex
;
response
.
setCode
(
oae
.
getResultCode
().
getCode
());
}
else
if
(
ex
instanceof
GatewayException
){
response
.
setMsg
(
oae
.
getResultCode
().
getMsg
())
;
throw
(
GatewayException
)
ex
;
}
else
{
}
else
{
LOGGER
.
error
(
"OpenApiService doService error,DispatchContext="
+
context
,
ex
);
LOGGER
.
error
(
"OpenApiService doService error,DispatchContext="
+
context
,
ex
);
response
.
setCode
(
OpenApiResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setCode
(
OpenApiResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setMsg
(
OpenApiResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
response
.
setMsg
(
OpenApiResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
...
@@ -84,8 +84,8 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
...
@@ -84,8 +84,8 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
return
JSON
.
toJSONString
(
response
.
getAttributes
());
return
JSON
.
toJSONString
(
response
.
getAttributes
());
}
}
if
(
StringUtil
.
isEmpty
(
response
.
getCode
()))
{
if
(
StringUtil
.
isEmpty
(
response
.
getCode
()))
{
response
.
setCode
(
OpenApiResultCode
.
SUCCESS
.
getCode
());
response
.
setCode
(
OpenApiResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
response
.
setMsg
(
OpenApiResultCode
.
SUCCESS
.
getMsg
());
response
.
setMsg
(
OpenApiResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
}
}
return
JSON
.
toJSONString
(
response
.
getAttributes
());
return
JSON
.
toJSONString
(
response
.
getAttributes
());
}
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/mapper/ApiInterfaceMapper.java
View file @
da3c8b94
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jz.dm.models.domian.ApiInterface
;
import
com.jz.dm.models.domian.ApiInterface
;
import
com.jz.dm.models.domian.ApiInterfaceCustom
;
import
com.jz.dm.models.domian.ApiInterfaceCustom
;
import
com.jz.dm.models.dto.ApiServiceApplyDto
;
import
com.jz.dm.models.req.api.ApiInterfaceDetailReq
;
import
com.jz.dm.models.req.api.ApiInterfaceDetailReq
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -21,13 +22,21 @@ public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> {
...
@@ -21,13 +22,21 @@ public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> {
/**
/**
* 查询API列表信息
* 查询
(已调用)
API列表信息
* @param page
* @param page
* @param query
* @param query
* @return
* @return
*/
*/
IPage
<
ApiInterface
>
listApiInterfaceInfo
(
IPage
<
ApiInterface
>
page
,
@Param
(
"ew"
)
Wrapper
<
ApiInterface
>
query
);
IPage
<
ApiInterface
>
listApiInterfaceInfo
(
IPage
<
ApiInterface
>
page
,
@Param
(
"ew"
)
Wrapper
<
ApiInterface
>
query
);
/**
* 查询(未调用)API列表信息
* @param page
* @param query
* @return
*/
IPage
<
ApiInterface
>
listCallApiInterfaceInfo
(
IPage
<
ApiInterface
>
page
,
@Param
(
"ew"
)
Wrapper
<
ApiInterface
>
query
);
/**
/**
* 查询API详情信息
* 查询API详情信息
* @param req
* @param req
...
@@ -42,4 +51,21 @@ public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> {
...
@@ -42,4 +51,21 @@ public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> {
* @return
* @return
*/
*/
ApiInterfaceCustom
getTestData
(
String
apiKey
);
ApiInterfaceCustom
getTestData
(
String
apiKey
);
/**
* 查询服务发布列表
* @param page
* @param query
* @return
*/
IPage
<
ApiServiceApplyDto
>
listApiIssueService
(
IPage
<
ApiServiceApplyDto
>
page
,
@Param
(
"ew"
)
Wrapper
<
ApiServiceApplyDto
>
query
);
/**
* 查询服务授权列表
* @param page
* @param query
* @return
*/
IPage
<
ApiServiceApplyDto
>
listApiAuthService
(
IPage
<
ApiServiceApplyDto
>
page
,
@Param
(
"ew"
)
Wrapper
<
ApiServiceApplyDto
>
query
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiAuth.java
View file @
da3c8b94
...
@@ -97,6 +97,15 @@ public class ApiAuth extends BaseObject implements Serializable {
...
@@ -97,6 +97,15 @@ public class ApiAuth extends BaseObject implements Serializable {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
validEndTime
;
private
Date
validEndTime
;
/**
* 有效截止时间
*/
@ApiModelProperty
(
"有效截止时间"
)
@TableField
(
"valid_expr_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
validExprDate
;
/**
/**
* 处理状态:0 未处理, 1 已处理
* 处理状态:0 未处理, 1 已处理
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterface.java
View file @
da3c8b94
...
@@ -38,12 +38,6 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -38,12 +38,6 @@ public class ApiInterface extends BaseObject implements Serializable {
@JsonIgnore
@JsonIgnore
private
String
apiName
;
private
String
apiName
;
/**
* api描述
*/
@TableField
(
"api_desc"
)
private
String
apiDesc
;
/**
/**
* api请求协议:http,https
* api请求协议:http,https
*/
*/
...
@@ -51,41 +45,29 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -51,41 +45,29 @@ public class ApiInterface extends BaseObject implements Serializable {
private
String
apiProtocl
;
private
String
apiProtocl
;
/**
/**
*
api类型:1 数据银行制作大数据表 2 数据银行制作数据包,3,数据银行制作自定义API 4 API实时接入 5 DMP标签查询 6.DMP大数据表查询 7 DMP自定义'
*
接入类型:对应字典表key
*/
*/
@TableField
(
"api_type"
)
@TableField
(
"api_type"
)
private
String
apiType
;
private
String
apiType
;
/**
* 请求地址
*/
@TableField
(
"api_path"
)
private
String
apiPath
;
/**
/**
* 目标url
* 目标url
*/
*/
@TableField
(
"target_url"
)
@TableField
(
"target_url"
)
private
String
targetUrl
;
private
String
targetUrl
;
/**
/**
* 接入类型:对应字典表key
* 请求方式:GET POST
*/
@TableField
(
"join_type"
)
private
String
joinType
;
/**
* 测试实例
*/
*/
@TableField
(
"test_example"
)
@TableField
(
"req_type"
)
private
String
testExample
;
private
String
reqType
;
/**
/**
* '输出类型:flow 流形式输出, json格式输出',
* '输出类型:flow 流形式输出, json格式输出',
*/
*/
@TableField
(
"output_type"
)
@TableField
(
"output_type"
)
private
String
outputType
;
private
String
outputType
;
/**
* 是否分页:0 false ,1 true
*/
@TableField
(
"page"
)
private
Boolean
page
;
/**
/**
* 状态(1-草稿 2-发布 3-过时 4-冻结 5-失效)
* 状态(1-草稿 2-发布 3-过时 4-冻结 5-失效)
...
@@ -113,8 +95,8 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -113,8 +95,8 @@ public class ApiInterface extends BaseObject implements Serializable {
/**
/**
* 限流类型:DAY 按天,MONTH 按月, YEAR 按年
* 限流类型:DAY 按天,MONTH 按月, YEAR 按年
*/
*/
@TableField
(
"
req
_type"
)
@TableField
(
"
limit
_type"
)
private
String
req
Type
;
private
String
limit
Type
;
/**
/**
* 限制次数
* 限制次数
...
@@ -127,17 +109,19 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -127,17 +109,19 @@ public class ApiInterface extends BaseObject implements Serializable {
@TableField
(
"timeout"
)
@TableField
(
"timeout"
)
private
String
timeout
;
private
String
timeout
;
/**
* 是否测试数据:0 否,1 是
*/
@TableField
(
"is_test"
)
private
Integer
isTest
;
/**
/**
* 文件夹id
* 文件夹id
*/
*/
@TableField
(
"file_id"
)
@TableField
(
"file_id"
)
private
Long
fileId
;
private
Long
fileId
;
/**
* 是否发送到数据银行
*/
@TableField
(
"is_send_bank"
)
private
Boolean
isSendBank
;
/*-----------------------------------保存数据库时忽略字段--------------------------------*/
/*-----------------------------------保存数据库时忽略字段--------------------------------*/
/**
/**
* 请求总次数
* 请求总次数
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceCustom.java
View file @
da3c8b94
...
@@ -93,5 +93,19 @@ public class ApiInterfaceCustom extends BaseObject implements Serializable {
...
@@ -93,5 +93,19 @@ public class ApiInterfaceCustom extends BaseObject implements Serializable {
*/
*/
@TableField
(
"inbox_param"
)
@TableField
(
"inbox_param"
)
private
String
inboxParam
;
private
String
inboxParam
;
/**
* 最大行数
*/
@TableField
(
"max_row"
)
private
Long
maxRow
;
/**
* 每页返回行数
*/
@TableField
(
"page_row"
)
private
Long
pageRow
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
View file @
da3c8b94
...
@@ -31,17 +31,11 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
...
@@ -31,17 +31,11 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
private
Long
projectId
;
private
Long
projectId
;
/**
/**
* 文件来源:
1 DMP 2 数据银行
* 文件来源:
,1 API制做,2 组织创建
*/
*/
@TableField
(
"file_source"
)
@TableField
(
"file_source"
)
private
String
fileSource
;
private
String
fileSource
;
///**
//* 文件类型:1 文件夹 ,2 文件
//*/
//@TableField("file_type")
//private String fileType;
/**
/**
* 文件名称
* 文件名称
*/
*/
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiOrg.java
View file @
da3c8b94
...
@@ -55,6 +55,13 @@ public class ApiOrg extends BaseObject implements Serializable {
...
@@ -55,6 +55,13 @@ public class ApiOrg extends BaseObject implements Serializable {
*/
*/
@TableField
(
"linkman"
)
@TableField
(
"linkman"
)
private
String
linkman
;
private
String
linkman
;
/**
* 组织目录文件夹
*/
@TableField
(
"org_folder_id"
)
private
Long
orgFolderId
;
/**
/**
* 组织类型 OUT 外部组织 IN 内部组织
* 组织类型 OUT 外部组织 IN 内部组织
*/
*/
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/dto/ApiServiceApplyDto.java
0 → 100644
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.dto
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiServiceApplyDto
* @DATE: 2021-1-28/11:10
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
(
value
=
"服务发布/授权应用类"
)
public
class
ApiServiceApplyDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"apiId"
)
private
String
apiId
;
@ApiModelProperty
(
value
=
"api名称"
)
private
String
apiName
;
@ApiModelProperty
(
value
=
"api类型"
)
private
String
apiType
;
@ApiModelProperty
(
value
=
"返回类型"
)
private
String
outputType
;
@ApiModelProperty
(
value
=
"请求方式"
)
private
String
reqType
;
@ApiModelProperty
(
value
=
"最大数据量"
)
private
Long
maxRow
;
@ApiModelProperty
(
value
=
"每页行数"
)
private
Long
pageRow
;
@ApiModelProperty
(
value
=
"描述"
)
private
String
apiFunction
;
@ApiModelProperty
(
value
=
"是否发布到数据银行,0 false 1 true"
)
private
Boolean
isSendBank
;
@ApiModelProperty
(
value
=
"授权码"
)
private
String
authCode
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/enity/GatewayRequest.java
View file @
da3c8b94
...
@@ -49,6 +49,10 @@ public class GatewayRequest implements Serializable {
...
@@ -49,6 +49,10 @@ public class GatewayRequest implements Serializable {
@ApiModelProperty
(
value
=
"请求参数,JSON格式"
)
@ApiModelProperty
(
value
=
"请求参数,JSON格式"
)
private
String
params
;
private
String
params
;
@ApiModelProperty
(
value
=
"是否测试请求"
)
private
Boolean
isTest
;
@ApiModelProperty
(
value
=
"扩展属性"
)
@ApiModelProperty
(
value
=
"扩展属性"
)
private
final
Map
<
String
,
Attribute
>
extAttributes
=
new
HashMap
<
String
,
Attribute
>();
private
final
Map
<
String
,
Attribute
>
extAttributes
=
new
HashMap
<
String
,
Attribute
>();
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/AuthUserApiReq.java
View file @
da3c8b94
...
@@ -38,9 +38,9 @@ public class AuthUserApiReq implements Serializable {
...
@@ -38,9 +38,9 @@ public class AuthUserApiReq implements Serializable {
@NotNull
(
message
=
"组织编码不能为空"
)
@NotNull
(
message
=
"组织编码不能为空"
)
private
String
orgCode
;
private
String
orgCode
;
/*
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH 授权",required = true)
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH 授权"
,
required
=
true
)
@NotNull
(
message
=
"授权类型不能为空"
)
@NotNull
(
message
=
"授权类型不能为空"
)
private String authType;
*/
private
String
authType
;
@ApiModelProperty
(
value
=
"授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效"
,
required
=
true
)
@ApiModelProperty
(
value
=
"授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效"
,
required
=
true
)
@NotNull
(
message
=
"授权方式不能为空"
)
@NotNull
(
message
=
"授权方式不能为空"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/ServiceAuthReq.java
0 → 100644
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
auth
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req.auth
* @PROJECT_NAME: jz-dm-parent
* @NAME: ServiceAuthReq
* @DATE: 2021-1-28/11:50
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
(
value
=
"服务授权请求体"
)
public
class
ServiceAuthReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"文件夹id"
,
required
=
false
)
private
Long
folderId
;
@ApiModelProperty
(
value
=
"api名称"
,
required
=
false
)
private
String
apiName
;
@ApiModelProperty
(
value
=
"apiId"
,
required
=
false
)
private
String
apiId
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/folder/CreateFolderReq.java
0 → 100644
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
folder
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: CreateFolderReq
* @DATE: 2021-1-27/18:12
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Data
@ApiModel
(
"创建文件请求体"
)
public
class
CreateFolderReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"项目id"
,
required
=
false
)
private
Long
projectId
;
@ApiModelProperty
(
value
=
"父类文件夹id ,创建同级不传"
,
required
=
false
)
private
Long
parentId
;
@ApiModelProperty
(
value
=
"文件夹名称"
,
required
=
true
)
@NotBlank
(
message
=
"文件夹名称不能为空!"
)
private
String
fileName
;
@ApiModelProperty
(
value
=
"文件来源:,1 API制做,2 组织创建"
,
required
=
true
)
@NotBlank
(
message
=
"文件来源不能为空"
)
private
String
fileSource
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
private
String
createUser
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeBigDataApiReq.java
deleted
100644 → 0
View file @
deb9ea2e
package
com
.
jz
.
dm
.
models
.
req
.
make
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: MakeBigDataApiReq
* @DATE: 2020-12-26/13:08
* @DAY_NAME_SHORT: 周六
* @Description:
**/
@Data
@ApiModel
(
"Api制作大数据查询/标签查询请求体"
)
public
class
MakeBigDataApiReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"id--更新时id不能为空"
,
required
=
false
)
private
Long
id
;
/* @ApiModelProperty(value = "数据类型:api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6标签查询 8 查询hive数据源 9自定义",required = true)
@NotNull(message = "apiType不能为空")
private String apiType;*/
@ApiModelProperty
(
value
=
"apiKey"
,
required
=
false
)
@NotNull
(
message
=
"apiKey不能为空"
)
public
String
apiKey
;
//@ApiModelProperty(value = "是否分页",required = false)
//public Boolean page;
@ApiModelProperty
(
value
=
"数据源Id"
,
required
=
true
)
@NotNull
(
message
=
"数据源Id不能为空"
)
private
String
esDataSource
;
@ApiModelProperty
(
value
=
"源库名称"
,
required
=
true
)
@NotNull
(
message
=
"源库名称不能为空"
)
private
String
esDataBase
;
@ApiModelProperty
(
value
=
"源表名称"
,
required
=
true
)
@NotNull
(
message
=
"源表名称不能为空"
)
private
String
esTable
;
@ApiModelProperty
(
value
=
"处理类型"
,
required
=
true
)
@NotNull
(
message
=
"处理类型不能为空"
)
private
String
handleType
;
@ApiModelProperty
(
value
=
"请求参数"
,
required
=
true
)
@NotNull
(
message
=
"请求参数不能为空"
)
private
String
requestParam
;
@ApiModelProperty
(
value
=
"返回参数"
,
required
=
true
)
@NotNull
(
message
=
"返回参数不能为空"
)
private
String
responseParam
;
@ApiModelProperty
(
value
=
"段列表"
,
required
=
true
)
@NotNull
(
message
=
"字段列表不能为空"
)
private
String
tableFields
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
public
String
createUser
;
//@ApiModelProperty(value = "项目id",required = true)
//@NotNull(message="项目id不能为空")
//public Long projectId;
//@ApiModelProperty(value = "父类文件id,一级文件夹传入0",required = false)
//public Long parentId;
//
//@ApiModelProperty(value = "文件id",required = false)
//public Long fileId;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/organizationManage/OrganizationManageAddReq.java
View file @
da3c8b94
...
@@ -20,14 +20,10 @@ import java.io.Serializable;
...
@@ -20,14 +20,10 @@ import java.io.Serializable;
@ApiModel
(
"组织管理详情请求体"
)
@ApiModel
(
"组织管理详情请求体"
)
public
class
OrganizationManageAddReq
implements
Serializable
{
public
class
OrganizationManageAddReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
/*
@ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织",required = true)
@NotNull(message = "组织类型不能为空!")
@NotNull(message = "组织类型不能为空!")
private String orgType;
private String orgType;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
private
String
orgName
;
@ApiModelProperty(value = "组织描述",required = false)
@ApiModelProperty(value = "组织描述",required = false)
private String orgDesc;
private String orgDesc;
...
@@ -35,21 +31,31 @@ public class OrganizationManageAddReq implements Serializable {
...
@@ -35,21 +31,31 @@ public class OrganizationManageAddReq implements Serializable {
private String orgCnName;
private String orgCnName;
@ApiModelProperty(value = "组织邮箱",required = false)
@ApiModelProperty(value = "组织邮箱",required = false)
private
String
orgMail
;
private String orgMail;*/
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织电话"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织电话"
,
required
=
true
)
@NotNull
(
message
=
"组织电话不能为空"
)
private
String
orgPhone
;
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"组织联系人"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织联系人"
,
required
=
true
)
@NotNull
(
message
=
"组织联系人不能为空"
)
private
String
linkman
;
private
String
linkman
;
@ApiModelProperty
(
value
=
"文件夹Id"
,
required
=
true
)
@NotNull
(
message
=
"文件夹Id不能为空"
)
private
Long
orgFolderId
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
private
String
remark
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
private
String
createUser
;
private
String
createUser
;
@ApiModelProperty
(
value
=
"
创建
用户"
,
required
=
false
)
@ApiModelProperty
(
value
=
"
更新
用户"
,
required
=
false
)
private
String
updateUser
;
private
String
updateUser
;
@ApiModelProperty
(
value
=
"id ----更新时必传"
,
required
=
false
)
@ApiModelProperty
(
value
=
"id ----更新时必传"
,
required
=
false
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/organizationManage/OrganizationManageListQueryReq.java
View file @
da3c8b94
...
@@ -29,4 +29,9 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri
...
@@ -29,4 +29,9 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri
@ApiModelProperty
(
value
=
"组织联系人"
)
@ApiModelProperty
(
value
=
"组织联系人"
)
private
String
linkman
;
private
String
linkman
;
@ApiModelProperty
(
value
=
"组织文件夹"
)
private
Long
fileId
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
make
/ApiInterfaceReq.java
→
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
producer
/ApiInterfaceReq.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
make
;
package
com
.
jz
.
dm
.
models
.
req
.
producer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -20,33 +20,39 @@ import java.io.Serializable;
...
@@ -20,33 +20,39 @@ import java.io.Serializable;
@ApiModel
(
value
=
"api基本信息"
)
@ApiModel
(
value
=
"api基本信息"
)
public
class
ApiInterfaceReq
implements
Serializable
{
public
class
ApiInterfaceReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"传输方式:http https"
,
required
=
true
)
@ApiModelProperty
(
value
=
"传输方式:http https"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
transMode
;
public
String
apiProtocl
;
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
signType
;
public
String
signType
;
@ApiModelProperty
(
value
=
"
接入
类型:对应字典表key"
,
required
=
true
)
@ApiModelProperty
(
value
=
"
Api
类型:对应字典表key"
,
required
=
true
)
@NotNull
(
message
=
"
接入
类型不能为空"
)
@NotNull
(
message
=
"
Api
类型不能为空"
)
public
String
join
Type
;
public
String
api
Type
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
true
)
@ApiModelProperty
(
value
=
"apiKey"
,
required
=
true
)
@NotNull
(
message
=
"目标地址不能为空"
)
@NotNull
(
message
=
"apiKey不能为空"
)
public
String
apiKey
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
false
)
public
String
targetUrl
;
public
String
targetUrl
;
@ApiModelProperty
(
value
=
"请求方式:GET POST"
,
required
=
true
)
@NotNull
(
message
=
"请求方式不能为空"
)
public
String
reqType
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@NotNull
(
message
=
"超时时间不能为空"
)
@NotNull
(
message
=
"超时时间不能为空"
)
public
String
timeout
;
public
String
timeout
;
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月, YEAR 按年"
,
required
=
true
)
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月, YEAR 按年"
,
required
=
true
)
@NotNull
(
message
=
"限流类型不能为空"
)
@NotNull
(
message
=
"限流类型不能为空"
)
public
String
reqType
;
public
String
limitType
;
@ApiModelProperty
(
value
=
"API名称"
,
required
=
false
)
public
String
apiName
;
@ApiModelProperty
(
value
=
"限制次数"
,
required
=
false
)
@ApiModelProperty
(
value
=
"限制次数"
,
required
=
false
)
public
Long
reqFrequency
;
public
Long
reqFrequency
;
...
@@ -54,16 +60,40 @@ public class ApiInterfaceReq implements Serializable {
...
@@ -54,16 +60,40 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
public
String
apiFunction
;
public
String
apiFunction
;
@ApiModelProperty
(
value
=
"父类文件id,一级文件夹传入0"
,
required
=
false
)
@ApiModelProperty
(
value
=
"文件夹Id"
,
required
=
true
)
public
Long
parentId
;
@NotNull
(
message
=
"文件夹Id不能为空"
)
@ApiModelProperty
(
value
=
"文件id"
,
required
=
false
)
public
Long
fileId
;
public
Long
fileId
;
@ApiModelProperty
(
value
=
"项目
id
"
,
required
=
true
)
@ApiModelProperty
(
value
=
"项目
编号
"
,
required
=
true
)
@NotNull
(
message
=
"项目
id
不能为空"
)
@NotNull
(
message
=
"项目
编号
不能为空"
)
public
Long
projectId
;
public
Long
projectId
;
@ApiModelProperty
(
value
=
"输出类型:JSON 文件流形式"
,
required
=
false
)
public
String
outType
;
@ApiModelProperty
(
value
=
"最大行数:"
,
required
=
false
)
public
Long
maxRow
;
@ApiModelProperty
(
value
=
"每页返回数据数:"
,
required
=
false
)
public
Long
pageRow
;
@ApiModelProperty
(
value
=
"请求参数:"
,
required
=
false
)
public
String
requestParam
;
@ApiModelProperty
(
value
=
"响应参数:"
,
required
=
false
)
public
String
responseParam
;
@ApiModelProperty
(
value
=
"参数字段:"
,
required
=
false
)
public
String
tableFields
;
@ApiModelProperty
(
value
=
"数据源id"
,
required
=
false
)
public
String
esDataSource
;
@ApiModelProperty
(
value
=
"数据库名称"
,
required
=
false
)
public
String
esDataBase
;
@ApiModelProperty
(
value
=
"数据表名称"
,
required
=
false
)
public
String
esTable
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
public
String
status
;
public
String
status
;
...
@@ -72,10 +102,12 @@ public class ApiInterfaceReq implements Serializable {
...
@@ -72,10 +102,12 @@ public class ApiInterfaceReq implements Serializable {
public
Long
id
;
public
Long
id
;
@ApiModelProperty
(
value
=
"创建用户"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"创建用户"
,
hidden
=
true
)
public
String
createUser
;
public
String
createUser
;
@ApiModelProperty
(
value
=
"创建用户"
,
hidden
=
true
)
public
String
updateUser
;
@ApiModelProperty
(
value
=
"api类型:1.数据银行制作大数据表 "
+
/*
@ApiModelProperty(value = "api类型:1.数据银行制作大数据表 " +
"2 数据银行制作数据包,3,数据银行制作自定义API " +
"2 数据银行制作数据包,3,数据银行制作自定义API " +
"4 API实时接入 6 标签查询 9自定义",hidden = true)
"4 API实时接入 6 标签查询 9自定义",hidden = true)
public
String
apiType
;
public String apiType;
*/
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/producer/MakeBigDataApiReq.java
0 → 100644
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
producer
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: MakeBigDataApiReq
* @DATE: 2020-12-26/13:08
* @DAY_NAME_SHORT: 周六
* @Description:
**/
@Data
@ApiModel
(
"Api制作大数据查询/标签查询请求体"
)
public
class
MakeBigDataApiReq
implements
Serializable
{
// @ApiModelProperty(value = "id--更新时id不能为空",required = false)
// private Long id;
//
///* @ApiModelProperty(value = "数据类型:api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6标签查询 8 查询hive数据源 9自定义",required = true)
// @NotNull(message = "apiType不能为空")
// private String apiType;*/
//
// @ApiModelProperty(value = "apiKey",required = false)
// @NotNull(message = "apiKey不能为空")
// public String apiKey;
//
// //@ApiModelProperty(value = "是否分页",required = false)
// //public Boolean page;
//
// @ApiModelProperty(value = "数据源Id",required = true)
// @NotNull(message = "数据源Id不能为空")
// private String esDataSource;
//
// @ApiModelProperty(value = "源库名称",required = true)
// @NotNull(message = "源库名称不能为空")
// private String esDataBase;
//
// @ApiModelProperty(value = "源表名称",required = true)
// @NotNull(message = "源表名称不能为空")
// private String esTable;
//
// @ApiModelProperty(value = "处理类型",required = true)
// @NotNull(message = "处理类型不能为空")
// private String handleType;
//
//
// @ApiModelProperty(value = "请求参数",required = true)
// @NotNull(message = "请求参数不能为空")
// private String requestParam;
//
// @ApiModelProperty(value = "返回参数",required = true)
// @NotNull(message = "返回参数不能为空")
// private String responseParam;
//
// @ApiModelProperty(value = "段列表",required = true)
// @NotNull(message = "字段列表不能为空")
// private String tableFields;
//
// @ApiModelProperty(value = "创建用户",required = false)
// public String createUser;
//
// //@ApiModelProperty(value = "项目id",required = true)
// //@NotNull(message="项目id不能为空")
// //public Long projectId;
//
// //@ApiModelProperty(value = "父类文件id,一级文件夹传入0",required = false)
// //public Long parentId;
// //
// //@ApiModelProperty(value = "文件id",required = false)
// //public Long fileId;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
make
/MakeDataBankApiReq.java
→
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
producer
/MakeDataBankApiReq.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
make
;
package
com
.
jz
.
dm
.
models
.
req
.
producer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -40,9 +40,13 @@ public class MakeDataBankApiReq implements Serializable {
...
@@ -40,9 +40,13 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull
(
message
=
"输出类型不能为空"
)
@NotNull
(
message
=
"输出类型不能为空"
)
public
String
outputType
;
public
String
outputType
;
@ApiModelProperty
(
value
=
"是否分页:"
,
required
=
true
)
@ApiModelProperty
(
value
=
"请求方式:GET POST"
,
required
=
true
)
@NotNull
(
message
=
"请求方式不能为空"
)
public
String
reqMethod
;
/*@ApiModelProperty(value = "是否分页:",required = true)
@NotNull(message = "是否分页不能为空")
@NotNull(message = "是否分页不能为空")
public
Boolean
page
;
public Boolean page;
*/
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月"
,
required
=
true
)
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月"
,
required
=
true
)
@NotNull
(
message
=
"限流类型不能为空"
)
@NotNull
(
message
=
"限流类型不能为空"
)
...
@@ -52,9 +56,15 @@ public class MakeDataBankApiReq implements Serializable {
...
@@ -52,9 +56,15 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull
(
message
=
"目标地址不能为空"
)
@NotNull
(
message
=
"目标地址不能为空"
)
public
String
targetUrl
;
public
String
targetUrl
;
@ApiModelProperty
(
value
=
"文件id"
,
required
=
true
)
@ApiModelProperty
(
value
=
"当前页"
,
required
=
true
)
@NotNull
(
message
=
"文件id不能为空"
)
public
Integer
pageNum
;
public
Long
fileId
;
@ApiModelProperty
(
value
=
"当前页显示条数"
,
required
=
true
)
public
Integer
pageSize
;
//@ApiModelProperty(value = "文件id",required = true)
//@NotNull(message = "文件id不能为空")
//public Long fileId;
@ApiModelProperty
(
value
=
"签名"
,
required
=
true
)
@ApiModelProperty
(
value
=
"签名"
,
required
=
true
)
@NotNull
(
message
=
"签名不能为空"
)
@NotNull
(
message
=
"签名不能为空"
)
...
@@ -69,7 +79,8 @@ public class MakeDataBankApiReq implements Serializable {
...
@@ -69,7 +79,8 @@ public class MakeDataBankApiReq implements Serializable {
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"数据包下载路径"
,
required
=
false
)
public
String
fileLocation
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
false
)
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
false
)
public
String
timeout
;
public
String
timeout
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
make
/MakeRealCustomApiReq.java
→
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
producer
/MakeRealCustomApiReq.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
make
;
package
com
.
jz
.
dm
.
models
.
req
.
producer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.Data
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/producer/ServiceIssueReq.java
0 → 100644
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
producer
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req.producer
* @PROJECT_NAME: jz-dm-parent
* @NAME: ServiceIssueReq
* @DATE: 2021-1-28/11:00
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
(
value
=
"服务发布请求体"
)
public
class
ServiceIssueReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"文件夹id"
,
required
=
false
)
private
Long
fileId
;
@ApiModelProperty
(
value
=
"api名称"
,
required
=
false
)
private
String
apiName
;
@ApiModelProperty
(
value
=
"apiId"
,
required
=
false
)
private
String
apiId
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
make
/SourceConfigReq.java
→
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/
producer
/SourceConfigReq.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
models
.
req
.
make
;
package
com
.
jz
.
dm
.
models
.
req
.
producer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/ApiInterfaceService.java
View file @
da3c8b94
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
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.ApiInterfaceCustom
;
import
com.jz.dm.models.req.api.ApiInterfaceDetailReq
;
import
com.jz.dm.models.req.api.ApiInterfaceDetailReq
;
import
com.jz.dm.models.req.api.ApiInterfaceInfoListReq
;
import
com.jz.dm.models.req.api.ApiInterfaceInfoListReq
;
...
@@ -41,11 +42,19 @@ public interface ApiInterfaceService {
...
@@ -41,11 +42,19 @@ public interface ApiInterfaceService {
ApiInterface
getReqTargetInfo
(
String
apiKey
);
ApiInterface
getReqTargetInfo
(
String
apiKey
);
/**
/**
*
查询API列表信息
*
API---(已调用列表)列表查询
* @param req
* @param req
* @return
* @return
*/
*/
IPage
<
ApiInterface
>
listApiInterface
(
ApiInterfaceInfoListReq
req
);
IPage
<
ApiInterface
>
listCallApiInterface
(
ApiInterfaceInfoListReq
req
);
/**
* API---(未调用列表)列表查询
* @param req
* @return
*/
IPage
<
ApiInterface
>
listUnCallApiInterface
(
ApiInterfaceInfoListReq
req
);
/**
/**
* 查询API详情
* 查询API详情
...
@@ -77,12 +86,24 @@ public interface ApiInterfaceService {
...
@@ -77,12 +86,24 @@ public interface ApiInterfaceService {
Result
dmpDeleteAuth
(
String
type
,
String
apiKey
);
Result
dmpDeleteAuth
(
String
type
,
String
apiKey
);
/**
/**
*
api测试接口
*
获取api自定义信息
* @param api
Key
* @param api
InterfaceId
* @return
* @return
*/
*/
Result
apiTestInterface
(
String
apiKey
);
ApiInterfaceCustom
getApiCustomInfo
(
Long
apiInterfaceId
);
/**
* 更新数据银行调用状态
* @param apiKey
* @return
*/
Result
updateApiSendStatus
(
String
apiKey
);
/**
* 获取已发送到数据API列表
* @param pageNum
* @param pageSize
* @return
*/
Result
getSendDataBankList
(
String
pageNum
,
String
pageSize
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/AuthService.java
View file @
da3c8b94
...
@@ -84,4 +84,11 @@ public interface AuthService {
...
@@ -84,4 +84,11 @@ public interface AuthService {
* @return
* @return
*/
*/
Result
getAuthNameList
(
String
key
);
Result
getAuthNameList
(
String
key
);
/**
* 获取服务授权列表
* @param req
* @return
*/
Result
getServiceAuthList
(
ServiceAuthReq
req
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/OrganizationManageService.java
View file @
da3c8b94
...
@@ -38,12 +38,6 @@ public interface OrganizationManageService {
...
@@ -38,12 +38,6 @@ public interface OrganizationManageService {
*/
*/
Result
add
(
OrganizationManageAddReq
req
);
Result
add
(
OrganizationManageAddReq
req
);
/**
* 更新组织信息
* @param req
* @return
*/
//Result update(OrganizationManageUpdateReq req);
/**
/**
* 根据id注销组织
* 根据id注销组织
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/ProducerService.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
service
;
package
com
.
jz
.
dm
.
service
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.models.req.make.*
;
import
com.jz.dm.models.req.folder.CreateFolderReq
;
import
com.jz.dm.models.req.producer.ApiInterfaceReq
;
import
com.jz.dm.models.req.producer.ServiceIssueReq
;
/**
/**
* @author ZC
* @author ZC
...
@@ -13,40 +15,29 @@ import com.jz.dm.models.req.make.*;
...
@@ -13,40 +15,29 @@ import com.jz.dm.models.req.make.*;
* @Description:
* @Description:
**/
**/
public
interface
ProducerService
{
public
interface
ProducerService
{
/**
* 制作自定义APi
* @param req
* @return
*/
Result
addCustomApi
(
ApiInterfaceReq
req
);
/**
/**
* Api制作(实时接入)
* Api制作(实时接入)
* @param req
* @param req
* @return
* @return
*/
*/
Result
addRealCustomApi
(
MakeRealCustomApiReq
req
);
// Result addRealCustomApi(MakeRealCustomApiReq req);
/**
* Api制作(大数据查询/标签查询)
* @param req
* @return
*/
Result
addBigDataMakeApi
(
MakeBigDataApiReq
req
);
/**
/**
* 获取数据源配置
* 获取数据源配置
* @param req
* @param req
* @return
* @return
*/
*/
Result
getSourceConfig
(
SourceConfigReq
req
);
//
Result getSourceConfig(SourceConfigReq req);
/**
/**
* 获取数据库列表
* 获取数据库列表
* @param id
* @param id
* @return
* @return
*/
*/
Result
getSourceWarehouseList
(
Long
id
);
//
Result getSourceWarehouseList(Long id);
/**
/**
* 获取某个索引下的type
* 获取某个索引下的type
...
@@ -54,7 +45,7 @@ public interface ProducerService {
...
@@ -54,7 +45,7 @@ public interface ProducerService {
* @param id
* @param id
* @return
* @return
*/
*/
Result
getIndicesTypes
(
String
indices
,
Long
id
);
//
Result getIndicesTypes(String indices, Long id);
/**
/**
* 获取某个索引 type的fields
* 获取某个索引 type的fields
...
@@ -63,23 +54,28 @@ public interface ProducerService {
...
@@ -63,23 +54,28 @@ public interface ProducerService {
* @param id
* @param id
* @return
* @return
*/
*/
Result
getIndicesTypesFields
(
String
indices
,
String
type
,
Long
id
);
//
Result getIndicesTypesFields(String indices, String type, Long id);
/**
* 数据银行制作API/数据包
* @param req
* @return
*/
// Result addDataBankApiInfo(MakeDataBankApiReq req);
/**
/**
* 保存修改的api信息
* 保存修改的api信息
* @param req
* @param req
* @return
* @return
*/
*/
Result
saveUpdateAPiInfo
(
ApiInterfaceReq
req
);
//
Result saveUpdateAPiInfo(ApiInterfaceReq req);
/**
/**
*
数据银行制作API/数据包
*
Api制作(数据查询/标签查询)
* @param req
* @param req
* @return
* @return
*/
*/
Result
addDataBankApiInfo
(
MakeDataBankApiReq
req
);
Result
addBigDataMakeApi
(
ApiInterfaceReq
req
);
/**
/**
* 保存 API基本信息
* 保存 API基本信息
* @param req
* @param req
...
@@ -96,15 +92,36 @@ public interface ProducerService {
...
@@ -96,15 +92,36 @@ public interface ProducerService {
/**
/**
* 创建文件夹
* 创建文件夹
* @param projectId
* @param req
* @param parentId
* @return
* @param currentUser
*/
Result
createProjectFolder
(
CreateFolderReq
req
);
/**
* 获取生成后的APIId
* @return
* @return
*/
*/
Result
createProjectFolder
(
Long
projectId
,
Long
parentId
,
String
currentUser
);
Result
getCustomApiId
();
/**
* 获取服务发布列表
* @param req
* @return
*/
Result
getServiceIssueList
(
ServiceIssueReq
req
);
/**
* 服务发布/取消操作
* @param id
* @param optStatus
* @return
*/
Result
optionApiIssueStatus
(
Long
id
,
Boolean
optStatus
);
//Result saveObjOnRedis();
//Result getObjOnRedis();
Result
saveObjOnRedis
();
Result
getObjOnRedis
();
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ApiInterfaceServiceImpl.java
View file @
da3c8b94
...
@@ -11,15 +11,16 @@ import com.jz.dm.common.enums.GeneralStatusTypeEnum;
...
@@ -11,15 +11,16 @@ import com.jz.dm.common.enums.GeneralStatusTypeEnum;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.mapper.ApiAuthMapper
;
import
com.jz.dm.mapper.ApiAuthMapper
;
import
com.jz.dm.mapper.ApiInterfaceCustomMapper
;
import
com.jz.dm.mapper.ApiInterfaceMapper
;
import
com.jz.dm.mapper.ApiInterfaceMapper
;
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.ApiInterfaceCustom
;
import
com.jz.dm.models.domian.ApiInterfaceCustom
;
import
com.jz.dm.models.dto.ApiCallDataDto
;
import
com.jz.dm.models.req.api.ApiInterfaceDetailReq
;
import
com.jz.dm.models.req.api.ApiInterfaceDetailReq
;
import
com.jz.dm.models.req.api.ApiInterfaceInfoListReq
;
import
com.jz.dm.models.req.api.ApiInterfaceInfoListReq
;
import
com.jz.dm.service.ApiInterfaceService
;
import
com.jz.dm.service.ApiInterfaceService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -49,26 +50,25 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
...
@@ -49,26 +50,25 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
@Resource
@Resource
private
ApiInterfaceMapper
apiInterfaceMapper
;
private
ApiInterfaceMapper
apiInterfaceMapper
;
@Resource
@Resource
private
ApiInterfaceCustomMapper
apiInterfaceCustomMapper
;
@Resource
private
ApiAuthMapper
apiAuthMapper
;
private
ApiAuthMapper
apiAuthMapper
;
@Autowired
@Autowired
private
HttpsUtils
httpsUtils
;
private
HttpsUtils
httpsUtils
;
/**
/**
*
获取API列表信息
*
API---(调用列表)列表查询
*
*
* @param req
* @param req
* @return
* @return
*/
*/
@Override
@Override
public
IPage
<
ApiInterface
>
listApiInterface
(
ApiInterfaceInfoListReq
req
)
{
public
IPage
<
ApiInterface
>
list
Call
ApiInterface
(
ApiInterfaceInfoListReq
req
)
{
IPage
<
ApiInterface
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
IPage
<
ApiInterface
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
ApiInterface
>
query
=
new
QueryWrapper
<>();
QueryWrapper
<
ApiInterface
>
query
=
new
QueryWrapper
<>();
/*if (StringUtils.isNotBlank(req.getApiKey())){
if
(
StringUtils
.
isNotBlank
(
req
.
getApiKey
())){
query.eq("api_key",req.getApiKey());
query
.
eq
(
"ai.api_key"
,
req
.
getApiKey
());
}*/
}
/* if (StringUtils.isNotBlank(req.getStatus())){
query.eq("status",req.getStatus());
}*/
query
.
eq
(
"ai.is_deleted"
,
0
);
query
.
eq
(
"ai.is_deleted"
,
0
);
query
.
orderByDesc
(
"ai.create_date"
);
query
.
orderByDesc
(
"ai.create_date"
);
query
.
groupBy
(
"ai.create_date"
);
query
.
groupBy
(
"ai.create_date"
);
...
@@ -76,6 +76,24 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
...
@@ -76,6 +76,24 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
}
}
/**
* API---(未调用列表)列表查询
* @param req
* @return
*/
@Override
public
IPage
<
ApiInterface
>
listUnCallApiInterface
(
ApiInterfaceInfoListReq
req
)
{
IPage
<
ApiInterface
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
ApiInterface
>
query
=
new
QueryWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
req
.
getApiKey
())){
query
.
eq
(
"ai.api_key"
,
req
.
getApiKey
());
}
query
.
isNull
(
"ar.api_key"
);
query
.
eq
(
"ai.is_deleted"
,
0
);
query
.
orderByDesc
(
"ai.create_date"
);
return
apiInterfaceMapper
.
listCallApiInterfaceInfo
(
page
,
query
);
}
/**
/**
* 获取API详情信息
* 获取API详情信息
*
*
...
@@ -206,28 +224,20 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
...
@@ -206,28 +224,20 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
return
authCall
+
authDateCall
;
return
authCall
+
authDateCall
;
}
}
/**
/**
* api测试接口
* 获取api自定义信息
*
* @param apiInterfaceId
* @param apiKey
* @return
* @return
*/
*/
@Override
@Override
public
Result
apiTestInterface
(
String
apiKey
)
{
public
ApiInterfaceCustom
getApiCustomInfo
(
Long
apiInterfaceId
)
{
ApiInterfaceCustom
apiInterfaceCustom
=
apiInterfaceMapper
.
getTestData
(
apiKey
);
QueryWrapper
<
ApiInterfaceCustom
>
queryWra
=
new
QueryWrapper
<>();
if
(
null
==
apiInterfaceCustom
)
{
queryWra
.
eq
(
"api_interface_id"
,
apiInterfaceId
);
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_FOUND
);
queryWra
.
eq
(
"is_deleted"
,
0
);
}
return
apiInterfaceCustomMapper
.
selectOne
(
queryWra
)
;
/* if (StringUtils.isNotBlank(apiInterfaceCustom.getApiExample())){
httpsUtils.doGet(testUrl,"");
}else {
}*/
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
);
}
}
/**
/**
* 获取用户授权信息
* 获取用户授权信息
*
*
...
@@ -275,4 +285,39 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
...
@@ -275,4 +285,39 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
query
.
eq
(
"is_deleted"
,
0
);
query
.
eq
(
"is_deleted"
,
0
);
return
apiInterfaceMapper
.
selectOne
(
query
);
return
apiInterfaceMapper
.
selectOne
(
query
);
}
}
/**
* 更新APi是否发送到数据银行状态
* @param apiKey
* @return
*/
@Override
public
Result
updateApiSendStatus
(
String
apiKey
)
{
QueryWrapper
<
ApiInterface
>
queryWra
=
new
QueryWrapper
<>();
queryWra
.
eq
(
"api_key"
,
apiKey
);
queryWra
.
eq
(
"is_deleted"
,
0
);
ApiInterface
apiInterface
=
apiInterfaceMapper
.
selectOne
(
queryWra
);
if
(
null
==
apiInterface
){
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_FOUND
);
}
UpdateWrapper
<
ApiInterface
>
updateWra
=
new
UpdateWrapper
<>();
updateWra
.
set
(
"is_send_bank"
,
0
);
if
(
apiInterfaceMapper
.
update
(
null
,
updateWra
)
>
0
){
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
}
return
Result
.
of_error
(
ResultMsg
.
UPDATE_FAIL
);
}
@Override
public
Result
getSendDataBankList
(
String
pageNum
,
String
pageSize
)
{
Integer
pageN
=
Integer
.
valueOf
(
pageNum
);
Integer
pageS
=
Integer
.
valueOf
(
pageSize
);
IPage
<
ApiInterface
>
page
=
new
Page
<>(
pageN
,
pageS
);
QueryWrapper
<
ApiInterface
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"is_send_bank"
,
1
);
query
.
eq
(
"status"
,
ApiStatusEnum
.
ISSUE
.
name
());
query
.
eq
(
"is_deleted"
,
0
);
return
Result
.
of_success
(
apiInterfaceMapper
.
selectPage
(
page
,
query
));
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
View file @
da3c8b94
...
@@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
...
@@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.enums.auth.AuthTypeEnum
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.enums.GeneralStatusTypeEnum
;
import
com.jz.dm.common.enums.GeneralStatusTypeEnum
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.
enums.org.OrgStatusEnum
;
import
com.jz.dm.common.
util.DateUtil
;
import
com.jz.dm.common.util.RandomUtil
;
import
com.jz.dm.common.util.RandomUtil
;
import
com.jz.dm.mapper.ApiAuthMapper
;
import
com.jz.dm.mapper.ApiAuthMapper
;
import
com.jz.dm.mapper.ApiInterfaceMapper
;
import
com.jz.dm.mapper.ApiInterfaceMapper
;
...
@@ -19,6 +17,7 @@ import com.jz.dm.mapper.ApiOrgMapper;
...
@@ -19,6 +17,7 @@ import com.jz.dm.mapper.ApiOrgMapper;
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
;
import
com.jz.dm.models.dto.ApiServiceApplyDto
;
import
com.jz.dm.models.dto.AuthInfoDto
;
import
com.jz.dm.models.dto.AuthInfoDto
;
import
com.jz.dm.models.req.auth.*
;
import
com.jz.dm.models.req.auth.*
;
import
com.jz.dm.models.resp.AuthUserResponse
;
import
com.jz.dm.models.resp.AuthUserResponse
;
...
@@ -34,6 +33,7 @@ import javax.annotation.Resource;
...
@@ -34,6 +33,7 @@ import javax.annotation.Resource;
import
java.util.Date
;
import
java.util.Date
;
import
static
com
.
jz
.
dm
.
common
.
enums
.
auth
.
AuthModeEnum
.
fromTypeModeName
;
import
static
com
.
jz
.
dm
.
common
.
enums
.
auth
.
AuthModeEnum
.
fromTypeModeName
;
import
static
com
.
jz
.
dm
.
common
.
enums
.
auth
.
AuthTypeEnum
.
fromAuthTypeName
;
/**
/**
* @author ZC
* @author ZC
...
@@ -89,6 +89,29 @@ public class AuthServiceImpl implements AuthService {
...
@@ -89,6 +89,29 @@ public class AuthServiceImpl implements AuthService {
return
Result
.
of_success
(
apiAuthMapper
.
selectAuthDetail
(
req
));
return
Result
.
of_success
(
apiAuthMapper
.
selectAuthDetail
(
req
));
}
}
/**
* 获取服务授权列表
* @param req
* @return
*/
@Override
public
Result
getServiceAuthList
(
ServiceAuthReq
req
)
{
IPage
<
ApiServiceApplyDto
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
ApiServiceApplyDto
>
query
=
new
QueryWrapper
<>();
if
(
null
!=
req
.
getFolderId
()){
query
.
eq
(
"ai.file_id"
,
req
.
getFolderId
());
}
if
(
StringUtils
.
isNotBlank
(
req
.
getApiName
())){
query
.
eq
(
"ai.api_name"
,
req
.
getApiName
());
}
if
(
StringUtils
.
isNotBlank
(
req
.
getApiId
())){
query
.
eq
(
"ai.api_key"
,
req
.
getApiId
());
}
query
.
eq
(
"ai.is_deleted"
,
0
);
query
.
orderByDesc
(
"ai.create_time"
);
return
Result
.
of_success
(
apiInterfaceMapper
.
listApiAuthService
(
page
,
query
));
}
/**
/**
* 添加dmp认证信息
* 添加dmp认证信息
*
*
...
@@ -102,20 +125,23 @@ public class AuthServiceImpl implements AuthService {
...
@@ -102,20 +125,23 @@ public class AuthServiceImpl implements AuthService {
if
(
null
==
apiInterface
)
{
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
return
Result
.
of_error
(
"api授权信息不存在!"
);
}
}
if
(
ApiStatusEnum
.
DRAFT
.
name
().
equals
(
apiInterface
.
getStatus
())){
return
Result
.
of_error
(
"api未发布,无法授权"
);
}
if
(
ApiStatusEnum
.
EXPIRY
.
name
().
equals
(
apiInterface
.
getStatus
()))
{
if
(
ApiStatusEnum
.
EXPIRY
.
name
().
equals
(
apiInterface
.
getStatus
()))
{
return
Result
.
of_error
(
"api已下架,无法授权"
);
return
Result
.
of_error
(
"api已下架,无法授权"
);
}
}
ApiOrg
apiOrg
=
apiOrgMapper
.
selectOne
(
new
QueryWrapper
<
ApiOrg
>().
eq
(
"org_code"
,
req
.
getOrgCode
()));
ApiOrg
apiOrg
=
apiOrgMapper
.
selectOne
(
new
QueryWrapper
<
ApiOrg
>().
eq
(
"org_code"
,
req
.
getOrgCode
()));
if
(
null
==
apiOrg
||
OrgStatusEnum
.
CANCEL
.
name
().
equals
(
apiOrg
))
{
if
(
null
==
apiOrg
||
!
apiOrg
.
getStatus
(
))
{
return
Result
.
of_error
(
"组织信息不存在!"
);
return
Result
.
of_error
(
"组织信息不存在!"
);
}
}
//授权验证
//授权验证
//
if (StringUtils.isNotBlank(req.getAuthType())){
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
())){
// if (null == from
TypeName(req.getAuthType())){
if
(
null
==
fromAuth
TypeName
(
req
.
getAuthType
())){
//
return Result.of_error("授权类型不存在!");
return
Result
.
of_error
(
"授权类型不存在!"
);
//
}
}
//
}
}
//验证授权方式
//验证授权方式
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
()))
{
if
(
null
==
fromTypeModeName
(
req
.
getAuthMode
()))
{
if
(
null
==
fromTypeModeName
(
req
.
getAuthMode
()))
{
...
@@ -130,7 +156,7 @@ public class AuthServiceImpl implements AuthService {
...
@@ -130,7 +156,7 @@ public class AuthServiceImpl implements AuthService {
if
(
StringUtils
.
isBlank
(
apiOrg
.
getOrgCode
()))
{
if
(
StringUtils
.
isBlank
(
apiOrg
.
getOrgCode
()))
{
return
Result
.
of_error
(
"内部授权组织编码不能为空!!"
);
return
Result
.
of_error
(
"内部授权组织编码不能为空!!"
);
}
}
return
saveAuthInfo
(
apiInterface
,
apiOrg
,
req
,
Constants
.
AUTH_INT
);
return
saveAuthInfo
(
apiInterface
,
apiOrg
,
req
);
}
}
/**
/**
...
@@ -149,16 +175,19 @@ public class AuthServiceImpl implements AuthService {
...
@@ -149,16 +175,19 @@ public class AuthServiceImpl implements AuthService {
if
(
ApiStatusEnum
.
SOLDOUT
.
name
().
equals
(
apiInterface
.
getStatus
()))
{
if
(
ApiStatusEnum
.
SOLDOUT
.
name
().
equals
(
apiInterface
.
getStatus
()))
{
return
Result
.
of_error
(
"api已下架,无法授权"
);
return
Result
.
of_error
(
"api已下架,无法授权"
);
}
}
if
(
ApiStatusEnum
.
DRAFT
.
name
().
equals
(
apiInterface
.
getStatus
())){
return
Result
.
of_error
(
"api未发布,无法授权"
);
}
ApiOrg
apiOrg
=
apiOrgMapper
.
selectOne
(
new
QueryWrapper
<
ApiOrg
>().
eq
(
"org_code"
,
req
.
getOrgCode
()));
ApiOrg
apiOrg
=
apiOrgMapper
.
selectOne
(
new
QueryWrapper
<
ApiOrg
>().
eq
(
"org_code"
,
req
.
getOrgCode
()));
if
(
null
==
apiOrg
||
OrgStatusEnum
.
CANCEL
.
name
().
equals
(
apiOrg
))
{
if
(
null
==
apiOrg
||
!
apiOrg
.
getStatus
(
))
{
return
Result
.
of_error
(
"组织信息不存在!"
);
return
Result
.
of_error
(
"组织信息不存在!"
);
}
}
//授权验证
//授权验证
//
if (StringUtils.isNotBlank(req.getAuthType())){
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
())){
// if (null == from
TypeName(req.getAuthType())){
if
(
null
==
fromAuth
TypeName
(
req
.
getAuthType
())){
//
return Result.of_error("授权类型不存在!");
return
Result
.
of_error
(
"授权类型不存在!"
);
//
}
}
//
}
}
//验证授权方式
//验证授权方式
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
()))
{
if
(
null
==
fromTypeModeName
(
req
.
getAuthMode
()))
{
if
(
null
==
fromTypeModeName
(
req
.
getAuthMode
()))
{
...
@@ -181,7 +210,7 @@ public class AuthServiceImpl implements AuthService {
...
@@ -181,7 +210,7 @@ public class AuthServiceImpl implements AuthService {
if
(
StringUtils
.
isBlank
(
req
.
getUserId
()))
{
if
(
StringUtils
.
isBlank
(
req
.
getUserId
()))
{
return
Result
.
of_error
(
"外部授权用户Id不能为空"
);
return
Result
.
of_error
(
"外部授权用户Id不能为空"
);
}
}
return
saveAuthInfo
(
apiInterface
,
apiOrg
,
req
,
Constants
.
AUTH_OUT
);
return
saveAuthInfo
(
apiInterface
,
apiOrg
,
req
);
}
}
/**
/**
...
@@ -190,11 +219,10 @@ public class AuthServiceImpl implements AuthService {
...
@@ -190,11 +219,10 @@ public class AuthServiceImpl implements AuthService {
* @param apiInterface
* @param apiInterface
* @param apiOrg
* @param apiOrg
* @param req
* @param req
* @param orgType
* @return
* @return
*/
*/
private
Result
saveAuthInfo
(
ApiInterface
apiInterface
,
ApiOrg
apiOrg
,
private
Result
saveAuthInfo
(
ApiInterface
apiInterface
,
ApiOrg
apiOrg
,
AuthUserApiReq
req
,
String
orgType
)
{
AuthUserApiReq
req
)
{
AuthUserResponse
response
=
new
AuthUserResponse
();
AuthUserResponse
response
=
new
AuthUserResponse
();
ApiAuth
apiAuth
=
new
ApiAuth
();
ApiAuth
apiAuth
=
new
ApiAuth
();
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
...
@@ -202,21 +230,11 @@ public class AuthServiceImpl implements AuthService {
...
@@ -202,21 +230,11 @@ public class AuthServiceImpl implements AuthService {
apiAuth
.
setApiOrgId
(
apiOrg
.
getId
());
apiAuth
.
setApiOrgId
(
apiOrg
.
getId
());
apiAuth
.
setReqType
(
apiInterface
.
getReqType
());
apiAuth
.
setReqType
(
apiInterface
.
getReqType
());
apiAuth
.
setReqFrequency
(
apiInterface
.
getReqFrequency
());
apiAuth
.
setReqFrequency
(
apiInterface
.
getReqFrequency
());
if
(
Constants
.
AUTH_INT
.
equals
(
orgType
))
{
//内部授权
if
(!
AuthModeEnum
.
RECORD_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
())){
apiAuth
.
setAuthType
(
AuthTypeEnum
.
DMP_AUTH
.
name
());
apiAuth
.
setValidExprDate
(
DateUtil
.
getAssignYearDate
(
99
));
//过期时间
}
else
{
apiAuth
.
setAuthType
(
AuthTypeEnum
.
DATA_BANK_AUTH
.
name
());
}
}
//商城只有外部授权
//商城只有外部授权
String
authCode
=
""
;
String
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
""
);
//内部组织
if
(
StringUtils
.
isNotBlank
(
orgType
)
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
orgType
))
{
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
//外部组织
}
else
if
(
StringUtils
.
isNotBlank
(
orgType
)
&&
Constants
.
AUTH_OUT
.
equalsIgnoreCase
(
orgType
))
{
authCode
=
getAuthCode
(
""
,
req
.
getUserId
(),
Constants
.
AUTH_OUT
);
}
//生成盐值
//生成盐值
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setAuthCode
(
authCode
);
//授权码
apiAuth
.
setAuthCode
(
authCode
);
//授权码
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/OrganizationManageImpl.java
View file @
da3c8b94
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
da3c8b94
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/java/com/jz/dm/service/request/ApiQueryService.java
View file @
da3c8b94
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/java/com/jz/dm/service/request/ApiQueryTestService.java
0 → 100644
View file @
da3c8b94
package
com
.
jz
.
dm
.
service
.
request
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.dm.common.enums.GatewayResultCode
;
import
com.jz.dm.common.enums.apiInterface.ApiInfoOutTypeEnum
;
import
com.jz.dm.common.exception.GatewayException
;
import
com.jz.dm.common.util.OpenApiRequest
;
import
com.jz.dm.common.util.OpenApiResponse
;
import
com.jz.dm.gateway.OpenApiService
;
import
com.jz.dm.models.domian.ApiInterface
;
import
com.jz.dm.service.ApiInterfaceService
;
import
com.jz.dm.web.annotation.AccessLimit
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Map
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.request
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiQueryTestService
* @DATE: 2021-1-25/10:13
* @DAY_NAME_SHORT: 周一
* @Description:
**/
@Service
(
"apiQueryTestService"
)
@Slf4j
public
class
ApiQueryTestService
extends
ApiParamVerify
implements
OpenApiService
{
@Override
public
String
getOpenApiMethod
()
{
return
"test"
;
}
@Override
public
String
getOpenApiVersion
()
{
return
"v1.0.0"
;
}
@Autowired
private
ApiQueryService
apiQueryService
;
@Resource
private
ApiInterfaceService
apiInterfaceService
;
@Autowired
private
RedisUtils
redisUtils
;
/**
* API测试实现
* @param request
* @param response
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@AccessLimit
(
sec
=
1
,
limit
=
1000
)
public
void
doService
(
OpenApiRequest
request
,
OpenApiResponse
response
)
{
JSONObject
parameter
=
JSONObject
.
parseObject
(
request
.
getOpenApiParams
());
ApiInterface
apiInterface
=
apiInterfaceService
.
getApiInfo
(
request
.
getApiKey
());
verifyApiInterface
(
apiInterface
);
String
reqParams
=
parameter
.
getString
(
"reqParams"
);
JSONObject
jsonParams
=
null
;
Map
paramMap
=
null
;
if
(
StringUtils
.
isNotBlank
(
reqParams
))
{
jsonParams
=
JSONObject
.
parseObject
(
reqParams
);
paramMap
=
JSONObject
.
parseObject
(
jsonParams
.
getString
(
"request_fileds"
),
Map
.
class
);
jsonParams
.
put
(
"is_test"
,
true
);
}
//取出缓存数据
// String redisReqParam = redisUtils.get(request.getApiKey());
String
redisReqParam
=
null
;
if
(
StringUtils
.
isNotBlank
(
redisReqParam
))
{
//redis中存在
//解析出API制作成功时的参数配置
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
redisReqParam
);
String
targetUrl
=
jsonObject
.
getString
(
"targetUrl"
);
String
outputType
=
jsonObject
.
getString
(
"outputType"
);
if
(
StringUtils
.
isBlank
(
outputType
))
{
outputType
=
ApiInfoOutTypeEnum
.
JSON
.
name
();
}
if
(
StringUtils
.
isBlank
(
targetUrl
))
{
throw
new
GatewayException
(
GatewayResultCode
.
REQUEST_PARAM_EMPTY
);
}
apiQueryService
.
dataTableSelect
(
outputType
,
targetUrl
,
paramMap
,
jsonParams
,
apiInterface
,
response
);
}
else
{
//不存在查询数据库
apiQueryService
.
dataTableSelect
(
apiInterface
.
getOutputType
(),
apiInterface
.
getTargetUrl
(),
paramMap
,
jsonParams
,
apiInterface
,
response
);
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/web/aspect/SystemLogAspect.java
View file @
da3c8b94
...
@@ -69,7 +69,6 @@ public class SystemLogAspect {
...
@@ -69,7 +69,6 @@ public class SystemLogAspect {
}
}
@Around
(
"aroundAspect()"
)
@Around
(
"aroundAspect()"
)
public
void
doAround
(
ProceedingJoinPoint
joinPoint
)
{
public
void
doAround
(
ProceedingJoinPoint
joinPoint
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
...
@@ -81,8 +80,9 @@ public class SystemLogAspect {
...
@@ -81,8 +80,9 @@ public class SystemLogAspect {
params
+=
JsonUtils
.
objectToJson
(
joinPoint
.
getArgs
()[
i
])
+
";"
;
params
+=
JsonUtils
.
objectToJson
(
joinPoint
.
getArgs
()[
i
])
+
";"
;
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
params
)){
if
(
StringUtils
.
isNotBlank
(
params
))
{
params
=
params
.
substring
(
0
,
params
.
length
()-
1
).
split
(
";"
)[
0
];;
params
=
params
.
substring
(
0
,
params
.
length
()
-
1
).
split
(
";"
)[
0
];
;
}
}
//获取请求路径
//获取请求路径
String
url
=
UrlUtil
.
getServerUrl
(
request
);
String
url
=
UrlUtil
.
getServerUrl
(
request
);
...
@@ -95,33 +95,37 @@ public class SystemLogAspect {
...
@@ -95,33 +95,37 @@ public class SystemLogAspect {
String
paramsList
=
jsonObject
.
getString
(
"openApiParams"
);
String
paramsList
=
jsonObject
.
getString
(
"openApiParams"
);
com
.
alibaba
.
fastjson
.
JSONObject
jsonParamsList
=
com
.
alibaba
.
fastjson
.
JSONObject
.
parseObject
(
paramsList
);
com
.
alibaba
.
fastjson
.
JSONObject
jsonParamsList
=
com
.
alibaba
.
fastjson
.
JSONObject
.
parseObject
(
paramsList
);
ApiReqLog
reqLog
=
new
ApiReqLog
();
ApiReqLog
reqLog
=
new
ApiReqLog
();
JSONObject
jsonResult
=
null
;
JSONObject
jsonResult
=
null
;
try
{
Boolean
isTest
=
jsonParamsList
.
getBoolean
(
"isTest"
);
reqLog
.
setRequestIp
(
ip
);
//不保存测试数据
reqLog
.
setApiKey
(
jsonObject
.
getString
(
"apiKey"
));
if
(!
isTest
)
{
reqLog
.
setRequestParams
(
params
);
try
{
reqLog
.
setResponseParams
(
""
);
//响应参数
reqLog
.
setRequestIp
(
ip
);
reqLog
.
setRequestUrl
(
url
);
reqLog
.
setApiKey
(
jsonObject
.
getString
(
"apiKey"
));
reqLog
.
setRequestMethod
(
contextPath
);
reqLog
.
setRequestParams
(
params
);
reqLog
.
setEncryMode
(
jsonObject
.
getString
(
"signType"
));
//加密方式:MD5,RSA
reqLog
.
setResponseParams
(
""
);
//响应参数
reqLog
.
setEncryMode
(
"MD5"
);
//加密方式暂时写死MD5
reqLog
.
setRequestUrl
(
url
);
reqLog
.
setTransMode
(
request
.
getMethod
());
//传输方式 GET POST
reqLog
.
setRequestMethod
(
contextPath
);
reqLog
.
setRequestToken
(
jsonParamsList
.
getString
(
"authCode"
));
reqLog
.
setEncryMode
(
jsonObject
.
getString
(
"signType"
));
//加密方式:MD5,RSA
reqLog
.
setRequestStartTime
(
new
Date
());
//reqLog.setEncryMode("MD5"); //加密方式暂时写死MD5
reqLog
.
setRemark
(
getServiceMethodDescription
(
joinPoint
));
reqLog
.
setTransMode
(
request
.
getMethod
());
//传输方式 GET POST
log
.
info
(
"请求参数:"
,
reqLog
);
reqLog
.
setRequestToken
(
jsonParamsList
.
getString
(
"authCode"
));
if
(
null
!=
reqLog
)
{
reqLog
.
setRequestStartTime
(
new
Date
());
apiReqLogMapper
.
insert
(
reqLog
);
reqLog
.
setRemark
(
getServiceMethodDescription
(
joinPoint
));
log
.
info
(
"请求参数:"
,
reqLog
);
if
(
null
!=
reqLog
)
{
apiReqLogMapper
.
insert
(
reqLog
);
}
Object
result
=
joinPoint
.
proceed
(
joinPoint
.
getArgs
());
jsonResult
=
JSONObject
.
fromObject
(
result
);
log
.
info
(
"around响应结果为{}"
,
jsonResult
);
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
GatewayException
ex
)
{
log
.
info
(
"切面处理保存异常信息:{}"
,
ex
.
getMessage
());
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
}
Object
result
=
joinPoint
.
proceed
(
joinPoint
.
getArgs
());
jsonResult
=
JSONObject
.
fromObject
(
result
);
log
.
info
(
"around响应结果为{}"
,
jsonResult
);
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
GatewayException
ex
)
{
log
.
info
(
"切面处理保存异常信息:{}"
,
ex
.
getMessage
());
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
Throwable
throwable
){
throwable
.
printStackTrace
();
}
}
}
}
/*@Before("beforeAspect()")
/*@Before("beforeAspect()")
...
@@ -204,7 +208,7 @@ public class SystemLogAspect {
...
@@ -204,7 +208,7 @@ public class SystemLogAspect {
// log.error("异常信息{}", e.getMessage());
// log.error("异常信息{}", e.getMessage());
// }
// }
// }
// }
/**
/**
* 获取注解中对方法的描述信息 用于service层注解
* 获取注解中对方法的描述信息 用于service层注解
...
...
jz-dm-apigateway/src/main/resources/application-test.yml
View file @
da3c8b94
...
@@ -77,9 +77,16 @@ dmp:
...
@@ -77,9 +77,16 @@ dmp:
ignoreRedis
:
true
ignoreRedis
:
true
openapi
:
openapi
:
timeout
:
timeout
:
default
:
5
000
default
:
10
000
max
:
5
000
max
:
10
000
#logback日志配置
logging
:
config
:
classpath:logback-dev.xml
level
:
com
:
zhl
:
springbootlogback
:
off
#流处理配置
#流处理配置
windows
:
#文件流输出地址设置
windows
:
#文件流输出地址设置
name
:
stream
name
:
stream
...
@@ -95,17 +102,17 @@ sentinel: #sentinel每秒中最大的请求个数
...
@@ -95,17 +102,17 @@ sentinel: #sentinel每秒中最大的请求个数
data
:
data
:
bank
:
bank
:
balanceUrl
:
http://192.168.1.139:8081
#余额信息url #扣款信通知url
balanceUrl
:
http://192.168.1.139:8081
#余额信息url #扣款信通知url
select
:
#大数据查询请求链接
jsonUrl
:
http://192.168.1.140:8082/api/data/query/json
flowUrl
:
http://192.168.1.140:8082/api/data/query/streaming
#token: #dataBank 制作验签
# dataBank: dataBank123
token
:
#dataBank 制作验签
dataBank
:
dataBank123
#logback日志配置
logging
:
config
:
classpath:logback-dev.xml
level
:
com
:
zhl
:
springbootlogback
:
off
jz-dm-apigateway/src/main/resources/mapper/ApiInterfaceMapper.xml
View file @
da3c8b94
...
@@ -11,18 +11,21 @@
...
@@ -11,18 +11,21 @@
<select
id=
"listApiInterfaceInfo"
resultType=
"com.jz.dm.models.domian.ApiInterface"
>
<select
id=
"listApiInterfaceInfo"
resultType=
"com.jz.dm.models.domian.ApiInterface"
>
SELECT ai.*,
SELECT ai.*,
/* ai.id AS id,
ai.api_key AS apiKey,
ai.join_type AS joinType,
ai.create_user AS createUser,*/
COUNT(ar.id) AS callStat,
COUNT(ar.id) AS callStat,
SUM(ar.request_consuming) AS requestTimeStat
SUM(ar.request_consuming) AS requestTimeStat
FROM t_api_interface AS ai
FROM t_api_interface AS ai
LEFT JOIN t_api_req_log AS ar ON ai.api_key =ar.api_key
JOIN t_api_req_log AS ar ON ai.api_key =ar.api_key AND ar.is_deleted =0
AND ar.is_deleted =0
AND DATE_FORMAT(CURDATE(), '%Y%m') = DATE_FORMAT(ar.create_date, '%Y%m')
AND DATE_FORMAT(CURDATE(), '%Y%m') = DATE_FORMAT(ar.create_date, '%Y%m')
${ew.customSqlSegment}
${ew.customSqlSegment}
</select>
</select>
<select
id=
"listCallApiInterfaceInfo"
resultType=
"com.jz.dm.models.domian.ApiInterface"
>
SELECT
ai.*
FROM t_api_interface AS ai
LEFT JOIN t_api_req_log AS ar ON ai.api_key = ar.api_key AND ar.is_deleted =0
${ew.customSqlSegment}
</select>
<select
id=
"selectDetail"
resultType=
"com.jz.dm.models.domian.ApiInterface"
>
<select
id=
"selectDetail"
resultType=
"com.jz.dm.models.domian.ApiInterface"
>
SELECT ai.*,
SELECT ai.*,
aic.request_param AS requestParam,
aic.request_param AS requestParam,
...
@@ -40,5 +43,35 @@
...
@@ -40,5 +43,35 @@
AND ai.api_key =#{apiKey}
AND ai.api_key =#{apiKey}
</select>
</select>
<select
id=
"listApiIssueService"
resultType=
"com.jz.dm.models.dto.ApiServiceApplyDto"
>
SELECT ai.api_key AS apiId,
ai.api_name AS apiName,
ai.api_type AS apiType,
ai.output_type AS outputType,
ai.req_type AS reqType,
ai.api_function AS apiFunction,
aic.max_row AS maxRow,
aic.page_row AS pageRow,
aic.is_send_bank AS isSendBank
FROM t_api_interface AS ai JOIN t_api_interface_custom AS aic
ON ai.id =aic.api_interface_id AND aic.is_deleted =0
${ew.customSqlSegment}
</select>
<select
id=
"listApiAuthService"
resultType=
"com.jz.dm.models.dto.ApiServiceApplyDto"
>
SELECT ai.api_key AS apiId,
ai.api_name AS apiName,
ai.api_type AS apiType,
ai.output_type AS outputType,
ai.req_type AS reqType,
ai.api_function AS apiFunction,
aic.max_row AS maxRow,
aic.page_row AS pageRow,
au.auth_code AS authCode
FROM t_api_interface AS ai
JOIN t_api_interface_custom AS aic ON ai.id =aic.api_interface_id AND aic.is_deleted =0
JOIN t_api_auth AS au ON au.api_interface_id = ai.id AND aic.is_deleted =0
${ew.customSqlSegment}
</select>
</mapper>
</mapper>
\ No newline at end of file
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/api/ApiReqTest.java
View file @
da3c8b94
...
@@ -27,15 +27,14 @@ public class ApiReqTest extends SpringTestCase {
...
@@ -27,15 +27,14 @@ public class ApiReqTest extends SpringTestCase {
public
void
TestGatewayReq
()
{
public
void
TestGatewayReq
()
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"apiKey"
,
"
sE862E97j7Yzo049
"
);
jsonObject
.
put
(
"apiKey"
,
"
8trDpp4WRl92850o
"
);
jsonObject
.
put
(
"method"
,
"query"
);
jsonObject
.
put
(
"method"
,
"query"
);
jsonObject
.
put
(
"signType"
,
"MD5"
);
jsonObject
.
put
(
"signType"
,
"MD5"
);
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
jsonObject
.
put
(
"timestamp"
,
String
.
valueOf
(
time
));
jsonObject
.
put
(
"timestamp"
,
String
.
valueOf
(
time
));
JSONObject
params
=
new
JSONObject
();
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"authCode"
,
"202100000001118191258T718d78591J"
);
params
.
put
(
"authCode"
,
"2021000000011118104856J1QR4u9Afm"
);
params
.
put
(
"selectType"
,
"10006"
);
params
.
put
(
"reqParams"
,
new
JSONObject
());
params
.
put
(
"reqParams"
,
new
JSONObject
());
jsonObject
.
put
(
"params"
,
params
);
jsonObject
.
put
(
"params"
,
params
);
try
{
try
{
...
@@ -44,7 +43,7 @@ public class ApiReqTest extends SpringTestCase {
...
@@ -44,7 +43,7 @@ public class ApiReqTest extends SpringTestCase {
String
signType
=
jsonObject
.
getString
(
"signType"
);
String
signType
=
jsonObject
.
getString
(
"signType"
);
String
signature
=
MapUtil
.
getSignValue
(
apiKey
,
method
,
signType
);
String
signature
=
MapUtil
.
getSignValue
(
apiKey
,
method
,
signType
);
String
salt
=
Md5
.
encrypt
(
signature
,
"
33tgT3g
2"
);
String
salt
=
Md5
.
encrypt
(
signature
,
"
7330lQl
2"
);
jsonObject
.
put
(
"sign"
,
salt
);
jsonObject
.
put
(
"sign"
,
salt
);
String
response
=
httpsUtils
.
submitPost
(
url
,
jsonObject
.
toString
());
String
response
=
httpsUtils
.
submitPost
(
url
,
jsonObject
.
toString
());
System
.
out
.
println
(
response
);
System
.
out
.
println
(
response
);
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/org/TestOrganizationManage.java
View file @
da3c8b94
...
@@ -2,10 +2,8 @@ package com.jz.dm.gateway.org;
...
@@ -2,10 +2,8 @@ package com.jz.dm.gateway.org;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.common.enums.auth.AuthTypeEnum
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.models.domian.ApiOrg
;
import
com.jz.dm.models.domian.ApiOrg
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageAddReq
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageListQueryReq
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageListQueryReq
;
import
com.jz.dm.service.OrganizationManageService
;
import
com.jz.dm.service.OrganizationManageService
;
...
@@ -53,7 +51,7 @@ public class TestOrganizationManage extends SpringTestCase {
...
@@ -53,7 +51,7 @@ public class TestOrganizationManage extends SpringTestCase {
*/
*/
@Test
@Test
public
void
addOrg
(){
public
void
addOrg
(){
OrganizationManageAddReq
req
=
new
OrganizationManageAddReq
();
/*
OrganizationManageAddReq req = new OrganizationManageAddReq();
req.setOrgName("数据银行");
req.setOrgName("数据银行");
req.setOrgDesc("粗这次");
req.setOrgDesc("粗这次");
req.setOrgCnName("databank");
req.setOrgCnName("databank");
...
@@ -62,7 +60,7 @@ public class TestOrganizationManage extends SpringTestCase {
...
@@ -62,7 +60,7 @@ public class TestOrganizationManage extends SpringTestCase {
req.setOrgPhone("18279668524");
req.setOrgPhone("18279668524");
req.setOrgType(AuthTypeEnum.DATA_BANK_AUTH.name());
req.setOrgType(AuthTypeEnum.DATA_BANK_AUTH.name());
Result result = organizationManageService.add(req);
Result result = organizationManageService.add(req);
System
.
out
.
println
(
result
.
getMessage
());
System.out.println(result.getMessage());
*/
}
}
/**
/**
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestRedisUserSave.java
View file @
da3c8b94
...
@@ -2,7 +2,7 @@ package com.jz.dm.gateway.orther;
...
@@ -2,7 +2,7 @@ package com.jz.dm.gateway.orther;
import
com.jz.dm.common.util.RedisSerializableUtil
;
import
com.jz.dm.common.util.RedisSerializableUtil
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.models.req.
make
.MakeDataBankApiReq
;
import
com.jz.dm.models.req.
producer
.MakeDataBankApiReq
;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -43,10 +43,10 @@ public class TestRedisUserSave extends SpringTestCase {
...
@@ -43,10 +43,10 @@ public class TestRedisUserSave extends SpringTestCase {
bankApiReq
.
setSignType
(
"MD5"
);
bankApiReq
.
setSignType
(
"MD5"
);
bankApiReq
.
setJoinType
(
"10004"
);
bankApiReq
.
setJoinType
(
"10004"
);
bankApiReq
.
setOutputType
(
"JSON"
);
bankApiReq
.
setOutputType
(
"JSON"
);
bankApiReq
.
setPage
(
false
);
//
bankApiReq.setPage(false);
bankApiReq
.
setReqType
(
"DAY"
);
bankApiReq
.
setReqType
(
"DAY"
);
bankApiReq
.
setTargetUrl
(
"www.baidu.com"
);
bankApiReq
.
setTargetUrl
(
"www.baidu.com"
);
bankApiReq
.
setFileId
(
1L
);
//
bankApiReq.setFileId(1L);
bankApiReq
.
setSign
(
"F2A8E3CFE528D6AE5C5B075046653F3E"
);
bankApiReq
.
setSign
(
"F2A8E3CFE528D6AE5C5B075046653F3E"
);
bankApiReq
.
setReqFrequency
(
0L
);
bankApiReq
.
setReqFrequency
(
0L
);
bankApiReq
.
setApiDesc
(
"4444"
);
bankApiReq
.
setApiDesc
(
"4444"
);
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestStr.java
View file @
da3c8b94
package
com
.
jz
.
dm
.
gateway
.
orther
;
package
com
.
jz
.
dm
.
gateway
.
orther
;
import
com.alibaba.fastjson.JSONObject
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* @ClassName:
* @ClassName:
* @Author: Carl
* @Author: Carl
...
@@ -8,10 +14,89 @@ package com.jz.dm.gateway.orther;
...
@@ -8,10 +14,89 @@ package com.jz.dm.gateway.orther;
*/
*/
public
class
TestStr
{
public
class
TestStr
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
str
=
"/picture/logo/T6gxlv137nFA555z.jpg"
;
Calendar
cal
=
Calendar
.
getInstance
();
// String[] split = str.split("\\/");
/* int year =cal.get(Calendar.YEAR)+1;
System
.
out
.
println
(
str
.
substring
(
0
,
str
.
lastIndexOf
(
"/"
)
+
1
));
int month=cal.get(Calendar.MONTH)+1;
String
substring
=
str
.
substring
(
str
.
lastIndexOf
(
"."
));
cal.add(Calendar.MONTH, 0);*/
System
.
out
.
println
(
substring
);
//Date date = cal.getTime(); //结果
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
cal
.
set
(
Calendar
.
YEAR
,
cal
.
get
(
Calendar
.
YEAR
)+
2
);
Date
date
=
cal
.
getTime
();
System
.
out
.
println
(
sdf
.
format
(
date
));
//String stereo = "000101";
// Integer valueOf = Integer.valueOf(stereo);
// System.out.println(valueOf);
}
public
void
resolveParameter
(){
String
str
=
"[{\"name\":\"flelds1\",\"bindName\":\"flelds1\",\"type\":\"BIGINT\",\"sampleValue\":\"1\",\"defaultValue\":\"1\",\"required\":true,\"desc\":\"\"},{\"name\":\"flelds2\",\"bindName\":\"flelds2\",\"type\":\"BIGINT\",\"sampleValue\":\"1\",\"defaultValue\":\"1\",\"required\":true,\"desc\":\"\"}]"
;
String
str2
=
"[{\"name\":\"field1\",\"bindName\":\"field1\",\"type\":\"STRING\",\"sampleValue\":\"1\",\"desc\":\"\"},{\"name\":\"field2\",\"bindName\":\"field2\",\"type\":\"BIGINT\",\"sampleValue\":\"1\",\"desc\":\"\"},{\"name\":\"field3\",\"bindName\":\"field3\",\"type\":\"BIGINT\",\"sampleValue\":\"1\",\"desc\":\"\"},{\"name\":\"field4\",\"bindName\":\"field4\",\"type\":\"STRING\",\"sampleValue\":\"1\",\"desc\":\"\"}]"
;
List
<
Map
>
maps
=
JSONObject
.
parseArray
(
str2
,
Map
.
class
);
for
(
Map
map
:
maps
)
{
System
.
out
.
println
(
"map:"
+
map
);
}
}
/**
* 获取集合信息
*/
public
static
void
getList
()
{
List
<
String
>
list1
=
new
ArrayList
<
String
>();
list1
.
add
(
"1"
);
list1
.
add
(
"2"
);
list1
.
add
(
"3"
);
list1
.
add
(
"4"
);
list1
.
add
(
"5"
);
List
<
String
>
list2
=
new
ArrayList
<
String
>();
list2
.
add
(
"1"
);
list2
.
add
(
"2"
);
list2
.
add
(
"3"
);
list2
.
add
(
"4"
);
list2
.
add
(
"5"
);
list2
.
add
(
"7"
);
list2
.
add
(
"9"
);
// 交集
List
<
String
>
intersection
=
list1
.
stream
().
filter
(
item
->
list2
.
contains
(
item
)).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"---交集 intersection---"
);
intersection
.
parallelStream
().
forEach
(
System
.
out
::
println
);
// 差集 (list1 - list2)
List
<
String
>
reduce1
=
list1
.
stream
().
filter
(
item
->
!
list2
.
contains
(
item
)).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"---差集 reduce1 (list1 - list2)---"
);
reduce1
.
parallelStream
().
forEach
(
System
.
out
::
println
);
// 差集 (list2 - list1)
List
<
String
>
reduce2
=
list2
.
stream
().
filter
(
item
->
!
list1
.
contains
(
item
)).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"---差集 reduce2 (list2 - list1)---"
);
reduce2
.
parallelStream
().
forEach
(
System
.
out
::
println
);
//合拼差
reduce1
.
addAll
(
reduce2
);
System
.
out
.
println
(
"---合拼差 reduce1 (list2 -> list1)---"
);
reduce1
.
parallelStream
().
forEach
(
System
.
out
::
println
);
// 并集
List
<
String
>
listAll
=
list1
.
parallelStream
().
collect
(
Collectors
.
toList
());
List
<
String
>
listAll2
=
list2
.
parallelStream
().
collect
(
Collectors
.
toList
());
listAll
.
addAll
(
listAll2
);
System
.
out
.
println
(
"---并集 listAll---"
);
listAll
.
parallelStream
().
forEachOrdered
(
System
.
out
::
println
);
// 去重并集
List
<
String
>
listAllDistinct
=
listAll
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"---得到去重并集 listAllDistinct---"
);
listAllDistinct
.
parallelStream
().
forEachOrdered
(
System
.
out
::
println
);
System
.
out
.
println
(
"---原来的List1---"
);
list1
.
parallelStream
().
forEachOrdered
(
System
.
out
::
println
);
System
.
out
.
println
(
"---原来的List2---"
);
list2
.
parallelStream
().
forEachOrdered
(
System
.
out
::
println
);
}
}
}
}
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestStreamReq.java
View file @
da3c8b94
...
@@ -3,7 +3,7 @@ package com.jz.dm.gateway.orther;
...
@@ -3,7 +3,7 @@ package com.jz.dm.gateway.orther;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.gateway.SpringTestCase
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
static
com
.
jz
.
dm
.
common
.
util
.
stream
.
HttpDownload
.
d
ownload
;
import
static
com
.
jz
.
dm
.
common
.
util
.
stream
.
HttpDownload
.
getD
ownload
;
/**
/**
* @author ZC
* @author ZC
...
@@ -21,6 +21,6 @@ public class TestStreamReq extends SpringTestCase {
...
@@ -21,6 +21,6 @@ public class TestStreamReq extends SpringTestCase {
//@Test
//@Test
public
void
testStreamReq
()
{
public
void
testStreamReq
()
{
d
ownload
(
baseUrl
);
getD
ownload
(
baseUrl
);
}
}
}
}
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