Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-service
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
姚本章
jz-dmp-service
Commits
7413cc0f
Commit
7413cc0f
authored
Feb 25, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
83685b10
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
204 additions
and
215 deletions
+204
-215
GatewayApiConstant.java
src/main/java/com/jz/common/constant/GatewayApiConstant.java
+66
-30
DmpApiMangeController.java
...modules/controller/dataService/DmpApiMangeController.java
+3
-6
DmpApiServiceMangeController.java
.../controller/dataService/DmpApiServiceMangeController.java
+29
-9
ApiInterfaceReq.java
.../modules/controller/dataService/bean/ApiInterfaceReq.java
+67
-38
DmpApiMangeService.java
...n/java/com/jz/dmp/modules/service/DmpApiMangeService.java
+3
-1
DmpApiServiceMangeService.java
...com/jz/dmp/modules/service/DmpApiServiceMangeService.java
+10
-3
DmpApiMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
+2
-21
DmpApiServiceMangeServiceImpl.java
...p/modules/service/impl/DmpApiServiceMangeServiceImpl.java
+24
-107
No files found.
src/main/java/com/jz/common/constant/GatewayApiConstant.java
View file @
7413cc0f
package
com
.
jz
.
common
.
constant
;
package
com
.
jz
.
common
.
constant
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.dmp.modules.service.impl.DmpApiServiceMangeServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.Map
;
/**
/**
* @ClassName: GatewayApiConstant
* @ClassName: GatewayApiConstant
* @Description: 服务网关api地址
* @Description: 服务网关api地址
...
@@ -11,82 +20,109 @@ public class GatewayApiConstant {
...
@@ -11,82 +20,109 @@ public class GatewayApiConstant {
//列表分页查询url
//列表分页查询url
public
static
final
String
orgListPage
=
"/api/organization/listOrg"
;
public
static
final
String
orgListPage
=
"/api/organization/listOrg"
;
//删除组织url
//删除组织url
public
static
final
String
delOrg
=
"/api/organization/logoutOrg"
;
public
static
final
String
delOrg
=
"/api/organization/logoutOrg"
;
//新增组织url
//新增组织url
public
static
final
String
addOrg
=
"/api/organization/add"
;
public
static
final
String
addOrg
=
"/api/organization/add"
;
//编辑组织url
//编辑组织url
public
static
final
String
updateOrg
=
"/api/organization/update"
;
public
static
final
String
updateOrg
=
"/api/organization/update"
;
//根据组织id获取组织详情url
//根据组织id获取组织详情url
public
static
final
String
orgDetail
=
"/api/organization/getOrgDetail"
;
public
static
final
String
orgDetail
=
"/api/organization/getOrgDetail"
;
//授权给他人的API-列表分页查询url
//授权给他人的API-列表分页查询url
public
static
final
String
apiAuthListPage
=
"/api/auth/auth-list"
;
public
static
final
String
apiAuthListPage
=
"/api/auth/auth-list"
;
//取消授权url
//取消授权url
public
static
final
String
cancelApiAuth
=
"/api/auth/update-auth-info"
;
public
static
final
String
cancelApiAuth
=
"/api/auth/update-auth-info"
;
//发布的API-API列表分页查询url
//发布的API-API列表分页查询url
public
static
final
String
apiListPage
=
"/api/interface/listApiInterface"
;
public
static
final
String
apiListPage
=
"/api/interface/listApiInterface"
;
//删除APIurl
//删除APIurl
public
static
final
String
delApi
=
"/api/interface/delDMPApiInterface"
;
public
static
final
String
delApi
=
"/api/interface/delDMPApiInterface"
;
//根据apiid获取API详情url
//根据apiid获取API详情url
public
static
final
String
getApiInfo
=
"/api/interface/getApiInterfaceDetail"
;
public
static
final
String
getApiInfo
=
"/api/interface/getApiInterfaceDetail"
;
//授权给组织url
//授权给组织url
public
static
final
String
apiAuthToOrg
=
"/api/auth/dmp-auth-api"
;
public
static
final
String
apiAuthToOrg
=
"/api/auth/dmp-auth-api"
;
//测试url
//测试url
public
static
final
String
testApi
=
"/api/interface/apiTestApiInterface"
;
public
static
final
String
testApi
=
"/api/request/gateway"
;
//查看日志url
//查看日志url
public
static
final
String
checkApiLog
=
"/api/logging/listApiLog"
;
public
static
final
String
checkApiLog
=
"/api/logging/listApiLog"
;
//授权模糊查询组织信息url
//授权模糊查询组织信息url
public
static
final
String
authOrgList
=
"/api/auth/getAuthNameList"
;
public
static
final
String
authOrgList
=
"/api/auth/getAuthNameList"
;
//保存API(第三方)基本信息url
//保存API(第三方)基本信息url
public
static
final
String
addApiInfo
=
"/api/producer/addCustomApi"
;
public
static
final
String
addApiInfo
=
"/api/producer/addCustomApi"
;
//保存API(大数据查询/标签查询)url
//保存API(大数据查询/标签查询)url
public
static
final
String
addApiBigData
=
"/api/producer/makeBigDataApi"
;
public
static
final
String
addApiBigData
=
"/api/producer/addDataTableSelect"
;
//编辑API(第三方)基本信息url
//编辑API(第三方)基本信息url
public
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
public
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
//API计量调用次数和执行时长url
//API计量调用次数和执行时长url
public
static
final
String
countAPiCallStat
=
"/api/logging/countAPiCallStat"
;
public
static
final
String
countAPiCallStat
=
"/api/interface/countAPiCallStat"
;
//API计量--API未调用列表url
//API计量--API未调用列表url
public
static
final
String
notCalledList
=
"/api/interface/listUnCallApiInterface"
;
public
static
final
String
notCalledList
=
"/api/interface/listUnCallApi"
;
//API计量--API已调用列表url
public
static
final
String
listCallApi
=
"/api/interface/listCallApi"
;
//服务发布/服务取消url
//服务发布/服务取消url
public
static
final
String
apiPublishCancel
=
"/api/producer/optionApiIssueStatus"
;
public
static
final
String
apiPublishCancel
=
"/api/producer/optionApiIssueStatus"
;
//盐值重置url
//盐值重置url
public
static
final
String
saltReset
=
"/api/auth/reset-salt"
;
public
static
final
String
saltReset
=
"/api/auth/reset-salt"
;
//授权管理-api列表url
//授权管理-api列表url
public
static
final
String
authApiList
=
"/api/auth/getServiceAuthList"
;
public
static
final
String
authApiList
=
"/api/auth/getServiceAuthList"
;
//授权
//授权
public
static
final
String
authUserApi
=
"/api/auth/user-auth-api"
;
public
static
final
String
authUserApi
=
"/api/auth/user-auth-api"
;
//上传(发送给数据银行)
//上传(发送给数据银行)
public
static
final
String
serverUpload
=
"/api/producer/serverUpload"
;
public
static
final
String
serverUpload
=
"/api/producer/serverUpload"
;
//日志详情
//日志详情
public
static
final
String
logDetails
=
"/api/logging/getReqDetail"
;
public
static
final
String
logDetails
=
"/api/logging/getReqDetail"
;
//服务开发 api列表
//服务开发 api列表
public
static
final
String
listServerApplyApi
=
"/api/interface/listServerApplyApi"
;
public
static
final
String
listServerApplyApi
=
"/api/interface/listServerApplyApi"
;
//获取文件夹树
//获取文件夹树
public
static
final
String
folderTree
=
"/api/producer/getFileCatalog"
;
public
static
final
String
folderTree
=
"/api/producer/getFileCatalog"
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
GatewayApiConstant
.
class
);
/*
* post 请求获取数据
* */
public
static
JsonResult
postRequest2GetData
(
String
url
,
String
param
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
resultData
=
HttpClientUtils
.
post
(
url
,
param
);
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"failed!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/*
* get 请求获取数据
* */
public
static
JsonResult
getRequest2GetData
(
String
url
,
Map
params
)
{
JsonResult
result
=
new
JsonResult
();
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
}
}
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiMangeController.java
View file @
7413cc0f
...
@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
...
@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
/**
/**
* 数据服务Api管理--调用gateway 接口
* 数据服务Api管理--调用gateway 接口
...
@@ -178,14 +179,10 @@ public class DmpApiMangeController {
...
@@ -178,14 +179,10 @@ public class DmpApiMangeController {
*/
*/
@ApiOperation
(
value
=
"API测试"
,
notes
=
"API测试"
)
@ApiOperation
(
value
=
"API测试"
,
notes
=
"API测试"
)
@GetMapping
(
value
=
"/apiTestInfo"
)
@GetMapping
(
value
=
"/apiTestInfo"
)
@ApiImplicitParam
(
name
=
"apiKey"
,
value
=
"apiKey"
,
required
=
true
)
public
JsonResult
getApiTestInfo
(
@RequestBody
Map
<
String
,
Object
>
params
,
HttpServletRequest
httpRequest
)
{
public
JsonResult
getApiTestInfo
(
@RequestParam
String
apiKey
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
apiKey
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"apiKey不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
JsonResult
jsonResult
=
new
JsonResult
();
try
{
try
{
jsonResult
=
dmpApiMangeService
.
apiTestInfo
(
apiKey
);
jsonResult
=
dmpApiMangeService
.
apiTestInfo
(
params
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiServiceMangeController.java
View file @
7413cc0f
...
@@ -49,12 +49,12 @@ public class DmpApiServiceMangeController {
...
@@ -49,12 +49,12 @@ public class DmpApiServiceMangeController {
private
OfflineSynchService
offlineSynchService
;
private
OfflineSynchService
offlineSynchService
;
/**
/**
*
保存
API(第三方)基本信息
*
制作/编辑
API(第三方)基本信息
*
*
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
@ApiOperation
(
value
=
"
保存API(第三方)"
,
notes
=
"保存
API(第三方)"
)
@ApiOperation
(
value
=
"
制作/编辑API(第三方)"
,
notes
=
"保存/编辑
API(第三方)"
)
@PostMapping
(
value
=
"/saveApi"
)
@PostMapping
(
value
=
"/saveApi"
)
public
JsonResult
saveApiInfo
(
@RequestBody
@Validated
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
public
JsonResult
saveApiInfo
(
@RequestBody
@Validated
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
JsonResult
jsonResult
=
new
JsonResult
();
...
@@ -69,14 +69,14 @@ public class DmpApiServiceMangeController {
...
@@ -69,14 +69,14 @@ public class DmpApiServiceMangeController {
}
}
/**
/**
*
保存
API(大数据查询/标签查询)
*
制作/编辑
API(大数据查询/标签查询)
*
*
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
@ApiOperation
(
value
=
"
保存API(大数据查询/标签查询)"
,
notes
=
"保存
API(大数据查询/标签查询)"
)
@ApiOperation
(
value
=
"
制作/编辑API(大数据查询/标签查询)"
,
notes
=
"制作/编辑
API(大数据查询/标签查询)"
)
@PostMapping
(
value
=
"/saveApiBigData"
)
@PostMapping
(
value
=
"/saveApiBigData"
)
public
JsonResult
saveApiBigDataInfo
(
@RequestBody
@Validated
MakeBigDataApi
Req
req
,
HttpServletRequest
httpRequest
)
{
public
JsonResult
saveApiBigDataInfo
(
@RequestBody
@Validated
ApiInterface
Req
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
JsonResult
jsonResult
=
new
JsonResult
();
try
{
try
{
jsonResult
=
dmpApiServiceMangeService
.
saveApiBigDataInfo
(
req
);
jsonResult
=
dmpApiServiceMangeService
.
saveApiBigDataInfo
(
req
);
...
@@ -94,7 +94,7 @@ public class DmpApiServiceMangeController {
...
@@ -94,7 +94,7 @@ public class DmpApiServiceMangeController {
* @author Bellamy
* @author Bellamy
* @since 2021-01-20
* @since 2021-01-20
*/
*/
@ApiOperation
(
value
=
"编辑API(第三方)"
,
notes
=
"编辑API(第三方)"
)
/*
@ApiOperation(value = "编辑API(第三方)", notes = "编辑API(第三方)")
@PostMapping(value = "/updataApi")
@PostMapping(value = "/updataApi")
public JsonResult updateApiInfo(@RequestBody @Validated ApiInterfaceReq req, HttpServletRequest httpRequest) {
public JsonResult updateApiInfo(@RequestBody @Validated ApiInterfaceReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
JsonResult jsonResult = new JsonResult();
...
@@ -106,7 +106,7 @@ public class DmpApiServiceMangeController {
...
@@ -106,7 +106,7 @@ public class DmpApiServiceMangeController {
e.printStackTrace();
e.printStackTrace();
}
}
return jsonResult;
return jsonResult;
}
}
*/
/**
/**
* 编辑API(大数据查询/标签查询)
* 编辑API(大数据查询/标签查询)
...
@@ -114,7 +114,7 @@ public class DmpApiServiceMangeController {
...
@@ -114,7 +114,7 @@ public class DmpApiServiceMangeController {
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
@ApiOperation
(
value
=
"编辑API(大数据查询/标签查询)"
,
notes
=
"编辑API(大数据查询/标签查询)"
)
/*
@ApiOperation(value = "编辑API(大数据查询/标签查询)", notes = "编辑API(大数据查询/标签查询)")
@PostMapping(value = "/updateApiBigData")
@PostMapping(value = "/updateApiBigData")
public JsonResult updateApiBigDataInfo(@RequestBody @Validated MakeBigDataApiReq req, HttpServletRequest httpRequest) {
public JsonResult updateApiBigDataInfo(@RequestBody @Validated MakeBigDataApiReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
JsonResult jsonResult = new JsonResult();
...
@@ -126,7 +126,7 @@ public class DmpApiServiceMangeController {
...
@@ -126,7 +126,7 @@ public class DmpApiServiceMangeController {
e.printStackTrace();
e.printStackTrace();
}
}
return jsonResult;
return jsonResult;
}
}
*/
/**
/**
* API计量调用次数和执行时长
* API计量调用次数和执行时长
...
@@ -189,6 +189,26 @@ public class DmpApiServiceMangeController {
...
@@ -189,6 +189,26 @@ public class DmpApiServiceMangeController {
return
jsonResult
;
return
jsonResult
;
}
}
/**
* API计量--API已调用列表
*
* @author Bellamy
* @since 2021-02-25
*/
@ApiOperation
(
value
=
"API计量--API已调用列表"
,
notes
=
"API计量--API已调用列表"
)
@PostMapping
(
value
=
"/listCallApi"
)
public
JsonResult
listCallApi
(
@RequestBody
@Validated
ApiInterfaceInfoListReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
listCallApi
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
/**
* 获取数据源库——下拉框
* 获取数据源库——下拉框
*
*
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/bean/ApiInterfaceReq.java
View file @
7413cc0f
...
@@ -19,64 +19,93 @@ import java.io.Serializable;
...
@@ -19,64 +19,93 @@ import java.io.Serializable;
public
class
ApiInterfaceReq
implements
Serializable
{
public
class
ApiInterfaceReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"传输方式:0,http 1.https"
,
required
=
true
)
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"传输方式:http https"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
transMode
;
public
Integer
apiProtocl
;
@ApiModelProperty
(
value
=
"加密方式
0 无,1:MD5 2:RSA"
,
required
=
true
)
@ApiModelProperty
(
value
=
"加密方式
,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
signType
;
public
Integer
signType
;
@ApiModelProperty
(
value
=
"Api类型:对应字典表key"
,
required
=
true
)
@NotNull
(
message
=
"Api类型不能为空"
)
public
String
apiType
;
@ApiModelProperty
(
value
=
"
接入类型:对应字典表key"
,
required
=
true
)
@ApiModelProperty
(
value
=
"
apiKey"
,
required
=
true
)
@NotNull
(
message
=
"
接入类型
不能为空"
)
@NotNull
(
message
=
"
apiKey
不能为空"
)
public
String
joinType
;
public
String
apiKey
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
true
)
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
false
)
@NotNull
(
message
=
"目标地址不能为空"
)
public
String
targetUrl
;
public
String
targetUrl
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@ApiModelProperty
(
value
=
"请求方式:GET POST"
,
required
=
true
)
@NotNull
(
message
=
"超时时间不能为空"
)
@NotNull
(
message
=
"请求方式不能为空"
)
public
String
timeout
;
public
String
reqType
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@NotNull
(
message
=
"超时时间不能为空"
)
public
Integer
timeout
;
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月, YEAR 按年"
,
required
=
true
)
@ApiModelProperty
(
value
=
"限流类型:DAY 按天,MONTH 按月, YEAR 按年"
,
required
=
true
)
@NotNull
(
message
=
"限流类型不能为空"
)
@NotNull
(
message
=
"限流类型不能为空"
)
public
String
req
Type
;
public
String
limit
Type
;
@ApiModelProperty
(
value
=
"限制次数"
,
required
=
false
)
@ApiModelProperty
(
value
=
"API名称"
,
required
=
false
)
public
String
apiName
;
@ApiModelProperty
(
value
=
"限制次数"
,
required
=
false
)
public
Long
reqFrequency
;
public
Long
reqFrequency
;
@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
=
"
状态"
,
required
=
false
)
@ApiModelProperty
(
value
=
"
输出类型:JSON 文件流形式"
,
required
=
false
)
public
String
status
;
public
String
outputType
;
@ApiModelProperty
(
value
=
"
更新时传入api自增id"
,
required
=
false
)
@ApiModelProperty
(
value
=
"
最大行数:"
,
required
=
false
)
public
Long
id
;
public
Long
maxRow
;
@ApiModelProperty
(
value
=
"
创建用户"
)
@ApiModelProperty
(
value
=
"
每页返回数据数:"
,
required
=
false
)
public
String
createUser
;
public
Long
pageRow
;
@ApiModelProperty
(
value
=
"api类型:1.数据银行制作大数据表 "
+
@ApiModelProperty
(
value
=
"请求参数:"
,
required
=
false
)
"2 数据银行制作数据包,3,数据银行制作自定义API "
+
public
String
requestParam
;
"4 API实时接入 6 标签查询 9自定义"
,
hidden
=
true
)
public
String
apiType
;
@ApiModelProperty
(
value
=
"请求方式"
)
@ApiModelProperty
(
value
=
"响应参数:"
,
required
=
false
)
public
String
reqMethod
;
public
String
responseParam
;
@ApiModelProperty
(
value
=
"固定参数:"
,
required
=
false
)
public
String
inboxParam
;
@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
=
"更新时传入api自增id"
,
required
=
false
)
public
Long
id
;
@ApiModelProperty
(
value
=
"创建用户"
,
hidden
=
true
)
public
String
createUser
;
@ApiModelProperty
(
value
=
"更新用户"
,
hidden
=
true
)
public
String
updateUser
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
public
String
status
;
}
}
src/main/java/com/jz/dmp/modules/service/DmpApiMangeService.java
View file @
7413cc0f
...
@@ -3,6 +3,8 @@ package com.jz.dmp.modules.service;
...
@@ -3,6 +3,8 @@ package com.jz.dmp.modules.service;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
java.util.Map
;
/**
/**
* @ClassName: DmpApiMangeService
* @ClassName: DmpApiMangeService
* @Description: 数据服务Api管理
* @Description: 数据服务Api管理
...
@@ -66,7 +68,7 @@ public interface DmpApiMangeService {
...
@@ -66,7 +68,7 @@ public interface DmpApiMangeService {
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
JsonResult
apiTestInfo
(
String
apiKey
)
throws
Exception
;
JsonResult
apiTestInfo
(
Map
<
String
,
Object
>
params
)
throws
Exception
;
/**
/**
* 查看日志
* 查看日志
...
...
src/main/java/com/jz/dmp/modules/service/DmpApiServiceMangeService.java
View file @
7413cc0f
...
@@ -17,7 +17,7 @@ import java.util.List;
...
@@ -17,7 +17,7 @@ import java.util.List;
public
interface
DmpApiServiceMangeService
{
public
interface
DmpApiServiceMangeService
{
/**
/**
* 保存API(第三方)基本信息
* 保存
/编辑
API(第三方)基本信息
*
*
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
...
@@ -25,12 +25,12 @@ public interface DmpApiServiceMangeService {
...
@@ -25,12 +25,12 @@ public interface DmpApiServiceMangeService {
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
;
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
;
/**
/**
*
保存
API(大数据查询/标签查询)
*
制作/编辑
API(大数据查询/标签查询)
*
*
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
JsonResult
saveApiBigDataInfo
(
MakeBigDataApi
Req
req
)
throws
Exception
;
JsonResult
saveApiBigDataInfo
(
ApiInterface
Req
req
)
throws
Exception
;
/**
/**
* 编辑API(第三方)基本信息
* 编辑API(第三方)基本信息
...
@@ -98,4 +98,11 @@ public interface DmpApiServiceMangeService {
...
@@ -98,4 +98,11 @@ public interface DmpApiServiceMangeService {
*/
*/
JsonResult
getFolderTree
(
String
projectId
,
String
orgCode
)
throws
Exception
;
JsonResult
getFolderTree
(
String
projectId
,
String
orgCode
)
throws
Exception
;
/**
* API计量--API已调用列表
*
* @author Bellamy
* @since 2021-02-25
*/
JsonResult
listCallApi
(
ApiInterfaceInfoListReq
req
)
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
View file @
7413cc0f
...
@@ -226,28 +226,9 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
...
@@ -226,28 +226,9 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
* @since 2021-01-19
* @since 2021-01-19
*/
*/
@Override
@Override
public
JsonResult
apiTestInfo
(
String
apiKey
)
throws
Exception
{
public
JsonResult
apiTestInfo
(
Map
<
String
,
Object
>
params
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
testApi
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
testApi
;
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
params
));
Map
params
=
new
HashMap
();
params
.
put
(
"apiKey"
,
apiKey
);
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"测试失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
return
result
;
}
}
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpApiServiceMangeServiceImpl.java
View file @
7413cc0f
...
@@ -45,77 +45,31 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
...
@@ -45,77 +45,31 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
private
OfflineSynchDao
offlineSynchDao
;
private
OfflineSynchDao
offlineSynchDao
;
/**
/**
* 保存API(第三方)基本信息
* 保存
/编辑
API(第三方)基本信息
*
*
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
@Override
@Override
public
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
public
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiInfo
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
Map
apiKey
=
JSONObject
.
parseObject
(
jsonObject
.
get
(
"data"
).
toString
());
result
.
setData
(
apiKey
.
get
(
"data"
));
// 新增API数据的apiKey
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
return
result
;
}
}
/**
/**
*
保存
API(大数据查询/标签查询)
*
制作/编辑
API(大数据查询/标签查询)
*
*
* @author Bellamy
* @author Bellamy
* @since 2021-01-19
* @since 2021-01-19
*/
*/
@Override
@Override
public
JsonResult
saveApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
{
public
JsonResult
saveApiBigDataInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiBigData
;
ApiInterfaceReq
baseInfo
=
new
ApiInterfaceReq
();
BeanUtils
.
copyProperties
(
req
,
baseInfo
);
//保存API基本信息
JsonResult
apiKeyData
=
saveApiInfo
(
baseInfo
);
String
apiKey
=
apiKeyData
.
getData
().
toString
();
if
(
StringUtils
.
isNotEmpty
(
apiKey
))
{
logger
.
info
(
"######apiKey="
+
apiKey
);
req
.
setApiKey
(
apiKey
);
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiBigData
;
//保存API(大数据查询/标签查询)
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
}
return
result
;
return
result
;
}
}
...
@@ -199,27 +153,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
...
@@ -199,27 +153,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
*/
*/
@Override
@Override
public
JsonResult
getCountAPiCallStat
()
throws
Exception
{
public
JsonResult
getCountAPiCallStat
()
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
countAPiCallStat
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
countAPiCallStat
;
Map
params
=
new
HashMap
();
Map
params
=
new
HashMap
();
params
.
put
(
"date"
,
DateUtils
.
currentDate
());
params
.
put
(
"date"
,
DateUtils
.
currentDate
());
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
JsonResult
result
=
GatewayApiConstant
.
getRequest2GetData
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
return
result
;
}
}
...
@@ -260,25 +197,22 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
...
@@ -260,25 +197,22 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
*/
*/
@Override
@Override
public
JsonResult
queryApiNotCalledListPage
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
public
JsonResult
queryApiNotCalledListPage
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
notCalledList
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
notCalledList
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
return
result
;
throw
new
RuntimeException
(
"查询失败!"
);
}
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
/**
if
(
jsonObject
.
containsKey
(
"code"
))
{
* API计量--API已调用列表
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
*
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
* @param req
}
* @author Bellamy
}
* @since 2021-02-25
if
(
jsonObject
.
containsKey
(
"message"
))
{
*/
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
@Override
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
public
JsonResult
listCallApi
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
)
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
listCallApi
;
}
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
return
result
;
return
result
;
}
}
...
@@ -291,25 +225,8 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
...
@@ -291,25 +225,8 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
*/
*/
@Override
@Override
public
JsonResult
apiListPaging
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
public
JsonResult
apiListPaging
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
listServerApplyApi
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
listServerApplyApi
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
JsonResult
result
=
GatewayApiConstant
.
postRequest2GetData
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
jsonObject
.
get
(
"data"
));
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
return
result
;
}
}
...
@@ -328,7 +245,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
...
@@ -328,7 +245,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
String
url
=
gatewayUrl
+
GatewayApiConstant
.
folderTree
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
folderTree
;
Map
params
=
new
HashMap
();
Map
params
=
new
HashMap
();
if
(
StringUtils
.
isNotEmpty
(
projectId
))
{
if
(
StringUtils
.
isNotEmpty
(
projectId
))
{
params
.
put
(
"projectId"
,
projectId
);
params
.
put
(
"projectId"
,
projectId
);
}
}
params
.
put
(
"orgCode"
,
orgCode
);
params
.
put
(
"orgCode"
,
orgCode
);
...
...
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