| | |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | | import com.vci.constant.FrameWorkBtmTypeConstant; |
| | | import com.vci.dto.SmRoleDTO; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.enumpck.RoleClassifyEnum; |
| | | import com.vci.frameworkcore.enumpck.RoleControlAreaEnum; |
| | | import com.vci.model.SmRoleForPlatform1; |
| | | import com.vci.pagemodel.SmUserVO; |
| | | import com.vci.po.SmRolePO; |
| | | import com.vci.pagemodel.SmRoleVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | */ |
| | | @Autowired |
| | | private WebBoServiceI boService; |
| | | |
| | | /** |
| | | * 用户查询服务 |
| | | */ |
| | | @Autowired |
| | | @Lazy |
| | | private SmUserQueryServiceI smUserQueryServiceI; |
| | | |
| | | /** |
| | | * 平台调用客户端 |
| | |
| | | @Override |
| | | public boolean deleteRole(String[] ids) throws PLException { |
| | | VciBaseUtil.alertNotNull(ids,"要删除的角色主键"); |
| | | //使用主键判断角色是否被用户引用 |
| | | for (int i = 0; i < ids.length; i++) { |
| | | String roleName = this.checkIsUsed(ids[i]); |
| | | if(Func.isNotBlank(roleName)){ |
| | | throw new PLException("500",new String[]{"当前选中要删除的角色中存在【"+roleName+"】被引用!"}); |
| | | } |
| | | } |
| | | //具备连带删除的功能,如角色菜单授权表里面的授权信息 |
| | | return platformClientUtil.getFrameworkService().deleteRole( |
| | | ids, |
| | |
| | | } |
| | | |
| | | /** |
| | | * 检查角色是否有在引用 |
| | | * @param roleOid |
| | | * @return |
| | | */ |
| | | private String checkIsUsed(String roleOid){ |
| | | List<SmUserVO> smUserVOS = smUserQueryServiceI.listUserByRoleOid(roleOid, null); |
| | | if (Func.isNotEmpty(smUserVOS)) { |
| | | return this.getRoleNameByRoleOid(roleOid); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 导入角色 |
| | | * @param file |
| | | * @return |