Commit 41258ba6 authored by ngadkari's avatar ngadkari

Loan Tracking system

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@185883 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 38a60a31
......@@ -21,6 +21,7 @@ import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
......@@ -30,6 +31,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
E12GenericUtility genericUtility = new E12GenericUtility();
FinCommon finCommon = new FinCommon();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
......@@ -665,7 +667,9 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
System.out.println("retString:::"+errString);
}
catch(Exception e)
{
{
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
return(errString);
......@@ -699,8 +703,8 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
String chq_name="",acct_code__ar="",modName="",acct_code__ap="",acct_code__ap_adv="",cctr_code__ar="";
String cctr_code__ap="",cctr_code__ap_adv="",site_code="",channel_partner="",curr_code="",loginSiteCode;
Timestamp TranDate = null, disbursDate = null, santionDate =null;
String tranDateStr="",disbursDateStr="",santionDateStr="",loanAmountStr="",loanTenureStr="",intRateStr="";
double loanAmount=0.0,loanTenure=0.0,intRate=0.0;
String tranDateStr="",disbursDateStr="",santionDateStr="",loanAmountStr="",loanTenureStr="",intRateStr="",exchRateStr="";
double loanAmount=0.0,loanTenure=0.0,intRate=0.0,exchRate=0.0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try
{
......@@ -728,19 +732,20 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
if(childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = genericUtility.getColumnValue("site_code", dom);
if(editFlag.equals("A"))
{
if(siteCode!= null && siteCode.trim().length() > 0)
{
existFlag = isExist("site", "site_code", siteCode, conn);
if (! "TRUE".equals(existFlag))
{
errCode = "VTDUPSITCD";
System.out.println("siteCode: " + siteCode);
if (siteCode == null || siteCode.trim().length() == 0) {
errCode = "VMSITECD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Site Code can not be blank!!");
} else {
if (siteCode != null && siteCode.trim().length() > 0) {
if (!(isExist(conn, "site", "site_code", siteCode))) {
errCode = "VMSITE1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}// end of if block for site_code
else if (childNodeName.equalsIgnoreCase("tran_date"))
......@@ -769,14 +774,16 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
{
disbursDate = Timestamp.valueOf(genericUtility.getValidDateString(disbursDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
TranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr.toString(),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+" 00:00:00.0");
TranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+" 00:00:00.0");
System.out.println("disbursDate"+disbursDateStr+".after (tranDate)"+tranDateStr);
if (TranDate.after(disbursDate))
{
{
System.out.println("disbursDate"+disbursDateStr+".error inside after (tranDate)"+tranDateStr);
errCode = "VTDISDTGT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
......@@ -794,10 +801,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
System.out.println("santionDate"+santionDateStr+".Before (disbursDate)"+disbursDateStr);
if (disbursDate.before(santionDate))
{
{
System.out.println("santionDate"+santionDateStr+".error inside Before (disbursDate)"+disbursDateStr);
errCode = "VTSNDTLDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
......@@ -1040,6 +1049,23 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
}// end of if block for group_code
else if("exch_rate".equalsIgnoreCase(childNodeName))
{
exchRateStr = checkNull(genericUtility.getColumnValue("exch_rate",dom));
if(exchRateStr != null && exchRateStr.trim().length() > 0)
{
exchRate=Double.parseDouble(exchRateStr);
if( exchRate <= 0 )
{
errCode = "VTEXRATEL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}// end of if block for group_code
}
break;
......@@ -1416,33 +1442,37 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
errCode = "VTCURRCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}// end of if block
}
break;
}// end of switch statement
int errListSize = errList.size();
cnt = 0;
String errFldName = null;
if(errList != null && errListSize > 0)
if ( errList != null && errListSize > 0 )
{
for(cnt = 0; cnt < errListSize; cnt ++)
for (cnt = 0; cnt < errListSize; cnt++ )
{
errCode = errList.get((int) cnt);
errFldName = errFields.get((int) cnt);
errCode = errList.get(cnt);
errFldName = errFields.get(cnt);
System.out.println("errCode .........." + errCode);
errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn , errCode);
if(errString.length() > 0)
errString = itmDBAccessEJB.getErrorString("", errCode, userId, "", conn);
errorType = errorType( conn, errCode );
if ( errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
String bifurErrString = errString.substring( errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString =bifurErrString+errString.substring( errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........."+errStringXml);
errString = "";
}
if(errorType.equalsIgnoreCase("E"))
if ( errorType.equalsIgnoreCase("E"))
{
break;
}
......@@ -1451,12 +1481,15 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
errStringXml.append("</Errors></Root>\r\n");
}
else
{
errStringXml = new StringBuffer("");
}
errStringXml = new StringBuffer( "" );
}
errString = errStringXml.toString();
}// End of try
catch(Exception e)
{
......@@ -1583,6 +1616,35 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
return errCode;
}*/
private boolean isExist(Connection conn, String tableName, String columnName, String value)
throws ITMException, RemoteException {
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
boolean status = false;
try {
sql = "SELECT count(*) from " + tableName + " where " + columnName + " = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, value);
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.getBoolean(1)) {
status = true;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} catch (Exception e) {
System.out.println("Exception in isExist ");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning String from isExist ");
return status;
}
private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{
Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
......
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