...
|
...
|
@@ -235,14 +235,14 @@ public class BrandServiceImpl implements IBrandService, ApplicationEventPublishe |
|
|
searchParam.setFiter(boolQueryBuilder);
|
|
|
|
|
|
// 2、brand数据量比较大,走本地缓存。guavacache缓存中获取result,没有到es中获取
|
|
|
final String indexName = ISearchConstants.INDEX_NAME_BRAND;
|
|
|
JSONArray cacheJSONArray = searchCacheService.getJSONArrayFromCache(brandCacheEnum, indexName, searchParam);
|
|
|
final String brandIndexName = ISearchConstants.INDEX_NAME_BRAND;
|
|
|
JSONArray cacheJSONArray = searchCacheService.getJSONArrayFromCache(brandCacheEnum, brandIndexName, searchParam);
|
|
|
if (cacheJSONArray != null) {
|
|
|
CACHE_MATCH_REQUEST.info("match cache , url is :/brand/list.json?" + HttpServletRequestUtils.genParamString(paramMap));
|
|
|
return new SearchApiResult().setData(cacheJSONArray);
|
|
|
}
|
|
|
// 3、执行搜索
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_BRAND, searchParam);
|
|
|
SearchResult searchResult = searchCommonService.doSearch(brandIndexName, searchParam);
|
|
|
if (searchResult == null || searchResult.getResultList().isEmpty()) {
|
|
|
return new SearchApiResult().setData(400).setMessage("empty result");
|
|
|
}
|
...
|
...
|
@@ -253,7 +253,7 @@ public class BrandServiceImpl implements IBrandService, ApplicationEventPublishe |
|
|
Map<String, Object> brandInfo= brandIndexBaseService.getBrandMap(map);
|
|
|
jsonArray.add(brandInfo);
|
|
|
}
|
|
|
searchCacheService.addJSONArrayToCache(brandCacheEnum, indexName, searchParam, jsonArray);
|
|
|
searchCacheService.addJSONArrayToCache(brandCacheEnum, brandIndexName, searchParam, jsonArray);
|
|
|
return new SearchApiResult().setMessage("brands info").setData(jsonArray);
|
|
|
} catch (Exception e) {
|
|
|
publisher.publishEvent(new SearchEvent(EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getEventName(), EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getFunctionName(),
|
...
|
...
|
@@ -310,6 +310,7 @@ public class BrandServiceImpl implements IBrandService, ApplicationEventPublishe |
|
|
JSONArray jsonArrayBrands = (JSONArray) searchApiResultBrands.getData();
|
|
|
Iterator<Object> it = jsonArrayBrands.iterator();
|
|
|
while (it.hasNext()) {
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Map<String, Object> dataMap = (Map<String, Object>) it.next();
|
|
|
brandMap.put(dataMap.get("id").toString(), dataMap);
|
|
|
}
|
...
|
...
|
|