| Line 22... |
Line 22... |
| 22 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
22 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 23 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
23 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 24 |
import com.spice.profitmandi.dao.entity.user.User;
|
24 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 25 |
import com.spice.profitmandi.dao.entity.warehouse.BrandRegionMapping;
|
25 |
import com.spice.profitmandi.dao.entity.warehouse.BrandRegionMapping;
|
| 26 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
26 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 27 |
import com.spice.profitmandi.dao.model.DateWiseSoldCatalogQtyModel;
|
- |
|
| 28 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
27 |
import com.spice.profitmandi.dao.model.*;
|
| 29 |
import com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel;
|
- |
|
| 30 |
import com.spice.profitmandi.dao.model.InStockBrandFofoIdModel;
|
- |
|
| 31 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
28 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
29 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
30 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
31 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
32 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| Line 2113... |
Line 2110... |
| 2113 |
|
2110 |
|
| 2114 |
|
2111 |
|
| 2115 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
2112 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 2116 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
2113 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 2117 |
|
2114 |
|
| - |
|
2115 |
List<String> brands = ProfitMandiConstants.BRANDS;
|
| - |
|
2116 |
|
| - |
|
2117 |
List<BrandWisePartnerSaleModel> brandWisePartnerSaleModels = fofoStoreRepository.selectGroupByBrandWarehousePartnerSale(Arrays.asList(fofoId));
|
| - |
|
2118 |
LOGGER.info("brandWisePartnerSaleModels {}", brandWisePartnerSaleModels);
|
| - |
|
2119 |
|
| - |
|
2120 |
Map<String, Long> brandToMtdMap = brandWisePartnerSaleModels.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getMtd()));
|
| - |
|
2121 |
|
| - |
|
2122 |
// Sort the BRANDS list based on MTD sale in descending order
|
| - |
|
2123 |
List<String> sortedBrands = ProfitMandiConstants.BRANDS.stream()
|
| - |
|
2124 |
.sorted((b1, b2) -> {
|
| - |
|
2125 |
long mtd1 = brandToMtdMap.getOrDefault(b1, 0L);
|
| - |
|
2126 |
long mtd2 = brandToMtdMap.getOrDefault(b2, 0L);
|
| - |
|
2127 |
return Long.compare(mtd2, mtd1); // descending
|
| - |
|
2128 |
}).collect(Collectors.toList());
|
| - |
|
2129 |
|
| 2118 |
List<PartnerWarehouseStockSummaryModel> partnerWarehouseStockSummaryModels = saholicInventoryService.getSaholicAndPartnerStock(fofoId, fofoStore.getWarehouseId());
|
2130 |
List<PartnerWarehouseStockSummaryModel> partnerWarehouseStockSummaryModels = saholicInventoryService.getSaholicAndPartnerStock(fofoId, fofoStore.getWarehouseId());
|
| 2119 |
|
2131 |
|
| 2120 |
Set<Integer> catalogIds = partnerWarehouseStockSummaryModels.stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
2132 |
Set<Integer> catalogIds = partnerWarehouseStockSummaryModels.stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
| 2121 |
|
2133 |
|
| 2122 |
List<DateWiseSoldCatalogQtyModel> sevenDayAboveSoldsCatalogs = fofoOrderRepository.getDateWiseSoldCatalogQty(fofoId, catalogIds, presentDate.minusDays(7));
|
2134 |
List<DateWiseSoldCatalogQtyModel> sevenDayAboveSoldsCatalogs = fofoOrderRepository.getDateWiseSoldCatalogQty(fofoId, catalogIds, presentDate.minusDays(7));
|
| Line 2151... |
Line 2163... |
| 2151 |
partnerWarehouseStockAgingSummaryModel.setStatus(stockSummary.getStatus());
|
2163 |
partnerWarehouseStockAgingSummaryModel.setStatus(stockSummary.getStatus());
|
| 2152 |
|
2164 |
|
| 2153 |
partnerWarehouseStockAgingSummaryModelList.add(partnerWarehouseStockAgingSummaryModel);
|
2165 |
partnerWarehouseStockAgingSummaryModelList.add(partnerWarehouseStockAgingSummaryModel);
|
| 2154 |
}
|
2166 |
}
|
| 2155 |
|
2167 |
|
| 2156 |
List<String> brands = ProfitMandiConstants.BRANDS;
|
- |
|
| - |
|
2168 |
|
| 2157 |
List<String> statusOrder = Arrays.asList("HID", "FASTMOVING", "RUNNING", "SLOWMOVING", "OTHER");
|
2169 |
List<String> statusOrder = Arrays.asList("HID", "FASTMOVING", "RUNNING", "SLOWMOVING", "OTHER");
|
| 2158 |
Map<String, List<PartnerWarehouseStockAgingSummaryModel>> brandPartnerWarehouseStockListMap =
|
2170 |
Map<String, List<PartnerWarehouseStockAgingSummaryModel>> brandPartnerWarehouseStockListMap =
|
| 2159 |
partnerWarehouseStockAgingSummaryModelList.stream().collect(Collectors.groupingBy(
|
2171 |
partnerWarehouseStockAgingSummaryModelList.stream().collect(Collectors.groupingBy(
|
| 2160 |
PartnerWarehouseStockAgingSummaryModel::getBrand));
|
2172 |
PartnerWarehouseStockAgingSummaryModel::getBrand));
|
| 2161 |
|
2173 |
|
| 2162 |
Map<String, Map<String, List<PartnerWarehouseStockAgingSummaryModel>>> brandStatusWiseStockListMap =
|
2174 |
Map<String, Map<String, List<PartnerWarehouseStockAgingSummaryModel>>> brandStatusWiseStockListMap =
|
| 2163 |
partnerWarehouseStockAgingSummaryModelList.stream().collect(Collectors.groupingBy(
|
2175 |
partnerWarehouseStockAgingSummaryModelList.stream().collect(Collectors.groupingBy(
|
| 2164 |
PartnerWarehouseStockAgingSummaryModel::getBrand,
|
2176 |
PartnerWarehouseStockAgingSummaryModel::getBrand,
|
| 2165 |
Collectors.groupingBy(PartnerWarehouseStockAgingSummaryModel::getStatus)
|
2177 |
Collectors.groupingBy(PartnerWarehouseStockAgingSummaryModel::getStatus)
|
| 2166 |
));
|
2178 |
));
|
| 2167 |
|
- |
|
| - |
|
2179 |
//map of list as hid,fast,slow and other in last otherwise other is coming in start (here is using status order)
|
| 2168 |
Map<String, Map<String, List<PartnerWarehouseStockAgingSummaryModel>>> sortedBrandStatusWiseStockListMap =
|
2180 |
Map<String, Map<String, List<PartnerWarehouseStockAgingSummaryModel>>> sortedBrandStatusWiseStockListMap =
|
| 2169 |
brandStatusWiseStockListMap.entrySet().stream().collect(Collectors.toMap(
|
2181 |
brandStatusWiseStockListMap.entrySet().stream().collect(Collectors.toMap(
|
| 2170 |
Map.Entry::getKey, // Key (Brand)
|
2182 |
Map.Entry::getKey, // Key (Brand)
|
| 2171 |
entry -> {
|
2183 |
entry -> {
|
| 2172 |
Map<String, List<PartnerWarehouseStockAgingSummaryModel>> sortedStatusMap = entry.getValue().entrySet().stream()
|
2184 |
Map<String, List<PartnerWarehouseStockAgingSummaryModel>> sortedStatusMap = entry.getValue().entrySet().stream()
|
| Line 2189... |
Line 2201... |
| 2189 |
model.addAttribute("brandStatusWiseStockListMap", sortedBrandStatusWiseStockListMap);
|
2201 |
model.addAttribute("brandStatusWiseStockListMap", sortedBrandStatusWiseStockListMap);
|
| 2190 |
model.addAttribute("sevenDayAboveSoldsCatalogsMap", sevenDayAboveSoldsCatalogsMap);
|
2202 |
model.addAttribute("sevenDayAboveSoldsCatalogsMap", sevenDayAboveSoldsCatalogsMap);
|
| 2191 |
model.addAttribute("fourteenDayAboveSoldsCatalogsMap", fourteenDayAboveSoldsCatalogsMap);
|
2203 |
model.addAttribute("fourteenDayAboveSoldsCatalogsMap", fourteenDayAboveSoldsCatalogsMap);
|
| 2192 |
model.addAttribute("twentyOneDayAboveSoldsCatalogsMap", twentyOneDayAboveSoldsCatalogsMap);
|
2204 |
model.addAttribute("twentyOneDayAboveSoldsCatalogsMap", twentyOneDayAboveSoldsCatalogsMap);
|
| 2193 |
model.addAttribute("twentyEightDayAboveSoldsCatalogsMap", twentyEightDayAboveSoldsCatalogsMap);
|
2205 |
model.addAttribute("twentyEightDayAboveSoldsCatalogsMap", twentyEightDayAboveSoldsCatalogsMap);
|
| 2194 |
model.addAttribute("brands", brands);
|
2206 |
model.addAttribute("brands", sortedBrands);
|
| 2195 |
model.addAttribute("brand", brand);
|
2207 |
model.addAttribute("brand", brand);
|
| 2196 |
model.addAttribute("fofoId", fofoId);
|
2208 |
model.addAttribute("fofoId", fofoId);
|
| 2197 |
model.addAttribute("customRetailer", customRetailer);
|
2209 |
model.addAttribute("customRetailer", customRetailer);
|
| 2198 |
return "partner-stock";
|
2210 |
return "partner-stock";
|
| 2199 |
|
2211 |
|