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
fa006437
authored
Sep 04, 2023
by
李小龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
组织角色
parent
35e57c70
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
186 additions
and
42 deletions
saas-module/src/main/java/com/makeit/controller/plat/PlatUserController.java
saas-module/src/main/java/com/makeit/controller/saas/SaasUserController.java
server-common/src/main/java/com/makeit/common/vo/ExcelErrorVo.java
server-common/src/main/java/com/makeit/module/admin/dto/plat/PlatUserQueryDTO.java
server-service/src/main/java/com/makeit/dto/platform/auth/PlatUserImportDTO.java
server-service/src/main/java/com/makeit/service/platform/auth/PlatUserService.java
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
server-service/src/main/java/com/makeit/service/saas/impl/PlatTenantServiceImpl.java
saas-module/src/main/java/com/makeit/controller/plat/PlatUserController.java
View file @
fa006437
package
com
.
makeit
.
controller
.
plat
;
package
com
.
makeit
.
controller
.
plat
;
import
com.makeit.common.dto.BaseBatchIdDTO
;
import
com.makeit.common.dto.BaseIdDTO
;
import
com.makeit.common.dto.BaseIdDTO
;
import
com.makeit.common.dto.StatusDTO
;
import
com.makeit.common.dto.StatusDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.common.vo.ExcelImportVo
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.global.annotation.Action
;
import
com.makeit.global.annotation.Action
;
import
com.makeit.module.admin.dto.plat.PlatUserDTOVO
;
import
com.makeit.module.admin.dto.plat.PlatUserDTOVO
;
import
com.makeit.module.admin.dto.plat.PlatUserQueryDTO
;
import
com.makeit.module.admin.dto.plat.PlatUserQueryDTO
;
...
@@ -20,7 +23,9 @@ import org.springframework.validation.annotation.Validated;
...
@@ -20,7 +23,9 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.List
;
...
@@ -111,6 +116,14 @@ public class PlatUserController {
...
@@ -111,6 +116,14 @@ public class PlatUserController {
return
ApiResponseUtils
.
success
();
return
ApiResponseUtils
.
success
();
}
}
@Action
(
module
=
"平台端-人员"
,
name
=
"批量删除"
,
code
=
"plat:user:del"
)
@ApiOperation
(
"批量删除"
)
@PostMapping
(
"delBatch"
)
public
ApiResponseEntity
<
Void
>
delBatch
(
@RequestBody
BaseBatchIdDTO
dto
)
{
platUserService
.
delBatch
(
dto
.
getIdList
());
return
ApiResponseUtils
.
success
();
}
@Action
(
module
=
"平台端-人员"
,
name
=
"改变状态"
,
code
=
"plat:user:changeStatus"
)
@Action
(
module
=
"平台端-人员"
,
name
=
"改变状态"
,
code
=
"plat:user:changeStatus"
)
@ApiOperation
(
"改变状态"
)
@ApiOperation
(
"改变状态"
)
@PostMapping
(
"changeStatus"
)
@PostMapping
(
"changeStatus"
)
...
@@ -143,5 +156,15 @@ public class PlatUserController {
...
@@ -143,5 +156,15 @@ public class PlatUserController {
return
ApiResponseUtils
.
success
(
platUserService
.
getUserDetail
());
return
ApiResponseUtils
.
success
(
platUserService
.
getUserDetail
());
}
}
@Action
(
module
=
"平台端-人员"
,
name
=
"批量导入"
,
code
=
"plat:user:import"
)
@ApiOperation
(
"批量导入"
)
@PostMapping
(
"import"
)
public
ApiResponseEntity
<
ExcelImportVo
>
importExcel
(
@RequestParam
(
value
=
"excelFile"
,
required
=
false
)
MultipartFile
excelFile
)
throws
Exception
{
if
(
excelFile
==
null
){
throw
new
BusinessException
(
"请上传excel"
);
}
ExcelImportVo
excelImportVo
=
platUserService
.
importExcel
(
excelFile
);
return
ApiResponseUtils
.
success
(
excelImportVo
);
}
}
}
saas-module/src/main/java/com/makeit/controller/saas/SaasUserController.java
View file @
fa006437
...
@@ -46,7 +46,7 @@ public class SaasUserController {
...
@@ -46,7 +46,7 @@ public class SaasUserController {
return
ApiResponseUtils
.
success
(
saasUserService
.
page
(
page
));
return
ApiResponseUtils
.
success
(
saasUserService
.
page
(
page
));
}
}
@ApiOperation
(
"分页列表"
)
@ApiOperation
(
"分页列表
-免登录
"
)
@PostMapping
(
"pageAuthIgnore"
)
@PostMapping
(
"pageAuthIgnore"
)
public
ApiResponseEntity
<
PageVO
<
SaasUserDTOVO
>>
pageAuthIgnore
(
@RequestBody
PageReqDTO
<
SaasUserQueryDTO
>
page
){
public
ApiResponseEntity
<
PageVO
<
SaasUserDTOVO
>>
pageAuthIgnore
(
@RequestBody
PageReqDTO
<
SaasUserQueryDTO
>
page
){
return
ApiResponseUtils
.
success
(
saasUserService
.
page
(
page
));
return
ApiResponseUtils
.
success
(
saasUserService
.
page
(
page
));
...
...
server-common/src/main/java/com/makeit/common/vo/ExcelErrorVo.java
View file @
fa006437
...
@@ -4,8 +4,11 @@ import com.makeit.utils.data.locale.LocaleUtil;
...
@@ -4,8 +4,11 @@ import com.makeit.utils.data.locale.LocaleUtil;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Objects
;
@Data
@Data
@ApiModel
(
"excel导入错误信息VO"
)
@ApiModel
(
"excel导入错误信息VO"
)
...
@@ -41,4 +44,17 @@ public class ExcelErrorVo implements Serializable {
...
@@ -41,4 +44,17 @@ public class ExcelErrorVo implements Serializable {
public
ExcelErrorVo
()
{
public
ExcelErrorVo
()
{
}
}
public
static
void
isNotNull
(
String
value
,
List
<
ExcelErrorVo
>
errorVoList
,
int
i
,
String
title
)
{
if
(
StringUtils
.
isBlank
(
value
))
{
errorVoList
.
add
(
new
ExcelErrorVo
(
i
,
title
,
"数据不为空"
));
}
}
public
static
void
notExists
(
Object
object
,
List
<
ExcelErrorVo
>
errorVoList
,
int
i
,
String
title
){
if
(
Objects
.
isNull
(
object
)){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
,
title
,
"数据库数据不存在"
));
}
}
}
}
server-common/src/main/java/com/makeit/module/admin/dto/plat/PlatUserQueryDTO.java
View file @
fa006437
...
@@ -32,20 +32,20 @@ public class PlatUserQueryDTO extends BaseOrgDTO {
...
@@ -32,20 +32,20 @@ public class PlatUserQueryDTO extends BaseOrgDTO {
@ApiModelProperty
(
value
=
"要排除的角色id roleId和notRoleId只能用一个"
)
@ApiModelProperty
(
value
=
"要排除的角色id roleId和notRoleId只能用一个"
)
private
String
notRoleId
;
private
String
notRoleId
;
@ApiModelProperty
(
value
=
"关键词 用来搜姓名或者工号"
)
//
@ApiModelProperty(value = "关键词 用来搜姓名或者工号")
private
String
keyword
;
//
private String keyword;
//
@ApiModelProperty
(
value
=
"职级"
)
//
@ApiModelProperty(value = "职级")
private
Integer
postLevel
;
//
private Integer postLevel;
//
@ApiModelProperty
(
value
=
"是否从酒店开始 0否 1是"
)
//
@ApiModelProperty(value = "是否从酒店开始 0否 1是")
private
String
fromHotel
;
//
private String fromHotel;
//
@ApiModelProperty
(
value
=
"是否常用人员 0否 1是"
)
//
@ApiModelProperty(value = "是否常用人员 0否 1是")
private
String
isFrequent
;
//
private String isFrequent;
//
@ApiModelProperty
(
value
=
"标签id"
)
//
@ApiModelProperty(value = "标签id")
private
String
labelId
;
//
private String labelId;
@ApiModelProperty
(
value
=
"用户工号集合"
)
@ApiModelProperty
(
value
=
"用户工号集合"
)
private
List
<
String
>
accountList
;
private
List
<
String
>
accountList
;
...
...
server-service/src/main/java/com/makeit/dto/platform/auth/PlatUserImportDTO.java
0 → 100644
View file @
fa006437
package
com
.
makeit
.
dto
.
platform
.
auth
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
@Data
public
class
PlatUserImportDTO
{
private
static
final
String
headDesc
=
"导入说明:\n"
+
"\n"
+
"1.带*号为必填项\n"
+
"\n"
+
"2.手机号和邮箱不可重复\n"
+
"\n"
+
"3.角色必须为【角色管理】处维护的角色名称\n"
+
"\n"
+
"4.导入人员默认登录密码为:888888"
;
@ExcelProperty
(
value
=
"姓名*"
)
private
String
username
;
@ExcelProperty
(
value
=
"手机号*"
)
private
String
mobile
;
@ExcelProperty
(
value
=
"邮箱"
)
private
String
email
;
@ExcelProperty
(
value
=
"所属组织*"
)
private
String
orgName
;
@ExcelProperty
(
value
=
"角色*"
)
private
String
roleName
;
@ExcelProperty
(
value
=
"备注"
)
private
String
remark
;
@ExcelIgnore
private
String
password
=
"888888"
;
}
server-service/src/main/java/com/makeit/service/platform/auth/PlatUserService.java
View file @
fa006437
...
@@ -6,6 +6,7 @@ import com.makeit.common.dto.LoginDTO;
...
@@ -6,6 +6,7 @@ import com.makeit.common.dto.LoginDTO;
import
com.makeit.common.dto.StatusDTO
;
import
com.makeit.common.dto.StatusDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.vo.ExcelImportVo
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatRole
;
import
com.makeit.entity.platform.auth.PlatRole
;
import
com.makeit.entity.platform.auth.PlatUser
;
import
com.makeit.entity.platform.auth.PlatUser
;
...
@@ -16,6 +17,7 @@ import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
...
@@ -16,6 +17,7 @@ import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
import
com.makeit.module.admin.vo.plat.PlatUserLoginVO
;
import
com.makeit.module.admin.vo.plat.PlatUserLoginVO
;
import
com.makeit.vo.platform.auth.PlatPersonDTOVO
;
import
com.makeit.vo.platform.auth.PlatPersonDTOVO
;
import
com.makeit.vo.platform.auth.PlatUserCountVO
;
import
com.makeit.vo.platform.auth.PlatUserCountVO
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -137,4 +139,8 @@ public interface PlatUserService extends IService<PlatUser> {
...
@@ -137,4 +139,8 @@ public interface PlatUserService extends IService<PlatUser> {
* @param platUserId
* @param platUserId
*/
*/
void
updatePlatUserTenantId
(
String
tenantId
,
String
platUserId
);
void
updatePlatUserTenantId
(
String
tenantId
,
String
platUserId
);
void
delBatch
(
List
<
String
>
idList
);
ExcelImportVo
importExcel
(
MultipartFile
excelFile
)
throws
Exception
;
}
}
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
View file @
fa006437
...
@@ -13,6 +13,9 @@ import com.makeit.common.entity.BaseBusEntity;
...
@@ -13,6 +13,9 @@ import com.makeit.common.entity.BaseBusEntity;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.vo.ExcelErrorVo
;
import
com.makeit.common.vo.ExcelImportVo
;
import
com.makeit.dto.platform.auth.PlatUserImportDTO
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatRole
;
import
com.makeit.entity.platform.auth.PlatRole
;
import
com.makeit.entity.platform.auth.PlatRoleMenu
;
import
com.makeit.entity.platform.auth.PlatRoleMenu
;
...
@@ -52,6 +55,8 @@ import com.makeit.utils.data.convert.BeanDtoVoUtils;
...
@@ -52,6 +55,8 @@ import com.makeit.utils.data.convert.BeanDtoVoUtils;
import
com.makeit.utils.data.convert.JsonUtil
;
import
com.makeit.utils.data.convert.JsonUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
com.makeit.utils.data.excel.ExcelUtil
;
import
com.makeit.utils.data.excel.ExcelValidatorUtil
;
import
com.makeit.utils.data.id.IdGen
;
import
com.makeit.utils.data.id.IdGen
;
import
com.makeit.utils.sql.groupby.DynamicQuery
;
import
com.makeit.utils.sql.groupby.DynamicQuery
;
import
com.makeit.utils.sql.groupby.SqlUtil
;
import
com.makeit.utils.sql.groupby.SqlUtil
;
...
@@ -70,6 +75,7 @@ import org.slf4j.LoggerFactory;
...
@@ -70,6 +75,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -247,7 +253,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -247,7 +253,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_USER_PASSWORD_NOT_BLANK
);
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_USER_PASSWORD_NOT_BLANK
);
}
}
setPassword
(
user
);
setPassword
(
user
);
user
.
setAccount
(
dto
.
getMobile
());
save
(
user
);
save
(
user
);
dto
.
setId
(
user
.
getId
());
dto
.
setId
(
user
.
getId
());
}
}
...
@@ -686,11 +692,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -686,11 +692,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getMobile
()),
PlatUser:
:
getMobile
,
dto
.
getMobile
())
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getMobile
()),
PlatUser:
:
getMobile
,
dto
.
getMobile
())
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getStatus
()),
PlatUser:
:
getStatus
,
dto
.
getStatus
())
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getStatus
()),
PlatUser:
:
getStatus
,
dto
.
getStatus
())
.
eq
(
PlatUser:
:
getTenantId
,
TenantIdUtil
.
getTenantId
())
.
eq
(
PlatUser:
:
getTenantId
,
TenantIdUtil
.
getTenantId
())
.
and
(
StringUtils
.
isNotBlank
(
dto
.
getKeyword
()),
qw
->
{
;
qw
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getKeyword
()),
PlatUser:
:
getUsername
,
dto
.
getKeyword
())
.
or
()
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getKeyword
()),
PlatUser:
:
getAccount
,
dto
.
getKeyword
());
});
roleIdFilter
(
lambdaQueryWrapper
,
dto
);
roleIdFilter
(
lambdaQueryWrapper
,
dto
);
...
@@ -781,24 +783,24 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -781,24 +783,24 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return
PageUtil
.
toPageVO
(
tntUserDTOVOList
,
pageList
);
return
PageUtil
.
toPageVO
(
tntUserDTOVOList
,
pageList
);
}
}
private
void
frequentUser
(
LambdaQueryWrapper
<
PlatUser
>
lambdaQueryWrapper
,
PlatUserQueryDTO
dto
)
{
//
private void frequentUser(LambdaQueryWrapper<PlatUser> lambdaQueryWrapper, PlatUserQueryDTO dto) {
if
(
CommonEnum
.
YES
.
getValue
().
equals
(
dto
.
getIsFrequent
()))
{
//
if (CommonEnum.YES.getValue().equals(dto.getIsFrequent())) {
//
List
<
String
>
frequentUserIdList
=
new
ArrayList
<>(
10
);
//
List<String> frequentUserIdList = new ArrayList<>(10);
frequentUserIdList
.
add
(-
1
+
""
);
//
frequentUserIdList.add(-1 + "");
//
// frequentUserIdList.addAll(
//
//
frequentUserIdList.addAll(
// StreamUtil.map(
//
//
StreamUtil.map(
// tntFrequentUserService.list(new QueryWrapper<PlatFrequentUser>().lambda()
//
//
tntFrequentUserService.list(new QueryWrapper<PlatFrequentUser>().lambda()
// .eq(PlatFrequentUser::getPlatUserId, PlatUserUtil.getUserId())
//
//
.eq(PlatFrequentUser::getPlatUserId, PlatUserUtil.getUserId())
// ),
//
//
),
// PlatFrequentUser::getFrequentUserId)
//
//
PlatFrequentUser::getFrequentUserId)
// );
//
//
);
//
lambdaQueryWrapper
.
in
(
CommonEnum
.
YES
.
getValue
().
equals
(
dto
.
getIsFrequent
()),
PlatUser:
:
getId
,
frequentUserIdList
);
//
lambdaQueryWrapper.in(CommonEnum.YES.getValue().equals(dto.getIsFrequent()), PlatUser::getId, frequentUserIdList);
//
}
//
}
}
//
}
private
void
roleIdList
(
LambdaQueryWrapper
<
PlatUser
>
lambdaQueryWrapper
,
PlatUserQueryDTO
dto
)
{
private
void
roleIdList
(
LambdaQueryWrapper
<
PlatUser
>
lambdaQueryWrapper
,
PlatUserQueryDTO
dto
)
{
if
(
CollectionUtils
.
isNotEmpty
(
dto
.
getRoleIdList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
dto
.
getRoleIdList
()))
{
...
@@ -825,7 +827,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -825,7 +827,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
//.eq(dto.getPostLevel() != null, PlatUser::getPostLevel, dto.getPostLevel())
//.eq(dto.getPostLevel() != null, PlatUser::getPostLevel, dto.getPostLevel())
.
eq
(
PlatUser:
:
getTenantId
,
TenantIdUtil
.
getTenantId
());
.
eq
(
PlatUser:
:
getTenantId
,
TenantIdUtil
.
getTenantId
());
frequentUser
(
lambdaQueryWrapper
,
dto
);
//
frequentUser(lambdaQueryWrapper, dto);
roleIdList
(
lambdaQueryWrapper
,
dto
);
roleIdList
(
lambdaQueryWrapper
,
dto
);
...
@@ -870,7 +872,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -870,7 +872,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
user
.
setStatus
(
CommonEnum
.
YES
.
getValue
());
user
.
setStatus
(
CommonEnum
.
YES
.
getValue
());
//user.setEmpStatus(CommonEnum.YES.getValue());
//user.setEmpStatus(CommonEnum.YES.getValue());
user
.
setAccount
(
dto
.
getMobile
());
save
(
user
);
save
(
user
);
dto
.
setId
(
user
.
getId
());
dto
.
setId
(
user
.
getId
());
setRoleList
(
dto
);
setRoleList
(
dto
);
...
@@ -1224,4 +1226,64 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -1224,4 +1226,64 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.
eq
(
BaseEntity:
:
getId
,
platUserId
);
.
eq
(
BaseEntity:
:
getId
,
platUserId
);
this
.
update
(
updateWrapper
);
this
.
update
(
updateWrapper
);
}
}
@Override
@Transactional
public
void
delBatch
(
List
<
String
>
idList
)
{
this
.
removeByIds
(
idList
);
}
/**
* 导入人员
* @param excelFile
*/
@Override
public
ExcelImportVo
importExcel
(
MultipartFile
excelFile
)
throws
Exception
{
List
<
PlatUserImportDTO
>
platUserImportDTOS
=
ExcelUtil
.
importExcel
(
null
,
3
,
excelFile
,
PlatUserImportDTO
.
class
);
LambdaQueryWrapper
<
PlatOrg
>
orgLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
orgLambdaQueryWrapper
.
select
(
BaseEntity:
:
getId
,
PlatOrg:
:
getName
);
List
<
PlatOrg
>
orgList
=
platOrgService
.
list
(
orgLambdaQueryWrapper
);
LambdaQueryWrapper
<
PlatRole
>
roleLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
roleLambdaQueryWrapper
.
select
(
BaseEntity:
:
getId
,
PlatRole:
:
getName
);
List
<
PlatRole
>
roleList
=
platRoleService
.
list
(
roleLambdaQueryWrapper
);
Map
<
String
,
String
>
orgNameMap
=
orgList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatOrg:
:
getName
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
Map
<
String
,
String
>
roleNameMap
=
roleList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatRole:
:
getName
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
LambdaQueryWrapper
<
PlatUser
>
userLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
userLambdaQueryWrapper
.
select
(
PlatUser:
:
getMobile
,
PlatUser:
:
getEmail
,
BaseEntity:
:
getId
);
List
<
PlatUser
>
userList
=
this
.
list
(
userLambdaQueryWrapper
);
Map
<
String
,
String
>
mobileMap
=
userList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatUser:
:
getMobile
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
Map
<
String
,
String
>
emailMap
=
userList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatUser:
:
getEmail
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
return
ExcelValidatorUtil
.
validate
(
platUserImportDTOS
,
list
->
{
List
<
ExcelErrorVo
>
errorVoList
=
new
ArrayList
<>();
int
start
=
3
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
PlatUserImportDTO
dto
=
list
.
get
(
i
);
ExcelErrorVo
.
isNotNull
(
dto
.
getUsername
(),
errorVoList
,
start
+
i
,
"姓名*"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getRoleName
(),
errorVoList
,
start
+
i
,
"角色*"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getRoleName
(),
errorVoList
,
start
+
i
,
"所属组织*"
);
ExcelErrorVo
.
notExists
(
orgNameMap
.
get
(
dto
.
getOrgName
()),
errorVoList
,
start
+
i
,
"所属组织*"
);
ExcelErrorVo
.
notExists
(
roleNameMap
.
get
(
dto
.
getRoleName
()),
errorVoList
,
start
+
i
,
"角色*"
);
ExcelErrorVo
.
notExists
(
mobileMap
.
get
(
dto
.
getMobile
()),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
notExists
(
emailMap
.
get
(
dto
.
getEmail
()),
errorVoList
,
start
+
i
,
"邮箱"
);
}
if
(
errorVoList
.
isEmpty
()){
List
<
PlatUser
>
platUsers
=
new
ArrayList
<>();
list
.
forEach
(
vo
->{
PlatUser
platUser
=
BeanDtoVoUtils
.
convert
(
vo
,
PlatUser
.
class
);
setPassword
(
platUser
);
platUsers
.
add
(
platUser
);
});
saveBatch
(
platUsers
);
}
return
errorVoList
;
},
null
);
}
}
}
server-service/src/main/java/com/makeit/service/saas/impl/PlatTenantServiceImpl.java
View file @
fa006437
...
@@ -128,7 +128,7 @@ implements PlatTenantService {
...
@@ -128,7 +128,7 @@ implements PlatTenantService {
TntUserJoinUtil
.
join
(
platUserService
,
voList
,
qw
->
qw
.
eq
(
PlatUser:
:
getIsTenant
,
IsTenantAccountEnum
.
YES
.
getValue
()),
TntUserJoinUtil
.
join
(
platUserService
,
voList
,
qw
->
qw
.
eq
(
PlatUser:
:
getIsTenant
,
IsTenantAccountEnum
.
YES
.
getValue
()),
PlatTenantVO:
:
getTntUserId
,(
t
,
u
)
->
{
PlatTenantVO:
:
getTntUserId
,(
t
,
u
)
->
{
t
.
setUserAccount
(
u
.
get
Account
());
t
.
setUserAccount
(
u
.
get
Mobile
());
t
.
setUserName
(
u
.
getUsername
());
t
.
setUserName
(
u
.
getUsername
());
},
BaseEntity:
:
getId
);
},
BaseEntity:
:
getId
);
...
...
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