|
|
@ -2,10 +2,10 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysPositionService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
|
|
|
|
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
@ -14,6 +14,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysMenuRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysRefRoleMenuRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysRefRoleMenuRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysRefUserRoleRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysRefUserRoleRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysRoleRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysRoleRepository;
|
|
|
@ -21,9 +22,12 @@ import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
|
|
|
import cn.estsh.impp.framework.base.service.CacheCrudService;
|
|
|
|
import cn.estsh.impp.framework.base.service.CacheCrudService;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@ -79,31 +83,6 @@ public class SysRoleService extends CacheCrudService<SysRole> implements ISysRol
|
|
|
|
return CoreHqlPack.packDdlBeanSysRole(bean);
|
|
|
|
return CoreHqlPack.packDdlBeanSysRole(bean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// @ApiOperation(value = "更新角色信息",notes = "更新角色信息")
|
|
|
|
|
|
|
|
// public void updateSysRole(SysRole sysRole) {
|
|
|
|
|
|
|
|
// LOGGER.info("系统角色 SYS_ROLE :{}", sysRole);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 更新角色信息
|
|
|
|
|
|
|
|
// roleRDao.update(sysRole);
|
|
|
|
|
|
|
|
// // 更新账号角色关系冗余信息
|
|
|
|
|
|
|
|
// refUserRoleRDao.updateByProperties(new String[]{"roleId"}, new Object[]{sysRole.getId()},
|
|
|
|
|
|
|
|
// new String[]{"roleNameRdd"}, new Object[]{sysRole.getName()});
|
|
|
|
|
|
|
|
// // 更新角色
|
|
|
|
|
|
|
|
// refRoleMenuRDao.updateByProperties(new String[]{"roleId"}, new Object[]{sysRole.getId()},
|
|
|
|
|
|
|
|
// new String[]{"roleNameRdd"}, new Object[]{sysRole.getName()});
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// @ApiOperation(value = "更新角色信息",notes = "更新角色状态信息")
|
|
|
|
|
|
|
|
// public void updateSysRoleStatus(Long id, int status, SessionUser user) {
|
|
|
|
|
|
|
|
// LOGGER.info("系统角色 SYS_MENU id:{} status:{} user:{}", id,status,user);
|
|
|
|
|
|
|
|
// SysRole role = roleRDao.getById(id);
|
|
|
|
|
|
|
|
// role.setRoleStatus(status);
|
|
|
|
|
|
|
|
// role.setModifyUser(user.getUserName());
|
|
|
|
|
|
|
|
// roleRDao.update(role);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ApiOperation(value = "更新角色信息",notes = "根据ID 批量更新角色状态信息")
|
|
|
|
@ApiOperation(value = "更新角色信息",notes = "根据ID 批量更新角色状态信息")
|
|
|
|
public void updateSysRoleStatusByIds(Long[] ids, int status, SessionUser user) {
|
|
|
|
public void updateSysRoleStatusByIds(Long[] ids, int status, SessionUser user) {
|
|
|
@ -113,30 +92,7 @@ public class SysRoleService extends CacheCrudService<SysRole> implements ISysRol
|
|
|
|
HqlPack.getInPack(StringUtils.join( ids,","), "id", where);
|
|
|
|
HqlPack.getInPack(StringUtils.join( ids,","), "id", where);
|
|
|
|
roleRDao.updateByHqlWhere(where.toString(), "roleStatus", status);
|
|
|
|
roleRDao.updateByHqlWhere(where.toString(), "roleStatus", status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// @ApiOperation(value = "删除角色信息",notes = "根据ID 删除角色信息")
|
|
|
|
|
|
|
|
// public void deleteSysRoleById(Long id) {
|
|
|
|
|
|
|
|
// LOGGER.info("系统角色 SYS_ROLE Key:{}", id);
|
|
|
|
|
|
|
|
// refRoleMenuRDao.deleteByProperty("roleId",id);
|
|
|
|
|
|
|
|
// roleRDao.deleteById(id);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// @ApiOperation(value = "删除角色信息",notes = "根据ID 批量删除角色信息")
|
|
|
|
|
|
|
|
// public void deleteSysRoleByIds(Long[] ids) {
|
|
|
|
|
|
|
|
// LOGGER.info("系统角色 SYS_ROLE ids :{}", ids);
|
|
|
|
|
|
|
|
// refRoleMenuRDao.deleteByPropertyIn("roleId",ids);
|
|
|
|
|
|
|
|
// roleRDao.deleteByIds(ids);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// @ApiOperation(value = "新增角色信息")
|
|
|
|
|
|
|
|
// public SysRole insertSysRole(SysRole sysRole) {
|
|
|
|
|
|
|
|
// LOGGER.info("系统角色 SYS_ROLE :{}", sysRole);
|
|
|
|
|
|
|
|
// return roleRDao.insert(sysRole);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ApiOperation(value = "刷新角色菜单关系",notes = "刷新 角色 菜单关系信息")
|
|
|
|
@ApiOperation(value = "刷新角色菜单关系",notes = "刷新 角色 菜单关系信息")
|
|
|
|
public void refreshSysRoleRef(Long roleId,Long[] ids,String userName) {
|
|
|
|
public void refreshSysRoleRef(Long roleId,Long[] ids,String userName) {
|
|
|
@ -181,6 +137,7 @@ public class SysRoleService extends CacheCrudService<SysRole> implements ISysRol
|
|
|
|
ref.setRoleNameRdd(role.getName());
|
|
|
|
ref.setRoleNameRdd(role.getName());
|
|
|
|
ref.setMenuNameRdd(menu.getName());
|
|
|
|
ref.setMenuNameRdd(menu.getName());
|
|
|
|
ref.setMenuId(menu.getId());
|
|
|
|
ref.setMenuId(menu.getId());
|
|
|
|
|
|
|
|
ref.setSoftType(menu.getSoftType());
|
|
|
|
ref.setMenuTypeRdd(menu.getMenuType());
|
|
|
|
ref.setMenuTypeRdd(menu.getMenuType());
|
|
|
|
ConvertBean.serviceModelInitialize(ref, AuthUtil.getSessionUser());
|
|
|
|
ConvertBean.serviceModelInitialize(ref, AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
|
|
|
@ -216,6 +173,47 @@ public class SysRoleService extends CacheCrudService<SysRole> implements ISysRol
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void refreshSysRoleRef(Long roleId, Integer softType, List<Long> idList, String userName) {
|
|
|
|
|
|
|
|
SysRole role = roleRDao.getById(roleId);
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(role,"不存在的角色信息");
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(softType,"不存在的产品信息");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysMenu menu = new SysMenu();
|
|
|
|
|
|
|
|
menu.setSoftType(softType);
|
|
|
|
|
|
|
|
List<SysMenu> menuList = menuService.findAllByBean(menu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refRoleMenuRDao.deleteByProperties(new String[]{"roleId","softType"},new Object[]{roleId,softType});
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(idList)){
|
|
|
|
|
|
|
|
List<SysRefRoleMenu> refs = new ArrayList<>();
|
|
|
|
|
|
|
|
SysRefRoleMenu ref = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Long id : idList) {
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(menuList)){
|
|
|
|
|
|
|
|
for (SysMenu sysMenu : menuList) {
|
|
|
|
|
|
|
|
if(sysMenu.getId().equals(id)){
|
|
|
|
|
|
|
|
ref = new SysRefRoleMenu();
|
|
|
|
|
|
|
|
ref.setRoleId(role.getId());
|
|
|
|
|
|
|
|
ref.setRoleNameRdd(role.getName());
|
|
|
|
|
|
|
|
ref.setSoftType(sysMenu.getSoftType());
|
|
|
|
|
|
|
|
ref.setMenuNameRdd(sysMenu.getName());
|
|
|
|
|
|
|
|
ref.setMenuId(sysMenu.getId());
|
|
|
|
|
|
|
|
ref.setMenuTypeRdd(sysMenu.getMenuType());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(ref, AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refs.add(ref);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(refs)){
|
|
|
|
|
|
|
|
refRoleMenuRDao.saveAll(refs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ApiOperation(value = "查信角色菜单关系",notes = "查询 ID 查询角色菜单关系")
|
|
|
|
@ApiOperation(value = "查信角色菜单关系",notes = "查询 ID 查询角色菜单关系")
|
|
|
|
public List<SysRefRoleMenu> findSysRefRoleMenuByRoleId(Long roleId) {
|
|
|
|
public List<SysRefRoleMenu> findSysRefRoleMenuByRoleId(Long roleId) {
|
|
|
|
LOGGER.info("系统角色权限关系 RefRoleMenu find By RoleId");
|
|
|
|
LOGGER.info("系统角色权限关系 RefRoleMenu find By RoleId");
|
|
|
@ -224,15 +222,17 @@ public class SysRoleService extends CacheCrudService<SysRole> implements ISysRol
|
|
|
|
new Object[]{roleId,CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()}
|
|
|
|
new Object[]{roleId,CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
@Override
|
|
|
|
// @ApiOperation(value = "查信角色信息",notes = "查询所有角色信息")
|
|
|
|
public List<SysRefRoleMenu> findSysRefRoleMenuByRoleId(Long roleId, Integer softType) {
|
|
|
|
// public List<SysRole> findSysRoleAll() {
|
|
|
|
LOGGER.info("系统角色权限关系 RefRoleMenu find By RoleId");
|
|
|
|
// LOGGER.info("系统角色 SYS_ROLE find All");
|
|
|
|
return refRoleMenuRDao.findByProperty(
|
|
|
|
// return roleRDao.findByProperty(new String[]{"roleStatus"},new Object[]{CommonEnumUtil.DATA_STATUS.ENABLE.getValue()});
|
|
|
|
new String[]{"roleId","softType","isValid"},
|
|
|
|
// }
|
|
|
|
new Object[]{roleId,softType,
|
|
|
|
//
|
|
|
|
CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()}
|
|
|
|
//
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<SysRole> findSysRoleByInIdAndStatus(Long[] ids, Integer status) {
|
|
|
|
public List<SysRole> findSysRoleByInIdAndStatus(Long[] ids, Integer status) {
|
|
|
|
LOGGER.info("系统角色 SYS_ROLE findSysRoleByInIdAndStatus ids:{} , status:{}",ids,status);
|
|
|
|
LOGGER.info("系统角色 SYS_ROLE findSysRoleByInIdAndStatus ids:{} , status:{}",ids,status);
|
|
|
|