|
@@ -16,6 +16,7 @@ import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -38,14 +39,12 @@ import java.util.stream.Stream;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
+@RefreshScope
|
|
|
public class SearchServiceImpl implements SearchService {
|
|
|
|
|
|
@Value("${search.url}")
|
|
|
private String searchUrl; //测试环境搜索服务地址
|
|
|
|
|
|
- @Value("${search.fetch.url}")
|
|
|
- private String searchFetchUrl; //正式环境搜索平台地址
|
|
|
-
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
@@ -82,7 +81,7 @@ public class SearchServiceImpl implements SearchService {
|
|
|
String userId = userService.queryLoginUser();
|
|
|
headerMap.put("userId", userId);
|
|
|
//发送搜索请求
|
|
|
- JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchFetchUrl + "/api-kmsearch/search/search");
|
|
|
+ JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchUrl + "/api-kmsearch/search/search");
|
|
|
if (null != respone && 200 == respone.getIntValue("code")) {
|
|
|
result.put("code", respone.getIntValue("code"));
|
|
|
result.put("message", respone.getString("message"));
|
|
@@ -160,7 +159,7 @@ public class SearchServiceImpl implements SearchService {
|
|
|
headerMap.put("signature", sign);
|
|
|
headerMap.put("businessKey", httpServletRequest.getHeader("businessKey"));
|
|
|
headerMap.put("userId", userService.queryLoginUser());
|
|
|
- JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchFetchUrl + "/api-kmsearch/search/view");
|
|
|
+ JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchUrl + "/api-kmsearch/search/view");
|
|
|
if (null != respone && 200 == respone.getIntValue("code")) {
|
|
|
result.put("code", respone.getIntValue("code"));
|
|
|
result.put("message", respone.getString("message"));
|