Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
543a7b68
authored
Aug 31, 2023
by
李小龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
租户管理
parent
2106e41e
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
167 additions
and
41 deletions
db/platAuth.sql
db/saas.sql
saas-module/src/main/java/com/makeit/controller/config/SwaggerSaasConfig.java
saas-module/src/main/java/com/makeit/controller/saas/PlatTenantController.java
saas-module/src/main/java/com/makeit/controller/saas/SaasLoginController.java
saas-module/src/main/java/com/makeit/controller/saas/SaasOperationLogController.java
saas-module/src/main/java/com/makeit/controller/saas/SaasPrivacyConfigController.java
saas-module/src/main/java/com/makeit/controller/saas/SaasRoleController.java
saas-module/src/main/java/com/makeit/controller/saas/SaasUserController.java
server-common/src/main/java/com/makeit/module/admin/dto/plat/PlatTenantDTOVO.java
server-common/src/main/java/com/makeit/utils/user/TokenUtil.java
server-service/src/main/java/com/makeit/entity/saas/PlatTenant.java
server-service/src/main/java/com/makeit/server/platform/auth/impl/PlatUserServiceImpl.java
server-service/src/main/java/com/makeit/service/saas/impl/PlatTenantServiceImpl.java
server-service/src/main/java/com/makeit/service/saas/impl/SaasOperationLogServiceImpl.java
server-web/src/main/resources/application.yml
db/platAuth.sql
View file @
543a7b68
...
...
@@ -13,7 +13,7 @@ CREATE TABLE `plat_user` (
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_date`
datetime
NOT
NULL
COMMENT
'更新时间'
,
`del_flag`
CHAR
(
1
)
DEFAULT
NULL
COMMENT
'删除标识'
,
`create
d
_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`create_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`update_by`
varchar
(
64
)
NOT
NULL
COMMENT
'更新人'
,
`org_id`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'部门树id'
,
`org_path`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'部门树冗余id'
,
...
...
@@ -34,8 +34,8 @@ CREATE TABLE `plat_role` (
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_date`
datetime
NOT
NULL
COMMENT
'更新时间'
,
`del_flag`
CHAR
(
1
)
DEFAULT
NULL
COMMENT
'删除标识'
,
`update
d
_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'更新人'
,
`create
d
_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'创建人'
,
`update_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'更新人'
,
`create_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'创建人'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
COMPACT
COMMENT
=
'租户端角色'
;
...
...
@@ -47,7 +47,7 @@ CREATE TABLE `plat_user_role` (
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_date`
datetime
NOT
NULL
COMMENT
'更新时间'
,
`del_flag`
CHAR
(
1
)
DEFAULT
NULL
COMMENT
'删除标识'
,
`create
d
_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`create_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`update_by`
varchar
(
64
)
NOT
NULL
COMMENT
'更新人'
,
PRIMARY
KEY
(
`id`
),
KEY
`plat_user_role_role_id_index`
(
`role_id`
),
...
...
@@ -62,7 +62,7 @@ CREATE TABLE `plat_role_menu` (
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_date`
datetime
NOT
NULL
COMMENT
'更新时间'
,
`del_flag`
CHAR
(
1
)
DEFAULT
NULL
COMMENT
'删除标识'
,
`create
d
_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`create_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`update_by`
varchar
(
64
)
NOT
NULL
COMMENT
'更新人'
,
PRIMARY
KEY
(
`id`
),
KEY
`plat_role_menu_menu_id_index`
(
`menu_id`
),
...
...
@@ -82,7 +82,7 @@ CREATE TABLE `plat_org` (
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_date`
datetime
NOT
NULL
COMMENT
'更新时间'
,
`del_flag`
CHAR
(
1
)
DEFAULT
NULL
COMMENT
'删除标识'
,
`create
d
_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`create_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`update_by`
varchar
(
64
)
NOT
NULL
COMMENT
'更新人'
,
PRIMARY
KEY
(
`id`
),
KEY
`plat_org_parent_id_index`
(
`parent_id`
)
...
...
@@ -96,7 +96,7 @@ CREATE TABLE `plat_role_org` (
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_date`
datetime
NOT
NULL
COMMENT
'更新时间'
,
`del_flag`
CHAR
(
1
)
DEFAULT
NULL
COMMENT
'删除标识'
,
`create
d
_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`create_by`
varchar
(
64
)
NOT
NULL
COMMENT
'创建人'
,
`update_by`
varchar
(
64
)
NOT
NULL
COMMENT
'更新人'
,
PRIMARY
KEY
(
`id`
),
KEY
`plat_role_iorg_id_index`
(
`org_id`
),
...
...
db/saas.sql
View file @
543a7b68
...
...
@@ -138,7 +138,7 @@ CREATE TABLE `plat_tenant` (
`status`
varchar
(
10
)
NOT
NULL
COMMENT
'状态 0停用 1启用'
,
`start_time`
datetime
NOT
NULL
COMMENT
'租户有效期-开始时间'
,
`end_time`
datetime
NOT
NULL
COMMENT
'租户有效期-结束时间'
,
`
tn
t_user_id`
varchar
(
64
)
NOT
NULL
COMMENT
'租户管理员id'
,
`
pla
t_user_id`
varchar
(
64
)
NOT
NULL
COMMENT
'租户管理员id'
,
`menu_list`
varchar
(
600
)
DEFAULT
NULL
COMMENT
'菜单id列表 以逗号分隔'
,
`alert_channel`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'告警渠道 1-短信 2-邮件 3-语音短信 4-云龄工单 5-晶奇工单'
,
`create_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
...
...
saas-module/src/main/java/com/makeit/controller/config/SwaggerSaasConfig.java
View file @
543a7b68
...
...
@@ -46,7 +46,7 @@ public class SwaggerSaasConfig {
Docket
docket
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
groupName
(
"01-saas管理"
);
.
groupName
(
"01-saas管理
端
"
);
ApiSelectorBuilder
builder
=
docket
.
select
();
//api过滤
builder
=
builder
.
apis
(
...
...
saas-module/src/main/java/com/makeit/controller/saas/PlatTenantController.java
0 → 100644
View file @
543a7b68
package
com
.
makeit
.
controller
.
saas
;
import
com.makeit.common.dto.BaseIdDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.entity.saas.PlatTenant
;
import
com.makeit.global.annotation.Action
;
import
com.makeit.module.admin.dto.plat.PlatTenantDTOVO
;
import
com.makeit.module.admin.dto.plat.PlatTenantMenuDTO
;
import
com.makeit.module.admin.dto.plat.PlatTenantStatusDTO
;
import
com.makeit.module.admin.vo.plat.PlatTenantVO
;
import
com.makeit.service.saas.PlatTenantService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 租户 前端控制器
* </p>
*
* @author eugene young
* @since 2022-05-10
*/
@Api
(
tags
=
"租户管理-租户"
)
@RestController
@RequestMapping
(
"/saas/tenant"
)
public
class
PlatTenantController
{
@Autowired
private
PlatTenantService
platTenantService
;
@Action
(
module
=
"租户管理-租户"
,
name
=
"分页列表"
,
code
=
"plat:tnt:tenant:page"
)
@ApiOperation
(
"分页列表"
)
@PostMapping
(
"page"
)
public
ApiResponseEntity
<
PageVO
<
PlatTenantVO
>>
page
(
@RequestBody
PageReqDTO
<
PlatTenantVO
>
page
){
return
ApiResponseUtils
.
success
(
platTenantService
.
page
(
page
));
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"列表"
,
code
=
"plat:tnt:tenant:list"
)
@ApiOperation
(
"列表"
)
@PostMapping
(
"list"
)
public
ApiResponseEntity
<
List
<
PlatTenant
>>
list
(
@RequestBody
PlatTenantVO
dto
){
return
ApiResponseUtils
.
success
(
platTenantService
.
list
(
dto
));
}
@ApiOperation
(
"分页列表(AuthIgnore)"
)
@PostMapping
(
"pageAuthIgnore"
)
public
ApiResponseEntity
<
PageVO
<
PlatTenantVO
>>
pageAuthIgnore
(
@RequestBody
PageReqDTO
<
PlatTenantVO
>
page
){
return
ApiResponseUtils
.
success
(
platTenantService
.
page
(
page
));
}
@ApiOperation
(
"列表(AuthIgnore)"
)
@PostMapping
(
"listAuthIgnore"
)
public
ApiResponseEntity
<
List
<
PlatTenant
>>
listAuthIgnore
(
@RequestBody
PlatTenantVO
dto
){
return
ApiResponseUtils
.
success
(
platTenantService
.
list
(
dto
));
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"列表 根据账号精确查询"
,
code
=
"plat:tnt:tenant:listByUserIdAndAccount"
)
@ApiOperation
(
"列表 根据账号精确查询"
)
@PostMapping
(
"listByUserIdAndAccount"
)
public
ApiResponseEntity
<
List
<
PlatTenant
>>
listByUserIdAndAccount
(
@RequestBody
PlatTenantVO
dto
){
return
ApiResponseUtils
.
success
(
platTenantService
.
listByUserIdAndAccount
(
dto
));
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"新增"
,
code
=
"plat:tnt:tenant:add"
)
@ApiOperation
(
"新增"
)
@PostMapping
(
"add"
)
public
ApiResponseEntity
<
String
>
add
(
@Validated
@RequestBody
PlatTenantDTOVO
dto
){
;
return
ApiResponseUtils
.
success
(
platTenantService
.
add
(
dto
));
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"编辑"
,
code
=
"plat:tnt:tenant:edit"
)
@ApiOperation
(
"编辑"
)
@PostMapping
(
"edit"
)
public
ApiResponseEntity
<?>
edit
(
@Validated
@RequestBody
PlatTenantDTOVO
dto
){
platTenantService
.
edit
(
dto
);
return
ApiResponseUtils
.
success
();
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"详情"
,
code
=
"plat:tnt:tenant:view"
)
@ApiOperation
(
"详情"
)
@PostMapping
(
"view"
)
public
ApiResponseEntity
<
PlatTenantDTOVO
>
view
(
@RequestBody
BaseIdDTO
dto
){
return
ApiResponseUtils
.
success
(
platTenantService
.
view
(
dto
.
getId
()));
}
@ApiOperation
(
"详情"
)
@PostMapping
(
"viewIgnore"
)
public
ApiResponseEntity
<
PlatTenantDTOVO
>
viewIgnore
(
@RequestBody
BaseIdDTO
dto
){
return
ApiResponseUtils
.
success
(
platTenantService
.
view
(
dto
.
getId
()));
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"删除"
,
code
=
"plat:tnt:tenant:del"
)
@ApiOperation
(
"删除"
)
@PostMapping
(
"del"
)
public
ApiResponseEntity
<?>
del
(
@RequestBody
BaseIdDTO
dto
){
platTenantService
.
del
(
dto
.
getId
());
return
ApiResponseUtils
.
success
();
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"改变状态"
,
code
=
"plat:tnt:tenant:changeStatus"
)
@ApiOperation
(
"改变状态"
)
@PostMapping
(
"changeStatus"
)
public
ApiResponseEntity
<?>
changeStatus
(
@RequestBody
PlatTenantStatusDTO
dto
){
platTenantService
.
changeStatus
(
dto
);
return
ApiResponseUtils
.
success
();
}
@Action
(
module
=
"租户管理-租户"
,
name
=
"租户分配菜单"
,
code
=
"plat:tnt:tenant:assignMenuList"
)
@ApiOperation
(
"租户分配菜单"
)
@PostMapping
(
"assignMenuList"
)
public
ApiResponseEntity
<?>
assignMenuList
(
@RequestBody
PlatTenantMenuDTO
tntTenantMenuDTO
){
platTenantService
.
assignMenuList
(
tntTenantMenuDTO
);
return
ApiResponseUtils
.
success
();
}
}
saas-module/src/main/java/com/makeit/controller/saas/SaasLoginController.java
View file @
543a7b68
...
...
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"
saas端
-登录"
)
@Api
(
tags
=
"
系统管理
-登录"
)
@RestController
@RequestMapping
(
"/saas/login"
)
public
class
SaasLoginController
{
...
...
saas-module/src/main/java/com/makeit/controller/saas/SaasOperationLogController.java
View file @
543a7b68
...
...
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"
saas端-
系统管理-系统日志"
)
@Api
(
tags
=
"系统管理-系统日志"
)
@RestController
@RequestMapping
(
"/saas/sys/operationLog"
)
public
class
SaasOperationLogController
{
...
...
saas-module/src/main/java/com/makeit/controller/saas/SaasPrivacyConfigController.java
View file @
543a7b68
...
...
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2022年5月28日
* @description
*/
@Api
(
tags
=
"
saas端
-隐私政策-关于我们"
)
@Api
(
tags
=
"
系统管理
-隐私政策-关于我们"
)
@RestController
@RequestMapping
(
"/saas/sys/privacyConfig"
)
public
class
SaasPrivacyConfigController
{
...
...
saas-module/src/main/java/com/makeit/controller/saas/SaasRoleController.java
View file @
543a7b68
...
...
@@ -29,7 +29,7 @@ import java.util.List;
* @author eugene young
* @since 2022-05-10
*/
@Api
(
tags
=
"
saas端
-角色"
)
@Api
(
tags
=
"
系统管理
-角色"
)
@RestController
@RequestMapping
(
"/saas/role"
)
public
class
SaasRoleController
{
...
...
saas-module/src/main/java/com/makeit/controller/saas/SaasUserController.java
View file @
543a7b68
...
...
@@ -31,7 +31,7 @@ import java.util.List;
* @author eugene young
* @since 2022-05-10
*/
@Api
(
tags
=
"
SAAS端
-用户"
)
@Api
(
tags
=
"
系统管理
-用户"
)
@RestController
@RequestMapping
(
"/saas/user"
)
public
class
SaasUserController
{
...
...
server-common/src/main/java/com/makeit/module/admin/dto/plat/PlatTenantDTOVO.java
View file @
543a7b68
...
...
@@ -48,7 +48,7 @@ public class PlatTenantDTOVO extends BaseIdDTO {
//todo dto
@ApiModelProperty
(
value
=
"租户账号 详情用"
)
private
PlatUserVO
tntUser
;
private
PlatUserVO
platUserVO
;
// @ApiModelProperty(value = "菜单id列表 以逗号分隔")
// private String menuList;
...
...
server-common/src/main/java/com/makeit/utils/user/TokenUtil.java
View file @
543a7b68
...
...
@@ -41,7 +41,7 @@ public class TokenUtil {
public
static
SaasUserLoginVO
getPlatUserDetail
()
{
String
token
=
RequestUtil
.
getHeader
(
HeaderConst
.
PLATFORM_TOKEN
);
if
(
StringUtils
.
isNotBlank
(
token
))
{
SaasUserLoginVO
userLoginVO
=
Redis
Util
.
get
(
RedisConst
.
PLATFORM_TOKEN_PREFIX
+
token
);
SaasUserLoginVO
userLoginVO
=
Redis
TemplateUtil
.
get
(
RedisConst
.
PLATFORM_TOKEN_PREFIX
+
token
,
SaasUserLoginVO
.
class
);
return
userLoginVO
;
}
return
null
;
...
...
server-service/src/main/java/com/makeit/entity/saas/PlatTenant.java
View file @
543a7b68
...
...
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
com.makeit.common.entity.BaseEntity
;
import
lombok.Data
;
import
java.time.LocalDate
Time
;
import
java.time.LocalDate
;
/**
* 租户管理
...
...
@@ -27,17 +27,17 @@ public class PlatTenant extends BaseEntity {
/**
* 租户有效期-开始时间
*/
private
LocalDate
Time
startTime
;
private
LocalDate
startTime
;
/**
* 租户有效期-结束时间
*/
private
LocalDate
Time
endTime
;
private
LocalDate
endTime
;
/**
* 租户管理员id
*/
private
String
tn
tUserId
;
private
String
pla
tUserId
;
/**
* 菜单id列表 以逗号分隔
...
...
server-service/src/main/java/com/makeit/server/platform/auth/impl/PlatUserServiceImpl.java
View file @
543a7b68
...
...
@@ -164,10 +164,10 @@ implements PlatUserService{
List
<
String
>
userIdList
=
StreamUtil
.
map
(
tntUserList
,
PlatUserDTOVO:
:
getId
);
userIdList
.
add
(-
1
+
""
);
List
<
PlatTenant
>
tenantList
=
platTenantService
.
list
(
new
QueryWrapper
<
PlatTenant
>().
lambda
()
.
in
(
PlatTenant:
:
get
Tn
tUserId
,
userIdList
)
.
in
(
PlatTenant:
:
get
Pla
tUserId
,
userIdList
)
.
orderByAsc
(
PlatTenant:
:
getCreateDate
)
);
Map
<
String
,
List
<
PlatTenant
>>
userIdTenantListMap
=
StreamUtil
.
groupBy
(
tenantList
,
PlatTenant:
:
get
Tn
tUserId
);
Map
<
String
,
List
<
PlatTenant
>>
userIdTenantListMap
=
StreamUtil
.
groupBy
(
tenantList
,
PlatTenant:
:
get
Pla
tUserId
);
tntUserList
.
forEach
(
e
->
{
List
<
PlatTenant
>
tenantList1
=
userIdTenantListMap
.
get
(
e
.
getId
());
if
(
tenantList1
!=
null
)
{
...
...
@@ -307,7 +307,7 @@ implements PlatUserService{
public
void
del
(
String
id
)
{
long
count
=
platTenantService
.
count
(
new
QueryWrapper
<
PlatTenant
>().
lambda
()
.
eq
(
PlatTenant:
:
get
Tn
tUserId
,
id
));
.
eq
(
PlatTenant:
:
get
Pla
tUserId
,
id
));
if
(
count
>
0
)
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_CANT_REMOVE_TENANT_USER_LINK
);
...
...
@@ -336,7 +336,7 @@ implements PlatUserService{
if
(
IsTenantAccountEnum
.
YES
.
getValue
().
equals
(
tntUserLoginVO
.
getIsTenant
()))
{
List
<
PlatTenant
>
tntTenantList
=
platTenantService
.
list
(
new
QueryWrapper
<
PlatTenant
>().
lambda
()
.
eq
(
PlatTenant:
:
getStatus
,
CommonEnum
.
YES
.
getValue
())
.
eq
(
PlatTenant:
:
get
Tn
tUserId
,
tntUserLoginVO
.
getId
())
.
eq
(
PlatTenant:
:
get
Pla
tUserId
,
tntUserLoginVO
.
getId
())
.
orderByAsc
(
PlatTenant:
:
getCreateDate
)
);
List
<
PlatTenantVO
>
voList
=
BeanDtoVoUtils
.
listVo
(
tntTenantList
,
PlatTenantVO
.
class
);
...
...
@@ -354,7 +354,7 @@ implements PlatUserService{
if
(
IsTenantAccountEnum
.
YES
.
getValue
().
equals
(
tntUser
.
getIsTenant
()))
{
List
<
PlatTenant
>
tntTenantList
=
platTenantService
.
list
(
new
QueryWrapper
<
PlatTenant
>().
lambda
()
.
eq
(
PlatTenant:
:
getStatus
,
CommonEnum
.
YES
.
getValue
())
.
eq
(
PlatTenant:
:
get
Tn
tUserId
,
tntUser
.
getId
())
.
eq
(
PlatTenant:
:
get
Pla
tUserId
,
tntUser
.
getId
())
.
orderByAsc
(
PlatTenant:
:
getCreateDate
)
);
return
tntTenantList
;
...
...
server-service/src/main/java/com/makeit/service/saas/impl/PlatTenantServiceImpl.java
View file @
543a7b68
...
...
@@ -20,9 +20,9 @@ import com.makeit.mapper.saas.PlatTenantMapper;
import
com.makeit.module.admin.dto.plat.PlatTenantDTOVO
;
import
com.makeit.module.admin.dto.plat.PlatTenantMenuDTO
;
import
com.makeit.module.admin.dto.plat.PlatTenantStatusDTO
;
import
com.makeit.module.admin.vo.plat.PlatTenantVO
;
import
com.makeit.module.system.service.SysConfigService
;
import
com.makeit.server.platform.auth.PlatUserService
;
import
com.makeit.service.saas.PlatMenuService
;
import
com.makeit.service.saas.PlatTenantMenuService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.service.saas.SaasOperationLogService
;
...
...
@@ -37,14 +37,12 @@ import com.makeit.utils.user.plat.PlatUserVO;
import
com.makeit.utils.user.plat.TntUserJoinUtil
;
import
com.makeit.utils.user.wechat.WechatUserInfo
;
import
com.makeit.utils.user.wechat.WechatUserUtil
;
import
com.makeit.module.admin.vo.plat.PlatTenantVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -60,9 +58,6 @@ public class PlatTenantServiceImpl extends ServiceImpl<PlatTenantMapper, PlatTen
implements
PlatTenantService
{
@Autowired
private
PlatMenuService
platMenuService
;
@Autowired
private
PlatUserService
platUserService
;
@Autowired
...
...
@@ -94,7 +89,7 @@ implements PlatTenantService {
LambdaQueryWrapper
<
PlatTenant
>
lambdaQueryWrapper
=
new
QueryWrapper
<
PlatTenant
>().
lambda
()
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getName
()),
PlatTenant:
:
getName
,
dto
.
getName
())
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getStatus
()),
PlatTenant:
:
getStatus
,
dto
.
getStatus
())
.
in
(
StringUtils
.
isNotBlank
(
dto
.
getUserAccount
()),
PlatTenant:
:
get
Tn
tUserId
,
tenantUserIdList
)
.
in
(
StringUtils
.
isNotBlank
(
dto
.
getUserAccount
()),
PlatTenant:
:
get
Pla
tUserId
,
tenantUserIdList
)
.
in
(
tenantIdList
!=
null
,
PlatTenant:
:
getId
,
tenantIdList
);
lambdaQueryWrapper
.
orderByDesc
(
PlatTenant:
:
getCreateDate
);
...
...
@@ -219,7 +214,7 @@ implements PlatTenantService {
public
PlatTenantDTOVO
view
(
String
id
)
{
PlatTenantDTOVO
userVO
=
BeanDtoVoUtils
.
convert
(
getById
(
id
),
PlatTenantDTOVO
.
class
);
TntUserJoinUtil
.
join
(
platUserService
,
Arrays
.
asList
(
userVO
),
PlatTenantDTOVO:
:
getPlatUserId
,(
t
,
u
)->
t
.
set
TntUser
(
BeanDtoVoUtils
.
convert
(
u
,
PlatUserVO
.
class
))
,
PlatUser:
:
getId
);
TntUserJoinUtil
.
join
(
platUserService
,
Arrays
.
asList
(
userVO
),
PlatTenantDTOVO:
:
getPlatUserId
,(
t
,
u
)->
t
.
set
PlatUserVO
(
BeanDtoVoUtils
.
convert
(
u
,
PlatUserVO
.
class
))
,
PlatUser:
:
getId
);
//platOperationLogService.add("平台端-租户账号-详情", id);
...
...
@@ -247,7 +242,7 @@ implements PlatTenantService {
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR
);
}
LocalDate
Time
now
=
LocalDateTim
e
.
now
();
LocalDate
now
=
LocalDat
e
.
now
();
if
(
CommonEnum
.
YES
.
getValue
().
equals
(
dto
.
getStatus
())
&&
(
now
.
compareTo
(
tntTenant
.
getStartTime
())
<
0
||
tntTenant
.
getEndTime
().
compareTo
(
now
)
<
0
))
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_CANT_CHANGE_TENANT_STATUS
);
}
...
...
@@ -306,7 +301,7 @@ implements PlatTenantService {
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_TENANT_NOT_EXIST
);
}
LocalDate
Time
localDate
=
LocalDateTim
e
.
now
();
LocalDate
localDate
=
LocalDat
e
.
now
();
if
(
tntTenant
.
getStartTime
().
compareTo
(
localDate
)
>
0
||
localDate
.
compareTo
(
tntTenant
.
getEndTime
())
>
0
)
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_TENANT_NOT_EXIST
);
}
...
...
server-service/src/main/java/com/makeit/service/saas/impl/SaasOperationLogServiceImpl.java
View file @
543a7b68
...
...
@@ -9,7 +9,7 @@ import com.makeit.entity.saas.SaasOperationLog;
import
com.makeit.mapper.saas.SaasOperationLogMapper
;
import
com.makeit.service.saas.SaasOperationLogService
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.user.
plat.Plat
UserUtil
;
import
com.makeit.utils.user.
saas.Saas
UserUtil
;
import
com.makeit.vo.saas.SaasOperationLogQueryVO
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -26,11 +26,11 @@ implements SaasOperationLogService{
@Transactional
@Override
public
void
add
(
String
content
,
String
tenantId
)
{
SaasOperationLog
plat
OperationLog
=
new
SaasOperationLog
();
plat
OperationLog
.
setContent
(
content
);
platOperationLog
.
setSaasUserId
(
Plat
UserUtil
.
getUserId
());
plat
OperationLog
.
setTenantId
(
tenantId
);
save
(
plat
OperationLog
);
SaasOperationLog
saas
OperationLog
=
new
SaasOperationLog
();
saas
OperationLog
.
setContent
(
content
);
saasOperationLog
.
setSaasUserId
(
Saas
UserUtil
.
getUserId
());
saas
OperationLog
.
setTenantId
(
tenantId
);
save
(
saas
OperationLog
);
}
@Override
...
...
server-web/src/main/resources/application.yml
View file @
543a7b68
...
...
@@ -152,6 +152,8 @@ tenant:
-
sys_auth_role_factory
-
sys_auth_user
-
wflow_model_perms
-
sys_config_category
-
sys_config
rsa
:
...
...
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