...
|
...
|
@@ -56,6 +56,9 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(ProductSearchServiceImpl.class);
|
|
|
|
|
|
// 如果是NFC分享页面列表,则传1
|
|
|
private final static Integer REGULARIZE_NFC = 1;
|
|
|
|
|
|
@Value("${ip.port.search.server}")
|
|
|
private String searchServerIpAndPort;
|
|
|
|
...
|
...
|
@@ -670,18 +673,36 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject searchUvscoreProductList(ProductSearchReq req) {
|
|
|
public JSONObject searchUvscoreProductList(ProductSearchReq req, Integer regularize) {
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
String url = PRODUCT_UVSCORE_LIST_URL;
|
|
|
JSONObject data = search(searchParam.getParam(), url);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
processProductList(data.getJSONArray("product_list"));
|
|
|
processProductSales(data.getJSONArray("product_list"));
|
|
|
|
|
|
if (REGULARIZE_NFC.equals(regularize)) { // NFC分享页列表 需要返回 3的倍数的列表
|
|
|
regularize(data.getJSONArray("product_list"));
|
|
|
} else {
|
|
|
processProductSales(data.getJSONArray("product_list")); // NFC分享页列表不需要销量
|
|
|
}
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
private void regularize(JSONArray productList) {
|
|
|
if(CollectionUtils.isEmpty(productList)){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (productList.size() % 3 == 1) {
|
|
|
productList.remove(productList.size() - 1);
|
|
|
} else if (productList.size() % 3 == 2) {
|
|
|
productList.remove(productList.size() - 1);
|
|
|
productList.remove(productList.size() - 2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private CouponInfo getCouponInfo(String token) {
|
|
|
ApiResponse resp = ufoServiceCaller.call("ufo.coupons.getProductIds", ApiResponse.class, token);
|
|
|
return (CouponInfo) resp.getData();
|
...
|
...
|
|