|
|
package com.yoho.search.service.scene.sknimg;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
|
|
import com.yoho.search.base.utils.ProductIndexEsField;
|
|
|
import com.yoho.search.cache.beans.AbstractCacheBean;
|
|
|
import com.yoho.search.common.SearchCommonService;
|
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.common.SearchCommonService;
|
|
|
import com.yoho.search.service.helper.SknImgHelper;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Component
|
|
|
public class SknImgsCacheBean extends AbstractCacheBean<SknImgsResquest, SknImgsResponse, SknImgsRequestResponse> {
|
|
|
|
|
|
@Autowired
|
|
|
private SearchCommonService searchCommonService;
|
|
|
@Autowired
|
|
|
private SknImgHelper sknImgHelper;
|
|
|
|
|
|
@Override
|
|
|
protected boolean useEhCache() {
|
...
|
...
|
@@ -75,8 +72,8 @@ public class SknImgsCacheBean extends AbstractCacheBean<SknImgsResquest, SknImgs |
|
|
response.setDefault_images(MapUtils.getString(product, ProductIndexEsField.defaultImages, ""));
|
|
|
response.setSkn_default_img(MapUtils.getString(product, ProductIndexEsField.sknDefaultImg, ""));
|
|
|
response.setGender(MapUtils.getString(product, ProductIndexEsField.gender, ""));
|
|
|
List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(product.get(ProductIndexEsField.goodsList)), new TypeReference<List<JSONObject>>() {});
|
|
|
sknImgHelper.genImage(goodsList, response);
|
|
|
response.setCover_1(MapUtils.getString(product, ProductIndexEsField.cover_1, ""));
|
|
|
response.setCover_2(MapUtils.getString(product, ProductIndexEsField.cover_2, ""));
|
|
|
defaultImgTempMap.put(MapUtils.getString(product,ProductIndexEsField.productSkn,""), response);
|
|
|
}
|
|
|
for (SknImgsRequestResponse requestResponse : missCacheRequests) {
|
...
|
...
|
|