Commit e9872038 authored by vvengurlekar's avatar vvengurlekar

EmpLeaveConf.java - commit statement written outside confirm method

EmpLvePrkBalTrfCanc.java
EmpLvePrkBalTrfConf.java - changes done for emp lve and prk transfer
EmpLvePrkBalTrfIC.java - 


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@188700 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b3ec1f5f
...@@ -3,7 +3,6 @@ package ibase.webitm.ejb.adm; ...@@ -3,7 +3,6 @@ package ibase.webitm.ejb.adm;
import ibase.system.config.AppConnectParm; import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;//Modified By Hemlata on[20/11/2014] [As per changes in framework to use genericUtility ] import ibase.utility.E12GenericUtility;//Modified By Hemlata on[20/11/2014] [As per changes in framework to use genericUtility ]
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal; import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
...@@ -534,6 +533,7 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC ...@@ -534,6 +533,7 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
String siteCodeFrom = ""; String siteCodeFrom = "";
String siteCodeTo = ""; String siteCodeTo = "";
java.util.Date joinDate = null ; java.util.Date joinDate = null ;
Date currentDate = new Date();
String tranMode = "", joinDateStr="", retString = ""; String tranMode = "", joinDateStr="", retString = "";
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
...@@ -694,7 +694,16 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC ...@@ -694,7 +694,16 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
retString = itmDBAccess.getErrorString( "", "VTELPTRF05", userId, "", conn ); retString = itmDBAccess.getErrorString( "", "VTELPTRF05", userId, "", conn );
return retString; return retString;
} }
//Added by Varsha V on 16-07-18 for adding condition of relieving date should less than current date
currentDate = new java.util.Date();
System.out.println("currentDate:::["+currentDate+"] relieveDate:::["+relieveDate+"]");
if(relieveDate.after(currentDate))
{
System.out.println("relieveDate is not greater than currentDate ::::");
retString = itmDBAccess.getErrorString( "", "VTELPTRF22", userId, "", conn );
return retString;
}
//Ended by Varsha V on 16-07-18 for adding condition of relieving date should less than current date
sql = "SELECT USR_LEV FROM USERS WHERE CODE = ? "; sql = "SELECT USR_LEV FROM USERS WHERE CODE = ? ";
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, loginCode ); pstmt.setString( 1, loginCode );
......
...@@ -98,6 +98,16 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -98,6 +98,16 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
try try
{ {
retString = confirm( tranId, xtraParams, forcedFlag, 2, conn); retString = confirm( tranId, xtraParams, forcedFlag, 2, conn);
//Added by varsha V on 03-08-18 for Commit statement
if(retString.contains("VTSUCC1"))
{
conn.commit();
}
else
{
conn.rollback();
}
//Ended by varsha V on 03-08-18 for Commit statement
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -214,7 +224,8 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -214,7 +224,8 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
} }
if (errString == null || errString.trim().length() == 0) if (errString == null || errString.trim().length() == 0)
{ {
conn.commit(); //commented commit statement by varsha V on 03-08-18
//conn.commit();
/*Modified by Anjali Rawankar on[22/08/2017][Start] /*Modified by Anjali Rawankar on[22/08/2017][Start]
*[Added for itmDbAccess]*/ *[Added for itmDbAccess]*/
//errString = getErrorString( "", "VTSUCC1" , this.userId ); //errString = getErrorString( "", "VTSUCC1" , this.userId );
...@@ -225,10 +236,11 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -225,10 +236,11 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
/*[Added for itmDbAccess] /*[Added for itmDbAccess]
*Modified by Anjali Rawankar on[22/08/2017][End]*/ *Modified by Anjali Rawankar on[22/08/2017][End]*/
} }
else //commented rollback statement by varsha V on 03-08-18
/*else
{ {
conn.rollback(); conn.rollback();
} }*/
} }
catch(Exception e) catch(Exception e)
{ {
......
...@@ -138,11 +138,14 @@ public class EmpLvePrkBalTrfCanc extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -138,11 +138,14 @@ public class EmpLvePrkBalTrfCanc extends ActionHandlerEJB implements EmpLvePrkBa
} }
else else
{ {
sql=" UPDATE EMP_LVEPRKBAL_TRFHDR SET STATUS = ?, STATUS_DATE = ? WHERE TRAN_ID= ? "; sql=" UPDATE EMP_LVEPRKBAL_TRFHDR SET STATUS = ?, STATUS_DATE = ?, EMP_CODE__CONF = ? WHERE TRAN_ID= ? ";
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, "X" ); pstmt.setString( 1, "X" );
pstmt.setTimestamp( 2, new java.sql.Timestamp( System.currentTimeMillis() ) ); pstmt.setTimestamp( 2, new java.sql.Timestamp( System.currentTimeMillis() ) );
pstmt.setString( 3, tranId ); // Added by Varsha V on 16/07/18 for updating EMP_CODE__CONF also
pstmt.setString( 3, userId );
// Ended by Varsha V on 16/07/18 for updating EMP_CODE__CONF also
pstmt.setString( 4, tranId );
pstmt.executeUpdate(); pstmt.executeUpdate();
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
if( updCnt > 0 ) if( updCnt > 0 )
......
package ibase.webitm.ejb.adm.adv; package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
...@@ -10,7 +9,6 @@ import java.sql.SQLException; ...@@ -10,7 +9,6 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.sql.Types; import java.sql.Types;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.naming.InitialContext; import javax.naming.InitialContext;
...@@ -20,15 +18,14 @@ import ibase.utility.BaseException; ...@@ -20,15 +18,14 @@ import ibase.utility.BaseException;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB; import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;//Added by sarita on 20 JULY 18 for [ITMDBAccessEJB] import ibase.webitm.ejb.ITMDBAccessEJB;
//import ibase.webitm.ejb.ITMDBAccessLocal; import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.ejb.adm.AdmCommon; import ibase.webitm.ejb.adm.AdmCommon;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
/**
/**Author: Umakanta Das * Author: Umakanta Das Desc:
* Desc:
* *
*/ */
@Stateless @Stateless
...@@ -38,53 +35,41 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -38,53 +35,41 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
* @see ActionHandlerEJB#ActionHandlerEJB() * @see ActionHandlerEJB#ActionHandlerEJB()
*/ */
AdmCommon admCommon = new AdmCommon(); AdmCommon admCommon = new AdmCommon();
public EmpLvePrkBalTrfConf()
{ public EmpLvePrkBalTrfConf() {
super(); super();
} }
public String confirm( String tranId, String xtraParams, String forcedFlag ) throws RemoteException, ITMException public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException {
{
Connection conn = null; Connection conn = null;
boolean errorFound = false; boolean errorFound = false;
String retStr = ""; String retStr = "";
try try {
{
conn = getConnection(); conn = getConnection();
System.out.println("tranId:::::["+tranId+"] xtraParams::::: ["+xtraParams+"] forcedFlag::::: ["+forcedFlag+"]"); System.out.println("tranId:::::[" + tranId + "] xtraParams::::: [" + xtraParams + "] forcedFlag::::: ["
retStr = confirm( tranId, xtraParams, forcedFlag, conn); + forcedFlag + "]");
System.out.println("Umakanta::retStr["+retStr+"]"); retStr = confirm(tranId, xtraParams, forcedFlag, conn);
} System.out.println("Umakanta::retStr[" + retStr + "]");
catch (Exception e) } catch (Exception e) {
{
errorFound = true; errorFound = true;
System.out.println("in confirm ["+e.getMessage()+"]" ); System.out.println("in confirm [" + e.getMessage() + "]");
e.printStackTrace(); e.printStackTrace();
} } finally {
finally try {
{ if (conn != null) {
try if (errorFound) {
{
if( conn != null )
{
if( errorFound )
{
System.out.println("Rolling Back Changes......"); System.out.println("Rolling Back Changes......");
conn.rollback(); conn.rollback();
} } else {
else
{
System.out.println("Commiting Changes......"); System.out.println("Commiting Changes......");
conn.commit(); conn.commit();
} }
conn.close(); conn.close();
conn = null; conn = null;
} }
} } catch (Exception e) {
catch(Exception e)
{
System.out.println("EmpLvePrkBalTrfConf :confirm :==>\n" + e); System.out.println("EmpLvePrkBalTrfConf :confirm :==>\n" + e);
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
...@@ -94,8 +79,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -94,8 +79,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
} }
/** /**
* This method handle the confirmation logic for * This method handle the confirmation logic for leave confirmation.
* leave confirmation.
* *
* @param conn * @param conn
* @param tranId * @param tranId
...@@ -109,11 +93,12 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -109,11 +93,12 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
* @throws BaseException * @throws BaseException
*/ */
@SuppressWarnings({ "unused", "resource" }) @SuppressWarnings({ "unused", "resource" })
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn) throws RemoteException, ITMException public String confirm(String tranId, String xtraParams, String forcedFlag, Connection conn) throws RemoteException, ITMException {
{ String retString = "";
String retString = ""; String successString = ""; String successString = "";
ResultSet rs = null; ResultSet rs1 = null; ResultSet rs = null;
PreparedStatement pStmt = null; PreparedStatement pStmt1 = null; PreparedStatement pStmt2 = null; PreparedStatement pStmt3 = null; PreparedStatement pStmt4 = null; PreparedStatement pStmt5 = null; ResultSet rs1 = null;
PreparedStatement pStmt = null, pStmt1 = null, pStmt2 = null, pStmt3 = null, pStmt4 = null, pStmt5 = null, pStmt6 = null;
CallableStatement callStmt = null; CallableStatement callStmt = null;
String sql = ""; String sql = "";
Timestamp tranDate = null; Timestamp tranDate = null;
...@@ -128,26 +113,26 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -128,26 +113,26 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
String empCodeConf = ""; String empCodeConf = "";
String balCodeAson = ""; String balCodeAson = "";
String balCode = ""; String balCode = "";
double lveBalance = 0.0D; double perkBalance = 0.0D; double lveBalance = 0.0D;
Timestamp relieveDateTM = null; Timestamp joinDate = null; double perkBalance = 0.0D;
Timestamp relieveDateTM = null;
String periodCode = ""; String periodCode = "";
String chgUser = ""; String chgUser = "";
String chgTerm = ""; String chgTerm = "";
String logEmpCode = ""; String logEmpCode = "";
String keyString = ""; String keyString = "";
String refSer = ""; String refSer = "";
String grade = ""; String cadre = ""; String siteCode = ""; String workSite = ""; String paySite = ""; String grade = "";
//Added & Commented by sarita to use object of ITMDBAccessEJB,EmpLeaveConf instead ITMDBAccessLocal,EmpLeaveConfLocal on 20 JULY 18.[START] String cadre = "";
/* ITMDBAccessLocal itmDBAccess = null; String siteCode = "";
EmpLeaveConfLocal empLeaveConf = null;*/ String workSite = "";
String paySite = "";
ITMDBAccessEJB itmDBAccess = null; ITMDBAccessEJB itmDBAccess = null;
EmpLeaveConf empLeaveConf = null; EmpLeaveConf empLeaveConf = null;
//Added & Commented by sarita to use object of ITMDBAccessEJB,EmpLeaveConf instead ITMDBAccessLocal,EmpLeaveConfLocal on 20 JULY 18.[END]
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
boolean successFlag = true; boolean successFlag = true;
StringBuffer xmlStringForID = null; StringBuffer xmlStringForID = null;
try try {
{
System.out.println("Inside confirm method of EmpLvePrkBalTrfConf"); System.out.println("Inside confirm method of EmpLvePrkBalTrfConf");
//Added & Commented by sarita to create object instead creating lookup for ITMDBAccessEJB on 20 JULY 18 [START] //Added & Commented by sarita to create object instead creating lookup for ITMDBAccessEJB on 20 JULY 18 [START]
/* AppConnectParm appConnect = new AppConnectParm(); /* AppConnectParm appConnect = new AppConnectParm();
...@@ -161,35 +146,39 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -161,35 +146,39 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
java.util.Date currentDate = new java.util.Date(); java.util.Date currentDate = new java.util.Date();
String currDateStr = sdf.format(currentDate); String currDateStr = sdf.format(currentDate);
System.out.println("currDateStr::::::[" + currDateStr + "]"); System.out.println("currDateStr::::::[" + currDateStr + "]");
Timestamp curDateTm = Timestamp.valueOf(genericUtility.getValidDateTimeString(currDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())); Timestamp curDateTm = Timestamp.valueOf(genericUtility.getValidDateTimeString(currDateStr,
genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
System.out.println("curDateTm - [" + curDateTm + "]"); System.out.println("curDateTm - [" + curDateTm + "]");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"); chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
if ((chgUser == null) || (chgUser.trim().length() == 0)) if ((chgUser == null) || (chgUser.trim().length() == 0)) {
{
chgUser = "SYSTEM"; chgUser = "SYSTEM";
} }
if ((chgTerm == null) || (chgTerm.trim().length() == 0)) if ((chgTerm == null) || (chgTerm.trim().length() == 0)) {
{
chgTerm = "SYSTEM"; chgTerm = "SYSTEM";
} }
String userId = ""; String userId = "";
int count = 0; int updCnt = 0; int insrtStatus = 0; int selectCount = 0; int count = 0;
String admEnvReturn = ""; String admParameter = ""; int updCnt = 0;
int insrtStatus = 0;
int selectCount = 0;
String admEnvReturn = "";
String admParameter = "", statusEmpLeave = "";
Timestamp frDate = null; Timestamp toDate = null; Timestamp expDate = null; Timestamp frDate = null;
Timestamp toDate = null;
Timestamp expDate = null;
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
sql = " SELECT LEAV.TRAN_DATE, LEAV.TRAN_TYPE, LEAV.TRAN_MODE, LEAV.SITE_CODE__FR , LEAV.SITE_CODE__TO, LEAV.EMP_CODE__FR, LEAV.EMP_CODE__TO, LEAV.STATUS, LEAV.STATUS_DATE, LEAV.EMP_CODE__CONF, LEAV.BALANCE_ASON, EMP.RELIEVE_DATE, EMP.PERIOD_CODE, EMP.RELIEVE_DATE, EMP.DATE_JOIN FROM EMP_LVEPRKBAL_TRFHDR LEAV INNER JOIN EMPLOYEE EMP ON LEAV.EMP_CODE__FR = EMP.EMP_CODE WHERE LEAV.TRAN_ID = ? "; sql = " SELECT LEAV.TRAN_DATE, LEAV.TRAN_TYPE, LEAV.TRAN_MODE, LEAV.SITE_CODE__FR , LEAV.SITE_CODE__TO, LEAV.EMP_CODE__FR, LEAV.EMP_CODE__TO, LEAV.STATUS, LEAV.STATUS_DATE, LEAV.EMP_CODE__CONF, LEAV.BALANCE_ASON FROM EMP_LVEPRKBAL_TRFHDR LEAV WHERE LEAV.TRAN_ID = ? FOR UPDATE NOWAIT ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId); pStmt.setString(1, tranId);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) if (rs.next()) {
{
tranDate = rs.getTimestamp("TRAN_DATE"); tranDate = rs.getTimestamp("TRAN_DATE");
tranType = checkNull(rs.getString("TRAN_TYPE")); tranType = checkNull(rs.getString("TRAN_TYPE"));
tranMode = checkNull(rs.getString("TRAN_MODE")); tranMode = checkNull(rs.getString("TRAN_MODE"));
...@@ -201,31 +190,23 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -201,31 +190,23 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
statusDate = rs.getDate("STATUS_DATE"); statusDate = rs.getDate("STATUS_DATE");
empCodeConf = checkNull(rs.getString("EMP_CODE__CONF")); empCodeConf = checkNull(rs.getString("EMP_CODE__CONF"));
balCodeAson = checkNull(rs.getString("BALANCE_ASON")); balCodeAson = checkNull(rs.getString("BALANCE_ASON"));
relieveDateTM = rs.getTimestamp("RELIEVE_DATE");
joinDate = rs.getTimestamp("DATE_JOIN");
periodCode = checkNull(rs.getString("PERIOD_CODE"));
} }
if (rs != null) if (rs != null) {
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pStmt != null) if (pStmt != null) {
{
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
} }
String releiveDateStr = genericUtility.getValidDateTimeString(relieveDateTM.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat());
System.out.println("releiveDateStr:::::[" + releiveDateStr + "]"); if ("X".equalsIgnoreCase(status)) {
if ("X".equalsIgnoreCase(status))
{
retString = itmDBAccess.getErrorString("", "VTELPTRF16", userId, "", conn); retString = itmDBAccess.getErrorString("", "VTELPTRF16", userId, "", conn);
successFlag = false; successFlag = false;
return retString; return retString;
} }
if ("C".equalsIgnoreCase(status)) else if ("C".equalsIgnoreCase(status)) {
{
retString = itmDBAccess.getErrorString("", "VTELPTRF17", userId, "", conn); retString = itmDBAccess.getErrorString("", "VTELPTRF17", userId, "", conn);
successFlag = false; successFlag = false;
return retString; return retString;
...@@ -237,49 +218,77 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -237,49 +218,77 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) if (rs.next()) {
{
count = rs.getInt("ROW_CNT"); count = rs.getInt("ROW_CNT");
} }
System.out.println("count:::: [" + count + "]"); System.out.println("count:::: [" + count + "]");
if (rs != null) if (rs != null) {
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pStmt != null) if (pStmt != null) {
{
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
} }
if (count <= 0) if (count <= 0) {
{
retString = itmDBAccess.getErrorString("", "VTELPTRF18", userId, "", conn); retString = itmDBAccess.getErrorString("", "VTELPTRF18", userId, "", conn);
successFlag = false; successFlag = false;
return retString; return retString;
} }
sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, empCodeFr);
rs = pStmt.executeQuery();
if (rs.next()) {
relieveDateTM = rs.getTimestamp("RELIEVE_DATE");
}
if (rs != null) {
rs.close();
rs = null;
}
if (pStmt != null) {
pStmt.close();
pStmt = null;
}
String releiveDateStr = genericUtility.getValidDateTimeString(relieveDateTM.toString(),
genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat());
System.out.println("releiveDateStr:::::[" + releiveDateStr + "]");
sql = "SELECT CODE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE";
pStmt = conn.prepareStatement(sql);
pStmt.setTimestamp(1, relieveDateTM);
rs = pStmt.executeQuery();
if (rs.next()) {
periodCode = checkNull(rs.getString("CODE"));
}
if (rs != null) {
rs.close();
rs = null;
}
if (pStmt != null) {
pStmt.close();
pStmt = null;
}
sql = "SELECT GRADE, CADRE, EMP_SITE, WORK_SITE, PAY_SITE FROM EMPLOYEE WHERE EMP_CODE = ? "; sql = "SELECT GRADE, CADRE, EMP_SITE, WORK_SITE, PAY_SITE FROM EMPLOYEE WHERE EMP_CODE = ? ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, empCodeTo); pStmt.setString(1, empCodeTo);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) if (rs.next()) {
{
grade = checkNull(rs.getString("GRADE")); grade = checkNull(rs.getString("GRADE"));
cadre = checkNull(rs.getString("CADRE")); cadre = checkNull(rs.getString("CADRE"));
siteCode = checkNull(rs.getString("EMP_SITE")); siteCode = checkNull(rs.getString("EMP_SITE"));
workSite = checkNull(rs.getString("WORK_SITE")); workSite = checkNull(rs.getString("WORK_SITE"));
paySite = checkNull(rs.getString("PAY_SITE")); paySite = checkNull(rs.getString("PAY_SITE"));
} }
if (rs != null) {
if (rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pStmt != null) if (pStmt != null) {
{
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
} }
...@@ -287,47 +296,38 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -287,47 +296,38 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
admParameter = "TRF" + tranType.trim() + "_BLUPD_PROC"; admParameter = "TRF" + tranType.trim() + "_BLUPD_PROC";
admEnvReturn = this.admCommon.getAdmEnv(siteCode, cadre, grade, admParameter, curDateTm, conn); admEnvReturn = this.admCommon.getAdmEnv(siteCode, cadre, grade, admParameter, curDateTm, conn);
if ((admEnvReturn == null) || (admEnvReturn.trim().length() == 0) || (admEnvReturn.equalsIgnoreCase("NULLFOUND"))) if ((admEnvReturn == null) || (admEnvReturn.trim().length() == 0)
{ || (admEnvReturn.equalsIgnoreCase("NULLFOUND"))) {
admEnvReturn = this.admCommon.getEnv("999999", admParameter, conn); admEnvReturn = this.admCommon.getEnv("999999", admParameter, conn);
if ((admEnvReturn == null) || (admEnvReturn.trim().length() == 0) || (admEnvReturn.equalsIgnoreCase("NULLFOUND"))) if ((admEnvReturn == null) || (admEnvReturn.trim().length() == 0)
{ || (admEnvReturn.equalsIgnoreCase("NULLFOUND"))) {
admEnvReturn = ""; admEnvReturn = "";
} }
} }
System.out.println("admEnvReturn:::::[" + admEnvReturn + "]"); System.out.println("admEnvReturn:::::[" + admEnvReturn + "]");
if ("LVE".equalsIgnoreCase(tranType)) if ("LVE".equalsIgnoreCase(tranType)) {
{
sql = " select key_string as keystr, ref_ser as refser from transetup where upper(tran_window) = 'W_EMPLEAVE' "; sql = " select key_string as keystr, ref_ser as refser from transetup where upper(tran_window) = 'W_EMPLEAVE' ";
} } else {
else
{
sql = " select key_string as keystr, ref_ser as refser from transetup where upper(tran_window) = 'T_EMP_ADLAPSE'"; sql = " select key_string as keystr, ref_ser as refser from transetup where upper(tran_window) = 'T_EMP_ADLAPSE'";
} }
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) if (rs.next()) {
{
keyString = checkNull(rs.getString("keystr")); keyString = checkNull(rs.getString("keystr"));
refSer = checkNull(rs.getString("refSer")); refSer = checkNull(rs.getString("refSer"));
} } else {
else
{
successFlag = false; successFlag = false;
} }
if (rs != null) if (rs != null) {
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pStmt != null) if (pStmt != null) {
{
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
} }
System.out.println("keyString[" + keyString + "]============= refSer[" + refSer + "]"); System.out.println("keyString[" + keyString + "]============= refSer[" + refSer + "]");
if (!successFlag) if (!successFlag) {
{
retString = itmDBAccess.getErrorString("", "VTSEQ", userId, "", conn); retString = itmDBAccess.getErrorString("", "VTSEQ", userId, "", conn);
return retString; return retString;
} }
...@@ -335,11 +335,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -335,11 +335,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
logEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); logEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
System.out.println("Umakanta::loginCode[" + logEmpCode + "]"); System.out.println("Umakanta::loginCode[" + logEmpCode + "]");
if ("LVE".equalsIgnoreCase(tranType)) if ("LVE".equalsIgnoreCase(tranType)) {
{
sql = " select sum(bal_days) as baldays from leavebal where emp_code = ? and lve_code = ? and EFF_DATE = ? and UPTO_DATE = ? and EXP_DATE >= ?";
pStmt1 = conn.prepareStatement(sql);
sql = "INSERT INTO EMPLEAVE ( EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, USE_FLAG, ENCH_AMT, NO_DAYS, STATUS_DATE, PRD_CODE, CHG_DATE, CHG_USER, CHG_TERM, APPL_DATE, TRAN_ID, LEAVE_STARTS, LEAVE_ENDS ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) "; sql = "INSERT INTO EMPLEAVE ( EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, USE_FLAG, ENCH_AMT, NO_DAYS, STATUS_DATE, PRD_CODE, CHG_DATE, CHG_USER, CHG_TERM, APPL_DATE, TRAN_ID, LEAVE_STARTS, LEAVE_ENDS ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ";
...@@ -348,13 +344,15 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -348,13 +344,15 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
sql = "SELECT count(*) as COUNT FROM EMPLEAVE WHERE TRAN_ID = ?"; sql = "SELECT count(*) as COUNT FROM EMPLEAVE WHERE TRAN_ID = ?";
pStmt3 = conn.prepareStatement(sql); pStmt3 = conn.prepareStatement(sql);
sql = " SELECT BALANCE_CODE, FROM_DATE, TO_DATE, SUM(BALANCE) AS BALANCE FROM EMP_LVEPRKBAL_TRFDET WHERE TRAN_ID = ? GROUP BY BALANCE_CODE, FROM_DATE, TO_DATE ORDER BY BALANCE_CODE, FROM_DATE, TO_DATE "; sql = "SELECT STATUS FROM EMPLEAVE WHERE TRAN_ID = ?";
pStmt4 = conn.prepareStatement(sql);
sql = " SELECT BALANCE_CODE, FROM_DATE, TO_DATE, BALANCE FROM EMP_LVEPRKBAL_TRFDET WHERE TRAN_ID = ? ORDER BY BALANCE_CODE, FROM_DATE, TO_DATE ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId); pStmt.setString(1, tranId);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
while (rs.next()) while (rs.next()) {
{
balCode = checkNull(rs.getString("BALANCE_CODE")); balCode = checkNull(rs.getString("BALANCE_CODE"));
lveBalance = rs.getDouble("BALANCE"); lveBalance = rs.getDouble("BALANCE");
frDate = rs.getTimestamp("FROM_DATE"); frDate = rs.getTimestamp("FROM_DATE");
...@@ -362,36 +360,13 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -362,36 +360,13 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
double balDays = 0.0D; double balDays = 0.0D;
pStmt1.setString(1, empCodeFr);
pStmt1.setString(2, balCode);
pStmt1.setTimestamp(3, frDate);
pStmt1.setTimestamp(4, toDate);
pStmt1.setTimestamp(5, relieveDateTM);
rs1 = pStmt1.executeQuery();
if (rs1.next())
{
balDays = rs1.getDouble("baldays");
}
if (rs1 != null)
{
rs1.close();
rs1 = null;
}
pStmt1.clearParameters();
if (lveBalance > balDays)
{
retString = itmDBAccess.getErrorString("", "VTELPTRF20", userId, "", conn);
successFlag = false;
break;
}
xmlStringForID = new StringBuffer(); xmlStringForID = new StringBuffer();
xmlStringForID.append("<Root><Detail1><appl_date>" + curDateTm + "</appl_date><lve_code>" + balCode + "</lve_code>" + xmlStringForID.append("<Root><Detail1><appl_date>" + curDateTm + "</appl_date><lve_code>" + balCode
"<lve_date_fr>" + releiveDateStr + "</lve_date_fr>" + + "</lve_code>" + "<lve_date_fr>" + releiveDateStr + "</lve_date_fr>" + "<work_site>"
"<work_site>" + workSite + "</work_site>" + "</Detail1></Root>"); + workSite + "</work_site>" + "</Detail1></Root>");
System.out.println("xmlStringForID::::[" + xmlStringForID + "]"); System.out.println("xmlStringForID::::[" + xmlStringForID + "]");
TransIDGenerator tg = new TransIDGenerator(xmlStringForID.toString(), "SYSTEM", CommonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(xmlStringForID.toString(), "SYSTEM",
CommonConstants.DB_NAME);
String tranIdGen = tg.generateTranSeqID(refSer, "", keyString, conn); String tranIdGen = tg.generateTranSeqID(refSer, "", keyString, conn);
System.out.println("Umakanta::uniqueKey[" + tranIdGen + "]"); System.out.println("Umakanta::uniqueKey[" + tranIdGen + "]");
...@@ -416,83 +391,93 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -416,83 +391,93 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
System.out.println("insert executed = [" + insrtStatus + "]"); System.out.println("insert executed = [" + insrtStatus + "]");
pStmt2.clearParameters(); pStmt2.clearParameters();
if (insrtStatus > 0) if (insrtStatus > 0) {
{
pStmt3.setString(1, tranIdGen); pStmt3.setString(1, tranIdGen);
rs1 = pStmt3.executeQuery(); rs1 = pStmt3.executeQuery();
if (rs1.next()) if (rs1.next()) {
{
selectCount = rs1.getInt("COUNT"); selectCount = rs1.getInt("COUNT");
} }
if (rs1 != null) if (rs1 != null) {
{
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
} }
pStmt3.clearParameters();
System.out.println("empLeave.table::selectCount[" + selectCount + "]"); System.out.println("empLeave.table::selectCount[" + selectCount + "]");
System.out.println("empLeave.table::tranIdGen[" + tranIdGen + "]"); System.out.println("empLeave.table::tranIdGen[" + tranIdGen + "]");
System.out.println("empLeave.table::xtraParams[" + xtraParams + "]"); System.out.println("empLeave.table::xtraParams[" + xtraParams + "]");
String confirmStatus = empLeaveConf.confirm(tranIdGen, xtraParams, "Y", conn); String confirmStatus = empLeaveConf.confirm(tranIdGen, xtraParams, "Y",1, conn);
System.out.println("empLeaveConf.confirm::confirmStatus[" + confirmStatus + "]"); System.out.println("empLeaveConf.confirm::confirmStatus[" + confirmStatus + "]");
if (selectCount > 0) if(!confirmStatus.contains("VTSUCC1"))
{ {
successFlag = false;
retString = confirmStatus;
break;
}
pStmt4.setString(1, tranIdGen);
rs1 = pStmt4.executeQuery();
if (rs1.next()) {
statusEmpLeave = checkNull(rs1.getString("status"));
}
if (rs1 != null) {
rs1.close();
rs1 = null;
}
pStmt4.clearParameters();
System.out.println("empLeave.table::statusEmpLeave[" + statusEmpLeave + "]");
if (statusEmpLeave.equalsIgnoreCase("A")) {
successFlag = true; successFlag = true;
successString = confirmStatus; successString = confirmStatus;
} } else {
else
{
retString = confirmStatus; retString = confirmStatus;
successFlag = false; successFlag = false;
break; break;
} }
} System.out.println("::After EmpLeave status successFlag[" + successFlag + "]");
else } else {
{
successFlag = false; successFlag = false;
break; break;
} }
} }
if (pStmt1 != null) if (rs1 != null) {
{ rs1.close();
rs1 = null;
}
if (pStmt1 != null) {
pStmt1.close(); pStmt1.close();
pStmt1 = null; pStmt1 = null;
} }
if (pStmt2 != null) if (pStmt2 != null) {
{
pStmt2.close(); pStmt2.close();
pStmt2 = null; pStmt2 = null;
} }
if (pStmt3 != null) if (pStmt3 != null) {
{
pStmt3.close(); pStmt3.close();
pStmt3 = null; pStmt3 = null;
} }
if (rs != null) if (pStmt4 != null) {
{ pStmt4.close();
pStmt4 = null;
}
if (rs != null) {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pStmt != null) if (pStmt != null) {
{
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
} }
if ((retString != null) && (retString.trim().length() > 0)) if ((retString != null) && (retString.trim().length() > 0)) {
{
System.out.println("retString:::::[ " + retString + " ] "); System.out.println("retString:::::[ " + retString + " ] ");
successFlag = false; successFlag = false;
return retString; return retString;
} }
if (successFlag) if (successFlag) {
{ if ((admEnvReturn != null) && (admEnvReturn.trim().length() > 0)
if ((admEnvReturn != null) && (admEnvReturn.trim().length() > 0) && (!admEnvReturn.equalsIgnoreCase("NULLFOUND"))) && (!admEnvReturn.equalsIgnoreCase("NULLFOUND"))) {
{ try {
try
{
System.out.println("Inside callable statement"); System.out.println("Inside callable statement");
String procSql = "{call " + admEnvReturn + "(?,?,?,?,?)}"; String procSql = "{call " + admEnvReturn + "(?,?,?,?,?)}";
callStmt = conn.prepareCall(procSql); callStmt = conn.prepareCall(procSql);
...@@ -503,22 +488,19 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -503,22 +488,19 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
callStmt.registerOutParameter(5, Types.VARCHAR); callStmt.registerOutParameter(5, Types.VARCHAR);
callStmt.executeQuery(); callStmt.executeQuery();
String outParam = callStmt.getString(5); String outParam = callStmt.getString(5);
if (callStmt != null) if (callStmt != null) {
{
callStmt.close(); callStmt.close();
callStmt = null; callStmt = null;
} }
System.out.println("outParam::::["+outParam+"]"); System.out.println("outParam::::[" + outParam + "]");
if ((outParam != null) && (outParam.trim().length() > 0)) if ((outParam != null) && (outParam.trim().length() > 0)) {
{ // retString = itmDBAccess.getErrorString("", "VTELPTRF53", userId, "", conn);
retString = itmDBAccess.getErrorString("", "VTELPTRF53", userId, "", conn); retString = itmDBAccess.getErrorString("", outParam.trim(), userId, "", conn);
successFlag = false; successFlag = false;
} }
successFlag = true; successFlag = true;
} } catch (SQLException se) {
catch (SQLException se)
{
se.printStackTrace(); se.printStackTrace();
retString = this.admCommon.getErrorMessage(se, ""); retString = this.admCommon.getErrorMessage(se, "");
retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId); retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId);
...@@ -528,19 +510,14 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -528,19 +510,14 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
} }
} } else {
else retString = itmDBAccess.getErrorString("", "VTELPTRF24", userId, "", conn);
{
retString = itmDBAccess.getErrorString("", "VTELPTRF52", userId, "", conn);
successFlag = false; successFlag = false;
return retString; return retString;
} }
} }
} } else if ("PRK".equalsIgnoreCase(tranType)) {
else if ("PRK".equalsIgnoreCase(tranType)) if (empCodeTo.length() <= 0) {
{
if (empCodeTo.length() <= 0)
{
retString = itmDBAccess.getErrorString("", "VTELPTRF19", userId, "", conn); retString = itmDBAccess.getErrorString("", "VTELPTRF19", userId, "", conn);
successFlag = false; successFlag = false;
return retString; return retString;
...@@ -566,6 +543,15 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -566,6 +543,15 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
pStmt5 = conn.prepareStatement(sql); pStmt5 = conn.prepareStatement(sql);
// Added by Varsha V on 16-07-18 for updating AMOUNT for emp_code_fr
// Modified by Piyush on 18/07/2018 [Should not update amount]
// sql = "UPDATE ALLOWDEDN_BAL set AMOUNT = AMOUNT - ?, AMT_ADJ = AMT_ADJ + ?,
// AMT_BAL = AMT_BAL - ? WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ?
// AND END_DATE = ?";
sql = "UPDATE ALLOWDEDN_BAL set AMT_ADJ = AMT_ADJ + ?, AMT_BAL = AMT_BAL - ? WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
pStmt6 = conn.prepareStatement(sql);
// Ended by Varsha V on 16-07-18 for updating AMOUNT for emp_code_fr
String procSql = "{call " + admEnvReturn + "(?,?,?,?,?)}"; String procSql = "{call " + admEnvReturn + "(?,?,?,?,?)}";
callStmt = conn.prepareCall(procSql); callStmt = conn.prepareCall(procSql);
...@@ -575,8 +561,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -575,8 +561,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
pStmt.setString(1, tranId); pStmt.setString(1, tranId);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
int ctr = 0; int ctr = 0;
while (rs.next()) while (rs.next()) {
{
balCode = checkNull(rs.getString("BALANCE_CODE")); balCode = checkNull(rs.getString("BALANCE_CODE"));
frDate = rs.getTimestamp("FROM_DATE"); frDate = rs.getTimestamp("FROM_DATE");
toDate = rs.getTimestamp("TO_DATE"); toDate = rs.getTimestamp("TO_DATE");
...@@ -584,12 +569,12 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -584,12 +569,12 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
perkBalance = rs.getDouble("BALANCE"); perkBalance = rs.getDouble("BALANCE");
xmlStringForID = new StringBuffer(); xmlStringForID = new StringBuffer();
xmlStringForID.append("<Root><Detail1><pay_site>" + xmlStringForID.append("<Root><Detail1><pay_site>" + paySite + "</pay_site><site_code>" + siteCode
paySite + "</pay_site><site_code>" + siteCode + "</site_code><ad_code>" + balCode + "</ad_code>" + + "</site_code><ad_code>" + balCode + "</ad_code>" + "<tran_date>" + currDateStr
"<tran_date>" + currDateStr + "</tran_date>" + + "</tran_date>" + "</Detail1></Root>");
"</Detail1></Root>");
System.out.println("xmlStringForID::::[" + xmlStringForID + "]"); System.out.println("xmlStringForID::::[" + xmlStringForID + "]");
TransIDGenerator tg = new TransIDGenerator(xmlStringForID.toString(), "SYSTEM", CommonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(xmlStringForID.toString(), "SYSTEM",
CommonConstants.DB_NAME);
String tranIdGen = tg.generateTranSeqID(refSer, "", keyString, conn); String tranIdGen = tg.generateTranSeqID(refSer, "", keyString, conn);
System.out.println("Umakanta::uniqueKey[" + tranIdGen + "]"); System.out.println("Umakanta::uniqueKey[" + tranIdGen + "]");
...@@ -609,12 +594,9 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -609,12 +594,9 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
insrtStatus = pStmt1.executeUpdate(); insrtStatus = pStmt1.executeUpdate();
System.out.println("insert executed = [" + insrtStatus + "]"); System.out.println("insert executed = [" + insrtStatus + "]");
pStmt1.clearParameters(); pStmt1.clearParameters();
if (insrtStatus > 0) if (insrtStatus > 0) {
{
successFlag = true; successFlag = true;
} } else {
else
{
successFlag = false; successFlag = false;
break; break;
} }
...@@ -634,35 +616,30 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -634,35 +616,30 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
insrtStatus = pStmt2.executeUpdate(); insrtStatus = pStmt2.executeUpdate();
System.out.println("insert executed = [" + insrtStatus + "]"); System.out.println("insert executed = [" + insrtStatus + "]");
pStmt2.clearParameters(); pStmt2.clearParameters();
if (insrtStatus > 0) if (insrtStatus > 0) {
{
successFlag = true; successFlag = true;
} } else {
else
{
successFlag = false; successFlag = false;
break; break;
} }
System.out.println("*************admEnvReturn:::::[" + admEnvReturn + "]"); System.out.println("*************admEnvReturn:::::[" + admEnvReturn + "]");
if ((admEnvReturn == null) || (admEnvReturn.trim().length() == 0) || (admEnvReturn.equalsIgnoreCase("NULLFOUND"))) if ((admEnvReturn == null) || (admEnvReturn.trim().length() == 0)
{ || (admEnvReturn.equalsIgnoreCase("NULLFOUND"))) {
insrtStatus = 0;
pStmt3.setString(1, empCodeTo); pStmt3.setString(1, empCodeTo);
pStmt3.setString(2, balCode); pStmt3.setString(2, balCode);
pStmt3.setTimestamp(3, frDate); pStmt3.setTimestamp(3, frDate);
pStmt3.setTimestamp(4, toDate); pStmt3.setTimestamp(4, toDate);
rs1 = pStmt3.executeQuery(); rs1 = pStmt3.executeQuery();
if (rs1.next()) if (rs1.next()) {
{
insrtStatus = rs1.getInt("COUNT"); insrtStatus = rs1.getInt("COUNT");
} }
if (rs1 != null) if (rs1 != null) {
{
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
} }
pStmt3.clearParameters(); pStmt3.clearParameters();
if (insrtStatus > 0) if (insrtStatus > 0) {
{
pStmt4.setDouble(1, perkBalance); pStmt4.setDouble(1, perkBalance);
pStmt4.setDouble(2, perkBalance); pStmt4.setDouble(2, perkBalance);
pStmt4.setString(3, empCodeTo); pStmt4.setString(3, empCodeTo);
...@@ -671,18 +648,13 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -671,18 +648,13 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
pStmt4.setTimestamp(6, toDate); pStmt4.setTimestamp(6, toDate);
updCnt = pStmt4.executeUpdate(); updCnt = pStmt4.executeUpdate();
pStmt4.clearParameters(); pStmt4.clearParameters();
if (updCnt > 0) if (updCnt > 0) {
{
successFlag = true; successFlag = true;
} } else {
else
{
successFlag = false; successFlag = false;
break; break;
} }
} } else {
else
{
pStmt5.setString(1, empCodeTo); pStmt5.setString(1, empCodeTo);
pStmt5.setString(2, balCode); pStmt5.setString(2, balCode);
pStmt5.setTimestamp(3, frDate); pStmt5.setTimestamp(3, frDate);
...@@ -700,23 +672,52 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -700,23 +672,52 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
updCnt = pStmt5.executeUpdate(); updCnt = pStmt5.executeUpdate();
System.out.println("insert executed = [" + updCnt + "]"); System.out.println("insert executed = [" + updCnt + "]");
pStmt5.clearParameters(); pStmt5.clearParameters();
if (updCnt > 0) if (updCnt > 0) {
{
successFlag = true; successFlag = true;
} else {
successFlag = false;
break;
} }
else }
{ // Added by Varsha V on 16-07-18 for updating AMOUNT for emp_code_fr
if (successFlag) {
// Modified by Piyush on 18/07/2018 [Should not update amount].Start
pStmt6.setDouble(1, perkBalance);
pStmt6.setDouble(2, perkBalance);
pStmt6.setString(3, empCodeFr);
pStmt6.setString(4, balCode);
pStmt6.setTimestamp(5, frDate);
pStmt6.setTimestamp(6, toDate);
// Modified by Piyush on 18/07/2018 [Should not update amount].End
updCnt = pStmt6.executeUpdate();
pStmt6.clearParameters();
if (updCnt > 0) {
successFlag = true;
} else {
successFlag = false; successFlag = false;
break; break;
} }
} }
// Ended by Varsha V on 16-07-18 for updating AMOUNT for emp_code_fr
} }
else // Modified by Piyush on 18/07/2018 [Procedure should be called outside of loop
{ // as it should happen once only].Start
try }
{
if (rs != null) {
rs.close();
rs = null;
}
if (pStmt != null) {
pStmt.close();
pStmt = null;
}
if ((admEnvReturn != null) && (admEnvReturn.trim().length() > 0)
&& (!admEnvReturn.equalsIgnoreCase("NULLFOUND"))) {
try {
System.out.println("Inside callable statement"); System.out.println("Inside callable statement");
System.out.println("tranId:::["+tranId+"] chgUser:::["+chgUser+"] empCodeTo:::["+empCodeTo+"] chgTerm:::["+chgTerm+"]"); System.out.println("tranId:::[" + tranId + "] chgUser:::[" + chgUser + "] empCodeTo:::["
+ empCodeTo + "] chgTerm:::[" + chgTerm + "]");
callStmt.setString(1, tranId); callStmt.setString(1, tranId);
callStmt.setString(2, chgUser); callStmt.setString(2, chgUser);
callStmt.setString(3, empCodeTo); callStmt.setString(3, empCodeTo);
...@@ -724,23 +725,18 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -724,23 +725,18 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
callStmt.registerOutParameter(5, Types.VARCHAR); callStmt.registerOutParameter(5, Types.VARCHAR);
callStmt.executeQuery(); callStmt.executeQuery();
String outParam = callStmt.getString(5); String outParam = callStmt.getString(5);
if (callStmt != null) if (callStmt != null) {
{
callStmt.close(); callStmt.close();
callStmt = null; callStmt = null;
} }
System.out.println("outParam::::["+outParam+"]"); System.out.println("outParam::::[" + outParam + "]");
if ((outParam != null) && (outParam.trim().length() > 0)) if ((outParam != null) && (outParam.trim().length() > 0)) {
{ retString = itmDBAccess.getErrorString("", outParam.trim(), userId, "", conn);
retString = itmDBAccess.getErrorString("", "VTELPTRF53", userId, "", conn);
successFlag = false; successFlag = false;
break; } else {
}
successFlag = true; successFlag = true;
} }
catch (SQLException se) } catch (SQLException se) {
{
se.printStackTrace(); se.printStackTrace();
retString = this.admCommon.getErrorMessage(se, ""); retString = this.admCommon.getErrorMessage(se, "");
retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId); retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId);
...@@ -750,51 +746,45 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -750,51 +746,45 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
} }
} }
} }
if (pStmt1 != null)
{ if (rs != null) {
rs.close();
rs = null;
}
if (pStmt != null) {
pStmt.close();
pStmt = null;
}
if (rs1 != null) {
rs1.close();
rs1 = null;
}
if (pStmt1 != null) {
pStmt1.close(); pStmt1.close();
pStmt1 = null; pStmt1 = null;
} }
if (pStmt2 != null) if (pStmt2 != null) {
{
pStmt2.close(); pStmt2.close();
pStmt2 = null; pStmt2 = null;
} }
if (pStmt3 != null) if (pStmt3 != null) {
{
pStmt3.close(); pStmt3.close();
pStmt3 = null; pStmt3 = null;
} }
if (pStmt4 != null) if (pStmt4 != null) {
{
pStmt4.close(); pStmt4.close();
pStmt4 = null; pStmt4 = null;
} }
if (pStmt5 != null) if (pStmt5 != null) {
{
pStmt5.close(); pStmt5.close();
pStmt5 = null; pStmt5 = null;
} }
if (rs != null) if (pStmt6 != null) {
{ pStmt6.close();
rs.close(); pStmt6 = null;
rs = null;
}
if (pStmt != null)
{
pStmt.close();
pStmt = null;
}
if (callStmt != null)
{
callStmt.close();
callStmt = null;
}
} }
if (successFlag) if (successFlag) {
{
sql = " UPDATE EMP_LVEPRKBAL_TRFHDR SET STATUS = ?, STATUS_DATE = ?, EMP_CODE__CONF = ? WHERE TRAN_ID = ? "; sql = " UPDATE EMP_LVEPRKBAL_TRFHDR SET STATUS = ?, STATUS_DATE = ?, EMP_CODE__CONF = ? WHERE TRAN_ID = ? ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, "C"); pStmt.setString(1, "C");
...@@ -802,43 +792,33 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -802,43 +792,33 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
pStmt.setString(3, logEmpCode); pStmt.setString(3, logEmpCode);
pStmt.setString(4, tranId); pStmt.setString(4, tranId);
updCnt = pStmt.executeUpdate(); updCnt = pStmt.executeUpdate();
if (updCnt > 0) if (updCnt > 0) {
{
successString = itmDBAccess.getErrorString("", "VTSUCC1", userId, "", conn); successString = itmDBAccess.getErrorString("", "VTSUCC1", userId, "", conn);
successFlag = true; successFlag = true;
System.out.println("Umakanta::retString::Confirm[" + successString + "]"); System.out.println("Umakanta::retString::Confirm[" + successString + "]");
return successString; return successString;
} } else {
retString = itmDBAccess.getErrorString("", "VTELPTRF23", userId, "", conn);
successFlag = false; successFlag = false;
return retString;
if (pStmt != null)
{
pStmt.close();
pStmt = null;
}
} }
} }
catch (SQLException se) } catch (SQLException se) {
{
se.printStackTrace(); se.printStackTrace();
successFlag = false; successFlag = false;
retString = this.admCommon.getErrorMessage(se, ""); retString = this.admCommon.getErrorMessage(se, "");
retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId); retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId);
System.out.println("errString after getErrorXmlString: " + retString); System.out.println("errString after getErrorXmlString: " + retString);
return retString; return retString;
} } catch (BaseException be) {
catch (BaseException be)
{
successFlag = false; successFlag = false;
retString = this.admCommon.getErrorMessage(be, ""); retString = this.admCommon.getErrorMessage(be, "");
retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId); retString = this.admCommon.getErrorXmlString(this.admCommon, retString, tranId);
System.out.println("errString after getErrorXmlString: " + retString); System.out.println("errString after getErrorXmlString: " + retString);
return retString; return retString;
} }
catch (Exception exp) // }
{ catch (Exception exp) {
System.out.println("Umakanta::Exception[" + exp.getMessage() + "]"); System.out.println("Umakanta::Exception[" + exp.getMessage() + "]");
successFlag = false; successFlag = false;
...@@ -847,91 +827,63 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -847,91 +827,63 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
System.out.println("errString after getErrorXmlString: " + retString); System.out.println("errString after getErrorXmlString: " + retString);
String str1 = retString; String str1 = retString;
return str1; return str1;
} } finally {
finally try {
{ if (conn != null) {
try if (successFlag) {
{
//Added by sarita on 25 JULY 18 [START]
itmDBAccess = null;
//Added by sarita on 25 JULY 18 [END]
if (successFlag)
{
conn.commit(); conn.commit();
} } else {
else
{
conn.rollback(); conn.rollback();
} }
if (conn != null) if (rs1 != null) {
{
if (rs1 != null)
{
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
} }
if (pStmt1 != null) if (pStmt1 != null) {
{
pStmt1.close(); pStmt1.close();
pStmt1 = null; pStmt1 = null;
} }
if (pStmt2 != null) if (pStmt2 != null) {
{
pStmt2.close(); pStmt2.close();
pStmt2 = null; pStmt2 = null;
} }
if (pStmt3 != null) if (pStmt3 != null) {
{
pStmt3.close(); pStmt3.close();
pStmt3 = null; pStmt3 = null;
} }
if (pStmt4 != null) if (pStmt4 != null) {
{
pStmt4.close(); pStmt4.close();
pStmt4 = null; pStmt4 = null;
} }
if (pStmt5 != null) if (pStmt5 != null) {
{
pStmt5.close(); pStmt5.close();
pStmt5 = null; pStmt5 = null;
} }
if (rs != null) if (rs != null) {
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pStmt != null) if (pStmt != null) {
{
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
} }
} }
} } catch (SQLException e) {
catch (SQLException e)
{
e.printStackTrace(); e.printStackTrace();
} }
} }
return retString; return retString;
} }
private InitialContext getInitialContext() throws ITMException {
private InitialContext getInitialContext()throws ITMException
{
InitialContext ctx = null; InitialContext ctx = null;
try try {
{
AppConnectParm appConnect = new AppConnectParm(); AppConnectParm appConnect = new AppConnectParm();
ctx = new InitialContext(appConnect.getProperty()); ctx = new InitialContext(appConnect.getProperty());
} } catch (ITMException itme) {
catch(ITMException itme)
{
System.out.println("ITMException :[EmpLvePrkBalTrfConf] :getInitialContext :==>"); System.out.println("ITMException :[EmpLvePrkBalTrfConf] :getInitialContext :==>");
throw itme; throw itme;
} } catch (Exception e) {
catch(Exception e)
{
System.out.println("Exception :[EmpLvePrkBalTrfConf] :getInitialContext :==>"); System.out.println("Exception :[EmpLvePrkBalTrfConf] :getInitialContext :==>");
throw new ITMException(e); throw new ITMException(e);
} }
...@@ -945,14 +897,10 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -945,14 +897,10 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
* @return input * @return input
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private String checkNull( String input ) private String checkNull(String input) {
{ if (input == null) {
if ( input == null )
{
input = ""; input = "";
} } else {
else
{
input = input.trim(); input = input.trim();
} }
return input; return input;
...@@ -966,45 +914,33 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa ...@@ -966,45 +914,33 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
* @return msgType * @return msgType
* @throws ITMException * @throws ITMException
*/ */
private String errorType( Connection conn , String errorCode ) throws ITMException private String errorType(Connection conn, String errorCode) throws ITMException {
{
String msgType = ""; String msgType = "";
PreparedStatement pstmt = null ; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try {
{
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? "; String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode); pstmt.setString(1, errorCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while( rs.next() ) while (rs.next()) {
{
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
} } catch (Exception ex) {
catch (Exception ex)
{
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex); throw new ITMException(ex);
} } finally {
finally try {
{ if (rs != null) {
try
{
if ( rs != null )
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if ( pstmt != null ) if (pstmt != null) {
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} } catch (Exception e) {
catch ( Exception e )
{
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment