| Line 632... |
Line 632... |
| 632 |
public ResponseEntity<?> getPartnersListing(HttpServletRequest request) throws Exception {
|
632 |
public ResponseEntity<?> getPartnersListing(HttpServletRequest request) throws Exception {
|
| 633 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true),
|
633 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true),
|
| 634 |
WebListingSource.partner);
|
634 |
WebListingSource.partner);
|
| 635 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
635 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 636 |
for (WebListing webListing : webListings) {
|
636 |
for (WebListing webListing : webListings) {
|
| - |
|
637 |
|
| - |
|
638 |
List<WebProductListing> webProducts = webProductListingRepository
|
| - |
|
639 |
.selectAllByWebListingId(webListing.getId());
|
| - |
|
640 |
String size = "50";
|
| - |
|
641 |
if (!webProducts.isEmpty()) {
|
| - |
|
642 |
size = String.valueOf(webProducts.size());
|
| - |
|
643 |
}
|
| 637 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing, "0", "10"));
|
644 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing, "0", size));
|
| 638 |
}
|
645 |
}
|
| 639 |
return responseSender.ok(webListings);
|
646 |
return responseSender.ok(webListings);
|
| 640 |
}
|
647 |
}
|
| 641 |
|
648 |
|
| 642 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing, String offset,
|
649 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing, String offset,
|
| Line 649... |
Line 656... |
| 649 |
|
656 |
|
| 650 |
List<Integer> webProducts = null;
|
657 |
List<Integer> webProducts = null;
|
| 651 |
if (webListing.getType().equals(WebListingType.solr)) {
|
658 |
if (webListing.getType().equals(WebListingType.solr)) {
|
| 652 |
logger.info("solrtype {}", webListing.getSolrQuery());
|
659 |
logger.info("solrtype {}", webListing.getSolrQuery());
|
| 653 |
mandatoryQ.add(String.format("+{!parent which=\"" + webListing.getSolrQuery() + "\"} AND active_b:true"));
|
660 |
mandatoryQ.add(String.format("+{!parent which=\"" + webListing.getSolrQuery() + "\"} AND active_b:true"));
|
| 654 |
|
- |
|
| - |
|
661 |
params.put("sort", "create_s desc");
|
| 655 |
} else {
|
662 |
} else {
|
| 656 |
logger.info("solrtype2 {}", webListing.getSolrQuery());
|
663 |
logger.info("solrtype2 {}", webListing.getSolrQuery());
|
| 657 |
|
664 |
|
| 658 |
webProducts = webProductListingRepository
|
665 |
webProducts = webProductListingRepository
|
| 659 |
.selectAllByWebListingId(webListing.getId(), Integer.parseInt(offset), Integer.parseInt(limit))
|
666 |
.selectAllByWebListingId(webListing.getId(), Integer.parseInt(offset), Integer.parseInt(limit))
|
| Line 666... |
Line 673... |
| 666 |
"+{!parent which=\"catalogId_i:" + StringUtils.join(webProducts, " ") + "\"} AND active_b:true"));
|
673 |
"+{!parent which=\"catalogId_i:" + StringUtils.join(webProducts, " ") + "\"} AND active_b:true"));
|
| 667 |
|
674 |
|
| 668 |
}
|
675 |
}
|
| 669 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
676 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
| 670 |
params.put("fl", "*, [child parentFilter=id:catalog* childFilter=active_b:true ]");
|
677 |
params.put("fl", "*, [child parentFilter=id:catalog* childFilter=active_b:true ]");
|
| 671 |
// params.put("sort", "create_s desc");
|
- |
|
| - |
|
678 |
|
| 672 |
params.put("start", String.valueOf(offset));
|
679 |
params.put("start", String.valueOf(offset));
|
| 673 |
params.put("rows", String.valueOf(limit));
|
680 |
params.put("rows", String.valueOf(limit));
|
| 674 |
params.put("wt", "json");
|
681 |
params.put("wt", "json");
|
| 675 |
String response = null;
|
682 |
String response = null;
|
| 676 |
try {
|
683 |
try {
|