| Line 52... |
Line 52... |
| 52 |
}
|
52 |
}
|
| 53 |
}
|
53 |
}
|
| 54 |
|
54 |
|
| 55 |
// GET /index
|
55 |
// GET /index
|
| 56 |
public HttpHeaders index() throws Exception {
|
56 |
public HttpHeaders index() throws Exception {
|
| 57 |
long categoryId = Long.parseLong(request.getParameter("categoryid"));
|
57 |
long categoryId = Long.parseLong(request.getParameter("categoryid"));
|
| - |
|
58 |
String brandName = request.getParameter("brand");
|
| - |
|
59 |
//Right now if we have brand name, we can just send back data for all categories
|
| - |
|
60 |
if(brandName!=null){
|
| - |
|
61 |
categoryId = -1;
|
| - |
|
62 |
}
|
| 58 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
63 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
| 59 |
this.items = client.getBestSellersCatalogIds(beginIndex, windowSize, categoryId);
|
64 |
this.items = client.getBestSellersCatalogIds(beginIndex, windowSize, brandName, categoryId);
|
| 60 |
return new DefaultHttpHeaders("index");
|
65 |
return new DefaultHttpHeaders("index");
|
| 61 |
}
|
66 |
}
|
| 62 |
|
67 |
|
| 63 |
// GET /show
|
68 |
// GET /show
|
| 64 |
public HttpHeaders show() {
|
69 |
public HttpHeaders show() {
|
| 65 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
70 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
| 66 |
try {
|
71 |
try {
|
| 67 |
this.setTotalItems(client.getBestSellersCount());
|
72 |
this.setTotalItems(client.getBestSellersCount());
|
| 68 |
this.items = client.getBestSellersCatalogIds(beginIndex, windowSize, -1);
|
73 |
this.items = client.getBestSellersCatalogIds(beginIndex, windowSize, null, -1);
|
| 69 |
} catch (InventoryServiceException e) {
|
74 |
} catch (InventoryServiceException e) {
|
| 70 |
log.error("Unable to get best sellers from inventory service.");
|
75 |
log.error("Unable to get best sellers from inventory service.");
|
| 71 |
log.error("Exception id is:" + e.getId() + " Exception message is:" + e.getMessage());
|
76 |
log.error("Exception id is:" + e.getId() + " Exception message is:" + e.getMessage());
|
| 72 |
e.printStackTrace();
|
77 |
e.printStackTrace();
|
| 73 |
} catch (TException e) {
|
78 |
} catch (TException e) {
|