Merge branch 'tolag3'
This commit is contained in:
commit
6f33aac8a3
@ -33,6 +33,7 @@ import javax.net.ssl.X509TrustManager;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@ -373,26 +374,32 @@ public class FairnetUtils {
|
||||
String url = new SearchGlobalSet().getHost()
|
||||
+ "/srch_resultjson?"
|
||||
+ "w=" + searchType
|
||||
+ "&q=" + searchKeyword
|
||||
+ "&q=" + "*" + searchKeyword + "*"
|
||||
+ "&outmax=" + pagingSize
|
||||
+ "§ion="
|
||||
+ "&pg=" + page;
|
||||
try {
|
||||
String response = new RestTemplate().getForObject(url, String.class);
|
||||
response = response.replaceAll("\n", "\\n");
|
||||
response = response.replaceAll("\r", "\\r");
|
||||
|
||||
JsonNode root = new ObjectMapper().readTree(response);
|
||||
JsonNode listNode = root.path("section_list")
|
||||
.path(0)
|
||||
.path("section")
|
||||
.path(0);
|
||||
if (listNode.path("att_list").isArray()) {
|
||||
List<SearchVO> searchList = new ObjectMapper().convertValue(
|
||||
listNode.path("att_list"), new TypeReference<List<SearchVO>>() {}
|
||||
);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
if (
|
||||
listNode.path("att_list").isArray()
|
||||
&& !"\"\"".equals(listNode.path("att_list").get(0).toString())
|
||||
) {
|
||||
List<SearchVO> searchList = new ObjectMapper().convertValue(
|
||||
listNode.path("att_list"), new TypeReference<List<SearchVO>>() {}
|
||||
);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
result.put("totcnt", ((TextNode) listNode.get("totcnt")).asText());
|
||||
result.put("list", searchList);
|
||||
return result;
|
||||
result.put("totcnt", ((TextNode) listNode.get("totcnt")).asText());
|
||||
result.put("list", searchList);
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user