|
|
|
@ -183,7 +183,7 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
//给角色设置系统权限
|
|
|
|
|
if (null != roleList && !roleList.isEmpty()) {
|
|
|
|
|
for (Power_UserAndRoleTree role : roleList) {
|
|
|
|
|
String sysFlagStr = "";
|
|
|
|
|
StringBuilder sysFlagStr = new StringBuilder();
|
|
|
|
|
String deptId = role.getDeptId();
|
|
|
|
|
if(StringUtils.isNotBlank(deptId)){
|
|
|
|
|
//单一科室
|
|
|
|
@ -191,13 +191,13 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
if (deptId.equals(dept.getDeptId())) {
|
|
|
|
|
if(null != sysFlagSet && !sysFlagSet.isEmpty()){
|
|
|
|
|
for(String sysFlag:sysFlagSet){
|
|
|
|
|
sysFlagStr += sysFlag + ",";
|
|
|
|
|
sysFlagStr.append(sysFlag).append(",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(sysFlagStr)){
|
|
|
|
|
if(StringUtils.isNotBlank(sysFlagStr.toString())){
|
|
|
|
|
Power_UserAndRoleTree tempRole = new Power_UserAndRoleTree();
|
|
|
|
|
BeanUtils.copyProperties(role,tempRole);
|
|
|
|
|
tempRole.setSysFlag(sysFlagStr);
|
|
|
|
|
tempRole.setSysFlag(sysFlagStr.toString());
|
|
|
|
|
tempRoleList.add(tempRole);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -208,13 +208,13 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
if (StringUtils.isNotBlank(deptStr) && deptStr.equals(dept.getDeptId())) {
|
|
|
|
|
if(null != sysFlagSet && !sysFlagSet.isEmpty()){
|
|
|
|
|
for(String sysFlag:sysFlagSet){
|
|
|
|
|
sysFlagStr += sysFlag + ",";
|
|
|
|
|
sysFlagStr.append(sysFlag).append(",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(sysFlagStr)){
|
|
|
|
|
if(StringUtils.isNotBlank(sysFlagStr.toString())){
|
|
|
|
|
Power_UserAndRoleTree tempRole = new Power_UserAndRoleTree();
|
|
|
|
|
BeanUtils.copyProperties(role,tempRole);
|
|
|
|
|
tempRole.setSysFlag(sysFlagStr);
|
|
|
|
|
tempRole.setSysFlag(sysFlagStr.toString());
|
|
|
|
|
tempRoleList.add(tempRole);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -291,18 +291,18 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
//roleId为-100医院管理员,菜单功能全选中
|
|
|
|
|
if(null != roleId && roleId == -100){
|
|
|
|
|
if(null != menus && !menus.isEmpty()){
|
|
|
|
|
for (int i = 0; i < menus.size(); i++) {
|
|
|
|
|
menus.get(i).setChecked("true");
|
|
|
|
|
for (Power_Menu menu : menus) {
|
|
|
|
|
menu.setChecked("true");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//否则按角色菜单表该角色的权限选中
|
|
|
|
|
List<Power_Role_Menu> roleMenus = roleMenuMapper.selectRoleMenuByRoleId(roleId);
|
|
|
|
|
if(null != menus && !menus.isEmpty() && null != roleMenus && !roleMenus.isEmpty()){
|
|
|
|
|
for (int i = 0; i < menus.size(); i++) {
|
|
|
|
|
for (int j = 0; j < roleMenus.size(); j++) {
|
|
|
|
|
if(menus.get(i).getMenuId().equals(roleMenus.get(j).getMenuId())){
|
|
|
|
|
menus.get(i).setChecked("true");
|
|
|
|
|
for (Power_Menu menu : menus) {
|
|
|
|
|
for (Power_Role_Menu roleMenu : roleMenus) {
|
|
|
|
|
if (menu.getMenuId().equals(roleMenu.getMenuId())) {
|
|
|
|
|
menu.setChecked("true");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -485,7 +485,7 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
tree5.setSysFlag(sys.getSysFlag());
|
|
|
|
|
threeLevelId = id;
|
|
|
|
|
id++;
|
|
|
|
|
Boolean isParent = false;
|
|
|
|
|
boolean isParent = false;
|
|
|
|
|
//第四级用户
|
|
|
|
|
if(null != userList && !userList.isEmpty()) {
|
|
|
|
|
for (Power_UserAndRoleTree users : userList) {
|
|
|
|
@ -617,8 +617,8 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
//roleId为-100医院管理员,菜单功能全选中
|
|
|
|
|
if(null != user.getRoleId() && user.getRoleId() == -100){
|
|
|
|
|
if(null != menus && !menus.isEmpty()){
|
|
|
|
|
for (int i = 0; i < menus.size(); i++) {
|
|
|
|
|
menus.get(i).setChecked("true");
|
|
|
|
|
for (Power_Menu menu : menus) {
|
|
|
|
|
menu.setChecked("true");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
@ -626,10 +626,10 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
List<Power_User_Menu> userMenus = userMenuMapper.selectUserAndRoleMenuPower(sysFlag, userId);
|
|
|
|
|
if(null != menus && !menus.isEmpty() && null != userMenus && !userMenus.isEmpty()){
|
|
|
|
|
//有符合权限则checked设为true
|
|
|
|
|
for (int i = 0; i < menus.size(); i++) {
|
|
|
|
|
for (int j = 0; j < userMenus.size(); j++) {
|
|
|
|
|
if(menus.get(i).getMenuId().equals(userMenus.get(j).getMenuId())){
|
|
|
|
|
menus.get(i).setChecked("true");
|
|
|
|
|
for (Power_Menu menu : menus) {
|
|
|
|
|
for (Power_User_Menu userMenu : userMenus) {
|
|
|
|
|
if (menu.getMenuId().equals(userMenu.getMenuId())) {
|
|
|
|
|
menu.setChecked("true");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -671,16 +671,16 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
if(StringUtils.isBlank(menus)){
|
|
|
|
|
//全取消
|
|
|
|
|
List<Power_User_Menu> list = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < rolePowers.size(); i++) {
|
|
|
|
|
list.add(addUserFunction(userName, userId, rolePowers.get(i).getMenuId().toString(), 0));
|
|
|
|
|
for (Power_Role_Menu rolePower : rolePowers) {
|
|
|
|
|
list.add(addUserFunction(userName, userId, rolePower.getMenuId().toString(), 0));
|
|
|
|
|
}
|
|
|
|
|
userMenuMapper.simpleInsertUserMenu(list);
|
|
|
|
|
}else{
|
|
|
|
|
//计算新增和删除
|
|
|
|
|
List<String> roles = new ArrayList<>();
|
|
|
|
|
List<String> users = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < rolePowers.size(); i++) {
|
|
|
|
|
roles.add(rolePowers.get(i).getMenuId().toString());
|
|
|
|
|
for (Power_Role_Menu rolePower : rolePowers) {
|
|
|
|
|
roles.add(rolePower.getMenuId().toString());
|
|
|
|
|
}
|
|
|
|
|
String[] menu = menus.split(",");
|
|
|
|
|
users = Arrays.asList(menu);
|
|
|
|
@ -772,13 +772,13 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
int twoLevel = 0;
|
|
|
|
|
Map<Integer,String> hospitalNameSet = new HashMap<>();
|
|
|
|
|
if(null != dicts && !dicts.isEmpty()){
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getHospitalName())){
|
|
|
|
|
hospitalNameSet.put(dicts.get(i).getDictId(),dicts.get(i).getHospitalName());
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getHospitalName())) {
|
|
|
|
|
hospitalNameSet.put(dict.getDictId(), dict.getHospitalName());
|
|
|
|
|
}
|
|
|
|
|
//用户集合
|
|
|
|
|
if(null == dicts.get(i).getDictId()){
|
|
|
|
|
userList.add(dicts.get(i));
|
|
|
|
|
if (null == dict.getDictId()) {
|
|
|
|
|
userList.add(dict);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -794,17 +794,17 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
tree1.setId(id);
|
|
|
|
|
tree1.setName(hospitalNameSet.get(hosKey));
|
|
|
|
|
treeList.add(tree1);
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
//查询病案系统的科室
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getSysFlag()) && dicts.get(i).getSysFlag().equals(sysFlag) && dicts.get(i).getParentId().equals(hosKey) && null != dicts.get(i).getDictDeptId()){
|
|
|
|
|
deptIds.add(dicts.get(i).getDictDeptId());
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getSysFlag()) && dict.getSysFlag().equals(sysFlag) && dict.getParentId().equals(hosKey) && null != dict.getDictDeptId()) {
|
|
|
|
|
deptIds.add(dict.getDictDeptId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(null != deptIds && !deptIds.isEmpty()){
|
|
|
|
|
for(Integer deptId : deptIds){
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getDeptIds()) && dicts.get(i).getDeptIds().equals(deptId.toString()) && StringUtils.isNotBlank(dicts.get(i).getDeptName())){
|
|
|
|
|
deptNameSet.put(dicts.get(i).getDeptIds(),dicts.get(i).getDeptName());
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getDeptIds()) && dict.getDeptIds().equals(deptId.toString()) && StringUtils.isNotBlank(dict.getDeptName())) {
|
|
|
|
|
deptNameSet.put(dict.getDeptIds(), dict.getDeptName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -821,19 +821,19 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
treeList.add(tree2);
|
|
|
|
|
Map<Integer,String> roleMap = new HashMap<>();
|
|
|
|
|
if (null != userList && !userList.isEmpty()) {
|
|
|
|
|
for (int j = 0; j < userList.size(); j++) {
|
|
|
|
|
if(StringUtils.isNoneBlank(userList.get(j).getSysType())){
|
|
|
|
|
String deptIdss = userList.get(j).getDeptIds();
|
|
|
|
|
for (Power_Sys_DictVo power_sys_dictVo : userList) {
|
|
|
|
|
if (StringUtils.isNoneBlank(power_sys_dictVo.getSysType())) {
|
|
|
|
|
String deptIdss = power_sys_dictVo.getDeptIds();
|
|
|
|
|
if (StringUtils.isNotBlank(deptIdss)) {
|
|
|
|
|
if (!deptIdss.contains(",")) {
|
|
|
|
|
if (deptIdss.equals(key)) {
|
|
|
|
|
roleMap.put(userList.get(j).getParentId(),userList.get(j).getSysType());
|
|
|
|
|
roleMap.put(power_sys_dictVo.getParentId(), power_sys_dictVo.getSysType());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
String[] deptIdsss = deptIdss.split(",");
|
|
|
|
|
for (String deptId : deptIdsss) {
|
|
|
|
|
if (StringUtils.isNotBlank(deptId) && deptId.equals(key)) {
|
|
|
|
|
roleMap.put(userList.get(j).getParentId(),userList.get(j).getSysType());
|
|
|
|
|
roleMap.put(power_sys_dictVo.getParentId(), power_sys_dictVo.getSysType());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -890,13 +890,13 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
int twoLevel = 0;
|
|
|
|
|
Map<Integer,String> hospitalNameSet = new HashMap<>();
|
|
|
|
|
if(null != dicts && !dicts.isEmpty()){
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getHospitalName())){
|
|
|
|
|
hospitalNameSet.put(dicts.get(i).getDictId(),dicts.get(i).getHospitalName());
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getHospitalName())) {
|
|
|
|
|
hospitalNameSet.put(dict.getDictId(), dict.getHospitalName());
|
|
|
|
|
}
|
|
|
|
|
//用户集合
|
|
|
|
|
if(null == dicts.get(i).getDictId()){
|
|
|
|
|
userList.add(dicts.get(i));
|
|
|
|
|
if (null == dict.getDictId()) {
|
|
|
|
|
userList.add(dict);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -912,17 +912,17 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
tree1.setId(id);
|
|
|
|
|
tree1.setName(hospitalNameSet.get(hosKey));
|
|
|
|
|
treeList.add(tree1);
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
//查询病案系统的科室
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getSysFlag()) && dicts.get(i).getSysFlag().equals(sysFlag) && dicts.get(i).getParentId().equals(hosKey)){
|
|
|
|
|
deptIds.add(dicts.get(i).getDictDeptId());
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getSysFlag()) && dict.getSysFlag().equals(sysFlag) && dict.getParentId().equals(hosKey)) {
|
|
|
|
|
deptIds.add(dict.getDictDeptId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(null != deptIds && !deptIds.isEmpty()){
|
|
|
|
|
for(Integer deptId : deptIds){
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getDeptIds()) && dicts.get(i).getDeptIds().equals(deptId.toString()) && StringUtils.isNotBlank(dicts.get(i).getDeptName())){
|
|
|
|
|
deptNameSet.put(dicts.get(i).getDeptIds(),dicts.get(i).getDeptName());
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getDeptIds()) && dict.getDeptIds().equals(deptId.toString()) && StringUtils.isNotBlank(dict.getDeptName())) {
|
|
|
|
|
deptNameSet.put(dict.getDeptIds(), dict.getDeptName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -939,19 +939,19 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
Map<Integer,Power_Sys_DictVo> roleMap = new HashMap<>();
|
|
|
|
|
//sysName 用户id,hospitalTel 手机号,dictArea用户名,parentId角色id,sysType角色名
|
|
|
|
|
if (null != userList && !userList.isEmpty()) {
|
|
|
|
|
for (int j = 0; j < userList.size(); j++) {
|
|
|
|
|
if(StringUtils.isNoneBlank(userList.get(j).getDictArea())){
|
|
|
|
|
String deptIdss = userList.get(j).getDeptIds();
|
|
|
|
|
for (Power_Sys_DictVo power_sys_dictVo : userList) {
|
|
|
|
|
if (StringUtils.isNoneBlank(power_sys_dictVo.getDictArea())) {
|
|
|
|
|
String deptIdss = power_sys_dictVo.getDeptIds();
|
|
|
|
|
if (StringUtils.isNotBlank(deptIdss)) {
|
|
|
|
|
if (!deptIdss.contains(",")) {
|
|
|
|
|
if (deptIdss.equals(key)) {
|
|
|
|
|
roleMap.put(Integer.valueOf(userList.get(j).getSysName()),userList.get(j));
|
|
|
|
|
roleMap.put(Integer.valueOf(power_sys_dictVo.getSysName()), power_sys_dictVo);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
String[] deptIdsss = deptIdss.split(",");
|
|
|
|
|
for (String deptId : deptIdsss) {
|
|
|
|
|
if (StringUtils.isNotBlank(deptId) && deptId.equals(key)) {
|
|
|
|
|
roleMap.put(Integer.valueOf(userList.get(j).getSysName()),userList.get(j));
|
|
|
|
|
roleMap.put(Integer.valueOf(power_sys_dictVo.getSysName()), power_sys_dictVo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1016,9 +1016,9 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
int twoLevel = 0;
|
|
|
|
|
Map<Integer,String> hospitalNameSet = new HashMap<>();
|
|
|
|
|
if(null != dicts && !dicts.isEmpty()){
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
if(StringUtils.isNotBlank(dicts.get(i).getHospitalName())){
|
|
|
|
|
hospitalNameSet.put(dicts.get(i).getDictId(),dicts.get(i).getHospitalName());
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (StringUtils.isNotBlank(dict.getHospitalName())) {
|
|
|
|
|
hospitalNameSet.put(dict.getDictId(), dict.getHospitalName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1035,26 +1035,26 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
tree1.setSelfId(hosKey);
|
|
|
|
|
tree1.setName(hospitalNameSet.get(hosKey));
|
|
|
|
|
treeList.add(tree1);
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (user.getRoleId() == 0) {
|
|
|
|
|
if(dicts.get(i).getDictId().equals(hosKey)){
|
|
|
|
|
String deptName = dicts.get(i).getDeptName();
|
|
|
|
|
if (dict.getDictId().equals(hosKey)) {
|
|
|
|
|
String deptName = dict.getDeptName();
|
|
|
|
|
if (StringUtils.isNoneBlank(deptName)) {
|
|
|
|
|
deptNameSet.put(dicts.get(i).getDeptId(),dicts.get(i).getDeptName());
|
|
|
|
|
deptNameSet.put(dict.getDeptId(), dict.getDeptName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if(dicts.get(i).getParentId().equals(hosKey)){
|
|
|
|
|
String deptName = dicts.get(i).getDeptName();
|
|
|
|
|
if (dict.getParentId().equals(hosKey)) {
|
|
|
|
|
String deptName = dict.getDeptName();
|
|
|
|
|
if (StringUtils.isNoneBlank(deptName)) {
|
|
|
|
|
deptNameSet.put(dicts.get(i).getDeptId(),dicts.get(i).getDeptName());
|
|
|
|
|
deptNameSet.put(dict.getDeptId(), dict.getDeptName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//添加权限系统
|
|
|
|
|
if(dicts.get(i).getParentId() != null && StringUtils.isNotBlank(dicts.get(i).getSysFlag())
|
|
|
|
|
&& dicts.get(i).getParentId().equals(hosKey) && "权限系统".equals(dicts.get(i).getSysType())){
|
|
|
|
|
poweSysNameSet.put(dicts.get(i).getDictId(),dicts.get(i));
|
|
|
|
|
if (dict.getParentId() != null && StringUtils.isNotBlank(dict.getSysFlag())
|
|
|
|
|
&& dict.getParentId().equals(hosKey) && "权限系统".equals(dict.getSysType())) {
|
|
|
|
|
poweSysNameSet.put(dict.getDictId(), dict);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//添加权限系统
|
|
|
|
@ -1084,12 +1084,12 @@ public class PowerServiceImpl implements PowerService {
|
|
|
|
|
tree2.setName(deptNameSet.get(key));
|
|
|
|
|
tree2.setSelfId(0-key);
|
|
|
|
|
treeList.add(tree2);
|
|
|
|
|
for (int i = 0; i < dicts.size(); i++) {
|
|
|
|
|
if(dicts.get(i).getDictDeptId() != null && dicts.get(i).getDictDeptId().equals(key)
|
|
|
|
|
&& dicts.get(i).getParentId() != null && dicts.get(i).getParentId().equals(hosKey)){
|
|
|
|
|
String sysName = dicts.get(i).getSysName();
|
|
|
|
|
for (Power_Sys_DictVo dict : dicts) {
|
|
|
|
|
if (dict.getDictDeptId() != null && dict.getDictDeptId().equals(key)
|
|
|
|
|
&& dict.getParentId() != null && dict.getParentId().equals(hosKey)) {
|
|
|
|
|
String sysName = dict.getSysName();
|
|
|
|
|
if (StringUtils.isNoneBlank(sysName)) {
|
|
|
|
|
sysNameSet.put(dicts.get(i).getDictId(),sysName);
|
|
|
|
|
sysNameSet.put(dict.getDictId(), sysName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|