...
|
...
|
@@ -4,6 +4,8 @@ import com.yoho.search.consumer.service.bo.ProductIndexBO; |
|
|
import com.yoho.search.dal.model.ProductSort;
|
|
|
import com.yoho.search.dal.model.UfoProduct;
|
|
|
import com.yoho.search.dal.model.UfoSearchSortRelation;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Map;
|
...
|
...
|
@@ -17,12 +19,15 @@ import java.util.Map; |
|
|
@Component
|
|
|
public class UfoToYohoSortService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(UfoToYohoSortService.class);
|
|
|
|
|
|
public void build(ProductIndexBO productIndexBO, UfoProduct ufoProduct, Map<Integer, ProductSort> productSortMap, Map<Integer, UfoSearchSortRelation> ufoSortRelationMap) {
|
|
|
try {
|
|
|
//处理大分类
|
|
|
if (ufoSortRelationMap.containsKey(Integer.valueOf(ufoProduct.getMaxSortId()))) {
|
|
|
UfoSearchSortRelation ufoSearchSortRelation = ufoSortRelationMap.get(Integer.valueOf(ufoProduct.getMaxSortId()));
|
|
|
if (ufoSearchSortRelation != null) {
|
|
|
ProductSort productSort = productSortMap.get(ufoSearchSortRelation.getUfoSortId());
|
|
|
ProductSort productSort = productSortMap.get(ufoSearchSortRelation.getYohoSortId());
|
|
|
if (productSort != null) {
|
|
|
productIndexBO.setMaxSortId(productSort.getId());
|
|
|
productIndexBO.setMaxSortName(productSort.getId() + ":" + productSort.getSortName() + ":" + productSort.getOrderBy());
|
...
|
...
|
@@ -34,7 +39,7 @@ public class UfoToYohoSortService { |
|
|
if (ufoSortRelationMap.containsKey(Integer.valueOf(ufoProduct.getMidSortId()))) {
|
|
|
UfoSearchSortRelation ufoSearchSortRelation = ufoSortRelationMap.get(Integer.valueOf(ufoProduct.getMidSortId()));
|
|
|
if (ufoSearchSortRelation != null) {
|
|
|
ProductSort productSortMid = productSortMap.get(ufoSearchSortRelation.getUfoSortId());
|
|
|
ProductSort productSortMid = productSortMap.get(ufoSearchSortRelation.getYohoSortId());
|
|
|
if (productSortMid != null) {
|
|
|
productIndexBO.setMiddleSortId(productSortMid.getId());
|
|
|
productIndexBO.setMiddleSortName(productSortMid.getId() + ":" + productSortMid.getSortName() + ":" + productSortMid.getOrderBy());
|
...
|
...
|
@@ -48,5 +53,9 @@ public class UfoToYohoSortService { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} |
...
|
...
|
|