Authored by hugufei

索引监听的表明修改

Showing 24 changed files with 165 additions and 481 deletions
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecallConfigBrand;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecallConfigBrandMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecallConfigBrand record);
int insertSelective(CsRecallConfigBrand record);
CsRecallConfigBrand selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecallConfigBrand record);
int updateByPrimaryKey(CsRecallConfigBrand record);
int selectCount();
List<CsRecallConfigBrand> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit);
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecallConfigSknPool;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecallConfigSknPoolMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecallConfigSknPool record);
int insertSelective(CsRecallConfigSknPool record);
CsRecallConfigSknPool selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecallConfigSknPool record);
int updateByPrimaryKey(CsRecallConfigSknPool record);
List<CsRecallConfigSknPool> selectBySkns(@Param(value = "skns") List<Integer> skns);
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecallConfigSortPrice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecallConfigSortPriceMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecallConfigSortPrice record);
int insertSelective(CsRecallConfigSortPrice record);
CsRecallConfigSortPrice selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecallConfigSortPrice record);
int updateByPrimaryKey(CsRecallConfigSortPrice record);
int selectCount();
List<CsRecallConfigSortPrice> selectPageLists(@Param(value = "start") Integer start, @Param(value = "limit") Integer limit);
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecommendBrand;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecommendBrandMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecommendBrand record);
int insertSelective(CsRecommendBrand record);
CsRecommendBrand selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecommendBrand record);
int updateByPrimaryKey(CsRecommendBrand record);
int selectCount();
List<CsRecommendBrand> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit);
}
\ No newline at end of file
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecommendConfig;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecommendConfigMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecommendConfig record);
int insertSelective(CsRecommendConfig record);
CsRecommendConfig selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecommendConfig record);
int updateByPrimaryKey(CsRecommendConfig record);
int selectCount();
List<CsRecommendConfig> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit);
}
\ No newline at end of file
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecommendSknPool;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecommendSknPoolMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecommendSknPool record);
int insertSelective(CsRecommendSknPool record);
CsRecommendSknPool selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecommendSknPool record);
int updateByPrimaryKey(CsRecommendSknPool record);
List<CsRecommendSknPool> selectBySkns(@Param(value = "skns") List<Integer> skns);
}
\ No newline at end of file
package com.yoho.search.dal;
import com.yoho.search.dal.model.CsRecommendSortPrice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CsRecommendSortPriceMapper {
int deleteByPrimaryKey(Integer id);
int insert(CsRecommendSortPrice record);
int insertSelective(CsRecommendSortPrice record);
CsRecommendSortPrice selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CsRecommendSortPrice record);
int updateByPrimaryKey(CsRecommendSortPrice record);
int selectCount();
List<CsRecommendSortPrice> selectPageLists(@Param(value = "start") Integer start, @Param(value = "limit") Integer limit);
}
\ 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.CsRecommendBrandMapper">
<mapper namespace="com.yoho.search.dal.CsRecallConfigBrandMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecommendBrand">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecallConfigBrand">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="brand_id" property="brandId" jdbcType="INTEGER"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
... ... @@ -24,13 +24,13 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecommendBrand">
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecallConfigBrand">
insert into cs_recommend_brand (id, brand_id, update_time)
values (#{id,jdbcType=INTEGER}, #{brandId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecommendBrand">
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecallConfigBrand">
insert into cs_recommend_brand
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
... ... @@ -56,7 +56,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecommendBrand">
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecallConfigBrand">
update cs_recommend_brand
<set>
<if test="brandId != null">
... ... @@ -69,7 +69,7 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecommendBrand">
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecallConfigBrand">
update cs_recommend_brand
set brand_id = #{brandId,jdbcType=INTEGER},update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=INTEGER}
</update>
... ...
<?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.CsRecommendConfigMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecommendConfig">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="config_type" property="configType" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="size" property="size" jdbcType="INTEGER"/>
<result column="size_limit" property="sizeLimit" jdbcType="VARCHAR"/>
<result column="interval" property="interval" jdbcType="INTEGER"/>
<result column="interval_limit" property="intervalLimit" jdbcType="VARCHAR"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, config_type, description, `size`, size_limit, `interval`, interval_limit, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from cs_recommend_config
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from cs_recommend_config
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecommendConfig">
insert into cs_recommend_config (id, config_type, description,
`size`, size_limit, `interval`,
interval_limit, update_time)
values (#{id,jdbcType=INTEGER}, #{configType,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{size,jdbcType=INTEGER}, #{sizeLimit,jdbcType=VARCHAR}, #{interval,jdbcType=INTEGER},
#{intervalLimit,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecommendConfig">
insert into cs_recommend_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="configType != null">
config_type,
</if>
<if test="description != null">
description,
</if>
<if test="size != null">
`size`,
</if>
<if test="sizeLimit != null">
size_limit,
</if>
<if test="interval != null">
`interval`,
</if>
<if test="intervalLimit != null">
interval_limit,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="configType != null">
#{configType,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="size != null">
#{size,jdbcType=INTEGER},
</if>
<if test="sizeLimit != null">
#{sizeLimit,jdbcType=VARCHAR},
</if>
<if test="interval != null">
#{interval,jdbcType=INTEGER},
</if>
<if test="intervalLimit != null">
#{intervalLimit,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecommendConfig">
update cs_recommend_config
<set>
<if test="configType != null">
config_type = #{configType,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="size != null">
`size` = #{size,jdbcType=INTEGER},
</if>
<if test="sizeLimit != null">
size_limit = #{sizeLimit,jdbcType=VARCHAR},
</if>
<if test="interval != null">
`interval` = #{interval,jdbcType=INTEGER},
</if>
<if test="intervalLimit != null">
interval_limit = #{intervalLimit,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecommendConfig">
update cs_recommend_config
set config_type = #{configType,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`size` = #{size,jdbcType=INTEGER},
size_limit = #{sizeLimit,jdbcType=VARCHAR},
`interval` = #{interval,jdbcType=INTEGER},
interval_limit = #{intervalLimit,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectCount" resultType="int">
select count(0) from cs_recommend_config
</select>
<select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
select <include refid="Base_Column_List" /> from cs_recommend_config limit #{start}, #{limit}
</select>
</mapper>
\ 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.CsRecommendSknPoolMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecommendSknPool">
<mapper namespace="com.yoho.search.dal.CsRecallConfigSknPoolMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecallConfigSknPool">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="skn" property="skn" jdbcType="INTEGER"/>
<result column="pool_id" property="poolId" jdbcType="INTEGER"/>
... ... @@ -23,14 +23,14 @@
delete from cs_recommend_skn_pool where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecommendSknPool">
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecallConfigSknPool">
insert into cs_recommend_skn_pool (id, skn, pool_id,
update_time)
values (#{id,jdbcType=INTEGER}, #{skn,jdbcType=INTEGER}, #{poolId,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecommendSknPool">
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecallConfigSknPool">
insert into cs_recommend_skn_pool
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
... ... @@ -62,7 +62,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecommendSknPool">
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecallConfigSknPool">
update cs_recommend_skn_pool
<set>
<if test="skn != null">
... ... @@ -78,7 +78,7 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecommendSknPool">
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecallConfigSknPool">
update cs_recommend_skn_pool
set skn = #{skn,jdbcType=INTEGER},
pool_id = #{poolId,jdbcType=INTEGER},
... ...
<?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.CsRecommendSortPriceMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecommendSortPrice">
<mapper namespace="com.yoho.search.dal.CsRecallConfigSortPriceMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsRecallConfigSortPrice">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="sort_id" property="sortId" jdbcType="INTEGER"/>
<result column="min_price" property="minPrice" jdbcType="DECIMAL"/>
... ... @@ -22,14 +22,14 @@
delete from cs_recommend_sort_price where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecommendSortPrice">
<insert id="insert" parameterType="com.yoho.search.dal.model.CsRecallConfigSortPrice">
insert into cs_recommend_sort_price (id, sort_id, min_price,
max_price, update_time)
values (#{id,jdbcType=INTEGER}, #{sortId,jdbcType=INTEGER}, #{minPrice,jdbcType=DECIMAL},
#{maxPrice,jdbcType=DECIMAL}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecommendSortPrice">
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.CsRecallConfigSortPrice">
insert into cs_recommend_sort_price
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
... ... @@ -67,7 +67,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecommendSortPrice">
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CsRecallConfigSortPrice">
update cs_recommend_sort_price
<set>
<if test="sortId != null">
... ... @@ -86,7 +86,7 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecommendSortPrice">
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsRecallConfigSortPrice">
update cs_recommend_sort_price
set sort_id = #{sortId,jdbcType=INTEGER},
min_price = #{minPrice,jdbcType=DECIMAL},
... ...
package com.yoho.search.consumer.index.fullbuild;
import com.yoho.search.dal.CsRecommendBrandMapper;
import com.yoho.search.dal.model.CsRecommendBrand;
import com.yoho.search.dal.CsRecallConfigBrandMapper;
import com.yoho.search.dal.model.CsRecallConfigBrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class CsRecommendBrandIndexBuilder extends IIndexBuilder {
public class CsRecallConfigBrandIndexBuilder extends IIndexBuilder {
@Autowired
private CsRecommendBrandMapper csRecommendBrandMapper;
private CsRecallConfigBrandMapper csRecallConfigBrandMapper;
@Override
public int getTotalCount() throws Exception {
return csRecommendBrandMapper.selectCount();
return csRecallConfigBrandMapper.selectCount();
}
@Override
public List<?> getPageLists(int offset, int limit) throws Exception {
return csRecommendBrandMapper.selectPageLists(offset, limit);
return csRecallConfigBrandMapper.selectPageLists(offset, limit);
}
@Override
public String getId(Object object) {
return ((CsRecommendBrand) object).getId().toString();
return ((CsRecallConfigBrand) object).getId().toString();
}
}
... ...
package com.yoho.search.consumer.index.fullbuild;
import com.yoho.search.dal.CsRecommendConfigMapper;
import com.yoho.search.dal.model.CsRecommendConfig;
import com.yoho.search.dal.CsRecallConfigSortPriceMapper;
import com.yoho.search.dal.model.CsRecallConfigSortPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class CsRecommendConfigIndexBuilder extends IIndexBuilder {
public class CsRecallConfigSortPriceIndexBuilder extends IIndexBuilder {
@Autowired
private CsRecommendConfigMapper csRecommendConfigMapper;
private CsRecallConfigSortPriceMapper csRecallConfigSortPriceMapper;
@Override
public int getTotalCount() throws Exception {
return csRecommendConfigMapper.selectCount();
return csRecallConfigSortPriceMapper.selectCount();
}
@Override
public List<?> getPageLists(int offset, int limit) throws Exception {
return csRecommendConfigMapper.selectPageLists(offset, limit);
return csRecallConfigSortPriceMapper.selectPageLists(offset,limit);
}
@Override
public String getId(Object object) {
return ((CsRecommendConfig) object).getId().toString();
return ((CsRecallConfigSortPrice)object).getId().toString();
}
}
... ...
package com.yoho.search.consumer.index.fullbuild;
import com.yoho.search.dal.CsRecommendSortPriceMapper;
import com.yoho.search.dal.model.CsRecommendSortPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class CsRecommendSortPriceIndexBuilder extends IIndexBuilder {
@Autowired
private CsRecommendSortPriceMapper csRecommendSortPriceMapper;
@Override
public int getTotalCount() throws Exception {
return csRecommendSortPriceMapper.selectCount();
}
@Override
public List<?> getPageLists(int offset, int limit) throws Exception {
return csRecommendSortPriceMapper.selectPageLists(offset,limit);
}
@Override
public String getId(Object object) {
return ((CsRecommendSortPrice)object).getId().toString();
}
}
... ... @@ -2,48 +2,47 @@ package com.yoho.search.consumer.index.increment.yhb_operations;
import com.alibaba.fastjson.JSONObject;
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.common.IYohoIndexService;
import com.yoho.search.consumer.index.increment.AbstractMqListener;
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.CsRecommendBrandMapper;
import com.yoho.search.dal.model.CsRecommendBrand;
import com.yoho.search.dal.CsRecallConfigBrandMapper;
import com.yoho.search.dal.model.CsRecallConfigBrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_brand")
public class CsRecommendBrandMqListener extends AbstractMqListener {
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recall_config_sort_brand")
public class CsRecallConfigBrandMqListener extends AbstractMqListener {
@Autowired
private CsRecommendBrandMapper csRecommendBrandMapper;
private CsRecallConfigBrandMapper csRecallConfigBrandMapper;
@Autowired
private IYohoIndexService yohoIndexService;
@Override
public String getIndexName() {
return ISearchConstants.INDEX_NAME_CS_RECOMMEND_BRAND;
return ISearchConstants.INDEX_NAME_CS_RECALL_CONFIG_BRAND;
}
@Override
protected void deleteData(String id) throws Exception {
csRecommendBrandMapper.deleteByPrimaryKey(Integer.valueOf(id));
csRecallConfigBrandMapper.deleteByPrimaryKey(Integer.valueOf(id));
yohoIndexService.deleteIndexData(this.getIndexName(),id);
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendBrand csRecommendBrand = ConvertUtils.toJavaObject(CsRecommendBrand.class, data);
if (csRecommendBrand == null || csRecommendBrand.getId() == null) {
CsRecallConfigBrand csRecallConfigBrand = ConvertUtils.toJavaObject(CsRecallConfigBrand.class, data);
if (csRecallConfigBrand == null || csRecallConfigBrand.getId() == null) {
return;
}
if (csRecommendBrandMapper.selectByPrimaryKey(csRecommendBrand.getId()) == null) {
csRecommendBrandMapper.insert(csRecommendBrand);
if (csRecallConfigBrandMapper.selectByPrimaryKey(csRecallConfigBrand.getId()) == null) {
csRecallConfigBrandMapper.insert(csRecallConfigBrand);
} else {
csRecommendBrandMapper.updateByPrimaryKey(csRecommendBrand);
csRecallConfigBrandMapper.updateByPrimaryKey(csRecallConfigBrand);
}
yohoIndexService.updateIndexData(this.getIndexName(),csRecommendBrand.getId().toString(),csRecommendBrand);
yohoIndexService.updateIndexData(this.getIndexName(), csRecallConfigBrand.getId().toString(), csRecallConfigBrand);
}
}
... ...
... ... @@ -7,8 +7,8 @@ import com.yoho.search.consumer.index.increment.AbstractMqListener;
import com.yoho.search.consumer.service.daoService.ProductService;
import com.yoho.search.consumer.service.logicService.CsRecommendSknPoolLogicService;
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.CsRecommendSknPoolMapper;
import com.yoho.search.dal.model.CsRecommendSknPool;
import com.yoho.search.dal.CsRecallConfigSknPoolMapper;
import com.yoho.search.dal.model.CsRecallConfigSknPool;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -18,11 +18,11 @@ import java.util.List;
import java.util.Map;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_skn_pool")
public class CsRecommendSknPoolMqListener extends AbstractMqListener {
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recall_config_skn_pool")
public class CsRecallConfigSknPoolMqListener extends AbstractMqListener {
@Autowired
private CsRecommendSknPoolMapper csRecommendSknPoolMapper;
private CsRecallConfigSknPoolMapper csRecallConfigSknPoolMapper;
@Autowired
private CsRecommendSknPoolLogicService csRecommendSknPoolLogicService;
@Autowired
... ... @@ -31,26 +31,26 @@ public class CsRecommendSknPoolMqListener extends AbstractMqListener {
@Override
protected void deleteData(String id) throws Exception {
Integer idInt = Integer.valueOf(id);
CsRecommendSknPool csRecommendSknPool = csRecommendSknPoolMapper.selectByPrimaryKey(idInt);
if (csRecommendSknPool == null) {
CsRecallConfigSknPool csRecallConfigSknPool = csRecallConfigSknPoolMapper.selectByPrimaryKey(idInt);
if (csRecallConfigSknPool == null) {
return;
}
csRecommendSknPoolMapper.deleteByPrimaryKey(csRecommendSknPool.getId());
this.updateProductIndex(csRecommendSknPool.getSkn());
csRecallConfigSknPoolMapper.deleteByPrimaryKey(csRecallConfigSknPool.getId());
this.updateProductIndex(csRecallConfigSknPool.getSkn());
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendSknPool csRecommendSknPool = ConvertUtils.toJavaObject(CsRecommendSknPool.class, data);
if (csRecommendSknPool == null || csRecommendSknPool.getId() == null) {
CsRecallConfigSknPool csRecallConfigSknPool = ConvertUtils.toJavaObject(CsRecallConfigSknPool.class, data);
if (csRecallConfigSknPool == null || csRecallConfigSknPool.getId() == null) {
return;
}
if (csRecommendSknPoolMapper.selectByPrimaryKey(csRecommendSknPool.getId()) == null) {
csRecommendSknPoolMapper.insert(csRecommendSknPool);
if (csRecallConfigSknPoolMapper.selectByPrimaryKey(csRecallConfigSknPool.getId()) == null) {
csRecallConfigSknPoolMapper.insert(csRecallConfigSknPool);
} else {
csRecommendSknPoolMapper.updateByPrimaryKey(csRecommendSknPool);
csRecallConfigSknPoolMapper.updateByPrimaryKey(csRecallConfigSknPool);
}
this.updateProductIndex(csRecommendSknPool.getSkn());
this.updateProductIndex(csRecallConfigSknPool.getSkn());
}
private void updateProductIndex(Integer skn) {
... ...
... ... @@ -2,47 +2,46 @@ package com.yoho.search.consumer.index.increment.yhb_operations;
import com.alibaba.fastjson.JSONObject;
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.common.IYohoIndexService;
import com.yoho.search.consumer.index.increment.AbstractMqListener;
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.CsRecommendSortPriceMapper;
import com.yoho.search.dal.model.CsRecommendSortPrice;
import com.yoho.search.dal.CsRecallConfigSortPriceMapper;
import com.yoho.search.dal.model.CsRecallConfigSortPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_sort_price")
public class CsRecommendSortPriceMqListener extends AbstractMqListener {
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recall_config_sort_price")
public class CsRecallConfigSortPriceMqListener extends AbstractMqListener {
@Autowired
private CsRecommendSortPriceMapper csRecommendSortPriceMapper;
private CsRecallConfigSortPriceMapper csRecallConfigSortPriceMapper;
@Autowired
private IYohoIndexService yohoIndexService;
@Override
protected String getIndexName() {
return ISearchConstants.INDEX_NAME_CS_RECOMMEND_SORT_PRICE;
return ISearchConstants.INDEX_NAME_CS_RECALL_CONFIG_SORT_PRICE;
}
@Override
protected void deleteData(String id) throws Exception {
csRecommendSortPriceMapper.deleteByPrimaryKey(Integer.valueOf(id));
csRecallConfigSortPriceMapper.deleteByPrimaryKey(Integer.valueOf(id));
yohoIndexService.deleteIndexData(this.getIndexName(),id);
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendSortPrice csRecommendSortPrice = ConvertUtils.toJavaObject(CsRecommendSortPrice.class, data);
if (csRecommendSortPrice == null || csRecommendSortPrice.getId() == null) {
CsRecallConfigSortPrice csRecallConfigSortPrice = ConvertUtils.toJavaObject(CsRecallConfigSortPrice.class, data);
if (csRecallConfigSortPrice == null || csRecallConfigSortPrice.getId() == null) {
return;
}
if (csRecommendSortPriceMapper.selectByPrimaryKey(csRecommendSortPrice.getId()) == null) {
csRecommendSortPriceMapper.insert(csRecommendSortPrice);
if (csRecallConfigSortPriceMapper.selectByPrimaryKey(csRecallConfigSortPrice.getId()) == null) {
csRecallConfigSortPriceMapper.insert(csRecallConfigSortPrice);
} else {
csRecommendSortPriceMapper.updateByPrimaryKey(csRecommendSortPrice);
csRecallConfigSortPriceMapper.updateByPrimaryKey(csRecallConfigSortPrice);
}
yohoIndexService.updateIndexData(this.getIndexName(),csRecommendSortPrice.getId().toString(),csRecommendSortPrice);
yohoIndexService.updateIndexData(this.getIndexName(), csRecallConfigSortPrice.getId().toString(), csRecallConfigSortPrice);
}
}
... ...
package com.yoho.search.consumer.index.increment.yhb_operations;
import com.alibaba.fastjson.JSONObject;
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.common.IYohoIndexService;
import com.yoho.search.consumer.index.increment.AbstractMqListener;
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.CsRecommendConfigMapper;
import com.yoho.search.dal.model.CsRecommendConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_config")
public class CsRecommendConfigMqListener extends AbstractMqListener {
@Autowired
private CsRecommendConfigMapper csRecommendConfigMapper;
@Autowired
private IYohoIndexService yohoIndexService;
@Override
public String getIndexName() {
return ISearchConstants.INDEX_NAME_CS_RECOMMEND_CONFIG;
}
@Override
protected void deleteData(String id) throws Exception {
csRecommendConfigMapper.deleteByPrimaryKey(Integer.valueOf(id));
yohoIndexService.deleteIndexData(this.getIndexName(),id);
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendConfig csRecommendConfig = ConvertUtils.toJavaObject(CsRecommendConfig.class, data);
if (csRecommendConfig == null || csRecommendConfig.getId() == null) {
return;
}
if (csRecommendConfigMapper.selectByPrimaryKey(csRecommendConfig.getId()) == null) {
csRecommendConfigMapper.insert(csRecommendConfig);
} else {
csRecommendConfigMapper.updateByPrimaryKey(csRecommendConfig);
}
yohoIndexService.updateIndexData(this.getIndexName(),csRecommendConfig.getId().toString(),csRecommendConfig);
}
}
{
"csrecommendconfig": {
"_all":{
"enabled":false
},
"_source":{
"enabled":true
},
"properties": {
"id": {
"type": "integer"
},
"configType": {
"type": "keyword"
},
"description": {
"type": "keyword"
},
"size": {
"type": "integer"
},
"sizeLimit": {
"type": "keyword"
},
"interval": {
"type": "integer"
},
"intervalLimit": {
"type": "keyword"
},
"updateTime": {
"type": "date"
}
}
}
}
\ No newline at end of file
package com.yoho.search.consumer.service.logicService;
import com.yoho.search.dal.CsRecommendSknPoolMapper;
import com.yoho.search.dal.model.CsRecommendSknPool;
import com.yoho.search.dal.CsRecallConfigSknPoolMapper;
import com.yoho.search.dal.model.CsRecallConfigSknPool;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -16,7 +16,7 @@ public class CsRecommendSknPoolLogicService {
private static final Logger logger = LoggerFactory.getLogger(CsRecommendSknPoolLogicService.class.getSimpleName());
@Autowired
private CsRecommendSknPoolMapper csRecommendSknPoolMapper;
private CsRecallConfigSknPoolMapper csRecallConfigSknPoolMapper;
public List<Integer> queryRecommendSknPools(Integer skn) {
Map<Integer, List<Integer>> result = this.queryRecommendSknPools(Arrays.asList(skn));
... ... @@ -28,7 +28,7 @@ public class CsRecommendSknPoolLogicService {
if (CollectionUtils.isEmpty(skns)) {
return new HashMap<>();
}
List<CsRecommendSknPool> recommendSknPoolList = csRecommendSknPoolMapper.selectBySkns(skns);
List<CsRecallConfigSknPool> recommendSknPoolList = csRecallConfigSknPoolMapper.selectBySkns(skns);
if (CollectionUtils.isEmpty(recommendSknPoolList)) {
return new HashMap<>();
}
... ...
... ... @@ -627,43 +627,29 @@
</index>
<index>
<name>csrecommendconfig</name>
<name>csrecallconfigbrand</name>
<properties>
<property key="number_of_shards" value="1"/>
<property key="number_of_replicas" value="auto"/>
<property key="refresh_interval" value="10s"/>
<property key="translog.flush_threshold_size" value="100mb"/>
</properties>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecommendConfigIndexBuilder</builderClass>
<mappingFile>esmapping/csrecommendconfig.json</mappingFile>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecallConfigBrandIndexBuilder</builderClass>
<mappingFile>esmapping/csrecallconfigbrand.json</mappingFile>
<analysisFile>analysis/default.yml</analysisFile>
<rebuildPageSize>2500</rebuildPageSize>
</index>
<index>
<name>csrecommendbrand</name>
<name>csrecallconfigsortprice</name>
<properties>
<property key="number_of_shards" value="1"/>
<property key="number_of_replicas" value="auto"/>
<property key="refresh_interval" value="10s"/>
<property key="translog.flush_threshold_size" value="100mb"/>
</properties>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecommendBrandIndexBuilder</builderClass>
<mappingFile>esmapping/csrecommendbrand.json</mappingFile>
<analysisFile>analysis/default.yml</analysisFile>
<rebuildPageSize>2500</rebuildPageSize>
</index>
<index>
<name>csrecommendsortprice</name>
<properties>
<property key="number_of_shards" value="1"/>
<property key="number_of_replicas" value="auto"/>
<property key="refresh_interval" value="10s"/>
<property key="translog.flush_threshold_size" value="100mb"/>
</properties>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecommendSortPriceIndexBuilder</builderClass>
<mappingFile>esmapping/csrecommendsortprice.json</mappingFile>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecallConfigSortPriceIndexBuilder</builderClass>
<mappingFile>esmapping/csrecallconfigsortprice.json</mappingFile>
<analysisFile>analysis/default.yml</analysisFile>
<rebuildPageSize>2500</rebuildPageSize>
</index>
... ...
... ... @@ -630,43 +630,29 @@
</index>
<index>
<name>csrecommendconfig</name>
<name>csrecallconfigbrand</name>
<properties>
<property key="number_of_shards" value="1"/>
<property key="number_of_replicas" value="auto"/>
<property key="refresh_interval" value="${search.index.refresh_interval}"/>
<property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/>
</properties>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecommendConfigIndexBuilder</builderClass>
<mappingFile>esmapping/csrecommendconfig.json</mappingFile>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecallConfigBrandIndexBuilder</builderClass>
<mappingFile>esmapping/csrecallconfigbrand.json</mappingFile>
<analysisFile>analysis/default.yml</analysisFile>
<rebuildPageSize>2500</rebuildPageSize>
</index>
<index>
<name>csrecommendbrand</name>
<name>csrecallconfigsortprice</name>
<properties>
<property key="number_of_shards" value="1"/>
<property key="number_of_replicas" value="auto"/>
<property key="refresh_interval" value="${search.index.refresh_interval}"/>
<property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/>
</properties>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecommendBrandIndexBuilder</builderClass>
<mappingFile>esmapping/csrecommendbrand.json</mappingFile>
<analysisFile>analysis/default.yml</analysisFile>
<rebuildPageSize>2500</rebuildPageSize>
</index>
<index>
<name>csrecommendsortprice</name>
<properties>
<property key="number_of_shards" value="1"/>
<property key="number_of_replicas" value="auto"/>
<property key="refresh_interval" value="${search.index.refresh_interval}"/>
<property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/>
</properties>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecommendSortPriceIndexBuilder</builderClass>
<mappingFile>esmapping/csrecommendsortprice.json</mappingFile>
<builderClass>com.yoho.search.consumer.index.fullbuild.CsRecallConfigSortPriceIndexBuilder</builderClass>
<mappingFile>esmapping/csrecallconfigsortprice.json</mappingFile>
<analysisFile>analysis/default.yml</analysisFile>
<rebuildPageSize>2500</rebuildPageSize>
</index>
... ...