Commit 9c628f37 authored by pbhosale's avatar pbhosale

updated On [27/11/2019][Changes done as suggested by Piyush Sir]

AdmCommon.java
AllowDednSalComp.java
AttendanceDailyIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212774 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ac71c7d8
...@@ -36,6 +36,7 @@ import org.w3c.dom.Document; ...@@ -36,6 +36,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.BaseLogger;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.bean.adm.LogWriterDatabase; import ibase.webitm.bean.adm.LogWriterDatabase;
...@@ -556,7 +557,7 @@ public class AdmCommon ...@@ -556,7 +557,7 @@ public class AdmCommon
//Modified by Poonam B[19/11/2019][START][Changes done as suggested by piyush sir] //Modified by Poonam B[19/11/2019][START][Changes done as suggested by piyush sir]
//if(voucherNo != null && !(voucherNo.trim().equalsIgnoreCase("PAYROLL"))) //if(voucherNo != null && !(voucherNo.trim().equalsIgnoreCase("PAYROLL")))
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]
...@@ -565,7 +566,7 @@ public class AdmCommon ...@@ -565,7 +566,7 @@ public class AdmCommon
//Modified by Poonam B[25/11/2019][START][Changes done as suggested by piyush sir] //Modified by Poonam B[25/11/2019][START][Changes done as suggested by piyush sir]
//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"))
else else
//Modified by Poonam B[25/11/2019][END][Changes done as suggested by piyush sir] //Modified by Poonam B[25/11/2019][END][Changes done as suggested by piyush sir]
{ {
sqlStr = "SELECT COUNT(*) AS COUNT FROM PAYARR_TO_PROC WHERE EMP_CODE = '"+currEmpCode+"'" + sqlStr = "SELECT COUNT(*) AS COUNT FROM PAYARR_TO_PROC WHERE EMP_CODE = '"+currEmpCode+"'" +
" AND PRD_CODE = '"+currPeriod+"' AND STATUS = 'U' AND PROC_TYPE = '"+procType+"'" ; " AND PRD_CODE = '"+currPeriod+"' AND STATUS = 'U' AND PROC_TYPE = '"+procType+"'" ;
...@@ -1566,6 +1567,197 @@ public class AdmCommon ...@@ -1566,6 +1567,197 @@ public class AdmCommon
return errString; return errString;
} }
//Added by Poonam B[26/11/2019][START][method to check user level]
public String chkHRMSiteAccess(String empCode , Date asOfDate , String empSite , String loginSite , String userId, int userLevel, String loginEmpCode , String winName ,Connection conn)
{
String status = "",retString="",errString="";
String relieveDateStr = "";
String asOfDateStr = "";
String sql = "" ;
PreparedStatement pstmt = null;
ResultSet rs = null;
java.util.Date relieveDate = null;
E12GenericUtility genericUtility = new E12GenericUtility();
AdmCommon admCommon = new AdmCommon();
String siteAccCol = "";
String lsRowSecurity = "0";
String usrLevStr = "";
System.out.println("worksite is" + empSite);
System.out.println("login site is" + loginSite);
System.out.println("userId is:::" + userId);
System.out.println("userLevel is:::" + userLevel);
System.out.println("loginEmpCode is:::" + loginEmpCode);
System.out.println("winName is:::" + winName);
try
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
SimpleDateFormat dbsdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("******** Inside Admcommon chkHRMSiteAccess method *********");
System.out.println("userLevel from caller --->" +userLevel);
if(asOfDate != null)
{
asOfDateStr =sdf.format(asOfDate) ;
}
if(userLevel == 0)
{
sql = "select usr_lev from users where code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userId);
rs = pstmt.executeQuery();
if (rs.next())
{
usrLevStr = rs.getString("usr_lev");
System.out.println("usrLevStr--->" +usrLevStr);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(usrLevStr != null)
{
userLevel = Integer.parseInt(usrLevStr);
}
}
System.out.println("userLevel after change --->" +userLevel);
if(userLevel > 1)
{
sql = "select site_acc_col from transetup where tran_window = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, winName);
rs = pstmt.executeQuery();
if (rs.next())
{
siteAccCol = rs.getString("site_acc_col");
System.out.println("siteAccCol ::: "+siteAccCol);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(siteAccCol != null && siteAccCol.trim().length() > 0)
{
lsRowSecurity = "2";
}
else
{
lsRowSecurity = admCommon.getEnv("999999" , "HR_SITE_SEC_LEVEL",conn);
if(lsRowSecurity == null)
{
lsRowSecurity = "1";
}
else
{
lsRowSecurity = lsRowSecurity.trim();
if(!"0".equalsIgnoreCase(lsRowSecurity) && !"2".equalsIgnoreCase(lsRowSecurity))
{
lsRowSecurity = "1";
}
}
}
}
//sql = "SELECT RELIEVE_DATE , STATUS FROM EMPLOYEE WHERE EMP_CODE = ? ";
sql = "select RELIEVE_DATE , STATUS from employee where emp_code = ? " +
" and emp_site = (case when ? = '2' then ? " +
" when ? = '0' then ? else (select site_code from user_site where user_id = ? and site_code = employee.emp_site) end)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, lsRowSecurity);
pstmt.setString(3, loginSite);
pstmt.setString(4, lsRowSecurity);
//pstmt.setString(5, loginEmpCode);
pstmt.setString(5, empSite);
pstmt.setString(6, userId);
rs= pstmt.executeQuery();
if(rs.next())
{
relieveDateStr = rs.getString("RELIEVE_DATE");
status = rs.getString("STATUS");
}
else
{
errString ="VMEMP1";
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null ;
}
if (errString != null && errString.trim().length() > 0)
{
return errString;
}
System.out.println("Relieve Date in chkHRMSiteAccess is " + relieveDateStr);
System.out.println("Status in chkHRMSiteAccess is " + status );
if(relieveDateStr != null && relieveDateStr.trim().length() >0)
{
relieveDate = dbsdf.parse(relieveDateStr);
}
System.out.println("Relieve Date in chkHRMSiteAccess is " + relieveDate);
if((asOfDateStr == null || asOfDateStr.trim().length() == 0))
{
System.out.println("INSIDE IF LOOP OF chkHRMSiteAccess (asOfDate NULL) " + asOfDateStr);
errString ="VMEMP1";
return errString;
}
System.out.println("asOfDate in chkHRMSiteAccess is " + asOfDate);
System.out.println("asOfDateStr in chkHRMSiteAccess is " + asOfDateStr);
if(relieveDateStr != null && (asOfDate.after(relieveDate) || asOfDate.equals(relieveDate)) && status.trim().equalsIgnoreCase("S"))
{
System.out.println("INSIDE IF LOOP OF chkHRMSiteAccess (relieveDateStr) " + relieveDateStr);
errString = "VMEMP2";
return errString;
}
/*if((loginSite != null && loginSite.trim().length() > 0) && !empSite.trim().equalsIgnoreCase(loginSite.trim()))
{
System.out.println("INSIDE IF LOOP OF GBFEMP (loginsite) " + loginSite);
errString = "VMSITE10";
return errString;
}*/
}
catch(Exception e)
{
e.printStackTrace();
}
return errString;
}
//Added by Poonam B[26/11/2019][END][method to check user level]
//Modified by Sana on [25-11-2015][Request ID: A15JSUN006 - To add gbfEmp during migration of Employee Seperation in java][End] //Modified by Sana on [25-11-2015][Request ID: A15JSUN006 - To add gbfEmp during migration of Employee Seperation in java][End]
//Modified by Juhi on 04-05-2016 [A15JSUN007] [To display error message as xml string] [START] //Modified by Juhi on 04-05-2016 [A15JSUN007] [To display error message as xml string] [START]
/** /**
...@@ -2273,7 +2465,7 @@ public class AdmCommon ...@@ -2273,7 +2465,7 @@ public class AdmCommon
localConn.setAutoCommit(false); localConn.setAutoCommit(false);
connFlag = true; connFlag = true;
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);
...@@ -5111,7 +5303,8 @@ public class AdmCommon ...@@ -5111,7 +5303,8 @@ public class AdmCommon
try try
{ {
int pos1 = Integer.parseInt(value)-1; int pos1 = Integer.parseInt(value)-1;
double data = (double) envVarNum.get(pos1); //double data = (double) envVarNum.get(pos1);
double data = ((Double) envVarNum.get(pos1)).doubleValue();
pstmt.setDouble(counter, data); pstmt.setDouble(counter, data);
} }
...@@ -5625,22 +5818,22 @@ public class AdmCommon ...@@ -5625,22 +5818,22 @@ public class AdmCommon
System.out.println("retval in gfGetSlabAmt:: "+retval); System.out.println("retval in gfGetSlabAmt:: "+retval);
return retval; return retval;
} }
//Added By Vikas Lagad on 13-09-2019[To get timestamp value] Start //Added By Vikas Lagad on 13-09-2019[To get timestamp value] Start
public Timestamp getTimeStampValue(String dateStr) public Timestamp getTimeStampValue(String dateStr)
{ {
Timestamp timeStampValue = null; Timestamp timeStampValue = null;
try try
{ {
E12GenericUtility genericUtility = new E12GenericUtility();; E12GenericUtility genericUtility = new E12GenericUtility();;
timeStampValue = Timestamp.valueOf(genericUtility .getValidDateTimeString(dateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())); timeStampValue = Timestamp.valueOf(genericUtility .getValidDateTimeString(dateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
} }
catch(Exception e) catch(Exception e)
{ {
BaseLogger.log("0",null,null,"Exception in getTimeStampValue "+e); BaseLogger.log("0",null,null,"Exception in getTimeStampValue "+e);
return null; return null;
} }
return timeStampValue; return timeStampValue;
} }
//Added By Vikas Lagad on 13-09-2019[To get timestamp value] End //Added By Vikas Lagad on 13-09-2019[To get timestamp value] End
} }
...@@ -16,6 +16,7 @@ import java.sql.SQLException; ...@@ -16,6 +16,7 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
...@@ -43,27 +44,42 @@ public class AllowDednSalComp ...@@ -43,27 +44,42 @@ public class AllowDednSalComp
{ {
String varValue = admCommon.getEnv("999999", "ADFORMULA_PB2JAVA", conn); String varValue = admCommon.getEnv("999999", "ADFORMULA_PB2JAVA", conn);
pbToJavaSyntaxKeySize = -1; pbToJavaSyntaxKeySize = -1;
if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") > 0 && varValue.indexOf("]") > 0) // Modified By Poonam B[26/11/2019][START]
//if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") > 0 && varValue.indexOf("]") > 0)
if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") != -1 && varValue.indexOf("]") != -1)
{ {
String[] syntaxStr = varValue.split("["); //String[] syntaxStr = varValue.split("[");
String[] syntaxStr = varValue.split("\\[");
System.out.println("syntaxStr::"+Arrays.toString(syntaxStr));
int syntaxStrSize = syntaxStr.length; int syntaxStrSize = syntaxStr.length;
for(int i = 0;i < syntaxStrSize; i++) for(int i = 0 ;i < syntaxStrSize; i++)
{ {
syntaxStr[i].replace("[", ""); //syntaxStr[i].replace("[", "");
syntaxStr[i].replace("]", ""); //syntaxStr[i].replace("]", "");
String[] syntaxKeyStr = ((String)syntaxStr[i]).split("{"); syntaxStr[i] = syntaxStr[i].replace("[", "");
if(syntaxKeyStr.length != 2) syntaxStr[i] = syntaxStr[i].replace("]", "");
String[] syntaxKeyStr = ((String)syntaxStr[i]).split("\\{");
//if(syntaxKeyStr.length != 2)
if(syntaxKeyStr.length != 3)
{ {
continue; continue;
} }
syntaxKeyStr[0].replace("{", ""); /*syntaxKeyStr[0].replace("{", "");
syntaxKeyStr[0].replace("}", ""); syntaxKeyStr[0].replace("}", "");
syntaxKeyStr[1].replace("{", ""); syntaxKeyStr[1].replace("{", "");
syntaxKeyStr[1].replace("}", ""); syntaxKeyStr[1].replace("}", "");*/
pbSyntaxKeyList.add(syntaxKeyStr[0]); syntaxKeyStr[1] = syntaxKeyStr[1].replace("{", "");
pbToJavaSyntaxKeyList.add(syntaxKeyStr[1]); syntaxKeyStr[1] = syntaxKeyStr[1].replace("}", "");
syntaxKeyStr[2]= syntaxKeyStr[2].replace("{", "");
syntaxKeyStr[2] = syntaxKeyStr[2].replace("}", "");
/*pbSyntaxKeyList.add(syntaxKeyStr[0]);
pbToJavaSyntaxKeyList.add(syntaxKeyStr[1]);*/
pbSyntaxKeyList.add(syntaxKeyStr[1]);
pbToJavaSyntaxKeyList.add(syntaxKeyStr[2]);
pbToJavaSyntaxKeySize = pbSyntaxKeyList.size(); pbToJavaSyntaxKeySize = pbSyntaxKeyList.size();
} }
// Modified By Poonam B[26/11/2019][END]
} }
} }
if(pbToJavaSyntaxKeySize > 0) if(pbToJavaSyntaxKeySize > 0)
......
...@@ -807,12 +807,26 @@ public class AttendanceDailyIC extends ValidatorEJB implements AttendanceDailyIC ...@@ -807,12 +807,26 @@ public class AttendanceDailyIC extends ValidatorEJB implements AttendanceDailyIC
String attdDateStr = ""; String attdDateStr = "";
String userId = "", loginSite = ""; String userId = "", loginSite = "";
String sql = ""; String sql = "";
String loginEmpCode = "";
String objName = "";
String userLevel = "";
int userLevelInt = 0;
try try
{ {
System.out.println("Inside Validation Method:::::::"); System.out.println("Inside Validation Method:::::::");
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode")); userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode")); loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"));
//Added By Poonam B[26/11/2019][START]
loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
objName = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "objName"));
userLevel = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "usr_lev");
System.out.println("userLevel:::::" +userLevel);
System.out.println("xtraParams:::::" +xtraParams);
if(userLevel != null && userLevel.trim().length() > 0)
{
userLevelInt = Integer.parseInt(userLevel);
}
//Added By Poonam B[26/11/2019][ED]
conn = getConnection(); conn = getConnection();
if(objContext != null && objContext.trim().length() > 0) if(objContext != null && objContext.trim().length() > 0)
{ {
...@@ -932,7 +946,11 @@ public class AttendanceDailyIC extends ValidatorEJB implements AttendanceDailyIC ...@@ -932,7 +946,11 @@ public class AttendanceDailyIC extends ValidatorEJB implements AttendanceDailyIC
break; break;
} }
close(rs, pstmt); close(rs, pstmt);
errCode = checkNull(admCommon.gbfEmp(mVal, mattdDate, lsSite, loginSite , conn)); // Modified By Poonam B[26/11/2019][method changed][START]
//errCode = checkNull(admCommon.gbfEmp(mVal, mattdDate, lsSite, loginSite , conn));
errCode = checkNull(admCommon.chkHRMSiteAccess(mVal, mattdDate, lsSite, loginSite ,userId, userLevelInt , loginEmpCode, "w_"+objName, conn));
System.out.println("value return from chkHRMSiteAccess::::" +errCode);
// Modified By Poonam B[26/11/2019][method changed][END]
} }
} }
else if(childNodeName.equalsIgnoreCase("intime")) else if(childNodeName.equalsIgnoreCase("intime"))
......
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