Commit e0634768 authored by vvengurlekar's avatar vvengurlekar

LoanscheduleStDedn.java - connection , statement related changes done and also...

LoanscheduleStDedn.java - connection , statement related changes done and also changes done as per piyush sir said


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@199100 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a03170c9
......@@ -58,7 +58,7 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null;
//PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "", loginEmpCode = "", start = "", status = "", errString = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
......@@ -66,9 +66,12 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
GenericUtility genericUtility = GenericUtility.getInstance();
String winName = "w_start_dedn_load", errCode = "";
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
{
//Connection related changes done [START] by Varsha V on 02-04-19
/*conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);*/
conn = getConnection();
//Connection related changes done [END] by Varsha V on 02-04-19
stmt = conn.createStatement();
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("TranId ::"+tranId);
......@@ -80,6 +83,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
start = rs.getString(1);
status = rs.getString(2);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("start ::"+start+" status :"+status);
if (start == null || start.equals(""))
{
......@@ -125,6 +135,18 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
try
{
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
stmt = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("Closing Connection.....");
conn.close();
conn = null;
......@@ -166,6 +188,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
issueDate = rs.getDate(2);
empCode = rs.getString(3);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("dateInterest :"+dateInterest+" issueDate :"+issueDate+" empCode :"+empCode);
if (dateInterest == null || dateInterest.trim().length() == 0)
{
......@@ -188,6 +217,18 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
frDate = rs.getDate(2);
toDate = rs.getDate(3);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("period :"+period+" frDate :"+frDate+" toDate :"+toDate);
sql = "SELECT COUNT(*) FROM PAYROLL WHERE PRD_CODE = '"+period+"' "
+"AND EMP_CODE = '"+empCode+"'";;
......@@ -197,6 +238,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
count = rs.getInt(1);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("count :"+count);
while (count > 0)
{
......@@ -218,6 +266,18 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
period = rs.getString(1);
toDate = rs.getDate(2);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
sql = "SELECT COUNT(*) FROM PAYROLL "
+"WHERE PRD_CODE = '"+period+"'"+" AND EMP_CODE = '"+empCode+"'";
System.out.println("sql :"+sql);
......@@ -226,6 +286,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
count = rs.getInt(1);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("count :"+count);
}
sql = "SELECT START_RECO FROM LOANS WHERE LOAN_NO ='"+loanNo+"'";
......@@ -235,6 +302,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
startReco = rs.getDate(1);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
if (startReco.compareTo(frDate) <= 0)
{
sql = "UPDATE LOANS SET START_RECO = ? "
......@@ -248,36 +322,60 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
pstmt.setTimestamp(1,startRecoDate);
// end 21/07/10 manoharan
updateCnt = pstmt.executeUpdate();
//Added by Varsha V on 02-04-19 for closing statement [START]
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("No. of Records updated ::"+updateCnt);
if (updateCnt > 0)
{
errCode = CreateInst(conn, loanNo, xtraParams);
System.out.println("errCode :"+errCode);
if (errCode == null || errCode.trim().length() == 0)
//added by Varsha V on 02-04-19 as per suggested by Piyush Sir[START]
}else
{
errCode = "DS000NR";
}
}
//added by Varsha V on 02-04-19 as per suggested by Piyush Sir[END]
if(errCode == null || errCode.trim().length() == 0)
{
errCode = CreateInst(conn, loanNo, xtraParams);
System.out.println("errCode :"+errCode);
if (errCode == null || errCode.trim().length() == 0)
{
sql = "UPDATE LOANS SET DATE__INTEREST = ?, START_DEDN = ? "
+"WHERE LOAN_NO = ?";
System.out.println("sql :"+sql);
pstmt = conn.prepareStatement(sql);
// 21/17/10 manoharan milliseconds are set to be avoided
//pstmt.setTimestamp(1,new java.sql.Timestamp(issueDate.getTime()));
pstmt.setTimestamp(1,iDT);
// end 21/07/10 manoharan milliseconds are set to be avoided
pstmt.setString(2,"Y");
pstmt.setString(3,loanNo);
updateCnt = pstmt.executeUpdate();
if(pstmt != null)
{
sql = "UPDATE LOANS SET DATE__INTEREST = ?, START_DEDN = ? "
+"WHERE LOAN_NO = ?";
System.out.println("sql :"+sql);
pstmt = conn.prepareStatement(sql);
// 21/17/10 manoharan milliseconds are set to be avoided
//pstmt.setTimestamp(1,new java.sql.Timestamp(issueDate.getTime()));
pstmt.setTimestamp(1,iDT);
// end 21/07/10 manoharan milliseconds are set to be avoided
pstmt.setString(2,"Y");
pstmt.setString(3,loanNo);
updateCnt = pstmt.executeUpdate();
System.out.println("No. of Records updated ::"+updateCnt);
if (updateCnt == 0)
{
errCode = "DS000NR";
}
}
pstmt.close();
pstmt = null;
}
System.out.println("No. of Records updated ::"+updateCnt);
if (updateCnt == 0)
{
errCode = "DS000NR";
}
}
}
//Commented by Varsha V as per suggested by Piyush Sir on 02-04-19[START]
/*}
else
{
errCode = "DS000NR";
}
}
}*/ //Commented by Varsha V as per suggested by Piyush Sir on 02-04-19[END]
}//end if
}//try end
catch(SQLException sqx)
......@@ -294,6 +392,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
try
{
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
if (stmt != null)
{
stmt.close();
......@@ -343,6 +448,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
term = rs.getInt(5);
schemeNo = rs.getString(6);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("startReco :"+startReco+" empCode :"+empCode+" loanAmt :"+loanAmt);
System.out.println("monInst :"+monInst+" term :"+term+" schemeNo :"+schemeNo);
......@@ -353,6 +465,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
adCodeDed = rs.getString(1);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("adCodeDed :"+adCodeDed);
if (term > 1)
{
......@@ -387,6 +506,18 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
count = rs.getInt(1);
}
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("count :"+count);
if (count == 0)
{
......@@ -424,6 +555,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
pstmt.setString(11,"L");
pstmt.setString(12,loanNo);
insertCnt = pstmt.executeUpdate();
//Added by Varsha V on 02-04-19 for closing statement [START]
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
System.out.println("insertCnt :"+insertCnt);
}
else
......@@ -445,6 +583,13 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
{
try
{
//Added by Varsha V on 02-04-19 for closing statement [START]
if(rs != null)
{
rs.close();
rs = null;
}
//Added by Varsha V on 02-04-19 for closing statement [END]
if (stmt != null)
{
stmt.close();
......
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