/** @Title: deleteTag @Description: TODO(删除tag) */ @RequestMapping(value = "/deleteTag.do", method = RequestMethod.POST) @ResponseBody public Map<String, Object> deleteTag(HttpServletRequest request) { String idstr = request.getParameter("tagid"); String[] id = StringUtil.splitString(idstr, ";"); // systemService.deleteAll(TBRssTag.class, id, null); for (String string : id) { TBRssTag tag = (TBRssTag) systemService.getClassById(TBRssTag.class, string); List<TBRssTag> list = systemService.findByQueryHql("from TBRss where source = '" + tag.getTagname() + "' "); systemService.delete(tag); systemService.deleteAll(list); } /* * 重新获取标签返回 */ Map<String, Object> map = new HashMap<String, Object>(); String hql = "from TBRssTag where macaddr ='" + IpUtils.getMacAddress() + "' order by createtime desc"; // 采用本机上,可以看本机的信息,伪cooikes的行为 List<TBRssTag> list = systemService.findByQueryHql(hql); map.put("list", list); return map; }
@SuppressWarnings("unchecked") public TBRssTag savetag(String url) { /** ========================配置文件 */ Map<String, Object> maprss = RSSParserUtil.RssHome(url); Map<String, Object> mapdom = DomjXmlIT.parserStringXml(maprss.get("xmlcontent").toString()); // 网上直接获取xml流,使用内容解析!防止存本地乱码 List<TBRss> list = (List<TBRss>) mapdom.get("list"); if (list.size() != 0) systemService.saveAll(list); String logcontent = "[******" + DataToolsUtils.getSimpleDateFormat() + " 初次配置抓取标题为 " + mapdom.get("source") + " ,总共录入数据 " + list.size() + "条******]"; systemService.addLogger(logcontent, Globals.Logger_Leavel_INFO, Globals.Logger_Type_INSERT); /** ================================================== */ TBRssTag tag = new TBRssTag(); tag.setFeedurl(url); tag.setSysfig("1"); tag.setTagname(mapdom.get("source").toString()); tag.setMacaddr(IpUtils.getMacAddress()); tag.setCreatetime(DataToolsUtils.getSimpleDateFormat()); systemService.save(tag); return tag; }