|
|
|
@@ -189,42 +189,124 @@ public class DmModelManager extends BaseManagerImpl<DmModelQuery, DmModelDto, Dm |
|
|
|
log.info("菜单列表:{}", menuPos); |
|
|
|
|
|
|
|
List<DmH5MenuDto> h5MenuDtos = new ArrayList<>(); |
|
|
|
// 根据列表获取icon集合 |
|
|
|
menuPos.forEach(item->{ |
|
|
|
|
|
|
|
DmH5MenuDto h5MenuDto = new DmH5MenuDto(); |
|
|
|
h5MenuDto.setId(item.getId()); |
|
|
|
h5MenuDto.setTitle(item.getTitle()); |
|
|
|
List<DmMenuIconPo> menuIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(item.getId()); |
|
|
|
// 获取数字人与Icon关联关系 |
|
|
|
List<Long> u2 = manIconPos.stream().map(DmManIconPo::getIconId).collect(Collectors.toList()); |
|
|
|
// 获取菜单与Icon关联关系 |
|
|
|
List<Long> u1 = menuIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList()); |
|
|
|
// 获取交集 |
|
|
|
List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList()); |
|
|
|
if (menuIconPos != null && menuIconPos.size() > 0) { |
|
|
|
if (iconIdResults != null && iconIdResults.size() > 0) { |
|
|
|
// 获取icon集合 |
|
|
|
List<DmScreenIconPo> iconPos = dmScreenIconMapper.selectBatchIds(iconIdResults); |
|
|
|
List<DmScreenIconDto> tmpDtos = screenIconConverter.mapperDto(iconPos); |
|
|
|
tmpDtos.forEach(item2-> { |
|
|
|
for (DmMenuIconPo menuIconPo : menuIconPos) { |
|
|
|
if (item2.getId().equals(menuIconPo.getIconId())) { |
|
|
|
item2.setPos(menuIconPo.getPos()); |
|
|
|
// 获取icon 图片地址 |
|
|
|
DmResourcesPo resourcesPo = dmResourcesMapper.selectById(item2.getResourceId()); |
|
|
|
if (resourcesPo != null) { |
|
|
|
item2.setIconUrl(resourcesPo.getUrl()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
List<DmH5MenuDto> usedH5MenuDtos = new ArrayList<>(); |
|
|
|
int level = 0; |
|
|
|
int finalLevel = level; |
|
|
|
// 构建菜单树 |
|
|
|
do { |
|
|
|
if (h5MenuDtos.size() == 0) { |
|
|
|
menuPos.stream().filter(item->item.getParentId() == 0L).forEach(item->{ |
|
|
|
|
|
|
|
DmH5MenuDto h5MenuDto = new DmH5MenuDto(); |
|
|
|
h5MenuDto.setId(item.getId()); |
|
|
|
h5MenuDto.setTitle(item.getTitle()); |
|
|
|
h5MenuDto.setChildren(new ArrayList<>()); |
|
|
|
h5MenuDto.setStatus(item.getStatus()); |
|
|
|
h5MenuDto.setLevel(finalLevel); |
|
|
|
h5MenuDto.setCreateTime(item.getCreateTime()); |
|
|
|
h5MenuDto.setUpdateTime(item.getUpdateTime()); |
|
|
|
h5MenuDto.setCreateBy(item.getCreateBy()); |
|
|
|
h5MenuDto.setMenuType(item.getMenuType()); |
|
|
|
h5MenuDtos.add(h5MenuDto); |
|
|
|
usedH5MenuDtos.add(h5MenuDto); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
// 遍历h5MenuDtos,将子菜单加入到父菜单中 |
|
|
|
List<DmH5MenuDto> tmpList = new ArrayList<>(); |
|
|
|
for (DmH5MenuDto h5MenuDto : usedH5MenuDtos) { |
|
|
|
// 遍历menuPos,将parentId与h5MenuDto的id相同的菜单加入到h5MenuDto的children中 |
|
|
|
menuPos.stream().filter(item->item.getParentId().equals(h5MenuDto.getId())).forEach(item->{ |
|
|
|
DmH5MenuDto h5MenuDto1 = new DmH5MenuDto(); |
|
|
|
h5MenuDto1.setId(item.getId()); |
|
|
|
h5MenuDto1.setTitle(item.getTitle()); |
|
|
|
h5MenuDto1.setChildren(new ArrayList<>()); |
|
|
|
h5MenuDto1.setStatus(item.getStatus()); |
|
|
|
h5MenuDto1.setLevel(finalLevel); |
|
|
|
h5MenuDto1.setCreateTime(item.getCreateTime()); |
|
|
|
h5MenuDto1.setUpdateTime(item.getUpdateTime()); |
|
|
|
h5MenuDto1.setCreateBy(item.getCreateBy()); |
|
|
|
h5MenuDto1.setMenuType(item.getMenuType()); |
|
|
|
h5MenuDto.getChildren().add(h5MenuDto1); |
|
|
|
tmpList.add(h5MenuDto1); |
|
|
|
}); |
|
|
|
h5MenuDto.setDmScreenIconDto(tmpDtos); |
|
|
|
|
|
|
|
} |
|
|
|
usedH5MenuDtos.clear(); |
|
|
|
usedH5MenuDtos.addAll(tmpList); |
|
|
|
} |
|
|
|
level++; |
|
|
|
Integer tmp = usedH5MenuDtos.size(); |
|
|
|
|
|
|
|
for (DmH5MenuDto tmpDto : usedH5MenuDtos) { |
|
|
|
if (tmpDto.getMenuType().equals("F") && tmpDto.getStatus().equals("0")) { |
|
|
|
List<DmMenuIconPo> menuIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(tmpDto.getId()); |
|
|
|
// 获取数字人与Icon关联关系 |
|
|
|
List<Long> u2 = manIconPos.stream().map(DmManIconPo::getIconId).collect(Collectors.toList()); |
|
|
|
// 获取菜单与Icon关联关系 |
|
|
|
List<Long> u1 = menuIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList()); |
|
|
|
// 获取交集 |
|
|
|
List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList()); |
|
|
|
if (menuIconPos != null && menuIconPos.size() > 0) { |
|
|
|
if (iconIdResults != null && iconIdResults.size() > 0) { |
|
|
|
// 获取icon集合 |
|
|
|
List<DmScreenIconPo> iconPos = dmScreenIconMapper.selectBatchIds(iconIdResults); |
|
|
|
List<DmScreenIconDto> tmpDtos = screenIconConverter.mapperDto(iconPos); |
|
|
|
tmpDtos.forEach(item2-> { |
|
|
|
for (DmMenuIconPo menuIconPo : menuIconPos) { |
|
|
|
if (item2.getId().equals(menuIconPo.getIconId())) { |
|
|
|
item2.setPos(menuIconPo.getPos()); |
|
|
|
// 获取icon 图片地址 |
|
|
|
DmResourcesPo resourcesPo = dmResourcesMapper.selectById(item2.getResourceId()); |
|
|
|
if (resourcesPo != null) { |
|
|
|
item2.setIconUrl(resourcesPo.getUrl()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
tmpDto.setDmScreenIconDto(tmpDtos); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
h5MenuDtos.add(h5MenuDto); |
|
|
|
}); |
|
|
|
} |
|
|
|
} while (level > 3); |
|
|
|
// 根据列表获取icon集合 |
|
|
|
// menuPos.forEach(item->{ |
|
|
|
// |
|
|
|
// DmH5MenuDto h5MenuDto = new DmH5MenuDto(); |
|
|
|
// h5MenuDto.setId(item.getId()); |
|
|
|
// h5MenuDto.setTitle(item.getTitle()); |
|
|
|
// List<DmMenuIconPo> menuIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(item.getId()); |
|
|
|
// // 获取数字人与Icon关联关系 |
|
|
|
// List<Long> u2 = manIconPos.stream().map(DmManIconPo::getIconId).collect(Collectors.toList()); |
|
|
|
// // 获取菜单与Icon关联关系 |
|
|
|
// List<Long> u1 = menuIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList()); |
|
|
|
// // 获取交集 |
|
|
|
// List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList()); |
|
|
|
// if (menuIconPos != null && menuIconPos.size() > 0) { |
|
|
|
// if (iconIdResults != null && iconIdResults.size() > 0) { |
|
|
|
// // 获取icon集合 |
|
|
|
// List<DmScreenIconPo> iconPos = dmScreenIconMapper.selectBatchIds(iconIdResults); |
|
|
|
// List<DmScreenIconDto> tmpDtos = screenIconConverter.mapperDto(iconPos); |
|
|
|
// tmpDtos.forEach(item2-> { |
|
|
|
// for (DmMenuIconPo menuIconPo : menuIconPos) { |
|
|
|
// if (item2.getId().equals(menuIconPo.getIconId())) { |
|
|
|
// item2.setPos(menuIconPo.getPos()); |
|
|
|
// // 获取icon 图片地址 |
|
|
|
// DmResourcesPo resourcesPo = dmResourcesMapper.selectById(item2.getResourceId()); |
|
|
|
// if (resourcesPo != null) { |
|
|
|
// item2.setIconUrl(resourcesPo.getUrl()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// h5MenuDto.setDmScreenIconDto(tmpDtos); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// h5MenuDtos.add(h5MenuDto); |
|
|
|
// }); |
|
|
|
return h5MenuDtos; |
|
|
|
} |
|
|
|
|
|
|
|
|