| Line 4... |
Line 4... |
| 4 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
4 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 6 |
import com.spice.profitmandi.common.model.*;
|
6 |
import com.spice.profitmandi.common.model.*;
|
| 7 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
7 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 8 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
8 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
| - |
|
9 |
import com.spice.profitmandi.dao.entity.cs.Bulletin;
|
| 9 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
10 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
11 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 11 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
12 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 12 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
13 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
| 13 |
import com.spice.profitmandi.dao.entity.transaction.LoanSummary;
|
14 |
import com.spice.profitmandi.dao.entity.transaction.LoanSummary;
|
| 14 |
import com.spice.profitmandi.dao.entity.transaction.StateWiseLoanSummary;
|
15 |
import com.spice.profitmandi.dao.entity.transaction.StateWiseLoanSummary;
|
| 15 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
16 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 16 |
import com.spice.profitmandi.dao.model.BrandWiseModel;
|
17 |
import com.spice.profitmandi.dao.model.BrandWiseModel;
|
| - |
|
18 |
import com.spice.profitmandi.dao.model.BulletinOfferModal;
|
| 17 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
19 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 18 |
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
|
20 |
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
|
| 19 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
21 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
22 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
| 21 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
23 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
| 22 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
24 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| 23 |
import com.spice.profitmandi.dao.repository.cs.CsService1;
|
- |
|
| 24 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
- |
|
| 25 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
- |
|
| 26 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
25 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 27 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
26 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
27 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
| 29 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
28 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
29 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| - |
|
30 |
import com.spice.profitmandi.service.offers.TodayOfferService;
|
| 31 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
31 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
| 32 |
import com.spice.profitmandi.service.user.RetailerService;
|
32 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 33 |
import org.apache.logging.log4j.LogManager;
|
33 |
import org.apache.logging.log4j.LogManager;
|
| 34 |
import org.apache.logging.log4j.Logger;
|
34 |
import org.apache.logging.log4j.Logger;
|
| 35 |
import org.springframework.beans.factory.annotation.Autowired;
|
35 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 36 |
import org.springframework.stereotype.Component;
|
36 |
import org.springframework.stereotype.Component;
|
| 37 |
import org.springframework.ui.Model;
|
37 |
import org.springframework.ui.Model;
|
| 38 |
|
38 |
|
| 39 |
import java.io.FileInputStream;
|
39 |
import java.io.FileInputStream;
|
| 40 |
import java.io.ObjectInputStream;
|
40 |
import java.io.ObjectInputStream;
|
| 41 |
import java.time.LocalDate;
|
- |
|
| 42 |
import java.time.LocalDateTime;
|
- |
|
| 43 |
import java.time.Period;
|
41 |
import java.time.*;
|
| 44 |
import java.time.YearMonth;
|
- |
|
| 45 |
import java.time.format.DateTimeFormatter;
|
42 |
import java.time.format.DateTimeFormatter;
|
| 46 |
import java.time.temporal.ChronoUnit;
|
43 |
import java.time.temporal.ChronoUnit;
|
| 47 |
import java.util.*;
|
44 |
import java.util.*;
|
| 48 |
import java.util.Map.Entry;
|
45 |
import java.util.Map.Entry;
|
| 49 |
import java.util.stream.Collectors;
|
46 |
import java.util.stream.Collectors;
|
| Line 99... |
Line 96... |
| 99 |
@Autowired
|
96 |
@Autowired
|
| 100 |
private PartnerStatsService partnerStatsService;
|
97 |
private PartnerStatsService partnerStatsService;
|
| 101 |
@Autowired
|
98 |
@Autowired
|
| 102 |
private SDCreditService sdCreditService;
|
99 |
private SDCreditService sdCreditService;
|
| 103 |
|
100 |
|
| - |
|
101 |
@Autowired
|
| - |
|
102 |
BulletinRepository bulletinRepository;
|
| - |
|
103 |
|
| - |
|
104 |
@Autowired
|
| - |
|
105 |
TodayOfferService todayOfferService;
|
| - |
|
106 |
|
| 104 |
List<String> colorList = Arrays.asList("mediumseagreen", "dodgerblue", "darkblue", "gold", "#eb0029", "coral",
|
107 |
List<String> colorList = Arrays.asList("mediumseagreen", "dodgerblue", "darkblue", "gold", "#eb0029", "coral",
|
| 105 |
"#63C5DA", "red", "deeppink", "midnightblue", "cornsilk");
|
108 |
"#63C5DA", "red", "deeppink", "midnightblue", "cornsilk");
|
| 106 |
|
109 |
|
| 107 |
List<String> borderList = Arrays.asList("lawngreen", "lightblue", "#0000cd", "#f7e98e", "#eb0029", "lightcoral",
|
110 |
List<String> borderList = Arrays.asList("lawngreen", "lightblue", "#0000cd", "#f7e98e", "#eb0029", "lightcoral",
|
| 108 |
"#0000cd", "lightsalmon", "pink", "#0000cd", "cornsilk");
|
111 |
"#0000cd", "lightsalmon", "pink", "#0000cd", "cornsilk");
|
| Line 607... |
Line 610... |
| 607 |
model.addAttribute("warehouseStockMap", warehouseStockSortedMap);
|
610 |
model.addAttribute("warehouseStockMap", warehouseStockSortedMap);
|
| 608 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
611 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 609 |
|
612 |
|
| 610 |
model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
|
613 |
model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
|
| 611 |
|
614 |
|
| - |
|
615 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> bulletins = this.getTodayBulletin(positions);
|
| - |
|
616 |
|
| - |
|
617 |
model.addAttribute("bulletins", bulletins);
|
| - |
|
618 |
|
| 612 |
} catch (ProfitMandiBusinessException e) {
|
619 |
} catch (ProfitMandiBusinessException e) {
|
| 613 |
}
|
620 |
}
|
| 614 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
621 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
| 615 |
//LOGGER.info("menu" + menuList);
|
622 |
//LOGGER.info("menu" + menuList);
|
| 616 |
model.addAttribute("menu", menuList);
|
623 |
model.addAttribute("menu", menuList);
|
| 617 |
return "admin";
|
624 |
return "admin";
|
| 618 |
}
|
625 |
}
|
| 619 |
|
626 |
|
| - |
|
627 |
|
| - |
|
628 |
private Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> getTodayBulletin(List<Position> positions) throws Exception {
|
| - |
|
629 |
List<Long> regionIds = positions.stream().map(x -> Long.valueOf(x.getRegionId())).collect(Collectors.toList());
|
| - |
|
630 |
|
| - |
|
631 |
regionIds.add(5L);
|
| - |
|
632 |
|
| - |
|
633 |
|
| - |
|
634 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("h:mm a");
|
| - |
|
635 |
|
| - |
|
636 |
LocalDateTime yesterDayDate = LocalDate.now().minusDays(1).atTime(LocalTime.MAX);
|
| - |
|
637 |
List<BulletinOfferModal> bulletinOfferModals = new ArrayList<>();
|
| - |
|
638 |
|
| - |
|
639 |
List<Bulletin> bulletins = bulletinRepository.selectALlTodayBulletinByRegionIds(regionIds, yesterDayDate);
|
| - |
|
640 |
for (Bulletin b : bulletins) {
|
| - |
|
641 |
|
| - |
|
642 |
BulletinOfferModal modal = new BulletinOfferModal();
|
| - |
|
643 |
modal.setOfferId(b.getId());
|
| - |
|
644 |
modal.setTitle(b.getTitle());
|
| - |
|
645 |
modal.setDescription(b.getDescription());
|
| - |
|
646 |
modal.setCreatedTime(formatter.format(b.getCreatedAt()));
|
| - |
|
647 |
modal.setCatalogOffer(false);
|
| - |
|
648 |
modal.setCreatedAt(b.getCreatedAt());
|
| - |
|
649 |
modal.setBulletinType(ProfitMandiConstants.BULLETIN_TYPE_ENUM.BULLETIN);
|
| - |
|
650 |
|
| - |
|
651 |
// ADD THIS BLOCK
|
| - |
|
652 |
if (b.getDocumentIds() != null && !b.getDocumentIds().isEmpty()) {
|
| - |
|
653 |
List<Integer> docIds = Arrays.stream(b.getDocumentIds().split(","))
|
| - |
|
654 |
.map(String::trim)
|
| - |
|
655 |
.map(Integer::parseInt)
|
| - |
|
656 |
.collect(Collectors.toList());
|
| - |
|
657 |
|
| - |
|
658 |
modal.setDocumentIds(docIds);
|
| - |
|
659 |
}
|
| - |
|
660 |
|
| - |
|
661 |
bulletinOfferModals.add(modal);
|
| - |
|
662 |
}
|
| - |
|
663 |
|
| - |
|
664 |
|
| - |
|
665 |
List<BulletinOfferModal> getTodayCreatedCatalogOffer = todayOfferService.findAllTodayCatalogOfferBulletin(regionIds.stream().map(x -> x.intValue()).collect(Collectors.toList()));
|
| - |
|
666 |
bulletinOfferModals.addAll(getTodayCreatedCatalogOffer);
|
| - |
|
667 |
|
| - |
|
668 |
List<BulletinOfferModal> getTodaySchemes = todayOfferService.findAllTodaySchemeBulletin(regionIds.stream().map(x -> x.intValue()).collect(Collectors.toList()));
|
| - |
|
669 |
bulletinOfferModals.addAll(getTodaySchemes);
|
| - |
|
670 |
|
| - |
|
671 |
List<BulletinOfferModal> getTodayCardCashback = todayOfferService.findAllTodayWebOfferBulletin();
|
| - |
|
672 |
bulletinOfferModals.addAll(getTodayCardCashback);
|
| - |
|
673 |
|
| - |
|
674 |
List<BulletinOfferModal> getTodayPrebookingList = todayOfferService.getAllTodayCreatedPreBookingList();
|
| - |
|
675 |
bulletinOfferModals.addAll(getTodayPrebookingList);
|
| - |
|
676 |
|
| - |
|
677 |
bulletinOfferModals.sort(
|
| - |
|
678 |
Comparator.comparing(BulletinOfferModal::getCreatedAt).reversed()
|
| - |
|
679 |
);
|
| - |
|
680 |
|
| - |
|
681 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> bulletinOffermap =
|
| - |
|
682 |
bulletinOfferModals.stream()
|
| - |
|
683 |
.collect(Collectors.groupingBy(
|
| - |
|
684 |
BulletinOfferModal::getBulletinType,
|
| - |
|
685 |
() -> new EnumMap<>(ProfitMandiConstants.BULLETIN_TYPE_ENUM.class),
|
| - |
|
686 |
Collectors.toList()
|
| - |
|
687 |
));
|
| - |
|
688 |
|
| - |
|
689 |
|
| - |
|
690 |
return bulletinOffermap;
|
| - |
|
691 |
}
|
| - |
|
692 |
|
| 620 |
private Map<Integer, List<Integer>> getWarehouseIdFofoIdMap(Set<Integer> fofoIds) throws ProfitMandiBusinessException {
|
693 |
private Map<Integer, List<Integer>> getWarehouseIdFofoIdMap(Set<Integer> fofoIds) throws ProfitMandiBusinessException {
|
| 621 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
694 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| 622 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream()
|
695 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream()
|
| 623 |
.collect(Collectors.groupingBy(FofoStore::getWarehouseId,
|
696 |
.collect(Collectors.groupingBy(FofoStore::getWarehouseId,
|
| 624 |
Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
697 |
Collectors.mapping(FofoStore::getId, Collectors.toList())));
|