/** @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;
  }
 /** @Title: resposEmail @Description: TODO(订阅邮件) */
 @RequestMapping(value = "/noticeEmail.do", method = RequestMethod.POST)
 @ResponseBody
 public AjaxJson resposEmail(
     @RequestParam("emailaddress") String emailaddress, HttpServletRequest request) {
   AjaxJson ajx = new AjaxJson();
   TBEmailNotice tbEmailNotice = new TBEmailNotice();
   tbEmailNotice.setDatetime(DataToolsUtils.getSimpleDateFormat());
   tbEmailNotice.setEmail(emailaddress);
   tbEmailNotice.setIp(IpUtils.getLocalHostIp(request));
   tbEmailNotice.setProjectname(SystemPath.getProjectName());
   systemService.save(tbEmailNotice);
   ajx.setMsg("订阅成功,敬请期待!");
   return ajx;
 }
  /** @Title: tab_selftag @Description: TODO(添加自己的tag) */
  @RequestMapping(value = "/addSelfTag.do", method = RequestMethod.POST)
  @ResponseBody
  public Map<String, Object> tab_selftag(HttpServletRequest request) {
    String feedurl = request.getParameter("feedurl");
    Map<String, Object> map = new HashMap<String, Object>();
    if (!"".equals(feedurl) && null != feedurl) {
      map.put("list", savetag(feedurl));
      return map;
    }
    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;
  }
 /** @Title: tab_news @Description: TODO(实时新闻) */
 @RequestMapping(value = "/tabnews.do", method = RequestMethod.POST)
 @ResponseBody
 public Map<String, Object> tab_news(HttpServletRequest request) {
   String pageNum = request.getParameter("pageNum"); // 当前页
   String rows = request.getParameter("rows"); // 每页数据
   CriteriaQuery cq = new CriteriaQuery(false, "epubDate");
   /** --字段-- * */
   Map<Object, String> parms = HqlQuery.getHashMaps();
   parms.put("macaddr", IpUtils.getMacAddress());
   cq.setMap(parms);
   /** --字段end-- * */
   Page page = new Page();
   if ((null != pageNum && !"".equals(pageNum)) && (null != rows && !"".equals(rows))) {
     page.setCurrentPage(pageNum);
     page.setPageSize(rows);
   }
   Map<?, ?> mapPage = systemService.getPageList(TBRss.class, cq, page);
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("list", mapPage.get("list"));
   map.put("pagehtml", mapPage.get("pagehtml"));
   return map;
 }