Authored by mali

展示渠道

... ... @@ -359,9 +359,10 @@ public class ProductSearchController {
@Cachable(expire = 600)
public ApiResponse searchSecondhandSkupList(@RequestParam(value = "preSale_flag", required = false)Integer preSaleFlag,
@RequestParam(value = "limit", required = false)Integer limit,
@RequestParam(value = "page", required = false)Integer page) {
LOG.info("in method=ufo.product.search.secondhand.skupList preSale_flag={}", preSaleFlag);
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setPreSaleFlag(preSaleFlag);
@RequestParam(value = "page", required = false)Integer page,
@RequestParam(value = "business_client", required = false) String businessClient) {
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setPreSaleFlag(preSaleFlag).setBusinessClient(businessClient);
LOG.info("in method=ufo.product.search.secondhand.skupList req={}", req);
JSONObject resp = productSearchService.searchSecondhandSkupList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("secondhand skupList.").data(resp).build();
}
... ...
... ... @@ -100,7 +100,7 @@ public final class SearchConstants {
String EXCLUDE_LIMIT = "isFilterLimitSale";
String showChannel = "showChannel";
String SHOW_CHANNEL = "showChannel";
}
... ... @@ -117,5 +117,9 @@ public final class SearchConstants {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return value;
}
}
}
... ...
... ... @@ -247,6 +247,17 @@ public class SearchParam {
return this;
}
public SearchParam setShowChannel(String businessClient) {
if (StringUtils.isNotBlank(businessClient) && BusinessClientEnum.isXianYu(businessClient)) {
param.put(SearchConstants.IndexNameConstant.SHOW_CHANNEL,
SearchConstants.ShowChannelEnum.SHOW_CHANNEL_XIANYU.getValue());
} else {
param.put(SearchConstants.IndexNameConstant.SHOW_CHANNEL,
SearchConstants.ShowChannelEnum.SHOW_CHANNEL_UFO.getValue());
}
return this;
}
/**
* 每次查询的条数
*
... ...
... ... @@ -81,9 +81,6 @@ public class ProductSearchServiceImpl implements ProductSearchService {
private BrandMapper brandMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private ConfigReader configReader;
@Autowired
... ... @@ -154,16 +151,19 @@ public class ProductSearchServiceImpl implements ProductSearchService {
req.setId(info.getContainsProductIds());
req.setNot_id(info.getExcludeProductIds());
logger.info("contains {} ex {}",info.getContainsProductIds(), info.getExcludeProductIds());
searchParam = new SearchParam().buildPageSearchParam(req);
searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
} else if (StringUtils.equals("Y", req.getIsSoonSale())) {
url = ProductSearchConstants.SOON_SALE_PRODUCT_LIST_URL;
} else if (StringUtils.equals("Y", req.getIsIdFilter())) {
url = ProductSearchConstants.FAVORITE_PRODUCT_LIST_URL;
} else if (StringUtils.isNotBlank(req.getQuery())
|| (req.getSearchType() != null && req.getSearchType() == 6)) {
searchParam.setShowChannel(req.getBusinessClient());
url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL;
} else if (StringUtils.isNotBlank(req.getPool())
|| (req.getSearchType() != null && (req.getSearchType() == 0 || req.getSearchType() == 1))) {
searchParam.setShowChannel(req.getBusinessClient());
url = ProductSearchConstants.PRODUCT_POOL_URL;
}
JSONObject data = search(searchParam.getParam(), url);
... ... @@ -251,7 +251,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
req.setId(info.getContainsProductIds());
req.setNot_id(info.getExcludeProductIds());
}
SearchParam searchParam = new SearchParam().buildSearchParam(req);
SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(req.getBusinessClient());;
/*if (req.getMaxSort() == null && req.getMidSort() == null) {
searchParam.setXianYuSort(req.getBusinessClient(), configReader);
}*/
... ... @@ -354,7 +354,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
@Override
public SearchBrandListResp searchBrandList(String businessClient) {
SearchBrandListResp resp = new SearchBrandListResp();
SearchParam searchParam = new SearchParam();
SearchParam searchParam = new SearchParam().setShowChannel(businessClient);
//searchParam.setXianYuSort(businessClient, configReader); //闲鱼改成全品类 如果是闲鱼请求,则设置大品类
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL);
... ... @@ -374,7 +374,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
@Override
public SearchProductRecommendResp searchProductRecommendById(Integer productId, String businessClient) {
SearchProductRecommendResp resp = new SearchProductRecommendResp();
Product product = productMapper.selectByPrimaryKey(productId);
Product product = productHelpService.selectByIdCache(productId);
if (product != null) {
ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName());
SearchParam searchParam = new SearchParam().buildSearchParam(req);
... ... @@ -531,7 +531,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
@Override
public JSONObject searchHotSale(Integer page, Integer limit, String businessClient) {
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page);
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(businessClient);
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL);
// 将图片的相对路径转成绝对路径
if (null != data) {
... ... @@ -546,7 +546,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
if (REGULARIZE_NFC.equals(regularize)) { // NFC分享页列表 需要返回18个商品
req.setViewNum(18);
}
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
String url = ProductSearchConstants.PRODUCT_UVSCORE_LIST_URL;
JSONObject data = search(searchParam.getParam(), url);
// 将图片的相对路径转成绝对路径
... ... @@ -574,7 +574,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
if(null != product.getSeriesId() && product.getSeriesId().intValue() != 0) {
req.setSeries(product.getSeriesId() + "");
}
SearchParam searchParam = new SearchParam().buildSearchParam(req);
SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(businessClient);
JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL);
if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
... ... @@ -594,7 +594,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
@Override
public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
JSONObject data = search(searchParam.getParam(), url);
// 将图片的相对路径转成绝对路径
... ...