Commit 8a0c7f3a by 张乐 Committed by GitHub

Merge pull request #306 from lepdou/0627_0701

fix user search
parents cd27534a 41b04ad1
...@@ -14,6 +14,7 @@ import org.springframework.http.HttpMethod; ...@@ -14,6 +14,7 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -44,6 +45,7 @@ public class CtripUserService implements UserService { ...@@ -44,6 +45,7 @@ public class CtripUserService implements UserService {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(getConnectTimeout()); factory.setConnectTimeout(getConnectTimeout());
factory.setReadTimeout(getReadTimeout()); factory.setReadTimeout(getReadTimeout());
return factory; return factory;
} }
...@@ -140,10 +142,10 @@ public class CtripUserService implements UserService { ...@@ -140,10 +142,10 @@ public class CtripUserService implements UserService {
int limit) { int limit) {
UserServiceRequest request = new UserServiceRequest(); UserServiceRequest request = new UserServiceRequest();
request.setAccess_token(getUserServiceAccessToken()); request.setAccess_token(getUserServiceAccessToken());
request.setType("emloyee");
UserServiceRequestBody requestBody = new UserServiceRequestBody(); UserServiceRequestBody requestBody = new UserServiceRequestBody();
requestBody.setIndexAlias("itdb_emloyee"); requestBody.setIndexAlias("itdb_emloyee");
requestBody.setType("emloyee");
request.setRequest_body(requestBody); request.setRequest_body(requestBody);
Map<String, Object> queryJson = Maps.newHashMap(); Map<String, Object> queryJson = Maps.newHashMap();
...@@ -168,7 +170,6 @@ public class CtripUserService implements UserService { ...@@ -168,7 +170,6 @@ public class CtripUserService implements UserService {
static class UserServiceRequest { static class UserServiceRequest {
private String access_token; private String access_token;
private String type;
private UserServiceRequestBody request_body; private UserServiceRequestBody request_body;
public String getAccess_token() { public String getAccess_token() {
...@@ -179,14 +180,6 @@ public class CtripUserService implements UserService { ...@@ -179,14 +180,6 @@ public class CtripUserService implements UserService {
this.access_token = access_token; this.access_token = access_token;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public UserServiceRequestBody getRequest_body() { public UserServiceRequestBody getRequest_body() {
return request_body; return request_body;
} }
...@@ -199,8 +192,17 @@ public class CtripUserService implements UserService { ...@@ -199,8 +192,17 @@ public class CtripUserService implements UserService {
static class UserServiceRequestBody { static class UserServiceRequestBody {
private String indexAlias; private String indexAlias;
private String type;
private Map<String, Object> queryJson; private Map<String, Object> queryJson;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getIndexAlias() { public String getIndexAlias() {
return indexAlias; return indexAlias;
} }
......
...@@ -70,7 +70,6 @@ public class CtripUserServiceTest { ...@@ -70,7 +70,6 @@ public class CtripUserServiceTest {
ctripUserService.assembleSearchUserRequest(someKeyword, someOffset, someLimit); ctripUserService.assembleSearchUserRequest(someKeyword, someOffset, someLimit);
assertEquals(someUserServiceToken, request.getAccess_token()); assertEquals(someUserServiceToken, request.getAccess_token());
assertEquals("emloyee", request.getType());
CtripUserService.UserServiceRequestBody requestBody = request.getRequest_body(); CtripUserService.UserServiceRequestBody requestBody = request.getRequest_body();
...@@ -94,7 +93,6 @@ public class CtripUserServiceTest { ...@@ -94,7 +93,6 @@ public class CtripUserServiceTest {
CtripUserService.UserServiceRequest request = ctripUserService.assembleFindUserRequest(userIds); CtripUserService.UserServiceRequest request = ctripUserService.assembleFindUserRequest(userIds);
assertEquals(someUserServiceToken, request.getAccess_token()); assertEquals(someUserServiceToken, request.getAccess_token());
assertEquals("emloyee", request.getType());
CtripUserService.UserServiceRequestBody requestBody = request.getRequest_body(); CtripUserService.UserServiceRequestBody requestBody = request.getRequest_body();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment