Authored by hugufei

图片返回SKN对应的性别,方便前端取图片

... ... @@ -72,13 +72,14 @@ public class SknImgsCacheBean extends AbstractCacheBean<SknImgsResquest, SknImgs
if (searchResult != null && CollectionUtils.isNotEmpty(searchResult.getResultList())) {
Map<String, SknImgsResponse> defaultImgTempMap = new HashMap<>();
for (Map<String, Object> image : searchResult.getResultList()) {
for (Map<String, Object> product : searchResult.getResultList()) {
SknImgsResponse response = new SknImgsResponse();
response.setDefault_images(MapUtils.getString(image, "defaultImages", ""));
response.setSkn_default_img(MapUtils.getString(image, "sknDefaultImg", ""));
List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(image.get("goodsList")), new TypeReference<List<JSONObject>>() {});
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);
defaultImgTempMap.put(MapUtils.getString(image,"productSkn",""), response);
defaultImgTempMap.put(MapUtils.getString(product,ProductIndexEsField.productSkn,""), response);
}
for (SknImgsRequestResponse requestResponse : missCacheRequests) {
results.put(requestResponse.getRequest(), defaultImgTempMap.get(requestResponse.getRequest().getProductSkn().toString()));
... ...
... ... @@ -5,6 +5,7 @@ public class SknImgsResponse {
private String skn_default_img;
private String cover_1;
private String cover_2;
private String gender;
public String getDefault_images() {
return default_images;
... ... @@ -37,4 +38,12 @@ public class SknImgsResponse {
public void setCover_2(String cover_2) {
this.cover_2 = cover_2;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
}
... ...
... ... @@ -9,7 +9,7 @@ import java.util.Arrays;
import java.util.List;
public class SknImgsResquest implements ICacheRequest {
private static final List<String> includeFields = Arrays.asList(ProductIndexEsField.productSkn,ProductIndexEsField.defaultImages, ProductIndexEsField.sknDefaultImg, ProductIndexEsField.goodsList);
private static final List<String> includeFields = Arrays.asList(ProductIndexEsField.productSkn,ProductIndexEsField.defaultImages, ProductIndexEsField.sknDefaultImg, ProductIndexEsField.goodsList,ProductIndexEsField.gender);
private Integer productSkn;
public SknImgsResquest(Integer productSkn){
... ...