Commit 99d3ef14 authored by ssalve's avatar ssalve

Sarita : Done changes on 21 DEC 2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@194799 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6808d212
......@@ -13,6 +13,7 @@ import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
......@@ -27,6 +28,7 @@ import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
......@@ -102,6 +104,12 @@ public class CostCtrAllocPosEJB extends ValidatorEJB implements CostCtrAllocPosE
int nodeListlen = 0;
String tranType = "CCA";
//String refSer = "JOUR"; Commented by sarita on 04 JUN 2018
//Added by sarita on 14 DECEMBER 2018 [START]
HashMap<String,Double> detailData1 = new HashMap<String,Double>();
HashMap<String,Double> detailData2 = new HashMap<String,Double>();
double finalAllocation = 0.0;
double diffInAmt = 0.0 , allocvalue = 0.0;
//Added by sarita on 14 DECEMBER 2018 [END]
try
{
if(conn == null || conn.isClosed())
......@@ -417,6 +425,18 @@ public class CostCtrAllocPosEJB extends ValidatorEJB implements CostCtrAllocPosE
System.out.println("Detail String is :::: " +detailString.toString());
//Added by sarita on [24 MAY 2018] [start] to set drcrFlag
//Added by sarita to add detail2 values in hashmap on 14 DEC 2018 [START]
if((detailData1 != null) && (detailData1.containsKey(acct_code)))
{
totUnitsVal = totUnitsVal + detailData1.get(acct_code);
detailData1.put(acct_code, totUnitsVal);
}
else
{
detailData1.put(acct_code, totUnitsVal);
}System.out.println("SARITA :: HEADER DATA ::" +detailData1);
//Added by sarita to add detail2 values in hashmap on 14 DEC 2018 [END]
NodeList nodeList =dom.getElementsByTagName("Detail3");
nodeListlen = nodeList.getLength();
System.out.println("NodeList for Detail3 is ========"+nodeListlen);
......@@ -502,6 +522,28 @@ public class CostCtrAllocPosEJB extends ValidatorEJB implements CostCtrAllocPosE
continue;
}
//Added by sarita to add detail3 data in hashmap on 14 DEC 2018 [START]
double alloc2 = Double.valueOf(unitAllocDtl3);
System.out.println("Allocation Value is ::" + alloc2);
if((detailData2 != null) && (detailData2.containsKey(acct_code)))
{
alloc2 = alloc2 + detailData2.get(acct_code);
detailData2.put(acct_code, alloc2);
}
else
{
detailData2.put(acct_code, alloc2);
}System.out.println("Values in HashMap [1 "+detailData1+"] \t [2 "+detailData2+"]" );
diffInAmt = getHashMapValDiff(detailData1 , detailData2); System.out.println("Difference is Values ["+diffInAmt+"]");
if((diffInAmt != 0 && (diffInAmt <= 1)))
{
allocvalue = Double.valueOf(unitAllocDtl3);
finalAllocation = allocvalue + diffInAmt;
unitAllocDtl3 = String.valueOf(finalAllocation); System.out.println("unitAllocDtl3 ["+unitAllocDtl3+"]");
}
//Added by sarita on 14 DEC 2018 [END]
//domIDLineNo++;
System.out.println("domIDLineNo ::"+(domIDLineNo));
pstmt1.setString(1,tranID);
......@@ -526,7 +568,9 @@ public class CostCtrAllocPosEJB extends ValidatorEJB implements CostCtrAllocPosE
detailString.append("</Detail2>");
System.out.println("Detail String is :::: " +detailString.toString());
}//end of for loop for Detail2
//Added by sarita to clear hashmap values on 14 DECEMBER 2018 [Start]
detailData1.clear(); detailData2.clear(); System.out.println("detailData1["+detailData1+"]\t detailData2["+detailData2+"]");
//Added by sarita to clear hashmap values on 14 DECEMBER 2018 [end]
System.out.println("acctCodeDtl3["+acctCodeDtl3+"]"+"tranIdDtl3["+tranIdDtl3+"]"+"lineNoDtl3["+lineNoDtl3+"]"+"siteCodeDtl3["+siteCodeDtl3+"]"+"cctrCodeDtl3["+cctrCodeDtl3+"]"+"cctrDescrDtl3["+cctrDescrDtl3+"]"+"unitAllocDtl3["+unitAllocDtl3+"]");
//Commented by sarita on 28 May 2018 [start]
......@@ -706,11 +750,12 @@ public class CostCtrAllocPosEJB extends ValidatorEJB implements CostCtrAllocPosE
else*/
if(retString.indexOf("CONFSUCCES") == -1)
{
retString = getError(responseXML, "TRFAILED", conn);
//Commented by sarita on 14 DECEMBER 2018 [START]
//retString = getError(responseXML, "TRFAILED", conn);
//Commented by sarita on 14 DECEMBER 2018 [END]
System.out.println("retString if Error ::"+retString);
isError = true;
return retString;
}
else if(retString.indexOf("CONFSUCCES") != -1)
{
......@@ -1184,4 +1229,37 @@ public class CostCtrAllocPosEJB extends ValidatorEJB implements CostCtrAllocPosE
}
return userInfoStr.toString();
}//end of method getUserInfo*/
//Added by sarita on 14 DECEMBER 2018 [START]
private double getHashMapValDiff(HashMap<String,Double> data1 , HashMap<String,Double> data2) throws ITMException
{
double diffAmt = 0.0;
double totVal = 0.0;
FinCommon finCommon = new FinCommon();
try
{
System.out.println("******** Inside Method getHashMapValDiff *********** ");
System.out.println("data1 ["+data1+"] \t data2 ["+data2+"]" );
for(String key : data1.keySet())
{
totVal = data1.get(key);System.out.println("Total Value in HashMap 1 is ["+totVal+"]");
}
for (HashMap.Entry<String, Double> map1 : data2.entrySet()) // assuming your map is Map<String, String>
{
if(data1.containsKey(map1.getKey()))
{
double hmdata2 = map1.getValue();
diffAmt = finCommon.getRequiredDecimal((totVal - hmdata2),2);System.out.println("Found DATA -> " + hmdata2 + "\t Difference Amount is -->" + diffAmt);
}
}
}
catch(Exception e)
{
System.out.println(e);
e.printStackTrace();
throw new ITMException(e);
}
return diffAmt;
}
//Added by sarita on 14 DECEMBER 2018 [END]
}//end of class CostCtrAllocPosEJB
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