|
@@ -8,7 +8,6 @@ import java.util.Comparator; |
|
@@ -8,7 +8,6 @@ import java.util.Comparator; |
8
|
import java.util.Date;
|
8
|
import java.util.Date;
|
9
|
import java.util.List;
|
9
|
import java.util.List;
|
10
|
import java.util.Map;
|
10
|
import java.util.Map;
|
11
|
-import java.util.function.Function;
|
|
|
12
|
import java.util.stream.Collectors;
|
11
|
import java.util.stream.Collectors;
|
13
|
|
12
|
|
14
|
import com.yoho.core.config.ConfigReader;
|
13
|
import com.yoho.core.config.ConfigReader;
|
|
@@ -31,17 +30,19 @@ import com.alibaba.fastjson.JSONArray; |
|
@@ -31,17 +30,19 @@ import com.alibaba.fastjson.JSONArray; |
31
|
import com.alibaba.fastjson.JSONObject;
|
30
|
import com.alibaba.fastjson.JSONObject;
|
32
|
import com.google.common.collect.Lists;
|
31
|
import com.google.common.collect.Lists;
|
33
|
import com.yoho.core.common.utils.DateUtil;
|
32
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
33
|
+import com.yoho.core.config.ConfigReader;
|
34
|
import com.yoho.core.rest.client.ServiceCaller;
|
34
|
import com.yoho.core.rest.client.ServiceCaller;
|
35
|
import com.yoho.core.rest.exception.ServiceNotAvaibleException;
|
35
|
import com.yoho.core.rest.exception.ServiceNotAvaibleException;
|
|
|
36
|
+import com.yohobuy.ufo.model.promotion.response.CouponInfo;
|
|
|
37
|
+import com.yohoufo.common.ApiResponse;
|
36
|
import com.yohoufo.common.cache.Cachable;
|
38
|
import com.yohoufo.common.cache.Cachable;
|
37
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
39
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
38
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
40
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
39
|
import com.yohoufo.common.utils.UfoStringUtils;
|
41
|
import com.yohoufo.common.utils.UfoStringUtils;
|
|
|
42
|
+import com.yohoufo.dal.product.BrandMapper;
|
40
|
import com.yohoufo.dal.product.ProductMapper;
|
43
|
import com.yohoufo.dal.product.ProductMapper;
|
41
|
-import com.yohoufo.dal.product.ProductSalesMapper;
|
|
|
42
|
import com.yohoufo.dal.product.ProductSortMapper;
|
44
|
import com.yohoufo.dal.product.ProductSortMapper;
|
43
|
import com.yohoufo.dal.product.model.Product;
|
45
|
import com.yohoufo.dal.product.model.Product;
|
44
|
-import com.yohoufo.dal.product.model.ProductSales;
|
|
|
45
|
import com.yohoufo.dal.product.model.ProductSort;
|
46
|
import com.yohoufo.dal.product.model.ProductSort;
|
46
|
import com.yohoufo.product.helper.SearchParam;
|
47
|
import com.yohoufo.product.helper.SearchParam;
|
47
|
import com.yohoufo.product.model.FilterItem;
|
48
|
import com.yohoufo.product.model.FilterItem;
|
|
@@ -93,9 +94,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -93,9 +94,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
93
|
@Autowired
|
94
|
@Autowired
|
94
|
private ProductSearchAssistService productSearchAssistService;
|
95
|
private ProductSearchAssistService productSearchAssistService;
|
95
|
|
96
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
private JSONObject search(Map<String, Object> searchParams, String url) {
|
97
|
private JSONObject search(Map<String, Object> searchParams, String url) {
|
100
|
logger.info("begin invoke search.productList, param is:{}, url is :{}", searchParams, url);
|
98
|
logger.info("begin invoke search.productList, param is:{}, url is :{}", searchParams, url);
|
101
|
String resultJsonStr = null;
|
99
|
String resultJsonStr = null;
|
|
@@ -226,6 +224,26 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -226,6 +224,26 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
226
|
}
|
224
|
}
|
227
|
}
|
225
|
}
|
228
|
|
226
|
|
|
|
227
|
+ /**
|
|
|
228
|
+ * 对二手商品列表的信息进行修改,商品图片地址URL补全
|
|
|
229
|
+ *
|
|
|
230
|
+ */
|
|
|
231
|
+ protected void processSecondhandSkupList(JSONArray skupList) {
|
|
|
232
|
+ if(CollectionUtils.isEmpty(skupList)){
|
|
|
233
|
+ return;
|
|
|
234
|
+ }
|
|
|
235
|
+ // 遍历商品列表
|
|
|
236
|
+ for (int i = 0; i < skupList.size(); i++) {
|
|
|
237
|
+ JSONObject product = skupList.getJSONObject(i);
|
|
|
238
|
+ if(null == product){
|
|
|
239
|
+ continue;
|
|
|
240
|
+ }
|
|
|
241
|
+ // 处理图片,封面图设置
|
|
|
242
|
+ String secondhand_image = fillProductImgUrl(MapUtils.getString(product, "secondhand_image", ""));
|
|
|
243
|
+ product.replace("secondhand_image", secondhand_image);
|
|
|
244
|
+ }
|
|
|
245
|
+ }
|
|
|
246
|
+
|
229
|
public static void main(String[] args) {
|
247
|
public static void main(String[] args) {
|
230
|
System.out.println(fillProductImgUrl("https://img12.static.yhbimg.com/goodsimg/2019/04/17/17/021560b1bd437ded9a66dd15c29c81c53d.jpg"));
|
248
|
System.out.println(fillProductImgUrl("https://img12.static.yhbimg.com/goodsimg/2019/04/17/17/021560b1bd437ded9a66dd15c29c81c53d.jpg"));
|
231
|
}
|
249
|
}
|
|
@@ -744,6 +762,19 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -744,6 +762,19 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
744
|
return resp;
|
762
|
return resp;
|
745
|
}
|
763
|
}
|
746
|
|
764
|
|
|
|
765
|
+ @Override
|
|
|
766
|
+ public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
|
|
|
767
|
+ SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
768
|
+ String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
|
|
|
769
|
+ JSONObject data = search(searchParam.getParam(), url);
|
|
|
770
|
+ // 将图片的相对路径转成绝对路径
|
|
|
771
|
+ if (null != data) {
|
|
|
772
|
+ processSecondhandSkupList(data.getJSONArray("skup_list"));
|
|
|
773
|
+ }
|
|
|
774
|
+
|
|
|
775
|
+ return data;
|
|
|
776
|
+ }
|
|
|
777
|
+
|
747
|
// NFC详情分享页列表要保证 3的倍数,这里做最后的保证
|
778
|
// NFC详情分享页列表要保证 3的倍数,这里做最后的保证
|
748
|
private void regularize(JSONArray productList) {
|
779
|
private void regularize(JSONArray productList) {
|
749
|
if(CollectionUtils.isEmpty(productList)){
|
780
|
if(CollectionUtils.isEmpty(productList)){
|