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
eeae9c4a
Commit
eeae9c4a
authored
Dec 31, 2020
by
ysongq
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm_dev' of
http://gitlab.ioubuy.cn/yaobenzhang/dm_project
into dm_dev
parents
62ed7048
7893c12f
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
218 additions
and
132 deletions
+218
-132
api_gateway.sql
database/zc/api_gateway.sql
+8
-5
GeneralStatusTypeEnum.java
...in/java/com/jz/dm/common/enums/GeneralStatusTypeEnum.java
+9
-1
WebAppConfigurer.java
...eway/src/main/java/com/jz/dm/config/WebAppConfigurer.java
+1
-0
AuthController.java
...ay/src/main/java/com/jz/dm/controller/AuthController.java
+1
-1
GatewayController.java
...src/main/java/com/jz/dm/controller/GatewayController.java
+4
-2
OrganizationManageController.java
...va/com/jz/dm/controller/OrganizationManageController.java
+1
-2
ApiAuthMapper.java
...gateway/src/main/java/com/jz/dm/mapper/ApiAuthMapper.java
+1
-1
ApiAuth.java
...ateway/src/main/java/com/jz/dm/models/domian/ApiAuth.java
+5
-5
ApiInterface.java
...y/src/main/java/com/jz/dm/models/domian/ApiInterface.java
+5
-0
ApiInterfaceFile.java
...c/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
+12
-6
ApiReqLog.java
...eway/src/main/java/com/jz/dm/models/domian/ApiReqLog.java
+5
-0
AuthInfoDto.java
...teway/src/main/java/com/jz/dm/models/dto/AuthInfoDto.java
+8
-6
AuthDmpUserApiReq.java
...ain/java/com/jz/dm/models/req/auth/AuthDmpUserApiReq.java
+10
-2
AuthMallUserApiReq.java
...in/java/com/jz/dm/models/req/auth/AuthMallUserApiReq.java
+10
-2
SaltResetReq.java
...src/main/java/com/jz/dm/models/req/auth/SaltResetReq.java
+2
-2
ApiInterfaceReq.java
.../main/java/com/jz/dm/models/req/make/ApiInterfaceReq.java
+8
-8
MakeBigDataApiReq.java
...ain/java/com/jz/dm/models/req/make/MakeBigDataApiReq.java
+3
-3
MakeCustomApiReq.java
...main/java/com/jz/dm/models/req/make/MakeCustomApiReq.java
+6
-6
MakeDataBankApiReq.java
...in/java/com/jz/dm/models/req/make/MakeDataBankApiReq.java
+10
-6
AuthUserResponse.java
...src/main/java/com/jz/dm/models/resp/AuthUserResponse.java
+2
-2
AuthServiceImpl.java
...src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
+36
-21
ProducerServiceImpl.java
...main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
+27
-23
ApiAuthMapper.xml
jz-dm-apigateway/src/main/resources/mapper/ApiAuthMapper.xml
+43
-27
TestAuth.java
...ateway/src/test/java/com/jz/dm/gateway/auth/TestAuth.java
+1
-1
No files found.
database/zc/api_gateway.sql
View file @
eeae9c4a
...
@@ -10,9 +10,10 @@ CREATE TABLE `t_api_interface` (
...
@@ -10,9 +10,10 @@ CREATE TABLE `t_api_interface` (
`api_type`
varchar
(
50
)
NULL
DEFAULT
''
COMMENT
'api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6标签查询 9自定义'
,
`api_type`
varchar
(
50
)
NULL
DEFAULT
''
COMMENT
'api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6标签查询 9自定义'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`version`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'版本号'
,
`version`
varchar
(
20
)
DEFAULT
'1.0'
COMMENT
'版本号'
,
`sign_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'加密方式: MD5 RSA'
,
`sign_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'加密方式: MD5 RSA'
,
`timeout`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'超时时间'
,
`timeout`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'超时时间'
,
`file_id`
bigint
(
20
)
NOT
NULL
COMMENT
'文件夹id'
,
`is_test`
tinyint
(
2
)
NOT
NULL
DEFAULT
'0'
COMMENT
'是否测试数据:0 否,1 是'
,
`is_test`
tinyint
(
2
)
NOT
NULL
DEFAULT
'0'
COMMENT
'是否测试数据:0 否,1 是'
,
`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
'创建时间'
,
...
@@ -42,18 +43,19 @@ CREATE TABLE `t_api_interface_custom` (
...
@@ -42,18 +43,19 @@ CREATE TABLE `t_api_interface_custom` (
`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`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api自定义信息表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api自定义信息表'
;
#
api
api
文件表
#
api
api
文件表
DROP
TABLE
IF
EXISTS
`t_api_interface_file`
;
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'
,
`
api_interface_id`
bigint
(
20
)
NOT
NULL
COMMENT
'api表自增id
'
,
`
project_id`
bigint
(
20
)
NOT
NULL
COMMENT
'项目编号
'
,
`
api_key`
varchar
(
200
)
NOT
NULL
COMMENT
'api唯一标识
'
,
`
file_source`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件来源:,1 dmp, 2 数据银行
'
,
`file_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件类型'
,
`file_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件类型'
,
`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
)
NOT
NULL
COMMENT
'父类id'
,
`status`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'VALID 有效,UNVALID 无效'
,
`status`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'VALID 有效,UNVALID 无效'
,
`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
'创建时间'
,
...
@@ -61,7 +63,7 @@ CREATE TABLE `t_api_interface_file` (
...
@@ -61,7 +63,7 @@ CREATE TABLE `t_api_interface_file` (
`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`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api文件表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api文件表'
;
#
api
组织信息表
#
api
组织信息表
...
@@ -129,6 +131,7 @@ CREATE TABLE `t_api_req_log` (
...
@@ -129,6 +131,7 @@ CREATE TABLE `t_api_req_log` (
`trans_mode`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'传输方式:POST,GET'
,
`trans_mode`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'传输方式:POST,GET'
,
`request_token`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'客户请求token'
,
`request_token`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'客户请求token'
,
`request_time`
datetime
DEFAULT
NULL
COMMENT
'请求时间'
,
`request_time`
datetime
DEFAULT
NULL
COMMENT
'请求时间'
,
`remark`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'状态:SUCCEED 请求成功, FAIL 请求失败'
,
`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
'创建人'
,
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/GeneralStatusTypeEnum.java
View file @
eeae9c4a
...
@@ -29,7 +29,15 @@ public enum GeneralStatusTypeEnum {
...
@@ -29,7 +29,15 @@ public enum GeneralStatusTypeEnum {
/**
/**
* 无效
* 无效
*/
*/
UN_VALID
(
"无效"
);
UN_VALID
(
"无效"
),
/**
* 成功'
*/
SUCCEED
(
"成功"
),
/**
* 失败'
*/
FAIL
(
"失败"
);
private
String
text
;
private
String
text
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/config/WebAppConfigurer.java
View file @
eeae9c4a
...
@@ -23,6 +23,7 @@ public class WebAppConfigurer extends WebMvcConfigurerAdapter {
...
@@ -23,6 +23,7 @@ public class WebAppConfigurer extends WebMvcConfigurerAdapter {
// 可添加多个,这里选择拦截所有请求地址,进入后判断是否有加注解即可
// 可添加多个,这里选择拦截所有请求地址,进入后判断是否有加注解即可
registry
.
addInterceptor
(
getAccessLimitInterceptor
())
registry
.
addInterceptor
(
getAccessLimitInterceptor
())
.
addPathPatterns
(
"/api/organization/**"
)
.
addPathPatterns
(
"/api/organization/**"
)
.
excludePathPatterns
(
"api/producer/**"
)
.
excludePathPatterns
(
.
excludePathPatterns
(
"/**/*.html"
,
//html静态资源
"/**/*.html"
,
//html静态资源
"/**/*.js"
,
//js静态资源
"/**/*.js"
,
//js静态资源
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/AuthController.java
View file @
eeae9c4a
...
@@ -48,7 +48,7 @@ public class AuthController {
...
@@ -48,7 +48,7 @@ public class AuthController {
* @Author: Mr.zhang
* @Author: Mr.zhang
* @Date: 2020-12-26
* @Date: 2020-12-26
*/
*/
@ApiOperation
(
"
商城
用户API认证"
)
@ApiOperation
(
"
DMP
用户API认证"
)
@PostMapping
(
value
=
"dmp-auth-api"
)
@PostMapping
(
value
=
"dmp-auth-api"
)
public
Mono
<
Result
>
authDmpUserApi
(
@RequestBody
@Valid
AuthDmpUserApiReq
req
)
{
public
Mono
<
Result
>
authDmpUserApi
(
@RequestBody
@Valid
AuthDmpUserApiReq
req
)
{
return
Mono
.
fromSupplier
(()
->
authService
.
addDmpUserApiAuth
(
req
));
return
Mono
.
fromSupplier
(()
->
authService
.
addDmpUserApiAuth
(
req
));
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/GatewayController.java
View file @
eeae9c4a
...
@@ -8,6 +8,7 @@ import com.jz.dm.gateway.GatewayService;
...
@@ -8,6 +8,7 @@ import com.jz.dm.gateway.GatewayService;
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.models.enity.RequestContext
;
import
com.jz.dm.models.enity.RequestContext
;
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
;
...
@@ -23,7 +24,9 @@ import java.util.Map;
...
@@ -23,7 +24,9 @@ import java.util.Map;
* 网关请求
* 网关请求
* @author zc
* @author zc
*/
*/
@RestController
(
"/api"
)
@RestController
@RequestMapping
(
"api/"
)
@Api
(
tags
=
{
"api请求controller"
})
public
class
GatewayController
{
public
class
GatewayController
{
@Autowired
@Autowired
...
@@ -69,6 +72,5 @@ public class GatewayController {
...
@@ -69,6 +72,5 @@ public class GatewayController {
result
.
put
(
"data"
,
gatewayResponse
.
getEncryptData
());
result
.
put
(
"data"
,
gatewayResponse
.
getEncryptData
());
}
}
}
}
result
.
put
(
"sign"
,
gatewayResponse
.
getSign
());
}
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/controller/OrganizationManageController.java
View file @
eeae9c4a
...
@@ -7,7 +7,6 @@ import com.jz.dm.models.req.organizationManage.OrganizationManageListQueryReq;
...
@@ -7,7 +7,6 @@ import com.jz.dm.models.req.organizationManage.OrganizationManageListQueryReq;
import
com.jz.dm.models.req.organizationManage.OrganizationManageUpdateReq
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageUpdateReq
;
import
com.jz.dm.service.OrganizationManageService
;
import
com.jz.dm.service.OrganizationManageService
;
import
com.jz.dm.web.annotation.AccessLimit
;
import
com.jz.dm.web.annotation.AccessLimit
;
import
com.jz.dm.web.annotation.ApiLogAspect
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -53,7 +52,7 @@ public class OrganizationManageController {
...
@@ -53,7 +52,7 @@ public class OrganizationManageController {
@ApiOperation
(
"组织详情查询"
)
@ApiOperation
(
"组织详情查询"
)
@PostMapping
(
value
=
"/getOrgDetail"
)
@PostMapping
(
value
=
"/getOrgDetail"
)
@AccessLimit
(
limit
=
1000
,
sec
=
1
)
@AccessLimit
(
limit
=
1000
,
sec
=
1
)
@ApiLogAspect
//
@ApiLogAspect
public
Mono
<
Result
>
getOrganizationDetail
(
@RequestBody
@Valid
OrganizationManageDetailQueryReq
req
)
{
public
Mono
<
Result
>
getOrganizationDetail
(
@RequestBody
@Valid
OrganizationManageDetailQueryReq
req
)
{
return
Mono
.
fromSupplier
(()
->
organizationManageService
.
getOrganizationDetail
(
req
));
return
Mono
.
fromSupplier
(()
->
organizationManageService
.
getOrganizationDetail
(
req
));
}
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/mapper/ApiAuthMapper.java
View file @
eeae9c4a
...
@@ -19,7 +19,7 @@ public interface ApiAuthMapper extends BaseMapper<ApiAuth> {
...
@@ -19,7 +19,7 @@ public interface ApiAuthMapper extends BaseMapper<ApiAuth> {
* @param req
* @param req
* @return
* @return
*/
*/
AuthInfoDto
selectAuthDetail
(
AuthDetailInfoReq
req
);
AuthInfoDto
selectAuthDetail
(
@Param
(
"req"
)
AuthDetailInfoReq
req
);
/**
/**
* 分页查询认证列表
* 分页查询认证列表
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiAuth.java
View file @
eeae9c4a
...
@@ -56,11 +56,11 @@ public class ApiAuth extends BaseObject implements Serializable {
...
@@ -56,11 +56,11 @@ public class ApiAuth extends BaseObject implements Serializable {
@TableField
(
"salt"
)
@TableField
(
"salt"
)
private
String
salt
;
private
String
salt
;
/**
/
//
**
* 组织id
//
* 组织id
*/
//
*/
@TableField
(
"org_id"
)
//
@TableField("org_id")
private
Long
orgId
;
//
private Long orgId;
/**
/**
* 授权方式:1.按次调用 2.按月调用 3.按季调用 4.按年调用
* 授权方式:1.按次调用 2.按月调用 3.按季调用 4.按年调用
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterface.java
View file @
eeae9c4a
...
@@ -93,5 +93,10 @@ public class ApiInterface extends BaseObject implements Serializable {
...
@@ -93,5 +93,10 @@ public class ApiInterface extends BaseObject implements Serializable {
*/
*/
@TableField
(
"is_test"
)
@TableField
(
"is_test"
)
private
Integer
isTest
;
private
Integer
isTest
;
/**
* 文件夹id
*/
@TableField
(
"file_id"
)
private
Long
fileId
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
View file @
eeae9c4a
...
@@ -25,16 +25,16 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
...
@@ -25,16 +25,16 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
/**
/**
*
api唯一标识
*
项目编号
*/
*/
@TableField
(
"
api_key
"
)
@TableField
(
"
project_id
"
)
private
String
apiKey
;
private
String
projectId
;
/**
/**
*
apiInterfaceId
*
文件来源:1 DMP 2 数据银行
*/
*/
@TableField
(
"
api_interface_id
"
)
@TableField
(
"
file_source
"
)
private
Long
apiInterfaceId
;
private
String
fileSource
;
/**
/**
* 文件类型
* 文件类型
...
@@ -47,6 +47,12 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
...
@@ -47,6 +47,12 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
*/
*/
@TableField
(
"file_name"
)
@TableField
(
"file_name"
)
private
String
fileName
;
private
String
fileName
;
/**
* 父类id
*/
@TableField
(
"parent_id"
)
private
String
parentId
;
/**
/**
* 文件英文名称
* 文件英文名称
*/
*/
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiReqLog.java
View file @
eeae9c4a
...
@@ -88,4 +88,9 @@ public class ApiReqLog extends BaseObject implements Serializable {
...
@@ -88,4 +88,9 @@ public class ApiReqLog 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
requestTime
;
private
Date
requestTime
;
/**
* 请求状态: SUCCEED 成功 ,FAIL 失败
*/
@TableField
(
"status"
)
private
String
status
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/dto/AuthInfoDto.java
View file @
eeae9c4a
...
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* @author ZC
* @author ZC
...
@@ -25,12 +24,15 @@ public class AuthInfoDto implements Serializable {
...
@@ -25,12 +24,15 @@ public class AuthInfoDto implements Serializable {
@ApiModelProperty
(
value
=
"授权组织id"
)
@ApiModelProperty
(
value
=
"授权组织id"
)
private
Long
apiOrgId
;
private
Long
apiOrgId
;
@ApiModelProperty
(
value
=
"api应用id"
)
/*
@ApiModelProperty(value = "api应用id")
private
Long
apiInterfaceId
;
private Long apiInterfaceId;
*/
@ApiModelProperty
(
value
=
"授权组织名称"
)
@ApiModelProperty
(
value
=
"授权组织名称"
)
private
String
orgName
;
private
String
orgName
;
@ApiModelProperty
(
value
=
"授权组织名称"
)
private
String
authCode
;
@ApiModelProperty
(
value
=
"apiKey"
)
@ApiModelProperty
(
value
=
"apiKey"
)
private
String
apiKey
;
private
String
apiKey
;
...
@@ -38,10 +40,10 @@ public class AuthInfoDto implements Serializable {
...
@@ -38,10 +40,10 @@ public class AuthInfoDto implements Serializable {
private
String
authMode
;
private
String
authMode
;
@ApiModelProperty
(
value
=
"开始时间"
)
@ApiModelProperty
(
value
=
"开始时间"
)
private
Date
validStartTime
;
private
String
validStartTime
;
@ApiModelProperty
(
value
=
"结束时间"
)
@ApiModelProperty
(
value
=
"结束时间"
)
private
Date
validEndTime
;
private
String
validEndTime
;
@ApiModelProperty
(
value
=
"状态(1-正常 2-作废"
)
@ApiModelProperty
(
value
=
"状态(1-正常 2-作废"
)
private
String
status
;
private
String
status
;
...
@@ -50,7 +52,7 @@ public class AuthInfoDto implements Serializable {
...
@@ -50,7 +52,7 @@ public class AuthInfoDto implements Serializable {
private
String
remark
;
private
String
remark
;
@ApiModelProperty
(
value
=
"创建时间"
)
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTim
e
;
private
String
createDat
e
;
@ApiModelProperty
(
value
=
"创建用户"
)
@ApiModelProperty
(
value
=
"创建用户"
)
private
String
createUser
;
private
String
createUser
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/AuthDmpUserApiReq.java
View file @
eeae9c4a
package
com
.
jz
.
dm
.
models
.
req
.
auth
;
package
com
.
jz
.
dm
.
models
.
req
.
auth
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthTypeEnum
;
import
com.jz.dm.common.enums.auth.AuthTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* @author ZC
* @author ZC
...
@@ -43,9 +46,14 @@ public class AuthDmpUserApiReq implements Serializable {
...
@@ -43,9 +46,14 @@ public class AuthDmpUserApiReq implements Serializable {
private
AuthModeEnum
authMode
;
private
AuthModeEnum
authMode
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
private
String
validStartTime
;
@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
)
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
false
)
private
String
validEndTime
;
@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
)
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
private
String
remark
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/AuthMallUserApiReq.java
View file @
eeae9c4a
package
com
.
jz
.
dm
.
models
.
req
.
auth
;
package
com
.
jz
.
dm
.
models
.
req
.
auth
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthTypeEnum
;
import
com.jz.dm.common.enums.auth.AuthTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* @author ZC
* @author ZC
...
@@ -46,9 +49,14 @@ public class AuthMallUserApiReq implements Serializable {
...
@@ -46,9 +49,14 @@ public class AuthMallUserApiReq implements Serializable {
private
AuthModeEnum
authMode
;
private
AuthModeEnum
authMode
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
private
String
validStartTime
;
@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
)
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
false
)
private
String
validEndTime
;
@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
)
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
private
String
remark
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/SaltResetReq.java
View file @
eeae9c4a
...
@@ -23,8 +23,8 @@ public class SaltResetReq implements Serializable {
...
@@ -23,8 +23,8 @@ public class SaltResetReq implements Serializable {
@NotNull
(
message
=
"id不能为空"
)
@NotNull
(
message
=
"id不能为空"
)
private
Long
id
;
private
Long
id
;
@ApiModelProperty
(
value
=
"盐值"
,
required
=
true
)
/*
@ApiModelProperty(value = "盐值",required = true)
@NotNull(message = "盐值不能为空")
@NotNull(message = "盐值不能为空")
private
String
salt
;
private String salt;
*/
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/ApiInterfaceReq.java
View file @
eeae9c4a
...
@@ -22,15 +22,15 @@ public class ApiInterfaceReq {
...
@@ -22,15 +22,15 @@ public class ApiInterfaceReq {
@NotNull
(
message
=
"api类型不能为空"
)
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
public
String
apiType
;
@ApiModelProperty
(
value
=
"apiId 等价于apiKey"
,
required
=
true
)
/*
@ApiModelProperty(value = "apiId 等价于apiKey",required = true)
@NotNull(message = "apiId不能为空")
@NotNull(message = "apiId不能为空")
public
String
apiId
;
public String apiId;
*/
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
public
String
apiDesc
;
/*
@ApiModelProperty(value = "api版本",required = false)
@ApiModelProperty(value = "api版本",required = false)
public
String
version
;
public String version;
*/
@ApiModelProperty
(
value
=
"传输方式"
,
required
=
true
)
@ApiModelProperty
(
value
=
"传输方式"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
@NotNull
(
message
=
"传输方式不能为空"
)
...
@@ -54,11 +54,11 @@ public class ApiInterfaceReq {
...
@@ -54,11 +54,11 @@ public class ApiInterfaceReq {
@ApiModelProperty
(
value
=
"列"
,
required
=
false
)
@ApiModelProperty
(
value
=
"列"
,
required
=
false
)
public
String
columnCode
;
public
String
columnCode
;
@ApiModelProperty
(
value
=
"api名称"
,
required
=
false
)
/*
@ApiModelProperty(value = "api名称",required = false)
public String apiName;
public String apiName;
*/
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
/*
@ApiModelProperty(value = "状态",required = false)
public
String
status
;
public String status;
*/
//@ApiModelProperty(value = "更新时传入api自增id",required = false)
//@ApiModelProperty(value = "更新时传入api自增id",required = false)
//public Long id;
//public Long id;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeBigDataApiReq.java
View file @
eeae9c4a
...
@@ -27,9 +27,9 @@ public class MakeBigDataApiReq implements Serializable {
...
@@ -27,9 +27,9 @@ public class MakeBigDataApiReq implements Serializable {
@NotNull
(
message
=
"apiType不能为空"
)
@NotNull
(
message
=
"apiType不能为空"
)
private
String
apiType
;
private
String
apiType
;
@ApiModelProperty
(
value
=
"apiId 等价于apiKey"
,
required
=
true
)
//
@ApiModelProperty(value = "apiId 等价于apiKey",required = true)
@NotNull
(
message
=
"apiId不能为空"
)
//
@NotNull(message = "apiId不能为空")
public
String
apiId
;
//
public String apiId;
@ApiModelProperty
(
value
=
"数据源Id"
,
required
=
true
)
@ApiModelProperty
(
value
=
"数据源Id"
,
required
=
true
)
@NotNull
(
message
=
"数据源Id不能为空"
)
@NotNull
(
message
=
"数据源Id不能为空"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeCustomApiReq.java
View file @
eeae9c4a
...
@@ -23,15 +23,15 @@ public class MakeCustomApiReq implements Serializable {
...
@@ -23,15 +23,15 @@ public class MakeCustomApiReq implements Serializable {
@NotNull
(
message
=
"api类型不能为空"
)
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
public
String
apiType
;
@ApiModelProperty
(
value
=
"apiId 等价于apiKey"
,
required
=
true
)
/*
@ApiModelProperty(value = "apiId 等价于apiKey",required = true)
@NotNull(message = "apiId不能为空")
@NotNull(message = "apiId不能为空")
public
String
apiId
;
public String apiId;
*/
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"api版本"
,
required
=
false
)
/*
@ApiModelProperty(value = "api版本",required = false)
public
String
version
;
public String version;
*/
@ApiModelProperty
(
value
=
"传输方式"
,
required
=
true
)
@ApiModelProperty
(
value
=
"传输方式"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
@NotNull
(
message
=
"传输方式不能为空"
)
...
@@ -55,8 +55,8 @@ public class MakeCustomApiReq implements Serializable {
...
@@ -55,8 +55,8 @@ public class MakeCustomApiReq implements Serializable {
@ApiModelProperty
(
value
=
"列"
,
required
=
false
)
@ApiModelProperty
(
value
=
"列"
,
required
=
false
)
public
String
columnCode
;
public
String
columnCode
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
/*
@ApiModelProperty(value = "状态",required = false)
public
String
status
;
public String status;
*/
@ApiModelProperty
(
value
=
"更新时传入api自增id"
,
required
=
false
)
@ApiModelProperty
(
value
=
"更新时传入api自增id"
,
required
=
false
)
public
Long
id
;
public
Long
id
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeDataBankApiReq.java
View file @
eeae9c4a
...
@@ -24,19 +24,19 @@ public class MakeDataBankApiReq implements Serializable {
...
@@ -24,19 +24,19 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull
(
message
=
"api类型不能为空"
)
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
public
String
apiType
;
@ApiModelProperty
(
value
=
"apiId 等价于apiKey
"
,
required
=
true
)
//@ApiModelProperty(value = "apiKey 等价于apiId
",required = true)
@NotNull
(
message
=
"apiId
不能为空"
)
//@NotNull(message = "apiKey
不能为空")
public
String
apiId
;
//public String apiKey
;
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"api版本"
,
required
=
false
)
//
@ApiModelProperty(value = "api版本",required = false)
public
String
version
;
//
public String version;
@ApiModelProperty
(
value
=
"传输方式(1为HTTPS,2为HTTP)"
,
required
=
true
)
@ApiModelProperty
(
value
=
"传输方式(1为HTTPS,2为HTTP)"
,
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
=
"加密方式不能为空"
)
...
@@ -66,4 +66,8 @@ public class MakeDataBankApiReq implements Serializable {
...
@@ -66,4 +66,8 @@ public class MakeDataBankApiReq implements Serializable {
@ApiModelProperty
(
value
=
"api样例"
,
required
=
false
)
@ApiModelProperty
(
value
=
"api样例"
,
required
=
false
)
public
String
apiExample
;
public
String
apiExample
;
@ApiModelProperty
(
value
=
"文件id"
,
required
=
false
)
//@NotNull(message = "文件id不能为空")
public
Long
fileId
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/resp/Auth
Mall
UserResponse.java
→
jz-dm-apigateway/src/main/java/com/jz/dm/models/resp/AuthUserResponse.java
View file @
eeae9c4a
...
@@ -10,14 +10,14 @@ import java.io.Serializable;
...
@@ -10,14 +10,14 @@ import java.io.Serializable;
* @author ZC
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.resp
* @PACKAGE_NAME: com.jz.dm.models.resp
* @PROJECT_NAME: jz-dm-parent
* @PROJECT_NAME: jz-dm-parent
* @NAME: Auth
Mall
UserResponse
* @NAME: AuthUserResponse
* @DATE: 2020-12-30/19:35
* @DATE: 2020-12-30/19:35
* @DAY_NAME_SHORT: 周三
* @DAY_NAME_SHORT: 周三
* @Description:
* @Description:
**/
**/
@Data
@Data
@ApiModel
@ApiModel
public
class
Auth
Mall
UserResponse
implements
Serializable
{
public
class
AuthUserResponse
implements
Serializable
{
@ApiModelProperty
(
value
=
"授权码"
)
@ApiModelProperty
(
value
=
"授权码"
)
public
String
authCode
;
public
String
authCode
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
View file @
eeae9c4a
...
@@ -18,12 +18,14 @@ import com.jz.dm.models.domian.ApiInterface;
...
@@ -18,12 +18,14 @@ 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.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.Auth
Mall
UserResponse
;
import
com.jz.dm.models.resp.AuthUserResponse
;
import
com.jz.dm.service.AuthService
;
import
com.jz.dm.service.AuthService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -59,7 +61,7 @@ public class AuthServiceImpl implements AuthService {
...
@@ -59,7 +61,7 @@ public class AuthServiceImpl implements AuthService {
public
Result
getAuthListInfo
(
AuthListInfoReq
req
)
{
public
Result
getAuthListInfo
(
AuthListInfoReq
req
)
{
IPage
<
AuthInfoDto
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
IPage
<
AuthInfoDto
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
AuthInfoDto
>
query
=
new
QueryWrapper
<>();
QueryWrapper
<
AuthInfoDto
>
query
=
new
QueryWrapper
<>();
query
.
orderByDesc
(
"create_date"
);
query
.
orderByDesc
(
"
au.
create_date"
);
IPage
<
AuthInfoDto
>
listSelectApiAuth
=
apiAuthMapper
.
listSelectApiAuth
(
page
,
query
);
IPage
<
AuthInfoDto
>
listSelectApiAuth
=
apiAuthMapper
.
listSelectApiAuth
(
page
,
query
);
return
Result
.
of_success
(
listSelectApiAuth
);
return
Result
.
of_success
(
listSelectApiAuth
);
}
}
...
@@ -82,7 +84,9 @@ public class AuthServiceImpl implements AuthService {
...
@@ -82,7 +84,9 @@ public class AuthServiceImpl implements AuthService {
* @return
* @return
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addDmpUserApiAuth
(
AuthDmpUserApiReq
req
)
{
public
Result
addDmpUserApiAuth
(
AuthDmpUserApiReq
req
)
{
AuthUserResponse
response
=
new
AuthUserResponse
();
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
if
(
null
==
apiInterface
)
{
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
return
Result
.
of_error
(
"api授权信息不存在!"
);
...
@@ -93,12 +97,12 @@ public class AuthServiceImpl implements AuthService {
...
@@ -93,12 +97,12 @@ public class AuthServiceImpl implements AuthService {
}
}
//授权验证
//授权验证
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
().
name
())
&&
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
().
name
())
&&
!
AuthTypeEnum
.
DMP_AUTH
.
name
().
equals
(
req
.
getAuthType
()))
{
!
AuthTypeEnum
.
DMP_AUTH
.
name
().
equals
(
req
.
getAuthType
()
.
name
()
))
{
return
Result
.
of_error
(
"授权类型错误!"
);
return
Result
.
of_error
(
"授权类型错误!"
);
}
}
//认证类型
//认证类型
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()
.
name
()
))
{
if
(
StringUtils
.
isBlank
(
req
.
getValidStartTime
())
||
StringUtils
.
isBlank
(
req
.
getValidEndTime
()
))
{
if
(
null
==
req
.
getValidStartTime
()
||
null
==
req
.
getValidEndTime
(
))
{
return
Result
.
of_error
(
"开始或结束时间不能为空!"
);
return
Result
.
of_error
(
"开始或结束时间不能为空!"
);
}
}
}
}
...
@@ -108,22 +112,26 @@ public class AuthServiceImpl implements AuthService {
...
@@ -108,22 +112,26 @@ public class AuthServiceImpl implements AuthService {
}
}
String
authCode
=
""
;
String
authCode
=
""
;
ApiAuth
apiAuth
=
new
ApiAuth
();
ApiAuth
apiAuth
=
new
ApiAuth
();
apiAuth
.
setAuthType
(
req
.
getAuthType
().
name
());
apiAuth
.
setAuthMode
(
req
.
getAuthMode
().
name
());
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
apiAuth
.
setApiOrgId
(
apiOrg
.
getId
());
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
}
}
/*else if (StringUtils.isNotBlank(req.getOrgType()) //外部组织
&& Constants.AUTH_OUT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode("", req.getUserId(),Constants.AUTH_OUT);
}*/
apiAuth
.
setAuthCode
(
authCode
);
//授权码
apiAuth
.
setAuthCode
(
authCode
);
//授权码
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setStatus
(
"1"
);
//授权状态
apiAuth
.
setStatus
(
"1"
);
//授权状态
apiAuth
.
setCreateUser
(
""
);
apiAuth
.
setRemark
(
req
.
getRemark
());
response
.
setAuthCode
(
authCode
);
response
.
setSalt
(
salt
);
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
);
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
,
response
);
}
}
return
Result
.
of_success
(
ResultMsg
.
FAILURE
);
return
Result
.
of_success
(
ResultMsg
.
FAILURE
);
}
}
...
@@ -135,8 +143,9 @@ public class AuthServiceImpl implements AuthService {
...
@@ -135,8 +143,9 @@ public class AuthServiceImpl implements AuthService {
* @return
* @return
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addMallUserApiAuth
(
AuthMallUserApiReq
req
)
{
public
Result
addMallUserApiAuth
(
AuthMallUserApiReq
req
)
{
Auth
MallUserResponse
response
=
new
AuthMall
UserResponse
();
Auth
UserResponse
response
=
new
Auth
UserResponse
();
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
if
(
null
==
apiInterface
)
{
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
return
Result
.
of_error
(
"api授权信息不存在!"
);
...
@@ -147,23 +156,26 @@ public class AuthServiceImpl implements AuthService {
...
@@ -147,23 +156,26 @@ public class AuthServiceImpl implements AuthService {
}
}
//授权验证
//授权验证
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
().
name
())
&&
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
().
name
())
&&
!
AuthTypeEnum
.
DATA_BANK_AUTH
.
name
().
equals
(
req
.
getAuthType
()))
{
!
AuthTypeEnum
.
DATA_BANK_AUTH
.
name
().
equals
(
req
.
getAuthType
()
.
name
()
))
{
return
Result
.
of_error
(
"授权类型错误!"
);
return
Result
.
of_error
(
"授权类型错误!"
);
}
}
//认证类型
//认证类型
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
RECORD_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
RECORD_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()
.
name
()
))
{
if
(
StringUtils
.
isBlank
(
req
.
getValidStartTime
())
||
StringUtils
.
isBlank
(
req
.
getValidEndTime
()
))
{
if
(
null
==
req
.
getValidStartTime
()
||
null
==
req
.
getValidEndTime
(
))
{
return
Result
.
of_error
(
"开始或结束时间不能为空!"
);
return
Result
.
of_error
(
"开始或结束时间不能为空!"
);
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()
.
name
()
))
{
return
Result
.
of_error
(
"授权类型错误!"
);
return
Result
.
of_error
(
"授权类型错误!"
);
}
}
String
authCode
=
""
;
String
authCode
=
""
;
ApiAuth
apiAuth
=
new
ApiAuth
();
ApiAuth
apiAuth
=
new
ApiAuth
();
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
apiAuth
.
setAuthType
(
req
.
getAuthType
().
name
());
apiAuth
.
setAuthMode
(
req
.
getAuthMode
().
name
());
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
apiAuth
.
setApiOrgId
(
apiOrg
.
getId
());
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
...
@@ -175,6 +187,8 @@ public class AuthServiceImpl implements AuthService {
...
@@ -175,6 +187,8 @@ public class AuthServiceImpl implements AuthService {
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setStatus
(
"1"
);
//授权状态
apiAuth
.
setStatus
(
"1"
);
//授权状态
apiAuth
.
setCreateUser
(
""
);
apiAuth
.
setRemark
(
req
.
getRemark
());
response
.
setAuthCode
(
authCode
);
response
.
setAuthCode
(
authCode
);
response
.
setSalt
(
salt
);
response
.
setSalt
(
salt
);
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
...
@@ -222,26 +236,27 @@ public class AuthServiceImpl implements AuthService {
...
@@ -222,26 +236,27 @@ public class AuthServiceImpl implements AuthService {
*/
*/
@Override
@Override
public
Result
updateSaltInfo
(
SaltResetReq
req
)
{
public
Result
updateSaltInfo
(
SaltResetReq
req
)
{
AuthUserResponse
response
=
new
AuthUserResponse
();
ApiAuth
apiAuth
=
apiAuthMapper
.
selectById
(
req
.
getId
());
ApiAuth
apiAuth
=
apiAuthMapper
.
selectById
(
req
.
getId
());
if
(
null
==
apiAuth
)
{
if
(
null
==
apiAuth
)
{
return
Result
.
of_error
(
"认证用户不存在"
);
return
Result
.
of_error
(
"认证用户不存在"
);
}
}
if
(
StringUtils
.
isNotBlank
(
req
.
getSalt
()))
{
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
UpdateWrapper
<
ApiAuth
>
update
=
new
UpdateWrapper
<>();
UpdateWrapper
<
ApiAuth
>
update
=
new
UpdateWrapper
<>();
update
.
set
(
"salt"
,
req
.
getSalt
()
);
update
.
set
(
"salt"
,
salt
);
update
.
set
(
"create_time"
,
new
Date
());
update
.
set
(
"create_time"
,
new
Date
());
update
.
set
(
"create_user"
,
""
);
update
.
set
(
"create_user"
,
""
);
update
.
eq
(
"id"
,
req
.
getId
());
update
.
eq
(
"id"
,
req
.
getId
());
if
(
apiAuthMapper
.
update
(
null
,
update
)
>
0
)
{
if
(
apiAuthMapper
.
update
(
null
,
update
)
>
0
)
{
re
turn
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
re
sponse
.
setSalt
(
salt
);
}
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
,
response
);
}
}
return
Result
.
of_success
(
ResultMsg
.
UPDATE_FAIL
);
return
Result
.
of_success
(
ResultMsg
.
UPDATE_FAIL
);
}
}
private
ApiInterface
getInterface
(
String
apiKey
)
{
private
ApiInterface
getInterface
(
String
apiKey
)
{
QueryWrapper
<
ApiInterface
>
queryInface
=
new
QueryWrapper
<>();
QueryWrapper
<
ApiInterface
>
queryInface
=
new
QueryWrapper
<>();
queryInface
.
last
(
"where is_deleted=0 and api_key =
"
+
apiKey
+
"
"
);
queryInface
.
last
(
"where is_deleted=0 and api_key =
'"
+
apiKey
+
"'
"
);
ApiInterface
apiInterface
=
apiInterfaceMapper
.
selectOne
(
queryInface
);
ApiInterface
apiInterface
=
apiInterfaceMapper
.
selectOne
(
queryInface
);
if
(
null
!=
apiInterface
)
{
if
(
null
!=
apiInterface
)
{
return
apiInterface
;
return
apiInterface
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
eeae9c4a
...
@@ -4,14 +4,16 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,14 +4,16 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.exceptions.ApiException
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jz.common.bean.SysUserDto
;
import
com.jz.common.bean.SysUserDto
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.exception.ResponseException
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.common.constant.TagConstants
;
import
com.jz.dm.common.constant.TagConstants
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.enums.apiInterface.ApiStatusEnum
;
import
com.jz.dm.common.util.RandomUtil
;
import
com.jz.dm.common.util.WebUtils
;
import
com.jz.dm.common.util.WebUtils
;
import
com.jz.dm.mapper.*
;
import
com.jz.dm.mapper.*
;
import
com.jz.dm.models.domian.*
;
import
com.jz.dm.models.domian.*
;
...
@@ -98,16 +100,13 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -98,16 +100,13 @@ public class ProducerServiceImpl implements ProducerService {
public
Result
addCustomApi
(
MakeCustomApiReq
req
)
{
public
Result
addCustomApi
(
MakeCustomApiReq
req
)
{
ApiInterfaceReq
makeBigDataApiReq
=
new
ApiInterfaceReq
();
ApiInterfaceReq
makeBigDataApiReq
=
new
ApiInterfaceReq
();
makeBigDataApiReq
.
setApiType
(
req
.
getApiType
());
makeBigDataApiReq
.
setApiType
(
req
.
getApiType
());
makeBigDataApiReq
.
setApiId
(
req
.
getApiId
());
makeBigDataApiReq
.
setApiDesc
(
req
.
getApiDesc
());
makeBigDataApiReq
.
setApiDesc
(
req
.
getApiDesc
());
makeBigDataApiReq
.
setVersion
(
req
.
getVersion
());
makeBigDataApiReq
.
setTransMode
(
req
.
getTransMode
());
makeBigDataApiReq
.
setTransMode
(
req
.
getTransMode
());
makeBigDataApiReq
.
setType
(
req
.
getType
());
makeBigDataApiReq
.
setType
(
req
.
getType
());
makeBigDataApiReq
.
setTargetUrl
(
req
.
getTargetUrl
());
makeBigDataApiReq
.
setTargetUrl
(
req
.
getTargetUrl
());
makeBigDataApiReq
.
setTimeout
(
req
.
getTimeout
());
makeBigDataApiReq
.
setTimeout
(
req
.
getTimeout
());
makeBigDataApiReq
.
setApiFunction
(
req
.
getApiFunction
());
makeBigDataApiReq
.
setApiFunction
(
req
.
getApiFunction
());
makeBigDataApiReq
.
setColumnCode
(
req
.
getColumnCode
());
makeBigDataApiReq
.
setColumnCode
(
req
.
getColumnCode
());
makeBigDataApiReq
.
setStatus
(
req
.
getStatus
());
return
saveInterfaceAPi
(
makeBigDataApiReq
);
return
saveInterfaceAPi
(
makeBigDataApiReq
);
}
}
...
@@ -119,18 +118,28 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -119,18 +118,28 @@ public class ProducerServiceImpl implements ProducerService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addDataBankApiInfo
(
MakeDataBankApiReq
req
)
{
public
Result
addDataBankApiInfo
(
MakeDataBankApiReq
req
)
{
List
<
ApiInterfaceFile
>
fileSource
=
apiInterfaceFileMapper
.
selectList
(
new
QueryWrapper
<
ApiInterfaceFile
>().
eq
(
"file_source"
,
"2"
));
if
(
fileSource
.
size
()
==
0
||
fileSource
.
size
()
>=
2
){
return
Result
.
of_error
(
"文件夹信息异常!"
);
}
if
(
StringUtils
.
isNotBlank
(
req
.
getApiType
())
if
(
StringUtils
.
isNotBlank
(
req
.
getApiType
())
&&
"2"
.
equals
(
req
.
getApiType
())){
//数据银行制作API
&&
"2"
.
equals
(
req
.
getApiType
())){
//数据银行制作API
ApiInterface
anInterface
=
new
ApiInterface
();
ApiInterface
anInterface
=
new
ApiInterface
();
anInterface
.
setCreateUser
(
""
);
anInterface
.
setCreateUser
(
""
);
anInterface
.
setStatus
(
"2"
);
//发布
anInterface
.
setSignType
(
req
.
getType
());
//加密类型
anInterface
.
setVersion
(
"1.0"
);
anInterface
.
setApiKey
(
RandomUtil
.
getStringRandom
(
16
));
//apiKey
anInterface
.
setFileId
(
fileSource
.
get
(
0
).
getId
());
BeanUtils
.
copyProperties
(
req
,
anInterface
);
BeanUtils
.
copyProperties
(
req
,
anInterface
);
int
resIn
=
apiInterfaceMapper
.
insert
(
anInterface
);
int
resIn
=
apiInterfaceMapper
.
insert
(
anInterface
);
ApiInterfaceCustom
interfaceCustom
=
new
ApiInterfaceCustom
();
ApiInterfaceCustom
interfaceCustom
=
new
ApiInterfaceCustom
();
interfaceCustom
.
setCreateUser
(
""
);
interfaceCustom
.
setCreateUser
(
""
);
interfaceCustom
.
setApiInterfaceId
(
anInterface
.
getId
());
BeanUtils
.
copyProperties
(
req
,
interfaceCustom
);
BeanUtils
.
copyProperties
(
req
,
interfaceCustom
);
int
resOut
=
apiInterfaceCustomMapper
.
insert
(
interfaceCustom
);
int
resOut
=
apiInterfaceCustomMapper
.
insert
(
interfaceCustom
);
if
(
resOut
==
0
||
resIn
<
0
){
if
(
resOut
==
0
||
resIn
==
0
){
throw
new
ApiException
(
"保存信息
!"
);
throw
ResponseException
.
of_error
(
"保存信息失败
!"
);
}
}
}
else
if
(
StringUtils
.
isNotBlank
(
req
.
getApiType
())
}
else
if
(
StringUtils
.
isNotBlank
(
req
.
getApiType
())
&&
"3"
.
equals
(
req
.
getApiType
())){
//数据银行制作数据包
&&
"3"
.
equals
(
req
.
getApiType
())){
//数据银行制作数据包
...
@@ -139,15 +148,12 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -139,15 +148,12 @@ public class ProducerServiceImpl implements ProducerService {
}
}
ApiInterfaceReq
makeBigDataApiReq
=
new
ApiInterfaceReq
();
ApiInterfaceReq
makeBigDataApiReq
=
new
ApiInterfaceReq
();
makeBigDataApiReq
.
setApiType
(
req
.
getApiType
());
makeBigDataApiReq
.
setApiType
(
req
.
getApiType
());
makeBigDataApiReq
.
setApiId
(
req
.
getApiId
());
makeBigDataApiReq
.
setApiDesc
(
req
.
getApiDesc
());
makeBigDataApiReq
.
setApiDesc
(
req
.
getApiDesc
());
makeBigDataApiReq
.
setVersion
(
req
.
getVersion
());
makeBigDataApiReq
.
setTransMode
(
req
.
getApiProtocl
());
makeBigDataApiReq
.
setTransMode
(
req
.
getTransMode
());
makeBigDataApiReq
.
setType
(
req
.
getType
());
makeBigDataApiReq
.
setType
(
req
.
getType
());
makeBigDataApiReq
.
setTargetUrl
(
req
.
getTargetUrl
());
makeBigDataApiReq
.
setTargetUrl
(
req
.
getTargetUrl
());
makeBigDataApiReq
.
setTimeout
(
req
.
getTimeout
());
makeBigDataApiReq
.
setTimeout
(
req
.
getTimeout
());
makeBigDataApiReq
.
setApiFunction
(
req
.
getApiFunction
());
makeBigDataApiReq
.
setApiFunction
(
req
.
getApiFunction
());
makeBigDataApiReq
.
setStatus
(
"1"
);
saveInterfaceAPi
(
makeBigDataApiReq
);
saveInterfaceAPi
(
makeBigDataApiReq
);
}
}
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
...
@@ -209,7 +215,7 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -209,7 +215,7 @@ public class ProducerServiceImpl implements ProducerService {
}
}
ApiSyncingDatasource
dataSource
=
apiSyncingDatasourceMapper
.
selectById
(
req
.
getEsDataSource
());
ApiSyncingDatasource
dataSource
=
apiSyncingDatasourceMapper
.
selectById
(
req
.
getEsDataSource
());
//api信息在redis中的key
//api信息在redis中的key
String
redisValueOfKey
=
req
.
getApiId
(
);
String
redisValueOfKey
=
RandomUtil
.
getStringRandom
(
16
);
if
(
null
!=
dataSource
)
{
if
(
null
!=
dataSource
)
{
redisTemplate
.
opsForValue
().
set
(
TagConstants
.
OPEN_API_HANDLER_INFO_NAMESPACE
+
redisValueOfKey
,
req
.
getHandleType
());
redisTemplate
.
opsForValue
().
set
(
TagConstants
.
OPEN_API_HANDLER_INFO_NAMESPACE
+
redisValueOfKey
,
req
.
getHandleType
());
//es相关信息
//es相关信息
...
@@ -237,21 +243,19 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -237,21 +243,19 @@ public class ProducerServiceImpl implements ProducerService {
}
}
/**
/**
*
*
保存api基本信息
* @param req
* @param req
* @return
* @return
*/
*/
@Override
@Override
public
Result
saveInterfaceAPi
(
ApiInterfaceReq
req
)
{
public
Result
saveInterfaceAPi
(
ApiInterfaceReq
req
)
{
ApiInterface
apiInterface
=
new
ApiInterface
();
ApiInterface
apiInterface
=
new
ApiInterface
();
apiInterface
.
setApiKey
(
req
.
getApiId
());
apiInterface
.
setApiKey
(
RandomUtil
.
getStringRandom
(
16
));
apiInterface
.
setApiName
(
req
.
getApiName
());
apiInterface
.
setApiDesc
(
req
.
getApiDesc
());
apiInterface
.
setApiDesc
(
req
.
getApiDesc
());
apiInterface
.
setApiProtocl
(
req
.
getTransMode
());
//传输方式 https http
apiInterface
.
setApiProtocl
(
req
.
getTransMode
());
//传输方式 https http
apiInterface
.
setTargetUrl
(
req
.
getTargetUrl
());
apiInterface
.
setTargetUrl
(
req
.
getTargetUrl
());
apiInterface
.
setStatus
(
req
.
getStatus
());
apiInterface
.
setStatus
(
"2"
);
//发布
apiInterface
.
setApiFunction
(
req
.
getApiFunction
());
apiInterface
.
setApiFunction
(
req
.
getApiFunction
());
apiInterface
.
setVersion
(
req
.
getVersion
());
apiInterface
.
setSignType
(
req
.
getType
());
//加密方式
apiInterface
.
setSignType
(
req
.
getType
());
//加密方式
apiInterface
.
setApiType
(
req
.
getApiType
());
//api类型
apiInterface
.
setApiType
(
req
.
getApiType
());
//api类型
// apiInterface.setCreateUser(currentUser.getUserName());
// apiInterface.setCreateUser(currentUser.getUserName());
...
@@ -263,15 +267,14 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -263,15 +267,14 @@ public class ProducerServiceImpl implements ProducerService {
}
else
if
(
timeout
>
maxTimeout
)
{
}
else
if
(
timeout
>
maxTimeout
)
{
return
Result
.
of_success
(
"接口超时时间最大5000ms"
);
return
Result
.
of_success
(
"接口超时时间最大5000ms"
);
}
}
apiInterface
.
setTimeout
(
req
.
getTimeout
());
int
res
=
apiInterfaceMapper
.
insert
(
apiInterface
);
int
res
=
apiInterfaceMapper
.
insert
(
apiInterface
);
if
(
res
==
0
){
if
(
res
==
0
){
throw
new
RuntimeException
(
ResultMsg
.
UPDATE_FAIL
.
getMsg
()
);
throw
ResponseException
.
of_error
(
"保存Api信息失败!"
);
}
}
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
}
}
/**
/**
* 保存修改的api信息
* 保存修改的api信息
*
*
...
@@ -280,10 +283,10 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -280,10 +283,10 @@ public class ProducerServiceImpl implements ProducerService {
*/
*/
@Override
@Override
public
Result
saveUpdateAPiInfo
(
MakeApiSaveInfoReq
req
)
{
public
Result
saveUpdateAPiInfo
(
MakeApiSaveInfoReq
req
)
{
//
SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS);
SysUserDto
currentUser
=
(
SysUserDto
)
redisTemplate
.
opsForValue
().
get
(
"user"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_SYS
);
//
if (null == currentUser){
if
(
null
==
currentUser
){
//
return Result.of_error(ResultMsg.USER_NOT_EXIST);
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
//
}
}
ApiInterface
apiInterface
=
apiInterfaceMapper
.
selectById
(
req
.
getId
());
ApiInterface
apiInterface
=
apiInterfaceMapper
.
selectById
(
req
.
getId
());
if
(
null
==
apiInterface
)
{
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_FOUND
);
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_FOUND
);
...
@@ -320,6 +323,7 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -320,6 +323,7 @@ public class ProducerServiceImpl implements ProducerService {
return
Result
.
of_success
(
"接口超时时间最大5000ms"
);
return
Result
.
of_success
(
"接口超时时间最大5000ms"
);
}
}
apiInterface
.
setUpdateDate
(
new
Date
());
apiInterface
.
setUpdateDate
(
new
Date
());
apiInterface
.
setTimeout
(
req
.
getTimeout
());
//apiInterface.setUpdateUser(currentUser.getUserName());
//apiInterface.setUpdateUser(currentUser.getUserName());
int
result
=
apiInterfaceMapper
.
updateById
(
apiInterface
);
int
result
=
apiInterfaceMapper
.
updateById
(
apiInterface
);
if
(
result
>
0
)
{
if
(
result
>
0
)
{
...
...
jz-dm-apigateway/src/main/resources/mapper/ApiAuthMapper.xml
View file @
eeae9c4a
...
@@ -11,12 +11,20 @@
...
@@ -11,12 +11,20 @@
SELECT au.id AS id,
SELECT au.id AS id,
au.api_org_id AS apiOrgId,
au.api_org_id AS apiOrgId,
au.api_interface_id AS apiInterFace,
au.api_interface_id AS apiInterFace,
au.auth_mode AS authMode,
(CASE au.auth_mode
au.valid_start_time AS validStartTime,
WHEN 'RECORD_TIME_MODE' THEN '按时间调用'
au.valid_end_time AS validEndTime,
WHEN 'PERMANENT_TIME_MODE' THEN '永久有效'
au.status AS status,
WHEN 'POWER_CALL_MODE' THEN '按次调用'
END) AS authMode,
au.auth_code AS authCode,
DATE_FORMAT(au.valid_start_time,'%Y-%m-%d %H:%i:%s') AS validStartTime,
DATE_FORMAT(au.valid_end_time,'%Y-%m-%d %H:%i:%s') AS validEndTime,
(CASE au.status
WHEN '1' THEN '正常'
WHEN '2' THEN '作废'
END) AS status,
au.remark AS remark,
au.remark AS remark,
au.create_time
AS createDate,
DATE_FORMAT(au.create_date,'%Y-%m-%d %H:%i:%s')
AS createDate,
au.create_user AS createUser,
au.create_user AS createUser,
ao.org_name AS orgName,
ao.org_name AS orgName,
ai.api_key AS apiKey
ai.api_key AS apiKey
...
@@ -24,19 +32,27 @@
...
@@ -24,19 +32,27 @@
JOIN t_api_interface AS ai ON au.api_interface_id = ai.id AND ai.is_deleted =0 AND ai.`status` ='2'
JOIN t_api_interface AS ai ON au.api_interface_id = ai.id AND ai.is_deleted =0 AND ai.`status` ='2'
JOIN t_api_org AS ao ON au.api_org_id = ao.id AND ao.`status` ='1' AND ao.is_deleted =0
JOIN t_api_org AS ao ON au.api_org_id = ao.id AND ao.`status` ='1' AND ao.is_deleted =0
WHERE au.is_deleted =0
WHERE au.is_deleted =0
AND au.id =#{req.
getI
d}
AND au.id =#{req.
i
d}
</select>
</select>
<select
id=
"listSelectApiAuth"
resultType=
"com.jz.dm.models.dto.AuthInfoDto"
>
<select
id=
"listSelectApiAuth"
resultType=
"com.jz.dm.models.dto.AuthInfoDto"
>
SELECT au.id AS id,
SELECT au.id AS id,
au.api_org_id AS apiOrgId,
au.api_org_id AS apiOrgId,
au.api_interface_id AS apiInterFace,
au.api_interface_id AS apiInterFace,
au.auth_mode AS authMode,
(CASE au.auth_mode
au.valid_start_time AS validStartTime,
WHEN 'RECORD_TIME_MODE' THEN '按时间调用'
au.valid_end_time AS validEndTime,
WHEN 'PERMANENT_TIME_MODE' THEN '永久有效'
au.status AS status,
WHEN 'POWER_CALL_MODE' THEN '按次调用'
END) AS authMode,
au.auth_code AS authCode,
DATE_FORMAT(au.valid_start_time,'%Y-%m-%d %H:%i:%s') AS validStartTime,
DATE_FORMAT(au.valid_end_time,'%Y-%m-%d %H:%i:%s') AS validEndTime,
(CASE au.status
WHEN '1' THEN '正常'
WHEN '2' THEN '作废'
END) AS status,
au.remark AS remark,
au.remark AS remark,
au.create_time
AS createDate,
DATE_FORMAT(au.create_date,'%Y-%m-%d %H:%i:%s')
AS createDate,
au.create_user AS createUser,
au.create_user AS createUser,
ao.org_name AS orgName,
ao.org_name AS orgName,
ai.api_key AS apiKey
ai.api_key AS apiKey
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/
org
/TestAuth.java
→
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/
auth
/TestAuth.java
View file @
eeae9c4a
package
com
.
jz
.
dm
.
gateway
.
org
;
package
com
.
jz
.
dm
.
gateway
.
auth
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.service.AuthService
;
import
com.jz.dm.service.AuthService
;
...
...
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