Commit 28f85154 authored by reshamas's avatar reshamas

-Changes made to process attendance

AttdDailyPos.java
A17DSUN001.SQL.sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@197012 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8a2f2991
......@@ -10,6 +10,8 @@ import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.CreateRCPXML;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
......@@ -20,7 +22,10 @@ import java.util.GregorianCalendar;
import java.util.HashMap;
import org.w3c.dom.*;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
@javax.ejb.Stateless
public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, AttdDailyPosRemote
......@@ -46,7 +51,7 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
String prevOutTime = "";
String newOutTime = "";
String punchStr = "";
int attdUpdCnt = 0;
Timestamp attdDate = null ;
Timestamp currDate = null;
......@@ -64,6 +69,15 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
Document headerDom = null;
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][START]
String xmlStringDt = "";
Timestamp toDate = null;
String autolveapav = "";
String prdCode = "";
String procWindow = "";
int addOnDays = 0;
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][END]
try
{
......@@ -119,7 +133,63 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
pstmt.close();
pstmt = null;
}
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][START]
if (toUpdate)
{
autolveapav = checkNull(admCommon.getEnv("999999", "AUTOLVEAPRV",conn));
System.out.println("autolveapav---["+autolveapav+"]");
if("A".equalsIgnoreCase(autolveapav))
{
sql = "SELECT code,TO_DATE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,attdDate);
rs = pstmt.executeQuery();
if (rs.next())
{
prdCode = rs.getString("code");
toDate = rs.getTimestamp("TO_DATE");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
sql = "SELECT PROC_WINDOW , CASE WHEN ADDON_DAYS IS NULL THEN 0 ELSE ADDON_DAYS END AS ADDON_DAYS FROM ATTENDANCE_MON WHERE EMP_CODE = ? AND PRD_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,prdCode);
rs = pstmt.executeQuery();
if(rs.next())
{
procWindow = rs.getString("PROC_WINDOW");
addOnDays = rs.getInt("ADDON_DAYS");
}
if (procWindow == null || procWindow.trim().length() == 0)
{
procWindow = "N";
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
xmlStringDt = getTabSeparateString(empCode, prdCode, attdDate, addOnDays ,toDate, conn);
errString = confirmAttendanceProcess("attd_daily", xmlStringDt, xtraParams, "false", conn);
}
}
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][END]
}
catch(Exception e)
{
......@@ -184,5 +254,182 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
}
return inputVal.trim();
}
}
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][START]
private String getTabSeparateString(String empCode, String prdCode, Timestamp attdDate,int noOfDays ,Timestamp toDate, Connection conn) throws ITMException
{
String retString = "";
String sql = "";
StringBuffer retTabSepStrBuff = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String dateInDatabaseFormat = sdf.format(attdDate);
retTabSepStrBuff.append(empCode.trim()).append("\t"); // employee from
retTabSepStrBuff.append(empCode.trim()).append("\t"); // employee to
retTabSepStrBuff.append(prdCode).append("\t"); // period code
retTabSepStrBuff.append(prdCode).append("\t"); // period code to
retTabSepStrBuff.append(00).append("\t"); // site code from
retTabSepStrBuff.append("ZZ").append("\t"); // site code to
retTabSepStrBuff.append(dateInDatabaseFormat).append("\t"); // attd date
retTabSepStrBuff.append("PP").append("\t"); // Type
retTabSepStrBuff.append(noOfDays).append("\t"); // no_days
retTabSepStrBuff.append(00).append("\t"); // proc_group__from
retTabSepStrBuff.append("ZZ").append("\t"); // proc_group__to
retTabSepStrBuff.append(sdf.format(toDate)).append("\n"); // cutoff_date ( LAST DATE OF THE PERIOD)
retTabSepStrBuff.append("").append("\t"); // emp_name__fr
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // fr_prd_descr
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // emp_name__to
System.out.println(" final xml --> "+retTabSepStrBuff.toString());
}
catch(Exception e)
{
e.printStackTrace();
retString = e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
return retTabSepStrBuff.toString();
}
private String confirmAttendanceProcess(String businessObj, String XMLData,String xtraParams, String forcedFlag , Connection conn) throws ITMException
{
String methodName = "gbf_process";
String compName = "";
String retString = "";
String serviceCode = "";
String serviceURI = "";
String actionURI = "";
String sql = "";
PreparedStatement pStmt = null;
ResultSet rs = null;
System.out.println("confirmAttendanceProcess");
try
{
actionURI = "http://NvoServiceurl.org/" + methodName;
System.out.println("businessObj ---*------>"+businessObj+"---"+XMLData+"---"+xtraParams+"---"+forcedFlag);
if(conn != null)
{
conn.commit();
}
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'process' ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,businessObj);
rs = pStmt.executeQuery();
if ( rs.next() )
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
}
System.out.println("serviceCode = "+serviceCode+" compName "+compName);
if(rs != null)
{
rs.close();
rs = null;
}
if(pStmt != null)
{
pStmt.close();
pStmt = null;
}
sql = "SELECT SERVICE_URI,METHOD_NAME FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,serviceCode);
rs = pStmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
methodName=rs.getString("METHOD_NAME");
}
System.out.println("serviceURI = "+serviceURI+" compName = "+compName);
if(rs != null)
{
rs.close();
rs = null;
}
if(pStmt != null)
{
pStmt.close();
pStmt = null;
}
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tab_xml_data_1"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tab_xml_data__all"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName.trim());
aobj[1] = new String(XMLData);
aobj[2] = new String(XMLData);
aobj[3] = new String(xtraParams);
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println("Return string from NVO is:==>["+retString+"]");
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if (pStmt != null )
{
pStmt.close();
pStmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception inCalling confirmed");
e.printStackTrace();
try{
conn.rollback();
}catch (Exception s)
{
System.out.println("Unable to rollback");
s.printStackTrace();
}
throw new ITMException(e);
}
}
return retString;
}
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][End]
}
INSERT
INTO SYSTEM_EVENTS
(
OBJ_NAME,
EVENT_CODE,
EVENT_CONTEXT,
SERVICE_CODE,
METHOD_RULE,
OVERWRITE_CORE,
CHG_DATE,
CHG_USER,
CHG_TERM,
RESULT_HANDLE,
COMP_TYPE,
COMP_NAME,
COMM_FORMAT
)
VALUES
(
'attd_daily',
'process',
'1',
'pr_adm_default_1',
NULL,
'0',
sysdate,
'BASE',
'BASE',
'2',
'WSR',
'nvo_bo_attd_porc_norule',
NULL
);
\ No newline at end of file
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