Showing
3 changed files
with
21 additions
and
8 deletions
@@ -187,14 +187,27 @@ public class SearchCommonHelper { | @@ -187,14 +187,27 @@ public class SearchCommonHelper { | ||
187 | } | 187 | } |
188 | 188 | ||
189 | /** | 189 | /** |
190 | + * 是否是新品到着页 | ||
191 | + * | ||
192 | + * @param paramMap | ||
193 | + * @return | ||
194 | + */ | ||
195 | + public boolean isNewRecPage(Map<String, String> paramMap) { | ||
196 | + String pageId = paramMap.get("pageId"); | ||
197 | + if (StringUtils.isBlank(pageId) || !pageId.equals("4")) { | ||
198 | + return false; | ||
199 | + } | ||
200 | + return true; | ||
201 | + } | ||
202 | + | ||
203 | + /** | ||
190 | * 是否是新品到着默认页 | 204 | * 是否是新品到着默认页 |
191 | * | 205 | * |
192 | * @param paramMap | 206 | * @param paramMap |
193 | * @return | 207 | * @return |
194 | */ | 208 | */ |
195 | public boolean isNewRecPageDefault(Map<String, String> paramMap) { | 209 | public boolean isNewRecPageDefault(Map<String, String> paramMap) { |
196 | - String pageId = paramMap.get("pageId"); | ||
197 | - if (StringUtils.isBlank(pageId)|| !pageId.equals("4")){ | 210 | + if (!isNewRecPage(paramMap)) { |
198 | return false; | 211 | return false; |
199 | } | 212 | } |
200 | String order = paramMap.get("order"); | 213 | String order = paramMap.get("order"); |
@@ -204,7 +217,6 @@ public class SearchCommonHelper { | @@ -204,7 +217,6 @@ public class SearchCommonHelper { | ||
204 | return true; | 217 | return true; |
205 | } | 218 | } |
206 | 219 | ||
207 | - | ||
208 | /** | 220 | /** |
209 | * 关键字中含性别,则加上性别的过滤条件 | 221 | * 关键字中含性别,则加上性别的过滤条件 |
210 | * | 222 | * |
@@ -86,18 +86,19 @@ public class SearchSortHelper { | @@ -86,18 +86,19 @@ public class SearchSortHelper { | ||
86 | if (StringUtils.isBlank(sortFields)) { | 86 | if (StringUtils.isBlank(sortFields)) { |
87 | return null; | 87 | return null; |
88 | } | 88 | } |
89 | + boolean isNewRecPage = searchCommonHelper.isNewRecPage(paramMap); | ||
89 | String[] sortFieldArray = sortFields.split(","); | 90 | String[] sortFieldArray = sortFields.split(","); |
90 | StringBuilder realOrder = new StringBuilder(); | 91 | StringBuilder realOrder = new StringBuilder(); |
91 | for (String sortField : sortFieldArray) { | 92 | for (String sortField : sortFieldArray) { |
92 | if (!orderValues.contains(sortField)) { | 93 | if (!orderValues.contains(sortField)) { |
93 | continue; | 94 | continue; |
94 | } | 95 | } |
95 | - realOrder.append("," + this.dealSortField(sortField)); | 96 | + realOrder.append("," + this.dealSortField(sortField,isNewRecPage)); |
96 | } | 97 | } |
97 | return realOrder.toString().replaceFirst(",", ""); | 98 | return realOrder.toString().replaceFirst(",", ""); |
98 | } | 99 | } |
99 | 100 | ||
100 | - public String dealSortField(String sortField) { | 101 | + public String dealSortField(String sortField,boolean isNewRecPage) { |
101 | String[] sortParts = sortField.split(":"); | 102 | String[] sortParts = sortField.split(":"); |
102 | String realSortField = sortParts[0]; | 103 | String realSortField = sortParts[0]; |
103 | if (realSortField.contains("activities")) { | 104 | if (realSortField.contains("activities")) { |
@@ -106,9 +107,9 @@ public class SearchSortHelper { | @@ -106,9 +107,9 @@ public class SearchSortHelper { | ||
106 | // do nothing | 107 | // do nothing |
107 | } else if (realSortField.equals("discount")) { | 108 | } else if (realSortField.equals("discount")) { |
108 | realSortField = "promotionDiscount"; | 109 | realSortField = "promotionDiscount"; |
109 | - } else if (realSortField.equals("shelve_time")) { | 110 | + } else if (realSortField.equals("shelve_time") && !isNewRecPage) {//非新品到着的页面最新全部按真实上架时间排序 |
110 | realSortField = "firstShelveTime"; | 111 | realSortField = "firstShelveTime"; |
111 | - }else { | 112 | + } else { |
112 | realSortField = CharUtils.underlineToCamelhump(realSortField); | 113 | realSortField = CharUtils.underlineToCamelhump(realSortField); |
113 | } | 114 | } |
114 | if (realSortField.equalsIgnoreCase("score")) { | 115 | if (realSortField.equalsIgnoreCase("score")) { |
@@ -224,7 +224,7 @@ public class AggProductListServiceImpl implements IAggProductListService, Applic | @@ -224,7 +224,7 @@ public class AggProductListServiceImpl implements IAggProductListService, Applic | ||
224 | if (searchCommonHelper.isNeedPersonalSearch(paramMap)) { | 224 | if (searchCommonHelper.isNeedPersonalSearch(paramMap)) { |
225 | order = "_score:desc"; | 225 | order = "_score:desc"; |
226 | } | 226 | } |
227 | - order = searchSortHelper.dealSortField(order); | 227 | + order = searchSortHelper.dealSortField(order,false); |
228 | String sortField = order.split(":")[0]; | 228 | String sortField = order.split(":")[0]; |
229 | SortOrder sortOrder = order.split(":")[1].equals("desc") ? SortOrder.DESC : SortOrder.ASC; | 229 | SortOrder sortOrder = order.split(":")[1].equals("desc") ? SortOrder.DESC : SortOrder.ASC; |
230 | 230 |
-
Please register or login to post a comment