Example #1
0
 @Override
 public void delete(List<PanelGroup> infoList) throws Exception {
   // TODO Auto-generated method stub
   DbFactory.getSqlDdlDao().delete(infoList);
   for (PanelGroup group : infoList) {
     DbFactory.getSqlDdlDao()
         .delete(PanelGroupDtl.class, "PANELS_ID=?", new Object[] {group.getPanelsId()});
   }
 }
Example #2
0
  @Override
  public void updatePanelPublishJsonFiels(String path) throws Exception {
    // TODO Auto-generated method stub
    String custId = UserUtil.getCurUser().getDepartId(); // "1";//
    Map paramMap = new HashMap();
    paramMap.put("1", custId); // UserUtil.getCurUser().getDepartId()

    // --面板组定义表
    String panelGroupSql =
        "select * from panel_group where GROUP_ID in (select GROUP_ID from cust_group where cust_id = ?)";
    List<PanelGroup> panelGroups =
        DbFactory.getSqlDdlDao().query(panelGroupSql, paramMap, PanelGroup.class);
    //
    String date = SystemDateUtil.getSysDateTime();
    String root = path + "data" + File.separator;
    MD5Check md5 = new MD5Check();
    paramMap.clear();
    for (PanelGroup panelGroup : panelGroups) {
      // 面板组ID
      BigDecimal groupId = panelGroup.getGroupId();
      paramMap.clear();
      paramMap.put("1", groupId);
      // 文件名
      StringBuilder fileName = new StringBuilder();
      String date_replace1 = date.replaceAll(" ", "_");
      String date_replace2 = date_replace1.replaceAll(":", "_");
      String date_replace3 = date_replace2.replaceAll("-", "_");
      fileName.append("wifi.pub.").append(groupId);
      fileName.append(".").append(date_replace3).append(".json");
      PrintWriter print = null;
      try {
        print = org.frame.tool.FilesTool.getPrintWriter(root + fileName.toString());
        print.println("[");

        // 查找栏目子目录column_info

        // 面板组明细sql
        String panelGroupDtlSql =
            "select * from panel_group_dtl where PANELS_ID in "
                + "(select PANELS_ID from panel_group where GROUP_ID = ?)";
        JsonFactory.getSqlDdlDao()
            .queryJson(panelGroupDtlSql, paramMap, PanelGroupDtl.class, print);
        print.println(",");

        // 面板定义
        String panelDefSql =
            "select * from panel_def where PANEL_ID in "
                + "(select PANEL_ID from panel_group_dtl where PANELS_ID in "
                + "	(select PANELS_ID from panel_group where GROUP_ID = ?)"
                + ")";
        JsonFactory.getSqlDdlDao().queryJson(panelDefSql, paramMap, PanelDef.class, print);
        print.println(",");

        // 面板项
        String paneBoxDefSql =
            "select * from panel_box_def where PANEL_ID in "
                + "(select PANEL_ID from panel_group_dtl where PANELS_ID in "
                + "	(select PANELS_ID from panel_group where GROUP_ID = ?)"
                + ")";
        JsonFactory.getSqlDdlDao().queryJson(paneBoxDefSql, paramMap, PanelBoxDef.class, print);
        print.println(",");

        // 面板是否有已发布
        // updateStatus(col.getColumnId());

        // 面板内容
        String PanelBoxItemSql =
            "select * from panel_box_item where box_id in "
                + "(select box_id from panel_box_def where PANEL_ID in "
                + "	(select PANEL_ID from panel_group_dtl where PANELS_ID in "
                + "		(select PANELS_ID from panel_group where GROUP_ID = ?)"
                + "	)"
                + ")";
        JsonFactory.getSqlDdlDao().queryJson(PanelBoxItemSql, paramMap, PanelBoxItem.class, print);

        print.print("]");

      } finally {
        if (print != null) print.close();
      }
      //
      PublishLog log = new PublishLog();
      log.setColumnId(new BigDecimal(0));
      log.setCustId(new BigDecimal(custId));
      log.setFileUrl("data" + File.separator + fileName);
      log.setMd5Num(md5.getFileMD5String(new File(root + fileName.toString())));
      log.setState(BigDecimal.ZERO);
      log.setPublishType(new BigDecimal(2));
      log.setPublishId(PkHelper.getPk("PUBLISH_LOG"));
      DbFactory.getSqlDdlDao().insert(log);
    }
  }
Example #3
0
 public void save(PanelGroup group, List<PanelGroupDtl> dtlList) throws Exception {
   if (group.getPanelsId() == null) {
     group.setPanelsId(getMax());
     group.setVersionVal(BigDecimal.ONE);
     group.setCreateDate(SystemDateUtil.getSystemDate());
     group.setCreateMan(String.valueOf(UserUtil.getCurUser().getDepartId()));
     DbFactory.getSqlDdlDao().insert(group);
   } else {
     if (group.getVersionVal() != null)
       group.setVersionVal(group.getVersionVal().add(BigDecimal.ONE)); // 更新版本号
     else group.setVersionVal(BigDecimal.ONE);
     DbFactory.getSqlDdlDao().update(group);
   }
   DbFactory.getSqlDdlDao()
       .delete(PanelGroupDtl.class, "PANELS_ID=?", new Object[] {group.getPanelsId()});
   for (PanelGroupDtl info : dtlList) {
     info.setPanelsId(group.getPanelsId());
     DbFactory.getSqlDdlDao().insert(info);
   }
 }