| Line 610... |
Line 610... |
| 610 |
model.addAttribute("warehouseStockMap", warehouseStockSortedMap);
|
610 |
model.addAttribute("warehouseStockMap", warehouseStockSortedMap);
|
| 611 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
611 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 612 |
|
612 |
|
| 613 |
model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
|
613 |
model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
|
| 614 |
|
614 |
|
| 615 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> bulletins = this.getTodayBulletin(positions);
|
- |
|
| 616 |
|
- |
|
| 617 |
model.addAttribute("bulletins", bulletins);
|
- |
|
| 618 |
|
- |
|
| 619 |
} catch (ProfitMandiBusinessException e) {
|
615 |
} catch (ProfitMandiBusinessException e) {
|
| 620 |
}
|
616 |
}
|
| 621 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
617 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
| 622 |
//LOGGER.info("menu" + menuList);
|
618 |
//LOGGER.info("menu" + menuList);
|
| 623 |
model.addAttribute("menu", menuList);
|
619 |
model.addAttribute("menu", menuList);
|
| 624 |
return "admin";
|
620 |
return "admin";
|
| 625 |
}
|
621 |
}
|
| 626 |
|
622 |
|
| 627 |
|
623 |
|
| 628 |
private Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> getTodayBulletin(List<Position> positions) throws Exception {
|
624 |
public Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> getTodayBulletin(List<Position> positions, LocalDateTime date) throws Exception {
|
| 629 |
List<Long> regionIds = positions.stream().map(x -> Long.valueOf(x.getRegionId())).collect(Collectors.toList());
|
625 |
List<Long> regionIds = positions.stream().map(x -> Long.valueOf(x.getRegionId())).collect(Collectors.toList());
|
| 630 |
|
626 |
|
| 631 |
regionIds.add(5L);
|
627 |
regionIds.add(5L);
|
| 632 |
|
628 |
|
| 633 |
|
629 |
|
| 634 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("h:mm a");
|
630 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("h:mm a");
|
| 635 |
|
631 |
|
| 636 |
LocalDateTime yesterDayDate = LocalDate.now().minusDays(1).atTime(LocalTime.MAX);
|
632 |
LocalDateTime startDate = date.toLocalDate().minusDays(1).atTime(LocalTime.MAX);
|
| - |
|
633 |
LocalDateTime endDate = date.toLocalDate().plusDays(1).atTime(LocalTime.MAX);
|
| 637 |
List<BulletinOfferModal> bulletinOfferModals = new ArrayList<>();
|
634 |
List<BulletinOfferModal> bulletinOfferModals = new ArrayList<>();
|
| 638 |
|
635 |
|
| 639 |
List<Bulletin> bulletins = bulletinRepository.selectALlTodayBulletinByRegionIds(regionIds, yesterDayDate);
|
636 |
List<Bulletin> bulletins = bulletinRepository.selectALlTodayBulletinByRegionIds(regionIds, startDate, endDate);
|
| 640 |
for (Bulletin b : bulletins) {
|
637 |
for (Bulletin b : bulletins) {
|
| 641 |
|
638 |
|
| 642 |
BulletinOfferModal modal = new BulletinOfferModal();
|
639 |
BulletinOfferModal modal = new BulletinOfferModal();
|
| 643 |
modal.setOfferId(b.getId());
|
640 |
modal.setOfferId(b.getId());
|
| 644 |
modal.setTitle(b.getTitle());
|
- |
|
| 645 |
modal.setDescription(b.getDescription());
|
641 |
modal.setDescription(b.getDescription());
|
| 646 |
modal.setCreatedTime(formatter.format(b.getCreatedAt()));
|
642 |
modal.setCreatedTime(formatter.format(b.getCreatedAt()));
|
| 647 |
modal.setCatalogOffer(false);
|
643 |
modal.setCatalogOffer(false);
|
| 648 |
modal.setCreatedAt(b.getCreatedAt());
|
644 |
modal.setCreatedAt(b.getCreatedAt());
|
| - |
|
645 |
modal.setCreatedBy(b.getCreatedBy());
|
| 649 |
modal.setBulletinType(ProfitMandiConstants.BULLETIN_TYPE_ENUM.BULLETIN);
|
646 |
modal.setBulletinType(ProfitMandiConstants.BULLETIN_TYPE_ENUM.BULLETIN);
|
| 650 |
|
647 |
|
| 651 |
// ADD THIS BLOCK
|
648 |
// ADD THIS BLOCK
|
| 652 |
if (b.getDocumentIds() != null && !b.getDocumentIds().isEmpty()) {
|
649 |
if (b.getDocumentIds() != null && !b.getDocumentIds().isEmpty()) {
|
| 653 |
List<Integer> docIds = Arrays.stream(b.getDocumentIds().split(","))
|
650 |
List<Integer> docIds = Arrays.stream(b.getDocumentIds().split(","))
|
| Line 660... |
Line 657... |
| 660 |
|
657 |
|
| 661 |
bulletinOfferModals.add(modal);
|
658 |
bulletinOfferModals.add(modal);
|
| 662 |
}
|
659 |
}
|
| 663 |
|
660 |
|
| 664 |
|
661 |
|
| 665 |
List<BulletinOfferModal> getTodayCreatedCatalogOffer = todayOfferService.findAllTodayCatalogOfferBulletin(regionIds.stream().map(x -> x.intValue()).collect(Collectors.toList()));
|
662 |
List<BulletinOfferModal> getTodayCreatedCatalogOffer = todayOfferService.findAllTodayCatalogOfferBulletin(regionIds.stream().map(x -> x.intValue()).collect(Collectors.toList()), startDate, endDate);
|
| 666 |
bulletinOfferModals.addAll(getTodayCreatedCatalogOffer);
|
663 |
bulletinOfferModals.addAll(getTodayCreatedCatalogOffer);
|
| 667 |
|
664 |
|
| 668 |
List<BulletinOfferModal> getTodaySchemes = todayOfferService.findAllTodaySchemeBulletin(regionIds.stream().map(x -> x.intValue()).collect(Collectors.toList()));
|
665 |
List<BulletinOfferModal> getTodaySchemes = todayOfferService.findAllTodaySchemeBulletin(regionIds.stream().map(x -> x.intValue()).collect(Collectors.toList()), startDate, endDate);
|
| 669 |
bulletinOfferModals.addAll(getTodaySchemes);
|
666 |
bulletinOfferModals.addAll(getTodaySchemes);
|
| 670 |
|
667 |
|
| 671 |
List<BulletinOfferModal> getTodayCardCashback = todayOfferService.findAllTodayWebOfferBulletin();
|
668 |
List<BulletinOfferModal> getTodayCardCashback = todayOfferService.findAllTodayWebOfferBulletin(startDate, endDate);
|
| 672 |
bulletinOfferModals.addAll(getTodayCardCashback);
|
669 |
bulletinOfferModals.addAll(getTodayCardCashback);
|
| 673 |
|
670 |
|
| 674 |
List<BulletinOfferModal> getTodayPrebookingList = todayOfferService.getAllTodayCreatedPreBookingList();
|
671 |
List<BulletinOfferModal> getTodayPrebookingList = todayOfferService.getAllTodayCreatedPreBookingList(startDate, endDate);
|
| 675 |
bulletinOfferModals.addAll(getTodayPrebookingList);
|
672 |
bulletinOfferModals.addAll(getTodayPrebookingList);
|
| 676 |
|
673 |
|
| 677 |
bulletinOfferModals.sort(
|
674 |
bulletinOfferModals.sort(
|
| 678 |
Comparator.comparing(BulletinOfferModal::getCreatedAt).reversed()
|
675 |
Comparator.comparing(BulletinOfferModal::getCreatedAt).reversed()
|
| 679 |
);
|
676 |
);
|