示例#1
0
  public String panelPublishByCustId(String path, String equipNo) throws Exception {
    // TODO Auto-generated method stub
    // String custId=UserUtil.getCurUser().getDepartId();//"1";//
    Map paramMap = new HashMap();
    // paramMap.put("1", custId);

    String date = SystemDateUtil.getSysDate();
    // 文件名
    StringBuilder fileName = new StringBuilder(path);
    fileName.append("wifi.panel.").append(equipNo).append(".json");

    PrintWriter print = null;
    BufferedReader reader = null;

    try {
      // File file=new File(fileName.toString());
      //
      StringBuilder sb = new StringBuilder();
      // if(file.exists()){
      // String lastdate=getModDate(file);
      // if(lastdate.equals(SystemDateUtil.getSysDate())){
      // reader=FilesTool.getFileReader(fileName.toString());
      // String tempString=null;
      // while ((tempString = reader.readLine()) != null) {
      // sb.append(tempString);
      // }
      // return sb.toString();
      // }
      // }

      // panel_group panel_group_dtl panel_def panel_box_def
      // panel_box_item
      print = org.frame.tool.FilesTool.getPrintWriter(fileName.toString());
      print.println("[");

      // panel_group
      paramMap = new HashMap();
      paramMap.put("1", equipNo);
      JsonFactory.getSqlDdlDao()
          .queryJson(
              "select * from panel_group g where EXISTS(select 1 from cust_equipment a where a.EQUIP_NO=? and g.CREATE_MAN=a.cust_id and g.GROUP_ID=a.GROUP_ID and g.POINT_ID=a.POINT_ID ) ",
              paramMap,
              PanelGroup.class,
              print);
      print.println(",");

      // panel_group_dtl
      JsonFactory.getSqlDdlDao()
          .queryJson(
              "select * from panel_group_dtl dtl where EXISTS(select 1 from panel_group g where dtl.PANELS_ID=g.PANELS_ID and EXISTS(select 1 from cust_equipment a where a.EQUIP_NO=? and g.CREATE_MAN=a.cust_id and g.GROUP_ID=a.GROUP_ID and g.POINT_ID=a.POINT_ID ) ) ",
              paramMap,
              PanelGroupDtl.class,
              print);
      print.println(",");

      // panel_def
      JsonFactory.getSqlDdlDao()
          .queryJson(
              "select * from panel_def p where EXISTS (select 1 from panel_group_dtl dtl where p.PANEL_ID=dtl.PANEL_ID and EXISTS(select 1 from panel_group g where dtl.PANELS_ID=g.PANELS_ID and EXISTS(select 1 from cust_equipment a where a.EQUIP_NO=? and g.CREATE_MAN=a.cust_id and g.GROUP_ID=a.GROUP_ID and g.POINT_ID=a.POINT_ID ) ))",
              paramMap,
              PanelDef.class,
              print);
      print.println(",");

      // panel_box_def panel_box_item
      JsonFactory.getSqlDdlDao()
          .queryJson(
              "select * from panel_box_def box where EXISTS (select 1 from panel_def p where box.panel_id=p.panel_id and EXISTS (select 1 from panel_group_dtl dtl where p.PANEL_ID=dtl.PANEL_ID and EXISTS(select 1 from panel_group g where dtl.PANELS_ID=g.PANELS_ID and EXISTS(select 1 from cust_equipment a where a.EQUIP_NO=? and g.CREATE_MAN=a.cust_id and g.GROUP_ID=a.GROUP_ID and g.POINT_ID=a.POINT_ID ) )))",
              paramMap,
              PanelBoxDef.class,
              print);
      print.println(",");

      // panel_box_item
      JsonFactory.getSqlDdlDao()
          .queryJson(
              "select * from panel_box_item it where EXISTS (select 1 from panel_box_def box where it.box_id=box.box_id and EXISTS (select 1 from panel_def p where box.panel_id=p.panel_id and EXISTS (select 1 from panel_group_dtl dtl where p.PANEL_ID=dtl.PANEL_ID and EXISTS(select 1 from panel_group g where dtl.PANELS_ID=g.PANELS_ID and EXISTS(select 1 from cust_equipment a where a.EQUIP_NO=? and g.CREATE_MAN=a.cust_id and g.GROUP_ID=a.GROUP_ID and g.POINT_ID=a.POINT_ID ) ))))",
              paramMap,
              PanelBoxItem.class,
              print);

      print.print("]");
      if (print != null) {
        print.close();
        print = null;
      }
      reader = FilesTool.getFileReader(fileName.toString());
      String tempString = null;
      while ((tempString = reader.readLine()) != null) {
        sb.append(tempString);
      }
      return sb.toString();
    } finally {
      try {
        if (print != null) print.close();
      } catch (Exception e) {
      }

      if (reader != null) reader.close();
    }
    // 查找栏目column_info
    // 查找栏目子目录column_info
    // 栏目资源关系表 column_res_list
    // 查找栏目下的资源 res_info res_attr res_file res_owner_tag sub_res
  }