|
@@ -18,53 +18,42 @@ import org.springframework.web.client.RestTemplate;
|
|
|
public class SearchUitls {
|
|
|
Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
public void updateProductIndex(Integer productId){
|
|
|
- MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
- paramMap.add("productId", productId);
|
|
|
- updatePost("/update/product", paramMap);
|
|
|
+ updatePost("/update/product?productId=" + productId);
|
|
|
}
|
|
|
|
|
|
public void deleteProductIndex(Integer productId){
|
|
|
- MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
- paramMap.add("productId", productId);
|
|
|
- updatePost("/delete/product", paramMap);
|
|
|
+ updatePost("/delete/product?productId=" + productId);
|
|
|
}
|
|
|
|
|
|
public void updateArticleIndex(Integer articleId){
|
|
|
- MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
- paramMap.add("articleId", articleId);
|
|
|
- updatePost("/update/article", paramMap);
|
|
|
+ updatePost("/update/article?articleId=" + articleId);
|
|
|
}
|
|
|
|
|
|
public void deleteArticleIndex(Integer articleId){
|
|
|
- MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
- paramMap.add("articleId", articleId);
|
|
|
- updatePost("/delete/article", paramMap);
|
|
|
+ updatePost("/delete/article?articleId=" + articleId);
|
|
|
}
|
|
|
|
|
|
public void updateAllArticleIndex(){
|
|
|
- updatePost("/article/all",null);
|
|
|
+ updatePost("/article/all");
|
|
|
}
|
|
|
|
|
|
public void updateShopIndex(Integer shopId){
|
|
|
- MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
- paramMap.add("shopId", shopId);
|
|
|
- updatePost("/update/shop", paramMap);
|
|
|
+ updatePost("/update/shop?shopId=" + shopId);
|
|
|
}
|
|
|
|
|
|
public void updateEquipmentIndex(Integer equipmentId){
|
|
|
- MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
- paramMap.add("equipmentId", equipmentId);
|
|
|
- updatePost("/update/equipment", paramMap);
|
|
|
+ updatePost("/update/equipment?equipmentId=" + equipmentId);
|
|
|
}
|
|
|
|
|
|
- private void updatePost(String path, MultiValueMap<String, Integer> paramMap){
|
|
|
+ private void updatePost(String path){
|
|
|
// 获取core服务器地址
|
|
|
String coreServer = Global.getConfig("caimei.core");
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String uri = coreServer + "/commodity/search/index" + path;
|
|
|
// 打印参数
|
|
|
- logger.info("更新索引uri:" + uri +",参数:"+ paramMap.toString());
|
|
|
+ logger.info("更新索引uri:" + uri);
|
|
|
// 发起Post请求
|
|
|
+ MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
|
|
|
String result = restTemplate.postForObject(uri, paramMap, String.class);
|
|
|
logger.info("更新索引result:" + result);
|
|
|
}
|