Authored by mali

展示渠道

@@ -359,9 +359,10 @@ public class ProductSearchController { @@ -359,9 +359,10 @@ public class ProductSearchController {
359 @Cachable(expire = 600) 359 @Cachable(expire = 600)
360 public ApiResponse searchSecondhandSkupList(@RequestParam(value = "preSale_flag", required = false)Integer preSaleFlag, 360 public ApiResponse searchSecondhandSkupList(@RequestParam(value = "preSale_flag", required = false)Integer preSaleFlag,
361 @RequestParam(value = "limit", required = false)Integer limit, 361 @RequestParam(value = "limit", required = false)Integer limit,
362 - @RequestParam(value = "page", required = false)Integer page) {  
363 - LOG.info("in method=ufo.product.search.secondhand.skupList preSale_flag={}", preSaleFlag);  
364 - ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setPreSaleFlag(preSaleFlag); 362 + @RequestParam(value = "page", required = false)Integer page,
  363 + @RequestParam(value = "business_client", required = false) String businessClient) {
  364 + ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setPreSaleFlag(preSaleFlag).setBusinessClient(businessClient);
  365 + LOG.info("in method=ufo.product.search.secondhand.skupList req={}", req);
365 JSONObject resp = productSearchService.searchSecondhandSkupList(req); 366 JSONObject resp = productSearchService.searchSecondhandSkupList(req);
366 return new ApiResponse.ApiResponseBuilder().code(200).message("secondhand skupList.").data(resp).build(); 367 return new ApiResponse.ApiResponseBuilder().code(200).message("secondhand skupList.").data(resp).build();
367 } 368 }
@@ -100,7 +100,7 @@ public final class SearchConstants { @@ -100,7 +100,7 @@ public final class SearchConstants {
100 String EXCLUDE_LIMIT = "isFilterLimitSale"; 100 String EXCLUDE_LIMIT = "isFilterLimitSale";
101 101
102 102
103 - String showChannel = "showChannel"; 103 + String SHOW_CHANNEL = "showChannel";
104 } 104 }
105 105
106 106
@@ -117,5 +117,9 @@ public final class SearchConstants { @@ -117,5 +117,9 @@ public final class SearchConstants {
117 this.value = value; 117 this.value = value;
118 this.desc = desc; 118 this.desc = desc;
119 } 119 }
  120 +
  121 + public Integer getValue() {
  122 + return value;
  123 + }
120 } 124 }
121 } 125 }
@@ -247,6 +247,17 @@ public class SearchParam { @@ -247,6 +247,17 @@ public class SearchParam {
247 return this; 247 return this;
248 } 248 }
249 249
  250 + public SearchParam setShowChannel(String businessClient) {
  251 + if (StringUtils.isNotBlank(businessClient) && BusinessClientEnum.isXianYu(businessClient)) {
  252 + param.put(SearchConstants.IndexNameConstant.SHOW_CHANNEL,
  253 + SearchConstants.ShowChannelEnum.SHOW_CHANNEL_XIANYU.getValue());
  254 + } else {
  255 + param.put(SearchConstants.IndexNameConstant.SHOW_CHANNEL,
  256 + SearchConstants.ShowChannelEnum.SHOW_CHANNEL_UFO.getValue());
  257 + }
  258 + return this;
  259 + }
  260 +
250 /** 261 /**
251 * 每次查询的条数 262 * 每次查询的条数
252 * 263 *
@@ -81,9 +81,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -81,9 +81,6 @@ public class ProductSearchServiceImpl implements ProductSearchService {
81 private BrandMapper brandMapper; 81 private BrandMapper brandMapper;
82 82
83 @Autowired 83 @Autowired
84 - private ProductMapper productMapper;  
85 -  
86 - @Autowired  
87 private ConfigReader configReader; 84 private ConfigReader configReader;
88 85
89 @Autowired 86 @Autowired
@@ -154,16 +151,19 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -154,16 +151,19 @@ public class ProductSearchServiceImpl implements ProductSearchService {
154 req.setId(info.getContainsProductIds()); 151 req.setId(info.getContainsProductIds());
155 req.setNot_id(info.getExcludeProductIds()); 152 req.setNot_id(info.getExcludeProductIds());
156 logger.info("contains {} ex {}",info.getContainsProductIds(), info.getExcludeProductIds()); 153 logger.info("contains {} ex {}",info.getContainsProductIds(), info.getExcludeProductIds());
157 - searchParam = new SearchParam().buildPageSearchParam(req); 154 + searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
158 } else if (StringUtils.equals("Y", req.getIsSoonSale())) { 155 } else if (StringUtils.equals("Y", req.getIsSoonSale())) {
159 url = ProductSearchConstants.SOON_SALE_PRODUCT_LIST_URL; 156 url = ProductSearchConstants.SOON_SALE_PRODUCT_LIST_URL;
160 } else if (StringUtils.equals("Y", req.getIsIdFilter())) { 157 } else if (StringUtils.equals("Y", req.getIsIdFilter())) {
161 url = ProductSearchConstants.FAVORITE_PRODUCT_LIST_URL; 158 url = ProductSearchConstants.FAVORITE_PRODUCT_LIST_URL;
162 } else if (StringUtils.isNotBlank(req.getQuery()) 159 } else if (StringUtils.isNotBlank(req.getQuery())
163 || (req.getSearchType() != null && req.getSearchType() == 6)) { 160 || (req.getSearchType() != null && req.getSearchType() == 6)) {
  161 +
  162 + searchParam.setShowChannel(req.getBusinessClient());
164 url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL; 163 url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL;
165 } else if (StringUtils.isNotBlank(req.getPool()) 164 } else if (StringUtils.isNotBlank(req.getPool())
166 || (req.getSearchType() != null && (req.getSearchType() == 0 || req.getSearchType() == 1))) { 165 || (req.getSearchType() != null && (req.getSearchType() == 0 || req.getSearchType() == 1))) {
  166 + searchParam.setShowChannel(req.getBusinessClient());
167 url = ProductSearchConstants.PRODUCT_POOL_URL; 167 url = ProductSearchConstants.PRODUCT_POOL_URL;
168 } 168 }
169 JSONObject data = search(searchParam.getParam(), url); 169 JSONObject data = search(searchParam.getParam(), url);
@@ -251,7 +251,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -251,7 +251,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
251 req.setId(info.getContainsProductIds()); 251 req.setId(info.getContainsProductIds());
252 req.setNot_id(info.getExcludeProductIds()); 252 req.setNot_id(info.getExcludeProductIds());
253 } 253 }
254 - SearchParam searchParam = new SearchParam().buildSearchParam(req); 254 + SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(req.getBusinessClient());;
255 /*if (req.getMaxSort() == null && req.getMidSort() == null) { 255 /*if (req.getMaxSort() == null && req.getMidSort() == null) {
256 searchParam.setXianYuSort(req.getBusinessClient(), configReader); 256 searchParam.setXianYuSort(req.getBusinessClient(), configReader);
257 }*/ 257 }*/
@@ -354,7 +354,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -354,7 +354,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
354 @Override 354 @Override
355 public SearchBrandListResp searchBrandList(String businessClient) { 355 public SearchBrandListResp searchBrandList(String businessClient) {
356 SearchBrandListResp resp = new SearchBrandListResp(); 356 SearchBrandListResp resp = new SearchBrandListResp();
357 - SearchParam searchParam = new SearchParam(); 357 + SearchParam searchParam = new SearchParam().setShowChannel(businessClient);
358 //searchParam.setXianYuSort(businessClient, configReader); //闲鱼改成全品类 如果是闲鱼请求,则设置大品类 358 //searchParam.setXianYuSort(businessClient, configReader); //闲鱼改成全品类 如果是闲鱼请求,则设置大品类
359 359
360 JSONObject data = search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL); 360 JSONObject data = search(searchParam.getParam(), ProductSearchConstants.BRAND_LIST_URL);
@@ -374,7 +374,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -374,7 +374,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
374 @Override 374 @Override
375 public SearchProductRecommendResp searchProductRecommendById(Integer productId, String businessClient) { 375 public SearchProductRecommendResp searchProductRecommendById(Integer productId, String businessClient) {
376 SearchProductRecommendResp resp = new SearchProductRecommendResp(); 376 SearchProductRecommendResp resp = new SearchProductRecommendResp();
377 - Product product = productMapper.selectByPrimaryKey(productId); 377 + Product product = productHelpService.selectByIdCache(productId);
378 if (product != null) { 378 if (product != null) {
379 ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName()); 379 ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName());
380 SearchParam searchParam = new SearchParam().buildSearchParam(req); 380 SearchParam searchParam = new SearchParam().buildSearchParam(req);
@@ -531,7 +531,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -531,7 +531,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
531 @Override 531 @Override
532 public JSONObject searchHotSale(Integer page, Integer limit, String businessClient) { 532 public JSONObject searchHotSale(Integer page, Integer limit, String businessClient) {
533 ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page); 533 ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page);
534 - SearchParam searchParam = new SearchParam().buildPageSearchParam(req); 534 + SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(businessClient);
535 JSONObject data = search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL); 535 JSONObject data = search(searchParam.getParam(), ProductSearchConstants.HOT_SALE_LIST_URL);
536 // 将图片的相对路径转成绝对路径 536 // 将图片的相对路径转成绝对路径
537 if (null != data) { 537 if (null != data) {
@@ -546,7 +546,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -546,7 +546,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
546 if (REGULARIZE_NFC.equals(regularize)) { // NFC分享页列表 需要返回18个商品 546 if (REGULARIZE_NFC.equals(regularize)) { // NFC分享页列表 需要返回18个商品
547 req.setViewNum(18); 547 req.setViewNum(18);
548 } 548 }
549 - SearchParam searchParam = new SearchParam().buildPageSearchParam(req); 549 + SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
550 String url = ProductSearchConstants.PRODUCT_UVSCORE_LIST_URL; 550 String url = ProductSearchConstants.PRODUCT_UVSCORE_LIST_URL;
551 JSONObject data = search(searchParam.getParam(), url); 551 JSONObject data = search(searchParam.getParam(), url);
552 // 将图片的相对路径转成绝对路径 552 // 将图片的相对路径转成绝对路径
@@ -574,7 +574,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -574,7 +574,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
574 if(null != product.getSeriesId() && product.getSeriesId().intValue() != 0) { 574 if(null != product.getSeriesId() && product.getSeriesId().intValue() != 0) {
575 req.setSeries(product.getSeriesId() + ""); 575 req.setSeries(product.getSeriesId() + "");
576 } 576 }
577 - SearchParam searchParam = new SearchParam().buildSearchParam(req); 577 + SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(businessClient);
578 578
579 JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL); 579 JSONObject data = search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_BY_SERIESBRAND_LIST_URL);
580 if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) { 580 if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
@@ -594,7 +594,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -594,7 +594,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
594 594
595 @Override 595 @Override
596 public JSONObject searchSecondhandSkupList(ProductSearchReq req) { 596 public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
597 - SearchParam searchParam = new SearchParam().buildPageSearchParam(req); 597 + SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
598 String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL; 598 String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
599 JSONObject data = search(searchParam.getParam(), url); 599 JSONObject data = search(searchParam.getParam(), url);
600 // 将图片的相对路径转成绝对路径 600 // 将图片的相对路径转成绝对路径