新增租户时,新增客服和组长
This commit is contained in:
@@ -106,16 +106,16 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
public IPage<SysTenantEntity> selectSysTenantList(SysTenantQueryVo vo) {
|
||||
LambdaQueryWrapper<SysTenantEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByDesc(SysTenantEntity::getTenantId);
|
||||
//if (StrUtil.isNotBlank(vo.getTenantStatus())) {
|
||||
// if (StrUtil.isNotBlank(vo.getTenantStatus())) {
|
||||
// wrapper.eq(SysTenantEntity::getTenantStatus, vo.getTenantStatus());
|
||||
//}
|
||||
if (StrUtil.isNotBlank(vo.getTenantName())) {
|
||||
wrapper.like(SysTenantEntity::getTenantName, vo.getTenantName());
|
||||
}
|
||||
//if (StrUtil.isNotBlank(vo.getBeginTime())) {
|
||||
// if (StrUtil.isNotBlank(vo.getBeginTime())) {
|
||||
// wrapper.ge(SysTenantEntity::getTenantTime, vo.getBeginTime());
|
||||
//}
|
||||
//if (StrUtil.isNotBlank(vo.getEndTime())) {
|
||||
// if (StrUtil.isNotBlank(vo.getEndTime())) {
|
||||
// wrapper.le(SysTenantEntity::getTenantTime, vo.getEndTime());
|
||||
//}
|
||||
Page<SysTenantEntity> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
||||
@@ -207,10 +207,13 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
createUser(sysTenantEntity, deptId, roleId);
|
||||
// 创建域名
|
||||
this.createDomainAndDns(sysTenantEntity.getTenantKey());
|
||||
|
||||
// 新增客服和组长
|
||||
initOtherRule(sysTenantEntity, "waiter", "客服");
|
||||
initOtherRule(sysTenantEntity, "leader", "组长");
|
||||
return R.ok("租户创建成功!");
|
||||
}
|
||||
|
||||
|
||||
private Long createDept(SysTenantEntity sysTenantEntity) {
|
||||
// 创建部门
|
||||
SysDeptEntity dept = new SysDeptEntity();
|
||||
@@ -226,6 +229,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
return dept.getDeptId();
|
||||
}
|
||||
|
||||
|
||||
private Long createRole(SysTenantEntity sysTenantEntity) {
|
||||
// 创建角色
|
||||
SysRoleEntity role = new SysRoleEntity();
|
||||
@@ -242,6 +246,25 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
return role.getRoleId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sysTenantEntity 租户对象
|
||||
* @param roleKey 角色权限标识
|
||||
* @param ruleName 角色名称
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/6/13 16:20
|
||||
**/
|
||||
public void initOtherRule(SysTenantEntity sysTenantEntity, String roleKey, String ruleName) {
|
||||
SysRoleEntity role = new SysRoleEntity();
|
||||
role.setRoleName(sysTenantEntity.getTenantName() + ruleName);
|
||||
role.setRoleKey(roleKey);
|
||||
role.setDataScope("2");
|
||||
role.setMenuCheckStrictly(true);
|
||||
role.setDeptCheckStrictly(true);
|
||||
role.setDescription(ruleName);
|
||||
role.setTenantId(sysTenantEntity.getTenantId());
|
||||
roleMapper.insert(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 目前为单套餐,跟租户绑定,解耦防止套餐变动影响多个租户
|
||||
**/
|
||||
|
||||
Reference in New Issue
Block a user