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
a8f97b6b
Commit
a8f97b6b
authored
Feb 20, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
bdf7e405
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
471 additions
and
51 deletions
+471
-51
GatewayApiConstant.java
src/main/java/com/jz/common/constant/GatewayApiConstant.java
+15
-0
DmpApiMangeController.java
...modules/controller/dataService/DmpApiMangeController.java
+124
-16
DmpApiServiceMangeController.java
.../controller/dataService/DmpApiServiceMangeController.java
+3
-3
DmpOrgMangeController.java
...modules/controller/dataService/DmpOrgMangeController.java
+2
-2
AuthApiListReq.java
...p/modules/controller/dataService/bean/AuthApiListReq.java
+29
-0
AuthUserApiReq.java
...p/modules/controller/dataService/bean/AuthUserApiReq.java
+17
-0
LogInfoListReq.java
...p/modules/controller/dataService/bean/LogInfoListReq.java
+9
-0
OrganizationManageAddReq.java
...controller/dataService/bean/OrganizationManageAddReq.java
+21
-15
OrganizationManageUpdateReq.java
...troller/dataService/bean/OrganizationManageUpdateReq.java
+19
-15
SaltResetReq.java
...dmp/modules/controller/dataService/bean/SaltResetReq.java
+29
-0
DmpApiMangeService.java
...n/java/com/jz/dmp/modules/service/DmpApiMangeService.java
+40
-0
DmpApiMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
+163
-0
No files found.
src/main/java/com/jz/common/constant/GatewayApiConstant.java
View file @
a8f97b6b
...
...
@@ -68,4 +68,19 @@ public class GatewayApiConstant {
//服务发布/服务取消url
public
static
final
String
apiPublishCancel
=
"/api/producer/optionApiIssueStatus"
;
//盐值重置url
public
static
final
String
saltReset
=
"/api/auth/reset-salt"
;
//授权管理-api列表url
public
static
final
String
authApiList
=
"/api/auth/getServiceAuthList"
;
//授权
public
static
final
String
authUserApi
=
"/api/auth/user-auth-api"
;
//上传(发送给数据银行)
public
static
final
String
serverUpload
=
"/api/producer/serverUpload"
;
//日志详情
public
static
final
String
logDetails
=
"/api/logging/getReqDetail"
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiMangeController.java
View file @
a8f97b6b
...
...
@@ -36,13 +36,13 @@ public class DmpApiMangeController {
@Autowired
private
DmpApiMangeService
dmpApiMangeService
;
/**
/* */
/**
* 授权给他人的API-列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-18
*/
*/
/*
@ApiOperation(value = "授权给他人的API-列表分页查询", notes = "列表分页查询")
@PostMapping(value = "/apiAuthListPage")
public JsonResult getApiAuthListPage(@RequestBody @Validated AuthListInfoReq req, HttpServletRequest httpRequest) {
...
...
@@ -55,7 +55,7 @@ public class DmpApiMangeController {
e.printStackTrace();
}
return jsonResult;
}
}
*/
/**
* 取消授权
...
...
@@ -81,12 +81,12 @@ public class DmpApiMangeController {
return
jsonResult
;
}
/**
/* */
/**
* 发布的API-API列表分页查询
*
* @author Bellamy
* @since 2021-01-18
*/
*/
/*
@ApiOperation(value = "发布的API-API列表分页查询", notes = "列表分页查询")
@PostMapping(value = "/listPage")
public JsonResult getApiListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) {
...
...
@@ -99,7 +99,7 @@ public class DmpApiMangeController {
e.printStackTrace();
}
return jsonResult;
}
}
*/
/**
* 删除api
...
...
@@ -110,8 +110,8 @@ public class DmpApiMangeController {
@ApiOperation
(
value
=
"删除api"
,
notes
=
"删除api"
)
@GetMapping
(
value
=
"/delApiInfo"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"apiKey"
,
value
=
"apiKey"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型
"
,
required
=
fals
e
)})
public
JsonResult
delApiInfo
(
@RequestParam
String
apiKey
,
@RequestParam
(
required
=
false
)
String
type
,
HttpServletRequest
httpRequest
)
{
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型
:0删除提示,1正式删除"
,
required
=
tru
e
)})
public
JsonResult
delApiInfo
(
@RequestParam
String
apiKey
,
@RequestParam
String
type
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
apiKey
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"apiKey不能为空!"
);
}
...
...
@@ -150,12 +150,12 @@ public class DmpApiMangeController {
return
jsonResult
;
}
/**
/* */
/**
* 授权给组织-提交保存
*
* @author Bellamy
* @since 2021-01-19
*/
*/
/*
@ApiOperation(value = "授权给组织-提交保存", notes = "授权给组织-提交保存")
@PostMapping(value = "/addApiAuthToOrg")
public JsonResult addApiAuthToOrg(@RequestBody @Validated AuthUserApiReq req, HttpServletRequest httpRequest) {
...
...
@@ -168,7 +168,7 @@ public class DmpApiMangeController {
e.printStackTrace();
}
return jsonResult;
}
}
*/
/**
* API测试
...
...
@@ -195,12 +195,12 @@ public class DmpApiMangeController {
}
/**
*
查看日志
*
API日志列表
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"
查看日志"
,
notes
=
"查看日志
"
)
@ApiOperation
(
value
=
"
API日志列表"
,
notes
=
"API日志列表
"
)
@PostMapping
(
value
=
"/checkApiLogInfo"
)
public
JsonResult
checkApiLogInfo
(
@RequestBody
LogInfoListReq
req
,
HttpServletRequest
httpRequest
)
{
/* if (StringUtils.isEmpty(req.getApiKey())) {
...
...
@@ -217,12 +217,12 @@ public class DmpApiMangeController {
return
jsonResult
;
}
/**
/* */
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
*/
/*
@ApiOperation(value = "授权模糊查询组织信息", notes = "授权模糊查询组织信息")
@GetMapping(value = "/authOrgList")
@ApiImplicitParam(name = "key", value = "key", required = true)
...
...
@@ -239,7 +239,7 @@ public class DmpApiMangeController {
e.printStackTrace();
}
return jsonResult;
}
}
*/
/**
* 服务发布/服务取消
...
...
@@ -265,4 +265,112 @@ public class DmpApiMangeController {
return
jsonResult
;
}
/**
* 盐值重置
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation
(
value
=
"盐值重置"
,
notes
=
"盐值重置"
)
@PostMapping
(
value
=
"/saltReset"
)
public
JsonResult
saltReset
(
@RequestBody
@Validated
SaltResetReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
saltReset
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 授权管理-api列表
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation
(
value
=
"授权管理-api列表"
,
notes
=
"授权管理-api列表"
)
@PostMapping
(
value
=
"/authApiList"
)
public
JsonResult
authApiList
(
@RequestBody
@Validated
AuthApiListReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
queryAuthApiList
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 用户授权
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation
(
value
=
"授权"
,
notes
=
"授权"
)
@PostMapping
(
value
=
"/authUserApi"
)
public
JsonResult
authUserApi
(
@RequestBody
@Validated
AuthUserApiReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
authUserApi
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 服务开发--上传(发送给数据银行)
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation
(
value
=
"服务开发--上传"
,
notes
=
"上传"
)
@GetMapping
(
value
=
"/serverUpload"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
true
)
public
JsonResult
serverUpload
(
@RequestParam
String
id
)
{
if
(
StringUtils
.
isEmpty
(
id
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"id不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
serverUpload
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 日志详情
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation
(
value
=
"日志详情"
,
notes
=
"日志详情"
)
@GetMapping
(
value
=
"/logDetails"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
true
)
public
JsonResult
logDetails
(
@RequestParam
String
id
)
{
if
(
StringUtils
.
isEmpty
(
id
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"id不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
logDetails
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiServiceMangeController.java
View file @
a8f97b6b
...
...
@@ -149,12 +149,12 @@ public class DmpApiServiceMangeController {
return
jsonResult
;
}
/**
/* */
/**
* API计量--API调用列表
*
* @author Bellamy
* @since 2021-01-19
*/
*/
/*
@ApiOperation(value = "API计量--API调用列表", notes = "API计量--API调用列表")
@PostMapping(value = "/apiCountListPage")
public JsonResult apiCountListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) {
...
...
@@ -167,7 +167,7 @@ public class DmpApiServiceMangeController {
e.printStackTrace();
}
return jsonResult;
}
}
*/
/**
* API计量--API未调用列表
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/DmpOrgMangeController.java
View file @
a8f97b6b
...
...
@@ -93,9 +93,9 @@ public class DmpOrgMangeController {
if
(
StringUtils
.
isEmpty
(
req
.
getOrgName
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"组织名称不能为空!"
);
}
if
(
StringUtils
.
isEmpty
(
req
.
getOrgType
()))
{
/*
if (StringUtils.isEmpty(req.getOrgType())) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "组织类型不能为空!");
}
}
*/
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
addOrg
(
req
);
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/bean/AuthApiListReq.java
0 → 100644
View file @
a8f97b6b
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName: AuthApiListReq
* @Description: 授权api列表请求对象
* @Author: Bellamy
* @Date 2021/2/20
* @Version 1.0
*/
@Data
@ApiModel
(
"授权api列表请求对象"
)
public
class
AuthApiListReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"文件夹id"
,
required
=
false
)
private
Long
fileId
;
@ApiModelProperty
(
value
=
"组织编码"
,
required
=
false
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
false
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"api名称"
,
required
=
false
)
private
String
apiName
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/AuthUserApiReq.java
View file @
a8f97b6b
...
...
@@ -36,7 +36,24 @@ public class AuthUserApiReq implements Serializable {
@NotNull
(
message
=
"授权方式不能为空"
)
private
String
authMode
;
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH 授权"
,
required
=
true
)
@NotNull
(
message
=
"授权类型不能为空"
)
private
String
authType
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
private
String
createUser
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
validStartTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
validEndTime
;
@ApiModelProperty
(
value
=
"备注--加入来源信息"
,
required
=
false
)
private
String
remark
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/LogInfoListReq.java
View file @
a8f97b6b
...
...
@@ -20,4 +20,13 @@ public class LogInfoListReq extends BasePageBean implements Serializable {
@ApiModelProperty
(
value
=
"ApiKey"
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"客户请求token"
)
private
String
requestToken
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
String
createDate
;
@ApiModelProperty
(
value
=
"历史查询-数据银行"
)
private
String
historyQuery
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageAddReq.java
View file @
a8f97b6b
...
...
@@ -20,24 +20,15 @@ import java.io.Serializable;
public
class
OrganizationManageAddReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3131683881168540907L
;
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
@NotEmpty
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"组织英文名称"
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"文件夹Id"
,
required
=
true
)
@NotNull
(
message
=
"文件夹Id不能为空"
)
private
Long
orgFolderId
;
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
...
...
@@ -46,9 +37,24 @@ public class OrganizationManageAddReq implements Serializable {
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
Boolean
status
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
/* @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private Boolean status;
@ApiModelProperty(value = "组织描述")
private String orgDesc;
@ApiModelProperty(value = "组织英文名称")
private String orgCnName;
@ApiModelProperty(value = "组织邮箱")
private String orgMail;
@ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
@NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;*/
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageUpdateReq.java
View file @
a8f97b6b
...
...
@@ -23,17 +23,26 @@ public class OrganizationManageUpdateReq implements Serializable {
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
@NotEmpty
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
)
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"文件夹Id"
,
required
=
true
)
@NotNull
(
message
=
"文件夹Id不能为空"
)
private
Long
orgFolderId
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
/* @ApiModelProperty(value = "组织描述")
private String orgDesc;
@ApiModelProperty(value = "组织英文名称")
...
...
@@ -42,17 +51,12 @@ public class OrganizationManageUpdateReq implements Serializable {
@ApiModelProperty(value = "组织邮箱")
private String orgMail;
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private Boolean status;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
@ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
@NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;*/
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/SaltResetReq.java
0 → 100644
View file @
a8f97b6b
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @ClassName: SaltResetReq
* @Description: 盐值重置请求对象
* @Author: Bellamy
* @Date 2021/2/20
* @Version 1.0
*/
@Data
@ApiModel
(
"盐值重置请求对象"
)
public
class
SaltResetReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"授权码"
,
required
=
true
)
@NotNull
(
message
=
"授权码不能为空"
)
@NotEmpty
(
message
=
"授权码不能为空"
)
private
String
authCode
;
@ApiModelProperty
(
value
=
"更新用户"
,
required
=
false
)
private
String
updateUser
;
}
src/main/java/com/jz/dmp/modules/service/DmpApiMangeService.java
View file @
a8f97b6b
...
...
@@ -90,4 +90,44 @@ public interface DmpApiMangeService {
* @since 2021-02-07
*/
JsonResult
apiPublishCancel
(
String
id
,
Boolean
optStatus
)
throws
Exception
;
/**
* 盐值重置
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult
saltReset
(
SaltResetReq
req
)
throws
Exception
;
/**
* 授权管理-api列表
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult
queryAuthApiList
(
AuthApiListReq
req
)
throws
Exception
;
/**
* 用户授权
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult
authUserApi
(
AuthUserApiReq
req
)
throws
Exception
;
/**
* 服务开发--上传(发送给数据银行)
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult
serverUpload
(
String
id
)
throws
Exception
;
/**
* 日志详情
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult
logDetails
(
String
id
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
View file @
a8f97b6b
...
...
@@ -348,4 +348,167 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
return
result
;
}
/**
* 盐值重置
*
* @param req
* @author Bellamy
* @since 2021-02-20
*/
@Override
public
JsonResult
saltReset
(
SaltResetReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
saltReset
;
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
()))
{
result
.
setData
(
jsonObject
.
get
(
"data"
));
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
;
}
/**
* 授权管理-api列表
*
* @param req
* @author Bellamy
* @since 2021-02-20
*/
@Override
public
JsonResult
queryAuthApiList
(
AuthApiListReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
authApiList
;
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
()))
{
result
.
setData
(
jsonObject
.
get
(
"data"
));
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
;
}
/**
* 用户授权
*
* @param req
* @author Bellamy
* @since 2021-02-20
*/
@Override
public
JsonResult
authUserApi
(
AuthUserApiReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
authUserApi
;
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
()))
{
result
.
setData
(
jsonObject
.
get
(
"data"
));
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
;
}
/**
* 服务开发--上传(发送给数据银行)
*
* @param id
* @author Bellamy
* @since 2021-02-20
*/
@Override
public
JsonResult
serverUpload
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
serverUpload
;
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
Long
.
valueOf
(
id
));
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
();
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 日志详情
*
* @param id
* @author Bellamy
* @since 2021-02-20
*/
@Override
public
JsonResult
logDetails
(
String
id
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
GatewayApiConstant
.
logDetails
;
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
params
));
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
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
}
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