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;
import org.w3c.dom.Node;
import ibase.system.config.ConnDriver;
import ibase.utility.BaseLogger;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.bean.adm.LogWriterDatabase;
......@@ -1566,6 +1567,197 @@ public class AdmCommon
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 Juhi on 04-05-2016 [A15JSUN007] [To display error message as xml string] [START]
/**
......@@ -5111,7 +5303,8 @@ public class AdmCommon
try
{
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);
}
......
......@@ -16,6 +16,7 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import javax.script.ScriptEngine;
......@@ -43,27 +44,42 @@ public class AllowDednSalComp
{
String varValue = admCommon.getEnv("999999", "ADFORMULA_PB2JAVA", conn);
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;
for(int i = 0;i < syntaxStrSize; i++)
for(int i = 0 ;i < syntaxStrSize; i++)
{
syntaxStr[i].replace("[", "");
syntaxStr[i].replace("]", "");
String[] syntaxKeyStr = ((String)syntaxStr[i]).split("{");
if(syntaxKeyStr.length != 2)
//syntaxStr[i].replace("[", "");
//syntaxStr[i].replace("]", "");
syntaxStr[i] = syntaxStr[i].replace("[", "");
syntaxStr[i] = syntaxStr[i].replace("]", "");
String[] syntaxKeyStr = ((String)syntaxStr[i]).split("\\{");
//if(syntaxKeyStr.length != 2)
if(syntaxKeyStr.length != 3)
{
continue;
}
syntaxKeyStr[0].replace("{", "");
/*syntaxKeyStr[0].replace("{", "");
syntaxKeyStr[0].replace("}", "");
syntaxKeyStr[1].replace("{", "");
syntaxKeyStr[1].replace("}", "");
pbSyntaxKeyList.add(syntaxKeyStr[0]);
pbToJavaSyntaxKeyList.add(syntaxKeyStr[1]);
syntaxKeyStr[1].replace("}", "");*/
syntaxKeyStr[1] = syntaxKeyStr[1].replace("{", "");
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();
}
// Modified By Poonam B[26/11/2019][END]
}
}
if(pbToJavaSyntaxKeySize > 0)
......
......@@ -807,12 +807,26 @@ public class AttendanceDailyIC extends ValidatorEJB implements AttendanceDailyIC
String attdDateStr = "";
String userId = "", loginSite = "";
String sql = "";
String loginEmpCode = "";
String objName = "";
String userLevel = "";
int userLevelInt = 0;
try
{
System.out.println("Inside Validation Method:::::::");
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
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();
if(objContext != null && objContext.trim().length() > 0)
{
......@@ -932,7 +946,11 @@ public class AttendanceDailyIC extends ValidatorEJB implements AttendanceDailyIC
break;
}
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"))
......
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