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 @@ @@ -28,10 +28,6 @@
28 </dependency> 28 </dependency>
29 <dependency> 29 <dependency>
30 <groupId>com.yoho.search</groupId> 30 <groupId>com.yoho.search</groupId>
31 - <artifactId>search-core</artifactId>  
32 - </dependency>  
33 - <dependency>  
34 - <groupId>com.yoho.search</groupId>  
35 <artifactId>search-consumer-dal</artifactId> 31 <artifactId>search-consumer-dal</artifactId>
36 </dependency> 32 </dependency>
37 <dependency> 33 <dependency>
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 </dependency> 18 </dependency>
19 <dependency> 19 <dependency>
20 <groupId>com.yoho.search</groupId> 20 <groupId>com.yoho.search</groupId>
21 - <artifactId>search-core</artifactId> 21 + <artifactId>search-personalized</artifactId>
22 </dependency> 22 </dependency>
23 </dependencies> 23 </dependencies>
24 </project> 24 </project>
1 -package com.yoho.search.dal;  
2 -  
3 -import java.util.List;  
4 -  
5 -import org.apache.ibatis.annotations.Param;  
6 -  
7 -import com.yoho.search.dal.model.ProductI;  
8 -  
9 -public interface ProductIMapper {  
10 -  
11 - ProductI selectByPrimaryKey(Integer id);  
12 -  
13 - public int count();  
14 -  
15 - public List<ProductI> getPageLists(@Param(value = "offset") Integer offset, @Param(value = "pageSize") Integer pageSize);  
16 -  
17 -}  
1 -package com.yoho.search.dal;  
2 -  
3 -import com.yoho.search.dal.model.ProductIndex;  
4 -import org.apache.ibatis.annotations.Param;  
5 -  
6 -import java.util.List;  
7 -  
8 -public interface ProductIndexMapper {  
9 -  
10 - ProductIndex selectByPrimaryKey(Integer id);  
11 -  
12 - List<ProductIndex> getPageLists(@Param(value = "offset") Integer offset, @Param(value = "pageSize") Integer pageSize);  
13 -  
14 - ProductIndex selectByProductSkn(Integer ProductSkn);  
15 -  
16 - List<Integer> getSknsPage(@Param(value="offset")Integer offset, @Param(value="pageSize")Integer pageSize);  
17 -  
18 - int count();  
19 -}  
1 -<?xml version="1.0" encoding="UTF-8" ?>  
2 -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >  
3 -<mapper namespace="com.yoho.search.dal.ProductIMapper" >  
4 - <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductI" >  
5 - <result column="id" property="id" jdbcType="INTEGER" />  
6 - <result column="product_id" property="productId" jdbcType="INTEGER" />  
7 - <result column="shop_id" property="shopId" jdbcType="INTEGER" />  
8 - <result column="shelve_time" property="shelveTime" jdbcType="INTEGER" />  
9 - <result column="shelve_day" property="shelveDay" jdbcType="VARCHAR" />  
10 - <result column="cn_alphabet" property="cnAlphabet" jdbcType="VARCHAR" />  
11 - <result column="product_name" property="productName" jdbcType="VARCHAR" />  
12 - <result column="style" property="style" jdbcType="VARCHAR" />  
13 - <result column="sales_phrase" property="salesPhrase" jdbcType="VARCHAR" />  
14 - <result column="max_sort_id" property="maxSortId" jdbcType="SMALLINT" />  
15 - <result column="max_sort_name" property="maxSortName" jdbcType="VARCHAR" />  
16 - <result column="middle_sort_id" property="middleSortId" jdbcType="SMALLINT" />  
17 - <result column="middle_sort_name" property="middleSortName" jdbcType="VARCHAR" />  
18 - <result column="small_sort_id" property="smallSortId" jdbcType="SMALLINT" />  
19 - <result column="small_sort_name" property="smallSortName" jdbcType="VARCHAR" />  
20 - <result column="gender" property="gender" jdbcType="CHAR" />  
21 - <result column="gender_s" property="genderS" jdbcType="VARCHAR" />  
22 - <result column="brand_id" property="brandId" jdbcType="SMALLINT" />  
23 - <result column="is_special" property="isSpecial" jdbcType="CHAR" />  
24 - <result column="status" property="status" jdbcType="TINYINT" />  
25 - <result column="seasons_s" property="seasonsS" jdbcType="INTEGER" />  
26 - <result column="isspecial" property="isspecial" jdbcType="INTEGER" />  
27 - <result column="is_hot" property="isHot" jdbcType="CHAR" />  
28 - <result column="folder_id" property="folderId" jdbcType="INTEGER" />  
29 - <result column="ishot" property="ishot" jdbcType="INTEGER" />  
30 - <result column="ispromotion" property="ispromotion" jdbcType="SMALLINT" />  
31 - <result column="series_id" property="seriesId" jdbcType="INTEGER" />  
32 - <result column="is_sales" property="isSales" jdbcType="CHAR" />  
33 - <result column="issales" property="issales" jdbcType="INTEGER" />  
34 - <result column="is_advance" property="isAdvance" jdbcType="CHAR" />  
35 - <result column="isadvance" property="isadvance" jdbcType="INTEGER" />  
36 - <result column="is_auditing" property="isAuditing" jdbcType="CHAR" />  
37 - <result column="isauditing" property="isauditing" jdbcType="INTEGER" />  
38 - <result column="attribute" property="attribute" jdbcType="TINYINT" />  
39 - <result column="seasons" property="seasons" jdbcType="CHAR" />  
40 - <result column="is_down" property="isDown" jdbcType="CHAR" />  
41 - <result column="isdown" property="isdown" jdbcType="INTEGER" />  
42 - <result column="isrecommend" property="isrecommend" jdbcType="INTEGER" />  
43 - <result column="is_outlets" property="isOutlets" jdbcType="INTEGER" />  
44 - <result column="first_shelve_time" property="firstShelveTime" jdbcType="INTEGER" />  
45 - <result column="sell_channels" property="sellChannels" jdbcType="CHAR" />  
46 - <result column="product_skn" property="productSkn" jdbcType="INTEGER" />  
47 - <result column="brand_name_cn" property="brandNameCn" jdbcType="VARCHAR" />  
48 - <result column="brand_name_en" property="brandNameEn" jdbcType="VARCHAR" />  
49 - <result column="brand_keyword" property="brandKeyword" jdbcType="VARCHAR" />  
50 - <result column="hot_keyword" property="hotKeyword" jdbcType="VARCHAR" />  
51 - <result column="brand_name" property="brandName" jdbcType="VARCHAR" />  
52 - <result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />  
53 - <result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />  
54 - <result column="edit_time" property="editTime" jdbcType="INTEGER" />  
55 - <result column="islimited" property="islimited" jdbcType="CHAR" />  
56 - <result column="max_sort" property="maxSort" jdbcType="VARCHAR" />  
57 - <result column="middle_sort" property="middleSort" jdbcType="VARCHAR" />  
58 - <result column="small_sort" property="smallSort" jdbcType="VARCHAR" />  
59 - <result column="age_level" property="ageLevel" jdbcType="VARCHAR" />  
60 - <result column="app_type" property="appType" jdbcType="INTEGER" />  
61 - <result column="is_instalment" property="isInstalment" jdbcType="VARCHAR" />  
62 - <result column="is_seckill" property="isSeckill" jdbcType="CHAR" />  
63 - <result column="country_id" property="countryId" jdbcType="INTEGER" />  
64 - </resultMap>  
65 -  
66 - <sql id="Base_Column_List" >  
67 - id, product_id, shop_id,shelve_time, shelve_day,  
68 - cn_alphabet, product_name, style,sales_phrase, max_sort_id,  
69 - max_sort_name,middle_sort_id, middle_sort_name, small_sort_id,small_sort_name,  
70 - gender, gender_s, brand_id, is_special, status,  
71 - seasons_s, isspecial, is_hot, folder_id, ishot,  
72 - ispromotion, series_id, is_sales, issales, is_advance,  
73 - isadvance, is_auditing, isauditing, attribute, seasons,  
74 - is_down, isdown, isrecommend, is_outlets, first_shelve_time,  
75 - sell_channels, product_skn,brand_name_cn, brand_name_en,  
76 - brand_keyword, hot_keyword, brand_name,brand_domain,brand_alif,  
77 - edit_time,islimited,max_sort,middle_sort,small_sort,  
78 - age_level,app_type,is_instalment,is_seckill,country_id  
79 - </sql>  
80 -  
81 - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" timeout="20000">  
82 - select  
83 - <include refid="Base_Column_List" />  
84 - from product_i  
85 - where id = #{id,jdbcType=INTEGER}  
86 - </select>  
87 - <select id="count" resultType="java.lang.Integer" timeout="20000">  
88 - SELECT count(*) FROM product_i  
89 - </select>  
90 - <select id="getPageLists" resultMap="BaseResultMap" timeout="20000">  
91 - select  
92 - <include refid="Base_Column_List" />  
93 - from product_i limit #{offset},#{pageSize}  
94 - </select>  
95 -</mapper>  
1 -<?xml version="1.0" encoding="UTF-8" ?>  
2 -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >  
3 -<mapper namespace="com.yoho.search.dal.ProductIndexMapper" >  
4 - <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductIndex" >  
5 - <result column="id" property="id" jdbcType="INTEGER" />  
6 - <result column="product_id" property="productId" jdbcType="INTEGER" />  
7 - <result column="shop_id" property="shopId" jdbcType="INTEGER" />  
8 - <result column="sales_num" property="salesNum" jdbcType="INTEGER" />  
9 - <result column="shelve_time" property="shelveTime" jdbcType="INTEGER" />  
10 - <result column="shelve_day" property="shelveDay" jdbcType="VARCHAR" />  
11 - <result column="cn_alphabet" property="cnAlphabet" jdbcType="VARCHAR" />  
12 - <result column="product_name" property="productName" jdbcType="VARCHAR" />  
13 - <result column="brand_name_cn" property="brandNameCn" jdbcType="VARCHAR" />  
14 - <result column="brand_name_en" property="brandNameEn" jdbcType="VARCHAR" />  
15 - <result column="brand_keyword" property="brandKeyword" jdbcType="VARCHAR" />  
16 - <result column="hot_keyword" property="hotKeyword" jdbcType="VARCHAR" />  
17 - <result column="brand_name" property="brandName" jdbcType="VARCHAR" />  
18 - <result column="style" property="style" jdbcType="VARCHAR" />  
19 - <result column="sales_phrase" property="salesPhrase" jdbcType="VARCHAR" />  
20 - <result column="max_sort_id" property="maxSortId" jdbcType="SMALLINT" />  
21 - <result column="max_sort_name" property="maxSortName" jdbcType="VARCHAR" />  
22 - <result column="middle_sort_id" property="middleSortId" jdbcType="SMALLINT" />  
23 - <result column="middle_sort_name" property="middleSortName" jdbcType="VARCHAR" />  
24 - <result column="small_sort_id" property="smallSortId" jdbcType="SMALLINT" />  
25 - <result column="small_sort_name" property="smallSortName" jdbcType="VARCHAR" />  
26 - <result column="gender" property="gender" jdbcType="CHAR" />  
27 - <result column="brand_id" property="brandId" jdbcType="SMALLINT" />  
28 - <result column="is_special" property="isSpecial" jdbcType="CHAR" />  
29 - <result column="status" property="status" jdbcType="TINYINT" />  
30 - <result column="seasons_s" property="seasonsS" jdbcType="INTEGER" />  
31 - <result column="isspecial" property="isspecial" jdbcType="INTEGER" />  
32 - <result column="is_hot" property="isHot" jdbcType="CHAR" />  
33 - <result column="folder_id" property="folderId" jdbcType="INTEGER" />  
34 - <result column="ishot" property="ishot" jdbcType="INTEGER" />  
35 - <result column="ispromotion" property="ispromotion" jdbcType="SMALLINT" />  
36 - <result column="series_id" property="seriesId" jdbcType="INTEGER" />  
37 - <result column="is_sales" property="isSales" jdbcType="CHAR" />  
38 - <result column="issales" property="issales" jdbcType="INTEGER" />  
39 - <result column="is_advance" property="isAdvance" jdbcType="CHAR" />  
40 - <result column="isadvance" property="isadvance" jdbcType="INTEGER" />  
41 - <result column="is_auditing" property="isAuditing" jdbcType="CHAR" />  
42 - <result column="isauditing" property="isauditing" jdbcType="INTEGER" />  
43 - <result column="attribute" property="attribute" jdbcType="TINYINT" />  
44 - <result column="seasons" property="seasons" jdbcType="CHAR" />  
45 - <result column="is_down" property="isDown" jdbcType="CHAR" />  
46 - <result column="isdown" property="isdown" jdbcType="INTEGER" />  
47 - <result column="isrecommend" property="isrecommend" jdbcType="INTEGER" />  
48 - <result column="is_outlets" property="isOutlets" jdbcType="INTEGER" />  
49 - <result column="first_shelve_time" property="firstShelveTime" jdbcType="INTEGER" />  
50 - <result column="special_price" property="specialPrice" jdbcType="DECIMAL" />  
51 - <result column="market_price" property="marketPrice" jdbcType="DECIMAL" />  
52 - <result column="vip_discount_type" property="vipDiscountType" jdbcType="TINYINT" />  
53 - <result column="vip_price" property="vipPrice" jdbcType="DECIMAL" />  
54 - <result column="vip1_price" property="vip1Price" jdbcType="DECIMAL" />  
55 - <result column="vip2_price" property="vip2Price" jdbcType="DECIMAL" />  
56 - <result column="vip3_price" property="vip3Price" jdbcType="DECIMAL" />  
57 - <result column="student_price" property="studentPrice" jdbcType="DECIMAL" />  
58 - <result column="is_student_price" property="isStudentPrice" jdbcType="VARCHAR" />  
59 - <result column="sales_price" property="salesPrice" jdbcType="DECIMAL" />  
60 - <result column="promotion_discount_int" property="promotionDiscountInt" jdbcType="DECIMAL" />  
61 - <result column="promotion_discount" property="promotionDiscount" jdbcType="DECIMAL" />  
62 - <result column="specialoffer" property="specialoffer" jdbcType="CHAR" />  
63 - <result column="sell_channels" property="sellChannels" jdbcType="CHAR" />  
64 - <result column="product_skn" property="productSkn" jdbcType="INTEGER" />  
65 - <result column="storage_num" property="storageNum" jdbcType="DECIMAL" />  
66 - <result column="islimited" property="islimited" jdbcType="CHAR" />  
67 - <result column="isnew" property="isnew" jdbcType="CHAR" />  
68 - <result column="color_ids" property="colorIds" jdbcType="VARCHAR" />  
69 - <result column="color_names" property="colorNames" jdbcType="VARCHAR" />  
70 - <result column="size_ids" property="sizeIds" jdbcType="VARCHAR" />  
71 - <result column="size_names" property="sizeNames" jdbcType="VARCHAR" />  
72 - <result column="standard_ids" property="standardIds" jdbcType="VARCHAR" />  
73 - <result column="standard_names" property="standardNames" jdbcType="VARCHAR" />  
74 - <result column="style_ids" property="styleIds" jdbcType="VARCHAR" />  
75 - <result column="default_images" property="defaultImages" jdbcType="VARCHAR" />  
76 - <result column="gender_s" property="genderS" jdbcType="VARCHAR" />  
77 - <result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />  
78 - <result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />  
79 - <result column="edit_time" property="editTime" jdbcType="INTEGER" />  
80 - <result column="is_soon_sold_out" property="isSoonSoldOut" jdbcType="VARCHAR" />  
81 - <result column="is_discount" property="isDiscount" jdbcType="VARCHAR" />  
82 - <result column="is_sold_out" property="isSoldOut" jdbcType="VARCHAR" />  
83 - <result column="sold_out" property="soldOut" jdbcType="INTEGER" />  
84 - <result column="sort_weight" property="sortWeight" jdbcType="INTEGER" />  
85 - <result column="yohood_id" property="yohoodId" jdbcType="VARCHAR" />  
86 - <result column="standard_only_names" property="standardOnlyNames" jdbcType="VARCHAR" />  
87 - <result column="max_sort" property="maxSort" jdbcType="VARCHAR" />  
88 - <result column="middle_sort" property="middleSort" jdbcType="VARCHAR" />  
89 - <result column="small_sort" property="smallSort" jdbcType="VARCHAR" />  
90 - <result column="brand_weight" property="brandWeight" jdbcType="INTEGER" />  
91 - <result column="base_pin_ratio" property="basePinRatio" jdbcType="DOUBLE" />  
92 - <result column="breaking_rate" property="breakingRate" jdbcType="DOUBLE" />  
93 - <result column="discount_score" property="discountScore" jdbcType="DOUBLE" />  
94 - <result column="pool_id" property="poolId" jdbcType="VARCHAR" />  
95 - <result column="product_keyword" property="productKeyword" jdbcType="VARCHAR" />  
96 - <result column="age_level" property="ageLevel" jdbcType="VARCHAR" />  
97 - <result column="app_type" property="appType" jdbcType="INTEGER" />  
98 - <result column="is_instalment" property="isInstalment" jdbcType="VARCHAR" />  
99 - <result column="is_seckill" property="isSeckill" jdbcType="CHAR" />  
100 - <result column="country_id" property="countryId" jdbcType="INTEGER" />  
101 - </resultMap>  
102 - <resultMap id="ResultMapWithBLOBs" type="com.yoho.search.dal.model.ProductIndex" extends="BaseResultMap" >  
103 - <result column="goods_list" property="goodsList" jdbcType="LONGVARCHAR" />  
104 - <result column="activities" property="activities" jdbcType="LONGVARCHAR" />  
105 - </resultMap>  
106 - <sql id="Base_Column_List" >  
107 - id, product_id,shop_id, sales_num, shelve_time, shelve_day, cn_alphabet, product_name,  
108 - brand_name_cn, brand_name_en, brand_keyword, hot_keyword, brand_name, style,  
109 - sales_phrase, max_sort_id, middle_sort_id, small_sort_id, gender, brand_id,  
110 - is_special, status, seasons_s, isspecial, is_hot, folder_id,  
111 - ishot, ispromotion, series_id, is_sales, issales, is_advance,  
112 - isadvance, is_auditing, isauditing, attribute, seasons, is_down,  
113 - isdown, isrecommend, is_outlets, first_shelve_time, special_price, market_price,  
114 - vip_discount_type, vip_price, vip1_price, vip2_price, vip3_price,student_price,is_student_price, sales_price,  
115 - promotion_discount_int, promotion_discount, specialoffer, sell_channels, product_skn,  
116 - storage_num, islimited, isnew,color_ids,color_names,size_ids,size_names,standard_ids,standard_names,style_ids,default_images,  
117 - max_sort_name,middle_sort_name,small_sort_name,gender_s,brand_domain,  
118 - brand_alif,goods_list,edit_time,is_soon_sold_out,is_discount,activities,is_sold_out,sold_out,  
119 - sort_weight,yohood_id,standard_only_names,max_sort,middle_sort,small_sort,brand_weight,base_pin_ratio,breaking_rate,  
120 - discount_score,pool_id,product_keyword,age_level,app_type,is_instalment,is_seckill,country_id  
121 - </sql>  
122 - <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" timeout="20000">  
123 - select  
124 - <include refid="Base_Column_List" />  
125 - from product_index  
126 - where id = #{id,jdbcType=INTEGER}  
127 - </select>  
128 - <select id="selectByProductSkn" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" timeout="20000">  
129 - select  
130 - <include refid="Base_Column_List" />  
131 - from product_index  
132 - where product_skn = #{product_skn,jdbcType=INTEGER}  
133 - </select>  
134 - <select id="count" resultType="java.lang.Integer" timeout="20000">  
135 - SELECT count(*) FROM product_index  
136 - </select>  
137 - <select id="getPageLists" resultMap="ResultMapWithBLOBs" timeout="20000">  
138 - select  
139 - <include refid="Base_Column_List" />  
140 - from product_index limit #{offset},#{pageSize}  
141 - </select>  
142 - <resultMap id="ids" type="Integer">  
143 - <result column="product_skn" property="productSkn" jdbcType="INTEGER"/>  
144 - </resultMap>  
145 - <select id="getSknsPage" resultMap="ids" timeout="20000">  
146 - select product_skn  
147 - <include refid="Base_Column_List" />  
148 - from product_index  
149 - limit #{offset},#{pageSize}  
150 - </select>  
151 -</mapper>  
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <dependencies> 25 <dependencies>
26 <dependency> 26 <dependency>
27 <groupId>com.yoho.search</groupId> 27 <groupId>com.yoho.search</groupId>
28 - <artifactId>search-core</artifactId> 28 + <artifactId>search-personalized</artifactId>
29 <version>${search.core.version}</version> 29 <version>${search.core.version}</version>
30 </dependency> 30 </dependency>
31 <dependency> 31 <dependency>
1 -package com.yoho.search.consumer.index.fullbuild; 1 +package com.yoho.search.index.fullbuild;
2 2
3 -import com.yoho.search.base.utils.ISearchConstans;  
4 -import com.yoho.search.consumer.index.common.IIndexBuilder;  
5 -import com.yoho.search.consumer.service.base.ProductIndexService;  
6 -import com.yoho.search.consumer.service.logic.ProductIndexLogicService;  
7 import com.yoho.search.dal.ProductMapper; 3 import com.yoho.search.dal.ProductMapper;
8 import com.yoho.search.dal.model.ProductIndex; 4 import com.yoho.search.dal.model.ProductIndex;
9 - 5 +import com.yoho.search.service.base.ProductIndexService;
  6 +import com.yoho.search.service.logic.ProductIndexLogicService;
10 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
12 9
@@ -28,21 +25,12 @@ public class ProductIndexIndexBuilder extends IIndexBuilder { @@ -28,21 +25,12 @@ public class ProductIndexIndexBuilder extends IIndexBuilder {
28 25
29 @Override 26 @Override
30 public int getTotalCount() throws Exception { 27 public int getTotalCount() throws Exception {
31 - if (ISearchConstans.BUILD_PRODUCTINDEX_USE_CODE) {  
32 return productMapper.count(); 28 return productMapper.count();
33 - } else {  
34 - return productIndexService.count();  
35 - }  
36 } 29 }
37 30
38 @Override 31 @Override
39 public List<?> getPageLists(int offset, int limit) throws Exception { 32 public List<?> getPageLists(int offset, int limit) throws Exception {
40 - List<ProductIndex> list = new ArrayList<>();  
41 - if (ISearchConstans.BUILD_PRODUCTINDEX_USE_CODE) {  
42 - list = productIndexLogicService.getProductIndex(offset, limit);  
43 - } else {  
44 - list = productIndexService.getPageLists(offset, limit);  
45 - } 33 + List<ProductIndex> list = productIndexLogicService.getProductIndex(offset, limit);
46 List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>(); 34 List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
47 if (list != null && list.size() > 0) { 35 if (list != null && list.size() > 0) {
48 int size = list.size(); 36 int size = list.size();
1 -package com.yoho.search.consumer.index.fullbuild; 1 +package com.yoho.search.index.fullbuild;
2 2
3 -import com.yoho.search.base.utils.ISearchConstans;  
4 -import com.yoho.search.consumer.index.common.IIndexBuilder;  
5 -import com.yoho.search.consumer.service.base.Product15DaySalesNumService;  
6 -import com.yoho.search.consumer.service.base.StorageSkuService;  
7 -import com.yoho.search.consumer.service.logic.SpecialDealLogicService;  
8 -import com.yoho.search.consumer.service.logic.StorageSkuLogicService;  
9 import com.yoho.search.dal.StorageMapper; 3 import com.yoho.search.dal.StorageMapper;
10 import com.yoho.search.dal.model.StorageSku; 4 import com.yoho.search.dal.model.StorageSku;
11 - 5 +import com.yoho.search.service.base.Product15DaySalesNumService;
  6 +import com.yoho.search.service.base.StorageSkuService;
  7 +import com.yoho.search.service.logic.SpecialDealLogicService;
  8 +import com.yoho.search.service.logic.StorageSkuLogicService;
12 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
14 11
@@ -29,21 +26,13 @@ public class StorageSkuIndexBuilder extends IIndexBuilder { @@ -29,21 +26,13 @@ public class StorageSkuIndexBuilder extends IIndexBuilder {
29 26
30 @Override 27 @Override
31 public int getTotalCount() throws Exception { 28 public int getTotalCount() throws Exception {
32 - if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {  
33 return storageMapper.count(); 29 return storageMapper.count();
34 - } else {  
35 - return storageSkuService.count();  
36 - }  
37 } 30 }
38 31
39 @Override 32 @Override
40 public List<?> getPageLists(int offset, int limit) throws Exception { 33 public List<?> getPageLists(int offset, int limit) throws Exception {
41 List<StorageSku> pageLists = new ArrayList<StorageSku>(); 34 List<StorageSku> pageLists = new ArrayList<StorageSku>();
42 - if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {  
43 pageLists = storageSkuLogicService.getStorageSkuIndex(offset, limit); 35 pageLists = storageSkuLogicService.getStorageSkuIndex(offset, limit);
44 - } else {  
45 - pageLists = storageSkuService.selectList(offset, limit);  
46 - }  
47 for (StorageSku storageSku : pageLists) { 36 for (StorageSku storageSku : pageLists) {
48 SpecialDealLogicService.specialDealStorageSku(storageSku); 37 SpecialDealLogicService.specialDealStorageSku(storageSku);
49 } 38 }
@@ -96,33 +96,21 @@ public class StorageSkuIndexToolsService implements ApplicationEventPublisherAwa @@ -96,33 +96,21 @@ public class StorageSkuIndexToolsService implements ApplicationEventPublisherAwa
96 // 1、根据sku去取数据库对象 96 // 1、根据sku去取数据库对象
97 List<Integer> productSkus = this.getElementsFromArrayBlockingQueue(productSkuQueue, 200); 97 List<Integer> productSkus = this.getElementsFromArrayBlockingQueue(productSkuQueue, 200);
98 if (!productSkus.isEmpty()) { 98 if (!productSkus.isEmpty()) {
99 - if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {  
100 storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkus(productSkus)); 99 storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkus(productSkus));
101 - } else {  
102 - storageSkuList.addAll(storageSkuService.selectListProductSkus(productSkus));  
103 - }  
104 logger.info("doBulkUpdateStorageSkuIndex[getListBySku], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost()); 100 logger.info("doBulkUpdateStorageSkuIndex[getListBySku], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
105 } 101 }
106 102
107 // 2、根据skc去取数据库对象 103 // 2、根据skc去取数据库对象
108 List<Integer> goodsIds = this.getElementsFromArrayBlockingQueue(goodsIdQueue, 200); 104 List<Integer> goodsIds = this.getElementsFromArrayBlockingQueue(goodsIdQueue, 200);
109 if (!goodsIds.isEmpty()) { 105 if (!goodsIds.isEmpty()) {
110 - if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {  
111 storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkcs(goodsIds)); 106 storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkcs(goodsIds));
112 - } else {  
113 - storageSkuList.addAll(storageSkuService.selectListByGoodsIds(goodsIds));  
114 - }  
115 logger.info("doBulkUpdateStorageSkuIndex[getListBySkc], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost()); 107 logger.info("doBulkUpdateStorageSkuIndex[getListBySkc], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
116 } 108 }
117 109
118 // 3、根据skn去取数据库对象 110 // 3、根据skn去取数据库对象
119 List<Integer> productIds = this.getElementsFromArrayBlockingQueue(productIdQueue, 200); 111 List<Integer> productIds = this.getElementsFromArrayBlockingQueue(productIdQueue, 200);
120 if (!productIds.isEmpty()) { 112 if (!productIds.isEmpty()) {
121 - if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {  
122 storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkns(productIds)); 113 storageSkuList.addAll(storageSkuLogicService.getStorageSkuIndexBySkns(productIds));
123 - } else {  
124 - storageSkuList.addAll(storageSkuService.selectListByProductIds(productIds));  
125 - }  
126 logger.info("doBulkUpdateStorageSkuIndex[getListBySkn], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost()); 114 logger.info("doBulkUpdateStorageSkuIndex[getListBySkn], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
127 } 115 }
128 116
1 -package com.yoho.search.consumer.service.base;  
2 -  
3 -import java.math.BigDecimal;  
4 -import java.util.HashMap;  
5 -import java.util.List;  
6 -import java.util.Map; 1 +package com.yoho.search.service.base;
7 2
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.alibaba.fastjson.JSONException;
  5 +import com.yoho.search.dal.model.ProductIndex;
  6 +import com.yoho.search.service.logic.SpecialDealLogicService;
8 import org.apache.commons.lang.StringUtils; 7 import org.apache.commons.lang.StringUtils;
9 import org.slf4j.Logger; 8 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
11 -import org.springframework.beans.factory.annotation.Autowired;  
12 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
13 11
14 -import com.alibaba.fastjson.JSONArray;  
15 -import com.alibaba.fastjson.JSONException;  
16 -import com.yoho.search.consumer.service.logic.SpecialDealLogicService;  
17 -import com.yoho.search.dal.ProductIMapper;  
18 -import com.yoho.search.dal.ProductIndexMapper;  
19 -import com.yoho.search.dal.model.ProductI;  
20 -import com.yoho.search.dal.model.ProductIndex; 12 +import java.math.BigDecimal;
  13 +import java.util.HashMap;
  14 +import java.util.Map;
21 15
22 @Component 16 @Component
  17 +//@Transactional
23 public class ProductIndexService { 18 public class ProductIndexService {
24 private final Logger logger = LoggerFactory.getLogger(ProductIndexService.class); 19 private final Logger logger = LoggerFactory.getLogger(ProductIndexService.class);
25 20
26 - @Autowired  
27 - private ProductIndexMapper productIndexMapper;  
28 - @Autowired  
29 - private ProductIMapper productIMapper;  
30 -  
31 - public ProductIndex getById(Integer id) {  
32 - return productIndexMapper.selectByPrimaryKey(id);  
33 - }  
34 -  
35 - public ProductIndex getBySkn(Integer skn){  
36 - return productIndexMapper.selectByProductSkn(skn);  
37 - }  
38 -  
39 - public List<ProductIndex> getPageLists(int start, int size) {  
40 - return productIndexMapper.getPageLists(start, size);  
41 - }  
42 -  
43 - public int count() {  
44 - return productIndexMapper.count();  
45 - }  
46 -  
47 - public ProductI getProductById(Integer id) {  
48 - return productIMapper.selectByPrimaryKey(id);  
49 - }  
50 -  
51 - public List<ProductI> getProductPageLists(int start, int size) {  
52 - return productIMapper.getPageLists(start, size);  
53 - }  
54 -  
55 - public int countProduct() {  
56 - return productIMapper.count();  
57 - }  
58 -  
59 -  
60 21
61 @SuppressWarnings({ "rawtypes", "unchecked" }) 22 @SuppressWarnings({ "rawtypes", "unchecked" })
62 public Map<String, Object> beanToMap(ProductIndex productIndex) { 23 public Map<String, Object> beanToMap(ProductIndex productIndex) {
1 package com.yoho.search.consumer.service.base; 1 package com.yoho.search.consumer.service.base;
2 2
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -  
6 import com.yoho.search.dal.StorageSkuMapper; 3 import com.yoho.search.dal.StorageSkuMapper;
7 import com.yoho.search.dal.model.StorageSku; 4 import com.yoho.search.dal.model.StorageSku;
8 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Component; 6 import org.springframework.stereotype.Component;
10 7
  8 +import java.util.List;
  9 +
11 @Component 10 @Component
12 public class StorageSkuService { 11 public class StorageSkuService {
13 12
14 @Autowired 13 @Autowired
15 private StorageSkuMapper storageSkuMapper; 14 private StorageSkuMapper storageSkuMapper;
16 15
17 - public int count() {  
18 - return storageSkuMapper.selectCount();  
19 - }  
20 -  
21 - public List<StorageSku> selectList(int offset, int limit) {  
22 - return storageSkuMapper.selectList(offset, limit);  
23 - }  
24 16
25 - public StorageSku getById(Integer erpSkuId) {  
26 - return storageSkuMapper.selectByPrimaryKey(erpSkuId);  
27 - }  
28 -  
29 - public List<StorageSku> selectListProductSkus(List<Integer> productSkus) {  
30 - if (productSkus == null || productSkus.isEmpty()) {  
31 - return new ArrayList<StorageSku>();  
32 - }  
33 - return storageSkuMapper.selectListProductSkus(productSkus);  
34 - }  
35 17
36 public List<StorageSku> selectListByProductId(Integer productId) { 18 public List<StorageSku> selectListByProductId(Integer productId) {
37 return storageSkuMapper.selectListByProductId(productId); 19 return storageSkuMapper.selectListByProductId(productId);
38 } 20 }
39 21
40 - public List<StorageSku> selectListByProductIds(List<Integer> productIds) {  
41 - if (productIds == null || productIds.isEmpty()) {  
42 - return new ArrayList<StorageSku>();  
43 - }  
44 - return storageSkuMapper.selectListByProductIds(productIds);  
45 - }  
46 22
47 public List<StorageSku> selectListByGoodsId(Integer goodsId) { 23 public List<StorageSku> selectListByGoodsId(Integer goodsId) {
48 return storageSkuMapper.selectListByGoodsId(goodsId); 24 return storageSkuMapper.selectListByGoodsId(goodsId);
49 } 25 }
50 26
51 - public List<StorageSku> selectListByGoodsIds(List<Integer> goodsId) {  
52 - if (goodsId == null || goodsId.isEmpty()) {  
53 - return new ArrayList<StorageSku>();  
54 - }  
55 - return storageSkuMapper.selectListByGoodsIds(goodsId);  
56 - }  
57 27
58 } 28 }