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
7bf63f95
Commit
7bf63f95
authored
Jan 02, 2021
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化认证,授权,制作api接口
parent
5110bf16
Changes
38
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
653 additions
and
350 deletions
+653
-350
api_gateway.sql
database/zc/api_gateway.sql
+7
-5
BaseCurrentUserObject.java
...ain/java/com/jz/dm/common/base/BaseCurrentUserObject.java
+12
-13
ApiStatusEnum.java
...va/com/jz/dm/common/enums/apiInterface/ApiStatusEnum.java
+1
-1
AuthModeEnum.java
...c/main/java/com/jz/dm/common/enums/auth/AuthModeEnum.java
+1
-1
OrgStatusEnum.java
...c/main/java/com/jz/dm/common/enums/org/OrgStatusEnum.java
+36
-0
ProducerStatusTypeEnum.java
...om/jz/dm/common/enums/produce/ProducerStatusTypeEnum.java
+37
-0
RandomUtil.java
...teway/src/main/java/com/jz/dm/common/util/RandomUtil.java
+34
-5
ApiDirectionController.java
...ain/java/com/jz/dm/controller/ApiDirectionController.java
+14
-2
ApiLogController.java
.../src/main/java/com/jz/dm/controller/ApiLogController.java
+1
-1
AuthController.java
...ay/src/main/java/com/jz/dm/controller/AuthController.java
+4
-4
OrganizationManageController.java
...va/com/jz/dm/controller/OrganizationManageController.java
+0
-3
ProducerController.java
...rc/main/java/com/jz/dm/controller/ProducerController.java
+9
-9
ApiAuthMapper.java
...gateway/src/main/java/com/jz/dm/mapper/ApiAuthMapper.java
+1
-1
ApiDirection.java
...y/src/main/java/com/jz/dm/models/domian/ApiDirection.java
+39
-6
ApiInterface.java
...y/src/main/java/com/jz/dm/models/domian/ApiInterface.java
+10
-0
ApiInterfaceFile.java
...c/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
+3
-3
ApiOrg.java
...gateway/src/main/java/com/jz/dm/models/domian/ApiOrg.java
+1
-1
ApiReqLog.java
...eway/src/main/java/com/jz/dm/models/domian/ApiReqLog.java
+64
-2
AuthDmpUserApiReq.java
...ain/java/com/jz/dm/models/req/auth/AuthDmpUserApiReq.java
+5
-7
AuthUserApiReq.java
...c/main/java/com/jz/dm/models/req/auth/AuthUserApiReq.java
+9
-11
ApiInterfaceReq.java
.../main/java/com/jz/dm/models/req/make/ApiInterfaceReq.java
+15
-6
MakeCustomApiReq.java
...main/java/com/jz/dm/models/req/make/MakeCustomApiReq.java
+0
-63
MakeDataBankApiReq.java
...in/java/com/jz/dm/models/req/make/MakeDataBankApiReq.java
+15
-11
OrganizationManageAddReq.java
...dels/req/organizationManage/OrganizationManageAddReq.java
+3
-7
OrganizationManageUpdateReq.java
...s/req/organizationManage/OrganizationManageUpdateReq.java
+9
-2
ApiDirectionService.java
.../src/main/java/com/jz/dm/service/ApiDirectionService.java
+10
-2
AuthService.java
...igateway/src/main/java/com/jz/dm/service/AuthService.java
+2
-2
ProducerService.java
...eway/src/main/java/com/jz/dm/service/ProducerService.java
+1
-1
ApiDirectionServiceImpl.java
.../java/com/jz/dm/service/impl/ApiDirectionServiceImpl.java
+23
-4
ApiLogServiceImpl.java
...c/main/java/com/jz/dm/service/impl/ApiLogServiceImpl.java
+1
-0
AuthServiceImpl.java
...src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
+79
-69
OrganizationManageImpl.java
...n/java/com/jz/dm/service/impl/OrganizationManageImpl.java
+29
-19
ProducerServiceImpl.java
...main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
+88
-77
application-test.yml
jz-dm-apigateway/src/main/resources/application-test.yml
+1
-1
ApiAuthMapper.xml
jz-dm-apigateway/src/main/resources/mapper/ApiAuthMapper.xml
+10
-10
TestOrganizationManage.java
...st/java/com/jz/dm/gateway/org/TestOrganizationManage.java
+0
-1
TestMakeApi.java
...y/src/test/java/com/jz/dm/gateway/orther/TestMakeApi.java
+44
-0
TestRedisUserSave.java
...test/java/com/jz/dm/gateway/orther/TestRedisUserSave.java
+35
-0
No files found.
database/zc/api_gateway.sql
View file @
7bf63f95
...
...
@@ -9,6 +9,8 @@ CREATE TABLE `t_api_interface` (
`target_url`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'目标url'
,
`api_type`
varchar
(
50
)
NULL
DEFAULT
''
COMMENT
'api类型:1 实时接入 2 数据银行制作API, 3 数据银行制作数据包 6标签查询 9自定义'
,
`api_function`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'接口功能'
,
`join_type`
varchar
(
50
)
NULL
DEFAULT
NULL
COMMENT
'接入类型:字典表对应key值'
,
`test_example`
varchar
(
255
)
NULL
DEFAULT
NULL
COMMENT
'测试实例'
;
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)'
,
`version`
varchar
(
20
)
DEFAULT
'1.0'
COMMENT
'版本号'
,
`sign_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'加密方式: MD5 RSA'
,
...
...
@@ -52,10 +54,10 @@ CREATE TABLE `t_api_interface_file` (
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api文件表自增ID'
,
`project_id`
bigint
(
20
)
NOT
NULL
COMMENT
'项目编号'
,
`file_source`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件来源:,1 dmp, 2 数据银行'
,
`file_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件类型
'
,
`file_type`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'文件类型:1 文件夹 ,2 文件
'
,
`file_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件名称'
,
`file_en_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件英文名称'
,
`parent_id`
bigint
(
20
)
NO
T
NULL
COMMENT
'父类id'
,
`parent_id`
bigint
(
20
)
DEFAUL
T
NULL
COMMENT
'父类id'
,
`status`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'VALID 有效,UNVALID 无效'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
...
...
@@ -76,7 +78,7 @@ CREATE TABLE `t_api_org` (
`org_cn_name`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'组织英文名称'
,
`org_phone`
varchar
(
20
)
NULL
DEFAULT
NULL
COMMENT
'组织电话'
,
`org_type`
varchar
(
20
)
NULL
DEFAULT
NULL
COMMENT
'组织类型:OUT 外部组织, IN 内部组织'
,
`status`
varchar
(
100
)
NOT
NULL
COMMENT
'状态(1-正常 2-冻结 3-下架
)'
,
`status`
varchar
(
100
)
NOT
NULL
COMMENT
'状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销
)'
,
`org_mail`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'组织邮箱'
,
`org_sort`
int
(
10
)
DEFAULT
'999'
COMMENT
'组织排序'
,
`parent_id`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'父类组织编码'
,
...
...
@@ -103,7 +105,7 @@ CREATE TABLE `t_api_auth` (
`auth_mode`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用 PERMANENT_TIME_MODE 永久有效'
,
`valid_start_time`
datetime
DEFAULT
NULL
COMMENT
'开始时间'
,
`valid_end_time`
datetime
DEFAULT
NULL
COMMENT
'结束时间'
,
`status`
varchar
(
100
)
NOT
NULL
COMMENT
'状态(1-正常 2-作废
)'
,
`status`
varchar
(
50
)
NOT
NULL
COMMENT
'状态(VALID-正常 UN_VALID-无效
)'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`create_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'创建人'
,
...
...
@@ -256,7 +258,7 @@ CREATE TABLE `t_api_direction` (
`parent`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'父节点'
,
`direction_type`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'字典类型'
,
`level`
int
(
10
)
DEFAULT
NULL
COMMENT
'等级'
,
`is_enabled`
char
(
1
)
DEFAULT
NULL
COMMENT
'是否
启用'
,
`is_enabled`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'是否启用:UNABLE 停用,ENABLE
启用'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`create_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'创建人'
,
`is_deleted`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'是否删除'
,
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/base/BaseCurrentUserObject.java
View file @
7bf63f95
package
com
.
jz
.
dm
.
common
.
base
;
import
com.jz.common.bean.SysUserDto
;
import
com.jz.common.constant.RedisMessageConstant
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
/**
* @author ZC
...
...
@@ -13,28 +14,26 @@ import org.springframework.data.redis.core.RedisTemplate;
* @DAY_NAME_SHORT: 周三
* @Description: 获取当前登录用户
**/
@Component
public
class
BaseCurrentUserObject
{
private
static
RedisTemplate
<
String
,
Object
>
REDIS
=
new
RedisTemplate
();
private
volatile
static
SysUserDto
sysUserDto
;
@Autowired
private
RedisTemplate
redisTemplate
;
private
BaseCurrentUserObject
()
{
}
/**
* 获取登录用户
*
* @return
*/
public
static
SysUserDto
getUserInfo
()
{
if
(
sysUserDto
==
null
)
{
synchronized
(
SysUserDto
.
class
)
{
if
(
sysUserDto
==
null
)
{
sysUserDto
=
(
SysUserDto
)
REDIS
.
opsForValue
().
get
(
"USER"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_SYS
);
}
}
}
public
SysUserDto
getUserInfo
()
{
SysUserDto
sysUserDto
=
(
SysUserDto
)
redisTemplate
.
opsForValue
().
get
(
"USER"
+
"004"
);
//RedisMessageConstant.SENDTYPE_LOGIN_SYS);
return
sysUserDto
;
}
//SysUserDto currentUser = (SysUserDto)
// redisTemplate.opsForValue().get("user" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
/*public static void main(String[] args) {
System.out.println(new BaseCurrentUserObject().getUserInfo());
}*/
}
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/apiInterface/ApiStatusEnum.java
View file @
7bf63f95
...
...
@@ -42,7 +42,7 @@ public enum ApiStatusEnum {
return
text
;
}
public
static
ApiStatusEnum
from
Type
Name
(
String
typeName
)
{
public
static
ApiStatusEnum
from
ApiStatus
Name
(
String
typeName
)
{
for
(
ApiStatusEnum
type
:
ApiStatusEnum
.
values
())
{
if
(
type
.
name
().
equals
(
typeName
))
{
return
type
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/auth/AuthModeEnum.java
View file @
7bf63f95
...
...
@@ -35,7 +35,7 @@ public enum AuthModeEnum {
return
text
;
}
public
static
AuthModeEnum
fromTypeName
(
String
typeName
)
{
public
static
AuthModeEnum
fromType
Mode
Name
(
String
typeName
)
{
for
(
AuthModeEnum
type
:
AuthModeEnum
.
values
())
{
if
(
type
.
name
().
equals
(
typeName
))
{
return
type
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/org/OrgStatusEnum.java
0 → 100644
View file @
7bf63f95
package
com
.
jz
.
dm
.
common
.
enums
.
org
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums.org
* @PROJECT_NAME: jz-dm-parent
* @NAME: OrgStatusEnum
* @DATE: 2021-1-1/11:17
* @DAY_NAME_SHORT: 周五
* @Description:
**/
public
enum
OrgStatusEnum
{
NORMAL
(
"正常"
),
FREEZE
(
"冻结"
),
CANCEL
(
"注销"
);
private
String
text
;
OrgStatusEnum
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getText
()
{
return
text
;
}
public
static
OrgStatusEnum
fromTypeName
(
String
typeName
)
{
for
(
OrgStatusEnum
type
:
OrgStatusEnum
.
values
())
{
if
(
type
.
name
().
equals
(
typeName
))
{
return
type
;
}
}
return
null
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/produce/ProducerStatusTypeEnum.java
0 → 100644
View file @
7bf63f95
package
com
.
jz
.
dm
.
common
.
enums
.
produce
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums.produce
* @PROJECT_NAME: jz-dm-parent
* @NAME: ProducerStatusTypeEnum
* @DATE: 2021-1-1/18:04
* @DAY_NAME_SHORT: 周五
* @Description:
**/
public
enum
ProducerStatusTypeEnum
{
DRAFT
(
"草稿"
),
ISSUE
(
"发布"
),
OUTMODED
(
"过时"
),
FREEZE
(
"冻结"
),
EXPIRY
(
"失效"
);
private
String
text
;
ProducerStatusTypeEnum
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getText
()
{
return
text
;
}
public
static
ProducerStatusTypeEnum
fromTypeName
(
String
typeName
)
{
for
(
ProducerStatusTypeEnum
type
:
ProducerStatusTypeEnum
.
values
())
{
if
(
type
.
name
().
equals
(
typeName
))
{
return
type
;
}
}
return
null
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/RandomUtil.java
View file @
7bf63f95
...
...
@@ -65,11 +65,11 @@ public class RandomUtil {
log
.
info
(
"----------生成组织编码内容或类型不存在--------------"
);
return
""
;
}
boolean
chineseWord
=
isChineseWord
(
content
);
/*
boolean chineseWord = isChineseWord(content);
if (!chineseWord) {
log.info("----------编码中不能出现英文或者字母--------------");
return "";
}
}
*/
StringBuilder
builder
=
new
StringBuilder
();
if
(
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
type
))
{
builder
.
append
(
"NEI"
);
...
...
@@ -126,12 +126,12 @@ public class RandomUtil {
}
coding
=
getCodeInfo
(
userId
,
coding
,
builder
,
month
,
day
,
hour
,
minute
,
second
);
}
return
coding
;
}
/**
* 拼接内部/外部授权码
*
* @param orgCode
* @param coding
* @param builder
...
...
@@ -262,6 +262,34 @@ public class RandomUtil {
return
str
;
}
/**
* 生成指定版本号
* @param version 旧版本号
* @return
*/
public
static
String
generateVersion
(
String
version
)
{
StringBuilder
builder
=
new
StringBuilder
();
if
(
StringUtils
.
isNotBlank
(
version
))
{
String
[]
split
=
version
.
substring
(
1
).
split
(
"\\."
);
Integer
one
=
Integer
.
parseInt
(
split
[
0
]);
Integer
two
=
Integer
.
parseInt
(
split
[
1
]);
if
(
two
+
1
==
100
)
{
one
=
one
+
1
;
two
=
0
;
}
else
if
(
two
<
100
)
{
two
=
two
+
1
;
}
builder
.
append
(
"v"
);
builder
.
append
(
one
.
toString
());
builder
.
append
(
"."
);
builder
.
append
(
two
.
toString
());
}
else
{
return
""
;
}
return
builder
.
toString
();
}
public
static
void
main
(
String
[]
args
)
{
//System.out.println(getStringRandom(8));
// System.out.println("获取拼音首字母:"+getAllFirstLetter("大中国南昌中大china"));
...
...
@@ -269,7 +297,8 @@ public class RandomUtil {
//System.out.println(generateOrgCoding("九章数据","INT"));
// System.out.println(generateTokenCode("", ""));
//System.out.println(addZeroForNum("1", 8));
System
.
out
.
println
(
"内部授权码:"
+
generateTokenCode
(
"INT"
,
"NEIJZSJ900hx"
,
""
));
//内部授权码
System
.
out
.
println
(
"外部授权码:"
+
generateTokenCode
(
"OUT"
,
""
,
"199"
));
//内部授权码
//System.out.println("内部授权码:" + generateTokenCode("INT", "NEIJZSJ900hx", ""));//内部授权码
//System.out.println("外部授权码:" + generateTokenCode("OUT", "", "199"));//内部授权码
System
.
out
.
println
(
generateVersion
(
"v1.99"
));
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ApiDirectionController.java
View file @
7bf63f95
...
...
@@ -36,7 +36,19 @@ public class ApiDirectionController {
*/
@ApiOperation
(
"api类型列表"
)
@PostMapping
(
value
=
"/getApiTypeList"
)
public
Mono
<
Result
>
getApiTypeList
(
@RequestParam
(
name
=
"type"
)
String
type
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiDirectionService
.
getApiType
(
type
)));
public
Mono
<
Result
>
getApiTypeList
(
@RequestParam
(
name
=
"parentCode"
)
String
parentCode
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiDirectionService
.
getApiType
(
parentCode
)));
}
/**
* @Description:查询某个类型的字典值
* @return: 查询某个类型的字典值
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation
(
"查询某个类型的字典值"
)
@PostMapping
(
value
=
"/getDirectionVal"
)
public
Mono
<
Result
>
getDirectionVal
(
@RequestParam
(
name
=
"code"
,
required
=
false
)
String
code
,
@RequestParam
(
name
=
"key"
,
required
=
false
)
String
key
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
apiDirectionService
.
getDirectionVal
(
key
,
code
)));
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ApiLogController.java
View file @
7bf63f95
...
...
@@ -26,7 +26,7 @@ import javax.validation.Valid;
**/
@RestController
@RequestMapping
(
"api/logging"
)
@Api
(
tags
=
"
授权认证
Controller"
)
@Api
(
tags
=
"
日志信息
Controller"
)
public
class
ApiLogController
{
@Autowired
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/AuthController.java
View file @
7bf63f95
...
...
@@ -39,7 +39,7 @@ public class AuthController {
*/
@ApiOperation
(
"商城用户API认证"
)
@PostMapping
(
value
=
"/mall-user-auth-api"
)
public
Mono
<
Result
>
authMallUserApi
(
@RequestBody
@Valid
Auth
Mall
UserApiReq
req
)
{
public
Mono
<
Result
>
authMallUserApi
(
@RequestBody
@Valid
AuthUserApiReq
req
)
{
return
Mono
.
fromSupplier
(()
->
authService
.
addMallUserApiAuth
(
req
));
}
/**
...
...
@@ -50,7 +50,7 @@ public class AuthController {
*/
@ApiOperation
(
"DMP用户API认证"
)
@PostMapping
(
value
=
"dmp-auth-api"
)
public
Mono
<
Result
>
authDmpUserApi
(
@RequestBody
@Valid
Auth
Dmp
UserApiReq
req
)
{
public
Mono
<
Result
>
authDmpUserApi
(
@RequestBody
@Valid
AuthUserApiReq
req
)
{
return
Mono
.
fromSupplier
(()
->
authService
.
addDmpUserApiAuth
(
req
));
}
/**
...
...
@@ -81,8 +81,8 @@ public class AuthController {
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation
(
"认证信息修改"
)
@PostMapping
(
value
=
"/update-auth-info"
)
//
@ApiOperation("认证信息修改")
//
@PostMapping(value = "/update-auth-info")
public
Mono
<
Result
>
updateAuthListInfo
(
@RequestBody
@Valid
AuthInfoUpdateReq
req
)
{
return
Mono
.
fromSupplier
(()
->
authService
.
updateAuthInfo
(
req
));
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/OrganizationManageController.java
View file @
7bf63f95
...
...
@@ -6,7 +6,6 @@ import com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq;
import
com.jz.dm.models.req.organizationManage.OrganizationManageListQueryReq
;
import
com.jz.dm.models.req.organizationManage.OrganizationManageUpdateReq
;
import
com.jz.dm.service.OrganizationManageService
;
import
com.jz.dm.web.annotation.AccessLimit
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -51,8 +50,6 @@ public class OrganizationManageController {
*/
@ApiOperation
(
"组织详情查询"
)
@PostMapping
(
value
=
"/getOrgDetail"
)
@AccessLimit
(
limit
=
1000
,
sec
=
1
)
//@ApiLogAspect
public
Mono
<
Result
>
getOrganizationDetail
(
@RequestBody
@Valid
OrganizationManageDetailQueryReq
req
)
{
return
Mono
.
fromSupplier
(()
->
organizationManageService
.
getOrganizationDetail
(
req
));
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ProducerController.java
View file @
7bf63f95
...
...
@@ -47,7 +47,7 @@ public class ProducerController {
*/
@ApiOperation
(
"Api制作(自定义)"
)
@PostMapping
(
value
=
"/addCustomApi"
)
public
Mono
<
Result
>
makeCustomApi
(
@RequestBody
@Valid
MakeCustomApi
Req
req
)
{
public
Mono
<
Result
>
makeCustomApi
(
@RequestBody
@Valid
ApiInterface
Req
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
addCustomApi
(
req
)));
}
...
...
@@ -59,7 +59,7 @@ public class ProducerController {
@ApiOperation
(
"Api制作(数据银行)"
)
@PostMapping
(
value
=
"/addDataBankApiInfo"
)
public
Mono
<
Result
>
addDataBankApiInfo
(
@RequestBody
@Valid
MakeDataBankApiReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
addDataBankApiInfo
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
addDataBankApiInfo
(
req
));
}
/**
...
...
@@ -81,7 +81,7 @@ public class ProducerController {
@ApiOperation
(
"Api制作(大数据查询/标签查询)"
)
@PostMapping
(
value
=
"/makeBigDataApi"
)
public
Mono
<
Result
>
bigDataMakeApi
(
@RequestBody
@Valid
MakeBigDataApiReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
addBigDataMakeApi
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
addBigDataMakeApi
(
req
));
}
/**
...
...
@@ -93,7 +93,7 @@ public class ProducerController {
@ApiOperation
(
"保存API基本信息"
)
@PostMapping
(
value
=
"/saveInterface"
)
public
Mono
<
Result
>
saveInsetInterface
(
@RequestBody
@Valid
ApiInterfaceReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
saveInterfaceAPi
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
saveInterfaceAPi
(
req
));
}
/**
* @Description:Api制作(大数据查询/标签查询)保存修改的api信息
...
...
@@ -104,7 +104,7 @@ public class ProducerController {
@ApiOperation
(
"保存修改的api信息"
)
@PostMapping
(
value
=
"/保存修改的api信息"
)
public
Mono
<
Result
>
saveUpdateAPiInfo
(
@RequestBody
@Valid
MakeApiSaveInfoReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
saveUpdateAPiInfo
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
saveUpdateAPiInfo
(
req
));
}
...
...
@@ -116,7 +116,7 @@ public class ProducerController {
@ApiOperation
(
"获取数据源配置"
)
@PostMapping
(
value
=
"/getSourceConfig"
)
public
Mono
<
Result
>
getSourceConfig
(
@RequestBody
@Valid
SourceConfigReq
req
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getSourceConfig
(
req
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
getSourceConfig
(
req
));
}
/**
* @Description:获取索引
...
...
@@ -126,7 +126,7 @@ public class ProducerController {
@ApiOperation
(
"获取索引"
)
@GetMapping
(
value
=
"/getIndicess"
)
public
Mono
<
Result
>
getSourceWarehouseList
(
@RequestParam
(
name
=
"id"
)
Long
id
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getSourceWarehouseList
(
id
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
getSourceWarehouseList
(
id
));
}
/**
* @Description:获取某个索引下的type
...
...
@@ -137,7 +137,7 @@ public class ProducerController {
@GetMapping
(
value
=
"/getIndicesTypes"
)
public
Mono
<
Result
>
getIndicesTypes
(
@RequestParam
(
name
=
"indices"
)
String
indices
,
@RequestParam
(
name
=
"id"
)
Long
id
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getIndicesTypes
(
indices
,
id
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
getIndicesTypes
(
indices
,
id
));
}
/**
* @Description:获取某个索引 type的fields
...
...
@@ -149,6 +149,6 @@ public class ProducerController {
public
Mono
<
Result
>
getIndicesTypesFields
(
@RequestParam
(
name
=
"indices"
)
String
indices
,
@RequestParam
(
name
=
"type"
)
String
type
,
@RequestParam
(
name
=
"id"
)
Long
id
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getIndicesTypesFields
(
indices
,
type
,
id
)
));
return
Mono
.
fromSupplier
(()
->
producerService
.
getIndicesTypesFields
(
indices
,
type
,
id
));
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/mapper/ApiAuthMapper.java
View file @
7bf63f95
...
...
@@ -19,7 +19,7 @@ public interface ApiAuthMapper extends BaseMapper<ApiAuth> {
* @param req
* @return
*/
AuthInfoDto
selectAuthDetail
(
@Param
(
"req"
)
AuthDetailInfoReq
req
);
AuthInfoDto
selectAuthDetail
(
AuthDetailInfoReq
req
);
/**
* 分页查询认证列表
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiDirection.java
View file @
7bf63f95
package
com
.
jz
.
dm
.
models
.
domian
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.jz.dm.common.base.BaseObject
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @Description:
...
...
@@ -20,24 +25,30 @@ import java.io.Serializable;
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@TableName
(
"t_api_direction"
)
public
class
ApiDirection
extends
BaseObject
implements
Serializable
{
public
class
ApiDirection
implements
Serializable
{
/**
* 主健ID
*/
@ApiModelProperty
(
"主健ID"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 字典key
*/
@TableField
(
"
key
"
)
@TableField
(
"
`key`
"
)
private
String
key
;
/**
* 字典value
*/
@TableField
(
"
value
"
)
@TableField
(
"
`value`
"
)
private
String
value
;
/**
* 字典编码
*/
@TableField
(
"
code
"
)
@TableField
(
"
`code`
"
)
private
String
code
;
/**
...
...
@@ -55,7 +66,7 @@ public class ApiDirection extends BaseObject implements Serializable {
/**
* is_enabled
*/
@TableField
(
"
level
"
)
@TableField
(
"
`level`
"
)
private
Integer
level
;
...
...
@@ -65,5 +76,27 @@ public class ApiDirection extends BaseObject implements Serializable {
@TableField
(
"is_enabled"
)
private
String
isEnabled
;
/**
* 创建日期
*/
@ApiModelProperty
(
"创建日期"
)
@TableField
(
"create_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createDate
;
/**
* 创建人
*/
@ApiModelProperty
(
"创建人"
)
@TableField
(
"create_user"
)
private
String
createUser
;
/**
* 是否删除
*/
@TableField
(
"is_deleted"
)
private
Integer
isDeleted
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterface.java
View file @
7bf63f95
...
...
@@ -58,6 +58,16 @@ public class ApiInterface extends BaseObject implements Serializable {
*/
@TableField
(
"target_url"
)
private
String
targetUrl
;
/**
* 接入类型:对应字典表key
*/
@TableField
(
"join_type"
)
private
String
joinType
;
/**
* 测试实例
*/
@TableField
(
"test_example"
)
private
String
testExample
;
/**
* 状态(1-草稿 2-发布 3-过时 4-冻结 5-失效)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
View file @
7bf63f95
...
...
@@ -28,7 +28,7 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
* 项目编号
*/
@TableField
(
"project_id"
)
private
Stri
ng
projectId
;
private
Lo
ng
projectId
;
/**
* 文件来源:1 DMP 2 数据银行
...
...
@@ -37,10 +37,10 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
private
String
fileSource
;
/**
* 文件类型
* 文件类型
:1 文件夹 ,2 文件
*/
@TableField
(
"file_type"
)
private
String
api
Type
;
private
String
file
Type
;
/**
* 文件名称
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiOrg.java
View file @
7bf63f95
...
...
@@ -57,7 +57,7 @@ public class ApiOrg extends BaseObject implements Serializable {
private
String
orgType
;
/**
* 状态(
1-正常 2-冻结 3-下架
)
* 状态(
NORMAL-正常 FREEZE-冻结 CANCEL-注销
)
*/
@TableField
(
"status"
)
private
String
status
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiReqLog.java
View file @
7bf63f95
package
com
.
jz
.
dm
.
models
.
domian
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.
jz.dm.common.base.BaseObject
;
import
com.
fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
...
...
@@ -23,7 +25,15 @@ import java.util.Date;
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@TableName
(
"t_api_req_log"
)
public
class
ApiReqLog
extends
BaseObject
implements
Serializable
{
public
class
ApiReqLog
implements
Serializable
{
/**
* 主健ID
*/
@ApiModelProperty
(
"主健ID"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 请求ip
...
...
@@ -93,4 +103,56 @@ public class ApiReqLog extends BaseObject implements Serializable {
*/
@TableField
(
"status"
)
private
String
status
;
/**
* 创建日期
*/
@ApiModelProperty
(
"创建日期"
)
@TableField
(
"create_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createDate
;
/**
* 创建人
*/
@ApiModelProperty
(
"创建人"
)
@TableField
(
"create_user"
)
private
String
createUser
;
/**
* 更新人
*/
@ApiModelProperty
(
"更新人"
)
@TableField
(
"update_user"
)
@JsonIgnore
private
String
updateUser
;
/**
* 更新日期
*/
@ApiModelProperty
(
"更新日期"
)
@TableField
(
"update_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonIgnore
private
Date
updateDate
;
/**
* 是否删除
*/
@TableField
(
"is_deleted"
)
@JsonIgnore
private
Integer
isDeleted
;
/**
* 备注
*/
@TableField
(
"remark"
)
@JsonIgnore
private
String
remark
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/AuthDmpUserApiReq.java
View file @
7bf63f95
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.AuthTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -16,7 +14,7 @@ import java.util.Date;
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: Auth
Mall
UserApiReq
* @NAME: AuthUserApiReq
* @DATE: 2020-12-26/15:52
* @DAY_NAME_SHORT: 周六
* @Description:
...
...
@@ -33,17 +31,17 @@ public class AuthDmpUserApiReq implements Serializable {
@NotNull
(
message
=
"组织编码不能为空"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"组织类型: INT 内部, OUT 外部"
,
required
=
true
)
/*
@ApiModelProperty(value = "组织类型: INT 内部, OUT 外部",required = true)
@NotNull(message = "组织类型不能为空")
private
String
orgType
;
private String orgType;
*/
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权"
,
required
=
true
)
@NotNull
(
message
=
"授权类型不能为空"
)
private
AuthTypeEnum
authType
;
private
String
authType
;
@ApiModelProperty
(
value
=
"授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效"
,
required
=
true
)
@NotNull
(
message
=
"授权方式不能为空"
)
private
AuthModeEnum
authMode
;
private
String
authMode
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/Auth
Mall
UserApiReq.java
→
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/AuthUserApiReq.java
View file @
7bf63f95
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.AuthTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -16,37 +14,37 @@ import java.util.Date;
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: Auth
Mall
UserApiReq
* @NAME: AuthUserApiReq
* @DATE: 2020-12-26/15:52
* @DAY_NAME_SHORT: 周六
* @Description:
**/
@Data
@ApiModel
(
"商城用户API认证"
)
public
class
Auth
Mall
UserApiReq
implements
Serializable
{
public
class
AuthUserApiReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"apiKey唯一标识"
,
required
=
true
)
@NotNull
(
message
=
"apiKey唯一标识不能为空"
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"组织类型: INT 内部, OUT 外部"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空"
)
private
String
orgType
;
//
@ApiModelProperty(value = "组织类型: INT 内部, OUT 外部",required = true)
//
@NotNull(message = "组织类型不能为空")
//
private String orgType;
@ApiModelProperty
(
value
=
"用户id"
,
required
=
false
)
@ApiModelProperty
(
value
=
"用户id
-- 数据银行认证时必传
"
,
required
=
false
)
private
String
userId
;
@ApiModelProperty
(
value
=
"组织编码"
,
required
=
true
)
@NotNull
(
message
=
"组织编码不能为空"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH
dmp
授权"
,
required
=
true
)
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH 授权"
,
required
=
true
)
@NotNull
(
message
=
"授权类型不能为空"
)
private
AuthTypeEnum
authType
;
private
String
authType
;
@ApiModelProperty
(
value
=
"授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效"
,
required
=
true
)
@NotNull
(
message
=
"授权方式不能为空"
)
private
AuthModeEnum
authMode
;
private
String
authMode
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/ApiInterfaceReq.java
View file @
7bf63f95
...
...
@@ -28,9 +28,7 @@ public class ApiInterfaceReq {
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
/*
@ApiModelProperty(value = "api版本",required = false)
public String version;*/
@ApiModelProperty
(
value
=
"传输方式"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
...
...
@@ -38,7 +36,11 @@ public class ApiInterfaceReq {
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
type
;
public
String
signType
;
@ApiModelProperty
(
value
=
"接入类型:对应字典表key"
,
required
=
true
)
@NotNull
(
message
=
"接入类型不能为空"
)
public
String
joinType
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
true
)
@NotNull
(
message
=
"目标地址不能为空"
)
...
...
@@ -51,8 +53,15 @@ public class ApiInterfaceReq {
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
public
String
apiFunction
;
@ApiModelProperty
(
value
=
"列"
,
required
=
false
)
public
String
columnCode
;
@ApiModelProperty
(
value
=
"文件Id"
,
required
=
true
)
@NotNull
(
message
=
"文件id不能为空"
)
public
Long
fileId
;
@ApiModelProperty
(
value
=
"项目id"
,
required
=
true
)
@NotNull
(
message
=
"项目id不能为空"
)
public
Long
projectId
;
/*@ApiModelProperty(value = "api名称",required = false)
public String apiName;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeCustomApiReq.java
deleted
100644 → 0
View file @
5110bf16
package
com
.
jz
.
dm
.
models
.
req
.
make
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: MakeCustomApiReq
* @DATE: 2020-12-26/13:01
* @DAY_NAME_SHORT: 周六
* @Description:
**/
@Data
@ApiModel
(
"制作自定义Api"
)
public
class
MakeCustomApiReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"api类型"
,
required
=
true
)
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
/* @ApiModelProperty(value = "apiId 等价于apiKey",required = true)
@NotNull(message = "apiId不能为空")
public String apiId;*/
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
/* @ApiModelProperty(value = "api版本",required = false)
public String version;*/
@ApiModelProperty
(
value
=
"传输方式"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
transMode
;
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
type
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
true
)
@NotNull
(
message
=
"目标地址不能为空"
)
public
String
targetUrl
;
@ApiModelProperty
(
value
=
"超时时间"
,
required
=
true
)
@NotNull
(
message
=
"超时时间不能为空"
)
public
String
timeout
;
@ApiModelProperty
(
value
=
"api描述"
,
required
=
false
)
public
String
apiFunction
;
@ApiModelProperty
(
value
=
"列"
,
required
=
false
)
public
String
columnCode
;
/* @ApiModelProperty(value = "状态",required = false)
public String status;*/
@ApiModelProperty
(
value
=
"更新时传入api自增id"
,
required
=
false
)
public
Long
id
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/make/MakeDataBankApiReq.java
View file @
7bf63f95
...
...
@@ -24,23 +24,20 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
//@ApiModelProperty(value = "apiKey 等价于apiId",required = true)
//@NotNull(message = "apiKey不能为空")
//public String apiKey;
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
//@ApiModelProperty(value = "api版本",required = false)
//public String version;
@ApiModelProperty
(
value
=
"传输方式(1为HTTPS,2为HTTP)"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
apiProtocl
;
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
public
String
type
;
public
String
signType
;
@ApiModelProperty
(
value
=
"接入类型:对应字典表key"
,
required
=
true
)
@NotNull
(
message
=
"接入类型不能为空"
)
public
String
joinType
;
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"目标地址"
,
required
=
false
)
public
String
targetUrl
;
...
...
@@ -70,4 +67,11 @@ public class MakeDataBankApiReq implements Serializable {
//@NotNull(message = "文件id不能为空")
public
Long
fileId
;
//-------------------------前端无效传参----------------------
//@ApiModelProperty(value = "状态",hidden = true)
//public String status;
//
//@ApiModelProperty(value = "创建用户",hidden = true)
//public String createUser;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/organizationManage/OrganizationManageAddReq.java
View file @
7bf63f95
...
...
@@ -20,9 +20,9 @@ import java.io.Serializable;
@ApiModel
(
"组织管理详情请求体"
)
public
class
OrganizationManageAddReq
implements
Serializable
{
//@ApiModelProperty(value = "组织编码(组织唯一标识)
",required = true)
//@NotNull(message = "组织编码不能为空
")
//private String orgCod
e;
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织
"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!
"
)
private
String
orgTyp
e
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
...
...
@@ -40,10 +40,6 @@ public class OrganizationManageAddReq implements Serializable {
@ApiModelProperty
(
value
=
"组织电话"
,
required
=
false
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"组织类型"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/organizationManage/OrganizationManageUpdateReq.java
View file @
7bf63f95
...
...
@@ -19,23 +19,30 @@ import java.io.Serializable;
@Data
@ApiModel
(
"更新组织请求体"
)
public
class
OrganizationManageUpdateReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"id"
,
required
=
true
)
@NotNull
(
message
=
"id不能为空"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
/*
@ApiModelProperty(value = "组织名称",required = true)
@NotNull(message = "组织名称不能为空")
private
String
orgName
;
private String orgName;
*/
@ApiModelProperty
(
value
=
"组织描述"
,
required
=
false
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
false
)
private
String
status
;
@ApiModelProperty
(
value
=
"组织英文名称"
,
required
=
false
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
,
required
=
false
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"组织电话"
,
required
=
false
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/ApiDirectionService.java
View file @
7bf63f95
...
...
@@ -17,8 +17,16 @@ public interface ApiDirectionService {
/**
* 根据类型获取API类型信息
* @param
typ
e
* @param
parentCod
e
* @return
*/
List
<
ApiDirection
>
getApiType
(
String
type
);
List
<
ApiDirection
>
getApiType
(
String
parentCode
);
/**
* 查询code值信息
* @param code
* @param key
* @return
*/
List
<
ApiDirection
>
getDirectionVal
(
String
key
,
String
code
);
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/AuthService.java
View file @
7bf63f95
...
...
@@ -32,14 +32,14 @@ public interface AuthService {
* @param req
* @return
*/
Result
addDmpUserApiAuth
(
Auth
Dmp
UserApiReq
req
);
Result
addDmpUserApiAuth
(
AuthUserApiReq
req
);
/**
* 添加商城用户api认证
* @param req
* @return
*/
Result
addMallUserApiAuth
(
Auth
Mall
UserApiReq
req
);
Result
addMallUserApiAuth
(
AuthUserApiReq
req
);
/**
* 修改认证信息
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/ProducerService.java
View file @
7bf63f95
...
...
@@ -20,7 +20,7 @@ public interface ProducerService {
* @param req
* @return
*/
Result
addCustomApi
(
MakeCustomApi
Req
req
);
Result
addCustomApi
(
ApiInterface
Req
req
);
/**
* Api制作(实时接入)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ApiDirectionServiceImpl.java
View file @
7bf63f95
package
com
.
jz
.
dm
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jz.dm.common.enums.GeneralStatusTypeEnum
;
import
com.jz.dm.mapper.ApiDirectionMapper
;
import
com.jz.dm.models.domian.ApiDirection
;
import
com.jz.dm.service.ApiDirectionService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -27,10 +29,27 @@ public class ApiDirectionServiceImpl implements ApiDirectionService {
private
ApiDirectionMapper
apiDirectionMapper
;
@Override
public
List
<
ApiDirection
>
getApiType
(
String
typ
e
)
{
public
List
<
ApiDirection
>
getApiType
(
String
parentCod
e
)
{
QueryWrapper
<
ApiDirection
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"direction_type"
,
type
);
query
.
eq
(
"is_enabled"
,
0
);
query
.
eq
(
"parent"
,
parentCode
);
//父类下的所有子类
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
return
apiDirectionMapper
.
selectList
(
query
);
}
@Override
public
List
<
ApiDirection
>
getDirectionVal
(
String
key
,
String
code
)
{
QueryWrapper
<
ApiDirection
>
query
=
new
QueryWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
key
)
&&
StringUtils
.
isNotBlank
(
code
)){
query
.
eq
(
"key"
,
key
);
query
.
eq
(
"code"
,
code
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
}
else
if
(
StringUtils
.
isNotBlank
(
code
)){
query
.
eq
(
"key"
,
key
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
}
else
{
query
.
eq
(
"code"
,
code
);
query
.
eq
(
"is_enabled"
,
GeneralStatusTypeEnum
.
ENABLE
);
}
return
apiDirectionMapper
.
selectList
(
query
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ApiLogServiceImpl.java
View file @
7bf63f95
...
...
@@ -45,6 +45,7 @@ public class ApiLogServiceImpl implements ApiLogService {
public
IPage
<
ApiReqLog
>
listApiLog
(
LogInfoListReq
req
)
{
IPage
<
ApiReqLog
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
ApiReqLog
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"is_deleted"
,
0
);
query
.
orderByDesc
(
"create_date"
);
return
apiReqLogMapper
.
selectPage
(
page
,
query
);
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
View file @
7bf63f95
...
...
@@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.enums.GeneralStatusTypeEnum
;
import
com.jz.dm.common.enums.auth.AuthModeEnum
;
import
com.jz.dm.common.enums.auth.AuthTypeEnum
;
import
com.jz.dm.common.util.RandomUtil
;
import
com.jz.dm.mapper.ApiAuthMapper
;
import
com.jz.dm.mapper.ApiInterfaceMapper
;
...
...
@@ -30,6 +30,9 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
static
com
.
jz
.
dm
.
common
.
enums
.
auth
.
AuthModeEnum
.
fromTypeModeName
;
import
static
com
.
jz
.
dm
.
common
.
enums
.
auth
.
AuthTypeEnum
.
fromTypeName
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.impl
...
...
@@ -61,6 +64,7 @@ public class AuthServiceImpl implements AuthService {
public
Result
getAuthListInfo
(
AuthListInfoReq
req
)
{
IPage
<
AuthInfoDto
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
AuthInfoDto
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"au.is_deleted"
,
0
);
query
.
orderByDesc
(
"au.create_date"
);
IPage
<
AuthInfoDto
>
listSelectApiAuth
=
apiAuthMapper
.
listSelectApiAuth
(
page
,
query
);
return
Result
.
of_success
(
listSelectApiAuth
);
...
...
@@ -85,8 +89,7 @@ public class AuthServiceImpl implements AuthService {
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addDmpUserApiAuth
(
AuthDmpUserApiReq
req
)
{
AuthUserResponse
response
=
new
AuthUserResponse
();
public
Result
addDmpUserApiAuth
(
AuthUserApiReq
req
)
{
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
...
...
@@ -96,44 +99,26 @@ public class AuthServiceImpl implements AuthService {
return
Result
.
of_error
(
"组织信息不存在!"
);
}
//授权验证
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
()
.
name
())
&&
!
AuthTypeEnum
.
DMP_AUTH
.
name
().
equals
(
req
.
getAuthType
().
name
()))
{
return
Result
.
of_error
(
"授权类型错误
!"
);
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
()
)){
if
(
null
==
fromTypeName
(
req
.
getAuthType
()))
{
return
Result
.
of_error
(
"授权类型不存在
!"
);
}
//认证类型
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
().
name
()))
{
if
(
null
==
req
.
getValidStartTime
()
||
null
==
req
.
getValidEndTime
())
{
return
Result
.
of_error
(
"开始或结束时间不能为空!"
);
}
//验证授权方式
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
())){
if
(
null
==
fromTypeModeName
(
req
.
getAuthMode
())){
return
Result
.
of_error
(
"授权方式不存在!"
);
}
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
POWER_CALL_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
return
Result
.
of_error
(
"授权类型错误!"
);
}
String
authCode
=
""
;
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
);
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
//认证类型为永久授权
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
())
&&
!
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
return
Result
.
of_error
(
"授权类型错误!"
);
}
apiAuth
.
setAuthCode
(
authCode
);
//授权码
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setStatus
(
"1"
);
//授权状态
apiAuth
.
setCreateUser
(
""
);
apiAuth
.
setRemark
(
req
.
getRemark
());
response
.
setAuthCode
(
authCode
);
response
.
setSalt
(
salt
);
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
,
response
);
if
(
StringUtils
.
isBlank
(
apiOrg
.
getOrgCode
())){
return
Result
.
of_error
(
"内部授权组织编码不能为空!!"
);
}
return
Result
.
of_success
(
ResultMsg
.
FAILURE
);
return
saveAuthInfo
(
apiInterface
,
apiOrg
,
req
,
Constants
.
AUTH_INT
);
}
/**
...
...
@@ -144,8 +129,7 @@ public class AuthServiceImpl implements AuthService {
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addMallUserApiAuth
(
AuthMallUserApiReq
req
)
{
AuthUserResponse
response
=
new
AuthUserResponse
();
public
Result
addMallUserApiAuth
(
AuthUserApiReq
req
)
{
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
...
...
@@ -155,48 +139,74 @@ public class AuthServiceImpl implements AuthService {
return
Result
.
of_error
(
"组织信息不存在!"
);
}
//授权验证
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
().
name
())
&&
!
AuthTypeEnum
.
DATA_BANK_AUTH
.
name
().
equals
(
req
.
getAuthType
().
name
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
())){
if
(
null
==
fromTypeName
(
req
.
getAuthType
())){
return
Result
.
of_error
(
"授权类型不存在!"
);
}
}
//验证授权方式
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
())){
if
(
null
==
fromTypeModeName
(
req
.
getAuthMode
())){
return
Result
.
of_error
(
"授权方式不存在!"
);
}
}
//认证类型为永久授权
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
return
Result
.
of_error
(
"授权类型错误!"
);
}
//认证类型
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
RECORD_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
().
name
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
())
&&
AuthModeEnum
.
RECORD_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
())){
if
(
null
==
req
.
getValidStartTime
()
||
null
==
req
.
getValidEndTime
())
{
return
Result
.
of_error
(
"开始或结束时间不能为空!"
);
}
}
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
().
name
()))
{
return
Result
.
of_error
(
"授权类型错误!
"
);
//验证用户id
if
(
StringUtils
.
isBlank
(
req
.
getUserId
()))
{
return
Result
.
of_error
(
"外部授权用户Id不能为空
"
);
}
String
authCode
=
""
;
return
saveAuthInfo
(
apiInterface
,
apiOrg
,
req
,
Constants
.
AUTH_OUT
);
}
/**
* 保存授权信息
* @param apiInterface
* @param apiOrg
* @param req
* @param orgType
* @return
*/
private
Result
saveAuthInfo
(
ApiInterface
apiInterface
,
ApiOrg
apiOrg
,
AuthUserApiReq
req
,
String
orgType
){
AuthUserResponse
response
=
new
AuthUserResponse
();
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
);
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
//商城只有外部授权
String
authCode
=
""
;
//内部组织
if
(
StringUtils
.
isNotBlank
(
orgType
)
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
orgType
))
{
authCode
=
getAuthCode
(
apiOrg
.
getOrgCode
(),
""
,
Constants
.
AUTH_INT
);
}
else
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//外部组织
&&
Constants
.
AUTH_OUT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
//外部组织
}
else
if
(
StringUtils
.
isNotBlank
(
orgType
)
&&
Constants
.
AUTH_OUT
.
equalsIgnoreCase
(
orgType
))
{
authCode
=
getAuthCode
(
""
,
req
.
getUserId
(),
Constants
.
AUTH_OUT
);
}
apiAuth
.
setAuthCode
(
authCode
);
//授权码
//生成盐值
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setAuthCode
(
authCode
);
//授权码
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setStatus
(
"1"
);
//授权状态
apiAuth
.
setStatus
(
GeneralStatusTypeEnum
.
VALID
.
name
()
);
//授权状态
apiAuth
.
setCreateUser
(
""
);
apiAuth
.
setRemark
(
req
.
getRemark
());
response
.
setAuthCode
(
authCode
);
response
.
setSalt
(
salt
);
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
,
response
);
}
return
Result
.
of_success
(
ResultMsg
.
FAILURE
,
response
);
return
Result
.
of_error
(
ResultMsg
.
INSERT_FAIL
);
}
/**
* 获取授权码
* @param type
...
...
@@ -244,7 +254,7 @@ public class AuthServiceImpl implements AuthService {
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
UpdateWrapper
<
ApiAuth
>
update
=
new
UpdateWrapper
<>();
update
.
set
(
"salt"
,
salt
);
update
.
set
(
"create_
tim
e"
,
new
Date
());
update
.
set
(
"create_
dat
e"
,
new
Date
());
update
.
set
(
"create_user"
,
""
);
update
.
eq
(
"id"
,
req
.
getId
());
if
(
apiAuthMapper
.
update
(
null
,
update
)
>
0
)
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/OrganizationManageImpl.java
View file @
7bf63f95
package
com
.
jz
.
dm
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jz.common.bean.SysUserDto
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.enums.org.OrgStatusEnum
;
import
com.jz.dm.common.util.RandomUtil
;
import
com.jz.dm.mapper.ApiOrgMapper
;
import
com.jz.dm.models.domian.ApiOrg
;
...
...
@@ -25,6 +25,8 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
static
com
.
jz
.
dm
.
common
.
enums
.
org
.
OrgStatusEnum
.
fromTypeName
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.impl
...
...
@@ -53,6 +55,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
public
IPage
<
ApiOrg
>
listOrganization
(
OrganizationManageListQueryReq
req
)
{
IPage
<
ApiOrg
>
page
=
new
Page
<>(
req
.
getPageNum
(),
req
.
getPageSize
());
QueryWrapper
<
ApiOrg
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"is_deleted"
,
0
);
query
.
orderByDesc
(
"create_date"
);
return
apiOrgMapper
.
selectPage
(
page
,
query
);
}
...
...
@@ -65,7 +68,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
@Override
public
Result
getOrganizationDetail
(
OrganizationManageDetailQueryReq
req
)
{
return
Result
.
of_success
(
apiOrgMapper
.
selectById
(
req
.
getId
()));
QueryWrapper
<
ApiOrg
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"is_deleted"
,
0
);
query
.
eq
(
"id"
,
req
.
getId
());
return
Result
.
of_success
(
apiOrgMapper
.
selectOne
(
query
));
}
/**
...
...
@@ -76,14 +82,14 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
@Override
public
Result
add
(
OrganizationManageAddReq
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){
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
}
*/
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgName
()))
{
ApiOrg
orgNameInfo
=
getOrgNameInfo
(
req
.
getOrgName
());
if
(
null
!=
orgNameInfo
)
{
return
Result
.
of_error
(
"组织名称已存在"
);
return
Result
.
of_error
(
"组织名称已存在
!
"
);
}
}
String
coding
=
""
;
...
...
@@ -98,9 +104,9 @@ public class OrganizationManageImpl implements OrganizationManageService {
if
(
StringUtils
.
isBlank
(
coding
))
{
return
Result
.
of_error
(
"生成组织编码异常!"
);
}
apiOrg
.
setOrgCode
(
coding
);
//组织编码
需要生成
apiOrg
.
setStatus
(
"1"
);
//正常
apiOrg
.
setCreateUser
(
currentUser
.
getUserName
());
apiOrg
.
setOrgCode
(
coding
);
//组织编码
apiOrg
.
setStatus
(
OrgStatusEnum
.
NORMAL
.
name
()
);
//正常
//
apiOrg.setCreateUser(currentUser.getUserName());
if
(
apiOrgMapper
.
insert
(
apiOrg
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
}
...
...
@@ -109,6 +115,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
/**
* 获取组织编码(去重)
*
* @param orgName 组织名称
* @param type 生成类型
* @return
...
...
@@ -127,30 +134,29 @@ public class OrganizationManageImpl implements OrganizationManageService {
/**
* 更新组织
*
* @param req
* @return
*/
@Override
public
Result
update
(
OrganizationManageUpdateReq
req
)
{
SysUserDto
currentUser
=
(
SysUserDto
)
redisTemplate
.
opsForValue
().
get
(
"user"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_SYS
);
if
(
null
==
currentUser
){
/* SysUserDto currentUser = (SysUserDto) redisTemplate.opsForValue().get("user"
+ RedisMessageConstant.SENDTYPE_LOGIN_SYS);
if (null == currentUser)
{
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
}
*/
ApiOrg
apiOrg
=
apiOrgMapper
.
selectById
(
req
.
getId
());
if
(
null
==
apiOrg
)
{
return
Result
.
of_error
(
"组织信息不存在!"
);
}
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgName
()))
{
ApiOrg
orgNameInfo
=
getOrgNameInfo
(
req
.
getOrgName
());
if
(
null
!=
orgNameInfo
)
{
return
Result
.
of_error
(
"组织名称已存在"
);
if
(
StringUtils
.
isNotBlank
(
req
.
getStatus
()))
{
if
(
null
==
fromTypeName
(
req
.
getStatus
())){
return
Result
.
of_error
(
"更新组织状态不存在!"
);
}
}
ApiOrg
apiOrgUpdate
=
new
ApiOrg
();
apiOrgUpdate
.
setId
(
apiOrg
.
getId
());
BeanUtils
.
copyProperties
(
req
,
apiOrgUpdate
);
apiOrgUpdate
.
setUpdateDate
(
new
Date
());
apiOrgUpdate
.
setUpdateUser
(
currentUser
.
getUserName
());
//
apiOrgUpdate.setUpdateUser(currentUser.getUserName());
if
(
apiOrgMapper
.
updateById
(
apiOrgUpdate
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
}
...
...
@@ -159,6 +165,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
/**
* 删除组织
*
* @param id
* @return
*/
...
...
@@ -168,7 +175,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
if
(
null
==
apiOrg
)
{
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_EXIST
);
}
if
(
apiOrgMapper
.
deleteById
(
id
)
>
0
)
{
UpdateWrapper
<
ApiOrg
>
delete
=
new
UpdateWrapper
<>();
delete
.
set
(
"is_deleted"
,
1
);
delete
.
eq
(
"id"
,
id
);
if
(
apiOrgMapper
.
update
(
null
,
delete
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
DELETE_SUCCESS
);
}
return
Result
.
of_success
(
ResultMsg
.
DELETE_FAIL
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
7bf63f95
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/resources/application-test.yml
View file @
7bf63f95
jz-dm-apigateway/src/main/resources/mapper/ApiAuthMapper.xml
View file @
7bf63f95
...
...
@@ -20,8 +20,8 @@
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 '作废'
WHEN '
VALID
' THEN '正常'
WHEN '
UN_VALID
' THEN '作废'
END) AS status,
au.remark AS remark,
DATE_FORMAT(au.create_date,'%Y-%m-%d %H:%i:%s') AS createDate,
...
...
@@ -29,10 +29,10 @@
ao.org_name AS orgName,
ai.api_key AS apiKey
FROM t_api_auth AS au
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_interface AS ai ON au.api_interface_id = ai.id AND ai.is_deleted =0 AND ai.`status` ='
ISSUE
'
JOIN t_api_org AS ao ON au.api_org_id = ao.id AND ao.`status` ='
NORMAL
' AND ao.is_deleted =0
WHERE au.is_deleted =0
AND au.id =#{
req.
id}
AND au.id =#{id}
</select>
<select
id=
"listSelectApiAuth"
resultType=
"com.jz.dm.models.dto.AuthInfoDto"
>
...
...
@@ -48,8 +48,8 @@
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 '作废'
WHEN '
VALID
' THEN '正常'
WHEN '
UN_VALID
' THEN '作废'
END) AS status,
au.remark AS remark,
DATE_FORMAT(au.create_date,'%Y-%m-%d %H:%i:%s') AS createDate,
...
...
@@ -57,8 +57,8 @@
ao.org_name AS orgName,
ai.api_key AS apiKey
FROM t_api_auth AS au
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_interface AS ai ON au.api_interface_id = ai.id AND ai.is_deleted =0 AND ai.`status` ='
ISSUE
'
JOIN t_api_org AS ao ON au.api_org_id = ao.id AND ao.`status` ='
NORMAL
' AND ao.is_deleted =0
${ew.customSqlSegment}
</select>
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/org/TestOrganizationManage.java
View file @
7bf63f95
...
...
@@ -73,7 +73,6 @@ public class TestOrganizationManage extends SpringTestCase {
public
void
updateOrg
(){
OrganizationManageUpdateReq
req
=
new
OrganizationManageUpdateReq
();
req
.
setId
(
8L
);
req
.
setOrgName
(
"ABCOssO"
);
req
.
setOrgDesc
(
"粗这次002"
);
req
.
setOrgCnName
(
"AOKK33"
);
req
.
setOrgMail
(
"727322JA@QQ.COM"
);
...
...
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestMakeApi.java
0 → 100644
View file @
7bf63f95
package
com
.
jz
.
dm
.
gateway
.
orther
;
import
com.jz.dm.common.util.WebUtils
;
import
com.jz.dm.gateway.SpringTestCase
;
import
com.jz.dm.service.ProducerService
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.orther
* @PROJECT_NAME: jz-dm-parent
* @NAME: TestMakeApi
* @DATE: 2020-12-31/14:00
* @DAY_NAME_SHORT: 周四
* @Description:
**/
public
class
TestMakeApi
extends
SpringTestCase
{
private
static
final
String
url
=
"http://localhost:8088/api/producer/addDataBankApiInfo"
;
@Autowired
private
ProducerService
producerService
;
@Test
public
void
testApiMake
()
{
Map
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
put
(
"User-Agent"
,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
);
Map
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"apiType"
,
"2"
);
params
.
put
(
"apiKey"
,
"www.q99sss9"
);
params
.
put
(
"apiProtocl"
,
"HTTPS"
);
params
.
put
(
"type"
,
"1"
);
try
{
String
result
=
WebUtils
.
post
(
url
,
params
,
headers
);
System
.
out
.
println
(
"接受到的结果为:"
+
result
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
jz-dm-apigateway/src/test/java/com/jz/dm/gateway/orther/TestRedisUserSave.java
0 → 100644
View file @
7bf63f95
package
com
.
jz
.
dm
.
gateway
.
orther
;
import
com.jz.dm.common.base.BaseCurrentUserObject
;
import
com.jz.dm.gateway.SpringTestCase
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.orther
* @PROJECT_NAME: jz-dm-parent
* @NAME: TestRedisUserSave
* @DATE: 2021-1-2/11:16
* @DAY_NAME_SHORT: 周六
* @Description:
**/
public
class
TestRedisUserSave
extends
SpringTestCase
{
@Autowired
private
RedisTemplate
redisTemplate
;
@Test
public
void
saveUser
(){
redisTemplate
.
opsForValue
().
set
(
"USER004"
,
"USER9999"
);
}
@Test
public
void
getUser
(){
//String str= (String)redisTemplate.opsForValue().get("USER"+"_99999");
//System.out.println("获取到的用户:"+str);
System
.
out
.
println
(
new
BaseCurrentUserObject
().
getUserInfo
());
}
}
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