| Line 1721... |
Line 1721... |
| 1721 |
Map<Integer, Map<String, Double>> fofoIdBrandQtyMap = new HashMap<>();
|
1721 |
Map<Integer, Map<String, Double>> fofoIdBrandQtyMap = new HashMap<>();
|
| 1722 |
|
1722 |
|
| 1723 |
Map<Integer, InStockAccessoriesTvFofoIdModel> inStockAccessTv = new HashMap<>();
|
1723 |
Map<Integer, InStockAccessoriesTvFofoIdModel> inStockAccessTv = new HashMap<>();
|
| 1724 |
Map<Integer, InStockAccessoriesTvFofoIdModel> pendingIndentAccessTv = new HashMap<>();
|
1724 |
Map<Integer, InStockAccessoriesTvFofoIdModel> pendingIndentAccessTv = new HashMap<>();
|
| 1725 |
Map<Integer, InStockAccessoriesTvFofoIdModel> grnPendingAccessTvOrders = new HashMap<>();
|
1725 |
Map<Integer, InStockAccessoriesTvFofoIdModel> grnPendingAccessTvOrders = new HashMap<>();
|
| - |
|
1726 |
|
| - |
|
1727 |
Map<Integer, InStockAccessoriesTvQtyFofoIdModel> inStockQtyAccessTv = new HashMap<>();
|
| - |
|
1728 |
Map<Integer, InStockAccessoriesTvQtyFofoIdModel> pendingIndentQtyAccessTv = new HashMap<>();
|
| - |
|
1729 |
Map<Integer, InStockAccessoriesTvQtyFofoIdModel> grnPendingQtyAccessTvOrders = new HashMap<>();
|
| 1726 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
1730 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 1727 |
Map<Integer, CustomRetailer> customRetailers = new HashMap<>();
|
1731 |
Map<Integer, CustomRetailer> customRetailers = new HashMap<>();
|
| 1728 |
Map<Integer, PartnerType> fofoIdPartnerTypeMap = new HashMap<>();
|
1732 |
Map<Integer, PartnerType> fofoIdPartnerTypeMap = new HashMap<>();
|
| 1729 |
|
1733 |
|
| 1730 |
if (fofoIds != null && fofoIds.size() > 0) {
|
1734 |
if (fofoIds != null && fofoIds.size() > 0) {
|
| Line 1756... |
Line 1760... |
| 1756 |
Map<Integer, Map<String, Double>> pendingIndentQty;
|
1760 |
Map<Integer, Map<String, Double>> pendingIndentQty;
|
| 1757 |
Map<Integer, Map<String, Double>> grnPendingOrders;
|
1761 |
Map<Integer, Map<String, Double>> grnPendingOrders;
|
| 1758 |
Map<Integer, Map<String, Double>> grnPendingOrdersQty;
|
1762 |
Map<Integer, Map<String, Double>> grnPendingOrdersQty;
|
| 1759 |
|
1763 |
|
| 1760 |
// mobile
|
1764 |
// mobile
|
| 1761 |
inStockBrandModel = currentInventorySnapshotRepository.selectSumInStockMobiletabletGroupByBrand(fofoIdList)
|
1765 |
List<InStockBrandFofoIdModel> inStockBrandFofoIdModels = currentInventorySnapshotRepository.selectSumInStockMobiletabletGroupByBrand(fofoIdList);
|
| - |
|
1766 |
|
| - |
|
1767 |
inStockBrandModel = inStockBrandFofoIdModels
|
| 1762 |
.stream()
|
1768 |
.stream()
|
| 1763 |
.collect(Collectors.groupingBy(InStockBrandFofoIdModel::getFofoId,
|
1769 |
.collect(Collectors.groupingBy(InStockBrandFofoIdModel::getFofoId,
|
| 1764 |
Collectors.groupingBy(InStockBrandFofoIdModel::getBrand,
|
1770 |
Collectors.groupingBy(InStockBrandFofoIdModel::getBrand,
|
| 1765 |
Collectors.summingDouble(InStockBrandFofoIdModel::getAmount))));
|
1771 |
Collectors.summingDouble(InStockBrandFofoIdModel::getAmount))));
|
| 1766 |
|
1772 |
|
| 1767 |
inStockBrandModelQty = currentInventorySnapshotRepository.selectSumInStockMobiletabletGroupByBrand(fofoIdList)
|
1773 |
inStockBrandModelQty = inStockBrandFofoIdModels
|
| 1768 |
.stream()
|
1774 |
.stream()
|
| 1769 |
.collect(Collectors.groupingBy(InStockBrandFofoIdModel::getFofoId,
|
1775 |
.collect(Collectors.groupingBy(InStockBrandFofoIdModel::getFofoId,
|
| 1770 |
Collectors.groupingBy(InStockBrandFofoIdModel::getBrand,
|
1776 |
Collectors.groupingBy(InStockBrandFofoIdModel::getBrand,
|
| 1771 |
Collectors.summingDouble(InStockBrandFofoIdModel::getQty))));
|
1777 |
Collectors.summingDouble(InStockBrandFofoIdModel::getQty))));
|
| 1772 |
|
1778 |
|
| 1773 |
pendingIndent = transactionService.getInTransitOrders(fofoIdList).stream()
|
1779 |
List<Order> pendingIndentOrders = transactionService.getInTransitOrders(fofoIdList);
|
| - |
|
1780 |
|
| - |
|
1781 |
pendingIndent = pendingIndentOrders.stream()
|
| 1774 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
1782 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
| 1775 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
1783 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
| 1776 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
1784 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
| 1777 |
Collectors.summingDouble(y -> (double) y.getTotalAmount()))));
|
1785 |
Collectors.summingDouble(y -> (double) y.getTotalAmount()))));
|
| 1778 |
|
1786 |
|
| - |
|
1787 |
|
| 1779 |
pendingIndentQty = transactionService.getInTransitOrders(fofoIdList).stream()
|
1788 |
pendingIndentQty = pendingIndentOrders.stream()
|
| 1780 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
1789 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
| 1781 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
1790 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
| 1782 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
1791 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
| 1783 |
Collectors.summingDouble(y -> (double) y.getLineItem().getQuantity()))));
|
1792 |
Collectors.summingDouble(y -> (double) y.getLineItem().getQuantity()))));
|
| 1784 |
|
1793 |
|
| - |
|
1794 |
|
| 1785 |
grnPendingOrders = orderRepository.selectPendingGrnOrders(fofoIdList).stream()
|
1795 |
List<Order> grnPendingOrderList = orderRepository.selectPendingGrnOrders(fofoIdList);
|
| - |
|
1796 |
|
| - |
|
1797 |
grnPendingOrders = grnPendingOrderList.stream()
|
| 1786 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
1798 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
| 1787 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
1799 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
| 1788 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
1800 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
| 1789 |
Collectors.summingDouble(y -> (double) y.getTotalAmount()))));
|
1801 |
Collectors.summingDouble(y -> (double) y.getTotalAmount()))));
|
| 1790 |
grnPendingOrdersQty = orderRepository.selectPendingGrnOrders(fofoIdList).stream()
|
1802 |
grnPendingOrdersQty = grnPendingOrderList.stream()
|
| 1791 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
1803 |
.filter(x -> x.getLineItem().getItem().getCategoryId() == ProfitMandiConstants.MOBILE_CATEGORY_ID)
|
| 1792 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
1804 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
| 1793 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
1805 |
Collectors.groupingBy(y -> y.getLineItem().getBrand(),
|
| 1794 |
Collectors.summingDouble(y -> (double) y.getLineItem().getQuantity()))));
|
1806 |
Collectors.summingDouble(y -> (double) y.getLineItem().getQuantity()))));
|
| 1795 |
|
1807 |
|
| Line 1801... |
Line 1813... |
| 1801 |
.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
1813 |
.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 1802 |
|
1814 |
|
| 1803 |
grnPendingAccessTvOrders = orderRepository.selectAllGrnPendingAccessoriesTvGroupByFofoId(fofoIdList)
|
1815 |
grnPendingAccessTvOrders = orderRepository.selectAllGrnPendingAccessoriesTvGroupByFofoId(fofoIdList)
|
| 1804 |
.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
1816 |
.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 1805 |
|
1817 |
|
| - |
|
1818 |
|
| - |
|
1819 |
inStockQtyAccessTv = currentInventorySnapshotRepository.selectQtySumInStockAccessoriesAndTv(fofoIdList).stream()
|
| - |
|
1820 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
1821 |
|
| - |
|
1822 |
pendingIndentQtyAccessTv = orderRepository.selectAllQtyPendingIndentAccessoriesTvGroupByFofoId(fofoIdList)
|
| - |
|
1823 |
.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
1824 |
|
| - |
|
1825 |
grnPendingQtyAccessTvOrders = orderRepository.selectAllQtyGrnPendingAccessoriesTvGroupByFofoId(fofoIdList)
|
| - |
|
1826 |
.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
1827 |
|
| 1806 |
// Bulk fetch partner types to avoid N+1 queries
|
1828 |
// Bulk fetch partner types to avoid N+1 queries
|
| 1807 |
fofoIdPartnerTypeMap = partnerTypeChangeService.getTypesForFofoIds(new ArrayList<>(customRetailers.keySet()), LocalDate.now());
|
1829 |
fofoIdPartnerTypeMap = partnerTypeChangeService.getTypesForFofoIds(new ArrayList<>(customRetailers.keySet()), LocalDate.now());
|
| 1808 |
|
1830 |
|
| 1809 |
for (Entry<Integer, CustomRetailer> customRetailer : customRetailers.entrySet()) {
|
1831 |
for (Entry<Integer, CustomRetailer> customRetailer : customRetailers.entrySet()) {
|
| 1810 |
Map<String, Double> stockBrand = inStockBrandModel.get(customRetailer.getKey());
|
1832 |
Map<String, Double> stockBrand = inStockBrandModel.get(customRetailer.getKey());
|
| Line 1933... |
Line 1955... |
| 1933 |
model.addAttribute("fofoIdBrandQtyMap", fofoIdBrandQtyMap);
|
1955 |
model.addAttribute("fofoIdBrandQtyMap", fofoIdBrandQtyMap);
|
| 1934 |
|
1956 |
|
| 1935 |
model.addAttribute("inStockAccessTv", inStockAccessTv);
|
1957 |
model.addAttribute("inStockAccessTv", inStockAccessTv);
|
| 1936 |
model.addAttribute("pendingIndentAccessTv", pendingIndentAccessTv);
|
1958 |
model.addAttribute("pendingIndentAccessTv", pendingIndentAccessTv);
|
| 1937 |
model.addAttribute("grnPendingAccessTvOrders", grnPendingAccessTvOrders);
|
1959 |
model.addAttribute("grnPendingAccessTvOrders", grnPendingAccessTvOrders);
|
| - |
|
1960 |
model.addAttribute("inStockQtyAccessTv", inStockQtyAccessTv);
|
| - |
|
1961 |
model.addAttribute("pendingIndentQtyAccessTv", pendingIndentQtyAccessTv);
|
| - |
|
1962 |
model.addAttribute("grnPendingQtyAccessTvOrders", grnPendingQtyAccessTvOrders);
|
| 1938 |
model.addAttribute("fofoIdPartnerTypeMap", fofoIdPartnerTypeMap);
|
1963 |
model.addAttribute("fofoIdPartnerTypeMap", fofoIdPartnerTypeMap);
|
| 1939 |
|
1964 |
|
| 1940 |
|
1965 |
|
| 1941 |
return "partner-brandwise-detail";
|
1966 |
return "partner-brandwise-detail";
|
| 1942 |
}
|
1967 |
}
|