Merge branch 'wn_cutdown_price_for_0530' into gray0531
Showing
7 changed files
with
282 additions
and
118 deletions
1 | <?xml version="1.0" encoding="UTF-8" ?> | 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" > | 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.CutdownPriceProductMapper"> | 3 | <mapper namespace="com.yoho.search.dal.CutdownPriceProductMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CutdownPriceProduct"> | ||
5 | - <id column="id" property="id" jdbcType="INTEGER"/> | ||
6 | - <result column="activity_id" property="activityId" jdbcType="INTEGER"/> | ||
7 | - <result column="product_skn" property="productSkn" jdbcType="INTEGER"/> | ||
8 | - <result column="join_num" property="joinNum" jdbcType="INTEGER"/> | ||
9 | - <result column="high_price" property="highPrice" jdbcType="DECIMAL"/> | ||
10 | - <result column="low_price" property="lowPrice" jdbcType="DECIMAL"/> | ||
11 | - <result column="create_time" property="createTime" jdbcType="INTEGER"/> | ||
12 | - <result column="update_time" property="updateTime" jdbcType="INTEGER"/> | ||
13 | - <result column="status" property="status" jdbcType="INTEGER"/> | 4 | + |
5 | + <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CutdownPriceProduct" > | ||
6 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
7 | + <result column="activity_id" property="activityId" jdbcType="INTEGER" /> | ||
8 | + <result column="product_skn" property="productSkn" jdbcType="INTEGER" /> | ||
9 | + <result column="create_time" property="createTime" jdbcType="INTEGER" /> | ||
10 | + <result column="update_time" property="updateTime" jdbcType="INTEGER" /> | ||
11 | + <result column="status" property="status" jdbcType="INTEGER" /> | ||
12 | + <result column="product_type" property="productType" jdbcType="INTEGER" /> | ||
13 | + <result column="platform_limit" property="platformLimit" jdbcType="INTEGER" /> | ||
14 | + <result column="show_limit" property="showLimit" jdbcType="INTEGER" /> | ||
15 | + <result column="cut_total_price" property="cutTotalPrice" jdbcType="DECIMAL" /> | ||
16 | + <result column="cut_yoho_low_percent" property="cutYohoLowPercent" jdbcType="DECIMAL" /> | ||
17 | + <result column="cut_yoho_high_percent" property="cutYohoHighPercent" jdbcType="DECIMAL" /> | ||
18 | + <result column="cut_grade" property="cutGrade" jdbcType="INTEGER" /> | ||
19 | + <result column="cut_grade_config" property="cutGradeConfig" jdbcType="VARCHAR" /> | ||
20 | + <result column="order_by" property="orderBy" jdbcType="INTEGER" /> | ||
21 | + <result column="join_num" property="joinNum" jdbcType="INTEGER" /> | ||
22 | + <result column="high_price" property="highPrice" jdbcType="DECIMAL" /> | ||
23 | + <result column="low_price" property="lowPrice" jdbcType="DECIMAL" /> | ||
14 | </resultMap> | 24 | </resultMap> |
15 | 25 | ||
16 | - <sql id="Base_Column_List"> | ||
17 | - id, activity_id, product_skn, join_num, high_price, low_price, create_time, update_time,status | 26 | + <sql id="Base_Column_List" > |
27 | + id, activity_id, product_skn, create_time, update_time, status, product_type, platform_limit, | ||
28 | + show_limit, cut_total_price, cut_yoho_low_percent, cut_yoho_high_percent, cut_grade, | ||
29 | + cut_grade_config, order_by, join_num, high_price, low_price | ||
18 | </sql> | 30 | </sql> |
19 | 31 | ||
20 | - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer"> | 32 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
21 | select | 33 | select |
22 | - <include refid="Base_Column_List"/> | 34 | + <include refid="Base_Column_List" /> |
23 | from cutdown_price_product | 35 | from cutdown_price_product |
24 | where id = #{id,jdbcType=INTEGER} | 36 | where id = #{id,jdbcType=INTEGER} |
25 | </select> | 37 | </select> |
26 | 38 | ||
27 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
28 | - delete from cutdown_price_product | ||
29 | - where id = #{id,jdbcType=INTEGER} | 39 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
40 | + delete from cutdown_price_product | ||
41 | + where id = #{id,jdbcType=INTEGER} | ||
30 | </delete> | 42 | </delete> |
31 | 43 | ||
32 | - <insert id="insert" parameterType="com.yoho.search.dal.model.CutdownPriceProduct"> | ||
33 | - insert into cutdown_price_product (id, activity_id, product_skn, | ||
34 | - join_num, high_price, low_price, | ||
35 | - create_time, update_time, status | 44 | + <insert id="insert" parameterType="com.yoho.search.dal.model.CutdownPriceProduct" > |
45 | + insert into cutdown_price_product (id, activity_id, product_skn, | ||
46 | + create_time, update_time, status, | ||
47 | + product_type, platform_limit, show_limit, | ||
48 | + cut_total_price, cut_yoho_low_percent, cut_yoho_high_percent, | ||
49 | + cut_grade, cut_grade_config, order_by, | ||
50 | + join_num, high_price, low_price | ||
36 | ) | 51 | ) |
37 | - values (#{id,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{productSkn,jdbcType=INTEGER}, | ||
38 | - #{joinNum,jdbcType=INTEGER}, #{highPrice,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL}, | ||
39 | - #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{status,jdbcType=INTEGER} | 52 | + values (#{id,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{productSkn,jdbcType=INTEGER}, |
53 | + #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, | ||
54 | + #{productType,jdbcType=INTEGER}, #{platformLimit,jdbcType=INTEGER}, #{showLimit,jdbcType=INTEGER}, | ||
55 | + #{cutTotalPrice,jdbcType=DECIMAL}, #{cutYohoLowPercent,jdbcType=DECIMAL}, #{cutYohoHighPercent,jdbcType=DECIMAL}, | ||
56 | + #{cutGrade,jdbcType=INTEGER}, #{cutGradeConfig,jdbcType=VARCHAR}, #{orderBy,jdbcType=INTEGER}, | ||
57 | + #{joinNum,jdbcType=INTEGER}, #{highPrice,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL} | ||
40 | ) | 58 | ) |
41 | - </insert> | 59 | + </insert> |
42 | 60 | ||
43 | - <insert id="insertSelective" parameterType="com.yoho.search.dal.model.CutdownPriceProduct"> | 61 | + <insert id="insertSelective" parameterType="com.yoho.search.dal.model.CutdownPriceProduct" > |
44 | insert into cutdown_price_product | 62 | insert into cutdown_price_product |
45 | - <trim prefix="(" suffix=")" suffixOverrides=","> | ||
46 | - <if test="id != null"> | 63 | + <trim prefix="(" suffix=")" suffixOverrides="," > |
64 | + <if test="id != null" > | ||
47 | id, | 65 | id, |
48 | </if> | 66 | </if> |
49 | - <if test="activityId != null"> | 67 | + <if test="activityId != null" > |
50 | activity_id, | 68 | activity_id, |
51 | </if> | 69 | </if> |
52 | - <if test="productSkn != null"> | 70 | + <if test="productSkn != null" > |
53 | product_skn, | 71 | product_skn, |
54 | </if> | 72 | </if> |
55 | - <if test="joinNum != null"> | ||
56 | - join_num, | ||
57 | - </if> | ||
58 | - <if test="highPrice != null"> | ||
59 | - high_price, | ||
60 | - </if> | ||
61 | - <if test="lowPrice != null"> | ||
62 | - low_price, | ||
63 | - </if> | ||
64 | - <if test="createTime != null"> | 73 | + <if test="createTime != null" > |
65 | create_time, | 74 | create_time, |
66 | </if> | 75 | </if> |
67 | - <if test="updateTime != null"> | 76 | + <if test="updateTime != null" > |
68 | update_time, | 77 | update_time, |
69 | </if> | 78 | </if> |
70 | - <if test="status != null"> | 79 | + <if test="status != null" > |
71 | status, | 80 | status, |
72 | </if> | 81 | </if> |
82 | + <if test="productType != null" > | ||
83 | + product_type, | ||
84 | + </if> | ||
85 | + <if test="platformLimit != null" > | ||
86 | + platform_limit, | ||
87 | + </if> | ||
88 | + <if test="showLimit != null" > | ||
89 | + show_limit, | ||
90 | + </if> | ||
91 | + <if test="cutTotalPrice != null" > | ||
92 | + cut_total_price, | ||
93 | + </if> | ||
94 | + <if test="cutYohoLowPercent != null" > | ||
95 | + cut_yoho_low_percent, | ||
96 | + </if> | ||
97 | + <if test="cutYohoHighPercent != null" > | ||
98 | + cut_yoho_high_percent, | ||
99 | + </if> | ||
100 | + <if test="cutGrade != null" > | ||
101 | + cut_grade, | ||
102 | + </if> | ||
103 | + <if test="cutGradeConfig != null" > | ||
104 | + cut_grade_config, | ||
105 | + </if> | ||
106 | + <if test="orderBy != null" > | ||
107 | + order_by, | ||
108 | + </if> | ||
109 | + <if test="joinNum != null" > | ||
110 | + join_num, | ||
111 | + </if> | ||
112 | + <if test="highPrice != null" > | ||
113 | + high_price, | ||
114 | + </if> | ||
115 | + <if test="lowPrice != null" > | ||
116 | + low_price, | ||
117 | + </if> | ||
73 | </trim> | 118 | </trim> |
74 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
75 | - <if test="id != null"> | 119 | + <trim prefix="values (" suffix=")" suffixOverrides="," > |
120 | + <if test="id != null" > | ||
76 | #{id,jdbcType=INTEGER}, | 121 | #{id,jdbcType=INTEGER}, |
77 | </if> | 122 | </if> |
78 | - <if test="activityId != null"> | 123 | + <if test="activityId != null" > |
79 | #{activityId,jdbcType=INTEGER}, | 124 | #{activityId,jdbcType=INTEGER}, |
80 | </if> | 125 | </if> |
81 | - <if test="productSkn != null"> | 126 | + <if test="productSkn != null" > |
82 | #{productSkn,jdbcType=INTEGER}, | 127 | #{productSkn,jdbcType=INTEGER}, |
83 | </if> | 128 | </if> |
84 | - <if test="joinNum != null"> | ||
85 | - #{joinNum,jdbcType=INTEGER}, | ||
86 | - </if> | ||
87 | - <if test="highPrice != null"> | ||
88 | - #{highPrice,jdbcType=DECIMAL}, | ||
89 | - </if> | ||
90 | - <if test="lowPrice != null"> | ||
91 | - #{lowPrice,jdbcType=DECIMAL}, | ||
92 | - </if> | ||
93 | - <if test="createTime != null"> | 129 | + <if test="createTime != null" > |
94 | #{createTime,jdbcType=INTEGER}, | 130 | #{createTime,jdbcType=INTEGER}, |
95 | </if> | 131 | </if> |
96 | - <if test="updateTime != null"> | 132 | + <if test="updateTime != null" > |
97 | #{updateTime,jdbcType=INTEGER}, | 133 | #{updateTime,jdbcType=INTEGER}, |
98 | </if> | 134 | </if> |
99 | - <if test="status != null"> | 135 | + <if test="status != null" > |
100 | #{status,jdbcType=INTEGER}, | 136 | #{status,jdbcType=INTEGER}, |
101 | </if> | 137 | </if> |
138 | + <if test="productType != null" > | ||
139 | + #{productType,jdbcType=INTEGER}, | ||
140 | + </if> | ||
141 | + <if test="platformLimit != null" > | ||
142 | + #{platformLimit,jdbcType=INTEGER}, | ||
143 | + </if> | ||
144 | + <if test="showLimit != null" > | ||
145 | + #{showLimit,jdbcType=INTEGER}, | ||
146 | + </if> | ||
147 | + <if test="cutTotalPrice != null" > | ||
148 | + #{cutTotalPrice,jdbcType=DECIMAL}, | ||
149 | + </if> | ||
150 | + <if test="cutYohoLowPercent != null" > | ||
151 | + #{cutYohoLowPercent,jdbcType=DECIMAL}, | ||
152 | + </if> | ||
153 | + <if test="cutYohoHighPercent != null" > | ||
154 | + #{cutYohoHighPercent,jdbcType=DECIMAL}, | ||
155 | + </if> | ||
156 | + <if test="cutGrade != null" > | ||
157 | + #{cutGrade,jdbcType=INTEGER}, | ||
158 | + </if> | ||
159 | + <if test="cutGradeConfig != null" > | ||
160 | + #{cutGradeConfig,jdbcType=VARCHAR}, | ||
161 | + </if> | ||
162 | + <if test="orderBy != null" > | ||
163 | + #{orderBy,jdbcType=INTEGER}, | ||
164 | + </if> | ||
165 | + <if test="joinNum != null" > | ||
166 | + #{joinNum,jdbcType=INTEGER}, | ||
167 | + </if> | ||
168 | + <if test="highPrice != null" > | ||
169 | + #{highPrice,jdbcType=DECIMAL}, | ||
170 | + </if> | ||
171 | + <if test="lowPrice != null" > | ||
172 | + #{lowPrice,jdbcType=DECIMAL}, | ||
173 | + </if> | ||
102 | </trim> | 174 | </trim> |
103 | </insert> | 175 | </insert> |
104 | 176 | ||
105 | - <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CutdownPriceProduct"> | 177 | + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.CutdownPriceProduct" > |
106 | update cutdown_price_product | 178 | update cutdown_price_product |
107 | - <set> | ||
108 | - <if test="activityId != null"> | 179 | + <set > |
180 | + <if test="activityId != null" > | ||
109 | activity_id = #{activityId,jdbcType=INTEGER}, | 181 | activity_id = #{activityId,jdbcType=INTEGER}, |
110 | </if> | 182 | </if> |
111 | - <if test="productSkn != null"> | 183 | + <if test="productSkn != null" > |
112 | product_skn = #{productSkn,jdbcType=INTEGER}, | 184 | product_skn = #{productSkn,jdbcType=INTEGER}, |
113 | </if> | 185 | </if> |
114 | - <if test="joinNum != null"> | ||
115 | - join_num = #{joinNum,jdbcType=INTEGER}, | ||
116 | - </if> | ||
117 | - <if test="highPrice != null"> | ||
118 | - high_price = #{highPrice,jdbcType=DECIMAL}, | ||
119 | - </if> | ||
120 | - <if test="lowPrice != null"> | ||
121 | - low_price = #{lowPrice,jdbcType=DECIMAL}, | ||
122 | - </if> | ||
123 | - <if test="createTime != null"> | 186 | + <if test="createTime != null" > |
124 | create_time = #{createTime,jdbcType=INTEGER}, | 187 | create_time = #{createTime,jdbcType=INTEGER}, |
125 | </if> | 188 | </if> |
126 | - <if test="updateTime != null"> | 189 | + <if test="updateTime != null" > |
127 | update_time = #{updateTime,jdbcType=INTEGER}, | 190 | update_time = #{updateTime,jdbcType=INTEGER}, |
128 | </if> | 191 | </if> |
129 | - <if test="status != null"> | 192 | + <if test="status != null" > |
130 | status = #{status,jdbcType=INTEGER}, | 193 | status = #{status,jdbcType=INTEGER}, |
131 | </if> | 194 | </if> |
195 | + <if test="productType != null" > | ||
196 | + product_type = #{productType,jdbcType=INTEGER}, | ||
197 | + </if> | ||
198 | + <if test="platformLimit != null" > | ||
199 | + platform_limit = #{platformLimit,jdbcType=INTEGER}, | ||
200 | + </if> | ||
201 | + <if test="showLimit != null" > | ||
202 | + show_limit = #{showLimit,jdbcType=INTEGER}, | ||
203 | + </if> | ||
204 | + <if test="cutTotalPrice != null" > | ||
205 | + cut_total_price = #{cutTotalPrice,jdbcType=DECIMAL}, | ||
206 | + </if> | ||
207 | + <if test="cutYohoLowPercent != null" > | ||
208 | + cut_yoho_low_percent = #{cutYohoLowPercent,jdbcType=DECIMAL}, | ||
209 | + </if> | ||
210 | + <if test="cutYohoHighPercent != null" > | ||
211 | + cut_yoho_high_percent = #{cutYohoHighPercent,jdbcType=DECIMAL}, | ||
212 | + </if> | ||
213 | + <if test="cutGrade != null" > | ||
214 | + cut_grade = #{cutGrade,jdbcType=INTEGER}, | ||
215 | + </if> | ||
216 | + <if test="cutGradeConfig != null" > | ||
217 | + cut_grade_config = #{cutGradeConfig,jdbcType=VARCHAR}, | ||
218 | + </if> | ||
219 | + <if test="orderBy != null" > | ||
220 | + order_by = #{orderBy,jdbcType=INTEGER}, | ||
221 | + </if> | ||
222 | + <if test="joinNum != null" > | ||
223 | + join_num = #{joinNum,jdbcType=INTEGER}, | ||
224 | + </if> | ||
225 | + <if test="highPrice != null" > | ||
226 | + high_price = #{highPrice,jdbcType=DECIMAL}, | ||
227 | + </if> | ||
228 | + <if test="lowPrice != null" > | ||
229 | + low_price = #{lowPrice,jdbcType=DECIMAL}, | ||
230 | + </if> | ||
132 | </set> | 231 | </set> |
133 | where id = #{id,jdbcType=INTEGER} | 232 | where id = #{id,jdbcType=INTEGER} |
134 | </update> | 233 | </update> |
135 | 234 | ||
136 | - <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CutdownPriceProduct"> | 235 | + <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CutdownPriceProduct" > |
137 | update cutdown_price_product | 236 | update cutdown_price_product |
138 | set activity_id = #{activityId,jdbcType=INTEGER}, | 237 | set activity_id = #{activityId,jdbcType=INTEGER}, |
139 | product_skn = #{productSkn,jdbcType=INTEGER}, | 238 | product_skn = #{productSkn,jdbcType=INTEGER}, |
140 | - join_num = #{joinNum,jdbcType=INTEGER}, | ||
141 | - high_price = #{highPrice,jdbcType=DECIMAL}, | ||
142 | - low_price = #{lowPrice,jdbcType=DECIMAL}, | ||
143 | create_time = #{createTime,jdbcType=INTEGER}, | 239 | create_time = #{createTime,jdbcType=INTEGER}, |
144 | update_time = #{updateTime,jdbcType=INTEGER}, | 240 | update_time = #{updateTime,jdbcType=INTEGER}, |
145 | - status = #{status,jdbcType=INTEGER} | 241 | + status = #{status,jdbcType=INTEGER}, |
242 | + product_type = #{productType,jdbcType=INTEGER}, | ||
243 | + platform_limit = #{platformLimit,jdbcType=INTEGER}, | ||
244 | + show_limit = #{showLimit,jdbcType=INTEGER}, | ||
245 | + cut_total_price = #{cutTotalPrice,jdbcType=DECIMAL}, | ||
246 | + cut_yoho_low_percent = #{cutYohoLowPercent,jdbcType=DECIMAL}, | ||
247 | + cut_yoho_high_percent = #{cutYohoHighPercent,jdbcType=DECIMAL}, | ||
248 | + cut_grade = #{cutGrade,jdbcType=INTEGER}, | ||
249 | + cut_grade_config = #{cutGradeConfig,jdbcType=VARCHAR}, | ||
250 | + order_by = #{orderBy,jdbcType=INTEGER}, | ||
251 | + join_num = #{joinNum,jdbcType=INTEGER}, | ||
252 | + high_price = #{highPrice,jdbcType=DECIMAL}, | ||
253 | + low_price = #{lowPrice,jdbcType=DECIMAL} | ||
146 | where id = #{id,jdbcType=INTEGER} | 254 | where id = #{id,jdbcType=INTEGER} |
147 | - </update> | 255 | + </update> |
148 | 256 | ||
149 | <select id="selectCount" resultType="java.lang.Integer" timeout="20000"> | 257 | <select id="selectCount" resultType="java.lang.Integer" timeout="20000"> |
150 | SELECT count(1) FROM cutdown_price_product | 258 | SELECT count(1) FROM cutdown_price_product |
@@ -156,7 +264,6 @@ | @@ -156,7 +264,6 @@ | ||
156 | from cutdown_price_product limit #{offset},#{pageSize} | 264 | from cutdown_price_product limit #{offset},#{pageSize} |
157 | </select> | 265 | </select> |
158 | 266 | ||
159 | - | ||
160 | <select id="selectListByActivityIdsAndSkns" resultMap="BaseResultMap" timeout="20000"> | 267 | <select id="selectListByActivityIdsAndSkns" resultMap="BaseResultMap" timeout="20000"> |
161 | select | 268 | select |
162 | <include refid="Base_Column_List"/> | 269 | <include refid="Base_Column_List"/> |
1 | package com.yoho.search.consumer.index.fullbuild.ufo; | 1 | package com.yoho.search.consumer.index.fullbuild.ufo; |
2 | 2 | ||
3 | -import com.alibaba.fastjson.JSON; | ||
4 | import com.yoho.search.consumer.index.fullbuild.IIndexBuilder; | 3 | import com.yoho.search.consumer.index.fullbuild.IIndexBuilder; |
4 | +import com.yoho.search.consumer.service.bo.CutdownPriceInfoBO; | ||
5 | import com.yoho.search.consumer.service.bo.ProductIndexBO; | 5 | import com.yoho.search.consumer.service.bo.ProductIndexBO; |
6 | +import com.yoho.search.consumer.service.logicService.CutdownPriceLogicService; | ||
6 | import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService; | 7 | import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService; |
7 | import com.yoho.search.consumer.service.logicService.cache.BasicDataCacheService; | 8 | import com.yoho.search.consumer.service.logicService.cache.BasicDataCacheService; |
8 | import com.yoho.search.consumer.service.logicService.cache.UfoBasicDataCacheService; | 9 | import com.yoho.search.consumer.service.logicService.cache.UfoBasicDataCacheService; |
10 | +import com.yoho.search.consumer.service.logicService.tbl.util.StringUtils; | ||
9 | import com.yoho.search.consumer.service.logicService.ufo.ufo2yoho.*; | 11 | import com.yoho.search.consumer.service.logicService.ufo.ufo2yoho.*; |
10 | import com.yoho.search.consumer.service.utils.IdCheckUtils; | 12 | import com.yoho.search.consumer.service.utils.IdCheckUtils; |
11 | import com.yoho.search.dal.*; | 13 | import com.yoho.search.dal.*; |
12 | import com.yoho.search.dal.model.BigdataUfoSalesMoney; | 14 | import com.yoho.search.dal.model.BigdataUfoSalesMoney; |
13 | import com.yoho.search.dal.model.Brand; | 15 | import com.yoho.search.dal.model.Brand; |
14 | import com.yoho.search.dal.model.ufo_product.*; | 16 | import com.yoho.search.dal.model.ufo_product.*; |
15 | -import com.yoho.search.dal.model.ufo_product.Goods; | ||
16 | -import com.yoho.search.dal.model.ufo_product.Product; | ||
17 | -import com.yoho.search.dal.model.ufo_product.Size; | ||
18 | import org.apache.commons.collections.CollectionUtils; | 17 | import org.apache.commons.collections.CollectionUtils; |
19 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
20 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
@@ -68,6 +67,8 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | @@ -68,6 +67,8 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | ||
68 | private UfoProductSalesMapper ufoProductSalesMapper; | 67 | private UfoProductSalesMapper ufoProductSalesMapper; |
69 | @Autowired | 68 | @Autowired |
70 | private BigdataUfoSalesMoneyMapper bigdataUfoSalesMoneyMapper; | 69 | private BigdataUfoSalesMoneyMapper bigdataUfoSalesMoneyMapper; |
70 | + @Autowired | ||
71 | + private CutdownPriceLogicService cutdownPriceLogicService; | ||
71 | 72 | ||
72 | @Override | 73 | @Override |
73 | public int getTotalCount() throws Exception { | 74 | public int getTotalCount() throws Exception { |
@@ -159,9 +160,11 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | @@ -159,9 +160,11 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | ||
159 | } | 160 | } |
160 | 161 | ||
161 | //去查这一批ufo商品的总销量【product_sales】 | 162 | //去查这一批ufo商品的总销量【product_sales】 |
162 | - Map<Integer,Integer> totalSalesNumMap = this.queryTotalSalesNumMap(ufoProductIdList); | 163 | + Map<Integer, Integer> totalSalesNumMap = this.queryTotalSalesNumMap(ufoProductIdList); |
163 | //去查这一批ufo商品的7天销售额【bigdata_ufo_sales_money】 | 164 | //去查这一批ufo商品的7天销售额【bigdata_ufo_sales_money】 |
164 | - Map<Integer,BigDecimal> productSevendayMoneyMap = this.queryProductSevendayMoney(ufoProductIdList); | 165 | + Map<Integer, BigDecimal> productSevendayMoneyMap = this.queryProductSevendayMoney(ufoProductIdList); |
166 | + //去查这一批ufo商品的砍价购【cutdown_price_product】 | ||
167 | + Map<Integer, CutdownPriceInfoBO> cutdownPriceInfoBOMap = cutdownPriceLogicService.selectCutdownPriceInfoBOMap(ufoProductIdList); | ||
165 | 168 | ||
166 | //构造ProductIndexBO | 169 | //构造ProductIndexBO |
167 | for (Product product : productList) { | 170 | for (Product product : productList) { |
@@ -184,13 +187,19 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | @@ -184,13 +187,19 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | ||
184 | // 尺码 | 187 | // 尺码 |
185 | ufoToYohoSizeService.build(productIndexBO, product, ufoSizeMap, yohoSizeNameMap, ufoStorageMap); | 188 | ufoToYohoSizeService.build(productIndexBO, product, ufoSizeMap, yohoSizeNameMap, ufoStorageMap); |
186 | // 价格 | 189 | // 价格 |
187 | - ufoToYohoPriceService.build(productIndexBO, product, ufoStoragePriceMap,ufoStorageMap); | 190 | + ufoToYohoPriceService.build(productIndexBO, product, ufoStoragePriceMap, ufoStorageMap); |
188 | // 直通车 | 191 | // 直通车 |
189 | productIndexBO.setToAddScore(ufoScoreProductRuleSet.contains(product.getId()) ? "Y" : "N"); | 192 | productIndexBO.setToAddScore(ufoScoreProductRuleSet.contains(product.getId()) ? "Y" : "N"); |
190 | // 总销量 | 193 | // 总销量 |
191 | - productIndexBO.setTotalSalesNum(totalSalesNumMap.getOrDefault(product.getId(),0)); | 194 | + productIndexBO.setTotalSalesNum(totalSalesNumMap.getOrDefault(product.getId(), 0)); |
192 | // 7天销售额 | 195 | // 7天销售额 |
193 | - productIndexBO.setSevendayMoney(productSevendayMoneyMap.getOrDefault(product.getId(),BigDecimal.ZERO)); | 196 | + productIndexBO.setSevendayMoney(productSevendayMoneyMap.getOrDefault(product.getId(), BigDecimal.ZERO)); |
197 | + // 拼团购 | ||
198 | + CutdownPriceInfoBO cutdownPriceInfoBO = cutdownPriceInfoBOMap.get(productIndexBO.getProductSkn()); | ||
199 | + if (cutdownPriceInfoBO != null) { | ||
200 | + productIndexBO.setCutdownPriceActivityIds(StringUtils.join(cutdownPriceInfoBO.getActivityIds(), ",")); | ||
201 | + productIndexBO.setCutdownPriceOrder(cutdownPriceInfoBO.getOrder()); | ||
202 | + } | ||
194 | } | 203 | } |
195 | return productIndexBOList; | 204 | return productIndexBOList; |
196 | } catch (Exception e) { | 205 | } catch (Exception e) { |
@@ -199,27 +208,28 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | @@ -199,27 +208,28 @@ public class UfoToYohoIndexBuilder extends IIndexBuilder { | ||
199 | return productIndexBOList; | 208 | return productIndexBOList; |
200 | } | 209 | } |
201 | 210 | ||
202 | - private Map<Integer,Integer> queryTotalSalesNumMap(List<Integer> ufoProductIdList){ | 211 | + private Map<Integer, Integer> queryTotalSalesNumMap(List<Integer> ufoProductIdList) { |
203 | List<ProductSales> productSalesList = ufoProductSalesMapper.selectListByProductIds(ufoProductIdList); | 212 | List<ProductSales> productSalesList = ufoProductSalesMapper.selectListByProductIds(ufoProductIdList); |
204 | - Map<Integer,Integer> totalSalesNumMap = new HashMap<>(); | ||
205 | - for(ProductSales productSales: productSalesList){ | ||
206 | - int totalSalesNum = totalSalesNumMap.getOrDefault(productSales.getProductId(),0); | ||
207 | - if(productSales.getAmount() != null){ | 213 | + Map<Integer, Integer> totalSalesNumMap = new HashMap<>(); |
214 | + for (ProductSales productSales : productSalesList) { | ||
215 | + int totalSalesNum = totalSalesNumMap.getOrDefault(productSales.getProductId(), 0); | ||
216 | + if (productSales.getAmount() != null) { | ||
208 | totalSalesNum = totalSalesNum + productSales.getAmount(); | 217 | totalSalesNum = totalSalesNum + productSales.getAmount(); |
209 | } | 218 | } |
210 | - totalSalesNumMap.put(productSales.getProductId(),totalSalesNum); | 219 | + totalSalesNumMap.put(productSales.getProductId(), totalSalesNum); |
211 | } | 220 | } |
212 | return totalSalesNumMap; | 221 | return totalSalesNumMap; |
213 | } | 222 | } |
214 | 223 | ||
215 | - private Map<Integer,BigDecimal> queryProductSevendayMoney(List<Integer> ufoProductIdList){ | 224 | + private Map<Integer, BigDecimal> queryProductSevendayMoney(List<Integer> ufoProductIdList) { |
216 | //TODO 这里找个办法优化下 | 225 | //TODO 这里找个办法优化下 |
217 | Integer lastedDateId = bigdataUfoSalesMoneyMapper.selectLatestDateId(); | 226 | Integer lastedDateId = bigdataUfoSalesMoneyMapper.selectLatestDateId(); |
218 | - if(lastedDateId==null){ | 227 | + if (lastedDateId == null) { |
219 | return new HashMap<>(); | 228 | return new HashMap<>(); |
220 | } | 229 | } |
221 | - List<BigdataUfoSalesMoney> salesMoneyList = bigdataUfoSalesMoneyMapper.selectList(ufoProductIdList,lastedDateId); | ||
222 | - return salesMoneyList.stream().collect(Collectors.toMap(BigdataUfoSalesMoney::getProductId,BigdataUfoSalesMoney::getSevendayMoney)); | 230 | + List<BigdataUfoSalesMoney> salesMoneyList = bigdataUfoSalesMoneyMapper.selectList(ufoProductIdList, lastedDateId); |
231 | + return salesMoneyList.stream().collect(Collectors.toMap(BigdataUfoSalesMoney::getProductId, BigdataUfoSalesMoney::getSevendayMoney)); | ||
223 | } | 232 | } |
224 | 233 | ||
234 | + | ||
225 | } | 235 | } |
@@ -282,13 +282,20 @@ public abstract class AbstractMqListener implements ApplicationEventPublisherAwa | @@ -282,13 +282,20 @@ public abstract class AbstractMqListener implements ApplicationEventPublisherAwa | ||
282 | } | 282 | } |
283 | 283 | ||
284 | /** | 284 | /** |
285 | - * 增量更新PI索引的方法 | 285 | + * 增量更新PI索引的方法-使用有货id去更新的时候 |
286 | */ | 286 | */ |
287 | protected final void updateProductIndexWithDataMap(Map<String, Object> indexData, Integer productId) { | 287 | protected final void updateProductIndexWithDataMap(Map<String, Object> indexData, Integer productId) { |
288 | this.updateIndexWithDataString(JSON.toJSONString(indexData), Long.valueOf(productId), ISearchConstants.INDEX_NAME_PRODUCT_INDEX, false); | 288 | this.updateIndexWithDataString(JSON.toJSONString(indexData), Long.valueOf(productId), ISearchConstants.INDEX_NAME_PRODUCT_INDEX, false); |
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
292 | + * 增量更新PI索引的方法-使用Ufo的id去更新的时候 | ||
293 | + */ | ||
294 | + protected final void updateProductIndexWithDataMapByUfoId(Map<String, Object> indexData, String productId) { | ||
295 | + commonBulkService.add(new ESBluk(JSON.toJSONString(indexData), productId, ISearchConstants.INDEX_NAME_PRODUCT_INDEX, ISearchConstants.INDEX_NAME_PRODUCT_INDEX, false)); | ||
296 | + } | ||
297 | + | ||
298 | + /** | ||
292 | * 增量更新任意索引的方法 | 299 | * 增量更新任意索引的方法 |
293 | */ | 300 | */ |
294 | private final void updateIndexWithDataString(String data, Long id, String indexName, boolean isDelete) { | 301 | private final void updateIndexWithDataString(String data, Long id, String indexName, boolean isDelete) { |
@@ -9,6 +9,7 @@ import com.yoho.search.consumer.index.increment.AbstractMqListener; | @@ -9,6 +9,7 @@ import com.yoho.search.consumer.index.increment.AbstractMqListener; | ||
9 | import com.yoho.search.consumer.service.bo.CutdownPriceInfoBO; | 9 | import com.yoho.search.consumer.service.bo.CutdownPriceInfoBO; |
10 | import com.yoho.search.consumer.service.daoService.CutdownPriceProductService; | 10 | import com.yoho.search.consumer.service.daoService.CutdownPriceProductService; |
11 | import com.yoho.search.consumer.service.daoService.ProductService; | 11 | import com.yoho.search.consumer.service.daoService.ProductService; |
12 | +import com.yoho.search.consumer.service.daoService.ufo.UfoProductService; | ||
12 | import com.yoho.search.consumer.service.logicService.CutdownPriceLogicService; | 13 | import com.yoho.search.consumer.service.logicService.CutdownPriceLogicService; |
13 | import com.yoho.search.consumer.service.logicService.tbl.util.StringUtils; | 14 | import com.yoho.search.consumer.service.logicService.tbl.util.StringUtils; |
14 | import com.yoho.search.core.message.beans.SearchMqConsumerListerner; | 15 | import com.yoho.search.core.message.beans.SearchMqConsumerListerner; |
@@ -26,7 +27,7 @@ import java.util.Map; | @@ -26,7 +27,7 @@ import java.util.Map; | ||
26 | * @version 2018/11/15 | 27 | * @version 2018/11/15 |
27 | */ | 28 | */ |
28 | @Component | 29 | @Component |
29 | -@SearchMqConsumerListerner(dbName = "erp_product",tableName = "cutdown_price_product") | 30 | +@SearchMqConsumerListerner(dbName = "erp_product", tableName = "cutdown_price_product") |
30 | public class CutdownPriceProductMqListener extends AbstractMqListener { | 31 | public class CutdownPriceProductMqListener extends AbstractMqListener { |
31 | 32 | ||
32 | @Autowired | 33 | @Autowired |
@@ -38,6 +39,8 @@ public class CutdownPriceProductMqListener extends AbstractMqListener { | @@ -38,6 +39,8 @@ public class CutdownPriceProductMqListener extends AbstractMqListener { | ||
38 | @Autowired | 39 | @Autowired |
39 | private ProductService productService; | 40 | private ProductService productService; |
40 | @Autowired | 41 | @Autowired |
42 | + private UfoProductService ufoProductService; | ||
43 | + @Autowired | ||
41 | private CutdownPriceLogicService cutdownPriceLogicService; | 44 | private CutdownPriceLogicService cutdownPriceLogicService; |
42 | 45 | ||
43 | @Override | 46 | @Override |
@@ -50,8 +53,8 @@ public class CutdownPriceProductMqListener extends AbstractMqListener { | @@ -50,8 +53,8 @@ public class CutdownPriceProductMqListener extends AbstractMqListener { | ||
50 | CutdownPriceProduct cutdownPriceProduct = cutdownPriceProductMapper.selectByPrimaryKey(Integer.valueOf(id)); | 53 | CutdownPriceProduct cutdownPriceProduct = cutdownPriceProductMapper.selectByPrimaryKey(Integer.valueOf(id)); |
51 | cutdownPriceProductService.delete(Integer.valueOf(id)); | 54 | cutdownPriceProductService.delete(Integer.valueOf(id)); |
52 | indexService.deleteIndexData(this.getIndexName(), id); | 55 | indexService.deleteIndexData(this.getIndexName(), id); |
53 | - if(cutdownPriceProduct!=null){ | ||
54 | - updateProductIndex(cutdownPriceProduct.getProductSkn()); | 56 | + if (cutdownPriceProduct != null) { |
57 | + updateProductIndex(cutdownPriceProduct); | ||
55 | } | 58 | } |
56 | } | 59 | } |
57 | 60 | ||
@@ -63,28 +66,37 @@ public class CutdownPriceProductMqListener extends AbstractMqListener { | @@ -63,28 +66,37 @@ public class CutdownPriceProductMqListener extends AbstractMqListener { | ||
63 | } | 66 | } |
64 | cutdownPriceProductService.saveOrUpdate(cutdownPriceProduct); | 67 | cutdownPriceProductService.saveOrUpdate(cutdownPriceProduct); |
65 | indexService.updateIndexData(this.getIndexName(), String.valueOf(cutdownPriceProduct.getId()), JSONObject.toJSON(cutdownPriceProduct)); | 68 | indexService.updateIndexData(this.getIndexName(), String.valueOf(cutdownPriceProduct.getId()), JSONObject.toJSON(cutdownPriceProduct)); |
66 | - updateProductIndex(cutdownPriceProduct.getProductSkn()); | 69 | + updateProductIndex(cutdownPriceProduct); |
67 | } | 70 | } |
68 | 71 | ||
69 | - private void updateProductIndex(Integer productSkn) { | ||
70 | - //1、获取商品信息 | ||
71 | - Product product = productService.getBySkn(productSkn); | ||
72 | - if (product == null) { | ||
73 | - return; | ||
74 | - } | 72 | + private void updateProductIndex(CutdownPriceProduct cutdownPriceProduct) { |
73 | + | ||
74 | + // 1.这个值可能是有货商品的skn或者ufo商品的id | ||
75 | + Integer productSkn = cutdownPriceProduct.getProductSkn(); | ||
75 | 76 | ||
76 | //2、构造商品信息 | 77 | //2、构造商品信息 |
77 | Map<String, Object> indexData = new HashMap<String, Object>(); | 78 | Map<String, Object> indexData = new HashMap<String, Object>(); |
78 | CutdownPriceInfoBO cutdownPriceInfoBO = cutdownPriceLogicService.selectCutdownPriceInfoBO(productSkn); | 79 | CutdownPriceInfoBO cutdownPriceInfoBO = cutdownPriceLogicService.selectCutdownPriceInfoBO(productSkn); |
79 | - if(cutdownPriceInfoBO==null){ | 80 | + if (cutdownPriceInfoBO == null) { |
80 | indexData.put(ProductIndexEsField.cutdownPriceActivityIds, ""); | 81 | indexData.put(ProductIndexEsField.cutdownPriceActivityIds, ""); |
81 | indexData.put(ProductIndexEsField.cutdownPriceOrder, 0); | 82 | indexData.put(ProductIndexEsField.cutdownPriceOrder, 0); |
82 | - }else{ | ||
83 | - indexData.put(ProductIndexEsField.cutdownPriceActivityIds, StringUtils.join(cutdownPriceInfoBO.getActivityIds(),",")); | 83 | + } else { |
84 | + indexData.put(ProductIndexEsField.cutdownPriceActivityIds, StringUtils.join(cutdownPriceInfoBO.getActivityIds(), ",")); | ||
84 | indexData.put(ProductIndexEsField.cutdownPriceOrder, cutdownPriceInfoBO.getOrder()); | 85 | indexData.put(ProductIndexEsField.cutdownPriceOrder, cutdownPriceInfoBO.getOrder()); |
85 | } | 86 | } |
86 | 87 | ||
87 | //3、更新Es索引 | 88 | //3、更新Es索引 |
88 | - this.updateProductIndexWithDataMap(indexData, product.getId()); | 89 | + if (cutdownPriceProduct.getProductType() == 0) { |
90 | + Product product = productService.getBySkn(productSkn); | ||
91 | + if (product == null) { | ||
92 | + return; | ||
93 | + } | ||
94 | + this.updateProductIndexWithDataMap(indexData, product.getId()); | ||
95 | + } | ||
96 | + //ufo砍价商品 | ||
97 | + if (cutdownPriceProduct.getProductType() == 1) { | ||
98 | + String id = "ufo-" + productSkn; | ||
99 | + this.updateProductIndexWithDataMapByUfoId(indexData, id); | ||
100 | + } | ||
89 | } | 101 | } |
90 | } | 102 | } |
@@ -31,7 +31,31 @@ | @@ -31,7 +31,31 @@ | ||
31 | "updateTime": { | 31 | "updateTime": { |
32 | "type": "integer" | 32 | "type": "integer" |
33 | }, | 33 | }, |
34 | - "status;": { | 34 | + "productType;": { |
35 | + "type": "integer" | ||
36 | + }, | ||
37 | + "platformLimit;": { | ||
38 | + "type": "integer" | ||
39 | + }, | ||
40 | + "showLimit;": { | ||
41 | + "type": "integer" | ||
42 | + }, | ||
43 | + "cutTotalPrice;": { | ||
44 | + "type": "double" | ||
45 | + }, | ||
46 | + "cutYohoLowPercent;": { | ||
47 | + "type": "double" | ||
48 | + }, | ||
49 | + "cutYohoHighPercent;": { | ||
50 | + "type": "double" | ||
51 | + }, | ||
52 | + "cutGrade;": { | ||
53 | + "type": "integer" | ||
54 | + }, | ||
55 | + "cutGradeConfig;": { | ||
56 | + "type": "keyword" | ||
57 | + }, | ||
58 | + "orderBy;": { | ||
35 | "type": "integer" | 59 | "type": "integer" |
36 | } | 60 | } |
37 | } | 61 | } |
@@ -52,7 +52,7 @@ public class CutdownPriceLogicService { | @@ -52,7 +52,7 @@ public class CutdownPriceLogicService { | ||
52 | productBO.setProductSkn(product.getProductSkn()); | 52 | productBO.setProductSkn(product.getProductSkn()); |
53 | productBO.setActivityId(product.getActivityId()); | 53 | productBO.setActivityId(product.getActivityId()); |
54 | productBO.setBeginTime(activity.getBeginTime()); | 54 | productBO.setBeginTime(activity.getBeginTime()); |
55 | - productBO.setOrder(product.getId()); | 55 | + productBO.setOrder(product.getOrderBy()); |
56 | productBOList.add(productBO); | 56 | productBOList.add(productBO); |
57 | } | 57 | } |
58 | 58 |
@@ -5,7 +5,6 @@ import com.yoho.search.dal.model.ufo_product.BrandSeries; | @@ -5,7 +5,6 @@ import com.yoho.search.dal.model.ufo_product.BrandSeries; | ||
5 | import com.yoho.search.dal.model.ufo_product.Product; | 5 | import com.yoho.search.dal.model.ufo_product.Product; |
6 | import org.springframework.stereotype.Component; | 6 | import org.springframework.stereotype.Component; |
7 | 7 | ||
8 | -import java.math.BigDecimal; | ||
9 | import java.util.Map; | 8 | import java.util.Map; |
10 | 9 | ||
11 | /** | 10 | /** |
@@ -56,5 +55,10 @@ public class UfoToYohoGeneralService { | @@ -56,5 +55,10 @@ public class UfoToYohoGeneralService { | ||
56 | productIndexBO.setAgeLevel("1"); | 55 | productIndexBO.setAgeLevel("1"); |
57 | productIndexBO.setIsOutlets(2); | 56 | productIndexBO.setIsOutlets(2); |
58 | productIndexBO.setPhysicalChannels("1,2,3,4"); | 57 | productIndexBO.setPhysicalChannels("1,2,3,4"); |
58 | + // 为了让砍价接口可以查出来 | ||
59 | + productIndexBO.setStoreShowStatus(1); | ||
60 | + productIndexBO.setIsLimitbuy("N"); | ||
61 | + productIndexBO.setIsDepositAdvance("N"); | ||
62 | + productIndexBO.setIsLimitTimeAdvance("N"); | ||
59 | } | 63 | } |
60 | } | 64 | } |
-
Please register or login to post a comment