| Line 271... |
Line 271... |
| 271 |
@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
|
271 |
@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
|
| 272 |
@RequestParam(value = "sort", required = false) String sort,
|
272 |
@RequestParam(value = "sort", required = false) String sort,
|
| 273 |
@RequestParam(value = "brand", required = false) String brand,
|
273 |
@RequestParam(value = "brand", required = false) String brand,
|
| 274 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId,
|
274 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId,
|
| 275 |
@RequestParam(value = "q", required = false) String queryTerm,
|
275 |
@RequestParam(value = "q", required = false) String queryTerm,
|
| 276 |
@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
|
276 |
@RequestParam(value = "hotDeal", required = false) boolean hotDeal,
|
| - |
|
277 |
@RequestParam(value = "endPoint", required = false) String endPoint) throws Throwable {
|
| 277 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
278 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 278 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
279 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 279 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
280 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| 280 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
281 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
| - |
|
282 |
|
| - |
|
283 |
logger.info("endPoint {}", endPoint);
|
| - |
|
284 |
if (!StringUtils.isEmpty(endPoint)) {
|
| 281 |
dealResponse = this.getCatalogResponse(
|
285 |
dealResponse = this.getCatalogResponse(
|
| 282 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal),
|
286 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal),
|
| 283 |
hotDeal, userInfo.getRetailerId());
|
287 |
hotDeal, userInfo.getRetailerId());
|
| - |
|
288 |
} else {
|
| - |
|
289 |
|
| - |
|
290 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
| - |
|
291 |
dealResponse = this.getDealResponses(userInfo, webListing);
|
| - |
|
292 |
}
|
| 284 |
logger.info("log me");
|
293 |
logger.info("log me");
|
| 285 |
return responseSender.ok(dealResponse);
|
294 |
return responseSender.ok(dealResponse);
|
| 286 |
}
|
295 |
}
|
| 287 |
|
296 |
|
| 288 |
@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
297 |
@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 556... |
Line 565... |
| 556 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
|
565 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
|
| 557 |
}
|
566 |
}
|
| 558 |
return responseSender.ok(webListings);
|
567 |
return responseSender.ok(webListings);
|
| 559 |
}
|
568 |
}
|
| 560 |
|
569 |
|
| 561 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing)
|
570 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing) throws Exception {
|
| 562 |
throws Exception {
|
- |
|
| 563 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream()
|
571 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream()
|
| 564 |
.filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
572 |
.filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
| 565 |
if (webProducts.size() == 0) {
|
573 |
if (webProducts.size() == 0) {
|
| 566 |
return new ArrayList<>();
|
574 |
return new ArrayList<>();
|
| 567 |
}
|
575 |
}
|