⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.java

📁 jsp考勤
💻 JAVA
字号:
/*
 *	Copyright (C) 2000, TOA-System Co.  All rights reserved.
 */
package test;

import java.sql.*;
import java.text.*;
import exce.*;
import def.*;
import util.*;
import entity.*;
import dbcommon.*;

/**
 *	偙偺僋儔僗偼丄儘僌僀儞娭楢偺僋儔僗偱偡丅<br>
 *	@version	2.00
 *	@author		TOA
 */
public class Login {
	public Login() {}
	CommonUtil cu = new CommonUtil();
	ChangeField cf = new ChangeField();
	Status st = new Status();
	SimpleDateFormat sdf = new SimpleDateFormat(SISnet.DATE_FMT);

	/**
	 *	儘僌僀儞偺僠僃僢僋媦傃俿俿倄偺庢摼傪峴偆
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			loginID		儘僌僀儞俬俢
	 *			password	僷僗儚乕僪
	 */
	public String[] loginCheck(Connection	conn,								// 僐僱僋僔儑儞ID
							 String		loginID,								// 儘僌僀儞ID
							 String		password	) {							// 僷僗儚乕僪

		String		where	= "";
		String[]	rt		= new String[8];
		try {
			// User_Jouhou_002DataAccess僆僽僕僃僋僩偺findUser_Jouhou_002()儊僜僢僪傪幚峴偟傑偡丅
			User_Jouhou_002DataAccess ujda = new User_Jouhou_002DataAccess();
			where = "WHERE USER_CD = '" + loginID + "' AND PASSWORD = '" + password + "'";

			User_Jouhou_002Entity[] ujte = ujda.findUser_Jouhou_002(conn, where);

			if(ujte.length!=0){
					rt[0]	= ujte[0]._user_cd;
					rt[1]	= ujte[0]._user_nm;
					rt[2]	= ujte[0]._bumon_cd;
					rt[3]	= ujte[0]._bumon_nm;
					rt[4]	= ujte[0]._kengen_kubun;
					rt[5]	= "1";
					rt[6]	= ujte[0]._sex;
					rt[7]	= cf.intToStr(ujte[0]._nenrei);
			}
			else{
                    rt[5]	= "0";
			}
			// 尰嵼擔晅偺庢摼
			SISnet.TODAY         = 			cu.getToday();

			return(rt);
		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}

	/**
	 *	懚嵼偺僠僃僢僋媦傃俿俿倄偺庢摼傪峴偆
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			user_cd		儘僌僀儞俬俢
	 *			bumon_cd	僷僗儚乕僪
	 */
	public String [] search_Check(Connection conn,String user_cd,String bumon_cd){
		
		String		where	= "";
		String []	rt		= new String[9];
		try {
			// User_Jouhou_002DataAccess僆僽僕僃僋僩偺findUser_Jouhou_002()儊僜僢僪傪幚峴偟傑偡丅
			User_Jouhou_002DataAccess ujda = new User_Jouhou_002DataAccess();
			where = "WHERE USER_CD = '" + user_cd + "' AND BUMON_CD = '" + bumon_cd + "'";

			User_Jouhou_002Entity[] ujte = ujda.findUser_Jouhou_002(conn, where);
			if(ujte.length!=0){
					rt[0]	= ujte[0]._user_cd;
					rt[1]	= ujte[0]._user_nm;
					rt[2]	= ujte[0]._bumon_cd;
					rt[3]	= ujte[0]._bumon_nm;
					rt[4]	= ujte[0]._kengen_kubun;
					rt[5]	= "1";
					rt[6]	= ujte[0]._sex;
					rt[7]	= cf.intToStr(ujte[0]._nenrei);
					rt[8]	= ujte[0]._password;
			}
			else{
                    rt[5]	= "0";
			}

			return (rt);
		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}

	/**
	 *	擇師儘僌僀儞偺僠僃僢僋媦傃俿俿倄偺庢摼傪峴偆
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			loginID		儘僌僀儞俬俢
	 *			password	僷僗儚乕僪
	 */
	public String login_Touroku_Check(Connection	conn,						// 僐僱僋僔儑儞ID
							 String		loginID,								// 儘僌僀儞ID
							 String		password	) {							// 僷僗儚乕僪
		String		where	= "";
		String	rt		= "";
		try {
			Start_End_Time_001DataAccess setda = new Start_End_Time_001DataAccess();
			Start_End_Time_001Entity[] sette = setda.findStart_End_Time_001(conn,"");

			SISnet.START_TIME = sette[0]._start_time;   // 弌嬑帪揰
			SISnet.END_TIME   = sette[0]._end_time;     // 戅嬑帪揰
			// Syutuketu_Jouhou_003DataAccess僆僽僕僃僋僩偺findSyutuketu_Jouhou_003()儊僜僢僪傪幚峴偟傑偡丅
			Syutuketu_Jouhou_003DataAccess sjda = new Syutuketu_Jouhou_003DataAccess();

			where = "WHERE USER_CD = '" + loginID + "' AND DATE_TIME = to_date('" + sdf.format(cf.strToDate(SISnet.TODAY))+"','yyyy/mm/dd')" ;

			Syutuketu_Jouhou_003Entity[] sjte = sjda.findSyutuketu_Jouhou_003(conn, where);

			if(sjte.length!=0){			
			        rt	= "1";
			}
			else{
                    rt	= "0";
			}

			return rt;
		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}

	/**
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			pr		
	 */
	public void login_Touroku(Connection conn,String[]	pr) {							
		try {
            // Start_End_Time_001DataAccess僆僽僕僃僋僩偺findStart_End_Time_001()儊僜僢僪傪幚峴偟傑偡丅
			Start_End_Time_001DataAccess setda = new Start_End_Time_001DataAccess();
			Start_End_Time_001Entity[] sette = setda.findStart_End_Time_001(conn,"");

			SISnet.START_TIME = sette[0]._start_time;   // 弌嬑帪揰
			SISnet.END_TIME   = sette[0]._end_time;     // 戅嬑帪揰

			// Syutuketu_Jouhou_003DataAccess僆僽僕僃僋僩偺findMtanto()儊僜僢僪傪幚峴偟傑偡丅
			Syutuketu_Jouhou_003DataAccess sjda = new Syutuketu_Jouhou_003DataAccess();
			Syutuketu_Jouhou_003Entity sjee 	= new Syutuketu_Jouhou_003Entity();

            double tikoku =0.0;
			int hhmm  =   cu.gethhmm();
			int time  =   hhmm - SISnet.START_TIME;
			
			if(time>5){
				if(hhmm%100%30==0){
                      tikoku  = hhmm/100+(hhmm%100)/30*0.5-SISnet.START_TIME/100-(SISnet.START_TIME%100)/30*0.5;
				}
				else{
					  tikoku  = hhmm/100+(hhmm%100)/30*0.5+0.5-SISnet.START_TIME/100-(SISnet.START_TIME%100)/30*0.5;
				}
			}
					sjee._user_cd  = pr[0];
					sjee._user_nm  = pr[1];
					sjee._bumon_cd  = pr[2];
					sjee._bumon_nm  = pr[3];
					sjee._date_time = cf.strToDate(SISnet.TODAY);            // 擔晅
					sjee._tikoku = tikoku;               // 抶崗
					sjee._soutai = 0.0;     
					sjee._zangyou = 0.0;     
					sjee._ketukin = 0.0;     
					sjee._xiujia = 0.0; 
					sjee._syutyou = 0.0;
					sjee._start_end_kubun = "0";
					sjee._start_time = hhmm;           // 弌嬑帪揰
					sjee._end_time = 0;
					sjee._update_user= pr[0];
					sjee._olupdate_user= pr[0];

	        sjda.createSyutuketu_Jouhou_003(conn, sjee);

		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}

	/**
	 *	擇師戅嬑儘僌僀儞偺僠僃僢僋媦傃俿俿倄偺庢摼傪峴偆
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			loginID		儘僌僀儞俬俢
	 *			password	僷僗儚乕僪
	 */
	public String [] endLogin_Touroku_Check(Connection	conn,								// 僐僱僋僔儑儞ID
							 String		loginID,								// 儘僌僀儞ID
							 String		password	) {							// 僷僗儚乕僪

		String		where	= "";
		String	rt []		= new String[4];
		try {
			// Syutuketu_Jouhou_003DataAccess僆僽僕僃僋僩偺findSyutuketu_Jouhou_003()儊僜僢僪傪幚峴偟傑偡丅
			Syutuketu_Jouhou_003DataAccess sjda = new Syutuketu_Jouhou_003DataAccess();

			where = "WHERE USER_CD = '" + loginID + "' AND DATE_TIME = to_date('" + sdf.format(cf.strToDate(SISnet.TODAY))+"','yyyy/mm/dd')" ;

			Syutuketu_Jouhou_003Entity[] sjte = sjda.findSyutuketu_Jouhou_003(conn, where);

			if(sjte.length!=0){			
					rt[0]	= "1";
					rt[1]	= sjte[0]._start_end_kubun;
					rt[2]	= cf.intToStr(sjte[0]._start_time);
					rt[3]	= cf.doubleToStr(sjte[0]._tikoku);
			}

			else{
					rt[0]	= "0";
					rt[1]	= "0";
			}

			return (rt);

		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}

	/**
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			pr		
	 */
	public void endLogin_Touroku(Connection conn,String[]	pr ,String[] touroku) {							
		try {
            // Start_End_Time_001DataAccess僆僽僕僃僋僩偺findStart_End_Time_001()儊僜僢僪傪幚峴偟傑偡丅
			Start_End_Time_001DataAccess setda = new Start_End_Time_001DataAccess();
			Start_End_Time_001Entity[] sette = setda.findStart_End_Time_001(conn,"");

			SISnet.START_TIME = sette[0]._start_time;   // 弌嬑帪揰
			SISnet.END_TIME   = sette[0]._end_time;     // 戅嬑帪揰

			// Syutuketu_Jouhou_003DataAccess僆僽僕僃僋僩偺findMtanto()儊僜僢僪傪幚峴偟傑偡丅
			Syutuketu_Jouhou_003DataAccess sjda = new Syutuketu_Jouhou_003DataAccess();
			Syutuketu_Jouhou_003Entity sjee 	= new Syutuketu_Jouhou_003Entity();

			int hhmm  =   cu.gethhmm();    // 戅嬑帪揰
			double  soutai =0.0;           // 憗戅
			double  zangyou =0.0;          // 巆嬈
			int	hh=hhmm/100;
			int mm=hhmm%100;
			int	hh_end=sette[0]._end_time/100;
			int mm_end=sette[0]._end_time%100;
		  if(mm_end-mm>=0){
			  mm=mm_end-mm;	
		      hh=hh_end-hh;
		  }
		  else{
			  mm=mm_end+60-mm;
			  hh=hh_end-hh-1;	
		  }
		  if(hh>0){
			  zangyou=0.0;
			  if(mm>30){
				  soutai=(hh+1)+0.0;
			  }
			  else if(mm>0){
				  soutai=hh+0.5;
			  }
			  else if(mm==0){
				  soutai=hh+0.0;
			  }
		  }
		  else if(hh==0){
			  zangyou=0.0;
			  if(mm>30){
				  soutai=1.0;
			  }
			  else if(mm>0){
				  soutai=0.5;
			  }
			  else if(mm==0){
				  soutai=0.0;
			  }
		  }
		  else{
			      soutai=0.0;
				  if(0-hh==1){
					  if(mm>30){
						  zangyou=0.0;
					  }
					  else if(mm>0){
						  zangyou=0.5;
					  }
					  else{
						  zangyou=1.0;
					  }
				  }
				  else{
					  if(mm>30){
						  zangyou=(0-hh-1)+0.0;
					  }
					  else if(mm>0){
						  zangyou=(0-hh-1)+0.5;
					  }
					  else{
						  zangyou=(0-hh)+0.0;
					  }
				  }
		  }						
					sjee._user_cd  = pr[0];
					sjee._user_nm  = pr[1];
					sjee._bumon_cd  = pr[2];
					sjee._bumon_nm  = pr[3];
					sjee._date_time = cf.strToDate(SISnet.TODAY);            // 擔晅
					sjee._tikoku = cf.strToDouble(touroku[3]);               // 抶崗
					sjee._soutai = soutai;     
					sjee._zangyou = zangyou;     
					sjee._ketukin = 0.0;     
					sjee._xiujia = 0.0; 
					sjee._syutyou = 0.0;
					sjee._start_end_kubun = "1";
					sjee._start_time = cf.strToInt(touroku[2]);           // 弌嬑帪揰
					sjee._end_time = hhmm;                  // 戅嬑帪揰
					sjee._update_user= pr[0];
					sjee._olupdate_user= pr[0];

	        sjda.updateSyutuketu_Jouhou_003(conn, sjee);

		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}

	/**僷僗儚乕僪偺曄峏
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			pr		
	 */
	public void password_xiugai(Connection conn,String newpassword,String[]	pr) {							
		try {

			// User_Jouhou_002DataAccess僆僽僕僃僋僩偺updateUser_Jouhou_002()儊僜僢僪傪幚峴偟傑偡丅
			User_Jouhou_002DataAccess ujda = new User_Jouhou_002DataAccess();
			User_Jouhou_002Entity ujee 	= new User_Jouhou_002Entity();

			ujee._user_cd  = pr[0];
			ujee._user_nm  = pr[1];
			ujee._bumon_cd  = pr[2];
			ujee._bumon_nm  = pr[3];
			ujee._kengen_kubun  = pr[4];
			ujee._sex  =pr[6];
			ujee._nenrei  =cf.strToInt(pr[7]);
			ujee._password  =newpassword;
			ujee._update_user= pr[0];
			ujee._olupdate_user= pr[0];

	        ujda.updateUser_Jouhou_002(conn, ujee);

		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}
	
	/**
	 *	儘僌僀儞偺僠僃僢僋媦傃俿俿倄偺庢摼傪峴偆
	 *	@param	conn		DB僪儔僀僶偺URL側偳
	 *			loginID		儘僌僀儞俬俢
	 *			password	僷僗儚乕僪
	 */
	public String codeCheck(Connection	conn,								// 
							 String		loginID) {							// 僐僱僋僔儑儞ID

		String		where	= "";
		String	rt		= "";
		try {
			// User_Jouhou_002DataAccess僆僽僕僃僋僩偺findUser_Jouhou_002()儊僜僢僪傪幚峴偟傑偡丅
			User_Jouhou_002DataAccess ujda = new User_Jouhou_002DataAccess();
			where = "WHERE USER_CD = '" + loginID + "'";

			User_Jouhou_002Entity[] ujte = ujda.findUser_Jouhou_002(conn, where);

			if(ujte.length!=0){				
					rt	= "1";
			}
			else{
                    rt	= "0";
			}
		
			return(rt);
		} catch (ApplicationException ae) {
			st = ae.getStatus();
			ae.printStackTrace();
			throw new ApplicationException(st.usermsg, st.errno);
		} catch (OracleException orae) {
			st = orae.getStatus();
			orae.printStackTrace();
			throw new OracleException(st);
		} catch (Exception e) {
			e.printStackTrace();
			throw new OriginalException(e);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -