1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package com.chinacreator.videoalliance.smc.dao;
- import com.chinacreator.videoalliance.common.util.DataSource;
- import com.chinacreator.videoalliance.smc.bean.SmsCheckBean;
- import com.frameworkset.common.poolman.PreparedDBUtil;
- import com.frameworkset.common.poolman.SQLExecutor;
- import org.springframework.beans.factory.annotation.Value;
- import java.sql.SQLException;
- /**
- * 短信取号接口数据层类
- * @author lizhiyong
- *
- */
- public class SmsNumberDao {
- @Value("${sms.error.times}")
- private String times;
- /**
- * 检查验证码获取是否成功
- * @param userid 用户手机号
- * @return 是否成功布尔值
- */
- public SmsCheckBean checkVcode(String userid,String cpid) throws SQLException {
- String sql="select ROWNO,CPID,USERID,VERCODE,MAKETIME,SENDSTATUS,REMARK,CHANNEL,STATUS,TIMES FROM (select ROWNO,CPID,USERID,VERCODE,MAKETIME,SENDSTATUS,REMARK,CHANNEL,STATUS,TIMES FROM TL_VERIFICATION_CODE where USERID= ? and channel is null and cpid = ? and sysdate<=(to_date(MAKETIME,'yyyy-mm-dd hh24:mi:ss')+5*(1/(24*60))) and status='0' order by MAKETIME desc ) where rownum=1";
- return SQLExecutor.queryObjectWithDBName(SmsCheckBean.class, DataSource.NET3G, sql,userid,cpid);
- }
- public void addVcodeTimes(SmsCheckBean smsCheckBean){
- PreparedDBUtil pdb=new PreparedDBUtil();
- String sql="update TL_VERIFICATION_CODE set times=times+1 where ROWNO = ? ";
- try {
- pdb.preparedUpdate(DataSource.NET3G, sql);
- pdb.setString(1, smsCheckBean.getRowno());
- pdb.executePrepared();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public void diabled(SmsCheckBean smsCheckBean){
- PreparedDBUtil pdb=new PreparedDBUtil();
- String sql="update TL_VERIFICATION_CODE set status='1' where ROWNO = ? ";
- try {
- pdb.preparedUpdate(DataSource.NET3G, sql);
- pdb.setString(1, smsCheckBean.getRowno());
- pdb.executePrepared();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public boolean checkVcode(String userid, String vercode, String channel, String cpid) {
- boolean result = false;
- PreparedDBUtil pdb = new PreparedDBUtil();
- String sql = "select VERCODE from TL_VERIFICATION_CODE where VERCODE=? and USERID=? and channel = ? and cpid = ?";
- try {
- pdb.preparedSelect("net3g", sql);
- pdb.setString(1, vercode);
- pdb.setString(2, userid);
- pdb.setString(3, channel);
- pdb.setString(4, cpid);
- pdb.executePrepared();
- String temp = pdb.getString(0, 0);
- if (!temp.isEmpty()) {
- result = true;
- }
- } catch (SQLException var9) {
- var9.printStackTrace();
- }
- return result;
- }
- }
|