Authored by 胡古飞

fix ProductIndexService with ProductIndexEsField

... ... @@ -19,6 +19,10 @@
"bundleType": {
"type": "long"
},
"yohoodId": {
"type": "string",
"analyzer": "comma_spliter"
},
"salesNum": {
"type": "long",
"doc_values": true,
... ... @@ -241,6 +245,9 @@
"type": "string",
"index": "not_analyzed"
},
"isauditing": {
"type": "long",
},
"brandAlif": {
"type": "string",
"index": "not_analyzed",
... ... @@ -599,6 +606,12 @@
"format": "doc_values"
}
},
"issales": {
"type": "long"
},
"seriesId": {
"type": "long"
},
"isHot": {
"type": "string",
"index": "not_analyzed",
... ...
package com.yoho.search.consumer.service.base;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService;
@Component
public class ProductIndexService {
... ... @@ -27,147 +29,146 @@ public class ProductIndexService {
// 对productIndexBO做特殊处理
specialDealLogicService.specialDealProductIndex(productIndexBO);
Map map = new HashMap();
map.put("id", productIndexBO.getId());
map.put("productId", productIndexBO.getProductId());
map.put("shopId", productIndexBO.getShopId());
map.put(ProductIndexEsField.id, productIndexBO.getId());
map.put(ProductIndexEsField.productId, productIndexBO.getProductId());
map.put(ProductIndexEsField.shopId, productIndexBO.getShopId());
if (productIndexBO.getSalesNum() != null) {
map.put("salesNum", productIndexBO.getSalesNum());
map.put(ProductIndexEsField.salesNum, productIndexBO.getSalesNum());
}
map.put("shelveTime", productIndexBO.getShelveTime());
map.put("shelveDay", productIndexBO.getShelveDay());
map.put("cnAlphabet", productIndexBO.getCnAlphabet());
map.put("productName", productIndexBO.getProductName());
map.put("brandNameCn", productIndexBO.getBrandNameCn());
map.put("brandNameEn", productIndexBO.getBrandNameEn());
map.put("brandKeyword", productIndexBO.getBrandKeyword());
map.put("hotKeyword", productIndexBO.getHotKeyword());
map.put("brandName", productIndexBO.getBrandName());
map.put("style", productIndexBO.getStyle());
map.put("salesPhrase", productIndexBO.getSalesPhrase());
map.put("maxSortId", productIndexBO.getMaxSortId());
map.put("maxSortName", productIndexBO.getMaxSortName());
map.put("middleSortId", productIndexBO.getMiddleSortId());
map.put("middleSortName", productIndexBO.getMiddleSortName());
map.put("smallSortId", productIndexBO.getSmallSortId());
map.put("smallSortName", productIndexBO.getSmallSortName());
map.put("gender", productIndexBO.getGender());
map.put("brandId", productIndexBO.getBrandId());
map.put("isSpecial", productIndexBO.getIsSpecial());
map.put("status", productIndexBO.getStatus());
map.put("seasonsS", productIndexBO.getSeasonsS());
map.put("isspecial", productIndexBO.getIsspecial());
map.put("isHot", productIndexBO.getIsHot());
map.put("folderId", productIndexBO.getFolderId());
map.put("ishot", productIndexBO.getIshot());
map.put("ispromotion", productIndexBO.getIspromotion());
map.put("seriesId", productIndexBO.getSeriesId());
map.put("isSales", productIndexBO.getIsSales());
map.put("issales", productIndexBO.getIssales());
map.put("isAdvance", productIndexBO.getIsAdvance());
map.put("isadvance", productIndexBO.getIsadvance());
map.put("isDepositAdvance", productIndexBO.getIsDepositAdvance());
map.put("isLimitbuy", productIndexBO.getIsLimitbuy());
map.put("isAuditing", productIndexBO.getIsAuditing());
map.put("isauditing", productIndexBO.getIsauditing());
map.put("attribute", productIndexBO.getAttribute());
map.put("seasons", productIndexBO.getSeasons());
map.put("isDown", productIndexBO.getIsDown());
map.put("isdown", productIndexBO.getIsdown());
map.put("isrecommend", productIndexBO.getIsrecommend());
map.put("isOutlets", productIndexBO.getIsOutlets());
map.put("firstShelveTime", productIndexBO.getFirstShelveTime());
map.put(ProductIndexEsField.shelveTime, productIndexBO.getShelveTime());
map.put(ProductIndexEsField.shelveDay, productIndexBO.getShelveDay());
map.put(ProductIndexEsField.cnAlphabet, productIndexBO.getCnAlphabet());
map.put(ProductIndexEsField.productName, productIndexBO.getProductName());
map.put(ProductIndexEsField.brandNameCn, productIndexBO.getBrandNameCn());
map.put(ProductIndexEsField.brandNameEn, productIndexBO.getBrandNameEn());
map.put(ProductIndexEsField.brandKeyword, productIndexBO.getBrandKeyword());
map.put(ProductIndexEsField.hotKeyword, productIndexBO.getHotKeyword());
map.put(ProductIndexEsField.brandName, productIndexBO.getBrandName());
map.put(ProductIndexEsField.style, productIndexBO.getStyle());
map.put(ProductIndexEsField.salesPhrase, productIndexBO.getSalesPhrase());
map.put(ProductIndexEsField.maxSortId, productIndexBO.getMaxSortId());
map.put(ProductIndexEsField.maxSortName, productIndexBO.getMaxSortName());
map.put(ProductIndexEsField.middleSortId, productIndexBO.getMiddleSortId());
map.put(ProductIndexEsField.middleSortName, productIndexBO.getMiddleSortName());
map.put(ProductIndexEsField.smallSortId, productIndexBO.getSmallSortId());
map.put(ProductIndexEsField.smallSortName, productIndexBO.getSmallSortName());
map.put(ProductIndexEsField.gender, productIndexBO.getGender());
map.put(ProductIndexEsField.brandId, productIndexBO.getBrandId());
map.put(ProductIndexEsField.isSpecial, productIndexBO.getIsSpecial());
map.put(ProductIndexEsField.status, productIndexBO.getStatus());
map.put(ProductIndexEsField.seasonsS, productIndexBO.getSeasonsS());
map.put(ProductIndexEsField.isspecial, productIndexBO.getIsspecial());
map.put(ProductIndexEsField.isHot, productIndexBO.getIsHot());
map.put(ProductIndexEsField.folderId, productIndexBO.getFolderId());
map.put(ProductIndexEsField.ishot, productIndexBO.getIshot());
map.put(ProductIndexEsField.ispromotion, productIndexBO.getIspromotion());
map.put(ProductIndexEsField.seriesId, productIndexBO.getSeriesId());
map.put(ProductIndexEsField.isSales, productIndexBO.getIsSales());
map.put(ProductIndexEsField.issales, productIndexBO.getIssales());
map.put(ProductIndexEsField.isAdvance, productIndexBO.getIsAdvance());
map.put(ProductIndexEsField.isadvance, productIndexBO.getIsadvance());
map.put(ProductIndexEsField.isDepositAdvance, productIndexBO.getIsDepositAdvance());
map.put(ProductIndexEsField.isLimitbuy, productIndexBO.getIsLimitbuy());
map.put(ProductIndexEsField.isAuditing, productIndexBO.getIsAuditing());
map.put(ProductIndexEsField.isauditing, productIndexBO.getIsauditing());
map.put(ProductIndexEsField.attribute, productIndexBO.getAttribute());
map.put(ProductIndexEsField.seasons, productIndexBO.getSeasons());
map.put(ProductIndexEsField.isDown, productIndexBO.getIsDown());
map.put(ProductIndexEsField.isdown, productIndexBO.getIsdown());
map.put(ProductIndexEsField.isrecommend, productIndexBO.getIsrecommend());
map.put(ProductIndexEsField.isOutlets, productIndexBO.getIsOutlets());
map.put(ProductIndexEsField.firstShelveTime, productIndexBO.getFirstShelveTime());
BigDecimal temp = productIndexBO.getSpecialPrice();
if (temp != null) {
map.put("specialPrice", productIndexBO.getSpecialPrice().doubleValue());
map.put(ProductIndexEsField.specialPrice, productIndexBO.getSpecialPrice().doubleValue());
}
temp = productIndexBO.getMarketPrice();
if (temp != null) {
map.put("marketPrice", productIndexBO.getMarketPrice().doubleValue());
map.put(ProductIndexEsField.marketPrice, productIndexBO.getMarketPrice().doubleValue());
}
temp = productIndexBO.getVipPrice();
if (temp != null) {
map.put("vipPrice", productIndexBO.getVipPrice().doubleValue());
map.put(ProductIndexEsField.vipPrice, productIndexBO.getVipPrice().doubleValue());
}
temp = productIndexBO.getVip1Price();
if (temp != null) {
map.put("vip1Price", productIndexBO.getVip1Price().doubleValue());
map.put(ProductIndexEsField.vip1Price, productIndexBO.getVip1Price().doubleValue());
}
temp = productIndexBO.getVip2Price();
if (temp != null) {
map.put("vip2Price", productIndexBO.getVip2Price().doubleValue());
map.put(ProductIndexEsField.vip2Price, productIndexBO.getVip2Price().doubleValue());
}
temp = productIndexBO.getVip3Price();
if (temp != null) {
map.put("vip3Price", productIndexBO.getVip3Price().doubleValue());
map.put(ProductIndexEsField.vip3Price, productIndexBO.getVip3Price().doubleValue());
}
temp = productIndexBO.getSalesPrice();
if (temp != null) {
map.put("salesPrice", productIndexBO.getSalesPrice().doubleValue());
map.put(ProductIndexEsField.salesPrice, productIndexBO.getSalesPrice().doubleValue());
}
map.put("vipLevels", productIndexBO.getVipLevels());
map.put(ProductIndexEsField.vipLevels, productIndexBO.getVipLevels());
temp = productIndexBO.getPromotionDiscount();
if (temp != null) {
map.put("promotionDiscount", productIndexBO.getPromotionDiscount().doubleValue());
map.put(ProductIndexEsField.promotionDiscount, productIndexBO.getPromotionDiscount().doubleValue());
}
map.put("vipDiscountType", productIndexBO.getVipDiscountType());
map.put("promotionDiscountInt", productIndexBO.getPromotionDiscountInt());
map.put("specialoffer", productIndexBO.getSpecialoffer());
map.put("sellChannels", productIndexBO.getSellChannels());
map.put("productSkn", productIndexBO.getProductSkn());
map.put(ProductIndexEsField.vipDiscountType, productIndexBO.getVipDiscountType());
map.put(ProductIndexEsField.promotionDiscountInt, productIndexBO.getPromotionDiscountInt());
map.put(ProductIndexEsField.specialoffer, productIndexBO.getSpecialoffer());
map.put(ProductIndexEsField.sellChannels, productIndexBO.getSellChannels());
map.put(ProductIndexEsField.productSkn, productIndexBO.getProductSkn());
temp = productIndexBO.getStorageNum();
if (temp != null) {
map.put("storageNum", productIndexBO.getStorageNum().longValue());
map.put(ProductIndexEsField.storageNum, productIndexBO.getStorageNum().longValue());
}
map.put("islimited", productIndexBO.getIslimited());
map.put("isnew", productIndexBO.getIsnew());
map.put("colorIds", productIndexBO.getColorIds());
map.put("colorNames", productIndexBO.getColorNames());
map.put("sizeIds", productIndexBO.getSizeIds());
map.put("sizeNames", productIndexBO.getSizeNames());
map.put("standardIds", productIndexBO.getStandardIds());
map.put("standardNames", productIndexBO.getStandardNames());
map.put("styleIds", productIndexBO.getStyleIds());
map.put("defaultImages", productIndexBO.getDefaultImages());
map.put("genderS", productIndexBO.getGenderS());
map.put("brandDomain", productIndexBO.getBrandDomain());
map.put("brandAlif", productIndexBO.getBrandAlif());
map.put("editTime", productIndexBO.getEditTime());
map.put("isSoonSoldOut", productIndexBO.getIsSoonSoldOut());
map.put("isSoldOut", productIndexBO.getIsSoldOut());
map.put("soldOut", productIndexBO.getSoldOut());
map.put("isDiscount", productIndexBO.getIsDiscount());
map.put("sortWeight", productIndexBO.getSortWeight());
map.put("brandWeight", productIndexBO.getBrandWeight());
map.put("shopWeight", productIndexBO.getShopWeight());
map.put("yohoodId", productIndexBO.getYohoodId());
map.put("standardOnlyNames", productIndexBO.getStandardOnlyNames());
map.put("maxSort", productIndexBO.getMaxSort());
map.put("middleSort", productIndexBO.getMiddleSort());
map.put("smallSort", productIndexBO.getSmallSort());
map.put("basePinRatio", productIndexBO.getBasePinRatio());
map.put("breakingRate", productIndexBO.getBreakingRate());
map.put("discountScore", productIndexBO.getDiscountScore());
map.put("poolId", productIndexBO.getPoolId());
map.put("productKeyword", productIndexBO.getProductKeyword());
map.put("ageLevel", productIndexBO.getAgeLevel());
map.put("isGlobal", productIndexBO.getIsGlobal());
map.put("appType", productIndexBO.getAppType());
map.put(ProductIndexEsField.islimited, productIndexBO.getIslimited());
map.put(ProductIndexEsField.isnew, productIndexBO.getIsnew());
map.put(ProductIndexEsField.colorIds, productIndexBO.getColorIds());
map.put(ProductIndexEsField.colorNames, productIndexBO.getColorNames());
map.put(ProductIndexEsField.sizeIds, productIndexBO.getSizeIds());
map.put(ProductIndexEsField.sizeNames, productIndexBO.getSizeNames());
map.put(ProductIndexEsField.standardIds, productIndexBO.getStandardIds());
map.put(ProductIndexEsField.standardNames, productIndexBO.getStandardNames());
map.put(ProductIndexEsField.styleIds, productIndexBO.getStyleIds());
map.put(ProductIndexEsField.defaultImages, productIndexBO.getDefaultImages());
map.put(ProductIndexEsField.genderS, productIndexBO.getGenderS());
map.put(ProductIndexEsField.brandDomain, productIndexBO.getBrandDomain());
map.put(ProductIndexEsField.brandAlif, productIndexBO.getBrandAlif());
map.put(ProductIndexEsField.editTime, productIndexBO.getEditTime());
map.put(ProductIndexEsField.isSoonSoldOut, productIndexBO.getIsSoonSoldOut());
map.put(ProductIndexEsField.isSoldOut, productIndexBO.getIsSoldOut());
map.put(ProductIndexEsField.soldOut, productIndexBO.getSoldOut());
map.put(ProductIndexEsField.isDiscount, productIndexBO.getIsDiscount());
map.put(ProductIndexEsField.sortWeight, productIndexBO.getSortWeight());
map.put(ProductIndexEsField.brandWeight, productIndexBO.getBrandWeight());
map.put(ProductIndexEsField.shopWeight, productIndexBO.getShopWeight());
map.put(ProductIndexEsField.yohoodId, productIndexBO.getYohoodId());
map.put(ProductIndexEsField.standardOnlyNames, productIndexBO.getStandardOnlyNames());
map.put(ProductIndexEsField.maxSort, productIndexBO.getMaxSort());
map.put(ProductIndexEsField.middleSort, productIndexBO.getMiddleSort());
map.put(ProductIndexEsField.smallSort, productIndexBO.getSmallSort());
map.put(ProductIndexEsField.basePinRatio, productIndexBO.getBasePinRatio());
map.put("studentPrice", productIndexBO.getStudentPrice());
map.put("isStudentPrice", productIndexBO.getIsStudentPrice());
map.put("isInstalment", productIndexBO.getIsInstalment());
map.put("countryId", productIndexBO.getCountryId());
map.put("isstudentrebate", productIndexBO.getIsStudentRebate());
map.put("isSeckill", productIndexBO.getIsSeckill());
map.put("storageUpdateTime", productIndexBO.getStorageUpdateTime());
map.put(ProductIndexEsField.breakingRate, productIndexBO.getBreakingRate());
map.put(ProductIndexEsField.discountScore, productIndexBO.getDiscountScore());
map.put(ProductIndexEsField.poolId, productIndexBO.getPoolId());
map.put(ProductIndexEsField.productKeyword, productIndexBO.getProductKeyword());
map.put(ProductIndexEsField.ageLevel, productIndexBO.getAgeLevel());
map.put(ProductIndexEsField.isGlobal, productIndexBO.getIsGlobal());
map.put(ProductIndexEsField.appType, productIndexBO.getAppType());
map.put(ProductIndexEsField.studentPrice, productIndexBO.getStudentPrice());
map.put(ProductIndexEsField.isStudentPrice, productIndexBO.getIsStudentPrice());
map.put(ProductIndexEsField.isInstalment, productIndexBO.getIsInstalment());
map.put(ProductIndexEsField.countryId, productIndexBO.getCountryId());
map.put(ProductIndexEsField.isstudentrebate, productIndexBO.getIsStudentRebate());
map.put(ProductIndexEsField.isSeckill, productIndexBO.getIsSeckill());
map.put(ProductIndexEsField.storageUpdateTime, productIndexBO.getStorageUpdateTime());
String goodsListStr = productIndexBO.getGoodsList();
if (StringUtils.isNotBlank(goodsListStr)) {
try {
JSONArray jsonArray = JSONArray.parseArray(goodsListStr);
map.put("goodsList", jsonArray);
map.put(ProductIndexEsField.goodsList, jsonArray);
} catch (JSONException e) {
logger.error("[id={}} [goodsListStr={}] [e={}]", productIndexBO.getId(), goodsListStr, e.getMessage());
}
... ... @@ -177,29 +178,29 @@ public class ProductIndexService {
if (StringUtils.isNotBlank(activitiesStr)) {
try {
JSONArray jsonArray = JSONArray.parseArray(activitiesStr);
map.put("activities", jsonArray);
map.put(ProductIndexEsField.activities, jsonArray);
} catch (JSONException e) {
logger.error("[id={}} [activitiesStr={}] [e={}]", productIndexBO.getId(), activitiesStr, e.getMessage());
}
}
map.put("specialSearchField", productIndexBO.getSpecialSearchField());
map.put("isForbiddenSortBrand", productIndexBO.getIsForbiddenSortBrand());
map.put("forbiddenPageIds", productIndexBO.getForbiddenPageIds());
map.put("productFeatureFactor", productIndexBO.getProductFeatureFactor());
map.put("tblCountryId", productIndexBO.getTblCountryId());
map.put("tblCountryName", productIndexBO.getTblCountryName());
map.put("pools", productIndexBO.getPools());
map.put("marketPhrase", productIndexBO.getMarketPhrase());
map.put("physicalChannels", productIndexBO.getPhysicalChannels());
map.put("sknDefaultImg", productIndexBO.getSknDefaultImg());
map.put("phrase", productIndexBO.getPhrase());
map.put("isPhraseExist", productIndexBO.getIsPhraseExist());
map.put("pattern", productIndexBO.getPattern());
map.put("attributeNames", productIndexBO.getAttributeNames());
map.put("shopName", productIndexBO.getShopName());
map.put("shopDomain", productIndexBO.getShopDomain());
map.put("productAttrField", productIndexBO.getProductAttrField());
map.put("bundleType", productIndexBO.getBundleType());
map.put(ProductIndexEsField.specialSearchField, productIndexBO.getSpecialSearchField());
map.put(ProductIndexEsField.isForbiddenSortBrand, productIndexBO.getIsForbiddenSortBrand());
map.put(ProductIndexEsField.forbiddenPageIds, productIndexBO.getForbiddenPageIds());
map.put(ProductIndexEsField.productFeatureFactor, productIndexBO.getProductFeatureFactor());
map.put(ProductIndexEsField.tblCountryId, productIndexBO.getTblCountryId());
map.put(ProductIndexEsField.tblCountryName, productIndexBO.getTblCountryName());
map.put(ProductIndexEsField.pools, productIndexBO.getPools());
map.put(ProductIndexEsField.marketPhrase, productIndexBO.getMarketPhrase());
map.put(ProductIndexEsField.physicalChannels, productIndexBO.getPhysicalChannels());
map.put(ProductIndexEsField.sknDefaultImg, productIndexBO.getSknDefaultImg());
map.put(ProductIndexEsField.phrase, productIndexBO.getPhrase());
map.put(ProductIndexEsField.isPhraseExist, productIndexBO.getIsPhraseExist());
map.put(ProductIndexEsField.pattern, productIndexBO.getPattern());
map.put(ProductIndexEsField.attributeNames, productIndexBO.getAttributeNames());
map.put(ProductIndexEsField.shopName, productIndexBO.getShopName());
map.put(ProductIndexEsField.shopDomain, productIndexBO.getShopDomain());
map.put(ProductIndexEsField.productAttrField, productIndexBO.getProductAttrField());
map.put(ProductIndexEsField.bundleType, productIndexBO.getBundleType());
return map;
}
... ...