| Line 185... |
Line 185... |
| 185 |
RestClient rc = new RestClient();
|
185 |
RestClient rc = new RestClient();
|
| 186 |
Map<String, String> params = new HashMap<>();
|
186 |
Map<String, String> params = new HashMap<>();
|
| 187 |
List<String> mandatoryQ = new ArrayList<>();
|
187 |
List<String> mandatoryQ = new ArrayList<>();
|
| 188 |
if (brand != null) {
|
188 |
if (brand != null) {
|
| 189 |
|
189 |
|
| 190 |
mandatoryQ.add(String.format("+{!parent which=\"brand_s=%s\"} tagId_i:(%s)", brand,
|
190 |
mandatoryQ.add(String.format("+(categoryId_i:%d) +(brand_s:%s) +{!parent which=\"brand_s:%s\"} tagId_i:(%s)", categoryId, brand, brand,
|
| 191 |
StringUtils.join(tagIds, " ")));
|
191 |
StringUtils.join(tagIds, " ")));
|
| 192 |
} else if (hotDeal) {
|
192 |
} else if (hotDeal) {
|
| 193 |
mandatoryQ.add(String.format("+{!parent which=\"hot_deals_b=true\"} tagId_i:(%s)",
|
193 |
mandatoryQ.add(String.format("+{!parent which=\"hot_deals_b=true\"} tagId_i:(%s)",
|
| 194 |
StringUtils.join(tagIds, " ")));
|
194 |
StringUtils.join(tagIds, " ")));
|
| 195 |
} else {
|
195 |
} else {
|
| 196 |
mandatoryQ.add(
|
196 |
mandatoryQ.add(
|
| 197 |
String.format("+{!parent which=\"id:catalog*\"} tagId_i:(%s)", StringUtils.join(tagIds, " ")));
|
197 |
String.format("+{!parent which=\"id:catalog*\"} tagId_i:(%s)", StringUtils.join(tagIds, " ")));
|
| 198 |
}
|
198 |
}
|
| 199 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
199 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
| 200 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
200 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
| 201 |
params.put("sort", "rank_i asc");
|
201 |
params.put("sort", "rank_i asc, create_s desc");
|
| 202 |
params.put("start", String.valueOf(offset));
|
202 |
params.put("start", String.valueOf(offset));
|
| 203 |
params.put("rows", String.valueOf(limit));
|
203 |
params.put("rows", String.valueOf(limit));
|
| 204 |
params.put("wt", "json");
|
204 |
params.put("wt", "json");
|
| 205 |
String response = null;
|
205 |
String response = null;
|
| 206 |
try {
|
206 |
try {
|
| Line 436... |
Line 436... |
| 436 |
*/
|
436 |
*/
|
| 437 |
return responseSender.ok(dealsResponse);
|
437 |
return responseSender.ok(dealsResponse);
|
| 438 |
}
|
438 |
}
|
| 439 |
|
439 |
|
| 440 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
440 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 441 |
public ResponseEntity<?> getBrandsToDisplay() {
|
441 |
public ResponseEntity<?> getBrandsToDisplay(@RequestParam(required=false) int categoryId) {
|
| 442 |
return new ResponseEntity<>(mongoClient.getBrandsToDisplay(), HttpStatus.OK);
|
442 |
return new ResponseEntity<>(mongoClient.getBrandsToDisplay(categoryId), HttpStatus.OK);
|
| 443 |
}
|
443 |
}
|
| 444 |
|
444 |
|
| 445 |
@RequestMapping(value = "/banners/{bannerType}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
445 |
@RequestMapping(value = "/banners/{bannerType}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 446 |
public ResponseEntity<?> getBanners(@PathVariable String bannerType) {
|
446 |
public ResponseEntity<?> getBanners(@PathVariable String bannerType) {
|
| 447 |
return new ResponseEntity<>(mongoClient.getBannersByType(bannerType), HttpStatus.OK);
|
447 |
return new ResponseEntity<>(mongoClient.getBannersByType(bannerType), HttpStatus.OK);
|