Commit 0cc2cbdb authored by prane's avatar prane

to visible eff_date during processing

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@184467 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 103e2176
......@@ -60,8 +60,7 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
}
rtrStr = getData(dom, dom1, windowName, xtraParams);
} catch (Exception e) {
System.out
.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"
System.out.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"
+ e.getMessage() + ":");
throw new ITMException(e);
}
......@@ -76,43 +75,38 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
String refDate = "";
String resultString = "";
String errString = "";
String errCode = "", entryBatchNo = "";
String errCode = "";
String entryBatchNo = "";
String refNo = "";
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
//Statement stmt = null;
PreparedStatement pstmt = null;
int cnt = 0;
java.sql.Timestamp refDateTs = null;
// StringBuffer retTabSepStrBuff = new StringBuffer();
StringBuffer retTabSepStrBuff = new StringBuffer(
"<?xml version = \"1.0\"?>");
StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>");
retTabSepStrBuff.append("<DocumentRoot>");
retTabSepStrBuff.append("<description>").append("Datawindow Root")
.append("</description>");
retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>");
retTabSepStrBuff.append("<group0>");
retTabSepStrBuff.append("<description>").append("Group0 description")
.append("</description>");
retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>");
retTabSepStrBuff.append("<Header0>");
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
// GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
SimpleDateFormat sdf = null;
try {
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
bankCode = genericUtility.getColumnValue("bank_code", dom);
effDate = genericUtility.getColumnValue("eff_date", dom);
refDate = genericUtility.getColumnValue("ref_date", dom);
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if (refDate != null) {
refDateTs = Timestamp.valueOf(genericUtility
.getValidDateString(refDate, genericUtility
.getApplDateFormat(), genericUtility
.getDBDateFormat())
+ " 00:00:00.0");
refDateTs = Timestamp.valueOf(genericUtility.getValidDateString(refDate, genericUtility .getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
getDataSql = "SELECT TRAN_ID,"
+ " TRAN_TYPE,"
......@@ -144,7 +138,6 @@ conn = getConnection();
System.out.println("The getDataSql becomes :" + getDataSql);
pstmt = conn.prepareStatement(getDataSql);
pstmt.setString(1, bankCode);
pstmt.setTimestamp(2, refDateTs);
......@@ -178,83 +171,35 @@ conn = getConnection();
* retTabSepStrBuff.append(entryBatchNo).append("\n"); //End
* Addition Gulzar 20/12/06
*/
entryBatchNo = rs.getString("ENTRY_BATCH_NO");
entryBatchNo = checkNull(rs.getString("ENTRY_BATCH_NO"));
if (entryBatchNo == null) {
entryBatchNo = " ";
}
retTabSepStrBuff.append("<Detail2>");
retTabSepStrBuff.append("<entry_batch_no>").append(
"<![CDATA[" + entryBatchNo + "]]>").append(
"</entry_batch_no>");
retTabSepStrBuff.append("<ref_no>").append(
"<![CDATA[" + checkNull(rs.getString("REF_NO")) + "]]>")
.append("</ref_no>");
retTabSepStrBuff.append("<ref_date>").append(
"<![CDATA["
+ sdf.format(rs.getTimestamp("REF_DATE"))
+ "]]>").append("</ref_date>");
retTabSepStrBuff.append("<amount>").append(
"<![CDATA[" + rs.getString("AMOUNT") + "]]>")
.append("</amount>");
retTabSepStrBuff.append("<curr_code>").append(
"<![CDATA[" + rs.getString("CURR_CODE") + "]]>")
.append("</curr_code>");
retTabSepStrBuff.append("<amount_curr>").append(
"<![CDATA[" + rs.getDouble("AMOUNT")
/ rs.getDouble("EXCH_RATE") + "]]>")
.append("</amount_curr>");
retTabSepStrBuff.append("<tran_type>").append(
"<![CDATA[" + rs.getString("TRAN_TYPE") + "]]>")
.append("</tran_type>");
retTabSepStrBuff.append("<sundry_code>").append(
"<![CDATA[" + rs.getString("SUNDRY_CODE") + "]]>")
.append("</sundry_code>");
retTabSepStrBuff.append("<sundry_name>").append(
"<![CDATA[" + rs.getString("SUNDRY_NAME") + "]]>")
.append("</sundry_name>");
retTabSepStrBuff.append("<amt_adj>").append(
"<![CDATA[" + rs.getString("AMT_ADJ") + "]]>")
.append("</amt_adj>");
retTabSepStrBuff.append("<tran_date>").append(
"<![CDATA["
+ sdf.format(rs.getTimestamp("TRAN_DATE"))
+ "]]>").append("</tran_date>");
retTabSepStrBuff.append("<ref_mode>").append(
"<![CDATA[" + rs.getString("REF_MODE") + "]]>")
.append("</ref_mode>");
retTabSepStrBuff.append("<tran_ser>").append(
"<![CDATA[" + rs.getString("TRAN_SER") + "]]>")
.append("</tran_ser>");
retTabSepStrBuff.append("<tran_no>").append(
"<![CDATA[" + rs.getString("TRAN_NO") + "]]>")
.append("</tran_no>");
retTabSepStrBuff.append("<bank_code>").append(
"<![CDATA[" + rs.getString("BANK_CODE") + "]]>")
.append("</bank_code>");
retTabSepStrBuff.append("<site_code>").append(
"<![CDATA[" + rs.getString("SITE_CODE") + "]]>")
.append("</site_code>");
retTabSepStrBuff.append("<acct_code>").append(
"<![CDATA[" + rs.getString("ACCT_CODE") + "]]>")
.append("</acct_code>");
retTabSepStrBuff.append("<cctr_code>").append(
"<![CDATA[" + rs.getString("CCTR_CODE") + "]]>")
.append("</cctr_code>");
retTabSepStrBuff.append("<status>").append(
"<![CDATA[" + rs.getString("STATUS") + "]]>")
.append("</status>");
retTabSepStrBuff.append("<tran_id>").append(
"<![CDATA[" + rs.getString("TRAN_ID") + "]]>")
.append("</tran_id>");
retTabSepStrBuff.append("<remarks>").append(
"<![CDATA[" + checkNull(rs.getString("REMARKS")) + "]]>")
.append("</remarks>");
retTabSepStrBuff.append("<exch_rate>").append(
"<![CDATA[" + rs.getString("EXCH_RATE") + "]]>")
.append("</exch_rate>");
retTabSepStrBuff.append("<entry_batch_no>").append("<![CDATA[" + entryBatchNo + "]]>").append("</entry_batch_no>");
retTabSepStrBuff.append("<ref_no>").append("<![CDATA[" + checkNull(rs.getString("REF_NO")) + "]]>").append("</ref_no>");
retTabSepStrBuff.append("<ref_date>").append("<![CDATA["+ sdf.format(rs.getTimestamp("REF_DATE"))+ "]]>").append("</ref_date>");
retTabSepStrBuff.append("<amount>").append("<![CDATA[" + checkNull(rs.getString("AMOUNT")) + "]]>").append("</amount>");
retTabSepStrBuff.append("<curr_code>").append("<![CDATA[" + checkNull(rs.getString("CURR_CODE")) + "]]>").append("</curr_code>");
retTabSepStrBuff.append("<amount_curr>").append("<![CDATA[" + rs.getDouble("AMOUNT") / rs.getDouble("EXCH_RATE") + "]]>").append("</amount_curr>");
retTabSepStrBuff.append("<tran_type>").append("<![CDATA[" + checkNull(rs.getString("TRAN_TYPE")) + "]]>").append("</tran_type>");
retTabSepStrBuff.append("<sundry_code>").append("<![CDATA[" + checkNull(rs.getString("SUNDRY_CODE")) + "]]>").append("</sundry_code>");
retTabSepStrBuff.append("<sundry_name>").append("<![CDATA[" + checkNull(rs.getString("SUNDRY_NAME")) + "]]>").append("</sundry_name>");
retTabSepStrBuff.append("<amt_adj>").append("<![CDATA[" + checkNull(rs.getString("AMT_ADJ")) + "]]>").append("</amt_adj>");
retTabSepStrBuff.append("<tran_date>").append("<![CDATA["+ sdf.format(rs.getTimestamp("TRAN_DATE")) + "]]>").append("</tran_date>");
retTabSepStrBuff.append("<ref_mode>").append("<![CDATA[" + checkNull(rs.getString("REF_MODE")) + "]]>").append("</ref_mode>");
retTabSepStrBuff.append("<tran_ser>").append("<![CDATA[" + checkNull(rs.getString("TRAN_SER")) + "]]>").append("</tran_ser>");
retTabSepStrBuff.append("<tran_no>").append("<![CDATA[" + checkNull(rs.getString("TRAN_NO")) + "]]>").append("</tran_no>");
retTabSepStrBuff.append("<bank_code>").append("<![CDATA[" + checkNull(rs.getString("BANK_CODE")) + "]]>").append("</bank_code>");
retTabSepStrBuff.append("<site_code>").append("<![CDATA[" + checkNull(rs.getString("SITE_CODE")) + "]]>").append("</site_code>");
retTabSepStrBuff.append("<acct_code>").append("<![CDATA[" + checkNull(rs.getString("ACCT_CODE")) + "]]>").append("</acct_code>");
retTabSepStrBuff.append("<cctr_code>").append("<![CDATA[" + checkNull(rs.getString("CCTR_CODE")) + "]]>").append("</cctr_code>");
retTabSepStrBuff.append("<status>").append("<![CDATA[" + checkNull(rs.getString("STATUS")) + "]]>").append("</status>");
retTabSepStrBuff.append("<tran_id>").append("<![CDATA[" + checkNull(rs.getString("TRAN_ID")) + "]]>").append("</tran_id>");
retTabSepStrBuff.append("<remarks>").append("<![CDATA[" + checkNull(rs.getString("REMARKS")) + "]]>").append("</remarks>");
retTabSepStrBuff.append("<exch_rate>").append("<![CDATA[" + checkNull(rs.getString("EXCH_RATE")) + "]]>").append("</exch_rate>");
//Pavan R on 03-may-18 to visible eff_date during processing
retTabSepStrBuff.append("<eff_date>").append("<![CDATA[" +effDate+ "]]>").append("</eff_date>");
retTabSepStrBuff.append("<eff_date>").append("<![CDATA[" + checkNull(effDate) + "]]>").append("</eff_date>");
//Pavan R on 03-may-18 end
retTabSepStrBuff.append("</Detail2>");
cnt++;
......@@ -265,24 +210,21 @@ conn = getConnection();
retTabSepStrBuff.append("</DocumentRoot>");
resultString = retTabSepStrBuff.toString();
System.out.println("212--resultString:["+resultString+"]");
} else {
errCode = "VTNOREC2";
}
if (errCode != null && errCode.trim().length() > 0) {
errString = itmDBAccessEJB.getErrorString("", errCode, "", "",
conn);
if (errCode != null && errCode.trim().length() > 0)
{
errString = itmDBAccessEJB.getErrorString("", errCode, "", "", conn);
resultString = errString;
System.out.println("errString: " + errString);
}
} catch (SQLException e) {
System.out
.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"
+ e.getMessage() + ":");
System.out.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"+ e.getMessage() + ":");
throw new ITMException(e);
} catch (Exception e) {
System.out
.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"
+ e.getMessage() + ":");
System.out.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"+ e.getMessage() + ":");
throw new ITMException(e);
} finally {
try {
......@@ -295,9 +237,8 @@ conn = getConnection();
return resultString;
}
public String process(String xmlString, String xmlString2,
String windowName, String xtraParams) throws RemoteException,
ITMException {
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException, ITMException
{
String retStr = "";
Document detailDom = null;
Document headerDom = null;
......@@ -314,9 +255,7 @@ conn = getConnection();
}
retStr = process(headerDom, detailDom, windowName, xtraParams);
} catch (Exception e) {
System.out
.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"
+ e.getMessage() + ":");
System.out.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"+ e.getMessage() + ":");
throw new ITMException(e);
}
return retStr;
......@@ -360,9 +299,9 @@ conn = getConnection();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try {
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
sql = "SELECT AMOUNT, AMT_ADJ, STATUS, EXCH_RATE FROM BANKTRAN_LOG WHERE TRAN_ID = ? ";// '"+tranId+"'";
......@@ -378,27 +317,18 @@ conn = getConnection();
if (childNodeName.equals("tran_id")) {
if (childNode.getFirstChild() != null) {
tranId = childNode.getFirstChild().getNodeValue();
System.out.println("childNodeName ["
+ childNodeName + "] NodeValue ["
+ childNode.getFirstChild().getNodeValue()
+ "]");
System.out.println("childNodeName ["+ childNodeName + "] NodeValue ["+ childNode.getFirstChild().getNodeValue()+ "]");
}
} else if (childNodeName.equals("tran_ser")) {
if (childNode.getFirstChild() != null) {
tranSer = childNode.getFirstChild().getNodeValue();
}
System.out.println("childNodeName [" + childNodeName
+ "] NodeValue ["
+ childNode.getFirstChild().getNodeValue()
+ "]");
System.out.println("childNodeName [" + childNodeName+ "] NodeValue ["+ childNode.getFirstChild().getNodeValue() + "]");
} else if (childNodeName.equals("tran_no")) {
if (childNode.getFirstChild() != null) {
tranNo = childNode.getFirstChild().getNodeValue();
}
System.out.println("childNodeName [" + childNodeName
+ "] NodeValue ["
+ childNode.getFirstChild().getNodeValue()
+ "]");
System.out.println("childNodeName [" + childNodeName+ "] NodeValue ["+ childNode.getFirstChild().getNodeValue() + "]");
}
}
pstmt.setString(1, tranId);
......@@ -411,12 +341,10 @@ conn = getConnection();
status = rs.getString(3);
exchRate = rs.getDouble(4);
if (exchRate == 0) {
xmlStr = getBanklogExchRate(tranSer, tranNo);
xmlStr = getBanklogExchRate(tranSer, tranNo,conn);
dom1 = genericUtility.parseString(xmlStr);
currCode = genericUtility.getColumnValue("curr_code",
dom1);
exchRate1 = genericUtility.getColumnValue("exch_rate",
dom1);
currCode = genericUtility.getColumnValue("curr_code",dom1);
exchRate1 = genericUtility.getColumnValue("exch_rate",dom1);
}
if (!status.equals("R")) {
amount = amount - amtAdj;
......@@ -441,25 +369,21 @@ conn = getConnection();
return "";
}
if (errCode != null && errCode.trim().length() > 0) {
errString = itmDBAccessEJB.getErrorString("", errCode, "", "",
conn);
errString = itmDBAccessEJB.getErrorString("", errCode, "", "", conn);
conn.close();
conn = null;
return errString;
}
errCode = updateTable(cnt, headerDom, detailDom, conn);
if (errCode != null || errCode.trim().length() > 0) {
errString = itmDBAccessEJB.getErrorString("", errCode, "", "",
conn);
errString = itmDBAccessEJB.getErrorString("", errCode, "", "", conn);
System.out.println("errString becomes: " + errString);
} else {
errString = itmDBAccessEJB.getErrorString("", "VTRECOSUCC", "",
"", conn);
errString = itmDBAccessEJB.getErrorString("", "VTRECOSUCC", "", "", conn);
}
} catch (Exception e) {
System.out
.println("Exception :BankRecoEJB :process(String xmlString2, String xmlString2, String windowName, String xtraParams):"
+ e.getMessage() + ":");
System.out.println("Exception :BankRecoEJB :process(String xmlString2, String xmlString2, String windowName, String xtraParams):"+ e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
} finally {
try {
......@@ -472,11 +396,9 @@ conn = getConnection();
return errString;
}
private String updateTable(int cnt, Document headerDom, Document detailDom,
Connection conn) throws RemoteException, ITMException {
private String updateTable(int cnt, Document headerDom, Document detailDom, Connection conn) throws RemoteException, ITMException {
Document dom1 = null;
System.out.println("Counter :" + cnt + "\n detailDom :" + detailDom
+ "\n headerDom :" + headerDom);
System.out.println("Counter :[" + cnt + "]\n detailDom :[" + detailDom + "]\n headerDom :[" + headerDom + "]");
String errCode = "";
String errString = "";
String childNodeName = null;
......@@ -503,9 +425,11 @@ conn = getConnection();
ArrayList tranIdList = new ArrayList();
ArrayList amountList = new ArrayList();
ArrayList amtAdjList = new ArrayList();
// Connection conn = null; //commented by rajendra on 31/03/09
ResultSet rSet = null;
Statement stmt = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null;
PreparedStatement pstmt3 = null;
String keyStringQuery = "";
double amt = 0;
int childNodeListLength = 0;
......@@ -531,19 +455,19 @@ conn = getConnection();
Node childNode = null;
String xmlValues = "";
String effDate = "";
java.sql.Timestamp refDateTs = null, effDateTs = null;
String tranSer1 = "";
String keyString = "";
String keyCol = "";
String uniqueKey = null;
String insertSql = "";
String updateSql = "";
int insertCnt = 0;
int updateCnt = 0;
// commented by rajendra on 31/03/09
// ConnDriver connDriver = new ConnDriver();
// GenericUtility genericUtility = GenericUtility.getInstance();
//java.sql.Timestamp refDateTs = null, effDateTs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try {
// conn = getConnection();
// commented by rajendra on 31/03/09
// conn = connDriver.getConnectDB("DriverITM");
// ended by rajendra on 31/03/09
/*--- Commented by Gulzar as the logic to process single and multiple record should same 15/11/06
if (cnt == 1)
{
......@@ -653,9 +577,9 @@ conn = getConnection();
else
{*/// End Comment Gulzar 15/11/06
bankCode = genericUtility.getColumnValue("bank_code", headerDom);
effDate = genericUtility.getColumnValue("eff_date", headerDom);
//effDate = genericUtility.getColumnValue("eff_date", headerDom);
refDate = genericUtility.getColumnValue("ref_date", headerDom);
if (effDate != null) {
/*if (effDate != null) {
effDateTs = Timestamp.valueOf(genericUtility
.getValidDateString(effDate, genericUtility
.getApplDateFormat(), genericUtility
......@@ -668,22 +592,15 @@ conn = getConnection();
.getApplDateFormat(), genericUtility
.getDBDateFormat())
+ " 00:00:00.0");
}
}*/
/**
* Amount getting seprated in Bank statement table, if selected all
* in Bank Reco. process Abhijit Gaikwad 16/10/15 Start
*/
keyStringQuery = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE UPPER(TRAN_WINDOW) = 'W_BANK_STATEMENT'";
stmt = conn.createStatement();
rSet = stmt.executeQuery(keyStringQuery);
String tranSer1 = "";
String keyString = "";
String keyCol = "";
String uniqueKey = null;
String insertSql = "";
String updateSql = "";
int insertCnt = 0;
int updateCnt = 0;
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(keyStringQuery);
rSet = pstmt.executeQuery();
if (rSet.next()) {
keyString = rSet.getString(1);
keyCol = rSet.getString(2);
......@@ -692,17 +609,19 @@ conn = getConnection();
errCode = "VTSEQ";
return errCode;
}
pstmt.close();
pstmt = null;
parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength:::::::::"
+ parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++) {
System.out.println("parentNodeListLength:::::::::"+ parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength::: "
+ childNodeListLength + "\n");
for (int childRow = 0; childRow < childNodeListLength; childRow++) {
System.out.println("childNodeListLength::: "+ childNodeListLength + "\n");
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
System.out.println("Child node" + childNodeName);
......@@ -731,6 +650,8 @@ conn = getConnection();
tranNo = childNode.getFirstChild().getNodeValue();
} else if (childNodeName.equals("ref_no")) {
refNo = childNode.getFirstChild().getNodeValue();
if(refNo == null || refNo.trim().length() == 0 || "null".equals(refNo)) {
refNo = " "; }
} else if (childNodeName.equals("ref_date")) {
refDate = childNode.getFirstChild().getNodeValue();
} else if (childNodeName.equals("ref_mode")) {
......@@ -752,34 +673,37 @@ conn = getConnection();
effDate = childNode.getFirstChild().getNodeValue();
}
//Pavan R on 03-may-18 end
}// end inner for
System.out.println("tranType["+tranType+"]tranDate["+tranDate+"]bankCode["+bankCode+"]siteCode["+siteCode+"]tranSer["+tranSer+"]" +
"tranNo["+tranNo+"]refNo["+refNo+"]refDate["+refMode+"]sundryCode["+sundryCode+"]acctCode["+acctCode+"]" +
"cctrCode["+cctrCode+"]remarks["+remarks+"]currCode["+currCode+"]exchRate["+exchRate+"]effDate["+effDate+"]");
}//childNode loop end
try
{
// end inner for
xmlValues = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :[" + xmlValues + "]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE",
"");
uniqueKey = tg.generateTranSeqID(tranSer1, keyCol, keyString,
conn);
System.out.println("uniqueKey :" + uniqueKey);
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE","");
uniqueKey = tg.generateTranSeqID(tranSer1, keyCol, keyString,conn);
System.out.println("uniqueKey Tran Id :[" + uniqueKey+"]");
if (uniqueKey.equals("ERROR")) {
errCode = "VTTRANID";
return errCode;
}
status = "R";
exchRate = exchRate != null && exchRate.trim().length() > 0 ? exchRate
.trim()
: "0";
amtAdj = amtAdj != null && amtAdj.trim().length() > 0 ? amtAdj
.trim() : "0";
exchRate = exchRate != null && exchRate.trim().length() > 0 ? exchRate.trim(): "0";
amtAdj = amtAdj != null && amtAdj.trim().length() > 0 ? amtAdj.trim() : "0";
exchRateD = Double.parseDouble(exchRate);
amtAdjD = Double.parseDouble(amtAdj);
if (exchRateD == 0) {
xmlStr = getBanklogExchRate(tranSer, tranNo);
if (exchRateD == 0)
{
xmlStr = getBanklogExchRate(tranSer, tranNo, conn);
dom1 = genericUtility.parseString(xmlStr);
currCode = genericUtility.getColumnValue("curr_code", dom1);
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom1));
exchRate = genericUtility.getColumnValue("exch_rate", dom1);
amtAdjBase = amtAdjD * exchRateD;
} else {
......@@ -801,87 +725,95 @@ conn = getConnection();
System.out.println("Amount@@@@@@@@@@@@" + amt);
amt3 = Double.valueOf(amtAdj);
System.out.println("Adj Amount@@@@@@@@@@@@" + amt3);
java.sql.Date effDate1 = java.sql.Date.valueOf(genericUtility
.getValidDateString(effDate, genericUtility
.getApplDateFormat(), genericUtility
.getDBDateFormat()));
java.sql.Date effDate1 = java.sql.Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
System.out.println("effDate1 :" + effDate1);
System.out.println("refDate :"
+ new java.sql.Date(System.currentTimeMillis()));
System.out.println("refDate :" + new java.sql.Date(System.currentTimeMillis()));
// String refDate1 = refDate.substring(0,10);
java.sql.Date refDate2 = java.sql.Date.valueOf(genericUtility
.getValidDateString(refDate, genericUtility
.getApplDateFormat(), genericUtility
.getDBDateFormat()));
java.sql.Date refDate2 = java.sql.Date.valueOf(genericUtility.getValidDateString(refDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
System.out.println("refDate2 :" + refDate2);
insertSql = "INSERT INTO BANK_STATEMENT(TRAN_ID, BANK_CODE, SITE_CODE, REF_NO, REF_DATE,"
+ " REF_MODE, AMOUNT, TRAN_TYPE, EDI_REF, REMARKS, STATUS, CHG_DATE, CHG_USER, CHG_TERM,"
+ " AMT_ADJ, EFF_DATE, AUTO_ENTRY, STATUS_DATE, EXCH_RATE, CURR_CODE , STAT_DATE)"
+ " VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement pstmt = conn.prepareStatement(insertSql);
pstmt.setString(1, uniqueKey);
pstmt.setString(2, bankCode);
pstmt.setString(3, siteCode);
pstmt.setString(4, refNo);
pstmt.setDate(5, refDate2);
pstmt.setString(6, refMode);
pstmt.setDouble(7, amt);
pstmt.setString(8, tranType);
pstmt.setString(9, " ");
pstmt.setString(10, remarks);
pstmt.setString(11, status);
pstmt.setDate(12, currDate);
pstmt.setString(13, "Base");
pstmt.setString(14, "Base");
pstmt.setDouble(15, amt3);
pstmt.setDate(16, effDate1);
pstmt.setString(17, "Y");
pstmt.setDate(18, currDate);
pstmt.setDouble(19, exchRateD);
pstmt.setString(20, currCode);
pstmt.setDate(21, effDate1);
insertCnt = pstmt.executeUpdate();
System.out.println("insertSql is :" + insertSql);
pstmt1 = conn.prepareStatement(insertSql);
pstmt1.setString(1, uniqueKey);
pstmt1.setString(2, bankCode);
pstmt1.setString(3, siteCode);
pstmt1.setString(4, refNo);
pstmt1.setDate(5, refDate2);
pstmt1.setString(6, refMode);
pstmt1.setDouble(7, amt);
pstmt1.setString(8, tranType);
pstmt1.setString(9, " ");
pstmt1.setString(10, remarks);
pstmt1.setString(11, status);
pstmt1.setDate(12, currDate);
pstmt1.setString(13, "Base");
pstmt1.setString(14, "Base");
pstmt1.setDouble(15, amt3);
pstmt1.setDate(16, effDate1);
pstmt1.setString(17, "Y");
pstmt1.setDate(18, currDate);
pstmt1.setDouble(19, exchRateD);
pstmt1.setString(20, currCode);
pstmt1.setDate(21, effDate1);
insertCnt = pstmt1.executeUpdate();
System.out.println("insertCnt :" + insertCnt);
System.out.println("counter :" + counter);
if (insertCnt != 0) {
if (insertCnt != 0)
{
insertSql = "insert into bankreco_trace(tran_id__stat, tran_id__log, amount) values (?, ?, ?)";
System.out.println("insertSql :" + insertSql);
System.out.println("tranIdList.get(intcnt).toString() :"
+ tranId);
//System.out.println("insertSql :" + insertSql);
System.out.println("tranIdList.get(intcnt).toString() :"+ tranId);
PreparedStatement pstmt1 = conn.prepareStatement(insertSql);
pstmt1.setString(1, uniqueKey);
pstmt1.setString(2, tranId);
pstmt1.setDouble(3, amt);
insertCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
pstmt2 = conn.prepareStatement(insertSql);
pstmt2.setString(1, uniqueKey);
pstmt2.setString(2, tranId);
pstmt2.setDouble(3, amt);
insertCnt = pstmt2.executeUpdate();
pstmt2.close();
pstmt2 = null;
System.out.println("insertCnt :" + insertCnt);
System.out.println("cnt :" + cnt);
updateSql = "UPDATE BANKTRAN_LOG SET STATUS = ?, AMT_ADJ = AMT_ADJ + ?, EXCH_RATE = ?, CURR_CODE = ?"
+ " WHERE TRAN_ID = ?";
System.out.println("updateSql :" + updateSql);
PreparedStatement pstmt2 = conn.prepareStatement(updateSql);
pstmt2.setString(1, status);
pstmt2.setDouble(2, amt);
pstmt2.setDouble(3, exchRateD);
pstmt2.setString(4, currCode);
pstmt2.setString(5, tranId);
updateCnt = pstmt2.executeUpdate();
pstmt3 = conn.prepareStatement(updateSql);
pstmt3.setString(1, status);
pstmt3.setDouble(2, amt);
pstmt3.setDouble(3, exchRateD);
pstmt3.setString(4, currCode);
pstmt3.setString(5, tranId);
updateCnt = pstmt3.executeUpdate();
System.out.println("updateCnt :" + updateCnt);
pstmt2.close();
pstmt2 = null;
pstmt3.close();
pstmt3 = null;
conn.commit();
// 12/05/09 manoharan changed the message
// errCode = "VMSUCC";
errCode = "VTPRC1";
pstmt.close();
pstmt = null;
pstmt1.close();
pstmt1 = null;
} else {
errCode = "VTPROCUS";
}
}catch (SQLException d)
{
try
{
conn.rollback();
} catch (Exception e)
{
e.printStackTrace();
errString = e.getMessage();
throw new ITMException(e);
}
System.out.println("Exception : BankRecoPrc =>: updateTable"+ d.toString());
d.printStackTrace();
errString = d.getMessage();
throw new ITMException(d);
}
}// end outer for /** Abhijit Gaikwad 16/10/15 End
/*
......@@ -1115,93 +1047,79 @@ conn = getConnection();
return errCode;
}
private String getBanklogExchRate(String tranSer, String tranNo)
throws RemoteException, ITMException {
private String getBanklogExchRate(String tranSer, String tranNo, Connection conn) throws RemoteException, ITMException {
System.out.println("TranSer :" + tranSer);
String currCode = "";
StringBuffer valueXmlString = new StringBuffer(
"<?xml version=\"1.0\"?>\r\n<Root>\r\n");
double exchRate = 0;
Statement stmt = null;
Connection conn = null;
//String currCode = "";
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
//double exchRate = 0;
//Statement stmt = null;
//Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isSql = false;
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
String sql = "";
String tableName="";
try {
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
stmt = conn.createStatement();
//conn = connDriver.getConnectDB("DriverITM");
//conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
//stmt = conn.createStatement();
sql = "SELECT CURR_CODE, EXCH_RATE FROM ";
if (tranSer.equals("E-PAY")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM PAYMENT_EXP WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " FROM PAYMENT_EXP ";
isSql = true;
} else if (tranSer.equals("F-XFR")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM FUNDTRANSFER WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " FUNDTRANSFER ";
isSql = true;
} else if (tranSer.equals("M-PAY")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM MISC_PAYMENT WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " MISC_PAYMENT ";
isSql = true;
} else if (tranSer.equals("M-RCP")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM MISC_RECEIPT WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " MISC_RECEIPT ";
isSql = true;
} else if (tranSer.equals("MPCANC")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM MISC_PAYMENT_CANC WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " MISC_PAYMENT_CANC ";
isSql = true;
} else if (tranSer.equals("R-DIS")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM RCPDISHNR WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " RCPDISHNR ";
isSql = true;
} else if (tranSer.equals("RCP")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM RECEIPT WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " RECEIPT ";
isSql = true;
} else if (tranSer.equals("E-FUND")) {
sql = "SELECT CURR_CODE, EXCH_RATE FROM EXPORT_FUND WHERE TRAN_ID = '"
+ tranNo + "'";
tableName = " EXPORT_FUND ";
isSql = true;
}
sql = sql + tableName +" WHERE TRAN_ID = ? ";
System.out.println("SQL---getBanklogExchRate---["+sql+"]-------");
if (isSql) {
rs = stmt.executeQuery(sql);
pstmt= conn.prepareStatement(sql);
pstmt.setString(1, tranNo);
rs = pstmt.executeQuery();
if (rs.next()) {
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<curr_code>")
.append(rs.getString(1)).append("</curr_code>\r\n");
valueXmlString.append("<exch_rate>")
.append(rs.getString(2)).append("</exch_rate>\r\n");
valueXmlString.append("<curr_code>").append(rs.getString(1)).append("</curr_code>\r\n");
valueXmlString.append("<exch_rate>").append(rs.getString(2)).append("</exch_rate>\r\n");
valueXmlString.append("</Detail>\r\n");
}
}
stmt.close();
pstmt.close();
pstmt = null;
valueXmlString.append("</Root>\r\n");
} catch (Exception e) {
System.out
.println("Exception :ITMDBAccessEJB :getBanklogExchRate(String xmlString, String xmlString2):"
+ e.getMessage() + ":");
System.out.println("Exception :ITMDBAccessEJB :getBanklogExchRate(String xmlString, String xmlString2):"+ e.getMessage() + ":");
throw new ITMException(e);
} finally {
try {
System.out.println("Closing Connection.......");
conn.close();
conn = null;
} catch (Exception se) {
}
}
System.out.println("valueXmlString.toString() :"
+ valueXmlString.toString());
System.out.println("valueXmlString---getBanklogExchRate---:["+ valueXmlString.toString()+"]");
return valueXmlString.toString();
}
private String checkNull(String input)
{
if (input == null || "null".equals(input))
{
input = "";
input = " ";
}
return input;
}
......
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