Authored by wangnan9279

有货 批量维护商品封面 fix

package com.yoho.search.service.index;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.DateUtil;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.common.SearchCommonService;
... ... @@ -12,6 +13,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
... ... @@ -38,11 +40,22 @@ public class ProductCoverActivityIndexBaseService {
for (Map<String, Object> productReturnInfo : productReturnInfoList) {
String productSkn = MapUtils.getString(productReturnInfo, "product_skn", "0");
Map<String, Object> productCoverActivityMap = (Map<String, Object>) MapUtils.getObject(coverMap, productSkn, new HashMap<>());
productReturnInfo.put("cover_content_one", MapUtils.getString(productCoverActivityMap, "content_one", ""));
productReturnInfo.put("cover_content_two", MapUtils.getString(productCoverActivityMap, "content_two", ""));
productReturnInfo.put("cover_content_three", MapUtils.getString(productCoverActivityMap, "cover_content_three", ""));
productReturnInfo.put("left_image_url", MapUtils.getString(productCoverActivityMap, "left_image_url", ""));
productReturnInfo.put("bg_image_url", MapUtils.getString(productCoverActivityMap, "bg_image_url", ""));
if (productCoverActivityMap.isEmpty()) {
productReturnInfo.put("cover_info", new ArrayList<>(0));
continue;
}
List<JSONObject> result = new ArrayList<>();
JSONObject coverInfo = new JSONObject();
coverInfo.put("share_content", MapUtils.getString(productCoverActivityMap, "share_content", ""));
coverInfo.put("detail_title", MapUtils.getString(productCoverActivityMap, "detail_title", ""));
coverInfo.put("detail_note", MapUtils.getString(productCoverActivityMap, "detail_note", ""));
coverInfo.put("detail_left_img", MapUtils.getString(productCoverActivityMap, "detail_left_img", ""));
coverInfo.put("detail_bg_img", MapUtils.getString(productCoverActivityMap, "detail_bg_img", ""));
coverInfo.put("list_title", MapUtils.getString(productCoverActivityMap, "list_title", ""));
coverInfo.put("list_note", MapUtils.getString(productCoverActivityMap, "list_note", ""));
coverInfo.put("list_bg_img", MapUtils.getString(productCoverActivityMap, "list_bg_img", ""));
result.add(coverInfo);
productReturnInfo.put("cover_info", result);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
... ... @@ -87,11 +100,14 @@ public class ProductCoverActivityIndexBaseService {
private Map<String, Object> getProductCoverActivity(Map<String, Object> source) {
Map<String, Object> productCoverActivity = new HashMap<String, Object>();
productCoverActivity.put("content_one", MapUtils.getString(source, "contentOne"));
productCoverActivity.put("content_two", MapUtils.getString(source, "contentTwo"));
productCoverActivity.put("cover_content_three", MapUtils.getString(source, "contentThree"));
productCoverActivity.put("left_image_url", MapUtils.getString(source, "leftImageUrl"));
productCoverActivity.put("bg_image_url", MapUtils.getString(source, "bgImageUrl"));
productCoverActivity.put("share_content", MapUtils.getString(source, "shareContent"));
productCoverActivity.put("detail_title", MapUtils.getString(source, "detailTitle"));
productCoverActivity.put("detail_note", MapUtils.getString(source, "detailNote"));
productCoverActivity.put("detail_left_img", MapUtils.getString(source, "detailLeftImg"));
productCoverActivity.put("detail_bg_img", MapUtils.getString(source, "detailBgImg"));
productCoverActivity.put("list_title", MapUtils.getString(source, "listTitle"));
productCoverActivity.put("list_note", MapUtils.getString(source, "listNote"));
productCoverActivity.put("list_bg_img", MapUtils.getString(source, "listBgImg"));
return productCoverActivity;
}
... ...