📄 forgetcihper.java
字号:
package com.doone.fj1w.fjmgr.sysmgr;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Observable;
import java.util.Observer;
import com.doone.data.DacClient;
import com.doone.data.DataRow;
import com.doone.data.DataTable;
import com.doone.fj1w.common.mail.TemplateMail;
import com.doone.fj1w.common.mail.TemplcateMailImpl;
import com.doone.iossp.EMessage;
import com.doone.iossp.FormBody;
import com.doone.util.FileLogger;
import com.doone.uurm.UserFactory;
/**
* @author 黄赟
* @version 1.0
* @see 2005-08-08
* @author 吴少林
* @docRoot <strong>完成密码重置功能的所有提交操作</strong>
* @version 1.1
* @see 2005-08-11
*/
public class ForgetCihper extends Observable implements Observer {
private final String S_COMPARATIVE = "select t.accountid from tf_custinfoweb t "
+ "where t.custtypeid='2' and t.citycode=? "
+ "and t.userstate=? and t.state='E'";
private final String S_SETCIHER = "update Tf_CustInfoWeb set Pwd=? where "
+ "custtypeid='2' and accountid=? and state='E'";
private final String S_EMAIL = "select accountid from tf_custinfoweb where"
+ " custtypeid='2' and email=? and state='E'";
private final String S_CITYCODEAll = "select CITYCODE,CITYNAME from TD_CITY";
private final String S_CITYCODE = "select CITYCODE,CITYNAME from TD_CITY Where "
+ "CITYCODE=?";
private final String S_INVALIACC = "select t.email,t.citycode from tf_custinfoweb t "
+ "where t.accountid=? ";
private final String S_SQL_CARNAME = "Select PARAVALUE,PARADESC From "
+ "Ts_ConfigSub Where ParaName='CARTNAME'";
private final String S_SQL_INVALI = "select ACCOUNTID from tf_custinfoweb t "
+ "where t.accountid=? and t.cartname=? "
+ " and t.cartno=? and t.email=?";
private static String S_SQL_F = " select * from ( "; // 组建SQL语句的前部分
private static String S_SQL_E = " ) ss where ss.rid>= ? and ss.rid <= ?"; // 组建SQL语句的后部分
private static Object[] ROWINFO = null;
private static String S_DEFAULT_BGNROW = "1"; // 默认开始取得的纪录数
private static String S_DEFAULT_ENDROW = "15"; // 默认结束取得的纪录数
private static final String RESEARCH = "select t.accountid,t.name,t.citycode,t.email,"
+ "t.cartno,s.paradesc,decode(t.state,'E','可用','D','禁用') state,"
+ "to_char(t.createtime,'yyyy-mm-dd hh24:mi') createtime,"
+ "decode(t.userstate,'A','激活','N','未激活') userstate,userid,rownum rid"
+ " from tf_custinfoweb t join ts_configsub s on "
+ "s.paraname='CARTNAME' and t.cartname=s.paravalue "
+ "where t.custtypeid = '2'";
/** 根据输入的accountid查询到该accountid下的所有产品清单 */
private static final String RelaListSQL = "select a.andcustrelaid, "
+ " c.productname, " + " a.citycode, " + " a.phonenum, "
+ " a.createtime, " + " a.state, "
+ " a.cancel_res, " + " a.cancel_comment, "
+ " a.userid " + " from tf_andcustrela a, "
+ " tf_custinfoweb b , " + " td_product c "
+ " where a.userid = b.userid"
+ " and a.productid = c.productid" + " and b.accountid = ? "
+ " and a.state = ? "
+ " order by a.state ";
/**
* 通过后台对某一个userid下的产品进行撤销操作
*/
private static final String UnRelaProdSQL = "update tf_andcustrela "
+ " set cancel_res=2, " + " cancel_comment=?,"
+ " State='D' " + " where userid = ? "
+ " and PhoneNum = ? " ;
/** 根据地市,搜索帐号信息 */
private static final String getPhoneNum = " select * from tf_andcustrela where userid = ? ";
private static String CITYCODE = "";
private DacClient _dac = null;
private DataTable dt = null;
private FileLogger _logger = new FileLogger();
public ForgetCihper() {
try {
_dac = new DacClient();
} catch (Exception ex) {
_logger.warn("数据库连接出错!", ex);
}
}
/**
* 设置本类的地市条件
*
* @param citycode
*/
public ForgetCihper(String citycode) {
CITYCODE = citycode;
ROWINFO = new Object[2];
ROWINFO[0] = S_DEFAULT_BGNROW;
ROWINFO[1] = S_DEFAULT_ENDROW;
try {
_dac = new DacClient();
} catch (Exception ex) {
_logger.warn("数据库连接出错!", ex);
}
}
public ForgetCihper(String citycode, String bgnRow, String endRow) {
CITYCODE = citycode;
ROWINFO = new Object[2];
if ((bgnRow == null) || (bgnRow.equals(""))) {
ROWINFO[0] = S_DEFAULT_BGNROW;
} else {
ROWINFO[0] = bgnRow;
}
if ((endRow == null) || (endRow.equals(""))) {
ROWINFO[1] = S_DEFAULT_ENDROW;
} else {
ROWINFO[1] = endRow;
}
try {
_dac = new DacClient();
} catch (Exception ex) {
_logger.warn("数据库连接出错!", ex);
}
}
/**
* 按产品模糊搜索到帐号
*
* @param phonenum
* @return
*/
public DataTable searchByProd(String phonenum, String state) {
try {
String sCityCode = "";
if (!CITYCODE.equals(""))
sCityCode = " and t.citycode in (" + CITYCODE + ") ";
String sql = " select a.* from ( "
+ RESEARCH
+ sCityCode
+ " ) a, "
+ " (select userid usid,state stat,phonenum from tf_andcustrela) b "
+ " where a.userid=b.usid and b.phonenum ='"
+ phonenum.trim() + "'";
if (!"ALL".equals(state)) {
// 所有状态不加任何条件,如果需要状态则需要将状态加进去
sql = sql + " and b.stat = '" + state + "'";
}
sql = sql + " order by a.accountid";
dt = _dac.executeQuery(S_SQL_F + sql + S_SQL_E, ROWINFO);
return dt;
} catch (Exception ex) {
_logger.warn(ex.getMessage(), ex);
}
return null;
}
/**
* 按帐号模糊搜索
*
* @param account
* @return
*/
public DataTable search(String account) {
try {
String sCityCode = "";
if (!CITYCODE.equals(""))
sCityCode = " and t.citycode in (" + CITYCODE + ") ";
String sql = RESEARCH + sCityCode + "and t.accountid like '%"
+ account + "%' order by t.accountid";
dt = _dac.executeQuery(S_SQL_F + sql + S_SQL_E, ROWINFO);
return dt;
} catch (Exception ex) {
_logger.warn(ex.getMessage(), ex);
}
return null;
}
public DataTable search(String account, String carname, String carno) {
try {
String sCityCode = "";
if (!CITYCODE.equals(""))
sCityCode = " and t.citycode in (" + CITYCODE + ") ";
String sql = RESEARCH + sCityCode + "and t.cartname=" + carname
+ " " + "and t.accountid like '%" + account + "%' and "
+ "t.cartno like '%" + carno
+ "%' order by t.accountid,cartno";
dt = _dac.executeQuery(S_SQL_F + sql + S_SQL_E, ROWINFO);
return dt;
} catch (Exception ex) {
_logger.warn(ex.getMessage(), ex);
}
return null;
}
/**
* 多种搜索条件
*
* @param account
* @param carname
* @param carno
* @param email
* @return
*/
public DataTable search(String account, String carname, String carno,
String email) {
try {
/**
* if(carname.equals("") || carname.equals("0"))
*
* else carname = " and t.cartname="+carname+" and ";
*/
carname = "";
String sCityCode = "";
if (!carno.equals(""))
carno = " and t.cartno like '%" + carno + "%' ";
if (!email.equals(""))
email = " and t.email like '%" + email + "%' ";
if (!CITYCODE.equals(""))
sCityCode = " and t.citycode in (" + CITYCODE + ") ";
String sql = RESEARCH + sCityCode + carname
+ " and t.accountid like '%" + account + "%' " + carno
+ email + "order by t.accountid,t.cartno,t.email";
// System.out.println("sql: "+sql+" citycode: "+CITYCODE);
dt = _dac.executeQuery(S_SQL_F + sql + S_SQL_E, ROWINFO);
return dt;
} catch (Exception ex) {
_logger.warn(ex.getMessage(), ex);
}
return null;
}
/**
* 客户输入的验证信息
*
* @param acc
* @param carName
* @param carNo
* @param eMail
* @return
*/
public String isTrue(String acc, String carName, String carNo, String eMail) {
try {
Object[] _object = new Object[] { acc, carName, carNo, eMail };
dt = _dac.executeQuery(S_SQL_INVALI, _object);
if (dt != null && dt.getRows().getCount() > 0) {
return setCihper(acc);
}
} catch (Exception ex) {
_logger.warn(ex.getMessage(), ex);
}
return "0";
}
/**
* 获取身份类型
*
* @return
*/
public String getCarName() {
String city = "<option value=0>请选择</option>";
try {
dt = _dac.executeQuery(S_SQL_CARNAME);
for (int i = 0; i < dt.getRows().getCount(); i++) {
DataRow dr = dt.getRow(i);
String v = dr.getString("PARAVALUE");
String t = dr.getString("PARADESC");
city += "<option value=\"" + v + "\">" + t + "</option>\n";
}
} catch (Exception ex) {
_logger.warn("无法获取身份类型!", ex);
}
return city;
}
/**
* <p>
* 管理员以某个地市登陆时
* </p>
*
* @param citycode
* @return
*/
public String getCityCodeSingle(String citycode) {
if (citycode == null || citycode.equals("") || citycode.equals("0590"))
return getCityCode();
String city = "<option value=0>请选择</option>";
try {
Object[] _object = new Object[] { citycode };
dt = _dac.executeQuery(S_CITYCODE, _object);
for (int i = 0; i < dt.getRows().getCount(); i++) {
DataRow dr = dt.getRow(i);
String v = dr.getString("CITYCODE");
String t = dr.getString("CITYNAME");
city += "<option value=\"" + v + "\">" + t + "</option>\n";
}
} catch (Exception ex) {
_logger.warn("无地市信息!", ex);
}
return city;
}
/**
* <p>
* 管理员省权限登陆
* </p>
*
* @return
*/
public String getCityCode() {
String city = "<option value=0>请选择</option>";
try {
dt = _dac.executeQuery(S_CITYCODEAll);
for (int i = 0; i < dt.getRows().getCount(); i++) {
DataRow dr = dt.getRow(i);
String v = dr.getString("CITYCODE");
String t = dr.getString("CITYNAME");
city += "<option value=\"" + v + "\">" + t + "</option>\n";
}
} catch (Exception ex) {
_logger.warn("无地市信息!", ex);
}
return city;
}
/**
*
* @param account
* @return
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -