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