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
3ac7ab42
Commit
3ac7ab42
authored
Feb 04, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
008c0a82
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
89 deletions
+93
-89
GatewayApiConstant.java
src/main/java/com/jz/common/constant/GatewayApiConstant.java
+68
-0
DmpApiMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
+10
-39
DmpApiServiceMangeServiceImpl.java
...p/modules/service/impl/DmpApiServiceMangeServiceImpl.java
+8
-25
DmpOrgMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
+7
-25
No files found.
src/main/java/com/jz/common/constant/GatewayApiConstant.java
0 → 100644
View file @
3ac7ab42
package
com
.
jz
.
common
.
constant
;
/**
* @ClassName: GatewayApiConstant
* @Description: 服务网关api地址
* @Author Bellamy
* @Date 2021/2/4
* @Version 1.0
*/
public
class
GatewayApiConstant
{
//列表分页查询url
public
static
final
String
orgListPage
=
"/api/organization/listOrg"
;
//删除组织url
public
static
final
String
delOrg
=
"/api/organization/logoutOrg"
;
//新增组织url
public
static
final
String
addOrg
=
"/api/organization/add"
;
//编辑组织url
public
static
final
String
updateOrg
=
"/api/organization/update"
;
//根据组织id获取组织详情url
public
static
final
String
orgDetail
=
"/api/organization/getOrgDetail"
;
//授权给他人的API-列表分页查询url
public
static
final
String
apiAuthListPage
=
"/api/auth/auth-list"
;
//取消授权url
public
static
final
String
cancelApiAuth
=
"/api/auth/update-auth-info"
;
//发布的API-API列表分页查询url
public
static
final
String
apiListPage
=
"/api/interface/listApiInterface"
;
//删除APIurl
public
static
final
String
delApi
=
"/api/interface/delDMPApiInterface"
;
//根据apiid获取API详情url
public
static
final
String
getApiInfo
=
"/api/interface/getApiInterfaceDetail"
;
//授权给组织url
public
static
final
String
apiAuthToOrg
=
"/api/auth/dmp-auth-api"
;
//测试url
public
static
final
String
testApi
=
"/api/interface/apiTestApiInterface"
;
//查看日志url
public
static
final
String
checkApiLog
=
"/api/logging/listApiLog"
;
//授权模糊查询组织信息url
public
static
final
String
authOrgList
=
"/api/auth/getAuthNameList"
;
//保存API(第三方)基本信息url
public
static
final
String
addApiInfo
=
"/api/producer/addCustomApi"
;
//保存API(大数据查询/标签查询)url
public
static
final
String
addApiBigData
=
"/api/producer/makeBigDataApi"
;
//编辑API(第三方)基本信息url
public
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
//API计量调用次数和执行时长url
public
static
final
String
countAPiCallStat
=
"/api/logging/countAPiCallStat"
;
//API计量--API未调用列表url
public
static
final
String
notCalledList
=
"/api/interface/listUnCallApiInterface"
;
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
View file @
3ac7ab42
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.constant.GatewayApiConstant
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.service.DmpApiMangeService
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -30,33 +28,6 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpApiMangeServiceImpl
.
class
);
//授权给他人的API-列表分页查询url
private
static
final
String
apiAuthListPage
=
"/api/auth/auth-list"
;
//取消授权url
private
static
final
String
cancelApiAuth
=
"/api/auth/update-auth-info"
;
//发布的API-API列表分页查询url
private
static
final
String
apiListPage
=
"/api/interface/listApiInterface"
;
//删除APIurl
private
static
final
String
delApi
=
"/api/interface/delDMPApiInterface"
;
//根据apiid获取API详情url
private
static
final
String
getApiInfo
=
"/api/interface/getApiInterfaceDetail"
;
//授权给组织url
private
static
final
String
apiAuthToOrg
=
"/api/auth/dmp-auth-api"
;
//测试url
private
static
final
String
testApi
=
"/api/interface/apiTestApiInterface"
;
//查看日志url
private
static
final
String
checkApiLog
=
"/api/logging/listApiLog"
;
//授权模糊查询组织信息url
private
static
final
String
authOrgList
=
"/api/auth/getAuthNameList"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
...
...
@@ -69,7 +40,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
queryApiAuthListPage
(
AuthListInfoReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
apiAuthListPage
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
apiAuthListPage
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
...
...
@@ -99,7 +70,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
cancelApiAuth
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
cancelApiAuth
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
cancelApiAuth
;
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
params
));
...
...
@@ -131,7 +102,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
queryApiListPage
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
apiListPage
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
apiListPage
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
...
...
@@ -161,7 +132,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
delApiInfo
(
String
apiKey
,
String
type
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
delApi
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
delApi
;
Map
params
=
new
HashMap
();
params
.
put
(
"apiKey"
,
apiKey
);
params
.
put
(
"type"
,
type
);
...
...
@@ -193,7 +164,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
queryApiInfoByApiId
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
getApiInfo
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
getApiInfo
;
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
...
...
@@ -226,7 +197,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
addApiAuthToOrg
(
AuthUserApiReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
apiAuthToOrg
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
apiAuthToOrg
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
...
...
@@ -257,7 +228,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
apiTestInfo
(
String
apiKey
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
testApi
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
testApi
;
Map
params
=
new
HashMap
();
params
.
put
(
"apiKey"
,
apiKey
);
...
...
@@ -289,7 +260,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
checkApiLogInfo
(
LogInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
checkApiLog
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
checkApiLog
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
...
...
@@ -320,7 +291,7 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
@Override
public
JsonResult
getAuthOrgList
(
String
key
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
authOrgList
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
authOrgList
;
Map
params
=
new
HashMap
();
params
.
put
(
"key"
,
key
);
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpApiServiceMangeServiceImpl.java
View file @
3ac7ab42
...
...
@@ -9,12 +9,10 @@ import com.jz.common.utils.web.SessionUtils;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceInfoListReq
;
import
com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq
;
import
com.jz.common.constant.GatewayApiConstant
;
import
com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq
;
import
com.jz.dmp.modules.dao.DvRuleTDao
;
import
com.jz.dmp.modules.dao.OfflineSynchDao
;
import
com.jz.dmp.modules.model.DvRuleT
;
import
com.jz.dmp.modules.service.DmpApiServiceMangeService
;
import
com.jz.dmp.modules.service.DvRuleTService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -37,21 +35,6 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpApiServiceMangeServiceImpl
.
class
);
//保存API(第三方)基本信息url
private
static
final
String
addApiInfo
=
"/api/producer/addCustomApi"
;
//保存API(大数据查询/标签查询)url
private
static
final
String
addApiBigData
=
"/api/producer/makeBigDataApi"
;
//编辑API(第三方)基本信息url
private
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
//API计量调用次数和执行时长url
private
static
final
String
countAPiCallStat
=
"/api/logging/countAPiCallStat"
;
//API计量--API未调用列表url
private
static
final
String
notCalledList
=
"/api/interface/listUnCallApiInterface"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
...
...
@@ -70,7 +53,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
@Override
public
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addApiInfo
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
...
...
@@ -114,7 +97,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
req
.
setApiKey
(
apiKey
);
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
addApiBigData
;
//保存API(大数据查询/标签查询)
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiBigData
;
//保存API(大数据查询/标签查询)
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
...
...
@@ -145,7 +128,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
@Override
public
JsonResult
updateApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
updateApiInfo
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
updateApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
...
...
@@ -187,7 +170,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
//编辑API(大数据查询/标签查询)
JsonResult
result
=
new
JsonResult
();
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
addApiBigData
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addApiBigData
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
...
...
@@ -217,7 +200,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
@Override
public
JsonResult
getCountAPiCallStat
()
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
countAPiCallStat
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
countAPiCallStat
;
Map
params
=
new
HashMap
();
params
.
put
(
"date"
,
DateUtils
.
currentDate
());
...
...
@@ -247,7 +230,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
* @author Bellamy
*/
@Override
public
JsonResult
querygSourceDbList
(
Integer
projectId
,
String
dbName
)
throws
Exception
{
public
JsonResult
querygSourceDbList
(
Integer
projectId
,
String
dbName
)
throws
Exception
{
Map
map
=
new
HashMap
();
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"dbName"
,
dbName
);
...
...
@@ -278,7 +261,7 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
@Override
public
JsonResult
queryApiNotCalledListPage
(
ApiInterfaceInfoListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
notCalledList
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
notCalledList
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
View file @
3ac7ab42
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.j
craft.jsch.Session
;
import
com.j
z.common.constant.GatewayApiConstant
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.common.utils.web.SessionUtils
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageDetailQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -32,21 +29,6 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpOrgMangeServiceImpl
.
class
);
//列表分页查询url
private
static
final
String
orgListPage
=
"/api/organization/listOrg"
;
//删除组织url
private
static
final
String
delOrg
=
"/api/organization/logoutOrg"
;
//新增组织url
private
static
final
String
addOrg
=
"/api/organization/add"
;
//编辑组织url
private
static
final
String
updateOrg
=
"/api/organization/update"
;
//根据组织id获取组织详情url
private
static
final
String
orgDetail
=
"/api/organization/getOrgDetail"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
...
...
@@ -60,7 +42,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
@Override
public
JsonResult
queryOrgListPage
(
OrganizationManageListQueryReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
orgListPage
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
orgListPage
;
if
(
StringUtils
.
isNotEmpty
(
req
.
getOrgName
()))
{
req
.
setOrgName
(
req
.
getOrgName
().
trim
());
...
...
@@ -96,7 +78,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
public
JsonResult
delOrgById
(
long
id
)
throws
Exception
{
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
url
=
gatewayUrl
+
delOrg
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
delOrg
;
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"删除失败!"
);
...
...
@@ -121,7 +103,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
@Override
public
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addOrg
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addOrg
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
...
...
@@ -153,7 +135,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
@Override
public
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addOrg
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
addOrg
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
...
...
@@ -185,7 +167,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
@Override
public
JsonResult
getOrgInfoByOrgId
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
orgDetail
;
String
url
=
gatewayUrl
+
GatewayApiConstant
.
orgDetail
;
OrganizationManageDetailQueryReq
req
=
new
OrganizationManageDetailQueryReq
();
req
.
setId
(
Long
.
valueOf
(
id
));
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
...
...
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