| Line 484... |
Line 484... |
| 484 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
484 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 485 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
485 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 486 |
CreateOfferRequest createOfferRequest = offerService.getOffer(isAdmin ? 0 : loginDetails.getFofoId(), offerId);
|
486 |
CreateOfferRequest createOfferRequest = offerService.getOffer(isAdmin ? 0 : loginDetails.getFofoId(), offerId);
|
| 487 |
|
487 |
|
| 488 |
model.addAttribute("offer", createOfferRequest);
|
488 |
model.addAttribute("offer", createOfferRequest);
|
| 489 |
model.addAttribute("isAdmin", isAdmin);
|
489 |
model.addAttribute("isFinanceTeam", isAdmin && this.hasCategory(this.getUserPositions(loginDetails), ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS));
|
| 490 |
|
490 |
|
| 491 |
return "offer_margin_detail_partner";
|
491 |
return "offer_margin_detail_partner";
|
| 492 |
|
492 |
|
| 493 |
}
|
493 |
}
|
| 494 |
|
494 |
|
| Line 532... |
Line 532... |
| 532 |
model.addAttribute("date", FormattingUtils.format(LocalDateTime.now()));
|
532 |
model.addAttribute("date", FormattingUtils.format(LocalDateTime.now()));
|
| 533 |
|
533 |
|
| 534 |
return "today-offer";
|
534 |
return "today-offer";
|
| 535 |
}
|
535 |
}
|
| 536 |
|
536 |
|
| - |
|
537 |
@Autowired
|
| - |
|
538 |
com.spice.profitmandi.dao.repository.cs.PositionRepository positionRepository;
|
| - |
|
539 |
|
| - |
|
540 |
@Autowired
|
| - |
|
541 |
com.spice.profitmandi.dao.repository.auth.AuthRepository authRepository;
|
| - |
|
542 |
|
| - |
|
543 |
private List<com.spice.profitmandi.dao.entity.cs.Position> getUserPositions(LoginDetails loginDetails) throws ProfitMandiBusinessException {
|
| - |
|
544 |
com.spice.profitmandi.dao.entity.auth.AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
545 |
return positionRepository.selectAllByAuthUserId(authUser.getId());
|
| - |
|
546 |
}
|
| - |
|
547 |
|
| - |
|
548 |
private boolean hasCategory(List<com.spice.profitmandi.dao.entity.cs.Position> positions, int categoryId) {
|
| - |
|
549 |
return positions.stream().anyMatch(x -> x.getCategoryId() == categoryId);
|
| - |
|
550 |
}
|
| - |
|
551 |
|
| - |
|
552 |
private boolean hasCategoryL2Plus(List<com.spice.profitmandi.dao.entity.cs.Position> positions, int categoryId) {
|
| - |
|
553 |
return positions.stream()
|
| - |
|
554 |
.filter(x -> x.getCategoryId() == categoryId)
|
| - |
|
555 |
.anyMatch(x -> com.spice.profitmandi.dao.enumuration.cs.EscalationType.L2.isGreaterThanEqualTo(x.getEscalationType()));
|
| - |
|
556 |
}
|
| - |
|
557 |
|
| - |
|
558 |
private boolean canReceive(List<com.spice.profitmandi.dao.entity.cs.Position> positions) {
|
| - |
|
559 |
// Warehouse/Logistics team OR Finance L2+ can receive
|
| - |
|
560 |
return hasCategory(positions, ProfitMandiConstants.TICKET_CATEGORY_WAREHOUSE)
|
| - |
|
561 |
|| hasCategory(positions, ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS)
|
| - |
|
562 |
|| hasCategoryL2Plus(positions, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS);
|
| - |
|
563 |
}
|
| - |
|
564 |
|
| 537 |
@RequestMapping(value = "/todayOfferList")
|
565 |
@RequestMapping(value = "/todayOfferList")
|
| 538 |
public String todayOfferList(HttpServletRequest request, Model model, @RequestParam String brand, @RequestParam(defaultValue = "0", required = false) int fofoId) throws ProfitMandiBusinessException {
|
566 |
public String todayOfferList(HttpServletRequest request, Model model, @RequestParam String brand, @RequestParam(defaultValue = "0", required = false) int fofoId) throws ProfitMandiBusinessException {
|
| 539 |
|
567 |
|
| 540 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
568 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 541 |
if (fofoId == 0) {
|
569 |
if (fofoId == 0) {
|