/** 根据组号发送短信 */ public int insertSmsByGroup(SmsBody smsBody) { int limit = deductSMS(smsBody.getUserId(), 12000); if (limit > 0) { String sql = "insert into sms_send_tb(serviceid,mobile_no,msg,reserve,flag,req_num,create_time,user_id) " + "select ?,mobile_no,?,'000000','0',null,null,? from phoneNumbers where group_no=?"; Object[] parm = new Object[] { smsBody.getServiceId(), smsBody.getMsg(), smsBody.getUserId(), smsBody.getPhoneNo() }; return jdbcTemplate.update(sql, parm); } else return 0; }
/*发送短信*/ public void insertSend(SmsBody smsBody) { int limit = deductSMS(smsBody.getUserId(), 1); if (limit > 0) { String sql = "insert into sms_send_tb(serviceid,mobile_no,msg,reserve,flag,req_num,create_time,user_id) " + "values(?,?,?,'000000','0',null,null,?)"; Object[] parm = new Object[] { smsBody.getServiceId(), smsBody.getPhoneNo(), smsBody.getMsg(), smsBody.getUserId() }; // int[] types = new int[]{Types.INTEGER,Types.VARCHAR,Types.CHAR,Types.VARCHAR}; jdbcTemplate.update(sql, parm); } }