|
@@ -62,15 +62,8 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -62,15 +62,8 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
62
|
|
62
|
|
63
|
private static Logger logger = LoggerFactory.getLogger(ProductSearchServiceImpl.class);
|
63
|
private static Logger logger = LoggerFactory.getLogger(ProductSearchServiceImpl.class);
|
64
|
|
64
|
|
65
|
- // 如果是NFC分享页面列表,则传1
|
|
|
66
|
- private final static Integer REGULARIZE_NFC = 1;
|
65
|
+ private final static Integer REGULARIZE_NFC = 1; // 如果是NFC分享页面列表,则传1
|
67
|
|
66
|
|
68
|
- @Value("${ip.port.search.server}")
|
|
|
69
|
- private String searchServerIpAndPort;
|
|
|
70
|
-
|
|
|
71
|
- @Autowired
|
|
|
72
|
- private ServiceCaller serviceCaller;
|
|
|
73
|
-
|
|
|
74
|
@Autowired
|
67
|
@Autowired
|
75
|
private UfoServiceCaller ufoServiceCaller;
|
68
|
private UfoServiceCaller ufoServiceCaller;
|
76
|
|
69
|
|
|
@@ -89,42 +82,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -89,42 +82,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
89
|
@Autowired
|
82
|
@Autowired
|
90
|
private ProductSearchAssistService searchAssistService;
|
83
|
private ProductSearchAssistService searchAssistService;
|
91
|
|
84
|
|
92
|
- private JSONObject search(Map<String, Object> searchParams, String url) {
|
|
|
93
|
- logger.info("begin invoke search.productList, param is:{}, url is :{}", searchParams, url);
|
|
|
94
|
- String resultJsonStr = null;
|
|
|
95
|
- try {
|
|
|
96
|
- resultJsonStr = serviceCaller.get("search.productList", "http://" + searchServerIpAndPort + url, searchParams, String.class, null).get(1);
|
|
|
97
|
- } catch (Exception e) {
|
|
|
98
|
- logger.warn("The result of search product list find wrong. url {}: ", url, e);
|
|
|
99
|
- throw new ServiceNotAvaibleException("search server!!!", e);
|
|
|
100
|
- }
|
|
|
101
|
- JSONObject searchResult = null;
|
|
|
102
|
- try {
|
|
|
103
|
- searchResult = JSONObject.parseObject(resultJsonStr);
|
|
|
104
|
- } catch (Exception e) {
|
|
|
105
|
- logger.warn("The result of search product list is not string of json. result:{}", resultJsonStr, e);
|
|
|
106
|
- return null;
|
|
|
107
|
- }
|
|
|
108
|
- if (null == searchResult) {
|
|
|
109
|
- logger.warn("searchResult is null. params : {} ", searchParams);
|
|
|
110
|
- return null;
|
|
|
111
|
- }
|
|
|
112
|
- // 取出搜索接口真实查询的列表结果
|
|
|
113
|
- JSONObject data;
|
|
|
114
|
- try {
|
|
|
115
|
- data = searchResult.getJSONObject("data");
|
|
|
116
|
- } catch (Exception e) {
|
|
|
117
|
- logger.warn("The result of search product list is not string of json. searchResult:{}", searchResult, e);
|
|
|
118
|
- return null;
|
|
|
119
|
- }
|
|
|
120
|
-
|
|
|
121
|
- if (null == data) {
|
|
|
122
|
- logger.info("The data field of search product list is null. params : {} ", searchParams);
|
|
|
123
|
- return null;
|
|
|
124
|
- }
|
|
|
125
|
- return data;
|
|
|
126
|
- }
|
|
|
127
|
-
|
|
|
128
|
@Override
|
85
|
@Override
|
129
|
public JSONObject searchProductList(ProductSearchReq req) {
|
86
|
public JSONObject searchProductList(ProductSearchReq req) {
|
130
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
87
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
@@ -166,7 +123,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -166,7 +123,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
166
|
searchParam.setShowChannel(req.getBusinessClient());
|
123
|
searchParam.setShowChannel(req.getBusinessClient());
|
167
|
url = ProductSearchConstants.PRODUCT_POOL_URL;
|
124
|
url = ProductSearchConstants.PRODUCT_POOL_URL;
|
168
|
}
|
125
|
}
|
169
|
- JSONObject data = search(searchParam.getParam(), url);
|
126
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
170
|
// 将图片的相对路径转成绝对路径
|
127
|
// 将图片的相对路径转成绝对路径
|
171
|
if (null != data) {
|
128
|
if (null != data) {
|
172
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
129
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
|
@@ -181,7 +138,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -181,7 +138,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
181
|
req.setNotBrand(StringUtils.join(brandMapper.selectExcludeAppraise(), ","));
|
138
|
req.setNotBrand(StringUtils.join(brandMapper.selectExcludeAppraise(), ","));
|
182
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
139
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
183
|
String url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL;
|
140
|
String url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL;
|
184
|
- JSONObject data = search(searchParam.getParam(), url);
|
141
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
185
|
// 将图片的相对路径转成绝对路径
|
142
|
// 将图片的相对路径转成绝对路径
|
186
|
if (null != data) {
|
143
|
if (null != data) {
|
187
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
144
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
|
@@ -194,7 +151,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -194,7 +151,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
194
|
@Override
|
151
|
@Override
|
195
|
public JSONObject searchSuggest(ProductSearchReq req) {
|
152
|
public JSONObject searchSuggest(ProductSearchReq req) {
|
196
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
153
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
197
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.SUGGEST_URL);
|
154
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.SUGGEST_URL);
|
198
|
return data;
|
155
|
return data;
|
199
|
}
|
156
|
}
|
200
|
|
157
|
|
|
@@ -255,7 +212,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -255,7 +212,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
255
|
/*if (req.getMaxSort() == null && req.getMidSort() == null) {
|
212
|
/*if (req.getMaxSort() == null && req.getMidSort() == null) {
|
256
|
searchParam.setXianYuSort(req.getBusinessClient(), configReader);
|
213
|
searchParam.setXianYuSort(req.getBusinessClient(), configReader);
|
257
|
}*/
|
214
|
}*/
|
258
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.FILTER_LIST_URL);
|
215
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.FILTER_LIST_URL);
|
259
|
SearchProductListFilterResp resp = new SearchProductListFilterResp();
|
216
|
SearchProductListFilterResp resp = new SearchProductListFilterResp();
|
260
|
if (data != null) {
|
217
|
if (data != null) {
|
261
|
JSONObject filterData = data.getJSONObject("filter");
|
218
|
JSONObject filterData = data.getJSONObject("filter");
|
|
@@ -357,7 +314,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -357,7 +314,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
357
|
SearchParam searchParam = new SearchParam().setShowChannel(businessClient);
|
314
|
SearchParam searchParam = new SearchParam().setShowChannel(businessClient);
|
358
|
//searchParam.setXianYuSort(businessClient, configReader); //闲鱼改成全品类 如果是闲鱼请求,则设置大品类
|
315
|
//searchParam.setXianYuSort(businessClient, configReader); //闲鱼改成全品类 如果是闲鱼请求,则设置大品类
|
359
|
|
316
|
|
360
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL);
|
317
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL);
|
361
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("brand_list"))) {
|
318
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("brand_list"))) {
|
362
|
resp = JSON.toJavaObject(data, SearchBrandListResp.class);
|
319
|
resp = JSON.toJavaObject(data, SearchBrandListResp.class);
|
363
|
|
320
|
|
|
@@ -379,7 +336,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -379,7 +336,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
379
|
ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName());
|
336
|
ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName());
|
380
|
SearchParam searchParam = new SearchParam().buildSearchParam(req);
|
337
|
SearchParam searchParam = new SearchParam().buildSearchParam(req);
|
381
|
|
338
|
|
382
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_LIST_URL);
|
339
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_LIST_URL);
|
383
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
|
340
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
|
384
|
searchAssistService.processProductSales(data.getJSONArray("product_list"));
|
341
|
searchAssistService.processProductSales(data.getJSONArray("product_list"));
|
385
|
resp = JSON.toJavaObject(data, SearchProductRecommendResp.class);
|
342
|
resp = JSON.toJavaObject(data, SearchProductRecommendResp.class);
|
|
@@ -421,7 +378,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -421,7 +378,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
421
|
public List<ProductBrandSeriesResp> searchSeriesList() {
|
378
|
public List<ProductBrandSeriesResp> searchSeriesList() {
|
422
|
List<ProductBrandSeriesResp> respList = new ArrayList<>();
|
379
|
List<ProductBrandSeriesResp> respList = new ArrayList<>();
|
423
|
SearchParam searchParam = new SearchParam();
|
380
|
SearchParam searchParam = new SearchParam();
|
424
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.SERIES_LIST_URL);
|
381
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.SERIES_LIST_URL);
|
425
|
JSONArray series;
|
382
|
JSONArray series;
|
426
|
if (data != null && !CollectionUtils.isEmpty(series = data.getJSONArray("series_list"))) {
|
383
|
if (data != null && !CollectionUtils.isEmpty(series = data.getJSONArray("series_list"))) {
|
427
|
for (int i = 0; i < series.size(); i++) {
|
384
|
for (int i = 0; i < series.size(); i++) {
|
|
@@ -467,7 +424,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -467,7 +424,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
467
|
type = "";
|
424
|
type = "";
|
468
|
}
|
425
|
}
|
469
|
searchParam.setType(type);
|
426
|
searchParam.setType(type);
|
470
|
- countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
427
|
+ countMap = searchAssistService.search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
471
|
} catch (Exception e) {
|
428
|
} catch (Exception e) {
|
472
|
logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
429
|
logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
473
|
}
|
430
|
}
|
|
@@ -502,7 +459,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -502,7 +459,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
502
|
ProductSearchReq req = new ProductSearchReq();
|
459
|
ProductSearchReq req = new ProductSearchReq();
|
503
|
req.setStartTime(startTime).setEndTime(endTime);
|
460
|
req.setStartTime(startTime).setEndTime(endTime);
|
504
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
461
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
505
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.SALE_CALENDAR_LIST_URL);
|
462
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.SALE_CALENDAR_LIST_URL);
|
506
|
// 将图片的相对路径转成绝对路径
|
463
|
// 将图片的相对路径转成绝对路径
|
507
|
if (null != data) {
|
464
|
if (null != data) {
|
508
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
465
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
|
@@ -520,7 +477,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -520,7 +477,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
520
|
type = "";
|
477
|
type = "";
|
521
|
}
|
478
|
}
|
522
|
searchParam.setType(type);
|
479
|
searchParam.setType(type);
|
523
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.NEW_SALE_CALENDAR_LIST_URL);
|
480
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.NEW_SALE_CALENDAR_LIST_URL);
|
524
|
// 将图片的相对路径转成绝对路径
|
481
|
// 将图片的相对路径转成绝对路径
|
525
|
if (null != data) {
|
482
|
if (null != data) {
|
526
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
483
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
|
@@ -532,7 +489,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -532,7 +489,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
532
|
public JSONObject searchHotSale(Integer page, Integer limit, String businessClient) {
|
489
|
public JSONObject searchHotSale(Integer page, Integer limit, String businessClient) {
|
533
|
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page);
|
490
|
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page);
|
534
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(businessClient);
|
491
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(businessClient);
|
535
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL);
|
492
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL);
|
536
|
// 将图片的相对路径转成绝对路径
|
493
|
// 将图片的相对路径转成绝对路径
|
537
|
if (null != data) {
|
494
|
if (null != data) {
|
538
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
495
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
|
@@ -548,7 +505,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -548,7 +505,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
548
|
}
|
505
|
}
|
549
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
|
506
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
|
550
|
String url = ProductSearchConstants.PRODUCT_UVSCORE_LIST_URL;
|
507
|
String url = ProductSearchConstants.PRODUCT_UVSCORE_LIST_URL;
|
551
|
- JSONObject data = search(searchParam.getParam(), url);
|
508
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
552
|
// 将图片的相对路径转成绝对路径
|
509
|
// 将图片的相对路径转成绝对路径
|
553
|
if (null != data) {
|
510
|
if (null != data) {
|
554
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
511
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
|
@@ -576,7 +533,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -576,7 +533,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
576
|
}
|
533
|
}
|
577
|
SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(businessClient);
|
534
|
SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(businessClient);
|
578
|
|
535
|
|
579
|
- JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL);
|
536
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL);
|
580
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
|
537
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
|
581
|
searchAssistService.processProductSales(data.getJSONArray("product_list"));
|
538
|
searchAssistService.processProductSales(data.getJSONArray("product_list"));
|
582
|
resp = JSON.toJavaObject(data, SearchProductRecommendResp.class);
|
539
|
resp = JSON.toJavaObject(data, SearchProductRecommendResp.class);
|
|
@@ -596,7 +553,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -596,7 +553,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
596
|
public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
|
553
|
public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
|
597
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
|
554
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
|
598
|
String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
|
555
|
String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
|
599
|
- JSONObject data = search(searchParam.getParam(), url);
|
556
|
+ JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
600
|
// 将图片的相对路径转成绝对路径
|
557
|
// 将图片的相对路径转成绝对路径
|
601
|
if (null != data) {
|
558
|
if (null != data) {
|
602
|
searchAssistService.processSecondhandSkupList(data.getJSONArray("skup_list"));
|
559
|
searchAssistService.processSecondhandSkupList(data.getJSONArray("skup_list"));
|