Authored by 胡古飞

fix ShopListServiceImpl

... ... @@ -62,7 +62,6 @@ public class ShopListServiceImpl implements IShopListService {
private BrandIndexBaseService brandIndexBaseService;
@Autowired
private SearchCommonHelper searchCommonHelper;
@Autowired
private SearchCacheService searchCacheService;
@Autowired
... ... @@ -75,7 +74,7 @@ public class ShopListServiceImpl implements IShopListService {
brandAndShopSearchCache = searchCacheFactory.getBrandAndShopSearchCache();
}
private static final Logger logger = LoggerFactory.getLogger(ShopsServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(ShopListServiceImpl.class);
@Override
public SearchApiResult searchShopList(Map<String, String> paramMap) {
... ... @@ -92,9 +91,9 @@ public class ShopListServiceImpl implements IShopListService {
MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword);
queryBuilder.operator(MatchQueryBuilder.Operator.OR);
StringBuilder searchField = new StringBuilder();
searchField.append("brandName.brandName_lowercase^4000,brandName^900").append(",");
searchField.append("shopName.shopName_lowercase^4000,shopName^900").append(",");
searchField.append("brandNameCn^850,brandNameCn.brandNameCn_pinyin^850").append(",");
searchField.append("brandName.brandName_lowercase^4000,brandName^900").append(',');
searchField.append("shopName.shopName_lowercase^4000,shopName^900").append(',');
searchField.append("brandNameCn^850,brandNameCn.brandNameCn_pinyin^850").append(',');
searchField.append("brandNameEn^800,brandDomain^700");
String[] fields = searchField.toString().split(",");
for (String field : fields) {
... ... @@ -212,10 +211,10 @@ public class ShopListServiceImpl implements IShopListService {
Integer shopId = (Integer) productSource.get("shopId");
Integer brandId = (Integer) productSource.get("brandId");
String isGlobal = (String) productSource.get("isGlobal");
if ("Y".equals(isGlobal) && brandId != null) {
if (brandId != null && "Y".equals(isGlobal)) {
globalBrandIds.add(brandId);
}
if ("N".equals(isGlobal) && shopId != null && shopId > 0) {
if (shopId != null && shopId > 0 && "N".equals(isGlobal)) {
yohoShopIds.add(shopId);
}
}
... ... @@ -225,8 +224,8 @@ public class ShopListServiceImpl implements IShopListService {
List<Map<String, Object>> shops_info = new ArrayList<Map<String, Object>>();
for (Map<String, Object> productSource : productSourceList) {
String shopId = productSource.getOrDefault("shopId", "").toString();
String brandId = productSource.getOrDefault("brandId", "").toString();
String shopId = productSource.getOrDefault("shopId", "0").toString();
String brandId = productSource.getOrDefault("brandId", "0").toString();
String isGlobal = productSource.getOrDefault("isGlobal", "N").toString();
Map<String, Object> shop_info = new HashMap<String, Object>();
shop_info.put("tbl_brand", null);
... ... @@ -234,7 +233,7 @@ public class ShopListServiceImpl implements IShopListService {
shop_info.put("_score", 0);
// 处理有货的店铺
if ("N".equals(isGlobal) && shopId != null && Integer.valueOf(shopId) > 0) {
if (shopId != null && Integer.parseInt(shopId) > 0 && "N".equals(isGlobal)) {
Map<String, Object> yohoShopInfo = yohoShopMap.get(shopId);
if (yohoShopInfo != null) {
shop_info.put("yoho_shop", yohoShopInfo);
... ... @@ -244,7 +243,7 @@ public class ShopListServiceImpl implements IShopListService {
}
}
// 处理全球购的品牌
if ("Y".equals(isGlobal) && brandId != null) {
if (brandId != null && "Y".equals(isGlobal)) {
Map<String, Object> globalBrand = globalBrandMap.get(brandId);
if (globalBrand != null) {
shop_info.put("tbl_brand", globalBrand);
... ...