...
|
...
|
@@ -38,7 +38,7 @@ public class CsSearchResourceIndexBaseService { |
|
|
@Autowired
|
|
|
private SearchCommonService searchCommonService;
|
|
|
|
|
|
//Guava Cache
|
|
|
// Guava Cache
|
|
|
private LoadingCache<String, List<Map<String, Object>>> salesCategorySearchResourceCache = CacheBuilder.newBuilder()
|
|
|
.maximumSize(100).expireAfterWrite(3, TimeUnit.MINUTES).build(new CacheLoader<String, List<Map<String, Object>>>() {
|
|
|
public List<Map<String, Object>> load(String key) {
|
...
|
...
|
@@ -46,7 +46,7 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//Guava Cache
|
|
|
// Guava Cache
|
|
|
private LoadingCache<String, List<Map<String, Object>>> ufoSearchResourceCache = CacheBuilder.newBuilder()
|
|
|
.maximumSize(100).expireAfterWrite(3, TimeUnit.MINUTES).build(new CacheLoader<String, List<Map<String, Object>>>() {
|
|
|
public List<Map<String, Object>> load(String key) {
|
...
|
...
|
@@ -54,7 +54,7 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//Guava Cache
|
|
|
// Guava Cache
|
|
|
private LoadingCache<String, List<Map<String, Object>>> newArrivalSearchResourceCache = CacheBuilder.newBuilder()
|
|
|
.maximumSize(100).expireAfterWrite(3, TimeUnit.MINUTES).build(new CacheLoader<String, List<Map<String, Object>>>() {
|
|
|
public List<Map<String, Object>> load(String key) {
|
...
|
...
|
@@ -62,7 +62,17 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//获取销售类目当前生效的全部资源位之停车
|
|
|
|
|
|
// Guava Cache
|
|
|
private LoadingCache<String, List<Map<String, Object>>> firstPageSearchResourceCache = CacheBuilder.newBuilder()
|
|
|
.maximumSize(100).expireAfterWrite(3, TimeUnit.MINUTES).build(new CacheLoader<String, List<Map<String, Object>>>() {
|
|
|
public List<Map<String, Object>> load(String key) {
|
|
|
return queryValidValidCsSearchResourceFromEs(Arrays.asList(5),100);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// 获取销售类目当前生效的全部资源位之停车
|
|
|
public List<Map<String, Object>> querySalesCategoryCsSearchResource() {
|
|
|
try {
|
|
|
return salesCategorySearchResourceCache.get(CACHE_KEY);
|
...
|
...
|
@@ -72,7 +82,7 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
//获取UFO目当前生效的全部资源位之停车
|
|
|
// 获取UFO目当前生效的全部资源位之停车
|
|
|
public List<Map<String, Object>> queryUfoCsSearchResources() {
|
|
|
try {
|
|
|
return ufoSearchResourceCache.get(CACHE_KEY);
|
...
|
...
|
@@ -82,7 +92,7 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
//获取新品到着的直通车
|
|
|
// 获取新品到着的直通车
|
|
|
public List<Map<String, Object>> queryNewArrivalCsSearchResources() {
|
|
|
try {
|
|
|
return newArrivalSearchResourceCache.get(CACHE_KEY);
|
...
|
...
|
@@ -92,6 +102,16 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取首页猜你喜欢的直通车
|
|
|
public List<Map<String,Object>> queryFirstPageSearchResource() {
|
|
|
try {
|
|
|
return firstPageSearchResourceCache.get(CACHE_KEY);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
return new ArrayList<>(0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private List<Map<String, Object>> queryValidValidCsSearchResourceFromEs(List<Integer> resourceTypes,int limit) {
|
|
|
try {
|
|
|
SearchParam searchParam = new SearchParam();
|
...
|
...
|
@@ -147,4 +167,5 @@ public class CsSearchResourceIndexBaseService { |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|