|
|
package com.yoho.search.consumer.service.logic.productIndex;
|
|
|
|
|
|
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 java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
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.bo.ProductPriceBO;
|
|
|
|
|
|
@Component
|
|
|
public class ProductIndexBOToMapService {
|
...
|
...
|
@@ -23,6 +24,7 @@ public class ProductIndexBOToMapService { |
|
|
Map map = new HashMap(500);
|
|
|
map.put(ProductIndexEsField.id, productIndexBO.getId());
|
|
|
map.put(ProductIndexEsField.productId, productIndexBO.getProductId());
|
|
|
map.put(ProductIndexEsField.productSkn, productIndexBO.getProductSkn());
|
|
|
map.put(ProductIndexEsField.shopId, productIndexBO.getShopId());
|
|
|
map.put(ProductIndexEsField.salesNum, productIndexBO.getSalesNum());
|
|
|
map.put(ProductIndexEsField.shelveTime, productIndexBO.getShelveTime());
|
...
|
...
|
@@ -68,50 +70,43 @@ public class ProductIndexBOToMapService { |
|
|
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(ProductIndexEsField.specialPrice, productIndexBO.getSpecialPrice().doubleValue());
|
|
|
}
|
|
|
temp = productIndexBO.getMarketPrice();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.marketPrice, productIndexBO.getMarketPrice().doubleValue());
|
|
|
}
|
|
|
temp = productIndexBO.getVipPrice();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.vipPrice, productIndexBO.getVipPrice().doubleValue());
|
|
|
}
|
|
|
temp = productIndexBO.getVip1Price();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.vip1Price, productIndexBO.getVip1Price().doubleValue());
|
|
|
}
|
|
|
temp = productIndexBO.getVip2Price();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.vip2Price, productIndexBO.getVip2Price().doubleValue());
|
|
|
}
|
|
|
temp = productIndexBO.getVip3Price();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.vip3Price, productIndexBO.getVip3Price().doubleValue());
|
|
|
}
|
|
|
temp = productIndexBO.getSalesPrice();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.salesPrice, productIndexBO.getSalesPrice().doubleValue());
|
|
|
}
|
|
|
map.put(ProductIndexEsField.vipLevels, productIndexBO.getVipLevels());
|
|
|
temp = productIndexBO.getPromotionDiscount();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.promotionDiscount, productIndexBO.getPromotionDiscount().doubleValue());
|
|
|
|
|
|
/*---------------处理价格相关属性 begin-------------------------------*/
|
|
|
ProductPriceBO productPriceBO = productIndexBO.getProductPriceBO();
|
|
|
if (productPriceBO == null) {
|
|
|
productPriceBO = new ProductPriceBO(productIndexBO.getProductSkn());
|
|
|
}
|
|
|
map.put(ProductIndexEsField.vipDiscountType, productIndexBO.getVipDiscountType());
|
|
|
map.put(ProductIndexEsField.promotionDiscountInt, productIndexBO.getPromotionDiscountInt());
|
|
|
map.put(ProductIndexEsField.specialoffer, productIndexBO.getSpecialoffer());
|
|
|
map.put(ProductIndexEsField.marketPrice, productPriceBO.getMarketPrice());
|
|
|
map.put(ProductIndexEsField.salesPrice, productPriceBO.getSalesPrice());
|
|
|
map.put(ProductIndexEsField.vipDiscountType, productPriceBO.getVipDiscountType());
|
|
|
map.put(ProductIndexEsField.vipDiscount, productPriceBO.getVipDiscount());
|
|
|
map.put(ProductIndexEsField.vipPrice, productPriceBO.getVipPrice());
|
|
|
|
|
|
map.put(ProductIndexEsField.vip1Price, productPriceBO.getVip1Price());
|
|
|
map.put(ProductIndexEsField.vip2Price, productPriceBO.getVip2Price());
|
|
|
map.put(ProductIndexEsField.vip3Price, productPriceBO.getVip3Price());
|
|
|
map.put(ProductIndexEsField.vipLevels, productPriceBO.getVipLevels());
|
|
|
map.put(ProductIndexEsField.studentPrice, productPriceBO.getStudentPrice());
|
|
|
|
|
|
map.put(ProductIndexEsField.isStudentPrice, productPriceBO.getIsStudentPrice());
|
|
|
map.put(ProductIndexEsField.isstudentrebate, productPriceBO.getIsstudentrebate());
|
|
|
map.put(ProductIndexEsField.priceUpdateTime, productPriceBO.getPriceUpdateTime());
|
|
|
map.put(ProductIndexEsField.lastReducePriceTime, productPriceBO.getLastReducePriceTime());
|
|
|
map.put(ProductIndexEsField.isDiscount, productPriceBO.getIsDiscount());
|
|
|
|
|
|
map.put(ProductIndexEsField.promotionDiscount, productPriceBO.getPromotionDiscount());
|
|
|
map.put(ProductIndexEsField.promotionDiscountInt, productPriceBO.getPromotionDiscountInt());
|
|
|
map.put(ProductIndexEsField.specialoffer, productPriceBO.getSpecialoffer());
|
|
|
map.put(ProductIndexEsField.specialSearchFieldPrice, productPriceBO.getSpecialSearchFieldPrice());
|
|
|
map.put(ProductIndexEsField.isLatestReducePrice, productPriceBO.getIsLatestReducePrice());
|
|
|
|
|
|
map.put(ProductIndexEsField.isnew, productPriceBO.getIsnew());
|
|
|
/*---------------处理价格相关属性end-------------------------------*/
|
|
|
|
|
|
map.put(ProductIndexEsField.sellChannels, productIndexBO.getSellChannels());
|
|
|
map.put(ProductIndexEsField.productSkn, productIndexBO.getProductSkn());
|
|
|
temp = productIndexBO.getStorageNum();
|
|
|
if (temp != null) {
|
|
|
map.put(ProductIndexEsField.storageNum, productIndexBO.getStorageNum().longValue());
|
|
|
}
|
|
|
map.put(ProductIndexEsField.storageNum, productIndexBO.getStorageNum() == null ? 0 : productIndexBO.getStorageNum().longValue());
|
|
|
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());
|
...
|
...
|
@@ -129,7 +124,6 @@ public class ProductIndexBOToMapService { |
|
|
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());
|
...
|
...
|
@@ -148,11 +142,9 @@ public class ProductIndexBOToMapService { |
|
|
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());
|
|
|
|
...
|
...
|
@@ -196,28 +188,24 @@ public class ProductIndexBOToMapService { |
|
|
map.put(ProductIndexEsField.bundleType, productIndexBO.getBundleType());
|
|
|
map.put(ProductIndexEsField.heatValue, productIndexBO.getHeatValue());
|
|
|
map.put(ProductIndexEsField.skuIds, productIndexBO.getSkuIds());
|
|
|
|
|
|
map.put(ProductIndexEsField.priceUpdateTime, productIndexBO.getPriceUpdateTime());
|
|
|
|
|
|
map.put(ProductIndexEsField.activeValue, productIndexBO.getActiveValue());
|
|
|
map.put(ProductIndexEsField.transferValue, productIndexBO.getTransferValue());
|
|
|
map.put(ProductIndexEsField.giveValue, productIndexBO.getGiveValue());
|
|
|
map.put(ProductIndexEsField.profitValue, productIndexBO.getProfitValue());
|
|
|
map.put(ProductIndexEsField.promotionTitle, productIndexBO.getPromotionTitles());
|
|
|
map.put(ProductIndexEsField.lastReducePriceTime, productIndexBO.getLastReducePriceTime());
|
|
|
|
|
|
map.put(ProductIndexEsField.couponLimitStatus, productIndexBO.getCouponLimitStatus());
|
|
|
map.put(ProductIndexEsField.isFobbiden, productIndexBO.getIsFobbiden());
|
|
|
map.put(ProductIndexEsField.storeShowStatus, productIndexBO.getStoreShowStatus());
|
|
|
map.put(ProductIndexEsField.toAddScore, productIndexBO.getToAddScore());
|
|
|
|
|
|
map.put(ProductIndexEsField.specialSearchField, productIndexBO.getSpecialSearchField());
|
|
|
map.put(ProductIndexEsField.specialSearchFieldPrice, productIndexBO.getSpecialSearchFieldPrice());
|
|
|
map.put(ProductIndexEsField.specialSearchFieldVideo, productIndexBO.getSpecialSearchFieldVideo());
|
|
|
|
|
|
map.put(ProductIndexEsField.ctrValue, productIndexBO.getCtrValue());
|
|
|
map.put(ProductIndexEsField.flowType, productIndexBO.getFlowType());
|
|
|
map.put(ProductIndexEsField.sevendayMoney,productIndexBO.getSevendayMoney());
|
|
|
|
|
|
map.put("isLatestReducePrice", productIndexBO.getIsLatestReducePrice());
|
|
|
map.put(ProductIndexEsField.ctrValue, productIndexBO.getCtrValue());
|
|
|
map.put(ProductIndexEsField.flowType, productIndexBO.getFlowType());
|
|
|
map.put(ProductIndexEsField.sevendayMoney, productIndexBO.getSevendayMoney());
|
|
|
|
|
|
return map;
|
|
|
}
|
...
|
...
|
|