Commit 1f2e1f1f authored by ngadkari's avatar ngadkari

branch code merged in head

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198802 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c2e4379e
package ibase.webitm.ejb.fin.adv; package ibase.webitm.ejb.fin.adv;
import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB; import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.BankReconPrcLocal; import ibase.webitm.ejb.fin.adv.ReceiptAdvConf;
import ibase.webitm.ejb.fin.BankReconPrcRemote; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.ejb.fin.FinCommon;
//import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.io.PrintStream;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.OutputStreamWriter;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.text.DateFormat;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Properties;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@SuppressWarnings({"unused"}) @Stateless
public class BankPifRtgsprc extends ActionHandlerEJB implements Schedule // extends ProcessEJB implements public class BankPifRtgsprc extends ActionHandlerEJB
// BankPiFprcLocal,BankPiFprcRemote{
{ {
E12GenericUtility genericUtility = new E12GenericUtility(); GenericUtility genericUtility = GenericUtility.getInstance();
FileOutputStream fos1 = null;
public String actionHandler() throws RemoteException, ITMException
public String schedule(String scheduleParamXML) throws Exception, {
ITMException { return "";
ibase.utility.UserInfoBean userInfo = null; }
String loginSiteCode = "", siteCode = "";
try { public String actionHandler(String tranId, String xtraParams, String objContext)
Document dom = null; throws RemoteException, ITMException
String xtraParams = "", siteList = ""; {
int childNodeListLength = 0; String xtraParam = "";
String childNodeName = null; String retStr = "";
String voucher_date = "", sysDate = ""; Document detailDom = null;
String xmlString = "", xmlString2 = "", winName = "w_bankpif"; Document headerDom = null;
GenericUtility genericUtility = GenericUtility.getInstance();
NodeList parentNodeList = null, childNodeList = null; try {
Node parentNode = null, childNode = null; System.out.println(".......tranId......." + tranId + "objContext[" + objContext + "]xtraParams[" + xtraParams + "]");
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility retStr = pifprocess(tranId, xtraParams);
.getDBDateFormat()); }
catch (Exception e)
Node currDetail = null; {
int noOfParam = 0; System.out.println("Exception :RtgsBankPifprc :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
System.out throw new ITMException(e);
.println("scheduleParamXML>>>>[" + scheduleParamXML + "]"); }
userInfo = new ibase.utility.UserInfoBean(scheduleParamXML); return retStr;
loginSiteCode = userInfo.getSiteCode(); }
// System.out.println("@V@ IntializingLog "+
// intializingLog("Chnl_Ptr_VouchConf_log")); public String pifprocess(String tranId, String xtraParams) throws RemoteException, ITMException
System.out.println("Log in Site code>>>>" + loginSiteCode + "]"); {
xtraParams = "loginEmpCode=" + userInfo.getEmpCode()+ "~~loginCode=" + userInfo.getLoginCode() + "~~termId=" System.out.println("@@@@@@@@@@@@@@@@@@@@ inside RtgsBankPif Process@@@@@@@@@@@@@@@");
+ userInfo.getRemoteHost() + "~~loginSiteCode="
+ loginSiteCode; Connection conn = null;
dom = genericUtility.parseString(scheduleParamXML); GenericUtility genericUtility = GenericUtility.getInstance();
NodeList paramList = dom.getElementsByTagName("SCHEDULE"); PreparedStatement pstmt = null; PreparedStatement pstmt1 = null,pstmtlogin=null,pstmtSite=null;
noOfParam = paramList.getLength(); ResultSet rs = null; ResultSet rs1 = null,rslogin=null,rsSite=null;
String sql = "";
parentNodeList = dom.getElementsByTagName("ACTUALPARAMETERS"); ConnDriver connDriver = null;
parentNode = parentNodeList.item(0); String userId = "";
childNodeList = parentNode.getChildNodes(); String errString = "";
childNodeListLength = childNodeList.getLength(); String errCode = "";
System.out.println(" CshildNodeListLength >>>>:-[" ValidatorEJB validatorEJB = null;
+ childNodeListLength + "]"); ITMDBAccessEJB itmDBAccessEJB = null;
processRtgs(xmlString, xmlString2, winName, xtraParams); boolean isError = false;
boolean updateCnt=false;
} catch (Exception e) { DistCommon disCommon = null;
System.out String forcedFlag = "";
.println("Exception :BankPiFprc :schedule :Exception :==>\n" ReceiptAdvConf Conf = null;
+ e.getMessage());
e.printStackTrace(); itmDBAccessEJB = new ITMDBAccessEJB();
throw new ITMException(e); validatorEJB = new ValidatorEJB();
} finally { connDriver = new ConnDriver();
try { String confirm = "";
if (fos1 != null) { ArrayList al = new ArrayList();
fos1.close();
fos1 = null; int cnt = 0;
} int successcnt = 0;
} catch (Exception e) { Conf = new ReceiptAdvConf();
System.out.println("Exception >>>." + e.getMessage()); String refdate = "";
String refdate1 = "";
} String refno = "";
} String custcode = "";
return ""; String ediRef = "";
} String refNumber = "";
//actionHandler added by nandkumar gadkari on 18/03/19 Document dom1 = null;
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException { String xmlParseStr = "";
String xmlString = "", xmlString2 = "", winName = "w_bankpif"; NodeList parentNodeList = null;
try { NodeList childNodeList = null;
processRtgs(xmlString, xmlString2, winName, xtraParams); Node parentNode = null;
Node childNode = null;
} catch (Exception e) String description = ""; String shDescr = ""; String message = ""; String Error = ""; String fileName1 = "";
{ int parentNodeListLength = 0;
e.printStackTrace(); int detField1 = 0,cnt1=0;
throw new ITMException(e); java.sql.Date refDate = null;
} String retString = "",retString1="";
return ""; String currentTime = "";
} java.util.Date FromDate = null;
/* String amount = "";
* public String process() throws RemoteException,ITMException { return ""; String statNo = "";
* } String refNum = "";
*/ String Status1="",refNoOrg="",tranId1="";
// process() String loginSite = "",siteCode="",msgNo="";
public String processRtgs(String xmlString, String xmlString2, try
String windowName, String xtraParams) throws RemoteException, {
ITMException { //conn = connDriver.getConnectDB("DriverITM");
System.out.println("xmlString:::::::::::" + xmlString); conn = getConnection();
System.out.println("xmlString:::::::::::" + xmlString2); connDriver = null;
conn.setAutoCommit(false);
String xtraParam = ""; loginSite = GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginSite");
String retStr = ""; System.out.println("Login Site Rtgs Process:["+loginSite+ "]");
Document detailDom = null;
Document headerDom = null; sql = "select ref_no,amount,stat_no ,ref_date from bank_statement where STATUS = ? and stat_no is not null and site_code in(select site_code from site where fin_entity =(select fin_entity from site where site_code=?)) ";
// GenericUtility genericUtility = GenericUtility.getInstance(); pstmt1 = conn.prepareStatement(sql);
// E12GenericUtility genericUtility = new E12GenericUtility(); //commented by Nandkumar Gadkari on 26/07/18 pstmt1.setString(1, "M");
try { pstmt1.setString(2, loginSite);
if (xmlString != null && xmlString.trim().length() != 0) { rs1 = pstmt1.executeQuery();
headerDom = genericUtility.parseString(xmlString); System.out.println("sql@@@@@@" + sql);
} while (rs1.next())
if (xmlString2 != null && xmlString2.trim().length() != 0) { {
detailDom = genericUtility.parseString(xmlString2); refno = rs1.getString(1);
} amount = rs1.getString(2);
retStr = process(headerDom, detailDom, windowName, xtraParams); statNo = rs1.getString(3);
} catch (Exception e) { refDate = rs1.getDate(4);
System.out refNoOrg=refno;
.println("Exception :BankPifRtgsprc :process(String xmlString, String xmlString2, String windowName, String xtraParams):" System.out.println("RefNumber Orginial" + refno);
+ e.getMessage() + ":"); System.out.println("amount" + amount);
e.printStackTrace(); System.out.println("statNo" + statNo);
throw new ITMException(e); System.out.println("refDate" + refDate);
} System.out.println("ediRef" + ediRef);
return retStr; if (refno.trim().length() >= 6)
} {
refNum = refno.trim();
public String process(Document headerDom, Document detailDom, }
String windowName, String xtraParams) throws RemoteException, else
ITMException { {
System.out.println("@@@@@@@@@@@@@@@@@@@@ inside BankPifRtgsprc@@@@@@@@@@@@@@@"); System.out.println("Req Decimal");
refNum = getReqDecimal(refno.trim());
Connection conn = null; System.out.println("RefNumber" + refNum);
// GenericUtility genericUtility = GenericUtility.getInstance(); }
//E12GenericUtility genericUtility = new E12GenericUtility(); //commented by Nandkumar Gadkari on 26/07/18 System.out.println("@@@@@RefNumber" + refNum);
PreparedStatement pstmt = null; System.out.println("#############RefNumber of Bank Statement" + refNoOrg);
ResultSet rs = null; sql = "select count(*) from bank_statement where ref_no = ? and amount= ? and stat_no=? and ref_date=?";
String sql = ""; pstmt = conn.prepareStatement(sql);
ConnDriver connDriver = null; pstmt.setString(1, refNoOrg);
String tranId = "", userId = "", loginEmpCode = "", chgTerm = ""; pstmt.setString(2, amount);
String errString = ""; pstmt.setString(3, statNo);
String errCode = ""; pstmt.setDate(4,refDate);
ValidatorEJB validatorEJB = null; rs = pstmt.executeQuery();
ITMDBAccessEJB itmDBAccessEJB = null; if (rs.next())
boolean isError = false; {
double tempAMt = 0; cnt1 = rs.getInt(1);
double totAmt1 = 0; }
double InsNo1 = 0; System.out.println("cnt1 is#############" +cnt1);
String orgAmt = ""; rs.close();
DistCommon disCommon = null; rs = null;
String forcedFlag = ""; pstmt.close();
ReceiptAdvConf Conf = null; pstmt = null;
File csvFile = null; if (cnt1 > 1)
File destFile = null; {
File file=null; sql="select tran_id from bank_statement where status = ? and ref_no = ? and amount= ? and stat_no=? and ref_date=?";
itmDBAccessEJB = new ITMDBAccessEJB(); pstmt = conn.prepareStatement(sql);
validatorEJB = new ValidatorEJB(); pstmt.setString(1, "M");
connDriver = new ConnDriver(); pstmt.setString(2, refNoOrg);
String confirm = ""; pstmt.setString(3, amount);
ArrayList al = new ArrayList(); pstmt.setString(4, statNo);
String row; pstmt.setDate(5, refDate);
String fileName; rs = pstmt.executeQuery();
int sheetNo = 0; if (rs.next())
int cnt = 0; {
int successcnt = 0; tranId1= rs.getString(1);
Conf = new ReceiptAdvConf(); System.out.println("tranId1" + tranId1);
String refdate = ""; }
String refno = ""; rs.close();
String custcode = ""; rs = null;
String totAmt = ""; pstmt.close();
PreparedStatement psmt = null;
Document dom1 = null; sql = "delete from bank_statement where ref_no = ? and amount= ? and stat_no=? and ref_date=? and tran_id != ? and status = ?";
String xmlParseStr = ""; pstmt = conn.prepareStatement(sql);
NodeList parentNodeList = null; pstmt.setString(1, refNoOrg);
NodeList childNodeList = null; pstmt.setString(2, amount);
Node parentNode = null; pstmt.setString(3, statNo);
Node childNode = null; pstmt.setDate(4, refDate);
String description = "", shDescr = "", message = "", Error = ""; pstmt.setString(5, tranId1.trim());
int parentNodeListLength = 0; pstmt.setString(6, "M");
int detField1 = 0; int i = pstmt.executeUpdate();
try { System.out.println("Delete Successfully@@@@@@@@@@@@@@@@@@@" + i);
/*conn = connDriver.getConnectDB("DriverITM"); pstmt.close();
connDriver = null;*///commented and added getConnection by nandkumar gadkari on 18/03/19 pstmt = null;
conn = getConnection(); }
conn.setAutoCommit(false); sql = "select count(1) from receipt where cust_code = ? and ref_no=? and ref_date = ? and chq_amt =? ";
csvFile = new File( CommonConstants.JBOSSHOME + File.separator+"server"+File.separator+"default"+ File.separator+"deploy"+File.separator+"Rtgsupdatexls"); pstmt = conn.prepareStatement(sql);
System.out.println(":::::::file Path" + csvFile); pstmt.setString(1, statNo.trim());
al = readExcelFile(csvFile, sheetNo); pstmt.setString(2, refNum.trim());
System.out.println("call read excel File" + al.size()); pstmt.setDate(3, refDate);
//File file = new File("/home/base/tmp/Rtgs.txt"); pstmt.setString(4, amount.trim());
file = new File( CommonConstants.JBOSSHOME + File.separator+"server"+File.separator+"default"+ File.separator+"deploy"+File.separator+"updatexls"+File.separator+"Rtgs.txt"); rs = pstmt.executeQuery();
if(file.createNewFile()) if (rs.next())
{ {
System.out.println(file+" File Created"); cnt = rs.getInt(1);
}else }
System.out.println("File "+file+" already exists"); System.out.println(" sql@@@" + sql + "-->count" + cnt);
FileWriter fw = new FileWriter(file.getAbsoluteFile()); rs.close();
BufferedWriter bw = new BufferedWriter(fw); rs = null;
String retString = ""; pstmt.close();
for (int i = 1; i < al.size(); i++) pstmt = null;
if (cnt > 0)
{
System.out.println("@@ Count>0");
sql = "select tran_id,confirmed,site_code from receipt where cust_code = ? and ref_no=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, statNo.trim());
pstmt.setString(2, refNum.trim());
rs = pstmt.executeQuery();
System.out.println("sql@@@@@" + sql);
if (rs.next())
{
tranId = rs.getString(1);
confirm = rs.getString(2);//rs.getString("confirmed") == null ? "N" : rs.getString("confirmed");
siteCode=checkNull(rs.getString(3));
}
System.out.println("confirm[" + confirm + "] traniD" + tranId + "] Site Code["+siteCode+"]");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(confirm == null || confirm.trim().length() ==0)
{
confirm="N";
}
System.out.println("confirm[" + confirm + "] tranID[" + tranId + "] Site COde["+siteCode+"]");
String finLogin="",finSite="";
sql="select fin_entity from site where site_code=?";
pstmtlogin = conn.prepareStatement(sql);
pstmtlogin.setString(1,loginSite);
rslogin = pstmtlogin.executeQuery();
if (rslogin.next())
{
finLogin=checkNull(rslogin.getString(1));
}
rslogin.close();
rslogin = null;
pstmtlogin.close();
pstmtlogin = null;
System.out.println("finLogin["+finLogin+"]");
sql="select fin_entity from site where site_code=?";
pstmtSite = conn.prepareStatement(sql);
pstmtSite.setString(1,siteCode);
rsSite = pstmtSite.executeQuery();
if (rsSite.next())
{
finSite=checkNull(rsSite.getString(1));
}
System.out.println("finSite["+finSite+"]");
rsSite.close();
rsSite = null;
pstmtSite.close();
pstmtSite = null;
System.out.println("!(finLogin.trim()["+finLogin.trim()+"] .equals(finSite.trim()["+finSite.trim()+"]");
if(!(finLogin.trim().equals(finSite.trim())))
{ {
row = al.get(i).toString(); System.out.println("finLogin"+finLogin);
row = row.replace("[", ""); System.out.println("finSite"+finSite);
row = row.replace("]", ""); errString = itmDBAccessEJB.getErrorString("", "NORECFND", userId, "", conn);
String col[] = row.split(","); return errString;
// cust_code,ref_no,ref_date,net_amt
custcode = col[2].trim();
refno = col[6].trim();
refdate = col[7].trim();
totAmt = col[8].trim();
int Amt = Integer.parseInt(totAmt.substring(totAmt.indexOf(".") + 1, totAmt.length()));
System.out.println("Amt" + Amt);
if (!(Amt > 0)) {
totAmt = totAmt.substring(0, totAmt.indexOf("."));
}
System.out.println("Amount" + totAmt);
// cust_code,ref_date,ref_no,chq_amt
sql = "select count(1) from receipt where cust_code = ? and ref_no=? and ref_date = ? and chq_amt =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custcode);
pstmt.setString(2, refno);
pstmt.setString(3, refdate);
pstmt.setString(4, totAmt);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt > 0)
{
System.out.println("@@ Count>0");
sql = "select tran_id,confirmed from receipt where cust_code = ? and ref_no=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custcode);
pstmt.setString(2, refno);
rs = pstmt.executeQuery();
if (rs.next()) {
tranId = rs.getString(1);
confirm = rs.getString("confirmed") == null ? "N" : rs.getString("confirmed");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (confirm != null && confirm.equalsIgnoreCase("N"))
{
errString = Conf.confirm(tranId, xtraParams, forcedFlag);
if (errString == null || errString.trim().length() == 0)
{
System.out.println("Enter confirm COndition");
System.out.println("The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + " is Sucessfully Confirmed");
String content = "The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + " is Sucessfully Confirmed";
bw.write(content);
bw.newLine();
System.out.println("Write confirmed");
successcnt++;
System.out.println("Sucess Count Y is:"+ successcnt);
} else
{
dom1 = parseString(errString);
System.out.println("dom1>>>>>: " + dom1);
parentNodeList = dom1.getElementsByTagName("error");
parentNodeListLength = parentNodeList.getLength();
for (int lineCount = 0; lineCount < parentNodeListLength; lineCount++)
{
parentNode = parentNodeList.item(lineCount);
childNodeList = parentNode.getChildNodes();
for (detField1 = 0; detField1 < childNodeList.getLength(); detField1++)
{
childNode = childNodeList.item(detField1);
if (childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("message"))
{
message = (childNode.getFirstChild().getNodeValue().trim());
System.out.println(">>>message : "+ message);
}
else if (childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("description"))
{
description = (childNode.getFirstChild().getNodeValue().trim());
System.out.println(">>>Description : "+ description);
}
}
retString = "" + message + ":" + description + "";
System.out.println("After Parsing Return String>>>>"+ retString);
}
System.out.println("The Record of tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + ":" + retString + " is Unconfirmed");
String content = "The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + ":"+ retString +" is Unconfirmed";
bw.write(content);
System.out.println("Write Unconfirmed");
bw.newLine();
}
}
else
{
System.out.println("Enter in else Already confirm COndition");
System.out.println("The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + " is Already Sucessfully Confirmed");
String content = "The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + " is Already Sucessfully Confirmed";
bw.write(content);
bw.newLine();
System.out.println("Write Already confirmed");
successcnt++;
System.out.println("Sucess COunt Y is:" + successcnt);
}
System.out.println("Complete Process");
} else {
System.out.println("The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + " is not Present in Statement");
String content = "The Record of Receipt tran_id : "+ tranId+"Customer Code :"+ custcode+ " and Reference Number : " + refno + " and Reference Date : : " + refdate + " and Cheque Amount : " + totAmt + " is not Present in Statement";
bw.write(content);
bw.newLine();
System.out.println("Write Already confirmed");
}
} }
bw.close(); else
fw.close();
System.out.println("List size is" + al.size());
System.out.println("Counter size is" + successcnt);
if (al.size()-1 == successcnt)
{
System.out.println("In List size is" + al.size());
destFile = new File( CommonConstants.JBOSSHOME + File.separator+"server"+File.separator+"default"
+ File.separator+"deploy"+File.separator+"RtgsStatement");
boolean success = csvFile.renameTo(new File(destFile, csvFile.getName()));
if (success)
{
System.out.println("File was successfully moved.\n");
} else
{
System.out.println("File was not successfully moved.\n");
}
}
} catch (Exception e)
{
System.out.println("Exception: confirm method ..> "+ e.getMessage());
isError = true;
errCode = "VTTRNNCNF"; // exception so cannot confirm
errString = itmDBAccessEJB.getErrorString("", errCode, userId);
throw new ITMException(e);
}
finally
{
if (conn != null)
{ {
try { System.out.println("MAtch SIte Code Rtgs");
if (isError) /* sql = "select STATUS from bank_statement where stat_no = ? and ref_no=? and ref_date = ? and amount =?";
{ pstmt = conn.prepareStatement(sql);
conn.rollback(); pstmt.setString(1, statNo.trim());
System.out.println("confirm: Connection Rollback"); pstmt.setString(2, refNum.trim());
} else pstmt.setDate(3, refDate);
{ pstmt.setString(4, amount.trim());
conn.commit(); rs = pstmt.executeQuery();
System.out.println("confirm: Connection Commit"); if (rs.next())
} {
conn.close(); Status1 = rs.getString(1);
conn = null; }
} catch (Exception e) { System.out.println( "Status1" + Status1);
e.printStackTrace(); rs.close();
} rs = null;
} pstmt.close();
} pstmt = null;
return errString; if("M".equals(Status1))
} {
sql = "delete from bank_statement where stat_no = ? and ref_no=? and ref_date = ? and amount =?";
public Document parseString(String xsdString) { pstmt = conn.prepareStatement(sql);
Document dom = null; pstmt.setString(1, statNo.trim());
try { pstmt.setString(2, refno.trim());
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); pstmt.setDate(3, refDate);
dbf.setNamespaceAware(true); pstmt.setString(4, amount.trim());
dbf.setIgnoringComments(true); int i = pstmt.executeUpdate();
DocumentBuilder db = dbf.newDocumentBuilder(); System.out.println("confirm Successfully@@@@@@@@@@@@@@@@@@@" + i);
OutputStreamWriter errorWriter = new OutputStreamWriter(System.err, pstmt.close();
"UTF-8"); pstmt = null;
ByteArrayInputStream baos = new ByteArrayInputStream(xsdString }*/
.getBytes());
dom = db.parse(baos); if ((confirm != null) && (confirm.equalsIgnoreCase("N")))
} catch (Exception e) { {
System.out.println("Error :" + e); retString1 = Conf.confirm(tranId, xtraParams, forcedFlag);
}
return dom; if ((retString1.contains("VTCICONF3")) || (retString1.trim().length() == 0))
{
} String remark = "Receipt No - " + tranId + ":confirm Successfully";
System.out.println("Ref Number" + refno.trim());
public ArrayList readExcelFile(File fileName, int sheetNo) { sql = "update bank_statement set status=?,remarks=? where stat_no = ? and ref_no=? and ref_date = ? and amount =? ";
System.out pstmt = conn.prepareStatement(sql);
.println("----in readExcelFile1 method CNT.................."); pstmt.setString(1, "Z");
String value = null; pstmt.setString(2, remark);
int headerRowCnt = -1, detailRowCnt = -1; pstmt.setString(3, statNo.trim());
ArrayList cellArrayLisstHolder = new ArrayList(); pstmt.setString(4, refno.trim());
pstmt.setDate(5, refDate);
try { pstmt.setString(6, amount.trim());
FileInputStream myInput = new FileInputStream(fileName); int i = pstmt.executeUpdate();
POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput); System.out.println("confirm Successfully@@@@@@@@@@@@@@@@@@@" + i);
HSSFWorkbook myWorkBook = new HSSFWorkbook(myFileSystem); pstmt.close();
HSSFSheet mySheet = myWorkBook.getSheetAt(sheetNo); pstmt = null;
Sheet sheet = myWorkBook.getSheetAt(sheetNo); }
for (Row row : sheet) { else {
for (Cell cell : row) { dom1 = parseString(errString);
if (cell.getCellType() != Cell.CELL_TYPE_BLANK) { System.out.println("dom1>>>>>: " + dom1);
if (cell.getCellType() != Cell.CELL_TYPE_STRING parentNodeList = dom1.getElementsByTagName("error");
|| cell.getStringCellValue().length() > 0) { parentNodeListLength = parentNodeList.getLength();
if (sheetNo == 1) for (int lineCount = 0; lineCount < parentNodeListLength; lineCount++)
headerRowCnt++; {
else if (sheetNo == 2) /* parentNode = parentNodeList.item(lineCount);
detailRowCnt++; childNodeList = parentNode.getChildNodes();
break; for (detField1 = 0; detField1 < childNodeList.getLength(); detField1++)
} {
} childNode = childNodeList.item(detField1);
} if ((childNode != null) && (childNode.getFirstChild() != null) && (childNode.getNodeName().equalsIgnoreCase("message")))
} {
message = childNode.getFirstChild().getNodeValue().trim();
for (Row row : mySheet) { System.out.println(">>>message : " + message);
ArrayList cellStoreArrayList = new ArrayList(); } else {
for (int cn = 0; cn < row.getLastCellNum(); cn++) { if ((childNode == null) || (childNode.getFirstChild() == null) || (!childNode.getNodeName().equalsIgnoreCase("description")))
Cell cell = row.getCell(cn, Row.CREATE_NULL_AS_BLANK); continue;
value = cell.toString(); description = childNode.getFirstChild().getNodeValue().trim();
if (value.contains(",")) { System.out.println(">>>Description : " + description);
value = value.replace(",", ""); }
} }
cellStoreArrayList.add(value); retString = message + ":" + description + ":" + tranId + "- Unconfirm Transaction";
} System.out.println("After Parsing Return String>>>>" + retString);*/
cellArrayLisstHolder.add(cellStoreArrayList);
parentNode = parentNodeList.item(lineCount);
} childNodeList = parentNode.getChildNodes();
System.out.println("childNodeList["+childNodeList+"]");
} catch (Exception e) { for (detField1 = 0; detField1 < childNodeList.getLength(); detField1++)
e.printStackTrace(); {
childNode = childNodeList.item(detField1);
if ((childNode != null) && (childNode.getFirstChild() != null) &&
(childNode.getNodeName().equalsIgnoreCase("message")))
{
message = childNode.getFirstChild().getNodeValue().trim();
System.out.println(">>>message : " + message);
} else {
if ((childNode == null) || (childNode.getFirstChild() == null) ||
(!childNode.getNodeName().equalsIgnoreCase("description")))
continue;
description = childNode.getFirstChild().getNodeValue().trim();
System.out.println(">>>Description : " + description);
}
}
// retString = message + ":" + description + ":Receipt No -" + tranId + " is Unconfirm Transaction";
retString = "Rcp No-"+ tranId +":"+msgNo+":"+message;
if(retString.length() > 60)
{
int retLength=retString.length();
int extraLenth= retLength-60;
int totalLength=retLength-extraLenth;
System.out.println("retLength["+retLength+"]");
System.out.println("extraLenth["+extraLenth+"]");
System.out.println("totalLength["+totalLength+"]");
retString =retString.substring(0,totalLength);
System.out.println("retString Grater than then Remark is["+retString+"]");
}
else
{
retString = "Rcp No-"+ tranId +":"+msgNo+":"+message;
}
System.out.println("retString Final RTgs Process["+retString+"]");
}
System.out.println("The Record of tran_id : " + tranId + "State No:" + statNo + " and Reference Number : " + refNum + " and Reference Date : " + refDate + " and Cheque Amount : " + amount + ":" + retString + " is Unconfirmed");
System.out.println("Ref Number" + refno.trim());
System.out.println("if Error ---> Update Status M");
sql = "update bank_statement set status=?,remarks=? where stat_no = ? and ref_no=? and ref_date = ? and amount =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "M");
pstmt.setString(2, retString);
pstmt.setString(3, statNo.trim());
pstmt.setString(4, refno.trim());
pstmt.setDate(5, refDate);
pstmt.setString(6, amount.trim());
int i = pstmt.executeUpdate();
System.out.println("confirm Successfully@@@@@@@@@@@@@@@@@@@" + i);
pstmt.close();
pstmt = null;
}
}
else
{
String remark = "Receipt No -" + tranId + ":Already confirm";
System.out.println("Ref Number" + refno.trim());
System.out.println("Added Delete Statement");
sql = "delete from bank_statement where stat_no = ? and ref_no=? and ref_date = ? and amount =? and status=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, statNo.trim());
pstmt.setString(2, refno.trim());
pstmt.setDate(3, refDate);
pstmt.setString(4, amount.trim());
pstmt.setString(5, "M");
int i = pstmt.executeUpdate();
System.out.println("Not Data found @@@@@@@@@@@@@@@@@@@" + i);
pstmt.close();
pstmt = null;
}
System.out.println("Complete Process");
}
}
else
{
System.out.println("Else no Found Record");
retString="No Data Found";
sql = "update bank_statement set status=?,remarks=? where stat_no = ? and ref_no=? and ref_date = ? and amount =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "M");
pstmt.setString(2, retString);
pstmt.setString(3, statNo.trim());
pstmt.setString(4, refno.trim());
pstmt.setDate(5, refDate);
pstmt.setString(6, amount.trim());
int i = pstmt.executeUpdate();
System.out.println("confirm Successfully@@@@@@@@@@@@@@@@@@@" + i);
pstmt.close();
pstmt = null;
// errString = itmDBAccessEJB.getErrorString("", "VTNODATA", userId, "", conn);
// errString = itmDBAccessEJB.getErrorString("", "VTNODATA", userId, "", conn);
}
updateCnt=true;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if(!updateCnt)
{
errString = itmDBAccessEJB.getErrorString("", "NORECFND", userId, "", conn);
System.out.println("errString Rtgs Count" + errString);
}
if ((errString == null) || (errString.trim().length() == 0))
{
errCode = "VTBPRC1";
errString = itmDBAccessEJB.getErrorString("", errCode, userId);
}
else
{
String str1 = errString;
return str1;
}
}
catch (Exception e)
{
System.out.println("Exception: confirm method ..> " + e.getMessage());
e.printStackTrace();
}
finally
{
if (conn != null)
try
{
if (isError)
{
conn.rollback();
System.out.println("RtgsBankPifprc: Connection Rollback");
}
else {
conn.commit();
System.out.println("RtgsBankPifprc: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
if (conn != null) {
try
{
if (isError)
{
conn.rollback();
System.out.println("RtgsBankPifprc: Connection Rollback");
}
else {
conn.commit();
System.out.println("RtgsBankPifprc: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
return errString;
}
public String getReqDecimal(String chqAmt)
{
DecimalFormat df = new DecimalFormat("000000");
int num = Integer.parseInt(chqAmt);
String refAmt = df.format(num);
System.out.println("@@@@@" + refAmt);
return refAmt;
}
private String checkNull(String input) {
if (input == null) {
input = "";
} }
return cellArrayLisstHolder; return input;
}
/*
* public String getReqDecimal(String chqAmt) { DecimalFormat df = new
* DecimalFormat("000000"); //int num= Integer.parseInt(chqAmt); String
* refAmt = df.format(chqAmt); System.out.println("@@@@@"+refAmt); return
* refAmt; }
*/
@Override
public String schedule(HashMap arg0) throws Exception {
// TODO Auto-generated method stub
return null;
} }
}
@Override \ No newline at end of file
public String schedulePriority(String arg0) throws Exception {
// TODO Auto-generated method stub
return null;
}
}
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