Chinaunix首页 | 论坛 | 博客
  • 博客访问: 136532
  • 博文数量: 75
  • 博客积分: 3483
  • 博客等级: 中校
  • 技术积分: 820
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-07 08:31
文章分类

全部博文(75)

文章存档

2011年(53)

2010年(22)

我的朋友

分类: Java

2011-03-16 20:42:54

  1. public String getStrXML(String begin, String end) {

  2.         FusionChartsHelper mch = new FusionChartsHelper();
  3.         
  4.         //String begindate = null;

  5.         //String enddate = null;

  6.         
  7.         Connection conn = getConnection();
  8.         Map<Integer, String> pms = new HashMap<Integer, String>();
  9.         ResultSet rs = null;
  10.         ResultSet rs2 = null;
  11.         PreparedStatement pstmt = null;
  12.         PreparedStatement pstmt2 = null;
  13.         
  14.         /*if(begin == null || end == null || "".equals(begin) || "".equals(end)){
  15.             begindate = getBeginDate();
  16.             enddate = getEndDate();
  17.         }else{
  18.             begindate = begin + " 00:00:00";
  19.             enddate = end + " 23:59:59";
  20.         }*/

  21.         String[] types = new String[] { "CORPORATE", "MEET", "PEEP", "RR"};

  22.         StringBuffer strXML = new StringBuffer();
  23.         strXML.append("");
  24.         strXML.append("");

  25.         try {
  26.             pstmt = conn.prepareStatement(getpm);

  27.             rs = pstmt.executeQuery();

  28.             //set the category xml

  29.             while (rs.next()) {
  30.                 int pmid = rs.getInt(1);
  31.                 String pmname = rs.getString(2);
  32.                 pms.put(pmid, pmname);
  33.             }
  34.             
  35.             Set<Integer> pmset0 = pms.keySet();
  36.             Iterator<Integer> is0 = pmset0.iterator();
  37.             
  38.             while(is0.hasNext()){
  39.                 Integer pmid = is0.next();
  40.                 String pmname = pms.get(pmid);
  41.                 String category = "";
  42.                 strXML.append(category);
  43.             }

  44.             strXML.append("");
  45.             
  46.             Set<Integer> pmset = pms.keySet();
  47.             Iterator<Integer> is = pmset.iterator();
  48.             
  49.             int pmcount = pms.size();
  50.             int pmvalue[][] = new int[pmcount][types.length];

  51.             int loopi = 0;

  52.             while (is.hasNext() && loopi < pmcount) {
  53.                 int loopj = 0;
  54.                 int pmid = is.next();
  55.                 pstmt2 = conn.prepareStatement(getdata);
  56.                 pstmt2.setString(1, Integer.toString(pmid));
  57.                 pstmt2.setString(2, begin);
  58.                 pstmt2.setString(3, end);
  59.                 pstmt2.setString(4, Integer.toString(pmid));
  60.                 pstmt2.setString(5, begin);
  61.                 pstmt2.setString(6, end);
  62.                 pstmt2.setString(7, Integer.toString(pmid));
  63.                 pstmt2.setString(8, begin);
  64.                 pstmt2.setString(9, end);
  65.                 pstmt2.setString(10, Integer.toString(pmid));
  66.                 pstmt2.setString(11, begin);
  67.                 pstmt2.setString(12, end);

  68.                 rs2 = pstmt2.executeQuery();
  69.                 while (rs2.next() && loopj < types.length) {
  70.                     pmvalue[loopi][loopj++] = rs2.getInt(1);
  71.                 }
  72.                 loopi++;
  73.             }

  74.             for (int i = 0; i < types.length; i++) {
  75.                 String dataset = "";
  76.                 strXML.append(dataset);

  77.                 for (int k = 0; k < pmcount; k++) {
  78.                     strXML.append("");
  79.                 }
  80.                 strXML.append("");
  81.             }

  82.         } catch (SQLException e) {
  83.             e.printStackTrace();
  84.         }finally{
  85.             closeResultSet(rs);
  86.             closeResultSet(rs2);
  87.             closeStatement(pstmt);
  88.             closeStatement(pstmt);
  89.             returnConnection(conn);
  90.         }

  91.         strXML.append("");
  92.         return strXML.toString();
  93.     }
阅读(841) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~