コード例 #1
0
  @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;
  }
コード例 #2
0
 /** @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;
 }