Authored by hugufei

Merge branch 'zf_dependency_opt' into zf_dependenct_opt1

# Conflicts:
#	search-consumer-index/src/main/java/com/yoho/search/consumer/index/fullbuild/ProductIndexIndexBuilder.java
#	search-consumer-index/src/main/java/com/yoho/search/consumer/index/fullbuild/StorageSkuIndexBuilder.java
#	search-consumer-service/src/main/java/com/yoho/search/consumer/service/base/ProductIndexService.java
... ... @@ -28,10 +28,6 @@
</dependency>
<dependency>
<groupId>com.yoho.search</groupId>
<artifactId>search-core</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.search</groupId>
<artifactId>search-consumer-dal</artifactId>
</dependency>
<dependency>
... ...
... ... @@ -18,7 +18,7 @@
</dependency>
<dependency>
<groupId>com.yoho.search</groupId>
<artifactId>search-core</artifactId>
<artifactId>search-personalized</artifactId>
</dependency>
</dependencies>
</project>
... ...
package com.yoho.search.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.search.dal.model.ProductI;
public interface ProductIMapper {
ProductI selectByPrimaryKey(Integer id);
public int count();
public List<ProductI> getPageLists(@Param(value = "offset") Integer offset, @Param(value = "pageSize") Integer pageSize);
}
\ No newline at end of file
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductIndex;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ProductIndexMapper {
ProductIndex selectByPrimaryKey(Integer id);
List<ProductIndex> getPageLists(@Param(value = "offset") Integer offset, @Param(value = "pageSize") Integer pageSize);
ProductIndex selectByProductSkn(Integer ProductSkn);
List<Integer> getSknsPage(@Param(value="offset")Integer offset, @Param(value="pageSize")Integer pageSize);
int count();
}
\ 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.ProductIMapper" >
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductI" >
<result column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="shop_id" property="shopId" jdbcType="INTEGER" />
<result column="shelve_time" property="shelveTime" jdbcType="INTEGER" />
<result column="shelve_day" property="shelveDay" jdbcType="VARCHAR" />
<result column="cn_alphabet" property="cnAlphabet" jdbcType="VARCHAR" />
<result column="product_name" property="productName" jdbcType="VARCHAR" />
<result column="style" property="style" jdbcType="VARCHAR" />
<result column="sales_phrase" property="salesPhrase" jdbcType="VARCHAR" />
<result column="max_sort_id" property="maxSortId" jdbcType="SMALLINT" />
<result column="max_sort_name" property="maxSortName" jdbcType="VARCHAR" />
<result column="middle_sort_id" property="middleSortId" jdbcType="SMALLINT" />
<result column="middle_sort_name" property="middleSortName" jdbcType="VARCHAR" />
<result column="small_sort_id" property="smallSortId" jdbcType="SMALLINT" />
<result column="small_sort_name" property="smallSortName" jdbcType="VARCHAR" />
<result column="gender" property="gender" jdbcType="CHAR" />
<result column="gender_s" property="genderS" jdbcType="VARCHAR" />
<result column="brand_id" property="brandId" jdbcType="SMALLINT" />
<result column="is_special" property="isSpecial" jdbcType="CHAR" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="seasons_s" property="seasonsS" jdbcType="INTEGER" />
<result column="isspecial" property="isspecial" jdbcType="INTEGER" />
<result column="is_hot" property="isHot" jdbcType="CHAR" />
<result column="folder_id" property="folderId" jdbcType="INTEGER" />
<result column="ishot" property="ishot" jdbcType="INTEGER" />
<result column="ispromotion" property="ispromotion" jdbcType="SMALLINT" />
<result column="series_id" property="seriesId" jdbcType="INTEGER" />
<result column="is_sales" property="isSales" jdbcType="CHAR" />
<result column="issales" property="issales" jdbcType="INTEGER" />
<result column="is_advance" property="isAdvance" jdbcType="CHAR" />
<result column="isadvance" property="isadvance" jdbcType="INTEGER" />
<result column="is_auditing" property="isAuditing" jdbcType="CHAR" />
<result column="isauditing" property="isauditing" jdbcType="INTEGER" />
<result column="attribute" property="attribute" jdbcType="TINYINT" />
<result column="seasons" property="seasons" jdbcType="CHAR" />
<result column="is_down" property="isDown" jdbcType="CHAR" />
<result column="isdown" property="isdown" jdbcType="INTEGER" />
<result column="isrecommend" property="isrecommend" jdbcType="INTEGER" />
<result column="is_outlets" property="isOutlets" jdbcType="INTEGER" />
<result column="first_shelve_time" property="firstShelveTime" jdbcType="INTEGER" />
<result column="sell_channels" property="sellChannels" jdbcType="CHAR" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="brand_name_cn" property="brandNameCn" jdbcType="VARCHAR" />
<result column="brand_name_en" property="brandNameEn" jdbcType="VARCHAR" />
<result column="brand_keyword" property="brandKeyword" jdbcType="VARCHAR" />
<result column="hot_keyword" property="hotKeyword" jdbcType="VARCHAR" />
<result column="brand_name" property="brandName" jdbcType="VARCHAR" />
<result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />
<result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />
<result column="edit_time" property="editTime" jdbcType="INTEGER" />
<result column="islimited" property="islimited" jdbcType="CHAR" />
<result column="max_sort" property="maxSort" jdbcType="VARCHAR" />
<result column="middle_sort" property="middleSort" jdbcType="VARCHAR" />
<result column="small_sort" property="smallSort" jdbcType="VARCHAR" />
<result column="age_level" property="ageLevel" jdbcType="VARCHAR" />
<result column="app_type" property="appType" jdbcType="INTEGER" />
<result column="is_instalment" property="isInstalment" jdbcType="VARCHAR" />
<result column="is_seckill" property="isSeckill" jdbcType="CHAR" />
<result column="country_id" property="countryId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id, shop_id,shelve_time, shelve_day,
cn_alphabet, product_name, style,sales_phrase, max_sort_id,
max_sort_name,middle_sort_id, middle_sort_name, small_sort_id,small_sort_name,
gender, gender_s, brand_id, is_special, status,
seasons_s, isspecial, is_hot, folder_id, ishot,
ispromotion, series_id, is_sales, issales, is_advance,
isadvance, is_auditing, isauditing, attribute, seasons,
is_down, isdown, isrecommend, is_outlets, first_shelve_time,
sell_channels, product_skn,brand_name_cn, brand_name_en,
brand_keyword, hot_keyword, brand_name,brand_domain,brand_alif,
edit_time,islimited,max_sort,middle_sort,small_sort,
age_level,app_type,is_instalment,is_seckill,country_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" timeout="20000">
select
<include refid="Base_Column_List" />
from product_i
where id = #{id,jdbcType=INTEGER}
</select>
<select id="count" resultType="java.lang.Integer" timeout="20000">
SELECT count(*) FROM product_i
</select>
<select id="getPageLists" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from product_i limit #{offset},#{pageSize}
</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.ProductIndexMapper" >
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductIndex" >
<result column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="shop_id" property="shopId" jdbcType="INTEGER" />
<result column="sales_num" property="salesNum" jdbcType="INTEGER" />
<result column="shelve_time" property="shelveTime" jdbcType="INTEGER" />
<result column="shelve_day" property="shelveDay" jdbcType="VARCHAR" />
<result column="cn_alphabet" property="cnAlphabet" jdbcType="VARCHAR" />
<result column="product_name" property="productName" jdbcType="VARCHAR" />
<result column="brand_name_cn" property="brandNameCn" jdbcType="VARCHAR" />
<result column="brand_name_en" property="brandNameEn" jdbcType="VARCHAR" />
<result column="brand_keyword" property="brandKeyword" jdbcType="VARCHAR" />
<result column="hot_keyword" property="hotKeyword" jdbcType="VARCHAR" />
<result column="brand_name" property="brandName" jdbcType="VARCHAR" />
<result column="style" property="style" jdbcType="VARCHAR" />
<result column="sales_phrase" property="salesPhrase" jdbcType="VARCHAR" />
<result column="max_sort_id" property="maxSortId" jdbcType="SMALLINT" />
<result column="max_sort_name" property="maxSortName" jdbcType="VARCHAR" />
<result column="middle_sort_id" property="middleSortId" jdbcType="SMALLINT" />
<result column="middle_sort_name" property="middleSortName" jdbcType="VARCHAR" />
<result column="small_sort_id" property="smallSortId" jdbcType="SMALLINT" />
<result column="small_sort_name" property="smallSortName" jdbcType="VARCHAR" />
<result column="gender" property="gender" jdbcType="CHAR" />
<result column="brand_id" property="brandId" jdbcType="SMALLINT" />
<result column="is_special" property="isSpecial" jdbcType="CHAR" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="seasons_s" property="seasonsS" jdbcType="INTEGER" />
<result column="isspecial" property="isspecial" jdbcType="INTEGER" />
<result column="is_hot" property="isHot" jdbcType="CHAR" />
<result column="folder_id" property="folderId" jdbcType="INTEGER" />
<result column="ishot" property="ishot" jdbcType="INTEGER" />
<result column="ispromotion" property="ispromotion" jdbcType="SMALLINT" />
<result column="series_id" property="seriesId" jdbcType="INTEGER" />
<result column="is_sales" property="isSales" jdbcType="CHAR" />
<result column="issales" property="issales" jdbcType="INTEGER" />
<result column="is_advance" property="isAdvance" jdbcType="CHAR" />
<result column="isadvance" property="isadvance" jdbcType="INTEGER" />
<result column="is_auditing" property="isAuditing" jdbcType="CHAR" />
<result column="isauditing" property="isauditing" jdbcType="INTEGER" />
<result column="attribute" property="attribute" jdbcType="TINYINT" />
<result column="seasons" property="seasons" jdbcType="CHAR" />
<result column="is_down" property="isDown" jdbcType="CHAR" />
<result column="isdown" property="isdown" jdbcType="INTEGER" />
<result column="isrecommend" property="isrecommend" jdbcType="INTEGER" />
<result column="is_outlets" property="isOutlets" jdbcType="INTEGER" />
<result column="first_shelve_time" property="firstShelveTime" jdbcType="INTEGER" />
<result column="special_price" property="specialPrice" jdbcType="DECIMAL" />
<result column="market_price" property="marketPrice" jdbcType="DECIMAL" />
<result column="vip_discount_type" property="vipDiscountType" jdbcType="TINYINT" />
<result column="vip_price" property="vipPrice" jdbcType="DECIMAL" />
<result column="vip1_price" property="vip1Price" jdbcType="DECIMAL" />
<result column="vip2_price" property="vip2Price" jdbcType="DECIMAL" />
<result column="vip3_price" property="vip3Price" jdbcType="DECIMAL" />
<result column="student_price" property="studentPrice" jdbcType="DECIMAL" />
<result column="is_student_price" property="isStudentPrice" jdbcType="VARCHAR" />
<result column="sales_price" property="salesPrice" jdbcType="DECIMAL" />
<result column="promotion_discount_int" property="promotionDiscountInt" jdbcType="DECIMAL" />
<result column="promotion_discount" property="promotionDiscount" jdbcType="DECIMAL" />
<result column="specialoffer" property="specialoffer" jdbcType="CHAR" />
<result column="sell_channels" property="sellChannels" jdbcType="CHAR" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="storage_num" property="storageNum" jdbcType="DECIMAL" />
<result column="islimited" property="islimited" jdbcType="CHAR" />
<result column="isnew" property="isnew" jdbcType="CHAR" />
<result column="color_ids" property="colorIds" jdbcType="VARCHAR" />
<result column="color_names" property="colorNames" jdbcType="VARCHAR" />
<result column="size_ids" property="sizeIds" jdbcType="VARCHAR" />
<result column="size_names" property="sizeNames" jdbcType="VARCHAR" />
<result column="standard_ids" property="standardIds" jdbcType="VARCHAR" />
<result column="standard_names" property="standardNames" jdbcType="VARCHAR" />
<result column="style_ids" property="styleIds" jdbcType="VARCHAR" />
<result column="default_images" property="defaultImages" jdbcType="VARCHAR" />
<result column="gender_s" property="genderS" jdbcType="VARCHAR" />
<result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />
<result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />
<result column="edit_time" property="editTime" jdbcType="INTEGER" />
<result column="is_soon_sold_out" property="isSoonSoldOut" jdbcType="VARCHAR" />
<result column="is_discount" property="isDiscount" jdbcType="VARCHAR" />
<result column="is_sold_out" property="isSoldOut" jdbcType="VARCHAR" />
<result column="sold_out" property="soldOut" jdbcType="INTEGER" />
<result column="sort_weight" property="sortWeight" jdbcType="INTEGER" />
<result column="yohood_id" property="yohoodId" jdbcType="VARCHAR" />
<result column="standard_only_names" property="standardOnlyNames" jdbcType="VARCHAR" />
<result column="max_sort" property="maxSort" jdbcType="VARCHAR" />
<result column="middle_sort" property="middleSort" jdbcType="VARCHAR" />
<result column="small_sort" property="smallSort" jdbcType="VARCHAR" />
<result column="brand_weight" property="brandWeight" jdbcType="INTEGER" />
<result column="base_pin_ratio" property="basePinRatio" jdbcType="DOUBLE" />
<result column="breaking_rate" property="breakingRate" jdbcType="DOUBLE" />
<result column="discount_score" property="discountScore" jdbcType="DOUBLE" />
<result column="pool_id" property="poolId" jdbcType="VARCHAR" />
<result column="product_keyword" property="productKeyword" jdbcType="VARCHAR" />
<result column="age_level" property="ageLevel" jdbcType="VARCHAR" />
<result column="app_type" property="appType" jdbcType="INTEGER" />
<result column="is_instalment" property="isInstalment" jdbcType="VARCHAR" />
<result column="is_seckill" property="isSeckill" jdbcType="CHAR" />
<result column="country_id" property="countryId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.yoho.search.dal.model.ProductIndex" extends="BaseResultMap" >
<result column="goods_list" property="goodsList" jdbcType="LONGVARCHAR" />
<result column="activities" property="activities" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id,shop_id, sales_num, shelve_time, shelve_day, cn_alphabet, product_name,
brand_name_cn, brand_name_en, brand_keyword, hot_keyword, brand_name, style,
sales_phrase, max_sort_id, middle_sort_id, small_sort_id, gender, brand_id,
is_special, status, seasons_s, isspecial, is_hot, folder_id,
ishot, ispromotion, series_id, is_sales, issales, is_advance,
isadvance, is_auditing, isauditing, attribute, seasons, is_down,
isdown, isrecommend, is_outlets, first_shelve_time, special_price, market_price,
vip_discount_type, vip_price, vip1_price, vip2_price, vip3_price,student_price,is_student_price, sales_price,
promotion_discount_int, promotion_discount, specialoffer, sell_channels, product_skn,
storage_num, islimited, isnew,color_ids,color_names,size_ids,size_names,standard_ids,standard_names,style_ids,default_images,
max_sort_name,middle_sort_name,small_sort_name,gender_s,brand_domain,
brand_alif,goods_list,edit_time,is_soon_sold_out,is_discount,activities,is_sold_out,sold_out,
sort_weight,yohood_id,standard_only_names,max_sort,middle_sort,small_sort,brand_weight,base_pin_ratio,breaking_rate,
discount_score,pool_id,product_keyword,age_level,app_type,is_instalment,is_seckill,country_id
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" timeout="20000">
select
<include refid="Base_Column_List" />
from product_index
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByProductSkn" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" timeout="20000">
select
<include refid="Base_Column_List" />
from product_index
where product_skn = #{product_skn,jdbcType=INTEGER}
</select>
<select id="count" resultType="java.lang.Integer" timeout="20000">
SELECT count(*) FROM product_index
</select>
<select id="getPageLists" resultMap="ResultMapWithBLOBs" timeout="20000">
select
<include refid="Base_Column_List" />
from product_index limit #{offset},#{pageSize}
</select>
<resultMap id="ids" type="Integer">
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
</resultMap>
<select id="getSknsPage" resultMap="ids" timeout="20000">
select product_skn
<include refid="Base_Column_List" />
from product_index
limit #{offset},#{pageSize}
</select>
</mapper>
\ No newline at end of file
... ... @@ -25,7 +25,7 @@
<dependencies>
<dependency>
<groupId>com.yoho.search</groupId>
<artifactId>search-core</artifactId>
<artifactId>search-personalized</artifactId>
<version>${search.core.version}</version>
</dependency>
<dependency>
... ...
package com.yoho.search.consumer.index.fullbuild;
package com.yoho.search.index.fullbuild;
import com.yoho.search.base.utils.ISearchConstans;
import com.yoho.search.consumer.index.common.IIndexBuilder;
import com.yoho.search.consumer.service.base.ProductIndexService;
import com.yoho.search.consumer.service.logic.ProductIndexLogicService;
import com.yoho.search.dal.ProductMapper;
import com.yoho.search.dal.model.ProductIndex;
import com.yoho.search.service.base.ProductIndexService;
import com.yoho.search.service.logic.ProductIndexLogicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -17,44 +14,35 @@ import java.util.Map;
@Component
public class ProductIndexIndexBuilder extends IIndexBuilder {
@Autowired
private ProductIndexService productIndexService;
@Autowired
private ProductIndexLogicService productIndexLogicService;
@Autowired
private ProductMapper productMapper;
@Override
public int getTotalCount() throws Exception {
if (ISearchConstans.BUILD_PRODUCTINDEX_USE_CODE) {
return productMapper.count();
} else {
return productIndexService.count();
}
}
@Override
public List<?> getPageLists(int offset, int limit) throws Exception {
List<ProductIndex> list = new ArrayList<>();
if (ISearchConstans.BUILD_PRODUCTINDEX_USE_CODE) {
list = productIndexLogicService.getProductIndex(offset, limit);
} else {
list = productIndexService.getPageLists(offset, limit);
}
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
if (list != null && list.size() > 0) {
int size = list.size();
for (int i = 0; i < size; i++) {
dataList.add(productIndexService.beanToMap(list.get(i)));
}
}
return dataList;
}
@Override
public String getId(Object object) {
return ((Map<?, ?>) object).get("id").toString();
}
@Autowired
private ProductIndexService productIndexService;
@Autowired
private ProductIndexLogicService productIndexLogicService;
@Autowired
private ProductMapper productMapper;
@Override
public int getTotalCount() throws Exception {
return productMapper.count();
}
@Override
public List<?> getPageLists(int offset, int limit) throws Exception {
List<ProductIndex> list = productIndexLogicService.getProductIndex(offset, limit);
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
if (list != null && list.size() > 0) {
int size = list.size();
for (int i = 0; i < size; i++) {
dataList.add(productIndexService.beanToMap(list.get(i)));
}
}
return dataList;
}
@Override
public String getId(Object object) {
return ((Map<?, ?>) object).get("id").toString();
}
}
... ...
package com.yoho.search.consumer.index.fullbuild;
package com.yoho.search.index.fullbuild;
import com.yoho.search.base.utils.ISearchConstans;
import com.yoho.search.consumer.index.common.IIndexBuilder;
import com.yoho.search.consumer.service.base.Product15DaySalesNumService;
import com.yoho.search.consumer.service.base.StorageSkuService;
import com.yoho.search.consumer.service.logic.SpecialDealLogicService;
import com.yoho.search.consumer.service.logic.StorageSkuLogicService;
import com.yoho.search.dal.StorageMapper;
import com.yoho.search.dal.model.StorageSku;
import com.yoho.search.service.base.Product15DaySalesNumService;
import com.yoho.search.service.base.StorageSkuService;
import com.yoho.search.service.logic.SpecialDealLogicService;
import com.yoho.search.service.logic.StorageSkuLogicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -29,21 +26,13 @@ public class StorageSkuIndexBuilder extends IIndexBuilder {
@Override
public int getTotalCount() throws Exception {
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
return storageMapper.count();
} else {
return storageSkuService.count();
}
}
@Override
public List<?> getPageLists(int offset, int limit) throws Exception {
List<StorageSku> pageLists = new ArrayList<StorageSku>();
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
pageLists = storageSkuLogicService.getStorageSkuIndex(offset, limit);
} else {
pageLists = storageSkuService.selectList(offset, limit);
}
for (StorageSku storageSku : pageLists) {
SpecialDealLogicService.specialDealStorageSku(storageSku);
}
... ...
... ... @@ -96,33 +96,21 @@ public class StorageSkuIndexToolsService implements ApplicationEventPublisherAwa
// 1、根据sku去取数据库对象
List<Integer> productSkus = this.getElementsFromArrayBlockingQueue(productSkuQueue, 200);
if (!productSkus.isEmpty()) {
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkus(productSkus));
} else {
storageSkuList.addAll(storageSkuService.selectListProductSkus(productSkus));
}
storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkus(productSkus));
logger.info("doBulkUpdateStorageSkuIndex[getListBySku], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
}
// 2、根据skc去取数据库对象
List<Integer> goodsIds = this.getElementsFromArrayBlockingQueue(goodsIdQueue, 200);
if (!goodsIds.isEmpty()) {
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkcs(goodsIds));
} else {
storageSkuList.addAll(storageSkuService.selectListByGoodsIds(goodsIds));
}
storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkcs(goodsIds));
logger.info("doBulkUpdateStorageSkuIndex[getListBySkc], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
}
// 3、根据skn去取数据库对象
List<Integer> productIds = this.getElementsFromArrayBlockingQueue(productIdQueue, 200);
if (!productIds.isEmpty()) {
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkns(productIds));
} else {
storageSkuList.addAll(storageSkuService.selectListByProductIds(productIds));
}
logger.info("doBulkUpdateStorageSkuIndex[getListBySkn], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
}
... ...
package com.yoho.search.consumer.service.base;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package com.yoho.search.service.base;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.yoho.search.dal.model.ProductIndex;
import com.yoho.search.service.logic.SpecialDealLogicService;
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 com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.yoho.search.consumer.service.logic.SpecialDealLogicService;
import com.yoho.search.dal.ProductIMapper;
import com.yoho.search.dal.ProductIndexMapper;
import com.yoho.search.dal.model.ProductI;
import com.yoho.search.dal.model.ProductIndex;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
@Component
//@Transactional
public class ProductIndexService {
private final Logger logger = LoggerFactory.getLogger(ProductIndexService.class);
@Autowired
private ProductIndexMapper productIndexMapper;
@Autowired
private ProductIMapper productIMapper;
public ProductIndex getById(Integer id) {
return productIndexMapper.selectByPrimaryKey(id);
}
public ProductIndex getBySkn(Integer skn){
return productIndexMapper.selectByProductSkn(skn);
}
public List<ProductIndex> getPageLists(int start, int size) {
return productIndexMapper.getPageLists(start, size);
}
public int count() {
return productIndexMapper.count();
}
public ProductI getProductById(Integer id) {
return productIMapper.selectByPrimaryKey(id);
}
public List<ProductI> getProductPageLists(int start, int size) {
return productIMapper.getPageLists(start, size);
}
public int countProduct() {
return productIMapper.count();
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map<String, Object> beanToMap(ProductIndex productIndex) {
... ...
package com.yoho.search.consumer.service.base;
import java.util.ArrayList;
import java.util.List;
import com.yoho.search.dal.StorageSkuMapper;
import com.yoho.search.dal.model.StorageSku;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class StorageSkuService {
@Autowired
private StorageSkuMapper storageSkuMapper;
public int count() {
return storageSkuMapper.selectCount();
}
public List<StorageSku> selectList(int offset, int limit) {
return storageSkuMapper.selectList(offset, limit);
}
public StorageSku getById(Integer erpSkuId) {
return storageSkuMapper.selectByPrimaryKey(erpSkuId);
}
public List<StorageSku> selectListProductSkus(List<Integer> productSkus) {
if (productSkus == null || productSkus.isEmpty()) {
return new ArrayList<StorageSku>();
}
return storageSkuMapper.selectListProductSkus(productSkus);
}
public List<StorageSku> selectListByProductId(Integer productId) {
return storageSkuMapper.selectListByProductId(productId);
}
public List<StorageSku> selectListByProductIds(List<Integer> productIds) {
if (productIds == null || productIds.isEmpty()) {
return new ArrayList<StorageSku>();
}
return storageSkuMapper.selectListByProductIds(productIds);
}
public List<StorageSku> selectListByGoodsId(Integer goodsId) {
return storageSkuMapper.selectListByGoodsId(goodsId);
}
public List<StorageSku> selectListByGoodsIds(List<Integer> goodsId) {
if (goodsId == null || goodsId.isEmpty()) {
return new ArrayList<StorageSku>();
}
return storageSkuMapper.selectListByGoodsIds(goodsId);
}
}
... ...