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
29646613
Commit
29646613
authored
Dec 31, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化部分认证代码
parent
bb7a4f1d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
202 additions
and
11 deletions
+202
-11
api_gateway.sql
database/zc/api_gateway.sql
+18
-0
GeneralStatusTypeEnum.java
...in/java/com/jz/dm/common/enums/GeneralStatusTypeEnum.java
+43
-0
ProducerController.java
...rc/main/java/com/jz/dm/controller/ProducerController.java
+12
-0
ApiInterfaceFileMapper.java
...rc/main/java/com/jz/dm/mapper/ApiInterfaceFileMapper.java
+16
-0
ApiInterfaceFile.java
...c/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
+62
-0
ProducerService.java
...eway/src/main/java/com/jz/dm/service/ProducerService.java
+10
-0
OrganizationManageImpl.java
...n/java/com/jz/dm/service/impl/OrganizationManageImpl.java
+12
-10
ProducerServiceImpl.java
...main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
+21
-0
ApiInterfaceCustomMapper.xml
...ay/src/main/resources/mapper/ApiInterfaceCustomMapper.xml
+1
-1
ApiInterfaceFileMapper.xml
...eway/src/main/resources/mapper/ApiInterfaceFileMapper.xml
+7
-0
No files found.
database/zc/api_gateway.sql
View file @
29646613
...
@@ -45,6 +45,24 @@ CREATE TABLE `t_api_interface_custom` (
...
@@ -45,6 +45,24 @@ CREATE TABLE `t_api_interface_custom` (
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
文件表
DROP
TABLE
IF
EXISTS
`t_api_interface_file`
;
CREATE
TABLE
`t_api_interface_file`
(
`id`
bigint
(
20
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'api文件表自增ID'
,
`api_interface_id`
bigint
(
20
)
NOT
NULL
COMMENT
'api表自增id'
,
`api_key`
varchar
(
200
)
NOT
NULL
COMMENT
'api唯一标识'
,
`file_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件类型'
,
`file_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件名称'
,
`file_en_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'文件英文名称'
,
`status`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'VALID 有效,UNVALID 无效'
,
`remark`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'备注'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`create_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'创建人'
,
`update_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'修改时间'
,
`update_user`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'更新人'
,
`is_deleted`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
),
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'api文件表'
;
#
api
组织信息表
#
api
组织信息表
DROP
TABLE
IF
EXISTS
`t_api_org`
;
DROP
TABLE
IF
EXISTS
`t_api_org`
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/GeneralStatusTypeEnum.java
0 → 100644
View file @
29646613
package
com
.
jz
.
dm
.
common
.
enums
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums
* @PROJECT_NAME: jz-dm-parent
* @NAME: GeneralStatusTypeEnum
* @DATE: 2020-12-30/20:08
* @DAY_NAME_SHORT: 周三
* @Description: 通用状态枚举
**/
public
enum
GeneralStatusTypeEnum
{
/**
* 启用
*/
ENABLE
(
"启用"
),
/**
* 停用
*/
UNABLE
(
"停用"
),
/**
* 有效'
*/
VALID
(
"有效"
),
/**
* 无效
*/
UN_VALID
(
"无效"
);
private
String
text
;
GeneralStatusTypeEnum
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getText
()
{
return
text
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ProducerController.java
View file @
29646613
...
@@ -28,6 +28,18 @@ public class ProducerController {
...
@@ -28,6 +28,18 @@ public class ProducerController {
@Autowired
@Autowired
private
ProducerService
producerService
;
private
ProducerService
producerService
;
/**
* @Description:Api制作(自定义)
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation
(
"Api制作(获取文件夹列表)"
)
@GetMapping
(
value
=
"/getFileCatalog"
)
public
Mono
<
Result
>
getFileCatalog
(
@RequestParam
(
name
=
"pageNum"
,
defaultValue
=
"1"
,
required
=
false
)
String
pageNum
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
,
required
=
false
)
String
pageSize
)
{
return
Mono
.
fromSupplier
(()
->
Result
.
of_success
(
producerService
.
getFileCatalog
(
pageNum
,
pageSize
)));
}
/**
/**
* @Description:Api制作(自定义)
* @Description:Api制作(自定义)
* @Author: Mr.zhang
* @Author: Mr.zhang
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/mapper/ApiInterfaceFileMapper.java
0 → 100644
View file @
29646613
package
com
.
jz
.
dm
.
mapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.dm.models.domian.ApiInterfaceFile
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mapper
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiInterfaceFileMapper
* @DATE: 2020-12-30/20:34
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public
interface
ApiInterfaceFileMapper
extends
BaseMapper
<
ApiInterfaceFile
>
{
}
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterfaceFile.java
0 → 100644
View file @
29646613
package
com
.
jz
.
dm
.
models
.
domian
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.jz.dm.common.base.BaseObject
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@TableName
(
"t_api_interface_file"
)
public
class
ApiInterfaceFile
extends
BaseObject
implements
Serializable
{
/**
* api唯一标识
*/
@TableField
(
"api_key"
)
private
String
apiKey
;
/**
* apiInterfaceId
*/
@TableField
(
"api_interface_id"
)
private
Long
apiInterfaceId
;
/**
* 文件类型
*/
@TableField
(
"file_type"
)
private
String
apiType
;
/**
* 文件名称
*/
@TableField
(
"file_name"
)
private
String
fileName
;
/**
* 文件英文名称
*/
@TableField
(
"file_en_name"
)
private
String
fileEnName
;
/**
* 'VALID 有效,UNVALID 无效'
*/
@TableField
(
"status"
)
private
String
status
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/ProducerService.java
View file @
29646613
package
com
.
jz
.
dm
.
service
;
package
com
.
jz
.
dm
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.models.domian.ApiInterfaceFile
;
import
com.jz.dm.models.req.make.*
;
import
com.jz.dm.models.req.make.*
;
/**
/**
...
@@ -86,4 +88,12 @@ public interface ProducerService {
...
@@ -86,4 +88,12 @@ public interface ProducerService {
* @return
* @return
*/
*/
Result
saveInterfaceAPi
(
ApiInterfaceReq
req
);
Result
saveInterfaceAPi
(
ApiInterfaceReq
req
);
/**
* 获取文件列表
* @param pageNum
* @param pageSize
* @return
*/
IPage
<
ApiInterfaceFile
>
getFileCatalog
(
String
pageNum
,
String
pageSize
);
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/OrganizationManageImpl.java
View file @
29646613
...
@@ -3,6 +3,8 @@ package com.jz.dm.service.impl;
...
@@ -3,6 +3,8 @@ package com.jz.dm.service.impl;
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.plugins.pagination.Page
;
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.constant.ResultMsg
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.common.constant.Constants
;
import
com.jz.dm.common.constant.Constants
;
...
@@ -74,10 +76,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
...
@@ -74,10 +76,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
*/
@Override
@Override
public
Result
add
(
OrganizationManageAddReq
req
)
{
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){
if
(
null
==
currentUser
){
//
return Result.of_error(ResultMsg.USER_NOT_EXIST);
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
//
}
}
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgName
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgName
()))
{
ApiOrg
orgNameInfo
=
getOrgNameInfo
(
req
.
getOrgName
());
ApiOrg
orgNameInfo
=
getOrgNameInfo
(
req
.
getOrgName
());
if
(
null
!=
orgNameInfo
)
{
if
(
null
!=
orgNameInfo
)
{
...
@@ -98,7 +100,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
...
@@ -98,7 +100,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
}
}
apiOrg
.
setOrgCode
(
coding
);
//组织编码需要生成
apiOrg
.
setOrgCode
(
coding
);
//组织编码需要生成
apiOrg
.
setStatus
(
"1"
);
//正常
apiOrg
.
setStatus
(
"1"
);
//正常
//
apiOrg.setCreateUser(currentUser.getUserName());
apiOrg
.
setCreateUser
(
currentUser
.
getUserName
());
if
(
apiOrgMapper
.
insert
(
apiOrg
)
>
0
)
{
if
(
apiOrgMapper
.
insert
(
apiOrg
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
}
}
...
@@ -130,10 +132,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
...
@@ -130,10 +132,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
*/
@Override
@Override
public
Result
update
(
OrganizationManageUpdateReq
req
)
{
public
Result
update
(
OrganizationManageUpdateReq
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
);
//
}
}
ApiOrg
apiOrg
=
apiOrgMapper
.
selectById
(
req
.
getId
());
ApiOrg
apiOrg
=
apiOrgMapper
.
selectById
(
req
.
getId
());
if
(
null
==
apiOrg
)
{
if
(
null
==
apiOrg
)
{
return
Result
.
of_error
(
"组织信息不存在!"
);
return
Result
.
of_error
(
"组织信息不存在!"
);
...
@@ -148,7 +150,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
...
@@ -148,7 +150,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
apiOrgUpdate
.
setId
(
apiOrg
.
getId
());
apiOrgUpdate
.
setId
(
apiOrg
.
getId
());
BeanUtils
.
copyProperties
(
req
,
apiOrgUpdate
);
BeanUtils
.
copyProperties
(
req
,
apiOrgUpdate
);
apiOrgUpdate
.
setUpdateDate
(
new
Date
());
apiOrgUpdate
.
setUpdateDate
(
new
Date
());
//
apiOrgUpdate.setUpdateUser(currentUser.getUserName());
apiOrgUpdate
.
setUpdateUser
(
currentUser
.
getUserName
());
if
(
apiOrgMapper
.
updateById
(
apiOrgUpdate
)
>
0
)
{
if
(
apiOrgMapper
.
updateById
(
apiOrgUpdate
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
}
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
29646613
...
@@ -3,7 +3,9 @@ package com.jz.dm.service.impl;
...
@@ -3,7 +3,9 @@ package com.jz.dm.service.impl;
import
com.alibaba.fastjson.JSONArray
;
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.extension.exceptions.ApiException
;
import
com.baomidou.mybatisplus.extension.exceptions.ApiException
;
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.ResultMsg
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.utils.RedisUtils
;
import
com.jz.common.utils.RedisUtils
;
...
@@ -54,6 +56,8 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -54,6 +56,8 @@ public class ProducerServiceImpl implements ProducerService {
private
ApiOpenApiEsTagconfigMapper
apiOpenApiEsTagconfigMapper
;
private
ApiOpenApiEsTagconfigMapper
apiOpenApiEsTagconfigMapper
;
@Resource
@Resource
private
ApiInterfaceCustomMapper
apiInterfaceCustomMapper
;
private
ApiInterfaceCustomMapper
apiInterfaceCustomMapper
;
@Resource
private
ApiInterfaceFileMapper
apiInterfaceFileMapper
;
@Autowired
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
@Autowired
...
@@ -68,6 +72,21 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -68,6 +72,21 @@ public class ProducerServiceImpl implements ProducerService {
@Value
(
"${dmp.ignoreRedis}"
)
@Value
(
"${dmp.ignoreRedis}"
)
protected
boolean
ignoreRedis
;
protected
boolean
ignoreRedis
;
/**
* 获取文件列表
* @param pageSize
* @param pageNum
* @return
*/
@Override
public
IPage
<
ApiInterfaceFile
>
getFileCatalog
(
String
pageNum
,
String
pageSize
)
{
Integer
pageN
=
Integer
.
valueOf
(
pageNum
);
Integer
pageS
=
Integer
.
valueOf
(
pageSize
);
IPage
<
ApiInterfaceFile
>
page
=
new
Page
<>(
pageN
,
pageS
);
QueryWrapper
<
ApiInterfaceFile
>
query
=
new
QueryWrapper
<>();
query
.
orderByDesc
(
"create_time"
);
return
apiInterfaceFileMapper
.
selectPage
(
page
,
query
);
}
/**
/**
* 制作自定义Api
* 制作自定义Api
...
@@ -251,6 +270,8 @@ public class ProducerServiceImpl implements ProducerService {
...
@@ -251,6 +270,8 @@ public class ProducerServiceImpl implements ProducerService {
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
}
}
/**
/**
* 保存修改的api信息
* 保存修改的api信息
*
*
...
...
jz-dm-apigateway/src/main/resources/mapper/ApiInterfaceCustomMapper.xml
View file @
29646613
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jz.dm.mapper.ApiInterfaceMapper"
>
<mapper
namespace=
"com.jz.dm.mapper.ApiInterface
Custom
Mapper"
>
</mapper>
</mapper>
\ No newline at end of file
jz-dm-apigateway/src/main/resources/mapper/ApiInterfaceFileMapper.xml
0 → 100644
View file @
29646613
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jz.dm.mapper.ApiInterfaceFileMapper"
>
</mapper>
\ No newline at end of file
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