Authored by 胡古飞

SKN销售类目相关代码提交

package com.yoho.search.dal;
import java.util.List;
import com.yoho.search.dal.model.SalesCategory;
public interface SalesCategoryMapper {
int deleteByPrimaryKey(Integer categoryId);
int insert(SalesCategory record);
int insertSelective(SalesCategory record);
SalesCategory selectByPrimaryKey(Integer categoryId);
List<SalesCategory> selectAll();
int updateByPrimaryKeySelective(SalesCategory record);
int updateByPrimaryKey(SalesCategory record);
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.SalesCategoryMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.SalesCategory">
<id column="category_id" property="categoryId" jdbcType="INTEGER" />
<result column="category_name" property="categoryName" jdbcType="VARCHAR" />
<result column="relation_parameter" property="relationParameter" jdbcType="VARCHAR" />
<result column="relation_url" property="relationUrl" jdbcType="VARCHAR" />
<result column="parent_id" property="parentId" jdbcType="INTEGER" />
<result column="order_by" property="orderBy" jdbcType="INTEGER" />
<result column="icon" property="icon" jdbcType="VARCHAR" />
<result column="category_code" property="categoryCode" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="INTEGER" />
<result column="level_number" property="levelNumber" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="app_type" property="appType" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
category_id, category_name, relation_parameter,
relation_url, parent_id, order_by,
icon, category_code, state,
level_number, create_time, app_type
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from sales_category
where category_id = #{categoryId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from
sales_category
where category_id = #{categoryId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.model.SalesCategory">
insert into sales_category
(category_id, category_name,
relation_parameter,
relation_url,
parent_id, order_by,
icon, category_code, state,
level_number,
create_time, app_type
)
values (#{categoryId,jdbcType=INTEGER},
#{categoryName,jdbcType=VARCHAR},
#{relationParameter,jdbcType=VARCHAR},
#{relationUrl,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
#{orderBy,jdbcType=INTEGER},
#{icon,jdbcType=VARCHAR},
#{categoryCode,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
#{levelNumber,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
#{appType,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.model.SalesCategory">
insert into sales_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryId != null">
category_id,
</if>
<if test="categoryName != null">
category_name,
</if>
<if test="relationParameter != null">
relation_parameter,
</if>
<if test="relationUrl != null">
relation_url,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="orderBy != null">
order_by,
</if>
<if test="icon != null">
icon,
</if>
<if test="categoryCode != null">
category_code,
</if>
<if test="state != null">
state,
</if>
<if test="levelNumber != null">
level_number,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="appType != null">
app_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryId != null">
#{categoryId,jdbcType=INTEGER},
</if>
<if test="categoryName != null">
#{categoryName,jdbcType=VARCHAR},
</if>
<if test="relationParameter != null">
#{relationParameter,jdbcType=VARCHAR},
</if>
<if test="relationUrl != null">
#{relationUrl,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=INTEGER},
</if>
<if test="orderBy != null">
#{orderBy,jdbcType=INTEGER},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
<if test="categoryCode != null">
#{categoryCode,jdbcType=VARCHAR},
</if>
<if test="state != null">
#{state,jdbcType=INTEGER},
</if>
<if test="levelNumber != null">
#{levelNumber,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="appType != null">
#{appType,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.model.SalesCategory">
update sales_category
<set>
<if test="categoryName != null">
category_name = #{categoryName,jdbcType=VARCHAR},
</if>
<if test="relationParameter != null">
relation_parameter =
#{relationParameter,jdbcType=VARCHAR},
</if>
<if test="relationUrl != null">
relation_url = #{relationUrl,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=INTEGER},
</if>
<if test="orderBy != null">
order_by = #{orderBy,jdbcType=INTEGER},
</if>
<if test="icon != null">
icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="categoryCode != null">
category_code = #{categoryCode,jdbcType=VARCHAR},
</if>
<if test="state != null">
state = #{state,jdbcType=INTEGER},
</if>
<if test="levelNumber != null">
level_number = #{levelNumber,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="appType != null">
app_type = #{appType,jdbcType=TINYINT},
</if>
</set>
where category_id = #{categoryId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.model.SalesCategory">
update
sales_category
set category_name = #{categoryName,jdbcType=VARCHAR},
relation_parameter = #{relationParameter,jdbcType=VARCHAR},
relation_url = #{relationUrl,jdbcType=VARCHAR},
parent_id =
#{parentId,jdbcType=INTEGER},
order_by = #{orderBy,jdbcType=INTEGER},
icon = #{icon,jdbcType=VARCHAR},
category_code =
#{categoryCode,jdbcType=VARCHAR},
state = #{state,jdbcType=INTEGER},
level_number = #{levelNumber,jdbcType=INTEGER},
create_time =
#{createTime,jdbcType=INTEGER},
app_type = #{appType,jdbcType=TINYINT}
where category_id = #{categoryId,jdbcType=INTEGER}
</update>
<select id="selectAll" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from sales_category
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.search.consumer.index.increment;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.rabbitmq.client.Channel;
import com.yoho.error.event.SearchEvent;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.service.logic.SalesCategoryLogicService;
import com.yoho.search.core.es.utils.IgnoreSomeException;
import com.yoho.search.dal.model.SalesCategory;
@Component
public class SalesCategoryMqListener extends AbstractMqListener implements ChannelAwareMessageListener {
private static final Logger logger = LoggerFactory.getLogger(RobotQuestionMqListener.class);
@Autowired
private IYohoIndexService indexService;
@Autowired
private SalesCategoryLogicService salesCategoryLogicService;
@Override
public void onMessage(Message message, Channel channel) throws Exception {
try {
String messageStr = new String(message.getBody(), "UTF-8");
logger.info("[model=SalesCategoryMqListener] [message={}]", messageStr);
// 如果在重建索引等待
this.waitingRebuildingIndex();
JSONObject json = JSONObject.parseObject(messageStr);
if (ISearchConstants.ACTION_DELETE.equals(json.getString("action"))) {
deleteData(json.getString("data"));
} else if (ISearchConstants.ACTION_UPDATE.equals(json.getString("action"))) {
updateData(json.getObject("data", Map.class));
} else {
updateData(json.getObject("data", Map.class));
}
} catch (Exception e) {
publisher.publishEvent(new SearchEvent(EventReportEnum.ROBOTQUESTION_MQLISTENER_ONMESSAGE.getEventName(), EventReportEnum.ROBOTQUESTION_MQLISTENER_ONMESSAGE
.getFunctionName(), EventReportEnum.ROBOTQUESTION_MQLISTENER_ONMESSAGE.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
Thread.sleep(1000);
throw e;
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public void updateData(final Map data) throws Exception {
SalesCategory salesCategory = new SalesCategory();
salesCategory = (SalesCategory) ConvertUtils.toJavaBean(salesCategory, data);
if (salesCategory == null || salesCategory.getCategoryId() == null) {
return;
}
salesCategoryLogicService.saveOrUpdate(salesCategory);
}
public void deleteData(final String id) throws Exception {
if (StringUtils.isBlank(id)) {
return;
}
salesCategoryLogicService.deleteById(Integer.valueOf(id));
}
}
... ...
... ... @@ -871,6 +871,10 @@
"type": "integer"
}
}
},
"physicalChannels": {
"type": "string",
"analyzer":"comma_spliter"
}
}
}
... ...
... ... @@ -16,17 +16,17 @@ import java.util.Map;
@Component
public class ProductIndexService {
@Autowired
private SpecialDealLogicService specialDealLogicService;
private final Logger logger = LoggerFactory.getLogger(ProductIndexService.class);
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map<String, Object> beanToMap(ProductIndexBO productIndexBO) {
//对productIndexBO做特殊处理
// 对productIndexBO做特殊处理
specialDealLogicService.specialDealProductIndex(productIndexBO);
Map map = new HashMap();
map.put("id", productIndexBO.getId());
map.put("productId", productIndexBO.getProductId());
... ... @@ -160,7 +160,7 @@ public class ProductIndexService {
map.put("countryId", productIndexBO.getCountryId());
map.put("isstudentrebate", productIndexBO.getIsStudentRebate());
map.put("isSeckill", productIndexBO.getIsSeckill());
map.put("storageUpdateTime", productIndexBO.getStorageUpdateTime());
map.put("storageUpdateTime", productIndexBO.getStorageUpdateTime());
String goodsListStr = productIndexBO.getGoodsList();
if (StringUtils.isNotBlank(goodsListStr)) {
... ... @@ -184,9 +184,10 @@ public class ProductIndexService {
map.put("specialSearchField", productIndexBO.getSpecialSearchField());
map.put("isForbiddenSortBrand", productIndexBO.getIsForbiddenSortBrand());
map.put("productFeatureFactor", productIndexBO.getProductFeatureFactor());
map.put("tblCountryId", productIndexBO.getTblCountryId());
map.put("tblCountryName", productIndexBO.getTblCountryName());
map.put("pools", productIndexBO.getPools());
map.put("tblCountryId", productIndexBO.getTblCountryId());
map.put("tblCountryName", productIndexBO.getTblCountryName());
map.put("pools", productIndexBO.getPools());
map.put("physicalChannels", productIndexBO.getPhysicalChannels());
return map;
}
... ...
package com.yoho.search.consumer.service.base;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.search.dal.SalesCategoryMapper;
import com.yoho.search.dal.model.SalesCategory;
@Component
public class SalesCategoryService {
@Autowired
private SalesCategoryMapper salesCategoryMapper;
public SalesCategory selectById(Integer categoryId) {
return salesCategoryMapper.selectByPrimaryKey(categoryId);
}
public int deleteById(Integer categoryId) {
return salesCategoryMapper.deleteByPrimaryKey(categoryId);
}
public int saveOrUpdate(SalesCategory salesCategory) {
if (salesCategory.getCategoryId() == null || salesCategoryMapper.selectByPrimaryKey(salesCategory.getCategoryId()) == null) {
return salesCategoryMapper.insert(salesCategory);
} else {
return salesCategoryMapper.updateByPrimaryKey(salesCategory);
}
}
public List<SalesCategory> selectAll() {
return salesCategoryMapper.selectAll();
}
}
... ...
... ... @@ -80,9 +80,12 @@ public class ProductIBO implements Serializable {
private String specialSearchField;// 特殊搜索字段
private Integer isForbiddenSortBrand;// 是否是品类+品牌的屏蔽字段
// from quanqiugou
private String isGlobal = "N";
// from quanqiugou
private String isGlobal = "N";
// from sales_category
private String physicalChannels;
public Integer getId() {
return id;
... ... @@ -604,4 +607,12 @@ public class ProductIBO implements Serializable {
this.isGlobal = isGlobal;
}
public String getPhysicalChannels() {
return physicalChannels;
}
public void setPhysicalChannels(String physicalChannels) {
this.physicalChannels = physicalChannels;
}
}
\ No newline at end of file
... ...
... ... @@ -13,452 +13,452 @@ import com.alibaba.fastjson.JSONArray;
public class ProductIndexBO extends ProductIBO implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
// from product_price
private BigDecimal specialPrice;
private BigDecimal marketPrice;
private Integer vipDiscountType;
private BigDecimal vipPrice;
private BigDecimal vip1Price;
private BigDecimal vip2Price;
private BigDecimal vip3Price;
private BigDecimal salesPrice;
private BigDecimal studentPrice;
private String isStudentPrice;
private Long promotionDiscountInt;
private BigDecimal promotionDiscount;
private String specialoffer;
private String isDiscount;
// from product_keywords
private String productKeyword;
// from product_colors
private String colorIds;
private String colorNames;
// from product_standards
private String standardIds;
private String standardNames;
private String standardOnlyNames;
// from product_sizes
// private BigDecimal salesNum;
private BigDecimal storageNum;
private String isSoonSoldOut;
private String isSoldOut;
private Integer soldOut;
private String sizeIds;
private String sizeNames;
// from product_price
private BigDecimal specialPrice;
private BigDecimal marketPrice;
private Integer vipDiscountType;
private BigDecimal vipPrice;
private BigDecimal vip1Price;
private BigDecimal vip2Price;
private BigDecimal vip3Price;
private BigDecimal salesPrice;
private BigDecimal studentPrice;
private String isStudentPrice;
private Long promotionDiscountInt;
private BigDecimal promotionDiscount;
private String specialoffer;
private String isDiscount;
// from product_15day_salesnum
private Integer salesNum;
// from product_styles
private String styleIds;
// from product_goods
private String goodsList;
// from product_default_image
private String defaultImages;
// from product_keywords
private String productKeyword;
// from product_activities
private String activities;
// from product_search
private Long sortWeight;
private Long brandWeight;
private Long shopWeight;
// from product_colors
private String colorIds;
private String colorNames;
// from product_activities_link
private String yohoodId;
// from base_pin_ratio
private double basePinRatio;
// from broken_code
private double breakingRate;
// from discount_product_skn
private double discountScore;
private String poolId;
private String isStudentRebate;
// form storage
private Integer storageUpdateTime;
// from tbl_product
private Integer tblCountryId;
private String tblCountryName;
private String productFeatureFactor;
// from product_standards
private String standardIds;
private String standardNames;
private String standardOnlyNames;
// from product_pool_detail
private JSONArray pools;
// get
public BigDecimal getSpecialPrice() {
return specialPrice;
}
// from product_sizes
//private BigDecimal salesNum;
private BigDecimal storageNum;
private String isSoonSoldOut;
private String isSoldOut;
private Integer soldOut;
private String sizeIds;
private String sizeNames;
public BigDecimal getMarketPrice() {
return marketPrice;
}
//from product_15day_salesnum
private Integer salesNum;
public Integer getVipDiscountType() {
return vipDiscountType;
}
// from product_styles
private String styleIds;
public BigDecimal getVipPrice() {
return vipPrice;
}
public BigDecimal getVip1Price() {
return vip1Price;
}
// from product_goods
private String goodsList;
public BigDecimal getVip2Price() {
return vip2Price;
}
// from product_default_image
private String defaultImages;
public BigDecimal getVip3Price() {
return vip3Price;
}
// from product_activities
private String activities;
public BigDecimal getSalesPrice() {
return salesPrice;
}
// from product_search
private Long sortWeight;
private Long brandWeight;
private Long shopWeight;
public Long getPromotionDiscountInt() {
return promotionDiscountInt;
}
// from product_activities_link
private String yohoodId;
public BigDecimal getPromotionDiscount() {
return promotionDiscount;
}
// from base_pin_ratio
private double basePinRatio;
public String getSpecialoffer() {
return specialoffer;
}
// from broken_code
private double breakingRate;
public String getIsDiscount() {
return isDiscount;
}
// from discount_product_skn
private double discountScore;
private String poolId;
public String getProductKeyword() {
return productKeyword;
}
private String isStudentRebate;
public String getColorIds() {
return colorIds;
}
//form storage
private Integer storageUpdateTime;
public String getColorNames() {
return colorNames;
}
//from tbl_product
private Integer tblCountryId;
private String tblCountryName;
public String getStandardIds() {
return standardIds;
}
public String getStandardNames() {
return standardNames;
}
private String productFeatureFactor;
public String getStandardOnlyNames() {
return standardOnlyNames;
}
//
private JSONArray pools;
public Integer getSalesNum() {
return salesNum;
}
// get
public BigDecimal getSpecialPrice() {
return specialPrice;
}
public BigDecimal getStorageNum() {
return storageNum;
}
public BigDecimal getMarketPrice() {
return marketPrice;
}
public String getIsSoonSoldOut() {
return isSoonSoldOut;
}
public Integer getVipDiscountType() {
return vipDiscountType;
}
public String getIsSoldOut() {
return isSoldOut;
}
public BigDecimal getVipPrice() {
return vipPrice;
}
public Integer getSoldOut() {
return soldOut;
}
public BigDecimal getVip1Price() {
return vip1Price;
}
public String getSizeIds() {
return sizeIds;
}
public BigDecimal getVip2Price() {
return vip2Price;
}
public String getStyleIds() {
return styleIds;
}
public String getGoodsList() {
return goodsList;
}
public BigDecimal getVip3Price() {
return vip3Price;
}
public String getDefaultImages() {
return defaultImages;
}
public BigDecimal getSalesPrice() {
return salesPrice;
}
public String getActivities() {
return activities;
}
public Long getPromotionDiscountInt() {
return promotionDiscountInt;
}
public Long getSortWeight() {
return sortWeight;
}
public BigDecimal getPromotionDiscount() {
return promotionDiscount;
}
public Long getBrandWeight() {
return brandWeight;
}
public String getSpecialoffer() {
return specialoffer;
}
public String getYohoodId() {
return yohoodId;
}
public String getIsDiscount() {
return isDiscount;
}
public double getBasePinRatio() {
return basePinRatio;
}
public String getProductKeyword() {
return productKeyword;
}
public double getBreakingRate() {
return breakingRate;
}
public String getColorIds() {
return colorIds;
}
public double getDiscountScore() {
return discountScore;
}
public String getColorNames() {
return colorNames;
}
public String getPoolId() {
return poolId;
}
public String getStandardIds() {
return standardIds;
}
// set
public void setSpecialPrice(BigDecimal specialPrice) {
this.specialPrice = specialPrice;
}
public String getStandardNames() {
return standardNames;
}
public void setMarketPrice(BigDecimal marketPrice) {
this.marketPrice = marketPrice;
}
public String getStandardOnlyNames() {
return standardOnlyNames;
}
public void setVipDiscountType(Integer vipDiscountType) {
this.vipDiscountType = vipDiscountType;
}
public Integer getSalesNum() {
return salesNum;
}
public void setVipPrice(BigDecimal vipPrice) {
this.vipPrice = vipPrice;
}
public BigDecimal getStorageNum() {
return storageNum;
}
public void setVip1Price(BigDecimal vip1Price) {
this.vip1Price = vip1Price;
}
public String getIsSoonSoldOut() {
return isSoonSoldOut;
}
public void setVip2Price(BigDecimal vip2Price) {
this.vip2Price = vip2Price;
}
public String getIsSoldOut() {
return isSoldOut;
}
public void setVip3Price(BigDecimal vip3Price) {
this.vip3Price = vip3Price;
}
public Integer getSoldOut() {
return soldOut;
}
public void setSalesPrice(BigDecimal salesPrice) {
this.salesPrice = salesPrice;
}
public String getSizeIds() {
return sizeIds;
}
public void setPromotionDiscountInt(Long promotionDiscountInt) {
this.promotionDiscountInt = promotionDiscountInt;
}
public String getStyleIds() {
return styleIds;
}
public String getGoodsList() {
return goodsList;
}
public void setPromotionDiscount(BigDecimal promotionDiscount) {
this.promotionDiscount = promotionDiscount;
}
public String getDefaultImages() {
return defaultImages;
}
public void setSpecialoffer(String specialoffer) {
this.specialoffer = specialoffer;
}
public String getActivities() {
return activities;
}
public void setIsDiscount(String isDiscount) {
this.isDiscount = isDiscount;
}
public Long getSortWeight() {
return sortWeight;
}
public void setProductKeyword(String productKeyword) {
this.productKeyword = productKeyword;
}
public Long getBrandWeight() {
return brandWeight;
}
public void setColorIds(String colorIds) {
this.colorIds = colorIds == null ? null : colorIds.trim();
}
public String getYohoodId() {
return yohoodId;
}
public void setColorNames(String colorNames) {
this.colorNames = colorNames == null ? null : colorNames.trim();
}
public double getBasePinRatio() {
return basePinRatio;
}
public void setStandardIds(String standardIds) {
this.standardIds = standardIds == null ? null : standardIds.trim();
}
public double getBreakingRate() {
return breakingRate;
}
public void setStandardNames(String standardNames) {
this.standardNames = standardNames == null ? null : standardNames.trim();
}
public double getDiscountScore() {
return discountScore;
}
public void setStandardOnlyNames(String standardOnlyNames) {
this.standardOnlyNames = standardOnlyNames == null ? null : standardOnlyNames.trim();
}
public String getPoolId() {
return poolId;
}
public void setSalesNum(Integer salesNum) {
this.salesNum = salesNum;
}
// set
public void setSpecialPrice(BigDecimal specialPrice) {
this.specialPrice = specialPrice;
}
public void setStorageNum(BigDecimal storageNum) {
this.storageNum = storageNum;
}
public void setMarketPrice(BigDecimal marketPrice) {
this.marketPrice = marketPrice;
}
public void setIsSoonSoldOut(String isSoonSoldOut) {
this.isSoonSoldOut = isSoonSoldOut;
}
public void setVipDiscountType(Integer vipDiscountType) {
this.vipDiscountType = vipDiscountType;
}
public void setIsSoldOut(String isSoldOut) {
this.isSoldOut = isSoldOut;
}
public void setVipPrice(BigDecimal vipPrice) {
this.vipPrice = vipPrice;
}
public void setSoldOut(Integer soldOut) {
this.soldOut = soldOut;
}
public void setVip1Price(BigDecimal vip1Price) {
this.vip1Price = vip1Price;
}
public void setSizeIds(String sizeIds) {
this.sizeIds = sizeIds == null ? null : sizeIds.trim();
}
public void setVip2Price(BigDecimal vip2Price) {
this.vip2Price = vip2Price;
}
public void setStyleIds(String styleIds) {
this.styleIds = styleIds == null ? null : styleIds.trim();
}
public void setVip3Price(BigDecimal vip3Price) {
this.vip3Price = vip3Price;
}
public void setGoodsList(String goodsList) {
this.goodsList = goodsList == null ? null : goodsList.trim();
}
public void setSalesPrice(BigDecimal salesPrice) {
this.salesPrice = salesPrice;
}
public void setDefaultImages(String defaultImages) {
this.defaultImages = defaultImages == null ? null : defaultImages.trim();
}
public void setPromotionDiscountInt(Long promotionDiscountInt) {
this.promotionDiscountInt = promotionDiscountInt;
}
public void setActivities(String activities) {
this.activities = activities;
}
public void setPromotionDiscount(BigDecimal promotionDiscount) {
this.promotionDiscount = promotionDiscount;
}
public void setSortWeight(Long sortWeight) {
this.sortWeight = sortWeight;
}
public void setSpecialoffer(String specialoffer) {
this.specialoffer = specialoffer;
}
public void setBrandWeight(Long brandWeight) {
this.brandWeight = brandWeight;
}
public void setIsDiscount(String isDiscount) {
this.isDiscount = isDiscount;
}
public void setYohoodId(String yohoodId) {
this.yohoodId = yohoodId;
}
public void setProductKeyword(String productKeyword) {
this.productKeyword = productKeyword;
}
public void setBasePinRatio(double basePinRatio) {
this.basePinRatio = basePinRatio;
}
public void setColorIds(String colorIds) {
this.colorIds = colorIds == null ? null : colorIds.trim();
}
public void setBreakingRate(double breakingRate) {
this.breakingRate = breakingRate;
}
public void setColorNames(String colorNames) {
this.colorNames = colorNames == null ? null : colorNames.trim();
}
public void setDiscountScore(double discountScore) {
this.discountScore = discountScore;
}
public void setStandardIds(String standardIds) {
this.standardIds = standardIds == null ? null : standardIds.trim();
}
public void setPoolId(String poolId) {
this.poolId = poolId;
}
public void setStandardNames(String standardNames) {
this.standardNames = standardNames == null ? null : standardNames.trim();
}
public BigDecimal getStudentPrice() {
return studentPrice;
}
public void setStandardOnlyNames(String standardOnlyNames) {
this.standardOnlyNames = standardOnlyNames == null ? null : standardOnlyNames.trim();
}
public void setStudentPrice(BigDecimal studentPrice) {
this.studentPrice = studentPrice;
}
public void setSalesNum(Integer salesNum) {
this.salesNum = salesNum;
}
public String getSizeNames() {
return sizeNames;
}
public void setStorageNum(BigDecimal storageNum) {
this.storageNum = storageNum;
}
public String getIsStudentPrice() {
return isStudentPrice;
}
public void setIsSoonSoldOut(String isSoonSoldOut) {
this.isSoonSoldOut = isSoonSoldOut;
}
public void setSizeNames(String sizeNames) {
this.sizeNames = sizeNames;
}
public void setIsSoldOut(String isSoldOut) {
this.isSoldOut = isSoldOut;
}
public void setIsStudentPrice(String isStudentPrice) {
this.isStudentPrice = isStudentPrice;
}
public void setSoldOut(Integer soldOut) {
this.soldOut = soldOut;
}
public Long getShopWeight() {
return shopWeight;
}
public void setSizeIds(String sizeIds) {
this.sizeIds = sizeIds == null ? null : sizeIds.trim();
}
public void setStyleIds(String styleIds) {
this.styleIds = styleIds == null ? null : styleIds.trim();
}
public void setGoodsList(String goodsList) {
this.goodsList = goodsList == null ? null : goodsList.trim();
}
public void setShopWeight(Long shopWeight) {
this.shopWeight = shopWeight;
}
public void setDefaultImages(String defaultImages) {
this.defaultImages = defaultImages == null ? null : defaultImages.trim();
}
public String getIsStudentRebate() {
return isStudentRebate;
}
public void setActivities(String activities) {
this.activities = activities;
}
public void setIsStudentRebate(String isStudentRebate) {
this.isStudentRebate = isStudentRebate;
}
public void setSortWeight(Long sortWeight) {
this.sortWeight = sortWeight;
}
public Integer getStorageUpdateTime() {
return storageUpdateTime;
}
public void setStorageUpdateTime(Integer storageUpdateTime) {
this.storageUpdateTime = storageUpdateTime;
}
public String getProductFeatureFactor() {
return productFeatureFactor;
}
public void setProductFeatureFactor(String productFeatureFactor) {
this.productFeatureFactor = productFeatureFactor;
}
public Integer getTblCountryId() {
return tblCountryId;
}
public void setTblCountryId(Integer tblCountryId) {
this.tblCountryId = tblCountryId;
}
public String getTblCountryName() {
return tblCountryName;
}
public void setTblCountryName(String tblCountryName) {
this.tblCountryName = tblCountryName;
}
public JSONArray getPools() {
return pools;
}
public void setPools(JSONArray pools) {
this.pools = pools;
}
public void setBrandWeight(Long brandWeight) {
this.brandWeight = brandWeight;
}
public void setYohoodId(String yohoodId) {
this.yohoodId = yohoodId;
}
public void setBasePinRatio(double basePinRatio) {
this.basePinRatio = basePinRatio;
}
public void setBreakingRate(double breakingRate) {
this.breakingRate = breakingRate;
}
public void setDiscountScore(double discountScore) {
this.discountScore = discountScore;
}
public void setPoolId(String poolId) {
this.poolId = poolId;
}
public BigDecimal getStudentPrice() {
return studentPrice;
}
public void setStudentPrice(BigDecimal studentPrice) {
this.studentPrice = studentPrice;
}
public String getSizeNames() {
return sizeNames;
}
public String getIsStudentPrice() {
return isStudentPrice;
}
public void setSizeNames(String sizeNames) {
this.sizeNames = sizeNames;
}
public void setIsStudentPrice(String isStudentPrice) {
this.isStudentPrice = isStudentPrice;
}
public Long getShopWeight() {
return shopWeight;
}
public void setShopWeight(Long shopWeight) {
this.shopWeight = shopWeight;
}
public String getIsStudentRebate() {
return isStudentRebate;
}
public void setIsStudentRebate(String isStudentRebate) {
this.isStudentRebate = isStudentRebate;
}
public Integer getStorageUpdateTime() {
return storageUpdateTime;
}
public void setStorageUpdateTime(Integer storageUpdateTime) {
this.storageUpdateTime = storageUpdateTime;
}
public String getProductFeatureFactor() {
return productFeatureFactor;
}
public void setProductFeatureFactor(String productFeatureFactor) {
this.productFeatureFactor = productFeatureFactor;
}
public Integer getTblCountryId() {
return tblCountryId;
}
public void setTblCountryId(Integer tblCountryId) {
this.tblCountryId = tblCountryId;
}
public String getTblCountryName() {
return tblCountryName;
}
public void setTblCountryName(String tblCountryName) {
this.tblCountryName = tblCountryName;
}
public JSONArray getPools() {
return pools;
}
public void setPools(JSONArray pools) {
this.pools = pools;
}
}
\ No newline at end of file
... ...
package com.yoho.search.consumer.service.logic;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.search.consumer.service.base.SalesCategoryService;
import com.yoho.search.dal.model.SalesCategory;
@Component
public class SalesCategoryLogicService {
@Autowired
private SalesCategoryService salesCategoryService;
// 一级销售类目和物理小分类之间的关系
private Map<String, Set<Integer>> physicalChannelToSortIds;
public void init() {
Map<String, Set<Integer>> temps = new ConcurrentHashMap<String, Set<Integer>>();
List<SalesCategory> allSalesCategory = salesCategoryService.selectAll();
for (SalesCategory salesCategory : allSalesCategory) {
if (salesCategory.getState() == null || salesCategory.getState() == 0) {
continue;
}
// 获取一级销售类目
String categoryCode = salesCategory.getCategoryCode();
if (StringUtils.isBlank(categoryCode)) {
continue;
}
String[] categorys = categoryCode.split(",", 2);
if (categorys.length != 2) {
continue;
}
String physicalChannel = categorys[0];
// 获取全部物理分类
String relation_parameter = salesCategory.getRelationParameter();
if (StringUtils.isBlank(relation_parameter)) {
continue;
}
String[] smallSortIds = relation_parameter.split(",");
Set<Integer> results = temps.get(physicalChannel);
if (results == null) {
results = new HashSet<Integer>();
temps.put(physicalChannel, results);
}
for (String smallSortId : smallSortIds) {
results.add(Integer.valueOf(smallSortId));
}
}
physicalChannelToSortIds = temps;
}
public SalesCategory selectById(Integer categoryId) {
return salesCategoryService.selectById(categoryId);
}
public int deleteById(Integer categoryId) {
return salesCategoryService.deleteById(categoryId);
}
public int saveOrUpdate(SalesCategory salesCategory) {
return salesCategoryService.saveOrUpdate(salesCategory);
}
/**
* 根据小物理分类获取对应的一级销售类目
*
* @param smallSortId
* @return
*/
public List<String> getPhysicalChannelsBySmallSortId(Integer smallSortId) {
if (smallSortId == null) {
return new ArrayList<String>();
}
if (physicalChannelToSortIds == null || physicalChannelToSortIds.isEmpty()) {
init();
}
List<String> channels = new ArrayList<String>();
for (Map.Entry<String, Set<Integer>> entry : physicalChannelToSortIds.entrySet()) {
if (entry.getValue().contains(smallSortId)) {
channels.add(entry.getKey());
}
}
return channels;
}
}
... ...
package com.yoho.search.consumer.service.logic.tools;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -8,12 +10,15 @@ import com.yoho.search.consumer.service.bo.ProductIBO;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.bo.StorageSkuBO;
import com.yoho.search.consumer.service.logic.ForbidenSortBrandLogicService;
import com.yoho.search.consumer.service.logic.SalesCategoryLogicService;
@Service
public class SpecialDealLogicService {
@Autowired
private ForbidenSortBrandLogicService forbidenSortBrandLogicService;
@Autowired
private SalesCategoryLogicService salesCategoryLogicService;
private String specialDealAgeLevel(String ageLevel) {
if (StringUtils.isBlank(ageLevel)) {
... ... @@ -52,13 +57,15 @@ public class SpecialDealLogicService {
}
private int getIsForbiddenSortBrand(ProductIBO productIBO) {
boolean isForbidenSortBrand = forbidenSortBrandLogicService.isForbiddenSortBrand(productIBO.getMaxSortId(), productIBO.getMiddleSortId(),productIBO.getSmallSortId(), productIBO.getBrandId());
boolean isForbidenSortBrand = forbidenSortBrandLogicService.isForbiddenSortBrand(productIBO.getMaxSortId(), productIBO.getMiddleSortId(), productIBO.getSmallSortId(),
productIBO.getBrandId());
return isForbidenSortBrand ? 1 : 0;
}
/**
* 全量建索引時對PI的某些字段做特殊處
* 建索引时对Pi索引的字段做一些特殊处
*
* @param productIBO
*/
public void specialDealProductI(ProductIBO productIBO) {
// 1、处理ageLevel
... ... @@ -72,22 +79,25 @@ public class SpecialDealLogicService {
// 3、处理isForiddenSortBrand
int isForbiddenSortBrand = this.getIsForbiddenSortBrand(productIBO);
productIBO.setIsForbiddenSortBrand(isForbiddenSortBrand);
}
// 4、处理物理分类对应的销售分类
List<String> physicalChannels = salesCategoryLogicService.getPhysicalChannelsBySmallSortId(productIBO.getSmallSortId());
productIBO.setPhysicalChannels(StringUtils.join(physicalChannels, ","));
}
/**
* 全量建索引時對PI的某些字段做特殊處
* 建索引时对Pi索引的字段做一些特殊处
*
* @param productIndexBO
*/
public void specialDealProductIndex(ProductIndexBO productIndexBO) {
//1、处理其他信息
// 1、处理其他信息
this.specialDealProductI(productIndexBO);
//2、TODO OTHERS
// 2、TODO OTHERS
}
/**
* 全量建索引時對PI的某些字段做特殊處理
*
* 针对StorageSku索引做一些特殊处理
*/
public void specialDealStorageSku(StorageSkuBO storageSkuBO) {
storageSkuBO.setAgeLevel(specialDealAgeLevel(storageSkuBO.getAgeLevel()));
... ...
... ... @@ -81,6 +81,8 @@ public class GeneralDataBuilder {
productIndexBO.setCountryId(p.getCountryId());
// 是否分期全量要增加
productIndexBO.setIsInstalment(p.getIsInstalment());
// 一级销售分类
productIndexBO.setPhysicalChannels(p.getPhysicalChannels());
productIndexBOs.add(productIndexBO);
}
}
... ...
... ... @@ -68,6 +68,7 @@
<rabbit:queue durable="true" exclusive="false" name="data_update_channel_helper" />
<rabbit:queue durable="true" exclusive="false" name="data_update_channel_shops" />
<rabbit:queue durable="true" exclusive="false" name="data_update_channel_shopsbrands" />
<rabbit:queue durable="true" exclusive="false" name="data_update_channel_salescategory" />
<rabbit:queue durable="true" exclusive="false" name="data_update_channel_tblbrand" />
<rabbit:queue durable="true" exclusive="false" name="data_update_channel_tblsite" />
... ... @@ -129,6 +130,7 @@
<rabbit:listener queue-names="data_update_channel_producttiming" ref="productTimingMqListener" />
<rabbit:listener queue-names="data_update_channel_shops" ref="shopsMqListener" />
<rabbit:listener queue-names="data_update_channel_shopsbrands" ref="shopsBrandsMqListener" />
<rabbit:listener queue-names="data_update_channel_salescategory" ref="salescategoryMqListener" />
<rabbit:listener queue-names="data_update_channel_product" ref="productMqListener" />
<rabbit:listener queue-names="data_update_channel_product_0" ref="productMqListener0" />
... ...