| Line 282... |
Line 282... |
| 282 |
|
282 |
|
| 283 |
logger.info("endPoint {}", endPoint);
|
283 |
logger.info("endPoint {}", endPoint);
|
| 284 |
|
284 |
|
| 285 |
if (endPoint != null && !endPoint.trim().isEmpty()) {
|
285 |
if (endPoint != null && !endPoint.trim().isEmpty()) {
|
| 286 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
286 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
| 287 |
dealResponse = this.getDealResponses(userInfo, webListing);
|
287 |
dealResponse = this.getDealResponses(userInfo, webListing, offset, limit);
|
| 288 |
|
288 |
|
| 289 |
} else {
|
289 |
} else {
|
| 290 |
|
290 |
|
| 291 |
dealResponse = this.getCatalogResponse(
|
291 |
dealResponse = this.getCatalogResponse(
|
| 292 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal),
|
292 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal),
|
| Line 562... |
Line 562... |
| 562 |
public ResponseEntity<?> getPartnersListing(HttpServletRequest request) throws Exception {
|
562 |
public ResponseEntity<?> getPartnersListing(HttpServletRequest request) throws Exception {
|
| 563 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true),
|
563 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true),
|
| 564 |
WebListingType.partner);
|
564 |
WebListingType.partner);
|
| 565 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
565 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 566 |
for (WebListing webListing : webListings) {
|
566 |
for (WebListing webListing : webListings) {
|
| 567 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
|
567 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing, "0", "10"));
|
| 568 |
}
|
568 |
}
|
| 569 |
return responseSender.ok(webListings);
|
569 |
return responseSender.ok(webListings);
|
| 570 |
}
|
570 |
}
|
| 571 |
|
571 |
|
| 572 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing) throws Exception {
|
572 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing, String offset,
|
| - |
|
573 |
String limit) throws Exception {
|
| 573 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream()
|
574 |
List<Integer> webProducts = webProductListingRepository
|
| - |
|
575 |
.selectAllByWebListingId(webListing.getId(), Integer.parseInt(offset), Integer.parseInt(limit)).stream()
|
| 574 |
.filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
576 |
.filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
| 575 |
if (webProducts.size() == 0) {
|
577 |
if (webProducts.size() == 0) {
|
| 576 |
return new ArrayList<>();
|
578 |
return new ArrayList<>();
|
| 577 |
}
|
579 |
}
|
| 578 |
RestClient rc = new RestClient();
|
580 |
RestClient rc = new RestClient();
|
| Line 582... |
Line 584... |
| 582 |
"+{!parent which=\"catalogId_i:" + StringUtils.join(webProducts, " ") + "\"} tagId_i:(%s)",
|
584 |
"+{!parent which=\"catalogId_i:" + StringUtils.join(webProducts, " ") + "\"} tagId_i:(%s)",
|
| 583 |
StringUtils.join(TAG_IDS, " ")));
|
585 |
StringUtils.join(TAG_IDS, " ")));
|
| 584 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
586 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
| 585 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
587 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
| 586 |
// params.put("sort", "create_s desc");
|
588 |
// params.put("sort", "create_s desc");
|
| 587 |
params.put("start", String.valueOf(0));
|
589 |
params.put("start", String.valueOf(offset));
|
| 588 |
params.put("rows", String.valueOf(100));
|
590 |
params.put("rows", String.valueOf(limit));
|
| 589 |
params.put("wt", "json");
|
591 |
params.put("wt", "json");
|
| 590 |
String response = null;
|
592 |
String response = null;
|
| 591 |
try {
|
593 |
try {
|
| 592 |
response = rc.get(SchemeType.HTTP, "50.116.10.120", 8984, "solr/demo/select", params);
|
594 |
response = rc.get(SchemeType.HTTP, "50.116.10.120", 8984, "solr/demo/select", params);
|
| 593 |
} catch (HttpHostConnectException e) {
|
595 |
} catch (HttpHostConnectException e) {
|