|
|
|
@ -10,6 +10,7 @@ import com.daqing.framework.domain.hrms.RolePermissionEntity; |
|
|
|
|
import com.daqing.framework.model.response.ResponseResult; |
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
import org.apache.commons.beanutils.BeanUtils; |
|
|
|
|
import org.apache.commons.beanutils.ConvertUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
@ -68,7 +69,6 @@ public class PermissionServiceImpl extends ServiceImpl<PermissionDao, Permission |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List getPermission(String roleIds) { |
|
|
|
|
|
|
|
|
|
//截取字符串
|
|
|
|
|
String[] strArr = roleIds.split(","); |
|
|
|
|
//转换long类型的数组
|
|
|
|
@ -80,35 +80,11 @@ public class PermissionServiceImpl extends ServiceImpl<PermissionDao, Permission |
|
|
|
|
for(RolePermissionEntity res : rolePermissionList){ |
|
|
|
|
permissionList.add(res.getPermissionId()); |
|
|
|
|
} |
|
|
|
|
/* ResponseResult responseResult = hrmsFeignService.queryPermissionsByRoleIds(strArrNum); |
|
|
|
|
List<Integer> permissionList = new ArrayList(); |
|
|
|
|
|
|
|
|
|
List<LinkedHashMap> employeeMessage = null; |
|
|
|
|
if(responseResult.getData() != null){ |
|
|
|
|
employeeMessage = (List<LinkedHashMap>) responseResult.getData(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(LinkedHashMap res : employeeMessage){ |
|
|
|
|
permissionList.add((Integer) res.get("permissionId")); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
Long[] permissionIds = permissionList.toArray(new Long[permissionList.size()]); |
|
|
|
|
//根据权限ids查询对应权限
|
|
|
|
|
List<PermissionEntity> permissionEntityList = permissionMapper.queryPermissionsByIds(Arrays.asList(permissionIds)); |
|
|
|
|
/* |
|
|
|
|
ResponseResult responseResult2 = hrmsFeignService.queryPermissionsByIds(permissionIds); |
|
|
|
|
List<LinkedHashMap> perList = (List<LinkedHashMap>) responseResult2.getData(); |
|
|
|
|
//LinkedHashMap转对象
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
|
List<PermissionEntity> permissionEntityList = mapper.convertValue(perList, new TypeReference<List<PermissionEntity>>() { }); |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
return getListDepartmentAndEmployeeTree(permissionEntityList, 0L); |
|
|
|
|
/* |
|
|
|
|
List list = new ArrayList(); |
|
|
|
|
list.add(permissionEntityList); |
|
|
|
|
list.add(roleIds);*/ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<PermissionEntity> getListDepartmentAndEmployeeTree(List<PermissionEntity> list, Long parentId) { |
|
|
|
@ -118,6 +94,7 @@ public class PermissionServiceImpl extends ServiceImpl<PermissionDao, Permission |
|
|
|
|
dept.setChildren(getListDepartmentAndEmployeeTree(list, dept.getId())); // 设置该部门的子部门:递归调用
|
|
|
|
|
|
|
|
|
|
PermissionEntity permission = permissionService.getById(dept.getId()); |
|
|
|
|
/*dept.setUserDept(employeeDao.employeeListByDeptId(dept.getId(),account));*/ |
|
|
|
|
}) |
|
|
|
|
.sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) // 根据所选排序信息进行排序
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|