| 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;
|
| 27 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
28 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
| 28 |
import com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel;
|
29 |
import com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel;
|
| 29 |
import com.spice.profitmandi.dao.model.InStockBrandFofoIdModel;
|
30 |
import com.spice.profitmandi.dao.model.InStockBrandFofoIdModel;
|
| 30 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
31 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
32 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
| Line 2106... |
Line 2107... |
| 2106 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
2107 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
| 2107 |
public String getPartnerShortageStock(HttpServletRequest request,
|
2108 |
public String getPartnerShortageStock(HttpServletRequest request,
|
| 2108 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
2109 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
| 2109 |
throws Exception {
|
2110 |
throws Exception {
|
| 2110 |
|
2111 |
|
| - |
|
2112 |
LocalDateTime presentDate = LocalDateTime.now();
|
| - |
|
2113 |
|
| - |
|
2114 |
|
| 2111 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
2115 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 2112 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
2116 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 2113 |
|
2117 |
|
| 2114 |
List<PartnerWarehouseStockSummaryModel> partnerWarehouseStockSummaryModels = saholicInventoryService.getSaholicAndPartnerStock(fofoId, fofoStore.getWarehouseId());
|
2118 |
List<PartnerWarehouseStockSummaryModel> partnerWarehouseStockSummaryModels = saholicInventoryService.getSaholicAndPartnerStock(fofoId, fofoStore.getWarehouseId());
|
| 2115 |
|
2119 |
|
| 2116 |
Set<Integer> catalogIds = partnerWarehouseStockSummaryModels.stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
2120 |
Set<Integer> catalogIds = partnerWarehouseStockSummaryModels.stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
| 2117 |
|
2121 |
|
| - |
|
2122 |
List<DateWiseSoldCatalogQtyModel> sevenDayAboveSoldsCatalogs = fofoOrderRepository.getDateWiseSoldCatalogQty(fofoId, catalogIds, presentDate.minusDays(7));
|
| - |
|
2123 |
Map<Integer, DateWiseSoldCatalogQtyModel> sevenDayAboveSoldsCatalogsMap = sevenDayAboveSoldsCatalogs.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| - |
|
2124 |
|
| - |
|
2125 |
List<DateWiseSoldCatalogQtyModel> fourteenDayAboveSoldsCatalogs = fofoOrderRepository.getDateWiseSoldCatalogQty(fofoId, catalogIds, presentDate.minusDays(14));
|
| - |
|
2126 |
Map<Integer, DateWiseSoldCatalogQtyModel> fourteenDayAboveSoldsCatalogsMap = fourteenDayAboveSoldsCatalogs.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| - |
|
2127 |
|
| - |
|
2128 |
List<DateWiseSoldCatalogQtyModel> twentyOneDayAboveSoldsCatalogs = fofoOrderRepository.getDateWiseSoldCatalogQty(fofoId, catalogIds, presentDate.minusDays(21));
|
| - |
|
2129 |
Map<Integer, DateWiseSoldCatalogQtyModel> twentyOneDayAboveSoldsCatalogsMap = twentyOneDayAboveSoldsCatalogs.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| - |
|
2130 |
LOGGER.info("twentyOneDayAboveSoldsCatalogs {}", twentyOneDayAboveSoldsCatalogs);
|
| - |
|
2131 |
List<DateWiseSoldCatalogQtyModel> twentyEightDayAboveSoldsCatalogs = fofoOrderRepository.getDateWiseSoldCatalogQty(fofoId, catalogIds, presentDate.minusDays(28));
|
| - |
|
2132 |
Map<Integer, DateWiseSoldCatalogQtyModel> twentyEightDayAboveSoldsCatalogsMap = twentyEightDayAboveSoldsCatalogs.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| - |
|
2133 |
|
| 2118 |
List<CatalogAgingModel> catalogAgingModels = ageingService.getCatalogsAgingByWarehouse(catalogIds, fofoStore.getWarehouseId());
|
2134 |
List<CatalogAgingModel> catalogAgingModels = ageingService.getCatalogsAgingByWarehouse(catalogIds, fofoStore.getWarehouseId());
|
| 2119 |
|
2135 |
|
| 2120 |
Map<Integer, CatalogAgingModel> catalogAgingModelMap = catalogAgingModels.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
2136 |
Map<Integer, CatalogAgingModel> catalogAgingModelMap = catalogAgingModels.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| 2121 |
LOGGER.info("catalogAgingModelMap{},fofoId{},getWarehouseId {}", catalogAgingModelMap, fofoId, fofoStore.getWarehouseId());
|
- |
|
| 2122 |
|
2137 |
|
| 2123 |
List<PartnerWarehouseStockAgingSummaryModel> partnerWarehouseStockAgingSummaryModelList = new ArrayList<>();
|
2138 |
List<PartnerWarehouseStockAgingSummaryModel> partnerWarehouseStockAgingSummaryModelList = new ArrayList<>();
|
| 2124 |
|
2139 |
|
| 2125 |
for (PartnerWarehouseStockSummaryModel stockSummary : partnerWarehouseStockSummaryModels) {
|
2140 |
for (PartnerWarehouseStockSummaryModel stockSummary : partnerWarehouseStockSummaryModels) {
|
| 2126 |
|
2141 |
|
| 2127 |
PartnerWarehouseStockAgingSummaryModel partnerWarehouseStockAgingSummaryModel = new PartnerWarehouseStockAgingSummaryModel();
|
2142 |
PartnerWarehouseStockAgingSummaryModel partnerWarehouseStockAgingSummaryModel = new PartnerWarehouseStockAgingSummaryModel();
|
| 2128 |
LOGGER.info("stockSummary.getCatalogId() {}", stockSummary.getCatalogId());
|
- |
|
| 2129 |
partnerWarehouseStockAgingSummaryModel.setCatalogId(stockSummary.getCatalogId());
|
2143 |
partnerWarehouseStockAgingSummaryModel.setCatalogId(stockSummary.getCatalogId());
|
| 2130 |
partnerWarehouseStockAgingSummaryModel.setBrand(stockSummary.getBrand());
|
2144 |
partnerWarehouseStockAgingSummaryModel.setBrand(stockSummary.getBrand());
|
| 2131 |
partnerWarehouseStockAgingSummaryModel.setModelNumber(stockSummary.getModelNumber());
|
2145 |
partnerWarehouseStockAgingSummaryModel.setModelNumber(stockSummary.getModelNumber());
|
| 2132 |
partnerWarehouseStockAgingSummaryModel.setNetAvailability(stockSummary.getShaholicNetAvailability());
|
2146 |
partnerWarehouseStockAgingSummaryModel.setNetAvailability(stockSummary.getShaholicNetAvailability());
|
| 2133 |
partnerWarehouseStockAgingSummaryModel.setPartnerStockAvailability(stockSummary.getPartnerFullFilledQty());
|
2147 |
partnerWarehouseStockAgingSummaryModel.setPartnerStockAvailability(stockSummary.getPartnerFullFilledQty());
|
| Line 2138... |
Line 2152... |
| 2138 |
|
2152 |
|
| 2139 |
partnerWarehouseStockAgingSummaryModelList.add(partnerWarehouseStockAgingSummaryModel);
|
2153 |
partnerWarehouseStockAgingSummaryModelList.add(partnerWarehouseStockAgingSummaryModel);
|
| 2140 |
}
|
2154 |
}
|
| 2141 |
|
2155 |
|
| 2142 |
List<String> brands = ProfitMandiConstants.BRANDS;
|
2156 |
List<String> brands = ProfitMandiConstants.BRANDS;
|
| 2143 |
List<String> statusOrder = Arrays.asList("SLOWMOVING", "RUNNING", "FASTMOVING", "HID", "OTHER");
|
2157 |
List<String> statusOrder = Arrays.asList("HID", "FASTMOVING", "RUNNING", "SLOWMOVING", "OTHER");
|
| 2144 |
Map<String, List<PartnerWarehouseStockAgingSummaryModel>> brandPartnerWarehouseStockListMap =
|
2158 |
Map<String, List<PartnerWarehouseStockAgingSummaryModel>> brandPartnerWarehouseStockListMap =
|
| 2145 |
partnerWarehouseStockAgingSummaryModelList.stream().collect(Collectors.groupingBy(
|
2159 |
partnerWarehouseStockAgingSummaryModelList.stream().collect(Collectors.groupingBy(
|
| 2146 |
PartnerWarehouseStockAgingSummaryModel::getBrand));
|
2160 |
PartnerWarehouseStockAgingSummaryModel::getBrand));
|
| 2147 |
|
2161 |
|
| 2148 |
Map<String, Map<String, List<PartnerWarehouseStockAgingSummaryModel>>> brandStatusWiseStockListMap =
|
2162 |
Map<String, Map<String, List<PartnerWarehouseStockAgingSummaryModel>>> brandStatusWiseStockListMap =
|
| Line 2171... |
Line 2185... |
| 2171 |
(v1, v2) -> v1,
|
2185 |
(v1, v2) -> v1,
|
| 2172 |
LinkedHashMap::new // Maintain order of brands
|
2186 |
LinkedHashMap::new // Maintain order of brands
|
| 2173 |
));
|
2187 |
));
|
| 2174 |
|
2188 |
|
| 2175 |
model.addAttribute("brandStatusWiseStockListMap", sortedBrandStatusWiseStockListMap);
|
2189 |
model.addAttribute("brandStatusWiseStockListMap", sortedBrandStatusWiseStockListMap);
|
| - |
|
2190 |
model.addAttribute("sevenDayAboveSoldsCatalogsMap", sevenDayAboveSoldsCatalogsMap);
|
| - |
|
2191 |
model.addAttribute("fourteenDayAboveSoldsCatalogsMap", fourteenDayAboveSoldsCatalogsMap);
|
| - |
|
2192 |
model.addAttribute("twentyOneDayAboveSoldsCatalogsMap", twentyOneDayAboveSoldsCatalogsMap);
|
| - |
|
2193 |
model.addAttribute("twentyEightDayAboveSoldsCatalogsMap", twentyEightDayAboveSoldsCatalogsMap);
|
| 2176 |
model.addAttribute("brands", brands);
|
2194 |
model.addAttribute("brands", brands);
|
| 2177 |
model.addAttribute("brand", brand);
|
2195 |
model.addAttribute("brand", brand);
|
| 2178 |
model.addAttribute("fofoId", fofoId);
|
2196 |
model.addAttribute("fofoId", fofoId);
|
| 2179 |
model.addAttribute("customRetailer", customRetailer);
|
2197 |
model.addAttribute("customRetailer", customRetailer);
|
| 2180 |
return "partner-stock";
|
2198 |
return "partner-stock";
|