| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.controllers;
|
1 |
package in.shop2020.serving.controllers;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.datalogger.EventType;
|
3 |
import in.shop2020.datalogger.EventType;
|
| 4 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
4 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 5 |
import in.shop2020.model.v1.catalog.Banner;
|
- |
|
| 6 |
import in.shop2020.model.v1.catalog.BannerMap;
|
- |
|
| 7 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
5 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| 8 |
import in.shop2020.serving.cache.EhcacheWrapper;
|
6 |
import in.shop2020.serving.cache.EhcacheWrapper;
|
| 9 |
import in.shop2020.serving.services.ContentServingService;
|
7 |
import in.shop2020.serving.services.ContentServingService;
|
| 10 |
import in.shop2020.serving.utils.SnippetType;
|
8 |
import in.shop2020.serving.utils.SnippetType;
|
| 11 |
import in.shop2020.thrift.clients.CatalogClient;
|
9 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 12 |
import in.shop2020.utils.DataLogger;
|
10 |
import in.shop2020.utils.DataLogger;
|
| 13 |
|
11 |
|
| 14 |
import java.io.IOException;
|
12 |
import java.io.IOException;
|
| 15 |
import java.util.ArrayList;
|
13 |
import java.util.ArrayList;
|
| 16 |
import java.util.Arrays;
|
14 |
import java.util.Arrays;
|
| 17 |
import java.util.HashMap;
|
- |
|
| 18 |
import java.util.List;
|
15 |
import java.util.List;
|
| 19 |
import java.util.Map;
|
- |
|
| 20 |
|
16 |
|
| 21 |
import net.sf.ehcache.CacheManager;
|
17 |
import net.sf.ehcache.CacheManager;
|
| 22 |
|
18 |
|
| 23 |
import org.apache.log4j.Logger;
|
19 |
import org.apache.log4j.Logger;
|
| 24 |
import org.apache.struts2.convention.annotation.Action;
|
20 |
import org.apache.struts2.convention.annotation.Action;
|
| Line 133... |
Line 129... |
| 133 |
if(bestSellerCatalogIds.size() < bestSellerCount)
|
129 |
if(bestSellerCatalogIds.size() < bestSellerCount)
|
| 134 |
bestSellerCount = bestSellerCatalogIds.size();
|
130 |
bestSellerCount = bestSellerCatalogIds.size();
|
| 135 |
|
131 |
|
| 136 |
//Get top 12 latest arrivals b'coz 4 of them may overlap with best deals
|
132 |
//Get top 12 latest arrivals b'coz 4 of them may overlap with best deals
|
| 137 |
//while another 4 may overlap with best sellers.
|
133 |
//while another 4 may overlap with best sellers.
|
| 138 |
latestArrivalCatalogIds = client.getLatestArrivalsCatalogIds(0, 12, null, Arrays.asList(new Long[]{ 10002L, 10003L, 10004L, 10010L, 10050L}));
|
134 |
latestArrivalCatalogIds = client.getLatestArrivalsCatalogIds(0, 12, null, Arrays.asList(new Long[]{ 10006L, 10010L, 10050L}));
|
| 139 |
latestArrivalCatalogIds.removeAll(bestDealCatalogIds);
|
135 |
latestArrivalCatalogIds.removeAll(bestDealCatalogIds);
|
| 140 |
latestArrivalCatalogIds.removeAll(bestSellerCatalogIds.subList(0, bestSellerCount)); //We're only considering the first 4 best sellers for removal.
|
136 |
latestArrivalCatalogIds.removeAll(bestSellerCatalogIds.subList(0, bestSellerCount)); //We're only considering the first 4 best sellers for removal.
|
| 141 |
if(latestArrivalCatalogIds.size() < latestArrivalCount)
|
137 |
if(latestArrivalCatalogIds.size() < latestArrivalCount)
|
| 142 |
latestArrivalCount = latestArrivalCatalogIds.size();
|
138 |
latestArrivalCount = latestArrivalCatalogIds.size();
|
| 143 |
} catch (CatalogServiceException e) {
|
139 |
} catch (CatalogServiceException e) {
|