Authored by hugufei

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

@@ -72,13 +72,14 @@ public class SknImgsCacheBean extends AbstractCacheBean<SknImgsResquest, SknImgs @@ -72,13 +72,14 @@ public class SknImgsCacheBean extends AbstractCacheBean<SknImgsResquest, SknImgs
72 72
73 if (searchResult != null && CollectionUtils.isNotEmpty(searchResult.getResultList())) { 73 if (searchResult != null && CollectionUtils.isNotEmpty(searchResult.getResultList())) {
74 Map<String, SknImgsResponse> defaultImgTempMap = new HashMap<>(); 74 Map<String, SknImgsResponse> defaultImgTempMap = new HashMap<>();
75 - for (Map<String, Object> image : searchResult.getResultList()) { 75 + for (Map<String, Object> product : searchResult.getResultList()) {
76 SknImgsResponse response = new SknImgsResponse(); 76 SknImgsResponse response = new SknImgsResponse();
77 - response.setDefault_images(MapUtils.getString(image, "defaultImages", ""));  
78 - response.setSkn_default_img(MapUtils.getString(image, "sknDefaultImg", ""));  
79 - List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(image.get("goodsList")), new TypeReference<List<JSONObject>>() {}); 77 + response.setDefault_images(MapUtils.getString(product, ProductIndexEsField.defaultImages, ""));
  78 + response.setSkn_default_img(MapUtils.getString(product, ProductIndexEsField.sknDefaultImg, ""));
  79 + response.setGender(MapUtils.getString(product, ProductIndexEsField.gender, ""));
  80 + List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(product.get(ProductIndexEsField.goodsList)), new TypeReference<List<JSONObject>>() {});
80 sknImgHelper.genImage(goodsList, response); 81 sknImgHelper.genImage(goodsList, response);
81 - defaultImgTempMap.put(MapUtils.getString(image,"productSkn",""), response); 82 + defaultImgTempMap.put(MapUtils.getString(product,ProductIndexEsField.productSkn,""), response);
82 } 83 }
83 for (SknImgsRequestResponse requestResponse : missCacheRequests) { 84 for (SknImgsRequestResponse requestResponse : missCacheRequests) {
84 results.put(requestResponse.getRequest(), defaultImgTempMap.get(requestResponse.getRequest().getProductSkn().toString())); 85 results.put(requestResponse.getRequest(), defaultImgTempMap.get(requestResponse.getRequest().getProductSkn().toString()));
@@ -5,6 +5,7 @@ public class SknImgsResponse { @@ -5,6 +5,7 @@ public class SknImgsResponse {
5 private String skn_default_img; 5 private String skn_default_img;
6 private String cover_1; 6 private String cover_1;
7 private String cover_2; 7 private String cover_2;
  8 + private String gender;
8 9
9 public String getDefault_images() { 10 public String getDefault_images() {
10 return default_images; 11 return default_images;
@@ -37,4 +38,12 @@ public class SknImgsResponse { @@ -37,4 +38,12 @@ public class SknImgsResponse {
37 public void setCover_2(String cover_2) { 38 public void setCover_2(String cover_2) {
38 this.cover_2 = cover_2; 39 this.cover_2 = cover_2;
39 } 40 }
  41 +
  42 + public String getGender() {
  43 + return gender;
  44 + }
  45 +
  46 + public void setGender(String gender) {
  47 + this.gender = gender;
  48 + }
40 } 49 }
@@ -9,7 +9,7 @@ import java.util.Arrays; @@ -9,7 +9,7 @@ import java.util.Arrays;
9 import java.util.List; 9 import java.util.List;
10 10
11 public class SknImgsResquest implements ICacheRequest { 11 public class SknImgsResquest implements ICacheRequest {
12 - private static final List<String> includeFields = Arrays.asList(ProductIndexEsField.productSkn,ProductIndexEsField.defaultImages, ProductIndexEsField.sknDefaultImg, ProductIndexEsField.goodsList); 12 + private static final List<String> includeFields = Arrays.asList(ProductIndexEsField.productSkn,ProductIndexEsField.defaultImages, ProductIndexEsField.sknDefaultImg, ProductIndexEsField.goodsList,ProductIndexEsField.gender);
13 private Integer productSkn; 13 private Integer productSkn;
14 14
15 public SknImgsResquest(Integer productSkn){ 15 public SknImgsResquest(Integer productSkn){