public void doEnd(ReportRequest rrequest) {
    Date operateTime1 = new Date();
    java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String operateTime = format1.format(operateTime1);
    String userid = rrequest.getRequest().getSession().getAttribute("userId").toString();
    String remoteAddr = rrequest.getRequest().getSession().getAttribute("remoteAddr").toString();
    String logintime = rrequest.getRequest().getSession().getAttribute("loginTime").toString();
    // String opt= rrequest.getRequest().getAttribute("operateTime").toString();
    String menuName = rrequest.getPagebean().getId();
    //		String pageid=rrequest.getPagebean().getId();
    //		System.out.println(menuName);
    //		System.out.println(pageid);

    /*if(menuName.equalsIgnoreCase("eventType")){
    	menuName="事件类型管理";
    }
    else{
    	System.out.println("没执行if语句");
    }*/

    final Connection conn = Config.getInstance().getDataSource("").getConnection();
    PreparedStatement pstmt = null;
    try {

      String sql =
          "insert into LogInfo(UserId,LoginTime,MenuName,OperateTime,UserIp) values(?,?,?,?,?)";
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, userid);
      pstmt.setString(2, logintime);
      pstmt.setString(3, menuName);
      pstmt.setString(4, operateTime);
      pstmt.setString(5, remoteAddr);
      pstmt.executeUpdate();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        pstmt.close();
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
 /** 当报表没有配置PDF模板时,此方法在显示完每页PDF后执行 现在在此方法中演示显示完每页后向其中添加一个图片 */
 public void afterDisplayPdfPageWithoutTemplate(Document document, AbsReportType reportTypeObj) {
   super.afterDisplayPdfPageWithoutTemplate(document, reportTypeObj);
   ReportRequest rrequest = reportTypeObj.getReportRequest();
   String serverName = rrequest.getRequest().getServerName();
   String serverPort = String.valueOf(rrequest.getRequest().getServerPort());
   String imgurl =
       "http://"
           + serverName
           + ":"
           + serverPort
           + Config.webroot
           + "wabacusdemo/pdftemplate/logo.gif"; // 构造要添加图片的URL
   try {
     Image img = Image.getInstance(imgurl);
     float width = document.getPageSize().getWidth();
     float height = document.getPageSize().getHeight();
     // width = width - img.getWidth();
     img.setAbsolutePosition(width / 2, height / 2 + 300f);
     img.setAlignment(Image.ALIGN_CENTER);
     document.add(img);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 3
0
 public String getDisplayValue(ReportRequest rrequest, AbsComponentType ownerComponentObj) {
   String ref = null;
   String popupparams = null;
   String dataimportinitsize = null;
   String asyn = null;
   String interceptor = null;
   if (this.mTagAttributes != null) {
     ref = this.mTagAttributes.get("ref");
     popupparams = this.mTagAttributes.get("popupparams");
     dataimportinitsize = this.mTagAttributes.get("dataimportinitsize");
     asyn = this.mTagAttributes.get("asyn");
     interceptor = this.mTagAttributes.get("interceptor");
   }
   return TagAssistant.getInstance()
       .getDataImportDisplayValue(
           ref,
           asyn,
           popupparams,
           dataimportinitsize,
           this.tagContent,
           interceptor,
           rrequest.getRequest());
 }
Exemplo n.º 4
0
  public List<Map<String, String>> getLstSelectBoxOptions(
      ReportRequest rrequest, Map<String, String> mParentInputboxValues) {
    List<Map<String, String>> lstResults = new ArrayList<Map<String, String>>();
    HttpServletRequest r = rrequest.getRequest();
    String xianhao = r.getParameter("suoshuxianhao");
    System.out.println(
        r.getParameter("suoshuxianhao") + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
    List<String> conditions = new ArrayList<String>();
    conditions.add("SUOSHUXIANHAO");
    List<String> values = new ArrayList<String>();
    values.add(xianhao);
    List<Map<String, String>> result =
        Dao.getInstance().getRecoed("ZBGL_ZBJBXX_XIANHAO_STBZ", conditions, values);
    Map<String, String> mOptionTmp = null;
    // Boolean empty=false;
    for (Map<String, String> m : result) {

      mOptionTmp = new HashMap<String, String>();
      mOptionTmp.put("label", m.get("SHEBEIMING"));
      mOptionTmp.put("value", m.get("SHEBEIMING"));
      lstResults.add(mOptionTmp);
    }
    // System.out.println("m")

    if (lstResults.isEmpty()) {

      mOptionTmp = new HashMap<String, String>();
      mOptionTmp.put("label", "暂无设备!");
      lstResults.add(mOptionTmp);
    }

    System.out.println(lstResults);

    return lstResults; // 依赖的父输入框没有选中数据,则本子选择框也不显示选项

    /*
         String sql="select distinct city from tbl_area where province like '%%'";
         try
         {
             Connection conn=rrequest.getConnection();
             Statement stmt=conn.createStatement();
             ResultSet rs=stmt.executeQuery(sql);
             Map<String,String> mOptionTmp=null;

             while(rs.next())
             {
                 mOptionTmp=new HashMap<String,String>();
                 mOptionTmp.put("label",rs.getString("city"));
                 mOptionTmp.put("value",rs.getString("city"));
                 lstResults.add(mOptionTmp);
             }
             rs.close();
             stmt.close();
         }catch(SQLException e)
         {
             e.printStackTrace();
             return new ArrayList<Map<String,String>>();
         }
         return lstResults;
    */
  }