@ -1,6 +1,14 @@
package com.zky.manager ;
import com.zky.pub.Common ;
import com.zky.pub.DbConn ;
import com.zky.pub.HashFmlBuf ;
import com.zky.util.jdbc.HashFmlBufResultSetHandler ;
import com.zky.util.jdbc.JDBCUtils ;
import org.apache.log4j.Logger ;
import javax.servlet.http.HttpServletRequest ;
import java.sql.Connection ;
import java.sql.PreparedStatement ;
import java.sql.ResultSet ;
@ -8,13 +16,6 @@ import java.sql.Statement;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.List ;
import javax.servlet.http.HttpServletRequest ;
import org.apache.log4j.Logger ;
import com.zky.pub.Common ;
import com.zky.pub.DbConn ;
import com.zky.pub.HashFmlBuf ;
import com.zky.util.jdbc.HashFmlBufResultSetHandler ;
import com.zky.util.jdbc.JDBCUtils ;
/ * *
功 能 :
1 、 验 证 口 令 checkPwd
@ -71,6 +72,7 @@ public class Login {
public HashFmlBuf para_menu ;
public String loginresult = null ;
public Login ( ) {
para_menu = new HashFmlBuf ( ) ;
}
@ -381,6 +383,10 @@ public class Login {
public int checkPwd ( String emppwd , HashFmlBuf para_out ) {
//清除输出缓冲区中的数据
para_out . finit ( ) ;
int j = 0 ;
ResultSet rs ;
Connection conn = null ;
PreparedStatement prep = null ;
//比较口令是否校验成功
if ( encrypt_optr_password ( emppwd ) . equals ( this . emppwd ) & & certid . equals ( this . certid ) ) {
@ -400,6 +406,7 @@ public class Login {
} else if ( ! encrypt_optr_password ( emppwd ) . equals ( this . emppwd ) ) {
para_out . fchg ( "CHECKTAG" , 0 , "00002" ) ;
para_out . fchg ( "ERRORINFO" , 0 , "您输入的登录密码不正确!" ) ;
return - 1 ;
} else {
para_out . fchg ( "ERRORINFO" , 0 , "您的UKEY登录信息不正确!" ) ;
@ -408,10 +415,7 @@ public class Login {
//判断岗位是否存在
//根据工号查询表 tab_empdept 获取部门
int j = 0 ;
ResultSet rs ;
Connection conn = null ;
PreparedStatement prep = null ;
String sql = "select b.frameworkid,b.parentdeptid,b.areaid,b.departid,b.acptsiteid,b.departname,b.departtypeid,a.jobcode,a.emppro ,a.DEPARTLVLID adjustlvlid, b.DEPARTLVLID lvlid from tab_empdept a,tab_department b where a.departid=b.departid and a.empid = ?" ;
try {
@ -494,6 +498,7 @@ public class Login {
//表示用户身份验证通过
passtag = "1" ;
return 0 ;
}
@ -782,10 +787,11 @@ public class Login {
public void loginLog ( HttpServletRequest request ) {
Login login = ( Login ) request . getSession ( ) . getAttribute ( "login" ) ;
String ipAddr = request . getRemoteAddr ( ) ;
ipAddr = "BMXT:" + ipAddr ; ;
ipAddr = "BMXT:" + ipAddr ;
loginresult = "登录成功!" ;
Connection conn = null ;
PreparedStatement prep = null ;
String sql = "insert into tf_l_logonlog (IPADDR,OPTRID,ACPTSITEID,LOGONTIME ) values(?,?,?,now())";
String sql = "insert into tf_l_logonlog (IPADDR,OPTRID,ACPTSITEID,LOGONTIME ,LOGINRESULT ) values(?,?,?,now(),? )";
try {
conn = DbConn . getConn ( ) ;
conn . setAutoCommit ( true ) ;
@ -793,6 +799,7 @@ public class Login {
prep . setString ( 1 , ipAddr ) ;
prep . setString ( 2 , login . getEmpname ( ) ) ;
prep . setString ( 3 , login . getDepartname ( ) ) ;
prep . setString ( 4 , loginresult ) ;
prep . executeUpdate ( ) ;
} catch ( Exception e ) {
} finally {
@ -804,6 +811,40 @@ public class Login {
}
}
}
public void loginLogfalse ( HttpServletRequest request ) {
Login login = ( Login ) request . getSession ( ) . getAttribute ( "login" ) ;
String ipAddr = request . getRemoteAddr ( ) ;
ipAddr = "BMXT:" + ipAddr ;
loginresult = "登陆失败!" ;
Connection conn = null ;
PreparedStatement prep = null ;
String sql = "insert into tf_l_logonlog (IPADDR,OPTRID,ACPTSITEID,LOGONTIME,LOGINRESULT) values(?,?,?,now(),?)" ;
try {
conn = DbConn . getConn ( ) ;
conn . setAutoCommit ( true ) ;
prep = conn . prepareStatement ( sql ) ;
prep . setString ( 1 , ipAddr ) ;
prep . setString ( 2 , login . getEmpname ( ) ) ;
prep . setString ( 3 , login . getDepartname ( ) ) ;
prep . setString ( 4 , loginresult ) ;
prep . executeUpdate ( ) ;
} catch ( Exception e ) {
} finally {
try {
if ( prep ! = null ) prep . close ( ) ;
if ( conn ! = null ) conn . close ( ) ;
} catch ( Exception e ) {
}
}
}
public void operateLog ( HttpServletRequest request , String menugn ) {
String ipAddr = request . getRemoteAddr ( ) ;
ipAddr = "BMXT" + ipAddr ;