| Line 396... |
Line 396... |
| 396 |
private String adminPanel(int fofoId, String email, Model model) throws ProfitMandiBusinessException {
|
396 |
private String adminPanel(int fofoId, String email, Model model) throws ProfitMandiBusinessException {
|
| 397 |
List<Menu> menus = null;
|
397 |
List<Menu> menus = null;
|
| 398 |
try {
|
398 |
try {
|
| 399 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
399 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
| 400 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
400 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
| - |
|
401 |
if (positions.size() > 0) {
|
| 401 |
if(positions.stream().filter(x->x.getEscalationType().equals(EscalationType.L4)).count() > 0 ||
|
402 |
if (positions.stream().filter(x -> x.getEscalationType().equals(EscalationType.L4)).count() > 0
|
| 402 |
Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in").contains(email)) {
|
403 |
|| Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in").contains(email)) {
|
| 403 |
menus = menuRepository.selectAll();
|
404 |
menus = menuRepository.selectAll();
|
| 404 |
}
|
405 |
} else {
|
| 405 |
if(positions.size() > 0) {
|
- |
|
| 406 |
List<Integer> menuIds = menuCategoryRepository.selectAllByPositions(positions).stream()
|
406 |
List<Integer> menuIds = menuCategoryRepository.selectAllByPositions(positions).stream()
|
| 407 |
.map(x -> x.getMenuId()).collect(Collectors.toList());
|
407 |
.map(x -> x.getMenuId()).collect(Collectors.toList());
|
| 408 |
LOGGER.info("Menu Ids are {}", menuIds);
|
408 |
LOGGER.info("Menu Ids are {}", menuIds);
|
| 409 |
if(menuIds.size() > 0) {
|
409 |
if (menuIds.size() > 0) {
|
| 410 |
menus = menuRepository.selectAllByIds(menuIds);
|
410 |
menus = menuRepository.selectAllByIds(menuIds);
|
| - |
|
411 |
}
|
| 411 |
}
|
412 |
}
|
| - |
|
413 |
|
| 412 |
}
|
414 |
}
|
| 413 |
} catch (ProfitMandiBusinessException e) {
|
415 |
} catch (ProfitMandiBusinessException e) {
|
| 414 |
}
|
416 |
}
|
| 415 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
417 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
| 416 |
|
418 |
|
| 417 |
model.addAttribute("menu", menuList);
|
419 |
model.addAttribute("menu", menuList);
|
| 418 |
return "admin";
|
420 |
return "admin";
|
| 419 |
}
|
421 |
}
|
| 420 |
|
422 |
|