| Line 674... |
Line 674... |
| 674 |
|
674 |
|
| 675 |
@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
675 |
@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 676 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
|
676 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
|
| 677 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true), WebListingSource.store);
|
677 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true), WebListingSource.store);
|
| 678 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
678 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
679 |
for (WebListing webListing : webListings) {
|
| - |
|
680 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
|
| - |
|
681 |
}
|
| - |
|
682 |
return responseSender.ok(webListings);
|
| - |
|
683 |
}
|
| - |
|
684 |
/*@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
685 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
|
| - |
|
686 |
List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true), WebListingSource.store);
|
| - |
|
687 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 679 |
Iterator<WebListing> webListingIterator = webListings.iterator();
|
688 |
Iterator<WebListing> webListingIterator = webListings.iterator();
|
| 680 |
while (webListingIterator.hasNext()) {
|
689 |
while (webListingIterator.hasNext()) {
|
| 681 |
WebListing webListing = webListingIterator.next();
|
690 |
WebListing webListing = webListingIterator.next();
|
| 682 |
List<FofoCatalogResponse> catalogResponses = getDealResponses(userInfo, webListing);
|
691 |
List<FofoCatalogResponse> catalogResponses = getDealResponses(userInfo, webListing);
|
| 683 |
boolean isAvailable = catalogResponses.stream().anyMatch(x->x.getItems().stream().anyMatch(y->y.getAvailability()>0));
|
692 |
boolean isAvailable = catalogResponses.stream().anyMatch(x->x.getItems().stream().anyMatch(y->y.getAvailability()>0));
|
| Line 686... |
Line 695... |
| 686 |
webListings.remove(webListing);
|
695 |
webListings.remove(webListing);
|
| 687 |
}
|
696 |
}
|
| 688 |
}
|
697 |
}
|
| 689 |
|
698 |
|
| 690 |
return responseSender.ok(webListings);
|
699 |
return responseSender.ok(webListings);
|
| 691 |
}
|
700 |
}*/
|
| 692 |
|
701 |
|
| 693 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing) throws ProfitMandiBusinessException {
|
702 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, WebListing webListing) throws ProfitMandiBusinessException {
|
| 694 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream().filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
703 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream().filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
| 695 |
if (webProducts.size() == 0) {
|
704 |
if (webProducts.size() == 0) {
|
| 696 |
return new ArrayList<>();
|
705 |
return new ArrayList<>();
|