Commit 7aa7d760 authored by caluka's avatar caluka

generate log file for confirmed and status 'C' transactions


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97560 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0c6c18df
...@@ -10,7 +10,8 @@ import java.util.*; ...@@ -10,7 +10,8 @@ import java.util.*;
import java.util.Date; import java.util.Date;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import java.io.File;
import java.io.FileOutputStream;
import javax.naming.InitialContext; import javax.naming.InitialContext;
...@@ -19,7 +20,7 @@ import ibase.webitm.ejb.*; ...@@ -19,7 +20,7 @@ import ibase.webitm.ejb.*;
import ibase.webitm.ejb.fin.adv.ReceiptAdvConf; import ibase.webitm.ejb.fin.adv.ReceiptAdvConf;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.utility.CommonConstants;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
...@@ -32,7 +33,11 @@ public class EcollectionSchedule implements Schedule ...@@ -32,7 +33,11 @@ public class EcollectionSchedule implements Schedule
boolean isError = false; boolean isError = false;
String loginSiteCode = ""; String loginSiteCode = "";
String retString=""; String retString="";
E12GenericUtility e12GenericUtility = new E12GenericUtility();
FileOutputStream fos1 = null;
java.util.Date startDate = new java.util.Date(System.currentTimeMillis());
Calendar calendar = Calendar.getInstance();
String startDateStr = null;
public static void main(String args[]) public static void main(String args[])
{ {
EcollectionSchedule ecs=new EcollectionSchedule(); EcollectionSchedule ecs=new EcollectionSchedule();
...@@ -63,11 +68,8 @@ public class EcollectionSchedule implements Schedule ...@@ -63,11 +68,8 @@ public class EcollectionSchedule implements Schedule
Document dom=genericUtility.parseString(scheduleParamXML); Document dom=genericUtility.parseString(scheduleParamXML);
NodeList paramList = dom.getElementsByTagName( "SCHEDULE" ); NodeList paramList = dom.getElementsByTagName( "SCHEDULE" );
// Node currDetail = null ;
// int noOfParam = paramList.getLength();
NodeList parentNodeList = null,childNodeList = null; NodeList parentNodeList = null,childNodeList = null;
Node parentNode = null,childNode = null; Node parentNode = null,childNode = null;
//String DisparmSites = "";
int childNodeListLength = 0; int childNodeListLength = 0;
String childNodeName = null; String childNodeName = null;
...@@ -91,6 +93,7 @@ public class EcollectionSchedule implements Schedule ...@@ -91,6 +93,7 @@ public class EcollectionSchedule implements Schedule
} }
} }
System.out.println("ActualLoginSiteCode----["+actualLoginSiteCode+"]"); System.out.println("ActualLoginSiteCode----["+actualLoginSiteCode+"]");
System.out.println("intializingLog$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$........."+ intializingLog("ecollection_log"));
if(("null".equals(actualLoginSiteCode) || actualLoginSiteCode.trim().length() == 0 )) if(("null".equals(actualLoginSiteCode) || actualLoginSiteCode.trim().length() == 0 ))
{ {
siteCode = userInfo.getSiteCode(); siteCode = userInfo.getSiteCode();
...@@ -109,7 +112,6 @@ public class EcollectionSchedule implements Schedule ...@@ -109,7 +112,6 @@ public class EcollectionSchedule implements Schedule
} }
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -132,19 +134,23 @@ public class EcollectionSchedule implements Schedule ...@@ -132,19 +134,23 @@ public class EcollectionSchedule implements Schedule
String bankCode = "",refNo="",custCode="",tranType="",rcpMode="",finEntity="",remarks=""; String bankCode = "",refNo="",custCode="",tranType="",rcpMode="",finEntity="",remarks="";
String sql1="",refSer="",lineNoRef=""; String sql1="",refSer="",lineNoRef="";
String errString ="",xmlString=""; String errString ="",xmlString="";
String strToWrite = "";
String endDateStr = null;
double rcpAmt=0,bankAmount=0,rcpAmtDet=0; double rcpAmt=0,bankAmount=0,rcpAmtDet=0;
int cnt=0,lineNo=0; int cnt=0,lineNo=0;
Date refDate=null,effDate=null; Date refDate=null,effDate=null;
E12GenericUtility e12GenericUtility = new E12GenericUtility(); //E12GenericUtility e12GenericUtility = new E12GenericUtility();
SimpleDateFormat sdf = new SimpleDateFormat(e12GenericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
ReceiptAdvConf ReceiptAdv = new ReceiptAdvConf(); ReceiptAdvConf ReceiptAdv = new ReceiptAdvConf();
java.util.Date startDate = new java.util.Date(System.currentTimeMillis());
java.util.Date endDate = new java.util.Date(System.currentTimeMillis());
try try
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; connDriver = null;
conn.setAutoCommit(false); conn.setAutoCommit(false);
SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(e12GenericUtility.getApplDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
java.util.Calendar cal = java.util.Calendar.getInstance(); java.util.Calendar cal = java.util.Calendar.getInstance();
tranDate = simpleDateFormat.format(cal.getTime()); tranDate = simpleDateFormat.format(cal.getTime());
...@@ -168,6 +174,13 @@ public class EcollectionSchedule implements Schedule ...@@ -168,6 +174,13 @@ public class EcollectionSchedule implements Schedule
tranId = rs.getString("tran_id"); tranId = rs.getString("tran_id");
System.out.println("receipt form tranId:::::::::" + tranId); System.out.println("receipt form tranId:::::::::" + tranId);
strToWrite = tranId+",";
startDate = new java.util.Date(System.currentTimeMillis());
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
startDateStr = sdf1.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
strToWrite=strToWrite+startDateStr+",";
System.out.println("STARTING DATE"+startDateStr +"STRING TO WRITE"+strToWrite);
sql1 = " select fin_entity from site where site_code=? "; sql1 = " select fin_entity from site where site_code=? ";
pstmt1 = conn.prepareStatement(sql1); pstmt1 = conn.prepareStatement(sql1);
...@@ -314,7 +327,6 @@ public class EcollectionSchedule implements Schedule ...@@ -314,7 +327,6 @@ public class EcollectionSchedule implements Schedule
System.out.println("xmlString " + xmlString); System.out.println("xmlString " + xmlString);
errString = saveData(siteCode, xmlString, conn); errString = saveData(siteCode, xmlString, conn);
System.out.println("Passed xml in master State full errString " + errString); System.out.println("Passed xml in master State full errString " + errString);
if (errString.indexOf("Success") > -1) if (errString.indexOf("Success") > -1)
{ {
...@@ -350,7 +362,16 @@ public class EcollectionSchedule implements Schedule ...@@ -350,7 +362,16 @@ public class EcollectionSchedule implements Schedule
System.out.println("connection roll back for save data"); System.out.println("connection roll back for save data");
conn.rollback(); conn.rollback();
} }
System.out.println("Passed xml in master State full errString " + errString); System.out.println("Passed xml in master State full final errString " + errString);
endDate = new java.util.Date(System.currentTimeMillis());
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
endDateStr = sdf1.format(endDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
System.out.println("**** ecollection completed for.....[" + tranId + "] at [" + endDateStr + "]" );
strToWrite=strToWrite+endDateStr+",";
strToWrite = strToWrite + errString+"\r\n\r\n";
fos1.write(strToWrite.getBytes());
System.out.println("End Time for transaction"+endDateStr+"string to write"+strToWrite);
} else } else
{ {
sql1 = " update receipt_form set remarks = 'Mismatch amount in bank statement and total receipt amount',status= 'R' where tran_id = ? "; sql1 = " update receipt_form set remarks = 'Mismatch amount in bank statement and total receipt amount',status= 'R' where tran_id = ? ";
...@@ -439,6 +460,41 @@ public class EcollectionSchedule implements Schedule ...@@ -439,6 +460,41 @@ public class EcollectionSchedule implements Schedule
} }
return retString; return retString;
} }
private String intializingLog(String fileName)
{
String log="intializingLog_Failed";
String strToWrite = "";
String currTime = null;
try{
SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
try
{
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
currTime = currTime.replaceAll("-","");
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
fileName = fileName+currTime+calendar.get(Calendar.HOUR)+""+calendar.get(Calendar.MINUTE)+".txt";
fos1 = new FileOutputStream(CommonConstants.JBOSSHOME + File.separator +"EDI"+File.separator+fileName);
}
catch(Exception e)
{
System.out.println("Exception []::"+e.getMessage());
e.printStackTrace();
}
startDate = new java.util.Date(System.currentTimeMillis());
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
startDateStr = sdf1.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
fos1.write(("Fetching Records Started At " + startDateStr +"\r\n").getBytes());
}
catch(Exception e)
{
System.out.println("Exception []::"+e.getMessage());
e.printStackTrace();
}
log ="intializingLog_Successesfull";
return log;
}
......
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