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
1e9b3f69
Commit
1e9b3f69
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
eb20785a
29646613
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
313 additions
and
38 deletions
+313
-38
api_gateway.sql
database/zc/api_gateway.sql
+18
-0
pom.xml
jz-dm-apigateway/pom.xml
+1
-5
GeneralStatusTypeEnum.java
...in/java/com/jz/dm/common/enums/GeneralStatusTypeEnum.java
+43
-0
RandomUtil.java
...teway/src/main/java/com/jz/dm/common/util/RandomUtil.java
+1
-1
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
AuthDmpUserApiReq.java
...ain/java/com/jz/dm/models/req/auth/AuthDmpUserApiReq.java
+7
-3
AuthMallUserApiReq.java
...in/java/com/jz/dm/models/req/auth/AuthMallUserApiReq.java
+10
-3
AuthMallUserResponse.java
...main/java/com/jz/dm/models/resp/AuthMallUserResponse.java
+27
-0
ProducerService.java
...eway/src/main/java/com/jz/dm/service/ProducerService.java
+10
-0
AuthServiceImpl.java
...src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
+58
-13
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
pom.xml
jz-dm-common/pom.xml
+7
-2
No files found.
database/zc/api_gateway.sql
View file @
1e9b3f69
...
...
@@ -45,6 +45,24 @@ CREATE TABLE `t_api_interface_custom` (
PRIMARY
KEY
(
`id`
),
)
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
组织信息表
DROP
TABLE
IF
EXISTS
`t_api_org`
;
...
...
jz-dm-apigateway/pom.xml
View file @
1e9b3f69
...
...
@@ -49,11 +49,7 @@
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
4.5.6
</version>
</dependency>
<!--lang3工具类-->
<dependency>
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/common/enums/GeneralStatusTypeEnum.java
0 → 100644
View file @
1e9b3f69
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/common/util/RandomUtil.java
View file @
1e9b3f69
...
...
@@ -124,7 +124,7 @@ public class RandomUtil {
String
userNum
=
addZeroForNum
(
userId
,
8
);
builder
.
append
(
userNum
);
}
coding
=
getCodeInfo
(
orgCode
,
coding
,
builder
,
month
,
day
,
hour
,
minute
,
second
);
coding
=
getCodeInfo
(
userId
,
coding
,
builder
,
month
,
day
,
hour
,
minute
,
second
);
}
return
coding
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/ProducerController.java
View file @
1e9b3f69
...
...
@@ -28,6 +28,18 @@ public class ProducerController {
@Autowired
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制作(自定义)
* @Author: Mr.zhang
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/mapper/ApiInterfaceFileMapper.java
0 → 100644
View file @
1e9b3f69
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 @
1e9b3f69
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/models/req/auth/AuthDmpUserApiReq.java
View file @
1e9b3f69
...
...
@@ -26,9 +26,13 @@ public class AuthDmpUserApiReq implements Serializable {
@NotNull
(
message
=
"apiKey唯一标识不能为空"
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"组织id"
,
required
=
true
)
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
orgId
;
@ApiModelProperty
(
value
=
"组织编码"
,
required
=
true
)
@NotNull
(
message
=
"组织编码不能为空"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"组织类型: INT 内部, OUT 外部"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权"
,
required
=
true
)
@NotNull
(
message
=
"授权类型不能为空"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/req/auth/AuthMallUserApiReq.java
View file @
1e9b3f69
...
...
@@ -26,9 +26,16 @@ public class AuthMallUserApiReq implements Serializable {
@NotNull
(
message
=
"apiKey唯一标识不能为空"
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"组织id"
,
required
=
true
)
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
orgId
;
@ApiModelProperty
(
value
=
"组织类型: INT 内部, OUT 外部"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"用户id"
,
required
=
false
)
private
String
userId
;
@ApiModelProperty
(
value
=
"组织编码"
,
required
=
true
)
@NotNull
(
message
=
"组织编码不能为空"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权"
,
required
=
true
)
@NotNull
(
message
=
"授权类型不能为空"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/models/resp/AuthMallUserResponse.java
0 → 100644
View file @
1e9b3f69
package
com
.
jz
.
dm
.
models
.
resp
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.resp
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthMallUserResponse
* @DATE: 2020-12-30/19:35
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Data
@ApiModel
public
class
AuthMallUserResponse
implements
Serializable
{
@ApiModelProperty
(
value
=
"授权码"
)
public
String
authCode
;
@ApiModelProperty
(
value
=
"盐值"
)
public
String
salt
;
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/ProducerService.java
View file @
1e9b3f69
package
com
.
jz
.
dm
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.models.domian.ApiInterfaceFile
;
import
com.jz.dm.models.req.make.*
;
/**
...
...
@@ -86,4 +88,12 @@ public interface ProducerService {
* @return
*/
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/AuthServiceImpl.java
View file @
1e9b3f69
...
...
@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
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.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
;
import
com.jz.dm.mapper.ApiOrgMapper
;
...
...
@@ -16,6 +18,7 @@ import com.jz.dm.models.domian.ApiInterface;
import
com.jz.dm.models.domian.ApiOrg
;
import
com.jz.dm.models.dto.AuthInfoDto
;
import
com.jz.dm.models.req.auth.*
;
import
com.jz.dm.models.resp.AuthMallUserResponse
;
import
com.jz.dm.service.AuthService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -84,7 +87,7 @@ public class AuthServiceImpl implements AuthService {
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
}
ApiOrg
apiOrg
=
apiOrgMapper
.
select
ById
(
req
.
getOrgId
(
));
ApiOrg
apiOrg
=
apiOrgMapper
.
select
One
(
new
QueryWrapper
<
ApiOrg
>().
eq
(
"org_code"
,
req
.
getOrgCode
()
));
if
(
null
==
apiOrg
)
{
return
Result
.
of_error
(
"组织信息不存在!"
);
}
...
...
@@ -103,11 +106,21 @@ public class AuthServiceImpl implements AuthService {
AuthModeEnum
.
POWER_CALL_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
return
Result
.
of_error
(
"授权类型错误!"
);
}
String
authCode
=
""
;
ApiAuth
apiAuth
=
new
ApiAuth
();
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
apiAuth
.
setAuthCode
(
""
);
//授权码
apiAuth
.
setSalt
(
""
);
//盐值
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
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
);
//授权码
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setStatus
(
"1"
);
//授权状态
if
(
apiAuthMapper
.
insert
(
apiAuth
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
);
...
...
@@ -123,17 +136,18 @@ public class AuthServiceImpl implements AuthService {
*/
@Override
public
Result
addMallUserApiAuth
(
AuthMallUserApiReq
req
)
{
AuthMallUserResponse
response
=
new
AuthMallUserResponse
();
ApiInterface
apiInterface
=
getInterface
(
req
.
getApiKey
());
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
"api授权信息不存在!"
);
}
ApiOrg
apiOrg
=
apiOrgMapper
.
select
ById
(
req
.
getOrgId
(
));
ApiOrg
apiOrg
=
apiOrgMapper
.
select
One
(
new
QueryWrapper
<
ApiOrg
>().
eq
(
"org_code"
,
req
.
getOrgCode
()
));
if
(
null
==
apiOrg
)
{
return
Result
.
of_error
(
"组织信息不存在!"
);
}
//授权验证
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthType
().
name
())
&&
!
AuthTypeEnum
.
DATA_BANK_AUTH
.
name
().
equals
(
req
.
getAuthType
()))
{
!
AuthTypeEnum
.
DATA_BANK_AUTH
.
name
().
equals
(
req
.
getAuthType
()))
{
return
Result
.
of_error
(
"授权类型错误!"
);
}
//认证类型
...
...
@@ -143,19 +157,49 @@ public class AuthServiceImpl implements AuthService {
}
}
if
(
StringUtils
.
isNotBlank
(
req
.
getAuthMode
().
name
())
&&
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
().
equals
(
req
.
getAuthMode
()))
{
return
Result
.
of_error
(
"授权类型错误!"
);
}
String
authCode
=
""
;
ApiAuth
apiAuth
=
new
ApiAuth
();
BeanUtils
.
copyProperties
(
req
,
apiAuth
);
apiAuth
.
setApiInterfaceId
(
apiInterface
.
getId
());
apiAuth
.
setAuthCode
(
""
);
//授权码
apiAuth
.
setSalt
(
""
);
//盐值
if
(
StringUtils
.
isNotBlank
(
req
.
getOrgType
())
//内部组织
&&
Constants
.
AUTH_INT
.
equalsIgnoreCase
(
req
.
getOrgType
()))
{
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
);
//授权码
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
apiAuth
.
setSalt
(
salt
);
//盐值
apiAuth
.
setStatus
(
"1"
);
//授权状态
response
.
setAuthCode
(
authCode
);
response
.
setSalt
(
salt
);
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
,
response
);
}
/**
* 获取授权码
* @param type
* @param userId
* @param apiOrgCode
* @return
*/
private
String
getAuthCode
(
String
apiOrgCode
,
String
userId
,
String
type
)
{
String
authCode
=
""
;
authCode
=
RandomUtil
.
generateTokenCode
(
type
,
apiOrgCode
,
userId
);
QueryWrapper
<
ApiAuth
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"auth_code"
,
authCode
);
ApiAuth
auth
=
apiAuthMapper
.
selectOne
(
query
);
if
(
null
!=
auth
)
{
authCode
=
RandomUtil
.
generateTokenCode
(
type
,
apiOrgCode
,
userId
);
}
return
authCode
;
}
/**
...
...
@@ -194,11 +238,12 @@ public class AuthServiceImpl implements AuthService {
}
return
Result
.
of_success
(
ResultMsg
.
UPDATE_FAIL
);
}
private
ApiInterface
getInterface
(
String
apiKey
){
private
ApiInterface
getInterface
(
String
apiKey
)
{
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
);
if
(
null
!=
apiInterface
){
if
(
null
!=
apiInterface
)
{
return
apiInterface
;
}
return
null
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/OrganizationManageImpl.java
View file @
1e9b3f69
...
...
@@ -3,6 +3,8 @@ package com.jz.dm.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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
;
...
...
@@ -74,10 +76,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
@Override
public
Result
add
(
OrganizationManageAddReq
req
)
{
//
SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS);
//
if (null == currentUser){
//
return Result.of_error(ResultMsg.USER_NOT_EXIST);
//
}
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
)
{
...
...
@@ -98,7 +100,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
}
apiOrg
.
setOrgCode
(
coding
);
//组织编码需要生成
apiOrg
.
setStatus
(
"1"
);
//正常
//
apiOrg.setCreateUser(currentUser.getUserName());
apiOrg
.
setCreateUser
(
currentUser
.
getUserName
());
if
(
apiOrgMapper
.
insert
(
apiOrg
)
>
0
)
{
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
}
...
...
@@ -130,10 +132,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
@Override
public
Result
update
(
OrganizationManageUpdateReq
req
)
{
//
SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS);
//
if (null == currentUser){
//
return Result.of_error(ResultMsg.USER_NOT_EXIST);
//
}
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
(
"组织信息不存在!"
);
...
...
@@ -148,7 +150,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
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
);
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
1e9b3f69
...
...
@@ -3,7 +3,9 @@ package com.jz.dm.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
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.plugins.pagination.Page
;
import
com.jz.common.bean.SysUserDto
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.utils.RedisUtils
;
...
...
@@ -54,6 +56,8 @@ public class ProducerServiceImpl implements ProducerService {
private
ApiOpenApiEsTagconfigMapper
apiOpenApiEsTagconfigMapper
;
@Resource
private
ApiInterfaceCustomMapper
apiInterfaceCustomMapper
;
@Resource
private
ApiInterfaceFileMapper
apiInterfaceFileMapper
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
...
...
@@ -68,6 +72,21 @@ public class ProducerServiceImpl implements ProducerService {
@Value
(
"${dmp.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
...
...
@@ -251,6 +270,8 @@ public class ProducerServiceImpl implements ProducerService {
return
Result
.
of_success
(
ResultMsg
.
INSERT_SUCCESS
);
}
/**
* 保存修改的api信息
*
...
...
jz-dm-apigateway/src/main/resources/mapper/ApiInterfaceCustomMapper.xml
View file @
1e9b3f69
<?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.ApiInterfaceMapper"
>
<mapper
namespace=
"com.jz.dm.mapper.ApiInterface
Custom
Mapper"
>
</mapper>
\ No newline at end of file
jz-dm-apigateway/src/main/resources/mapper/ApiInterfaceFileMapper.xml
0 → 100644
View file @
1e9b3f69
<?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
jz-dm-common/pom.xml
View file @
1e9b3f69
...
...
@@ -34,7 +34,12 @@
<groupId>
org.springframework.session
</groupId>
<artifactId>
spring-session-data-redis
</artifactId>
</dependency>
<!--httpclient包-->
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
4.5.6
</version>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>
com.alibaba
</groupId>
...
...
@@ -57,11 +62,11 @@
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<!-- swagger2接口文档 -->
<dependency>
...
...
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