| Line 108... |
Line 108... |
| 108 |
|
108 |
|
| 109 |
@Autowired
|
109 |
@Autowired
|
| 110 |
com.spice.profitmandi.web.services.SolrService webSolrService;
|
110 |
com.spice.profitmandi.web.services.SolrService webSolrService;
|
| 111 |
|
111 |
|
| 112 |
@Autowired
|
112 |
@Autowired
|
| - |
|
113 |
com.spice.profitmandi.web.services.HotDealEnrichmentService hotDealEnrichmentService;
|
| - |
|
114 |
|
| - |
|
115 |
@Autowired
|
| - |
|
116 |
com.spice.profitmandi.dao.repository.catalog.ModelHotDealRepository modelHotDealRepository;
|
| - |
|
117 |
|
| - |
|
118 |
@Autowired
|
| 113 |
private com.spice.profitmandi.web.services.PartnerSolrClient partnerSolrClient;
|
119 |
private com.spice.profitmandi.web.services.PartnerSolrClient partnerSolrClient;
|
| 114 |
|
120 |
|
| 115 |
@Autowired
|
121 |
@Autowired
|
| 116 |
PinelabsAffordabilityService pinelabsAffordabilityService;
|
122 |
PinelabsAffordabilityService pinelabsAffordabilityService;
|
| 117 |
|
123 |
|
| Line 285... |
Line 291... |
| 285 |
int fofoId = uc.getUserId();
|
291 |
int fofoId = uc.getUserId();
|
| 286 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
292 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 287 |
Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
293 |
Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
| 288 |
if (!catalogIds.isEmpty()) {
|
294 |
if (!catalogIds.isEmpty()) {
|
| 289 |
dealResponse = webSolrService.dealResponse(catalogIds, fofoId);
|
295 |
dealResponse = webSolrService.dealResponse(catalogIds, fofoId);
|
| - |
|
296 |
hotDealEnrichmentService.enrich(dealResponse);
|
| 290 |
}
|
297 |
}
|
| 291 |
return responseSender.ok(dealResponse);
|
298 |
return responseSender.ok(dealResponse);
|
| 292 |
}
|
299 |
}
|
| 293 |
|
300 |
|
| 294 |
@RequestMapping(value = "/favourites/manage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
301 |
@RequestMapping(value = "/favourites/manage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 390... |
Line 397... |
| 390 |
|
397 |
|
| 391 |
if (endPoint != null && !endPoint.trim().isEmpty()) {
|
398 |
if (endPoint != null && !endPoint.trim().isEmpty()) {
|
| 392 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
399 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
| 393 |
dealResponse = this.getDealResponses(userInfo, fs, webListing, offset, limit);
|
400 |
dealResponse = this.getDealResponses(userInfo, fs, webListing, offset, limit);
|
| 394 |
|
401 |
|
| - |
|
402 |
} else if (hotDeal) {
|
| - |
|
403 |
// Hot deals are sourced from catalog.model_hot_deal (date-windowed, curated),
|
| - |
|
404 |
// not the legacy Solr hot_deal_b flag
|
| - |
|
405 |
List<Integer> hotDealCatalogIds = modelHotDealRepository.selectAllActive(java.time.LocalDate.now())
|
| - |
|
406 |
.stream().map(com.spice.profitmandi.dao.entity.catalog.ModelHotDeal::getCatalogItemId)
|
| - |
|
407 |
.distinct().collect(Collectors.toList());
|
| - |
|
408 |
if (hotDealCatalogIds.isEmpty()) {
|
| - |
|
409 |
dealResponse = new ArrayList<>();
|
| - |
|
410 |
} else {
|
| - |
|
411 |
dealResponse = this.getCatalogResponse(
|
| - |
|
412 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, false, group, true,
|
| - |
|
413 |
brandsService.restrictedBrands(userInfo.getRetailerId()), hotDealCatalogIds), false, userInfo.getRetailerId());
|
| - |
|
414 |
}
|
| 395 |
} else {
|
415 |
} else {
|
| 396 |
|
416 |
|
| 397 |
dealResponse = this.getCatalogResponse(
|
417 |
dealResponse = this.getCatalogResponse(
|
| 398 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal, group, true,
|
418 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal, group, true,
|
| 399 |
brandsService.restrictedBrands(userInfo.getRetailerId())), hotDeal, userInfo.getRetailerId());
|
419 |
brandsService.restrictedBrands(userInfo.getRetailerId())), hotDeal, userInfo.getRetailerId());
|
| 400 |
}
|
420 |
}
|
| - |
|
421 |
hotDealEnrichmentService.enrich(dealResponse);
|
| 401 |
|
422 |
|
| 402 |
Map<Integer, List<Integer>> similarModelMap = dealResponse.stream().filter(x -> x.getSimilarModelIds() != null && x.getSimilarModelIds().size() > 0)
|
423 |
Map<Integer, List<Integer>> similarModelMap = dealResponse.stream().filter(x -> x.getSimilarModelIds() != null && x.getSimilarModelIds().size() > 0)
|
| 403 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getSimilarModelIds()));
|
424 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getSimilarModelIds()));
|
| 404 |
Set<Integer> similarModelIds = similarModelMap.values().stream().flatMap(x -> x.stream()).collect(Collectors.toSet());
|
425 |
Set<Integer> similarModelIds = similarModelMap.values().stream().flatMap(x -> x.stream()).collect(Collectors.toSet());
|
| 405 |
logger.info("similarModelIds - {}", similarModelIds);
|
426 |
logger.info("similarModelIds - {}", similarModelIds);
|
| Line 655... |
Line 676... |
| 655 |
}
|
676 |
}
|
| 656 |
if (dealResponse.isEmpty()) {
|
677 |
if (dealResponse.isEmpty()) {
|
| 657 |
return responseSender.badRequest(
|
678 |
return responseSender.badRequest(
|
| 658 |
new ProfitMandiBusinessException("catalogId", id, "DEAL_NOT_FOUND"));
|
679 |
new ProfitMandiBusinessException("catalogId", id, "DEAL_NOT_FOUND"));
|
| 659 |
}
|
680 |
}
|
| - |
|
681 |
hotDealEnrichmentService.enrich(dealResponse);
|
| 660 |
return responseSender.ok(dealResponse.get(0));
|
682 |
return responseSender.ok(dealResponse.get(0));
|
| 661 |
}
|
683 |
}
|
| 662 |
|
684 |
|
| 663 |
|
685 |
|
| 664 |
@RequestMapping(value = "/suggestedPoDeals", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
686 |
@RequestMapping(value = "/suggestedPoDeals", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|