public Set<DartCompany> getDartCompanySet(int pageIndex) { Set<DartCompany> rst = new HashSet<DartCompany>(); setCurrentPage(pageIndex); Document doc = WebScrappUtil.get(url, argMap); Elements elements = doc.select("div[class =table_scroll]>table>tbody>tr"); rst = writeDartCompanyEntity(elements); logger.info("DartCompanySize : {} ", rst.size()); for (DartCompany comp : rst) { comp.setPageNum(pageIndex); } return rst; }
private Set<DartCompany> writeDartCompanyEntity(Elements contents) { Set<DartCompany> rst = new HashSet<DartCompany>(); for (Element el : contents) { DartCompany temp = new DartCompany(); temp.setComCode(el.child(0).child(0).child(2).attr("value")); temp.setComName(el.child(0).child(0).child(3).attr("value")); temp.setCeoName(el.child(1).text()); temp.setKrxShortCode(el.child(2).text()); temp.setIndustry(el.child(3).text()); // temp.setPageNum(pageIndex); rst.add(temp); } return rst; }