Commit e2fe5a1c authored by pbhosale's avatar pbhosale

Updated on 17-01-2020 as suggested by Piyush Sir

ArrearsDeletePrc.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215404 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4ef64af9
...@@ -45,6 +45,8 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -45,6 +45,8 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
Connection logConn = null; Connection logConn = null;
hrLogWriter = new HRLogWriter(); hrLogWriter = new HRLogWriter();
//Added By Poonam B [18/10/2019][END] //Added By Poonam B [18/10/2019][END]
ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB(); // Piyush - 17/01/2020
try try
{ {
//Added By Poonam B [18/10/2019][START] //Added By Poonam B [18/10/2019][START]
...@@ -86,9 +88,34 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -86,9 +88,34 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
hrLogWriter.setProcessId("PayrollDelete"); hrLogWriter.setProcessId("PayrollDelete");
hrLogWriter.initializeHRLogWriter(objName, jobId, userId, chgTerm, "PayrollDelete", "PAYROLLDELETE", loginSite, logConn); hrLogWriter.initializeHRLogWriter(objName, jobId, userId, chgTerm, "PayrollDelete", "PAYROLLDELETE", loginSite, logConn);
} }
// Piyush - 17/01/2020 [Shifted in main process].Start
/*
retStr = processData(headerDom, detailDom, objContext, xtraParams,hrLogWriter,conn,logConn); retStr = processData(headerDom, detailDom, objContext, xtraParams,hrLogWriter,conn,logConn);
System.out.println("Process for ArrearsDeletePrc :::: " + retStr); System.out.println("Process for ArrearsDeletePrc :::: " + retStr);
//Added By Poonam B [18/10/2019][END][To generate Log] */
try
{
retStr = processData(headerDom, detailDom, objContext, xtraParams,hrLogWriter,jobId, conn,logConn);
}
catch (Exception e1)
{
retStr = "Exception in processData method [" + e1.getMessage() + "]";
hrLogWriter.gbfErrWrite("", "", type, retStr, "I", logConn);
retStr = itmdbAccessEJB.getErrorString("", "PROCSUCC", userId, "", conn);
}
String lsLogStr = "";
lsLogStr = "Total Employees: " + hrLogWriter.getRowsProcessed() + hrLogWriter.getRowsRejected() + " Processed: " + hrLogWriter.getRowsProcessed() + " Rejected: " + hrLogWriter.getRowsRejected();
hrLogWriter.gbfErrWrite("", "", type,lsLogStr, "I", logConn);
if("AR".equalsIgnoreCase(type))
{
hrLogWriter.gbfErrWrite("", "", type, " - Arrears Deletion Process Completed", "I", logConn);
}
else
{
hrLogWriter.gbfErrWrite("", "", type, " - Payroll Deletion Process Completed", "I", logConn);
}
// Piyush - 17/01/2020 [Shifted in main process].End
} }
catch(Exception e) catch(Exception e)
...@@ -157,7 +184,7 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -157,7 +184,7 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
}*/ }*/
//Commented By Poonam B [18/10/2019][END][Connection is generated in above process()so again no need to generate] //Commented By Poonam B [18/10/2019][END][Connection is generated in above process()so again no need to generate]
public String processData(Document headerDom , Document detailDom,String objContext ,String xtraParams ,HRLogWriter hrLogWriter, Connection con, Connection logConn) throws ITMException public String processData(Document headerDom , Document detailDom,String objContext ,String xtraParams ,HRLogWriter hrLogWriter, String jobId, Connection con, Connection logConn) throws ITMException
{ {
String prdCodeAcct = "", prdCodeFr = "",prdCodeTo="" ,empCodeFr="",empCodeTo =""; String prdCodeAcct = "", prdCodeFr = "",prdCodeTo="" ,empCodeFr="",empCodeTo ="";
String siteCodeFr = "", siteCodeTo = "", prcGrpFr = "", prcGrpTo = ""; String siteCodeFr = "", siteCodeTo = "", prcGrpFr = "", prcGrpTo = "";
...@@ -341,6 +368,21 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -341,6 +368,21 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
// Modified by Piyush on 17/01/2020 [Not to write in log].Start
errorString = ""; // Modified by Piyush on 17/01/2020 [Initialize Error String]
if (hrLogWriter.gfJobterminateRequested(jobId , con))
{
if("AR".equalsIgnoreCase(type))
{
hrLogWriter.gbfErrWrite("", "", type, "Arrears deletion terminated on user request", "I", logConn);
}
else
{
hrLogWriter.gbfErrWrite("", "", type, "Payroll deletion terminated on user request", "I", logConn);
}
break;
}
// Modified by Piyush on 17/01/2020 [Not to write in log].End
prdCode = rs.getString("PRD_CODE"); prdCode = rs.getString("PRD_CODE");
empCode = rs.getString("EMP_CODE"); empCode = rs.getString("EMP_CODE");
siteCodePay = rs.getString("SITE_CODE__PAY"); siteCodePay = rs.getString("SITE_CODE__PAY");
...@@ -372,10 +414,21 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -372,10 +414,21 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
} }
if("Y".equalsIgnoreCase(confirmed) || (voucherNo != null && voucherNo.trim().length() > 0)) if("Y".equalsIgnoreCase(confirmed) || (voucherNo != null && voucherNo.trim().length() > 0))
{ {
errorString = itmdbAccessEJB.getErrorString("", "VTPOST06", userId, "", con); //Already Posted //errorString = itmdbAccessEJB.getErrorString("", "VTPOST06", userId, "", con); //Already Posted // Modified by Piyush on 17/01/2020 [No need to assign error string and only write in log]
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
//hrLogWriter.gbfErrWrite("", "", type, errorString, "E", logConn); //hrLogWriter.gbfErrWrite("", "", type, errorString, "E", logConn);
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn); // Modified by Piyush on 17/01/2020 [Not to write in log].Start
// hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn);
con.rollback(); // Piyush - 17/01/2020 [Rollback]
if("AR".equalsIgnoreCase(type))
{
hrLogWriter.gbfErrWrite(prdCode, empCode, type, "VTPOST06~Arrears is already posted hence can not delete", "E", 2 , logConn);
}
else
{
hrLogWriter.gbfErrWrite(prdCode, empCode, type, "VTPOST06~tPayroll is already posted hence can not delete", "E", 2, logConn);
}
// Modified by Piyush on 17/01/2020 [Not to write in log].End
//return errString; //return errString;
continue; continue;
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
...@@ -431,9 +484,13 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -431,9 +484,13 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
errString = admCommon.payarrToProcUpdation(prdCode, prdCode, empCode, empCode, type, "w_arrears_deletion", chgTerm, "", 0.0, frDateStr, toDateStr, xtraParams, con); errString = admCommon.payarrToProcUpdation(prdCode, prdCode, empCode, empCode, type, "w_arrears_deletion", chgTerm, "", 0.0, frDateStr, toDateStr, xtraParams, con);
if (errString != null && errString.trim().length() > 0) if (errString != null && errString.trim().length() > 0)
{ {
errorString = itmdbAccessEJB.getErrorString("", errString, userId, "", con); // errorString = itmdbAccessEJB.getErrorString("", errString, userId, "", con); // Piyush - 17/01/2020 [No need to assign errors as to be continued for next employee]
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn); // Modified by Piyush on 17/01/2020 [Not to write in log].Start
// hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn);
con.rollback();
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString.trim() + "~t Error in payarr to proc updation", "E", 2, logConn);
// Modified by Piyush on 17/01/2020 [Not to write in log].End
//return errString; //return errString;
continue; continue;
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
...@@ -448,9 +505,13 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -448,9 +505,13 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
if (errString != null && errString.trim().length() > 0) if (errString != null && errString.trim().length() > 0)
{ {
errorString = itmdbAccessEJB.getErrorString("", errString, userId, "", con); // errorString = itmdbAccessEJB.getErrorString("", errString, userId, "", con); // Piyush - 17/01/2020 [No need to assign error string as to be continued for next employee]
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn); // Modified by Piyush on 17/01/2020 [Not to write in log].Start
con.rollback();
// hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn);
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString.trim() + "~tError in inserting trace record", "E", 2, logConn);
// Modified by Piyush on 17/01/2020 [Not to write in log].End
//return errString; //return errString;
continue; continue;
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
...@@ -458,6 +519,19 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -458,6 +519,19 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
} }
isSuccess = true; isSuccess = true;
System.out.println("payarrToProcUpdation() successfully executed" +errString); System.out.println("payarrToProcUpdation() successfully executed" +errString);
// Modified by Piyush on 17/01/2020 [Not to write in log].Start
con.commit(); // Piyush - 17/01/2020 [Rollback]
if("AR".equalsIgnoreCase(type))
{
hrLogWriter.gbfErrWrite(prdCode, empCode, type, "Arrears deleted successfully", "I", 1, logConn);
}
else
{
hrLogWriter.gbfErrWrite(prdCode, empCode, type, "Payroll deleted successfully", "I", 1, logConn);
}
// Modified by Piyush on 17/01/2020 [Not to write in log].End
} }
if(pstmt2!=null) if(pstmt2!=null)
...@@ -508,7 +582,7 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -508,7 +582,7 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
errorString = itmdbAccessEJB.getErrorString("", "PROCSUCC", userId, "", con); errorString = itmdbAccessEJB.getErrorString("", "PROCSUCC", userId, "", con);
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
//hrLogWriter.gbfErrWrite("", "", type, errorString, "I", logConn);//Added by Poonam B[18/10/2019] //hrLogWriter.gbfErrWrite("", "", type, errorString, "I", logConn);//Added by Poonam B[18/10/2019]
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "I", logConn); //hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "I", logConn);// Piyush - 17/01/2020 [No need to write log]
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
} }
else else
...@@ -518,16 +592,20 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -518,16 +592,20 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
errorString = itmdbAccessEJB.getErrorString("", "VPF16DSG01", userId, "", con); errorString = itmdbAccessEJB.getErrorString("", "VPF16DSG01", userId, "", con);
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
//hrLogWriter.gbfErrWrite("", "", type, errorString, "I", logConn);//Added by Poonam B[18/10/2019] //hrLogWriter.gbfErrWrite("", "", type, errorString, "I", logConn);//Added by Poonam B[18/10/2019]
hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn); //hrLogWriter.gbfErrWrite(prdCode, empCode, type, errorString, "E", logConn); // Piyush - 17/01/2020 [No need to write log]
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
} }
// Piyush - 17/01/2020 [Shifted in main process].Start
/*
//Added by Poonam B[18/10/2019][START] //Added by Poonam B[18/10/2019][START]
if("AR".equalsIgnoreCase(type)) if("AR".equalsIgnoreCase(type))
{ {
lsLogStr = " - Arrears Deletion Process Completed"; lsLogStr = " - Arrears Deletion Process Completed";
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
//hrLogWriter.gbfErrWrite("", "", type, lsLogStr, "I", logConn); //hrLogWriter.gbfErrWrite("", "", type, lsLogStr, "I", logConn);
hrLogWriter.gbfErrWrite(prdCode, empCode, type, lsLogStr, "I", logConn); // Piyush-17/01/2020
//hrLogWriter.gbfErrWrite(prdCode, empCode, type, lsLogStr, "I", logConn);
hrLogWriter.gbfErrWrite("", "", type, lsLogStr, "I", logConn);
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
} }
else else
...@@ -535,11 +613,15 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo ...@@ -535,11 +613,15 @@ public class ArrearsDeletePrc extends ProcessEJB implements ArrearsDeletePrcRemo
lsLogStr = " - Payroll Deletion Process Completed"; lsLogStr = " - Payroll Deletion Process Completed";
//Added By Poonam B [03/12/2019][START][To add prdCode and empCode] //Added By Poonam B [03/12/2019][START][To add prdCode and empCode]
//hrLogWriter.gbfErrWrite("", "", type, lsLogStr, "I", logConn); //hrLogWriter.gbfErrWrite("", "", type, lsLogStr, "I", logConn);
hrLogWriter.gbfErrWrite(prdCode, empCode, type, lsLogStr, "I", logConn); // Piyush-17/01/2020
// hrLogWriter.gbfErrWrite(prdCode, empCode, type, lsLogStr, "I", logConn);
hrLogWriter.gbfErrWrite("", "", type, lsLogStr, "I", logConn);
//Added By Poonam B [03/12/2019][END][To add prdCode and empCode] //Added By Poonam B [03/12/2019][END][To add prdCode and empCode]
} }
//Added by Poonam B[18/10/2019][END] //Added by Poonam B[18/10/2019][END]
*/
// Piyush - 17/01/2020 [Shifted in main process].End
} }
catch(Exception e) catch(Exception e)
{ {
......
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