コード例 #1
0
  public boolean sendmsdb(Map<String, Object> map) {
    String insert =
        "insert into vgop.msm_upload(msm_id,msm_content,msm_state,msm_date,msm_phonenum) "
            + "values('100860470009',?,0,?,?)";

    Connection conn = DataBaseJdbc.getDB2Connection();
    PreparedStatement stmt = null;
    try {
      stmt = conn.prepareStatement(insert);
      stmt.setString(1, map.get("send_ms").toString());
      stmt.setString(2, map.get("create_time").toString());
      stmt.setString(3, map.get("phone_no").toString());
      int i = stmt.executeUpdate();
      log.info("插入vgop 短信表条数 :" + i);
      if (i > 0) {
        return true;
      }
    } catch (Exception e) {
      log.error("创建数据库查询对象出错=" + e.getMessage());
    } finally {
      try {
        stmt.close();
        conn.close();
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    return false;
  }
コード例 #2
0
  @Override
  public String shortMessageCodeSend(Map<String, Object> map) {
    map.put("create_time", DateUtil.getNowDateStr());
    map.put("sendCode", DateUtil.getNowDateStr2() + RandomUtil.getRandom());
    String resultms = (String) map.get("sendCode");

    String isql = "短信表";
    try {
      String r = insertShortMessageCode(map);
      if (r.equals("N")) {
        resultms = "F";
      } else {
        map.put("status", "2"); // 插入成功,修改目前状态已经为2的数据
        sendMessageDao.updateAfterSendMessageStatus(map);
      }
      Connection con = DataBaseJdbc.getDB2Connection();
      if (con != null) {
        Statement stmt = con.createStatement();
        int i = stmt.executeUpdate(isql);
        if (i < 1) {
          resultms = "F";
        }
      } else {
        resultms = "F";
      }
    } catch (Exception e) {
      log.error("cc=" + e.getMessage());
      resultms = "E";
    }
    return resultms;
  }