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.*;
import java.util.Date;
import java.sql.*;
import org.w3c.dom.*;
import java.io.File;
import java.io.FileOutputStream;
import javax.naming.InitialContext;
......@@ -19,7 +20,7 @@ import ibase.webitm.ejb.*;
import ibase.webitm.ejb.fin.adv.ReceiptAdvConf;
import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*;
import ibase.utility.CommonConstants;
import java.text.SimpleDateFormat;
import ibase.utility.E12GenericUtility;
......@@ -32,7 +33,11 @@ public class EcollectionSchedule implements Schedule
boolean isError = false;
String loginSiteCode = "";
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[])
{
EcollectionSchedule ecs=new EcollectionSchedule();
......@@ -63,11 +68,8 @@ public class EcollectionSchedule implements Schedule
Document dom=genericUtility.parseString(scheduleParamXML);
NodeList paramList = dom.getElementsByTagName( "SCHEDULE" );
// Node currDetail = null ;
// int noOfParam = paramList.getLength();
NodeList parentNodeList = null,childNodeList = null;
Node parentNode = null,childNode = null;
//String DisparmSites = "";
int childNodeListLength = 0;
String childNodeName = null;
......@@ -91,6 +93,7 @@ public class EcollectionSchedule implements Schedule
}
}
System.out.println("ActualLoginSiteCode----["+actualLoginSiteCode+"]");
System.out.println("intializingLog$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$........."+ intializingLog("ecollection_log"));
if(("null".equals(actualLoginSiteCode) || actualLoginSiteCode.trim().length() == 0 ))
{
siteCode = userInfo.getSiteCode();
......@@ -109,7 +112,6 @@ public class EcollectionSchedule implements Schedule
}
}
}
catch(Exception e)
{
......@@ -132,19 +134,23 @@ public class EcollectionSchedule implements Schedule
String bankCode = "",refNo="",custCode="",tranType="",rcpMode="",finEntity="",remarks="";
String sql1="",refSer="",lineNoRef="";
String errString ="",xmlString="";
String strToWrite = "";
String endDateStr = null;
double rcpAmt=0,bankAmount=0,rcpAmtDet=0;
int cnt=0,lineNo=0;
Date refDate=null,effDate=null;
E12GenericUtility e12GenericUtility = new E12GenericUtility();
//E12GenericUtility e12GenericUtility = new E12GenericUtility();
SimpleDateFormat sdf = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
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
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
java.util.Calendar cal = java.util.Calendar.getInstance();
tranDate = simpleDateFormat.format(cal.getTime());
......@@ -168,6 +174,13 @@ public class EcollectionSchedule implements Schedule
tranId = rs.getString("tran_id");
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=? ";
pstmt1 = conn.prepareStatement(sql1);
......@@ -314,7 +327,6 @@ public class EcollectionSchedule implements Schedule
System.out.println("xmlString " + xmlString);
errString = saveData(siteCode, xmlString, conn);
System.out.println("Passed xml in master State full errString " + errString);
if (errString.indexOf("Success") > -1)
{
......@@ -350,7 +362,16 @@ public class EcollectionSchedule implements Schedule
System.out.println("connection roll back for save data");
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
{
sql1 = " update receipt_form set remarks = 'Mismatch amount in bank statement and total receipt amount',status= 'R' where tran_id = ? ";
......@@ -438,7 +459,42 @@ public class EcollectionSchedule implements Schedule
throw new ITMException(e);
}
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