|
@@ -13,6 +13,7 @@ import com.yoho.search.core.es.model.SearchResult; |
|
@@ -13,6 +13,7 @@ import com.yoho.search.core.es.model.SearchResult; |
13
|
import com.yoho.search.core.es.utils.SearchParamUtils;
|
13
|
import com.yoho.search.core.es.utils.SearchParamUtils;
|
14
|
import com.yoho.search.dal.model.ProductCutpriceConfig;
|
14
|
import com.yoho.search.dal.model.ProductCutpriceConfig;
|
15
|
import org.apache.commons.collections.MapUtils;
|
15
|
import org.apache.commons.collections.MapUtils;
|
|
|
16
|
+import org.apache.commons.lang.StringUtils;
|
16
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
17
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
17
|
import org.elasticsearch.index.query.QueryBuilders;
|
18
|
import org.elasticsearch.index.query.QueryBuilders;
|
18
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
19
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
@@ -93,18 +94,16 @@ public class CutpriceConfigIndexBaseService { |
|
@@ -93,18 +94,16 @@ public class CutpriceConfigIndexBaseService { |
93
|
|
94
|
|
94
|
public void fillIsProductCutPrice(List<Map<String, Object>> productList) {
|
95
|
public void fillIsProductCutPrice(List<Map<String, Object>> productList) {
|
95
|
try {
|
96
|
try {
|
96
|
- //List<Integer> productCutpriceConfigPoolIds = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY);
|
|
|
97
|
- List<Integer> productCutpriceConfigPoolIds = this.buildCurrentProductCutpricePoolIds();
|
|
|
98
|
- if (productCutpriceConfigPoolIds == null || productCutpriceConfigPoolIds.isEmpty()) {
|
|
|
99
|
- return;
|
|
|
100
|
- }
|
97
|
+ List<Integer> productCutpriceConfigPoolIds = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY);
|
101
|
for (Map<String, Object> product : productList) {
|
98
|
for (Map<String, Object> product : productList) {
|
102
|
try {
|
99
|
try {
|
103
|
- String productPoolIdStr = MapUtils.getString(product, PRODUCTINDEX_FIELD_POOLIDS, "");
|
100
|
+ String productPoolIdStr = MapUtils.getString(product, "pool_ids", "");
|
104
|
boolean is_product_cutprice = this.isProductCutprice(productCutpriceConfigPoolIds, productPoolIdStr);
|
101
|
boolean is_product_cutprice = this.isProductCutprice(productCutpriceConfigPoolIds, productPoolIdStr);
|
105
|
product.put("is_product_cutprice", is_product_cutprice ? "Y" : "N");
|
102
|
product.put("is_product_cutprice", is_product_cutprice ? "Y" : "N");
|
106
|
} catch (Exception e) {
|
103
|
} catch (Exception e) {
|
107
|
logger.error(e.getMessage(), e);
|
104
|
logger.error(e.getMessage(), e);
|
|
|
105
|
+ }finally {
|
|
|
106
|
+ product.remove("pool_ids");
|
108
|
}
|
107
|
}
|
109
|
}
|
108
|
}
|
110
|
} catch (Exception e) {
|
109
|
} catch (Exception e) {
|
|
@@ -113,6 +112,12 @@ public class CutpriceConfigIndexBaseService { |
|
@@ -113,6 +112,12 @@ public class CutpriceConfigIndexBaseService { |
113
|
}
|
112
|
}
|
114
|
|
113
|
|
115
|
private boolean isProductCutprice(List<Integer> currentCutPricePoolIds, String productPoolIdStr) {
|
114
|
private boolean isProductCutprice(List<Integer> currentCutPricePoolIds, String productPoolIdStr) {
|
|
|
115
|
+ if (currentCutPricePoolIds == null || currentCutPricePoolIds.isEmpty()) {
|
|
|
116
|
+ return false;
|
|
|
117
|
+ }
|
|
|
118
|
+ if (StringUtils.isEmpty(productPoolIdStr)) {
|
|
|
119
|
+ return false;
|
|
|
120
|
+ }
|
116
|
List<Integer> productPoolIdList = ConvertUtils.stringToIntList(productPoolIdStr, ",");
|
121
|
List<Integer> productPoolIdList = ConvertUtils.stringToIntList(productPoolIdStr, ",");
|
117
|
for (Integer pool : productPoolIdList) {
|
122
|
for (Integer pool : productPoolIdList) {
|
118
|
if (currentCutPricePoolIds.contains(pool)) {
|
123
|
if (currentCutPricePoolIds.contains(pool)) {
|