Authored by 胡古飞

新品到着的最新按假上新来

... ... @@ -187,14 +187,27 @@ public class SearchCommonHelper {
}
/**
* 是否是新品到着页
*
* @param paramMap
* @return
*/
public boolean isNewRecPage(Map<String, String> paramMap) {
String pageId = paramMap.get("pageId");
if (StringUtils.isBlank(pageId) || !pageId.equals("4")) {
return false;
}
return true;
}
/**
* 是否是新品到着默认页
*
* @param paramMap
* @return
*/
public boolean isNewRecPageDefault(Map<String, String> paramMap) {
String pageId = paramMap.get("pageId");
if (StringUtils.isBlank(pageId)|| !pageId.equals("4")){
if (!isNewRecPage(paramMap)) {
return false;
}
String order = paramMap.get("order");
... ... @@ -204,7 +217,6 @@ public class SearchCommonHelper {
return true;
}
/**
* 关键字中含性别,则加上性别的过滤条件
*
... ...
... ... @@ -86,18 +86,19 @@ public class SearchSortHelper {
if (StringUtils.isBlank(sortFields)) {
return null;
}
boolean isNewRecPage = searchCommonHelper.isNewRecPage(paramMap);
String[] sortFieldArray = sortFields.split(",");
StringBuilder realOrder = new StringBuilder();
for (String sortField : sortFieldArray) {
if (!orderValues.contains(sortField)) {
continue;
}
realOrder.append("," + this.dealSortField(sortField));
realOrder.append("," + this.dealSortField(sortField,isNewRecPage));
}
return realOrder.toString().replaceFirst(",", "");
}
public String dealSortField(String sortField) {
public String dealSortField(String sortField,boolean isNewRecPage) {
String[] sortParts = sortField.split(":");
String realSortField = sortParts[0];
if (realSortField.contains("activities")) {
... ... @@ -106,9 +107,9 @@ public class SearchSortHelper {
// do nothing
} else if (realSortField.equals("discount")) {
realSortField = "promotionDiscount";
} else if (realSortField.equals("shelve_time")) {
} else if (realSortField.equals("shelve_time") && !isNewRecPage) {//非新品到着的页面最新全部按真实上架时间排序
realSortField = "firstShelveTime";
}else {
} else {
realSortField = CharUtils.underlineToCamelhump(realSortField);
}
if (realSortField.equalsIgnoreCase("score")) {
... ...
... ... @@ -224,7 +224,7 @@ public class AggProductListServiceImpl implements IAggProductListService, Applic
if (searchCommonHelper.isNeedPersonalSearch(paramMap)) {
order = "_score:desc";
}
order = searchSortHelper.dealSortField(order);
order = searchSortHelper.dealSortField(order,false);
String sortField = order.split(":")[0];
SortOrder sortOrder = order.split(":")[1].equals("desc") ? SortOrder.DESC : SortOrder.ASC;
... ...