@RequestMapping(value = {"/chuzu"}) public void getHouseRentInformation( Model model, HttpServletRequest request, HttpServletResponse response) { List<PartnerBaiduHouseRent> houseList = partnerBaiduHouseRentService.getHouseList(BATCH_ROW_COUNT); if (houseList == null) houseList = new ArrayList<PartnerBaiduHouseRent>(); cn.hshb.web.partner.baidu.entity.newest.houseRent.Urlset urlset = cn.hshb.web.partner.baidu.entity.newest.houseRent.Urlset.fromHouse(houseList); renderMergedOutputModel(urlset, request, response, RENT, ""); partnerBaiduHouseRentService.updateHouseInformation(houseList); }
@RequestMapping(value = {"/chuzuDel"}) public void DelHouseRentInformation( Model model, HttpServletRequest request, HttpServletResponse response) { List<PartnerBaiduHouseRent> houseList = partnerBaiduHouseRentService.getDeleteHouseList(); if (houseList == null) houseList = new ArrayList<PartnerBaiduHouseRent>(); cn.hshb.web.partner.baidu.entity.newest.houseRentDel.Urlset urlset = cn.hshb.web.partner.baidu.entity.newest.houseRentDel.Urlset.fromHouse(houseList); try { String xmlContext = urlset.toXML("rentDel"); // 测试 // String url = "http://localhost:8080/ddhb/postxml"; // 正式 // String url = // "http://ping.baidu.com/sitemap?site=www.hshb.cn&resource_name=ZufangDeletehouseproperty&access_token=Hpy8pyXE"; // String respStr = HttpConnectionUtil.postXML(url, xmlContext, "UTF-8", "UTF-8"); String respStr = HttpConnectionUtil.postXML(PUSH_URL_CHUZU_DEL, xmlContext, "UTF-8", "UTF-8"); printXML(respStr, response); recordDelXmlContent("chuzuDel", respStr); } catch (Exception ex) { log.error("提交到百度的租赁删除解析失败", ex); } partnerBaiduHouseRentService.updateHouseInformation(houseList); }