Commit 7ef2cddd authored by pbhosale's avatar pbhosale

Updated on [19/11/2019] changes done as suggested By Piyush Sir

AdmCommon.java
AllowDednSalComp.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212440 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 750c1c3f
...@@ -558,88 +558,63 @@ public class AdmCommon ...@@ -558,88 +558,63 @@ public class AdmCommon
if(voucherNo != null && (voucherNo.trim().equalsIgnoreCase("PAYROLL"))) if(voucherNo != null && (voucherNo.trim().equalsIgnoreCase("PAYROLL")))
//Modified by Poonam B[19/11/2019][END][Changes done as suggested by piyush sir] //Modified by Poonam B[19/11/2019][END][Changes done as suggested by piyush sir]
{ {
}//Added by Anjali R. on [19/07/2019][To terminate if condition here as per pb code] }//Added by Anjali R. on [19/07/2019][To terminate if condition here as per pb code]
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration] // Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration]
// if ((voucherNo != null && voucherNo.trim().length() > 0) || procType.equalsIgnoreCase("PY")) // if ((voucherNo != null && voucherNo.trim().length() > 0) || procType.equalsIgnoreCase("PY"))
else if ((voucherNo != null && voucherNo.trim().length() > 0) || procType.equalsIgnoreCase("PY") || winName.equalsIgnoreCase("W_ATTD_PROC_NORULE") || winName.equalsIgnoreCase("W_ATTD_MON")) else if ((voucherNo != null && voucherNo.trim().length() > 0) || procType.equalsIgnoreCase("PY") || winName.equalsIgnoreCase("W_ATTD_PROC_NORULE") || winName.equalsIgnoreCase("W_ATTD_MON"))
{
sqlStr = "SELECT COUNT(*) AS COUNT FROM PAYARR_TO_PROC WHERE EMP_CODE = '"+currEmpCode+"'" +
" AND PRD_CODE = '"+currPeriod+"' AND STATUS = 'U' AND PROC_TYPE = '"+procType+"'" ;
System.out.println("sqlStr In [payarrToProcUpdation][sqlStr][6]........:: " + sqlStr);
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sqlStr);
if (rs1.next())
{ {
sqlStr = "SELECT COUNT(*) AS COUNT FROM PAYARR_TO_PROC WHERE EMP_CODE = '"+currEmpCode+"'" + count1 = rs1.getInt("COUNT");
" AND PRD_CODE = '"+currPeriod+"' AND STATUS = 'U' AND PROC_TYPE = '"+procType+"'" ; }
System.out.println("sqlStr In [payarrToProcUpdation][sqlStr][6]........:: " + sqlStr); rs1.close();
stmt1 = conn.createStatement(); rs1 = null;
rs1 = stmt1.executeQuery(sqlStr); stmt1.close();
if (rs1.next()) stmt1 = null;
{ System.out.println("COUNT(*) FROM PAYARR_TO_PROC.....::[count1]:: "+ count1);
count1 = rs1.getInt("COUNT"); if (count1 == 0)
} {
rs1.close(); // Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].Start
rs1 = null; /*
stmt1.close();
stmt1 = null;
System.out.println("COUNT(*) FROM PAYARR_TO_PROC.....::[count1]:: "+ count1);
if (count1 == 0)
{
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].Start
/*
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+ String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1></Detail1></Root>"; "\r\n</header><Detail1></Detail1></Root>";
*/ */
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+ String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1><work_site><![CDATA[" + workSite.trim() + "]]></work_site><pay_site><![CDATA[" + paySite.trim() + "]]></pay_site><emp_site><![CDATA[" + empSite.trim() + "]]></emp_site></Detail1></Root>"; "\r\n</header><Detail1><work_site><![CDATA[" + workSite.trim() + "]]></work_site><pay_site><![CDATA[" + paySite.trim() + "]]></pay_site><emp_site><![CDATA[" + empSite.trim() + "]]></emp_site></Detail1></Root>";
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].End // Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].End
CommonConstants.setIBASEHOME(); CommonConstants.setIBASEHOME();
TransIDGenerator tg = new TransIDGenerator(XMLString, userId, CommonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(XMLString, userId, CommonConstants.DB_NAME);
tranID = tg.generateTranSeqID("PAYARR", "tran_id", keyString, conn); tranID = tg.generateTranSeqID("PAYARR", "tran_id", keyString, conn);
System.out.println("Transaction Id Generated [tranID] :: "+tranID); System.out.println("Transaction Id Generated [tranID] :: "+tranID);
if(tranID.equalsIgnoreCase("ERROR")) if(tranID.equalsIgnoreCase("ERROR"))
{ {
errCode = "VTTRANID"; errCode = "VTTRANID";
break; break;
}
String status = "U";
sqlIns = "INSERT INTO PAYARR_TO_PROC (TRAN_ID, EMP_CODE, PRD_CODE, STATUS, PROC_TYPE, CHG_DATE, CHG_USER, CHG_TERM) " +
" VALUES(?,?,?,?,?,?,?,?)";
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][1]........:: " + sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,tranID);
pstmt.setString(2,currEmpCode);
pstmt.setString(3,currPeriod);
pstmt.setString(4,status);
pstmt.setString(5,procType);
pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(7,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
int insCnt = pstmt.executeUpdate();
if (insCnt == 1)
{
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully.........");
}
else
{
errCode = "DS000";
break;
}
pstmt.close();
pstmt = null;
} }
sqlIns = "INSERT INTO PAYARR_TO_PROC_TRACE (EMP_CODE, PRD_CODE, PROC_TYPE, TRAN_WINDOW, KEY_VALUES, CHG_DATE, CHG_USER, CHG_TERM) " + String status = "U";
" VALUES(?,?,?,?,?,?,?,?)" ; sqlIns = "INSERT INTO PAYARR_TO_PROC (TRAN_ID, EMP_CODE, PRD_CODE, STATUS, PROC_TYPE, CHG_DATE, CHG_USER, CHG_TERM) " +
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][2]........:: " + sqlIns); " VALUES(?,?,?,?,?,?,?,?)";
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][1]........:: " + sqlIns);
pstmt = conn.prepareStatement(sqlIns); pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,currEmpCode); pstmt.setString(1,tranID);
pstmt.setString(2,currPeriod); pstmt.setString(2,currEmpCode);
pstmt.setString(3,procType); pstmt.setString(3,currPeriod);
pstmt.setString(4,winName); pstmt.setString(4,status);
pstmt.setString(5,keyStr); pstmt.setString(5,procType);
pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis())); pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(7,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode")); pstmt.setString(7,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId")); pstmt.setString(8,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
int insCnt = pstmt.executeUpdate(); int insCnt = pstmt.executeUpdate();
if (insCnt == 1) if (insCnt == 1)
{ {
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully:: [insCnt].........::" + insCnt); System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully.........");
} }
else else
{ {
...@@ -649,6 +624,31 @@ public class AdmCommon ...@@ -649,6 +624,31 @@ public class AdmCommon
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
sqlIns = "INSERT INTO PAYARR_TO_PROC_TRACE (EMP_CODE, PRD_CODE, PROC_TYPE, TRAN_WINDOW, KEY_VALUES, CHG_DATE, CHG_USER, CHG_TERM) " +
" VALUES(?,?,?,?,?,?,?,?)" ;
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][2]........:: " + sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,currEmpCode);
pstmt.setString(2,currPeriod);
pstmt.setString(3,procType);
pstmt.setString(4,winName);
pstmt.setString(5,keyStr);
pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(7,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
int insCnt = pstmt.executeUpdate();
if (insCnt == 1)
{
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully:: [insCnt].........::" + insCnt);
}
else
{
errCode = "DS000";
break;
}
pstmt.close();
pstmt = null;
}
//} //}
}//End Of If Block }//End Of If Block
rs.close(); rs.close();
...@@ -2218,9 +2218,9 @@ public class AdmCommon ...@@ -2218,9 +2218,9 @@ public class AdmCommon
} }
//Ended by Azhar for payroll period validation //Ended by Azhar for payroll period validation
// Added by Azhar LogWriter methods---------------------------------- // Added by Azhar LogWriter methods----------------------------------
public LogWriterDatabase initializeLogWriter(HashMap gbflogWriterMap,Document headerDom, Connection logConn) throws ITMException public LogWriterDatabase initializeLogWriter(HashMap gbflogWriterMap,Document headerDom, Connection logConn) throws ITMException
{ {
System.out.println("Inside admCommon initializeLogWriter localConn method...."); System.out.println("Inside admCommon initializeLogWriter localConn method....");
...@@ -2253,7 +2253,7 @@ public class AdmCommon ...@@ -2253,7 +2253,7 @@ public class AdmCommon
System.out.println("userInfoBean:::: " + userInfoBean); System.out.println("userInfoBean:::: " + userInfoBean);
transDb = userInfoBean.getTransDB(); transDb = userInfoBean.getTransDB();
System.out.println("transDb:::: " + transDb); System.out.println("transDb:::: " + transDb);
if(localConn == null) if(localConn == null)
{ {
System.out.println("creating localConn....."); System.out.println("creating localConn.....");
...@@ -2272,20 +2272,20 @@ public class AdmCommon ...@@ -2272,20 +2272,20 @@ public class AdmCommon
System.out.println("connFlag becomes false to ---["+ connFlag +"]"); System.out.println("connFlag becomes false to ---["+ connFlag +"]");
}*/ }*/
System.out.println("gbflogWriterMap:::: " + gbflogWriterMap); System.out.println("gbflogWriterMap:::: " + gbflogWriterMap);
logWriter.setCurrentProcess((String) gbflogWriterMap.get("currentProcess")); logWriter.setCurrentProcess((String) gbflogWriterMap.get("currentProcess"));
logWriter.setActivity((String) gbflogWriterMap.get("activity")); logWriter.setActivity((String) gbflogWriterMap.get("activity"));
logWriter.setProcessId((String) gbflogWriterMap.get("processId")); logWriter.setProcessId((String) gbflogWriterMap.get("processId"));
logWriter.setObjName((String) gbflogWriterMap.get("objName")); logWriter.setObjName((String) gbflogWriterMap.get("objName"));
logWriter.setFileNameStartWith((String) gbflogWriterMap.get("fileNameStartName")); logWriter.setFileNameStartWith((String) gbflogWriterMap.get("fileNameStartName"));
objName = logWriter.getObjName(); objName = logWriter.getObjName();
userId = (String) gbflogWriterMap.get("userId"); userId = (String) gbflogWriterMap.get("userId");
logWriter.setUserId(userId); logWriter.setUserId(userId);
loginSite = (String) gbflogWriterMap.get("loginSite"); loginSite = (String) gbflogWriterMap.get("loginSite");
xtraParams = (String) gbflogWriterMap.get("xtraParams"); xtraParams = (String) gbflogWriterMap.get("xtraParams");
System.out.println("objName::: " + objName + " \nuserId::: " + userId + " \nloginSite::: " + loginSite + " \nxtraParams::: " + xtraParams); System.out.println("objName::: " + objName + " \nuserId::: " + userId + " \nloginSite::: " + loginSite + " \nxtraParams::: " + xtraParams);
logWriter.setErrorCode(""); logWriter.setErrorCode("");
processId = logWriter.getProcessId(); processId = logWriter.getProcessId();
System.out.println("processId:::: " + processId); System.out.println("processId:::: " + processId);
...@@ -2306,7 +2306,7 @@ public class AdmCommon ...@@ -2306,7 +2306,7 @@ public class AdmCommon
System.out.println("Final File Path =" + filePath); System.out.println("Final File Path =" + filePath);
try try
{ {
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath)); BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null) while ((isCurrentLine = bufferedReader.readLine()) != null)
{ {
...@@ -2329,7 +2329,7 @@ public class AdmCommon ...@@ -2329,7 +2329,7 @@ public class AdmCommon
String xmlMetadata = xmlFileData.toString().replace("//", "").trim(); String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim(); xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata); Document domInitData = genericUtility.parseString(xmlMetadata);
logLocationType = logWriter.getLogLocationType(); logLocationType = logWriter.getLogLocationType();
logServerAddress = logWriter.getLogServerAddress(); logServerAddress = logWriter.getLogServerAddress();
if(logLocationType == null || logLocationType.trim().length() == 0) if(logLocationType == null || logLocationType.trim().length() == 0)
...@@ -2358,7 +2358,7 @@ public class AdmCommon ...@@ -2358,7 +2358,7 @@ public class AdmCommon
} }
logWriter.setLogLocationType(logLocationType); logWriter.setLogLocationType(logLocationType);
logWriter.setLogServerAddress(logServerAddress); logWriter.setLogServerAddress(logServerAddress);
jobId = logWriter.getJobID(); jobId = logWriter.getJobID();
System.out.println("jobId :::: " + jobId); System.out.println("jobId :::: " + jobId);
if(jobId == null || jobId.trim().length() == 0) if(jobId == null || jobId.trim().length() == 0)
...@@ -2385,10 +2385,10 @@ public class AdmCommon ...@@ -2385,10 +2385,10 @@ public class AdmCommon
while(resultSet.next()) while(resultSet.next())
{ {
maxJobId = checkNull(resultSet.getString("job_id")); maxJobId = checkNull(resultSet.getString("job_id"));
} }
System.out.println("maxJobId:::: " + maxJobId); System.out.println("maxJobId:::: " + maxJobId);
if(resultSet != null) if(resultSet != null)
{ {
resultSet.close(); resultSet.close();
...@@ -2483,7 +2483,7 @@ public class AdmCommon ...@@ -2483,7 +2483,7 @@ public class AdmCommon
} }
} }
} }
else else
{ {
logWriter.setJobID(null); logWriter.setJobID(null);
...@@ -2515,10 +2515,10 @@ public class AdmCommon ...@@ -2515,10 +2515,10 @@ public class AdmCommon
istr_log_writer.io_inet = create inet istr_log_writer.io_inet = create inet
logWriter.setInetCreatedBy("self"); logWriter.setInetCreatedBy("self");
}*/ }*/
logWriter.setInetCreatedBy("caller"); logWriter.setInetCreatedBy("caller");
} }
if("B".equalsIgnoreCase(logLocationType) || "N".equalsIgnoreCase(logLocationType)) if("B".equalsIgnoreCase(logLocationType) || "N".equalsIgnoreCase(logLocationType))
{ {
...@@ -2549,9 +2549,9 @@ public class AdmCommon ...@@ -2549,9 +2549,9 @@ public class AdmCommon
} }
} }
} }
logWriter.setlogWriterFlag(liRet); logWriter.setlogWriterFlag(liRet);
} }
catch (Exception e) catch (Exception e)
...@@ -2563,7 +2563,7 @@ public class AdmCommon ...@@ -2563,7 +2563,7 @@ public class AdmCommon
finally finally
{ {
try { try {
/* if(connFlag == true) /* if(connFlag == true)
{ {
System.out.println("connFlag is [" + connFlag + "] and ready to commit localConn....!!!"); System.out.println("connFlag is [" + connFlag + "] and ready to commit localConn....!!!");
...@@ -2590,8 +2590,8 @@ public class AdmCommon ...@@ -2590,8 +2590,8 @@ public class AdmCommon
} }
return logWriter; return logWriter;
} }
public LogWriterDatabase gbfErrWrite(String asPrdCode, String asEmpCode, String asType, String asErrCode, String asSeverity,LogWriterDatabase logWriter,Connection logConn) throws ITMException public LogWriterDatabase gbfErrWrite(String asPrdCode, String asEmpCode, String asType, String asErrCode, String asSeverity,LogWriterDatabase logWriter,Connection logConn) throws ITMException
{ {
System.out.println("Inside admCommon gbfErrWrite method with 5 parameters...."); System.out.println("Inside admCommon gbfErrWrite method with 5 parameters....");
...@@ -2609,14 +2609,14 @@ public class AdmCommon ...@@ -2609,14 +2609,14 @@ public class AdmCommon
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode")); userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId")); chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode")); loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"));
/*userInfoStr = getUserInfoStr(xtraParams); /*userInfoStr = getUserInfoStr(xtraParams);
System.out.println("userInfoStr:::: " + userInfoStr); System.out.println("userInfoStr:::: " + userInfoStr);
userInfoBean = new UserInfoBean(userInfoStr); userInfoBean = new UserInfoBean(userInfoStr);
System.out.println("userInfoBean:::: " + userInfoBean); System.out.println("userInfoBean:::: " + userInfoBean);
transDb = userInfoBean.getTransDB(); transDb = userInfoBean.getTransDB();
System.out.println("transDb:::: " + transDb); System.out.println("transDb:::: " + transDb);
if(localConn == null) if(localConn == null)
{ {
System.out.println("creating localConn in gbfErrWrite....."); System.out.println("creating localConn in gbfErrWrite.....");
...@@ -2634,7 +2634,7 @@ public class AdmCommon ...@@ -2634,7 +2634,7 @@ public class AdmCommon
connFlag = true; connFlag = true;
System.out.println("connFlag becomes false to ---["+ connFlag +"]"); System.out.println("connFlag becomes false to ---["+ connFlag +"]");
}*/ }*/
if(asPrdCode != null && asPrdCode.trim().length() > 0) if(asPrdCode != null && asPrdCode.trim().length() > 0)
{ {
lsErr = lsErr + "Prd : " + asPrdCode; lsErr = lsErr + "Prd : " + asPrdCode;
...@@ -2647,9 +2647,9 @@ public class AdmCommon ...@@ -2647,9 +2647,9 @@ public class AdmCommon
{ {
lsStr = asErrCode; lsStr = asErrCode;
asErrCode = getToken(lsStr,"~t"); asErrCode = getToken(lsStr,"~t");
} }
logWriter.setStatusDetail(lsErr + logWriter.getCurrentProcess().trim() + " " + lsStr); logWriter.setStatusDetail(lsErr + logWriter.getCurrentProcess().trim() + " " + lsStr);
logWriter.setErrorCode(asErrCode); logWriter.setErrorCode(asErrCode);
logWriter.setStatusType(asSeverity); logWriter.setStatusType(asSeverity);
...@@ -2676,7 +2676,7 @@ public class AdmCommon ...@@ -2676,7 +2676,7 @@ public class AdmCommon
finally finally
{ {
try { try {
/*if(connFlag == true) /*if(connFlag == true)
{ {
System.out.println("connFlag is [" + connFlag + "] and ready to commit localConn....!!!"); System.out.println("connFlag is [" + connFlag + "] and ready to commit localConn....!!!");
...@@ -2689,7 +2689,7 @@ public class AdmCommon ...@@ -2689,7 +2689,7 @@ public class AdmCommon
localConn.close(); localConn.close();
localConn = null; localConn = null;
}*/ }*/
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -2699,11 +2699,11 @@ public class AdmCommon ...@@ -2699,11 +2699,11 @@ public class AdmCommon
} }
return logWriter; return logWriter;
} }
public LogWriterDatabase gbfErrWrite(String asPrdCode, String asEmpCode, String asType, String asErrCode, String asSeverity,int Num,LogWriterDatabase logWriter,Connection logConn) throws ITMException public LogWriterDatabase gbfErrWrite(String asPrdCode, String asEmpCode, String asType, String asErrCode, String asSeverity,int Num,LogWriterDatabase logWriter,Connection logConn) throws ITMException
{ {
System.out.println("Inside admCommon gbfErrWrite method with 6 parameters...."); System.out.println("Inside admCommon gbfErrWrite method with 6 parameters....");
try try
{ {
logWriter.setTotalRows(logWriter.getTotalRows() + 1); logWriter.setTotalRows(logWriter.getTotalRows() + 1);
...@@ -2731,7 +2731,7 @@ public class AdmCommon ...@@ -2731,7 +2731,7 @@ public class AdmCommon
} }
return logWriter; return logWriter;
} }
public LogWriterDatabase gfLogWriter(LogWriterDatabase logWriter1,Connection logConn) throws ITMException, IOException public LogWriterDatabase gfLogWriter(LogWriterDatabase logWriter1,Connection logConn) throws ITMException, IOException
{ {
System.out.println("Inside admCommon gfLogWriter method...."); System.out.println("Inside admCommon gfLogWriter method....");
...@@ -2750,7 +2750,7 @@ public class AdmCommon ...@@ -2750,7 +2750,7 @@ public class AdmCommon
lsActivity = logWriter1.getActivity(); lsActivity = logWriter1.getActivity();
lsErrorCode = logWriter1.getErrorCode(); lsErrorCode = logWriter1.getErrorCode();
lsErrorCode1 = logWriter1.getErrorCode(); lsErrorCode1 = logWriter1.getErrorCode();
System.out.println("lsSeverity::: " + lsSeverity + " lsCurrentProcess::: " + lsCurrentProcess + " lsActivity:::: " + lsActivity + System.out.println("lsSeverity::: " + lsSeverity + " lsCurrentProcess::: " + lsCurrentProcess + " lsActivity:::: " + lsActivity +
" lsErrorCode:::" + lsErrorCode + " lsErrorCode1::: " + lsErrorCode1); " lsErrorCode:::" + lsErrorCode + " lsErrorCode1::: " + lsErrorCode1);
...@@ -2761,7 +2761,7 @@ public class AdmCommon ...@@ -2761,7 +2761,7 @@ public class AdmCommon
lsStr = lsStr + " " + logWriter1.getStatusDetail(); lsStr = lsStr + " " + logWriter1.getStatusDetail();
System.out.println("lsStr::: " + lsStr); System.out.println("lsStr::: " + lsStr);
if(lsErrorCode != null && lsErrorCode.trim().length() > 0) if(lsErrorCode != null && lsErrorCode.trim().length() > 0)
{ {
lsErrorCode1 = getToken(lsErrorCode1 , "~t"); lsErrorCode1 = getToken(lsErrorCode1 , "~t");
...@@ -2788,7 +2788,7 @@ public class AdmCommon ...@@ -2788,7 +2788,7 @@ public class AdmCommon
pstmt = null; pstmt = null;
} }
System.out.println("lsMsgStr::: " + lsMsgStr + " lsDescr::: " + lsDescr + " lsMsgType::: " + lsMsgType); System.out.println("lsMsgStr::: " + lsMsgStr + " lsDescr::: " + lsDescr + " lsMsgType::: " + lsMsgType);
if(lsMsgStr == null || lsMsgStr.trim().length() == 0) if(lsMsgStr == null || lsMsgStr.trim().length() == 0)
{ {
lsMsgStr = ""; lsMsgStr = "";
...@@ -2819,7 +2819,7 @@ public class AdmCommon ...@@ -2819,7 +2819,7 @@ public class AdmCommon
lsStr = lsStr + " " + lsMsg; lsStr = lsStr + " " + lsMsg;
} }
System.out.println("lsStr::: " + lsStr + " lsMsg::: " + lsMsg); System.out.println("lsStr::: " + lsStr + " lsMsg::: " + lsMsg);
if("E".equalsIgnoreCase(lsSeverity) || (lsMsgType != null && "E".equalsIgnoreCase(lsMsgType))) if("E".equalsIgnoreCase(lsSeverity) || (lsMsgType != null && "E".equalsIgnoreCase(lsMsgType)))
{ {
lsStr = "(ERROR$)-" + lsStr; lsStr = "(ERROR$)-" + lsStr;
...@@ -2828,7 +2828,7 @@ public class AdmCommon ...@@ -2828,7 +2828,7 @@ public class AdmCommon
{ {
lsStr = "(INFORMATION$)-" + lsStr; lsStr = "(INFORMATION$)-" + lsStr;
} }
if(lsStr != null && lsStr.trim().length() > 0) if(lsStr != null && lsStr.trim().length() > 0)
{ {
lsStr = lsStr.replace( '"' , ' '); lsStr = lsStr.replace( '"' , ' ');
...@@ -2836,7 +2836,7 @@ public class AdmCommon ...@@ -2836,7 +2836,7 @@ public class AdmCommon
System.out.println("lsStr got replaced::: " + lsStr); System.out.println("lsStr got replaced::: " + lsStr);
jobId = logWriter1.getJobID(); jobId = logWriter1.getJobID();
System.out.println("jobId:::: " + jobId); System.out.println("jobId:::: " + jobId);
if(jobId != null && jobId.trim().length() > 0) if(jobId != null && jobId.trim().length() > 0)
{ {
logWriter1.setStatusType(lsSeverity); logWriter1.setStatusType(lsSeverity);
...@@ -2891,7 +2891,7 @@ public class AdmCommon ...@@ -2891,7 +2891,7 @@ public class AdmCommon
String webServiceValue = callE12ExtService(url, query); String webServiceValue = callE12ExtService(url, query);
System.out.println("webServiceValue>>" + webServiceValue); System.out.println("webServiceValue>>" + webServiceValue);
//this need to be done //this need to be done
/* /*
lsKey = string(now() , "hhmmssfff"); lsKey = string(now() , "hhmmssfff");
...@@ -2906,7 +2906,7 @@ public class AdmCommon ...@@ -2906,7 +2906,7 @@ public class AdmCommon
ls_temp_data = astr_log_writer.inet_ret.is_return*/ ls_temp_data = astr_log_writer.inet_ret.is_return*/
} }
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -2921,7 +2921,7 @@ public class AdmCommon ...@@ -2921,7 +2921,7 @@ public class AdmCommon
{ {
output.close(); output.close();
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
...@@ -2942,7 +2942,7 @@ public class AdmCommon ...@@ -2942,7 +2942,7 @@ public class AdmCommon
return logWriter1; return logWriter1;
} }
public String gfUpdBackgroundPrcStatus(LogWriterDatabase LogWriter2,Connection logConn) throws ITMException, RemoteException public String gfUpdBackgroundPrcStatus(LogWriterDatabase LogWriter2,Connection logConn) throws ITMException, RemoteException
{ {
System.out.println("Inside admCommon gfUpdBackgroundPrcStatus method...."); System.out.println("Inside admCommon gfUpdBackgroundPrcStatus method....");
...@@ -2955,8 +2955,8 @@ public class AdmCommon ...@@ -2955,8 +2955,8 @@ public class AdmCommon
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
String sql = ""; String sql = "";
int cnt = 0; int cnt = 0;
try try
{ {
processID = LogWriter2.getProcessId().trim().toUpperCase(); processID = LogWriter2.getProcessId().trim().toUpperCase();
...@@ -2971,14 +2971,14 @@ public class AdmCommon ...@@ -2971,14 +2971,14 @@ public class AdmCommon
{ {
lsStatusDet = "[" + processID + "] " + statusDetail; lsStatusDet = "[" + processID + "] " + statusDetail;
} }
if(lsStatusDet.length() > 1024) if(lsStatusDet.length() > 1024)
{ {
lsStatusDet = utilMethod.left(lsStatusDet,1024); lsStatusDet = utilMethod.left(lsStatusDet,1024);
} }
System.out.println("lsStatusDet:::: " + lsStatusDet); System.out.println("lsStatusDet:::: " + lsStatusDet);
// Modified by Azhar to print sysdate with time in background_status table field STATUS_TIME on 29-03-2019 [Start] // Modified by Azhar to print sysdate with time in background_status table field STATUS_TIME on 29-03-2019 [Start]
Timestamp timestamp = null; Timestamp timestamp = null;
timestamp = new Timestamp(System.currentTimeMillis()); timestamp = new Timestamp(System.currentTimeMillis());
...@@ -2988,17 +2988,17 @@ public class AdmCommon ...@@ -2988,17 +2988,17 @@ public class AdmCommon
val = genericUtility.getValidDateTimeString(val, genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat()); val = genericUtility.getValidDateTimeString(val, genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat());
System.out.println("val--["+val+"]"); System.out.println("val--["+val+"]");
ldtCurrent = Timestamp.valueOf(val); ldtCurrent = Timestamp.valueOf(val);
// Modified by Azhar to print sysdate with time in background_status table field STATUS_TIME on 29-03-2019 [End] // Modified by Azhar to print sysdate with time in background_status table field STATUS_TIME on 29-03-2019 [End]
//LocalDateTime now = LocalDateTime.now(); //LocalDateTime now = LocalDateTime.now();
//todayDate = sdf.format(sdf); //todayDate = sdf.format(sdf);
//ldtCurrent= utilMethod.dateTime(utilMethod.todaySqlDate(),utilMethod.now()); //ldtCurrent= utilMethod.dateTime(utilMethod.todaySqlDate(),utilMethod.now());
//System.out.println("todayDate==>" + todayDate); //System.out.println("todayDate==>" + todayDate);
//ldtCurrent = Timestamp.valueOf(genericUtility.getValidDateString(todayDate, //ldtCurrent = Timestamp.valueOf(genericUtility.getValidDateString(todayDate,
//genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat())); //genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat()));
System.out.println("ldtCurrent==>" + ldtCurrent); System.out.println("ldtCurrent==>" + ldtCurrent);
sql = "insert into background_status(job_id , obj_name , line_no , status_det , status_time, status_type)" + sql = "insert into background_status(job_id , obj_name , line_no , status_det , status_time, status_type)" +
"values (? , ? , ? , ? , ?, ? )"; "values (? , ? , ? , ? , ?, ? )";
pstmt = logConn.prepareStatement(sql); pstmt = logConn.prepareStatement(sql);
...@@ -3015,9 +3015,9 @@ public class AdmCommon ...@@ -3015,9 +3015,9 @@ public class AdmCommon
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
userId = LogWriter2.getUserId(); userId = LogWriter2.getUserId();
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -3043,7 +3043,7 @@ public class AdmCommon ...@@ -3043,7 +3043,7 @@ public class AdmCommon
} }
return lsReturn; return lsReturn;
} }
public String getUserInfoStr( String xtraParams )throws ITMException public String getUserInfoStr( String xtraParams )throws ITMException
{ {
StringBuffer userInfoStr = new StringBuffer(); StringBuffer userInfoStr = new StringBuffer();
...@@ -3053,7 +3053,7 @@ public class AdmCommon ...@@ -3053,7 +3053,7 @@ public class AdmCommon
String entityCode = ""; String entityCode = "";
String profileId = ""; String profileId = "";
String userType = ""; String userType = "";
String chgTerm = ""; String chgTerm = "";
try try
{ {
...@@ -3064,9 +3064,9 @@ public class AdmCommon ...@@ -3064,9 +3064,9 @@ public class AdmCommon
entityCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"entityCode"); entityCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"entityCode");
profileId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"profileId"); profileId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"profileId");
userType = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userType"); userType = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userType");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm"); chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");
System.out.println("xtraParams is @@@@@ " + xtraParams); System.out.println("xtraParams is @@@@@ " + xtraParams);
userInfoStr.append("<UserInfo>"); userInfoStr.append("<UserInfo>");
...@@ -3076,7 +3076,7 @@ public class AdmCommon ...@@ -3076,7 +3076,7 @@ public class AdmCommon
userInfoStr.append("<entityCode>").append("<![CDATA["+entityCode+"]]>").append("</entityCode>\r\n"); userInfoStr.append("<entityCode>").append("<![CDATA["+entityCode+"]]>").append("</entityCode>\r\n");
userInfoStr.append("<profileId>").append("<![CDATA["+profileId+"]]>").append("</profileId>\r\n"); userInfoStr.append("<profileId>").append("<![CDATA["+profileId+"]]>").append("</profileId>\r\n");
userInfoStr.append("<userType>").append("<![CDATA["+userType+"]]>").append("</userType>\r\n"); userInfoStr.append("<userType>").append("<![CDATA["+userType+"]]>").append("</userType>\r\n");
userInfoStr.append("<remoteHost>").append("<![CDATA["+chgTerm+"]]>").append("</remoteHost>\r\n"); userInfoStr.append("<remoteHost>").append("<![CDATA["+chgTerm+"]]>").append("</remoteHost>\r\n");
userInfoStr.append("</UserInfo>"); userInfoStr.append("</UserInfo>");
} }
...@@ -3086,64 +3086,64 @@ public class AdmCommon ...@@ -3086,64 +3086,64 @@ public class AdmCommon
} }
return userInfoStr.toString(); return userInfoStr.toString();
} }
public int gfOpenFile (String asKeyValue, String asWriteMode, String asFileName) throws ITMException public int gfOpenFile (String asKeyValue, String asWriteMode, String asFileName) throws ITMException
{ {
String lsPath = "",lsOvWrt = "",filePath = "",isCurrentLine = ""; String lsPath = "",lsOvWrt = "",filePath = "",isCurrentLine = "";
StringBuffer xmlFileData = new StringBuffer(); StringBuffer xmlFileData = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods UtilMethod = new UtilMethods(); UtilMethods UtilMethod = new UtilMethods();
int li_ret = 0; int li_ret = 0;
try try
{ {
//default path will be root directory //default path will be root directory
filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war" + File.separator + "setting" + File.separator +"init.xml"; filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war" + File.separator + "setting" + File.separator +"init.xml";
System.out.println("Final File Path =" + filePath); System.out.println("Final File Path =" + filePath);
try try
{
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
{ {
System.out.println("isCurrentLine =" + isCurrentLine.trim());
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath)); if (isCurrentLine.trim().length() > 0)
while ((isCurrentLine = bufferedReader.readLine()) != null)
{ {
System.out.println("isCurrentLine =" + isCurrentLine.trim()); xmlFileData.append(isCurrentLine.trim());
if (isCurrentLine.trim().length() > 0)
{
xmlFileData.append(isCurrentLine.trim());
}
} }
}
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
} catch (IOException e)
{
e.printStackTrace();
} }
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim()); }
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
} catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
String xmlMetadata = xmlFileData.toString().replace("//", "").trim(); String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim(); xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata); Document domInitData = genericUtility.parseString(xmlMetadata);
lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData)); lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData));
lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData)); lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData));
System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt); System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt);
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyy_hhmmss"); SimpleDateFormat sdf = new SimpleDateFormat("ddMMyy_hhmmss");
String todayDateTime = sdf.format(cal.getTime()); String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime); System.out.println("todayDateTime::::: " + todayDateTime);
/* if(lsPath == null || lsPath.trim().length() == 0) /* if(lsPath == null || lsPath.trim().length() == 0)
{ {
lsPath = ""; lsPath = "";
} }
if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1)))) if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1))))
{ {
lsPath = lsPath + "\\"; lsPath = lsPath + "\\";
} }
//default will be overwrite //default will be overwrite
if("N".equalsIgnoreCase(lsOvWrt)) if("N".equalsIgnoreCase(lsOvWrt))
{ {
...@@ -3164,125 +3164,157 @@ public class AdmCommon ...@@ -3164,125 +3164,157 @@ public class AdmCommon
{ {
li_ret = FileOpen(asFileName, streammode!, Write!, LockWrite!,Replace!); need to change li_ret = FileOpen(asFileName, streammode!, Write!, LockWrite!,Replace!); need to change
}*/ }*/
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return li_ret; return li_ret;
} }
public String gfGetLogFileName(String asKeyValue, String xtraParams) throws ITMException
{
String lsPath = "", lsOvWrt = "N", asFileName = "", filePath = "", isCurrentLine = "", userid = "",chgTerm = "";
StringBuffer xmlFileData = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods UtilMethod = new UtilMethods();
try public String gfGetLogFileName(String asKeyValue, String xtraParams) throws ITMException
{ {
System.out.println("Inside gfGetLogFileName Method....!!!!!"); String lsPath = "", lsOvWrt = "N", asFileName = "", filePath = "", isCurrentLine = "", userid = "",chgTerm = "";
userid = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode")); StringBuffer xmlFileData = new StringBuffer();
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId")); E12GenericUtility genericUtility = new E12GenericUtility();
filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" UtilMethods UtilMethod = new UtilMethods();
+ File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war"
+ File.separator + "setting" + File.separator + "init.xml";
System.out.println("Final File Path =" + filePath);
try
{
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath)); try
while ((isCurrentLine = bufferedReader.readLine()) != null) {
{ System.out.println("Inside gfGetLogFileName Method....!!!!!");
System.out.println("isCurrentLine =" + isCurrentLine.trim()); userid = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
if (isCurrentLine.trim().length() > 0) chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
{ filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default"
xmlFileData.append(isCurrentLine.trim()); + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war"
} + File.separator + "setting" + File.separator + "init.xml";
} System.out.println("Final File Path =" + filePath);
} try
catch (FileNotFoundException e) {
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
}
catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
String xmlMetadata = xmlFileData.toString().replace("//", "").trim(); BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
xmlMetadata = xmlMetadata.replace('"', ' ').trim(); while ((isCurrentLine = bufferedReader.readLine()) != null)
Document domInitData = genericUtility.parseString(xmlMetadata); {
System.out.println("isCurrentLine =" + isCurrentLine.trim());
if (isCurrentLine.trim().length() > 0)
{
xmlFileData.append(isCurrentLine.trim());
}
}
}
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
}
catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData)); String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData)); xmlMetadata = xmlMetadata.replace('"', ' ').trim();
System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt); Document domInitData = genericUtility.parseString(xmlMetadata);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_hhmmss");
String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime);
if (lsPath == null || lsPath.trim().length() == 0) lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData));
{ lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData));
lsPath = ""; System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt);
} Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_hhmmss");
String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime);
/* if (lsPath == null || lsPath.trim().length() == 0)
* if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1)))) commented due to {
* file separator { lsPath = lsPath + "\\"; } lsPath = "";
*/ }
if ("N".equalsIgnoreCase(lsOvWrt)) /*
{ * if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1)))) commented due to
asFileName = lsPath + asKeyValue.toUpperCase() + "_" + userid.toUpperCase() + "_" * file separator { lsPath = lsPath + "\\"; }
+ chgTerm.toUpperCase() + "_" + todayDateTime; */
System.out.println("asFileName:::: " + asFileName);
}
else
{
asFileName = lsPath + asKeyValue.toUpperCase();
System.out.println("asFileName:::: " + asFileName);
}
} if ("N".equalsIgnoreCase(lsOvWrt))
catch (Exception e) {
{ asFileName = lsPath + asKeyValue.toUpperCase() + "_" + userid.toUpperCase() + "_"
e.printStackTrace(); + chgTerm.toUpperCase() + "_" + todayDateTime;
throw new ITMException(e); System.out.println("asFileName:::: " + asFileName);
} }
return asFileName; else
{
asFileName = lsPath + asKeyValue.toUpperCase();
System.out.println("asFileName:::: " + asFileName);
}
} }
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return asFileName;
}
public boolean gfJobTerminateRequested(String jobID, Connection logConn) throws ITMException
{
int cnt = 0;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
public boolean gfJobTerminateRequested(String jobID, Connection logConn) throws ITMException try
{ {
int cnt = 0; System.out.println("Inside gfJobTerminateRequested Method....!!!!!");
String sql = ""; System.out.println("jobID::::: " + jobID);
ResultSet rs = null; if (jobID == null || jobID.trim().length() == 0)
PreparedStatement pstmt = null; {
return false;
}
try sql = "select count(1) as count from background_job where job_id = ? and case when terminate_req is null then 'N' else terminate_req end = 'Y'";
pstmt = logConn.prepareStatement(sql);
pstmt.setString(1, jobID);
rs = pstmt.executeQuery();
if (rs.next())
{ {
System.out.println("Inside gfJobTerminateRequested Method....!!!!!"); cnt = rs.getInt("count");
System.out.println("jobID::::: " + jobID); System.out.println("count is:::: " + cnt);
if (jobID == null || jobID.trim().length() == 0) }
{
return false;
}
sql = "select count(1) as count from background_job where job_id = ? and case when terminate_req is null then 'N' else terminate_req end = 'Y'"; if (rs != null)
pstmt = logConn.prepareStatement(sql); {
pstmt.setString(1, jobID); rs.close();
rs = pstmt.executeQuery(); rs = null;
if (rs.next()) }
{
cnt = rs.getInt("count"); if (pstmt != null)
System.out.println("count is:::: " + cnt); {
} pstmt.close();
pstmt = null;
}
if (cnt > 0)
{
return true;
}
else
{
return false;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
...@@ -3294,16 +3326,6 @@ public class AdmCommon ...@@ -3294,16 +3326,6 @@ public class AdmCommon
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (cnt > 0)
{
return true;
}
else
{
return false;
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -3311,90 +3333,68 @@ public class AdmCommon ...@@ -3311,90 +3333,68 @@ public class AdmCommon
throw new ITMException(e); throw new ITMException(e);
} }
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
} }
public String callE12ExtService(String urlStr, String paramStr) throws ITMException { }
String output = "";
try
{
System.out.println("Inside callE12ExtService Method....!!!!");
URL url = new URL(urlStr + paramStr);
System.out.println("URL: " + url);
String urlTest = url.toString();
System.out.println("@S@urlTest[" + urlTest + "");
urlTest = urlTest.replaceAll(" ", "%20");
System.out.println("@S@ urlTest using %20[" + urlTest + "]");
url = new URL(urlTest);
System.out.println("@S@ url using %20[" + url + "]");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
System.out.println("RequestMethod- " + conn.getRequestMethod());
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("GET");
conn.setUseCaches(false);
conn.setRequestProperty("Accept", "application/json");
conn.connect();
/* public String callE12ExtService(String urlStr, String paramStr) throws ITMException {
* try { DataOutputStream wr = new DataOutputStream(conn.getOutputStream()); String output = "";
* wr.writeBytes( paramStr ); wr.flush(); } catch (Exception e) { try
* System.out.println( "Exception - "+ e.getMessage() ); e.printStackTrace(); } {
*/ System.out.println("Inside callE12ExtService Method....!!!!");
System.out.println("URL: " + url); URL url = new URL(urlStr + paramStr);
System.out.println("ResponseCode: " + conn.getResponseCode()); System.out.println("URL: " + url);
System.out.println("ResponseMessage: " + conn.getResponseMessage()); String urlTest = url.toString();
System.out.println("@S@urlTest[" + urlTest + "");
urlTest = urlTest.replaceAll(" ", "%20");
System.out.println("@S@ urlTest using %20[" + urlTest + "]");
url = new URL(urlTest);
System.out.println("@S@ url using %20[" + url + "]");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
System.out.println("RequestMethod- " + conn.getRequestMethod());
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("GET");
conn.setUseCaches(false);
conn.setRequestProperty("Accept", "application/json");
conn.connect();
if (conn.getResponseCode() != 200) /*
{ * try { DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
System.out.println("Failed : HTTP error code : " + conn.getResponseCode()); * wr.writeBytes( paramStr ); wr.flush(); } catch (Exception e) {
System.out.println("ErrorStream: " * System.out.println( "Exception - "+ e.getMessage() ); e.printStackTrace(); }
+ (new BufferedReader(new InputStreamReader(conn.getErrorStream()))).readLine()); */
} System.out.println("URL: " + url);
System.out.println("ResponseCode: " + conn.getResponseCode());
System.out.println("ResponseMessage: " + conn.getResponseMessage());
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); if (conn.getResponseCode() != 200)
while ((output = br.readLine()) != null) {
{ System.out.println("Failed : HTTP error code : " + conn.getResponseCode());
System.out.println(output); System.out.println("ErrorStream: "
} + (new BufferedReader(new InputStreamReader(conn.getErrorStream()))).readLine());
conn.disconnect(); }
System.out.println("Output: " + output);
} BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
catch (Exception e) while ((output = br.readLine()) != null)
{ {
e.printStackTrace(); System.out.println(output);
throw new ITMException(e);
} }
conn.disconnect();
System.out.println("Output: " + output);
return output; }
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} }
return output;
}
// Ended by Azhar LogWriter method--------------------------------- // Ended by Azhar LogWriter method---------------------------------
public String getToken(String source, String separator) public String getToken(String source, String separator)
{ {
...@@ -3424,49 +3424,49 @@ public class AdmCommon ...@@ -3424,49 +3424,49 @@ public class AdmCommon
return ret; return ret;
} }
public Timestamp gfLastDate(Timestamp mdate) throws ITMException public Timestamp gfLastDate(Timestamp mdate) throws ITMException
{ {
Timestamp retDate = null; Timestamp retDate = null;
java.util.Date nDate = null; java.util.Date nDate = null;
SimpleDateFormat sdf = null; SimpleDateFormat sdf = null;
UtilMethods utilMethod = new UtilMethods(); UtilMethods utilMethod = new UtilMethods();
try try
{ {
System.out.println("*************Inside gfLastDate Method*******************"); System.out.println("*************Inside gfLastDate Method*******************");
sdf = new SimpleDateFormat("dd/MM/yyyy"); sdf = new SimpleDateFormat("dd/MM/yyyy");
String formatDate = sdf.format(mdate); String formatDate = sdf.format(mdate);
System.out.println("formatDate:::[" + formatDate +"]"); System.out.println("formatDate:::[" + formatDate +"]");
if(mdate == null || ("01/01/1900".equalsIgnoreCase(formatDate))) if(mdate == null || ("01/01/1900".equalsIgnoreCase(formatDate)))
{ {
return mdate; return mdate;
} }
nDate = utilMethod.date(utilMethod.year(mdate), utilMethod.month(mdate), 01); nDate = utilMethod.date(utilMethod.year(mdate), utilMethod.month(mdate), 01);
//nDate = utilMethod.year(utilMethod.date(mdate)), utilMethod.month(mdate)), 01); //nDate = utilMethod.year(utilMethod.date(mdate)), utilMethod.month(mdate)), 01);
nDate = utilMethod.RelativeDate(nDate, 31); nDate = utilMethod.RelativeDate(nDate, 31);
System.out.println("nDate ::[" + nDate + "]" ); System.out.println("nDate ::[" + nDate + "]" );
do do
{ {
if(utilMethod.month(nDate) == utilMethod.month(mdate)) if(utilMethod.month(nDate) == utilMethod.month(mdate))
{ {
break; break;
} }
nDate = utilMethod.RelativeDate(nDate, -1); nDate = utilMethod.RelativeDate(nDate, -1);
System.out.println("nDate ::[" + nDate + "]" ); System.out.println("nDate ::[" + nDate + "]" );
} }
while(true); while(true);
retDate = new Timestamp(nDate.getTime()); retDate = new Timestamp(nDate.getTime());
System.out.println("retDate::[" + retDate + "]"); System.out.println("retDate::[" + retDate + "]");
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return retDate; return retDate;
} }
/*public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException /*public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{ {
double rndAmt = 0; double rndAmt = 0;
double lcMultiply = 1; double lcMultiply = 1;
...@@ -3541,112 +3541,112 @@ public class AdmCommon ...@@ -3541,112 +3541,112 @@ public class AdmCommon
return rndAmt; return rndAmt;
} }
//Added by Azhar K. on[08-07-2019][End] //Added by Azhar K. on[08-07-2019][End]
*/ */
//Modified by Azhar on [27-July-2019][To resolve the issue of job_id][Start] //Modified by Azhar on [27-July-2019][To resolve the issue of job_id][Start]
public HashMap gfGetHrBackgroundJobid(HashMap hrBackGrndJobId,Connection logConn) throws ITMException
{
String lsRetVal = "";
long llJobId = 0;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
UtilMethods utilMethod = new UtilMethods();
try public HashMap gfGetHrBackgroundJobid(HashMap hrBackGrndJobId,Connection logConn) throws ITMException
{ {
System.out.println("************ Inside gfGetHrBackgroundJobid Method ******************"); String lsRetVal = "";
long llJobId = 0;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
UtilMethods utilMethod = new UtilMethods();
sql = "select hrbackgroundjobseq.nextval as jobIdValue from dual "; try
pstmt = logConn.prepareStatement(sql); {
rs = pstmt.executeQuery(); System.out.println("************ Inside gfGetHrBackgroundJobid Method ******************");
if(rs.next()) sql = "select hrbackgroundjobseq.nextval as jobIdValue from dual ";
{ pstmt = logConn.prepareStatement(sql);
llJobId = rs.getLong("jobIdValue"); rs = pstmt.executeQuery();
}
else
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
lsRetVal = "ERR$DS000";
hrBackGrndJobId.put("ErrorCode", lsRetVal);
return hrBackGrndJobId;
}
if(rs != null) if(rs.next())
{ {
rs.close(); llJobId = rs.getLong("jobIdValue");
rs = null; }
} else
if(pstmt != null) {
{ if(rs != null)
pstmt.close(); {
pstmt = null; rs.close();
} rs = null;
//lsRetVal = "HMS" + right("000000000000000" + trim(string((llJobId))) , 12) }
lsRetVal = "HMS" + utilMethod.right("000000000000000" + String.valueOf(llJobId).trim(), 12); if(pstmt != null)
hrBackGrndJobId.put("jobId", lsRetVal); {
} pstmt.close();
catch (Exception e) pstmt = null;
{ }
e.printStackTrace(); lsRetVal = "ERR$DS000";
throw new ITMException(e); hrBackGrndJobId.put("ErrorCode", lsRetVal);
} return hrBackGrndJobId;
finally }
{
try if(rs != null)
{ {
if (rs != null) rs.close();
{ rs = null;
rs.close(); }
rs = null; if(pstmt != null)
} {
if (pstmt != null) pstmt.close();
{ pstmt = null;
pstmt.close(); }
pstmt = null; //lsRetVal = "HMS" + right("000000000000000" + trim(string((llJobId))) , 12)
} lsRetVal = "HMS" + utilMethod.right("000000000000000" + String.valueOf(llJobId).trim(), 12);
} hrBackGrndJobId.put("jobId", lsRetVal);
catch (Exception e1) }
{ catch (Exception e)
e1.printStackTrace(); {
throw new ITMException(e1); e.printStackTrace();
} throw new ITMException(e);
} }
return hrBackGrndJobId; finally
} {
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e1)
{
e1.printStackTrace();
throw new ITMException(e1);
}
}
return hrBackGrndJobId;
}
//Modified by Azhar on [27-July-2019][To resolve the issue of job_id][End] //Modified by Azhar on [27-July-2019][To resolve the issue of job_id][End]
//Added by sarita on setNodeValue method on 14 AUG 2019 [START] //Added by sarita on setNodeValue method on 14 AUG 2019 [START]
public static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception public 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);
System.out.println("tempNode is ["+tempNode+"]"); System.out.println("tempNode is ["+tempNode+"]");
if( tempNode != null ) if( tempNode != null )
{ {
if( tempNode.getFirstChild() == null ) if( tempNode.getFirstChild() == null )
{ {
CDATASection cDataSection = dom.createCDATASection( nodeVal ); CDATASection cDataSection = dom.createCDATASection( nodeVal );
tempNode.appendChild( cDataSection ); tempNode.appendChild( cDataSection );
System.out.println("tempNode is 1["+tempNode+"]"); System.out.println("tempNode is 1["+tempNode+"]");
} }
else else
{ {
tempNode.getFirstChild().setNodeValue(nodeVal); tempNode.getFirstChild().setNodeValue(nodeVal);
System.out.println("tempNode is 2["+tempNode+"]"); System.out.println("tempNode is 2["+tempNode+"]");
} }
} }
tempNode = null; tempNode = null;
}//End of Method setNodeValue }//End of Method setNodeValue
//Added by sarita on setNodeValue method on 14 AUG 2019 [END] //Added by sarita on setNodeValue method on 14 AUG 2019 [END]
//Added by Varsha V on 05-07-19 //Added by Varsha V on 05-07-19
...@@ -3691,9 +3691,9 @@ public class AdmCommon ...@@ -3691,9 +3691,9 @@ public class AdmCommon
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
int month = utilMethods.month(frDateTm); int month = utilMethods.month(frDateTm);
if(calcPropDays.get("calcprop") != null && calcPropDays.get("calcprop").toString().trim().length() > 0) if(calcPropDays.get("calcprop") != null && calcPropDays.get("calcprop").toString().trim().length() > 0)
{ {
calcProp = calcPropDays.get("calcprop").toString(); calcProp = calcPropDays.get("calcprop").toString();
...@@ -3731,7 +3731,7 @@ public class AdmCommon ...@@ -3731,7 +3731,7 @@ public class AdmCommon
errorCode = utilMethods.mid(woffInPropdays , 5); errorCode = utilMethods.mid(woffInPropdays , 5);
break; break;
} }
holidayInPropdays = checkNull(getAdmEnv(cPaysite, cCadre, cGrade, "HOLINPROPDAYS", frDateTm, conn)); holidayInPropdays = checkNull(getAdmEnv(cPaysite, cCadre, cGrade, "HOLINPROPDAYS", frDateTm, conn));
if(holidayInPropdays.equalsIgnoreCase("NULLFOUND")) if(holidayInPropdays.equalsIgnoreCase("NULLFOUND"))
{ {
...@@ -3747,9 +3747,9 @@ public class AdmCommon ...@@ -3747,9 +3747,9 @@ public class AdmCommon
{ {
woffInPropdays = "Y"; woffInPropdays = "Y";
} }
propDays = utilMethods.DaysAfter(frDateTm, toDateTm)+1; propDays = utilMethods.DaysAfter(frDateTm, toDateTm)+1;
if(woffInPropdays.equalsIgnoreCase("N")) if(woffInPropdays.equalsIgnoreCase("N"))
{ {
sql = "select hol_tblno from employee where emp_code = ?"; sql = "select hol_tblno from employee where emp_code = ?";
...@@ -3878,7 +3878,7 @@ public class AdmCommon ...@@ -3878,7 +3878,7 @@ public class AdmCommon
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
todayDateStr = sdf.format(new java.util.Date()); todayDateStr = sdf.format(new java.util.Date());
todatDateTm = Timestamp.valueOf(genericUtility.getValidDateString(todayDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); todatDateTm = Timestamp.valueOf(genericUtility.getValidDateString(todayDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(propAd != null && propAd.trim().length() > 0 && propAd.equalsIgnoreCase("NULLFOUND")) if(propAd != null && propAd.trim().length() > 0 && propAd.equalsIgnoreCase("NULLFOUND"))
{ {
count = 0; count = 0;
...@@ -3978,7 +3978,7 @@ public class AdmCommon ...@@ -3978,7 +3978,7 @@ public class AdmCommon
System.out.println("Error code in gfCalcPropDays : "+errorCode); System.out.println("Error code in gfCalcPropDays : "+errorCode);
return errorCode; return errorCode;
} }
public double gfGetProp(String periodCode, String empCode, String cadre, String grade, String paysite, String paytable, String setDefault, Connection conn) throws ITMException, SQLException public double gfGetProp(String periodCode, String empCode, String cadre, String grade, String paysite, String paytable, String setDefault, Connection conn) throws ITMException, SQLException
{ {
System.out.println("Calling gfGetProp(String periodCode, String empCode, String cadre, String grade, String paysite, String paytable, String setDefault, Connection conn) of AdmCommon"); System.out.println("Calling gfGetProp(String periodCode, String empCode, String cadre, String grade, String paysite, String paytable, String setDefault, Connection conn) of AdmCommon");
...@@ -3993,7 +3993,7 @@ public class AdmCommon ...@@ -3993,7 +3993,7 @@ public class AdmCommon
double amount = 0; double amount = 0;
try { try {
monthCode = Integer.parseInt(checkInt(utilMethods.mid(periodCode, 5, 2))); monthCode = Integer.parseInt(checkInt(utilMethods.mid(periodCode, 5, 2)));
if(setDefault == null) if(setDefault == null)
{ {
setDefault = "N"; setDefault = "N";
...@@ -4008,7 +4008,7 @@ public class AdmCommon ...@@ -4008,7 +4008,7 @@ public class AdmCommon
setDefault = "N"; setDefault = "N";
} }
// Piyush - 26/08/2019.End // Piyush - 26/08/2019.End
sql = "select fr_date, to_date from period where code = ?"; sql = "select fr_date, to_date from period where code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
...@@ -4087,7 +4087,7 @@ public class AdmCommon ...@@ -4087,7 +4087,7 @@ public class AdmCommon
} }
break; break;
} }
count = 0; count = 0;
sql = "select count(*) as count from grade_mthad where pay_table = ? " + sql = "select count(*) as count from grade_mthad where pay_table = ? " +
" and grade_code = ? and month_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? " + " and grade_code = ? and month_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? " +
...@@ -4145,7 +4145,7 @@ public class AdmCommon ...@@ -4145,7 +4145,7 @@ public class AdmCommon
} }
break; break;
} }
count = 0; count = 0;
sql = "select count(*) as count from cadre_mthad where pay_table = ? and cadre_code = ? and month_code = ? " + sql = "select count(*) as count from cadre_mthad where pay_table = ? and cadre_code = ? and month_code = ? " +
" and ad_code = ? and eff_date <= ? and exp_date >= ? and amount is not null and type = 'F'"; " and ad_code = ? and eff_date <= ? and exp_date >= ? and amount is not null and type = 'F'";
...@@ -4202,7 +4202,7 @@ public class AdmCommon ...@@ -4202,7 +4202,7 @@ public class AdmCommon
} }
break; break;
} }
count = 0; count = 0;
sql = "select count(*) as count from employee_ad where emp_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? " + sql = "select count(*) as count from employee_ad where emp_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? " +
" and confirmed = 'Y' and type='F' and amount is not null"; " and confirmed = 'Y' and type='F' and amount is not null";
...@@ -4255,7 +4255,7 @@ public class AdmCommon ...@@ -4255,7 +4255,7 @@ public class AdmCommon
} }
break; break;
} }
count = 0; count = 0;
sql = "select count(*) as count from grade_ad where pay_table = ? and grade_code = ? and ad_code = ? and eff_date <= ? " + sql = "select count(*) as count from grade_ad where pay_table = ? and grade_code = ? and ad_code = ? and eff_date <= ? " +
" and exp_date >= ? and amount is not null and type = 'F'"; " and exp_date >= ? and amount is not null and type = 'F'";
...@@ -4310,7 +4310,7 @@ public class AdmCommon ...@@ -4310,7 +4310,7 @@ public class AdmCommon
} }
break; break;
} }
count = 0; count = 0;
sql = "select count(*) as count from cadre_ad where pay_table = ? and cadre_code = ? and ad_code = ? and eff_date <= ? " + sql = "select count(*) as count from cadre_ad where pay_table = ? and cadre_code = ? and ad_code = ? and eff_date <= ? " +
" and exp_date >= ? and amount is not null and type = 'F'"; " and exp_date >= ? and amount is not null and type = 'F'";
...@@ -4445,7 +4445,7 @@ public class AdmCommon ...@@ -4445,7 +4445,7 @@ public class AdmCommon
return amount; return amount;
} }
public LinkedHashMap gfGetStatStanPayTable(String deptCode, String siteCode, String stanCodeHQ, String payTable, Connection conn) throws ITMException, SQLException public LinkedHashMap gfGetStatStanPayTable(String deptCode, String siteCode, String stanCodeHQ, String payTable, Connection conn) throws ITMException, SQLException
{ {
System.out.println("Calling gfGetStatStanPayTable(String deptCode, String siteCode, String stanCodeHQ, String payTable, Connection conn) of AdmCommon"); System.out.println("Calling gfGetStatStanPayTable(String deptCode, String siteCode, String stanCodeHQ, String payTable, Connection conn) of AdmCommon");
...@@ -4477,7 +4477,7 @@ public class AdmCommon ...@@ -4477,7 +4477,7 @@ public class AdmCommon
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
sql = "select pay_table from site_stan_paytbl where site_code = ? and state_code = ? and stan_code = ?"; sql = "select pay_table from site_stan_paytbl where site_code = ? and state_code = ? and stan_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -4520,7 +4520,7 @@ public class AdmCommon ...@@ -4520,7 +4520,7 @@ public class AdmCommon
} }
System.out.println("value of pay_table in site_stan_paytbl :: ["+lsPayTable+"]"); System.out.println("value of pay_table in site_stan_paytbl :: ["+lsPayTable+"]");
} }
} }
catch (Exception e) { catch (Exception e) {
retVal = -1; retVal = -1;
...@@ -4649,7 +4649,7 @@ public class AdmCommon ...@@ -4649,7 +4649,7 @@ public class AdmCommon
flag = "N"; flag = "N";
if(count == 0) if(count == 0)
{ {
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " + sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) "; "( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -4680,12 +4680,12 @@ public class AdmCommon ...@@ -4680,12 +4680,12 @@ public class AdmCommon
pstmt = null; pstmt = null;
} }
System.out.println("holDataAll map :: ["+holDataAll+"]"); System.out.println("holDataAll map :: ["+holDataAll+"]");
} }
else else
{ {
sql = "select hol_tblno__fr ,hol_tblno__to, eff_date from emp_employ_events where emp_code = ? " + sql = "select hol_tblno__fr ,hol_tblno__to, eff_date from emp_employ_events where emp_code = ? " +
" and trans_type = 'H' and confirmed = 'Y' order by eff_date asc "; " and trans_type = 'H' and confirmed = 'Y' order by eff_date asc ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery();
...@@ -4694,11 +4694,11 @@ public class AdmCommon ...@@ -4694,11 +4694,11 @@ public class AdmCommon
holTblNoFr = checkNull(resultSet.getString("hol_tblno__fr")); holTblNoFr = checkNull(resultSet.getString("hol_tblno__fr"));
holTblNoTo = checkNull(resultSet.getString("hol_tblno__to")); holTblNoTo = checkNull(resultSet.getString("hol_tblno__to"));
effDateTm = resultSet.getTimestamp("eff_date"); effDateTm = resultSet.getTimestamp("eff_date");
tempFr = frDateTm; tempFr = frDateTm;
do { do {
if(count == 1) if(count == 1)
{ {
if(effDateTm.after(frDateTm)) if(effDateTm.after(frDateTm))
...@@ -4710,8 +4710,8 @@ public class AdmCommon ...@@ -4710,8 +4710,8 @@ public class AdmCommon
{ {
flag = "Y"; flag = "Y";
tempTo = new Timestamp(utilMethods.RelativeDate(effDate, -1).getTime()); tempTo = new Timestamp(utilMethods.RelativeDate(effDate, -1).getTime());
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " + sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) "; "( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -4719,7 +4719,8 @@ public class AdmCommon ...@@ -4719,7 +4719,8 @@ public class AdmCommon
pstmt.setTimestamp(2, frDateTm); pstmt.setTimestamp(2, frDateTm);
pstmt.setTimestamp(3, toDateTm); pstmt.setTimestamp(3, toDateTm);
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery();
while(resultSet.next()) { while(resultSet.next())
{
holData = new HashMap(); holData = new HashMap();
holDate = resultSet.getTimestamp("hol_date"); holDate = resultSet.getTimestamp("hol_date");
holDateStr = sdf.format(holDate); holDateStr = sdf.format(holDate);
...@@ -4749,12 +4750,12 @@ public class AdmCommon ...@@ -4749,12 +4750,12 @@ public class AdmCommon
{ {
holDataAll.put(key, holDataAll1.get(key)); holDataAll.put(key, holDataAll1.get(key));
} }
} }
else else
{ {
tempTo = new Timestamp(utilMethods.RelativeDate(effDate, -1).getTime()); tempTo = new Timestamp(utilMethods.RelativeDate(effDate, -1).getTime());
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " + sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) "; "( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -4792,7 +4793,7 @@ public class AdmCommon ...@@ -4792,7 +4793,7 @@ public class AdmCommon
{ {
holDataAll.put(key, holDataAll1.get(key)); holDataAll.put(key, holDataAll1.get(key));
} }
} }
tempFr1 = effDateTm; tempFr1 = effDateTm;
tempTo1 = toDateTm; tempTo1 = toDateTm;
...@@ -4814,7 +4815,7 @@ public class AdmCommon ...@@ -4814,7 +4815,7 @@ public class AdmCommon
if(tempFrDate1.before(toDate) || tempFrDate1.equals(toDate)) if(tempFrDate1.before(toDate) || tempFrDate1.equals(toDate))
{ {
flag = "Y"; flag = "Y";
if(effDate.after(FrDate) || effDate.equals(FrDate)) if(effDate.after(FrDate) || effDate.equals(FrDate))
{ {
tempFr = tempFr1; tempFr = tempFr1;
...@@ -4835,7 +4836,7 @@ public class AdmCommon ...@@ -4835,7 +4836,7 @@ public class AdmCommon
{ {
holTblNo1 = holTblNoFr; holTblNo1 = holTblNoFr;
} }
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " + sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) "; "( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -4902,7 +4903,7 @@ public class AdmCommon ...@@ -4902,7 +4903,7 @@ public class AdmCommon
} }
} }
} }
} }
else else
{ {
...@@ -5003,7 +5004,7 @@ public class AdmCommon ...@@ -5003,7 +5004,7 @@ public class AdmCommon
} }
break; break;
}while(true); }while(true);
returnMap.put("holiday", holDataAll); returnMap.put("holiday", holDataAll);
returnMap.put("errorcode", errorCode); returnMap.put("errorcode", errorCode);
} }
...@@ -5056,48 +5057,141 @@ public class AdmCommon ...@@ -5056,48 +5057,141 @@ public class AdmCommon
{ {
pstmt = conn.prepareStatement(sqlstr); pstmt = conn.prepareStatement(sqlstr);
sqlInput = msqlinput.split(","); sqlInput = msqlinput.split(",");
if(sqlInput.length == 0) //Modified By Poonam B[19/11/2019][START]
{ //if(sqlInput.length == 0)
errorCode = "CONFERR"; if(sqlInput.length > 0)
}
else
{ {
/*errorCode = "CONFERR";
}*/
/*else
{*/
//Modified By Poonam B[19/11/2019][END]
for(int ctr = 0; ctr < sqlInput.length; ctr++) for(int ctr = 0; ctr < sqlInput.length; ctr++)
{ {
counter++; counter++;
input = sqlInput[ctr]; input = sqlInput[ctr];
if(input != null && input.trim().length() > 0) if(input != null && input.trim().length() > 0)
{ {
Object obj = dwobject.get(input); Object obj = dwobject.get(input);
inputType = getHashMapValType(obj); inputType = getHashMapValType(obj);
if(inputType.contains("String")) //Added By Poonam B[19/11/2019][START]
{ System.out.println("input::::"+input);
pstmt.setString(counter, obj.toString()); System.out.println("inputType::::"+inputType);
} System.out.println("msqlinput::::"+msqlinput);
else if(inputType.contains("Double")) System.out.println("sqlstr::::"+sqlstr);
{
pstmt.setDouble(counter, Double.parseDouble(checkInt(obj.toString()))); if(inputType == null || inputType.trim().length() == 0)
} {
else if(inputType.contains("Integer")) if((input != null &&input.trim().length() >= 3) && (input.startsWith(":S") || input.startsWith(":N") || input.startsWith(":D")))
{ {
pstmt.setInt(counter, Integer.parseInt(checkInt(obj.toString()))); if(input.startsWith(":S"))
} {
else if(inputType.contains("Timestamp") || inputType.contains("Date")) String value = input.substring(2);
{ try
localTm = Timestamp.valueOf(genericUtility.getValidDateString(obj.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0"); {
pstmt.setTimestamp(counter, localTm); int pos1 = Integer.parseInt(value)-1;
} String data = (String) envVarStr.get(pos1);
else pstmt.setString(counter, data);
{ }
errorCode = "CONFIGUREERR"; catch(Exception e)
} {
} e.printStackTrace();
} errorCode = "CONFIGUREERR\t"+e.getMessage();
rs = pstmt.executeQuery(); returnMap.put("errorcode", errorCode);
String resultType = rs.getMetaData().getColumnTypeName(1); returnMap.put("value", 0.0d);
if(resultType.equalsIgnoreCase("NUMBER")) }
{ }
if(rs.next()) else if(input.startsWith(":N"))
{
String value = input.substring(2);
try
{
int pos1 = Integer.parseInt(value)-1;
double data = (double) envVarNum.get(pos1);
pstmt.setDouble(counter, data);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else if(input.startsWith(":D"))
{
String dateStr = input.substring(2);
try
{
int pos1 = Integer.parseInt(dateStr)-1;
Timestamp date1 = (Timestamp) envVarDate.get(pos1);
Timestamp date = Timestamp.valueOf(genericUtility.getValidDateString(date1.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0");
pstmt.setTimestamp(counter,date);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else
{
errorCode = "CONFIGUREERR";
break;
}
}
else
{
pstmt.setString(counter, input);
}
}
else
{
//Added By Poonam B[18/11/2019][END]
if(inputType.contains("String"))
{
pstmt.setString(counter, obj.toString());
}
else if(inputType.contains("Double"))
{
pstmt.setDouble(counter, Double.parseDouble(checkInt(obj.toString())));
}
else if(inputType.contains("Integer"))
{
pstmt.setInt(counter, Integer.parseInt(checkInt(obj.toString())));
}
else if(inputType.contains("Timestamp") || inputType.contains("Date"))
{
localTm = Timestamp.valueOf(genericUtility.getValidDateString(obj.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0");
pstmt.setTimestamp(counter, localTm);
}
else
{
errorCode = "CONFIGUREERR";
break; //Added By Poonam B on[19/11/2019]
}
}
}
//Added By Poonam B on[19/11/2019][START]
if(errorCode != null && errorCode.trim().length() > 0)
{
break;
}
//Added By Poonam B on[19/11/2019][END]
}
}
//Modified By Poonam B on[19/11/2019][START]
if(errorCode == null || errorCode.trim().length() == 0)
{
rs = pstmt.executeQuery();
String resultType = rs.getMetaData().getColumnTypeName(1);
if(resultType.equalsIgnoreCase("NUMBER"))
{
if(rs.next())
{ {
outputSql = rs.getDouble(1); outputSql = rs.getDouble(1);
} }
...@@ -5117,13 +5211,29 @@ public class AdmCommon ...@@ -5117,13 +5211,29 @@ public class AdmCommon
pstmt = null; pstmt = null;
} }
} }
//Modified By Poonam B on[19/11/2019][END]
returnMap.put("errorcode", errorCode); returnMap.put("errorcode", errorCode);
returnMap.put("value", outputSql); returnMap.put("value", outputSql);
} }
//Added By Poonam B on[19/11/2019][START]
catch(SQLException e)
{
e.printStackTrace();
errorCode = "SQLERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
//Added By Poonam B on[19/11/2019][END]
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); //Modified By Poonam B[18/11/2019][START]
//throw new ITMException(e);
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
//Modified By Poonam B[18/11/2019][END]
} }
finally finally
{ {
...@@ -5139,10 +5249,17 @@ public class AdmCommon ...@@ -5139,10 +5249,17 @@ public class AdmCommon
} }
} }
System.out.println("returnMap in gfGetResSqlNvo:: "+returnMap); System.out.println("returnMap in gfGetResSqlNvo:: "+returnMap);
//Added By Poonam B on[19/11/2019][START][To fetch sql Error]
if(errorCode != null && errorCode.trim().length() > 0)
{
String errStr = (String) returnMap.get("errorcode");
errStr = errStr +"[SQL : " +sqlstr+ "]" + "[SQL INPUT : " +msqlinput+ "]";
returnMap.put("errorcode", errStr);
}
//Added By Poonam B on[19/11/2019][END][To fetch sql Error]
return returnMap; return returnMap;
} }
public String getHashMapValType(Object obj) throws ITMException public String getHashMapValType(Object obj) throws ITMException
{ {
Class cls = null; Class cls = null;
...@@ -5166,7 +5283,7 @@ public class AdmCommon ...@@ -5166,7 +5283,7 @@ public class AdmCommon
} }
return type; return type;
} }
public LinkedHashMap gfSetEnvVarNvo(String prdCode, String className, ArrayList envVarStr, ArrayList envVarDate, ArrayList envVarNum, Connection conn) throws ITMException, SQLException public LinkedHashMap gfSetEnvVarNvo(String prdCode, String className, ArrayList envVarStr, ArrayList envVarDate, ArrayList envVarNum, Connection conn) throws ITMException, SQLException
{ {
System.out.println("Calling gfSetEnvVarNvo(String prdCode, String className, ArrayList envVarStr, ArrayList envVarDate, ArrayList envVarNum, Connection conn) of AdmCommon"); System.out.println("Calling gfSetEnvVarNvo(String prdCode, String className, ArrayList envVarStr, ArrayList envVarDate, ArrayList envVarNum, Connection conn) of AdmCommon");
...@@ -5230,61 +5347,61 @@ public class AdmCommon ...@@ -5230,61 +5347,61 @@ public class AdmCommon
return returnMap; return returnMap;
} }
//Ended by Varsha V on 17-07-19 //Ended by Varsha V on 17-07-19
//Added by Jaffar for interest calculation [Start] //Added by Jaffar for interest calculation [Start]
public double gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) throws ITMException public double gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) throws ITMException
{ {
System.out.println("Calling gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) of AdmCommon"); System.out.println("Calling gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) of AdmCommon");
//Connection conn = null; //Connection conn = null;
String sql = ""; String sql = "";
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
String lsMethod = ""; String lsMethod = "";
double lcAmount = 0.0; double lcAmount = 0.0;
try
{
System.out.println("Inside gbfCalcInterest method of AdmCommon");
sql = "select cal_base from interestterm where int_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mintterm);
rs = pstmt.executeQuery();
if(rs.next())
{
lsMethod = checkNull(rs.getString("cal_base"));
System.out.println("sql = "+sql+" "+mintterm+" \nls_method is == "+lsMethod);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("R".equalsIgnoreCase(lsMethod) || "E".equalsIgnoreCase(lsMethod)) try
{ {
lcAmount = mbalAmt * ( mintPerc / 100 ) * ( mnoDays / 365 ); System.out.println("Inside gbfCalcInterest method of AdmCommon");
System.out.println("lc_amount = "+lcAmount); sql = "select cal_base from interestterm where int_term = ?";
} pstmt = conn.prepareStatement(sql);
else pstmt.setString(1, mintterm);
{ rs = pstmt.executeQuery();
return -1; if(rs.next())
} {
lsMethod = checkNull(rs.getString("cal_base"));
System.out.println("sql = "+sql+" "+mintterm+" \nls_method is == "+lsMethod);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} if("R".equalsIgnoreCase(lsMethod) || "E".equalsIgnoreCase(lsMethod))
catch (Exception e) {
{ lcAmount = mbalAmt * ( mintPerc / 100 ) * ( mnoDays / 365 );
System.out.println("Exception in InterestProcess gbf_emploan_int_proc "+ e.getMessage() + ":"); System.out.println("lc_amount = "+lcAmount);
e.printStackTrace(); }
throw new ITMException(e); else
{
return -1;
}
} }
finally catch (Exception e)
{ {
System.out.println("Exception in InterestProcess gbf_emploan_int_proc "+ e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try try
{ {
if (rs != null) if (rs != null)
...@@ -5303,206 +5420,206 @@ public class AdmCommon ...@@ -5303,206 +5420,206 @@ public class AdmCommon
d.printStackTrace(); d.printStackTrace();
throw new ITMException(d); throw new ITMException(d);
} }
} }
System.out.println("lcAmount ======= > "+lcAmount); System.out.println("lcAmount ======= > "+lcAmount);
return Math.round(lcAmount); return Math.round(lcAmount);
} }
//Added by Jaffar for interest calculation [End] //Added by Jaffar for interest calculation [End]
//Added by Jaffar for sorting Map[Start] //Added by Jaffar for sorting Map[Start]
public static Map sortMap(HashMap argMap) public static Map sortMap(HashMap argMap)
{ {
TreeMap treeMap = new TreeMap(); TreeMap treeMap = new TreeMap();
treeMap.putAll(argMap); treeMap.putAll(argMap);
Map retMap = new HashMap(); Map retMap = new HashMap();
retMap.putAll(treeMap); retMap.putAll(treeMap);
return retMap; return retMap;
} }
//Added by Jaffar [End] //Added by Jaffar [End]
public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{ {
System.out.println("Calling gfGetRndAmt(double unrAmt, String rndOff, double rndTo) of AdmCommon"); System.out.println("Calling gfGetRndAmt(double unrAmt, String rndOff, double rndTo) of AdmCommon");
double retVal = 0; double retVal = 0;
double lcMultiply = 1; double lcMultiply = 1;
UtilMethods utilMethods = new UtilMethods(); UtilMethods utilMethods = new UtilMethods();
try try
{ {
if(unrAmt < 0) if(unrAmt < 0)
{ {
lcMultiply = -1; lcMultiply = -1;
unrAmt = Math.abs(unrAmt); unrAmt = Math.abs(unrAmt);
} }
else if(unrAmt == 0) else if(unrAmt == 0)
{ {
return unrAmt; return unrAmt;
} }
else if("N".equalsIgnoreCase(rndOff)) else if("N".equalsIgnoreCase(rndOff))
{ {
return unrAmt; return unrAmt;
} }
else if(rndTo == 0) { else if(rndTo == 0) {
return unrAmt; return unrAmt;
} }
if("X".equalsIgnoreCase(rndOff)) if("X".equalsIgnoreCase(rndOff))
{ {
if(utilMethods.mod(unrAmt, rndTo) > 0) if(utilMethods.mod(unrAmt, rndTo) > 0)
{ {
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo; retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo;
} }
else else
{ {
retVal = unrAmt; retVal = unrAmt;
} }
} }
else if("P".equalsIgnoreCase(rndOff)) else if("P".equalsIgnoreCase(rndOff))
{ {
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo); retVal = unrAmt - utilMethods.mod(unrAmt, rndTo);
} }
else if("R".equalsIgnoreCase(rndOff)) else if("R".equalsIgnoreCase(rndOff))
{ {
if(utilMethods.mod(unrAmt, rndTo) < rndTo/2) if(utilMethods.mod(unrAmt, rndTo) < rndTo/2)
{ {
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo); retVal = unrAmt - utilMethods.mod(unrAmt, rndTo);
} }
else else
{ {
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo; retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo;
} }
} }
else else
{ {
retVal = unrAmt; retVal = unrAmt;
} }
retVal = retVal * lcMultiply; retVal = retVal * lcMultiply;
} }
catch(Exception e) catch(Exception e)
{ {
throw new ITMException(e); throw new ITMException(e);
} }
System.out.println("retVal in gfGetRndAmt:: "+retVal); System.out.println("retVal in gfGetRndAmt:: "+retVal);
return retVal; return retVal;
} }
public double gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) throws SQLException, ITMException public double gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) throws SQLException, ITMException
{ {
System.out.println("Calling gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) of AdmCommon"); System.out.println("Calling gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) of AdmCommon");
String sql = ""; String sql = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
double mminbamt = 0d; double mminbamt = 0d;
double mmaxbamt = 0d; double mmaxbamt = 0d;
double mamount = 0d; double mamount = 0d;
double mminamt = 0d; double mminamt = 0d;
double mmaxamt = 0d; double mmaxamt = 0d;
String type = ""; String type = "";
double retval = 0; double retval = 0;
double applyamt = 0d; double applyamt = 0d;
try try
{ {
sql = "select min_base_amt, max_base_amt,amount,type,min_amt,max_amt from ad_slabs where ad_code = ? and eff_date <= ? " + sql = "select min_base_amt, max_base_amt,amount,type,min_amt,max_amt from ad_slabs where ad_code = ? and eff_date <= ? " +
"and exp_date >= ? order by slab_no"; "and exp_date >= ? order by slab_no";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adcode); pstmt.setString(1, adcode);
pstmt.setTimestamp(2, mdate); pstmt.setTimestamp(2, mdate);
pstmt.setTimestamp(3, mdate); pstmt.setTimestamp(3, mdate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
mminbamt = rs.getDouble("min_base_amt"); mminbamt = rs.getDouble("min_base_amt");
mmaxbamt = rs.getDouble("max_base_amt"); mmaxbamt = rs.getDouble("max_base_amt");
mamount = rs.getDouble("amount"); mamount = rs.getDouble("amount");
type = rs.getString("type"); type = rs.getString("type");
mminamt = rs.getDouble("min_amt"); mminamt = rs.getDouble("min_amt");
mmaxamt = rs.getDouble("max_amt"); mmaxamt = rs.getDouble("max_amt");
applyamt = baseamt; applyamt = baseamt;
do { do {
if(slabopt.equalsIgnoreCase("D")) if(slabopt.equalsIgnoreCase("D"))
{ {
if(slabamt >= mminbamt && slabamt <= mmaxbamt) if(slabamt >= mminbamt && slabamt <= mmaxbamt)
{ {
if("P".equalsIgnoreCase(type)) if("P".equalsIgnoreCase(type))
{ {
retval = applyamt * mamount / 100; retval = applyamt * mamount / 100;
} }
else else
{ {
retval = mamount; retval = mamount;
} }
if(mminamt > 0 && retval < mminamt) if(mminamt > 0 && retval < mminamt)
retval = mminamt; retval = mminamt;
if(mmaxamt > 0 && retval > mmaxamt) if(mmaxamt > 0 && retval > mmaxamt)
retval = mmaxamt; retval = mmaxamt;
break; break;
} }
} }
else else
{ {
if(mmaxbamt <= slabamt) if(mmaxbamt <= slabamt)
{ {
if("P".equalsIgnoreCase(type)) if("P".equalsIgnoreCase(type))
{ {
retval = retval + ((mmaxbamt - mminbamt+1) * mamount / 100); retval = retval + ((mmaxbamt - mminbamt+1) * mamount / 100);
} }
else else
{ {
retval = retval + mamount; retval = retval + mamount;
} }
applyamt = applyamt - (mmaxbamt - mminbamt + 1); applyamt = applyamt - (mmaxbamt - mminbamt + 1);
} }
else if(mminbamt <= slabamt) else if(mminbamt <= slabamt)
{ {
if("P".equalsIgnoreCase(type)) if("P".equalsIgnoreCase(type))
{ {
retval = retval + (applyamt * mamount / 100); retval = retval + (applyamt * mamount / 100);
} }
else else
{ {
retval = retval + mamount; retval = retval + mamount;
} }
break; break;
} }
else else
{ {
break; break;
} }
} }
}while(true); }while(true);
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{ {
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
System.out.println("retval in gfGetSlabAmt:: "+retval); System.out.println("retval in gfGetSlabAmt:: "+retval);
return retval; return retval;
} }
} }
...@@ -1113,6 +1113,15 @@ public class AllowDednSalComp ...@@ -1113,6 +1113,15 @@ public class AllowDednSalComp
retMap = null; retMap = null;
// Modified by Piyush on 07/09/2019 [to create all ad code maps for select in formula].Start // Modified by Piyush on 07/09/2019 [to create all ad code maps for select in formula].Start
// retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), argEmpDataMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn); // retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), argEmpDataMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn);
//Added By Poonam B[18/11/2019][START]
System.out.println("strResFormula::::" +strResFormula);
System.out.println("SQL_INPUT::::" +adMap.get("SQL_INPUT").toString());
System.out.println("allInputMap::::" +allInputMap);
System.out.println("argStrVars::::" +argStrVars);
System.out.println("argStrDate::::" +argStrDate);
System.out.println("argDblVars::::" +argDblVars);
System.out.println("argConn:::::" +argConn);
//Added By Poonam B[18/11/2019][END]
retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), allInputMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn); retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), allInputMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn);
if(retMap.containsKey("errorcode")) if(retMap.containsKey("errorcode"))
{ {
......
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