驾驶舱功能调整

This commit is contained in:
xy
2025-10-24 16:14:54 +08:00
parent b63fab9085
commit 5e93eb3691
13 changed files with 355 additions and 54 deletions

View File

@@ -10,6 +10,8 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.redis.pojo.enums.RedisKeyEnum;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.PqDashboardPageFeignClient;
import com.njcn.system.pojo.po.PqDashboardPage;
import com.njcn.user.enums.UserResponseEnum;
import com.njcn.user.mapper.FunctionMapper;
import com.njcn.user.mapper.RoleFunctionMapper;
@@ -17,7 +19,10 @@ import com.njcn.user.pojo.constant.FunctionState;
import com.njcn.user.pojo.constant.UserType;
import com.njcn.user.pojo.param.FunctionParam;
import com.njcn.user.pojo.param.RoleParam;
import com.njcn.user.pojo.po.*;
import com.njcn.user.pojo.po.Function;
import com.njcn.user.pojo.po.Role;
import com.njcn.user.pojo.po.RoleFunction;
import com.njcn.user.pojo.po.UserRole;
import com.njcn.user.pojo.vo.FunctionVO;
import com.njcn.user.service.*;
import com.njcn.web.utils.RequestUtil;
@@ -57,6 +62,8 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
private final RoleFunctionMapper roleFunctionMapper;
private final PqDashboardPageFeignClient pqDashboardPageFeignClient;
/**
* 将系统中角色--资源对应数据缓存到redis
* 先清除,再缓存
@@ -270,25 +277,23 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
/**
* 组装驾驶舱子级
*
* @param list 菜单集合
*/
private void setDriverChildren(List<FunctionVO> list) {
List<HomePage> homePages = homePageService.getHomePagesByUserId(RequestUtil.getUserIndex());
List<PqDashboardPage> PqDashboardPage = pqDashboardPageFeignClient.getDashboardPageByUserId(RequestUtil.getUserIndex(),true).getData();
list.forEach(item -> {
if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME)) {
homePages.forEach(po -> {
if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME) && CollectionUtil.isNotEmpty(PqDashboardPage)) {
PqDashboardPage.forEach(po -> {
FunctionVO functionVO = new FunctionVO();
functionVO.setId(po.getId());
functionVO.setPid(item.getId());
functionVO.setTitle(po.getName());
functionVO.setTitle(po.getPageName());
functionVO.setCode(item.getCode());
functionVO.setRouteName(po.getPath().substring(po.getPath().lastIndexOf("/") + 1));
functionVO.setRoutePath(po.getPath());
functionVO.setRouteName(po.getRouteName());
functionVO.setRoutePath(po.getPagePath());
functionVO.setIcon(po.getIcon());
functionVO.setSort(po.getSort());
functionVO.setType(item.getType());
functionVO.setRemark(po.getName());
functionVO.setRemark(po.getPageName());
functionVO.setChildren(new ArrayList<>());
item.getChildren().add(functionVO);
});
@@ -296,6 +301,34 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
});
}
// /**
// * 组装驾驶舱子级
// *
// * @param list 菜单集合
// */
// private void setDriverChildren(List<FunctionVO> list) {
// List<HomePage> homePages = homePageService.getHomePagesByUserId(RequestUtil.getUserIndex());
// list.forEach(item -> {
// if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME)) {
// homePages.forEach(po -> {
// FunctionVO functionVO = new FunctionVO();
// functionVO.setId(po.getId());
// functionVO.setPid(item.getId());
// functionVO.setTitle(po.getName());
// functionVO.setCode(item.getCode());
// functionVO.setRouteName("/src/views/pqs/cockpit/homePage/index.vue");
// functionVO.setRoutePath(po.getPath());
// functionVO.setIcon(po.getIcon());
// functionVO.setSort(po.getSort());
// functionVO.setType(item.getType());
// functionVO.setRemark(po.getName());
// functionVO.setChildren(new ArrayList<>());
// item.getChildren().add(functionVO);
// });
// }
// });
// }
/**
* 处理tab页
*/