...
|
...
|
@@ -8,7 +8,6 @@ import java.util.Comparator; |
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.yoho.core.config.ConfigReader;
|
...
|
...
|
@@ -31,17 +30,19 @@ import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.core.config.ConfigReader;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.core.rest.exception.ServiceNotAvaibleException;
|
|
|
import com.yohobuy.ufo.model.promotion.response.CouponInfo;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.common.cache.Cachable;
|
|
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
|
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
|
|
import com.yohoufo.common.utils.UfoStringUtils;
|
|
|
import com.yohoufo.dal.product.BrandMapper;
|
|
|
import com.yohoufo.dal.product.ProductMapper;
|
|
|
import com.yohoufo.dal.product.ProductSalesMapper;
|
|
|
import com.yohoufo.dal.product.ProductSortMapper;
|
|
|
import com.yohoufo.dal.product.model.Product;
|
|
|
import com.yohoufo.dal.product.model.ProductSales;
|
|
|
import com.yohoufo.dal.product.model.ProductSort;
|
|
|
import com.yohoufo.product.helper.SearchParam;
|
|
|
import com.yohoufo.product.model.FilterItem;
|
...
|
...
|
@@ -93,9 +94,6 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
@Autowired
|
|
|
private ProductSearchAssistService productSearchAssistService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject search(Map<String, Object> searchParams, String url) {
|
|
|
logger.info("begin invoke search.productList, param is:{}, url is :{}", searchParams, url);
|
|
|
String resultJsonStr = null;
|
...
|
...
|
@@ -226,6 +224,26 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 对二手商品列表的信息进行修改,商品图片地址URL补全
|
|
|
*
|
|
|
*/
|
|
|
protected void processSecondhandSkupList(JSONArray skupList) {
|
|
|
if(CollectionUtils.isEmpty(skupList)){
|
|
|
return;
|
|
|
}
|
|
|
// 遍历商品列表
|
|
|
for (int i = 0; i < skupList.size(); i++) {
|
|
|
JSONObject product = skupList.getJSONObject(i);
|
|
|
if(null == product){
|
|
|
continue;
|
|
|
}
|
|
|
// 处理图片,封面图设置
|
|
|
String secondhand_image = fillProductImgUrl(MapUtils.getString(product, "secondhand_image", ""));
|
|
|
product.replace("secondhand_image", secondhand_image);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
System.out.println(fillProductImgUrl("https://img12.static.yhbimg.com/goodsimg/2019/04/17/17/021560b1bd437ded9a66dd15c29c81c53d.jpg"));
|
|
|
}
|
...
|
...
|
@@ -744,6 +762,19 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject searchSecondhandSkupList(ProductSearchReq req) {
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
String url = ProductSearchConstants.SECONDHAND_SKUP_QUERY_URL;
|
|
|
JSONObject data = search(searchParam.getParam(), url);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
processSecondhandSkupList(data.getJSONArray("skup_list"));
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
// NFC详情分享页列表要保证 3的倍数,这里做最后的保证
|
|
|
private void regularize(JSONArray productList) {
|
|
|
if(CollectionUtils.isEmpty(productList)){
|
...
|
...
|
|