...
|
...
|
@@ -62,15 +62,8 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(ProductSearchServiceImpl.class);
|
|
|
|
|
|
// 如果是NFC分享页面列表,则传1
|
|
|
private final static Integer REGULARIZE_NFC = 1;
|
|
|
private final static Integer REGULARIZE_NFC = 1; // 如果是NFC分享页面列表,则传1
|
|
|
|
|
|
@Value("${ip.port.search.server}")
|
|
|
private String searchServerIpAndPort;
|
|
|
|
|
|
@Autowired
|
|
|
private ServiceCaller serviceCaller;
|
|
|
|
|
|
@Autowired
|
|
|
private UfoServiceCaller ufoServiceCaller;
|
|
|
|
...
|
...
|
@@ -89,42 +82,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
@Autowired
|
|
|
private ProductSearchAssistService searchAssistService;
|
|
|
|
|
|
private JSONObject search(Map<String, Object> searchParams, String url) {
|
|
|
logger.info("begin invoke search.productList, param is:{}, url is :{}", searchParams, url);
|
|
|
String resultJsonStr = null;
|
|
|
try {
|
|
|
resultJsonStr = serviceCaller.get("search.productList", "http://" + searchServerIpAndPort + url, searchParams, String.class, null).get(1);
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("The result of search product list find wrong. url {}: ", url, e);
|
|
|
throw new ServiceNotAvaibleException("search server!!!", e);
|
|
|
}
|
|
|
JSONObject searchResult = null;
|
|
|
try {
|
|
|
searchResult = JSONObject.parseObject(resultJsonStr);
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("The result of search product list is not string of json. result:{}", resultJsonStr, e);
|
|
|
return null;
|
|
|
}
|
|
|
if (null == searchResult) {
|
|
|
logger.warn("searchResult is null. params : {} ", searchParams);
|
|
|
return null;
|
|
|
}
|
|
|
// 取出搜索接口真实查询的列表结果
|
|
|
JSONObject data;
|
|
|
try {
|
|
|
data = searchResult.getJSONObject("data");
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("The result of search product list is not string of json. searchResult:{}", searchResult, e);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
if (null == data) {
|
|
|
logger.info("The data field of search product list is null. params : {} ", searchParams);
|
|
|
return null;
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject searchProductList(ProductSearchReq req) {
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
...
|
...
|
@@ -166,7 +123,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
searchParam.setShowChannel(req.getBusinessClient());
|
|
|
url = ProductSearchConstants.PRODUCT_POOL_URL;
|
|
|
}
|
|
|
JSONObject data = search(searchParam.getParam(), url);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
...
|
...
|
@@ -181,7 +138,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
req.setNotBrand(StringUtils.join(brandMapper.selectExcludeAppraise(), ","));
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
String url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL;
|
|
|
JSONObject data = search(searchParam.getParam(), url);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
...
|
...
|
@@ -194,7 +151,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
@Override
|
|
|
public JSONObject searchSuggest(ProductSearchReq req) {
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.SUGGEST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.SUGGEST_URL);
|
|
|
return data;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -255,7 +212,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
/*if (req.getMaxSort() == null && req.getMidSort() == null) {
|
|
|
searchParam.setXianYuSort(req.getBusinessClient(), configReader);
|
|
|
}*/
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.FILTER_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.FILTER_LIST_URL);
|
|
|
SearchProductListFilterResp resp = new SearchProductListFilterResp();
|
|
|
if (data != null) {
|
|
|
JSONObject filterData = data.getJSONObject("filter");
|
...
|
...
|
@@ -357,7 +314,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
SearchParam searchParam = new SearchParam().setShowChannel(businessClient);
|
|
|
//searchParam.setXianYuSort(businessClient, configReader); //闲鱼改成全品类 如果是闲鱼请求,则设置大品类
|
|
|
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL);
|
|
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("brand_list"))) {
|
|
|
resp = JSON.toJavaObject(data, SearchBrandListResp.class);
|
|
|
|
...
|
...
|
@@ -379,7 +336,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName());
|
|
|
SearchParam searchParam = new SearchParam().buildSearchParam(req);
|
|
|
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_LIST_URL);
|
|
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
|
|
|
searchAssistService.processProductSales(data.getJSONArray("product_list"));
|
|
|
resp = JSON.toJavaObject(data, SearchProductRecommendResp.class);
|
...
|
...
|
@@ -421,7 +378,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
public List<ProductBrandSeriesResp> searchSeriesList() {
|
|
|
List<ProductBrandSeriesResp> respList = new ArrayList<>();
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.SERIES_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.SERIES_LIST_URL);
|
|
|
JSONArray series;
|
|
|
if (data != null && !CollectionUtils.isEmpty(series = data.getJSONArray("series_list"))) {
|
|
|
for (int i = 0; i < series.size(); i++) {
|
...
|
...
|
@@ -467,7 +424,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
type = "";
|
|
|
}
|
|
|
searchParam.setType(type);
|
|
|
countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
|
|
countMap = searchAssistService.search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
|
|
} catch (Exception e) {
|
|
|
logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
|
|
}
|
...
|
...
|
@@ -502,7 +459,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
ProductSearchReq req = new ProductSearchReq();
|
|
|
req.setStartTime(startTime).setEndTime(endTime);
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.SALE_CALENDAR_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.SALE_CALENDAR_LIST_URL);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
...
|
...
|
@@ -520,7 +477,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
type = "";
|
|
|
}
|
|
|
searchParam.setType(type);
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.NEW_SALE_CALENDAR_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.NEW_SALE_CALENDAR_LIST_URL);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
...
|
...
|
@@ -532,7 +489,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
public JSONObject searchHotSale(Integer page, Integer limit, String businessClient) {
|
|
|
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page);
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(businessClient);
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
...
|
...
|
@@ -548,7 +505,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
}
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
|
|
|
String url = ProductSearchConstants.PRODUCT_UVSCORE_LIST_URL;
|
|
|
JSONObject data = search(searchParam.getParam(), url);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processProductList(data.getJSONArray("product_list"));
|
...
|
...
|
@@ -576,7 +533,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
}
|
|
|
SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(businessClient);
|
|
|
|
|
|
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL);
|
|
|
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
|
|
|
searchAssistService.processProductSales(data.getJSONArray("product_list"));
|
|
|
resp = JSON.toJavaObject(data, SearchProductRecommendResp.class);
|
...
|
...
|
@@ -596,7 +553,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
|
|
|
String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
|
|
|
JSONObject data = search(searchParam.getParam(), url);
|
|
|
JSONObject data = searchAssistService.search(searchParam.getParam(), url);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
searchAssistService.processSecondhandSkupList(data.getJSONArray("skup_list"));
|
...
|
...
|
|