コード例 #1
0
  /*
   * 执行sql语句
   */
  public boolean changeDatabase(String sql) {
    boolean flag = false;
    Connection conn = commonDao.getSqlSession().getConnection();
    Statement st = null;

    if (conn == null) {
      logger.error("获取数据库连接失败 !");
      return false;
    }
    try {
      st = conn.createStatement();
      st.execute(sql);
      int num = st.getUpdateCount();
      flag = true;
      logger.info("更新记录数 : " + num);
    } catch (SQLException e) {

      logger.error(e.getMessage());
    } finally {
      try {
        if (st != null) {
          st.close();
        }

      } catch (SQLException e1) {
        Log.error(e1.getMessage());
      }
    }
    return flag;
  }
コード例 #2
0
  /** @return List<Map<String, String>> [resId,localCode,localChannelId,operation] */
  public List<Map<String, String>> getAutoSendCrawlResources() {
    List<Map<String, String>> list = null;

    Connection conn = null;
    PreparedStatement pst = null;
    ResultSet rs = null;
    String sql =
        " select a.res_id,b.local_code,b.local_channel_id,b.operation from twap_public_crawl_resource a,twap_public_channel_mapping_a b where a.channel_id = b.channel_id  ";

    try {
      conn = JavaOracle.getConn();
      pst = conn.prepareStatement(sql);
      rs = pst.executeQuery();
      list = new ArrayList<Map<String, String>>();
      Map<String, String> map = null;
      while (rs.next()) {
        map = new HashMap<String, String>();
        map.put("resId", String.valueOf(rs.getLong("res_id")));
        map.put("localCode", rs.getString("local_code"));
        map.put("localChannelId", rs.getString("local_channel_id"));
        map.put("operation", String.valueOf(rs.getInt("operation")));
        list.add(map);
      }

    } catch (Exception e) {
      e.printStackTrace();
      Log.error(e);
    } finally {
      close(conn, pst, rs);
    }

    return list;
  }
コード例 #3
0
 /** creating the list for generation to the report */
 private void createReportItems() {
   try {
     csvRoutineColumnBuilder = getColumnBuilder();
     csvRoutineColumnBuilder.buildDataSource();
   } catch (Exception e) {
     Log.error("Error in " + this.getClass().getSimpleName() + ".createReportItems: ", e);
     add1LineErrorMessage("report.error.message.general.error");
   }
 }
コード例 #4
0
 public void setRequestParameters(BaseActionForm dynaForm) {
   try {
     PropertyUtils.setProperty(dynaForm, "reportName", getReportNameForParameterPage());
     PropertyUtils.setProperty(dynaForm, "useLowerDateRange", Boolean.TRUE);
     PropertyUtils.setProperty(dynaForm, "useUpperDateRange", Boolean.TRUE);
     // PropertyUtils.setProperty(dynaForm, "useProjectCode", Boolean.TRUE);
     // PropertyUtils.setProperty(dynaForm, "projectCodeList", getProjectList());
   } catch (Exception e) {
     Log.error("Error in ExportRoutineByDate.setRequestParemeters: ", e);
   }
 }
コード例 #5
0
ファイル: GitRepository.java プロジェクト: kylelaker/web-cat
 // ----------------------------------------------------------
 public ObjectId resolve(String revstr) {
   try {
     return repository.resolve(revstr);
   } catch (Exception e) {
     Log.error(
         "An error occurred when resolving the string "
             + revstr
             + " in the repository at "
             + repository.getDirectory(),
         e);
     return null;
   }
 }
コード例 #6
0
ファイル: ExtractionHtml.java プロジェクト: MassPick/Java-zwh
  // 连接CB
  private static Bucket connectionBucket(Bucket bucket) {
    try {
      bucket = connectionCouchBaseLocal(); // 本地CB
    } catch (Exception e) {
      while (true) {
        try {
          bucket = connectionCouchBaseLocal(); // 本地CB
          break;
        } catch (Exception ee) {
          Log.error(ee);
        }
      }
    }

    return bucket;
  }
コード例 #7
0
  public String takePhoto() {
    if (input != null) return "input";

    try {
      int action = 1;
      int interval = 0; // 连续拍照时间
      int saveType = 0; // 保存类型
      int picSize = 2; // 画面大小
      int quality = 0; // 画面品质 0- 10
      int light = 0; // 亮度 0-255
      int compare = 0; // 对比度 0-127
      int stature = 0; // 饱和度 0-127
      int grade = 0; // 色度 0-255

      StringBuilder sb = new StringBuilder();
      sb.append(channel)
          .append(";")
          .append(action)
          .append(";")
          .append(interval)
          .append(";")
          .append(saveType)
          .append(";")
          .append(picSize)
          .append(";")
          .append(quality)
          .append(";")
          .append(light)
          .append(";")
          .append(compare)
          .append(";")
          .append(stature)
          .append(";")
          .append(grade);
      TerminalCommand tc = new TerminalCommand();
      tc.setCmdType(JT808Constants.CMD_TAKE_PHOTO);
      tc.setCmdData(sb.toString());
      SendCommand(tc);

      return json(true, tc.getEntityId());
    } catch (Exception ex) {
      Log.error(ex.getMessage(), ex);
      return json(false, ex.getMessage());
    }
  }