Commit 64d0f79a authored by pshinde's avatar pshinde

CONFIRMATION OF BANK GAURANTEE AMENDMENT


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98506 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6177bc6e
/********************************************************
Title : BankGauranteeAmdConf [F15DSUN031]
Date : 10/AUG/15
Developer: Priyanka Shinde.
********************************************************/
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.*;
import java.sql.*;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless;
import java.util.Calendar;
import java.util.Date;
@Stateless
public class BankGauranteeAmdConf extends ActionHandlerEJB implements BankGauranteeAmdConfLocal,BankGauranteeAmdConfRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
E12GenericUtility e12GenericUtility = new E12GenericUtility();
String sql = "",sql1="";
String confirmed="";
ResultSet rs = null,rs1=null;
PreparedStatement pstmt = null,pstmt1=null;
GenericUtility genericUtility = null;
Connection conn = null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
//ConnDriver connDriver = new ConnDriver();
String errString = null;
String bankAdd = "";
Date effDate = null;
Date dueDate = null;
double lcAmt = 0.0;
double noOfDays = 0.0;
int status = 0;
int cnt=0;
String tranCode="";
String tranIdAmend="";
Date lrDate = null;
String loginEmpCode="",statusBef="";
Timestamp sysDate = null;
try
{
genericUtility = GenericUtility.getInstance();
System.out.println("In BankGauranteeAmdConf_1 Confirmation Process >>>>>>>>>>>>>> ");
String userId="";
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
userId = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("--login code--"+userId);
System.out.println("Getting Tran_ID=============="+tranId);
if(tranId!=null && tranId.trim().length()>0)
{
System.out.println("@@@@@tranId"+tranId+"]");
sql = " select confirmed,tran_id__lc from lc_voucher_amend where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
confirmed = rs.getString("confirmed");
tranIdAmend = rs.getString("tran_id__lc");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("tranIdAmend======="+tranIdAmend);
if ("Y".equalsIgnoreCase(confirmed))
{
System.out.println("transaction already confirmed");
errString = itmDBAccessLocal.getErrorString("","VTCONF8","");
}
else
{
System.out.println("transaction not confirmed");
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime());
System.out.println("Now the date is :=> " + sysDateStr);
sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println(">>>>>>>>sysDate:"+sysDate);
System.out.println(">>>>>>>>loginEmpCode:"+loginEmpCode);
//selecting values
System.out.println("Update");
sql = "select eff_date,no_days,due_date,bank_address,lc_amt from lc_voucher_amend where tran_id =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
System.out.println("Inside REsult");
effDate = rs.getDate("eff_date");
noOfDays = rs.getDouble("no_days");
dueDate = rs.getDate("due_date");
bankAdd = rs.getString("bank_address");
lcAmt = rs.getDouble("lc_amt");
System.out.println("effDate====="+effDate);
System.out.println("LrDate="+lrDate);
System.out.println("noOfDays====="+noOfDays);
System.out.println("dueDate===="+dueDate);
System.out.println("bankAdd===="+bankAdd);
System.out.println("lcAmt===="+lcAmt);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//updating values
sql = "update lc_voucher set eff_date = ? ,no_days = ? ,due_date= ? ,bank_address= ?,lc_amt =?,amd_no__last=? WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
if(effDate == null)
{
pstmt.setDate(1,null);
}
else
{
pstmt.setDate(1,new java.sql.Date(effDate.getTime()));
}
pstmt.setDouble(2,noOfDays);
if(dueDate == null)
{
pstmt.setDate(3,null);
}
else
{
pstmt.setDate(3,new java.sql.Date(dueDate.getTime()));
}
pstmt.setString(4, bankAdd);
pstmt.setDouble(5, lcAmt);
pstmt.setString(6, tranId);
pstmt.setString(7,tranIdAmend);
status = pstmt.executeUpdate();
System.out.println("nO OF ROWS UPADTE="+status);
//conn.commit();
pstmt.close();
pstmt = null;
if(status >0)
{
sql = "update lc_voucher_amend set confirmed = 'Y',conf_date = sysdate where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
cnt=pstmt.executeUpdate();
//System.out.println("nO OF transaction conf is ="+pstmt.executeUpdate());
//conn.commit();
pstmt.close();
pstmt = null;
if (cnt>0)
{
errString = itmDBAccessLocal.getErrorString("","VTCNFSUCC","");
}
else
{
errString = itmDBAccessLocal.getErrorString("","VTUNCNFIRM","");
}
}
}
}
}
catch( Exception e )
{
System.out.println("BankGauranteeAmdConf_1..."+e.getMessage());
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("BankGauranteeAmdConf_1..."+e1.getMessage());
e1.printStackTrace();
}
}
finally
{
try
{
if (errString != null && errString.trim().length() > 0)
{
System.out.println("--going to commit tranaction--");
if (errString.indexOf("VTCNFSUCC") > -1)
{
conn.commit();
System.out.println("--transaction commited--");
}
else
{
conn.rollback();
System.out.println("--transaction rollback--");
}
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
catch(Exception e)
{
System.out.println("Exception : "+e);
e.printStackTrace();}
}
System.out.println("");
return errString ;
}
}
\ No newline at end of file
/********************************************************
Title : BankGauranteeAmdConfLocal [F15DSUN031]
Date : 10/AUG/15
Developer: Priyanka Shinde.
********************************************************/
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface BankGauranteeAmdConfLocal extends ActionHandlerLocal
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
/********************************************************
Title : BankGauranteeAmdConfRemote [F15DSUN031]
Date : 10/AUG/15
Developer: Priyanka Shinde.
********************************************************/
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface BankGauranteeAmdConfRemote extends ActionHandlerRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
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