Commit 134c773f authored by ngadkari's avatar ngadkari

Loan Tracking system

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@185638 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 693a0825
...@@ -5,6 +5,7 @@ import java.sql.Connection; ...@@ -5,6 +5,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
...@@ -272,13 +273,13 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -272,13 +273,13 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
siteCode =genericUtility.getColumnValue("site_code", dom); siteCode =genericUtility.getColumnValue("site_code", dom);
currCode =genericUtility.getColumnValue("curr_code", dom); currCode =genericUtility.getColumnValue("curr_code", dom);
mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn); mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
valueXmlString.append("<exch_rate>").append("<![CDATA[" + mexrate + "]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA[" + mexrate + "]]>").append("</exch_rate>");
loanAmt = genericUtility.getColumnValue("loan_amount", dom); loanAmt = genericUtility.getColumnValue("loan_amount", dom);
if(loanAmt !=null && loanAmt.trim().length() > 0) if(loanAmt !=null && loanAmt.trim().length() > 0)
{ {
loanAmtBC = (Double.parseDouble(loanAmt)) * mexrate; loanAmtBC = (Double.parseDouble(loanAmt)) * mexrate;
} }
valueXmlString.append("<loan_amt__bc>").append("<![CDATA[" + loanAmtBC + "]]>").append("</loan_amt__bc>"); valueXmlString.append("<loan_amt__bc protect = \"1\">").append("<![CDATA[" + loanAmtBC + "]]>").append("</loan_amt__bc>");
} }
String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); System.out.println("--login code--"+userId); String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); System.out.println("--login code--"+userId);
...@@ -290,7 +291,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -290,7 +291,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
String chgTerm = this.genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"); String chgTerm = this.genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
valueXmlString.append("</Detail1>"); // close tag valueXmlString.append("</Detail1>"); // close tag
System.out.println("NANDKUMAR itemchanged case 1 valueXmlString : "+valueXmlString); System.out.println(" itemchanged case 1 valueXmlString : "+valueXmlString);
break; break;
case 2 : case 2 :
...@@ -697,7 +698,9 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -697,7 +698,9 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
String refSer = "",acctCode = "",cctrCode="",bank_code="",int_term="",int_term__penalty=""; String refSer = "",acctCode = "",cctrCode="",bank_code="",int_term="",int_term__penalty="";
String chq_name="",acct_code__ar="",modName="",acct_code__ap="",acct_code__ap_adv="",cctr_code__ar=""; 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; 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;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
...@@ -739,7 +742,65 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -739,7 +742,65 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
} }
}// end of if block for site_code }// end of if block for site_code
else if (childNodeName.equalsIgnoreCase("tran_date"))
{
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
System.out.println("@@@@ Tran Date[" + tranDateStr + "]");
TranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr.toString(),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+" 00:00:00.0");
System.out.println("Trandate is"+TranDate);
errCode = finCommon.nfCheckPeriod("FIN", TranDate,siteCode, conn);
System.out.println("Errorcode in TranDate"+errCode);
if (errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("disburs_date"))
{
disbursDateStr = checkNull(genericUtility.getColumnValue("disburs_date", dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
System.out.println("@@@@ recDate[" + disbursDateStr + "]");
if ((disbursDateStr != null && disbursDateStr.trim().length() > 0))
{
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");
System.out.println("disbursDate"+disbursDateStr+".after (tranDate)"+tranDateStr);
if (TranDate.after(disbursDate))
{
errCode = "VTDISDTGT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("santion_date"))
{
santionDateStr = checkNull(genericUtility.getColumnValue("santion_date", dom));
disbursDateStr = checkNull(genericUtility.getColumnValue("disburs_date", dom));
System.out.println("@@@@ santionDate[" + santionDateStr + "]");
if ((santionDateStr != null && santionDateStr.trim().length() > 0))
{
santionDate = Timestamp.valueOf(genericUtility.getValidDateString(santionDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
disbursDate = Timestamp.valueOf(genericUtility.getValidDateString(disbursDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
System.out.println("santionDate"+santionDateStr+".Before (disbursDate)"+disbursDateStr);
if (disbursDate.before(santionDate))
{
errCode = "VTSNDTLDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("loan_party".equalsIgnoreCase(childNodeName)) else if("loan_party".equalsIgnoreCase(childNodeName))
{ {
loanParty = checkNull(genericUtility.getColumnValue("loan_party", dom)); loanParty = checkNull(genericUtility.getColumnValue("loan_party", dom));
...@@ -930,6 +991,55 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -930,6 +991,55 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
} }
}// end of if block for group_code }// end of if block for group_code
else if("loan_amount".equalsIgnoreCase(childNodeName))
{
loanAmountStr = checkNull(genericUtility.getColumnValue("loan_amount",dom));
if(loanAmountStr != null && loanAmountStr.trim().length() > 0)
{
loanAmount=Double.parseDouble(loanAmountStr);
if( loanAmount <= 0)
{
errCode = "VTLAMTZON";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}// end of if block for group_code
else if("loan_tenure".equalsIgnoreCase(childNodeName))
{
loanTenureStr = checkNull(genericUtility.getColumnValue("loan_tenure",dom));
if(loanTenureStr != null && loanTenureStr.trim().length() > 0)
{
loanTenure=Double.parseDouble(loanTenureStr);
if( loanTenure <= 0)
{
errCode = "VTLTENZON";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}// end of if block for group_code
else if("int_rate".equalsIgnoreCase(childNodeName))
{
intRateStr = checkNull(genericUtility.getColumnValue("int_rate",dom));
if(intRateStr != null && intRateStr.trim().length() > 0)
{
intRate=Double.parseDouble(intRateStr);
if( intRate > 100 || intRate < 0 )
{
errCode = "VTIINTRAT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}// end of if block for group_code
} }
break; break;
...@@ -1095,7 +1205,17 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -1095,7 +1205,17 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
} }
}// end of if block }// end of if block
/*else if("amount_paid".equalsIgnoreCase(childNodeName))
{
errCode = valAmount(dom, dom1,dom2, "amount_paid", objContext, editFlag, conn);
System.out.println("Amount" + errCode + "]");
if (errCode != null && errCode.trim().length() > 0) {
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}// end of if block
*/
}//end for loop }//end for loop
break; break;
...@@ -1408,6 +1528,61 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -1408,6 +1528,61 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
return retStr; return retStr;
} }
/*public String valAmount(Document dom, Document dom1,Document dom2, String currentColumn,String objContext, String editFlag,Connection conn) throws ITMException
{
String errCode = "", currLineNo = "";
String childNodeName = null;
Node parentNode = null;
Node childNode = null;
String childNodeName1 = null;
int childNodeListLength;
int ctr = 0, cnt1 = 0;
int currentFormNo = 0;
NodeList parentNodeList = null;
NodeList childNodeList = null;
double totAmountPaid=0.0, amountPaid=0.0 ,loanAmount=0.0;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeListLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
amountPaid = checkDoubleNull(genericUtility.getColumnValue("amount_paid", dom2));
totAmountPaid= totAmountPaid + amountPaid ;
System.out.println("@@@@ amountPaid[" + amountPaid + "]");
}
loanAmount = checkDoubleNull(genericUtility.getColumnValue("loan_amount", dom));
System.out.println("@@@@ amountPaid[" + totAmountPaid + "]");
if(totAmountPaid != loanAmount )
{
errCode = "VTRECO6";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Amount mismatch!");
}
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception ::" + e.getMessage());
throw new ITMException(e);
}
return errCode;
}*/
private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{ {
Node tempNode = dom.getElementsByTagName( nodeName ).item(0); Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
...@@ -1426,6 +1601,13 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -1426,6 +1601,13 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
tempNode = null; tempNode = null;
} }
private double checkDoubleNull(String str) {
if (str == null || str.trim().length() == 0) {
return 0.0;
} else {
return Double.parseDouble(str);
}
}
private String errorType(Connection conn , String errorCode) private String errorType(Connection conn , String errorCode)
{ {
String msgType = ""; String msgType = "";
......
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