| Line 342... |
Line 342... |
| 342 |
}
|
342 |
}
|
| 343 |
|
343 |
|
| 344 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
344 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 345 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
345 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 346 |
public ResponseEntity<?> getFofo(HttpServletRequest request, @RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId, @RequestParam(value = "offset") int offset,
|
346 |
public ResponseEntity<?> getFofo(HttpServletRequest request, @RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId, @RequestParam(value = "offset") int offset,
|
| 347 |
@RequestParam(value = "limit") int limit, @RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "brand", required = false) String brand, @RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(value = "q", required = false) String queryTerm, @RequestParam(value = "hotDeal", required = false) boolean hotDeal, @RequestParam(value = "endPoint", required = false) String endPoint) throws Throwable {
|
347 |
@RequestParam(value = "limit") int limit, @RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "brand", required = false) String brand, @RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(value = "q", required = false) String queryTerm, @RequestParam(value = "hotDeal", required = false) boolean hotDeal, @RequestParam(value = "endPoint", required = false) String endPoint,@RequestParam(value = "group", required = false) boolean group) throws Throwable {
|
| 348 |
List<FofoCatalogResponse> dealResponse;
|
348 |
List<FofoCatalogResponse> dealResponse;
|
| 349 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
349 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 350 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
350 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| 351 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
351 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
| 352 |
|
352 |
|
| 353 |
logger.info("endPoint {}", endPoint);
|
353 |
logger.info("endPoint {}", endPoint);
|
| - |
|
354 |
logger.info("group Column {}", group);
|
| 354 |
|
355 |
|
| 355 |
if (endPoint != null && !endPoint.trim().isEmpty()) {
|
356 |
if (endPoint != null && !endPoint.trim().isEmpty()) {
|
| 356 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
357 |
WebListing webListing = webListingRepository.selectByUrl(endPoint);
|
| 357 |
dealResponse = this.getDealResponses(userInfo, webListing, offset, limit);
|
358 |
dealResponse = this.getDealResponses(userInfo, webListing, offset, limit);
|
| 358 |
|
359 |
|
| 359 |
} else {
|
360 |
} else {
|
| 360 |
|
361 |
|
| 361 |
dealResponse = this.getCatalogResponse(
|
362 |
dealResponse = this.getCatalogResponse(
|
| 362 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal), hotDeal, userInfo.getRetailerId());
|
363 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal, group), hotDeal, userInfo.getRetailerId());
|
| 363 |
}
|
364 |
}
|
| 364 |
|
365 |
|
| 365 |
Map<Integer, List<Integer>> similarModelMap = dealResponse.stream().filter(x -> x.getSimilarModelIds() != null && x.getSimilarModelIds().size() > 0)
|
366 |
Map<Integer, List<Integer>> similarModelMap = dealResponse.stream().filter(x -> x.getSimilarModelIds() != null && x.getSimilarModelIds().size() > 0)
|
| 366 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getSimilarModelIds()));
|
367 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getSimilarModelIds()));
|
| 367 |
Set<Integer> similarModelIds = similarModelMap.values().stream().flatMap(x -> x.stream()).collect(Collectors.toSet());
|
368 |
Set<Integer> similarModelIds = similarModelMap.values().stream().flatMap(x -> x.stream()).collect(Collectors.toSet());
|