Commit 1b954a98 authored by pborate's avatar pborate

Updated changes in assessment and coaching dashboard for serdia

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191652 ce508802-f39f-4f6c-b175-0d175dae99d5
parent aa3d8487
......@@ -38,7 +38,7 @@ public class AssessMentEJB extends ValidatorEJB implements AssessMentEJBLocal,As
}
// Added by mrunalini sinkar For AssessMent report for serdia Client 25-06-2018(start)
@Override
public String getTreeStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException
public String getTreeStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException
{
JSONArray returnJsonArr = new JSONArray();
System.out.println("In AssessMentEJB loginCode["+loginCode+"] dataSourceName["+dataSourceName+"] fromDateStr["+fromDate+"] toDateStr["+toDate+"] teamArgs["+teamArgs+"] surveyId["+surveyId+"]");
......@@ -63,10 +63,21 @@ public class AssessMentEJB extends ValidatorEJB implements AssessMentEJBLocal,As
toDate = dateFormat.format(date);
System.out.println("toDateStr:::["+toDate+"]");
}
if(mConnection == null)
{
mConnection = connDriver.getConnectDB( dataSourceName );
}
//Added by PriyankaB for serdia Client 5-10-2018(start)
if(teamArgs.equalsIgnoreCase("All"))
{
System.out.println("Inside all arguments ");
String sqlstr=getPophelpData("SALES_PERS", mConnection);
teamArgs=getExecuteSql(sqlstr, mConnection);
System.out.println("team args "+teamArgs);
}
//Added by PriyankaB for serdia Client 5-10-2018(end)
String symbol="";
if("MSSQL".equalsIgnoreCase(CommonConstants.DB_NAME))
{
......@@ -245,11 +256,139 @@ public class AssessMentEJB extends ValidatorEJB implements AssessMentEJBLocal,As
System.out.println("returnJsonArr:::["+returnJsonArr+"]");
return returnJsonArr.toString();
}
//Added by PriyankaB for serdia Client 5-10-2018(start)
private String getPophelpData(String feildName,Connection mConnection) {
System.out.println("Inside get pophelp data "+feildName);
PreparedStatement pstmt=null;
String sqlStr="";
ResultSet rs=null;
try
{
String query="SELECT SQL_STR FROM POPHELP WHERE FIELD_NAME='"+feildName+"' AND MOD_NAME='W_DASHBOARD'" ;
System.out.println("query sql "+query);
pstmt = mConnection.prepareStatement(query);
rs = pstmt.executeQuery();
while(rs.next())
{
sqlStr =rs.getString("SQL_STR");
System.out.println("sql str "+sqlStr+":::::::::::: "+sqlStr.indexOf("?"));
}
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(sqlStr.indexOf("RecursiveCte") != -1) {
System.out.println("Inside contains :::::::::::::::"+sqlStr.toString());
sqlStr=sqlStr.replace("'?'","'1010'");
System.out.println("sql str ::::::::::"+sqlStr);
}
}
catch(Exception e)
{
System.out.println("Exception in pophelp.getEntityCount():["+e.getMessage()+"]");
e.printStackTrace();
}
finally
{
try
{
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch(SQLException se)
{
System.out.println("AssesmentEjb.getEntityCount.finally["+se.getMessage()+"]");
se.printStackTrace();
}
}
return sqlStr;
}
private String getExecuteSql(String sqlstr,Connection mConnection) {
String empArray="";
System.out.println("Inside get pophelp data "+sqlstr);
PreparedStatement pstmt=null;
String empCode="";
ResultSet rs=null;
try
{
String query=sqlstr;
pstmt = mConnection.prepareStatement(query);
rs = pstmt.executeQuery();
while(rs.next())
{
empCode =rs.getString("EMP_CODE");
empArray=empArray+","+empCode;
}
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.out.println("Exception in pophelp.getEntityCount():["+e.getMessage()+"]");
e.printStackTrace();
}
finally
{
try
{
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch(SQLException se)
{
System.out.println("AssesmentEjb.getExecuteSql.finally["+se.getMessage()+"]");
se.printStackTrace();
}
}
return empArray;
}
//Added by PriyankaB for serdia Client 5-10-2018(end)
// Added by mrunalini sinkar For AssessMent report for serdia Client 25-06-2018(end)
// Added by mrunalini sinkar to get graph AssessMent data for 25-06-2018(start)
@Override
public String getGraphStructureData(String loginCode, String dataSourceName, String fromDate, String toDate,
String teamArgs, String surveyId, String profileId) throws RemoteException, ITMException
String teamArgs, String surveyId, String profileId,String empCode) throws RemoteException, ITMException
{
JSONArray returnJsonArr = new JSONArray();
System.out.println("In AssessMentEJB loginCode["+loginCode+"] dataSourceName["+dataSourceName+"] fromDateStr["+fromDate+"] toDateStr["+toDate+"] teamArgs["+teamArgs+"] surveyId["+surveyId+"]");
......@@ -279,6 +418,15 @@ public class AssessMentEJB extends ValidatorEJB implements AssessMentEJBLocal,As
mConnection = connDriver.getConnectDB( dataSourceName );
}
if(teamArgs.equalsIgnoreCase("All"))
{
System.out.println("Inside all arguments ");
String sqlstr=getPophelpData("SALES_PERS", mConnection);
teamArgs=getExecuteSql(sqlstr, mConnection);
System.out.println("team args "+teamArgs);
}
fromDate = e12genericUtil.getValidDateString(fromDate, e12genericUtil.getApplDateFormat(), e12genericUtil.getDBDateFormat());
toDate = e12genericUtil.getValidDateString(toDate, e12genericUtil.getApplDateFormat(), e12genericUtil.getDBDateFormat());
System.out.println("fromDateStr["+fromDate+"] toDateStr["+toDate+"]");
......
......@@ -10,9 +10,9 @@ import javax.ejb.Local;
@Local
public interface AssessMentEJBLocal extends ValidatorLocal
{
public String getTreeStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException;
public String getTreeStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException;
public String getGraphStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException;
public String getGraphStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException;
}
......
......@@ -11,7 +11,7 @@ import javax.ejb.Remote;
public interface AssessMentEJBRemote extends ValidatorRemote
{
public String getTreeStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException;
public String getGraphStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException;
public String getTreeStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException;
public String getGraphStructureData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException;
}
......@@ -33,7 +33,7 @@ public class CoachingSummaryEJB extends ValidatorEJB implements CoachingSummaryE
}
//added by mrunalini sinkar for Esi KPI Report(start)
@Override
public String getCoachingData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException
public String getCoachingData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException
{
JSONArray returnJsonArr = new JSONArray();
System.out.println("In CoachingEJB loginCode["+loginCode+"] dataSourceName["+dataSourceName+"] fromDateStr["+fromDate+"] toDateStr["+toDate+"] teamArgs["+teamArgs+"] surveyId["+surveyId+"]");
......@@ -61,6 +61,16 @@ public class CoachingSummaryEJB extends ValidatorEJB implements CoachingSummaryE
{
mConnection = connDriver.getConnectDB( dataSourceName );
}
//Added by PriyankaB for serdia Client 5-10-2018(start)
if(teamArgs.equalsIgnoreCase("All"))
{
System.out.println("Inside all arguments ");
String sqlstr=getPophelpData("SALES_PERS", mConnection);
teamArgs=getExecuteSql(sqlstr, mConnection);
System.out.println("team args "+teamArgs);
}
//Added by PriyankaB for serdia Client 5-10-2018(end)
String regionalUsrImg="",AssessorusrImg="",AssessusrImg="";
fromDate = e12genericUtil.getValidDateString(fromDate, e12genericUtil.getApplDateFormat(), e12genericUtil.getDBDateFormat());
......@@ -290,6 +300,132 @@ public class CoachingSummaryEJB extends ValidatorEJB implements CoachingSummaryE
return returnJsonArr.toString();
}
//Added by PriyankaB for serdia Client 5-10-2018(start)
private String getPophelpData(String feildName,Connection mConnection) {
System.out.println("Inside get pophelp data "+feildName);
PreparedStatement pstmt=null;
String sqlStr="";
ResultSet rs=null;
try
{
String query="SELECT SQL_STR FROM POPHELP WHERE FIELD_NAME='"+feildName+"' AND MOD_NAME='W_DASHBOARD'";
System.out.println("query sql "+query);
pstmt = mConnection.prepareStatement(query);
rs = pstmt.executeQuery();
while(rs.next())
{
sqlStr =rs.getString("SQL_STR");
System.out.println("sql str "+sqlStr+":::::::::::: "+sqlStr.indexOf("?"));
}
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(sqlStr.indexOf("RecursiveCte") != -1) {
System.out.println("Inside contains :::::::::::::::"+sqlStr.toString());
sqlStr=sqlStr.replace("'?'","'1010'");
System.out.println("sql str ::::::::::"+sqlStr);
}
}
catch(Exception e)
{
System.out.println("Exception in pophelp.getEntityCount():["+e.getMessage()+"]");
e.printStackTrace();
}
finally
{
try
{
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch(SQLException se)
{
System.out.println("AssesmentEjb.getEntityCount.finally["+se.getMessage()+"]");
se.printStackTrace();
}
}
return sqlStr;
}
private String getExecuteSql(String sqlstr,Connection mConnection) {
String empArray="";
System.out.println("Inside get pophelp data "+sqlstr);
PreparedStatement pstmt=null;
String empCode="";
ResultSet rs=null;
try
{
String query=sqlstr;
pstmt = mConnection.prepareStatement(query);
rs = pstmt.executeQuery();
while(rs.next())
{
empCode =rs.getString("EMP_CODE"); //Need to set as dynamic
empArray=empArray+","+empCode;
}
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.out.println("Exception in pophelp.getEntityCount():["+e.getMessage()+"]");
e.printStackTrace();
}
finally
{
try
{
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch(SQLException se)
{
System.out.println("AssesmentEjb.getExecuteSql.finally["+se.getMessage()+"]");
se.printStackTrace();
}
}
return empArray;
}
//Added by PriyankaB for serdia Client 5-10-2018(end)
public static String getFormattedUserId( String userId )
{
StringBuffer userIdSql = new StringBuffer();
......
......@@ -10,7 +10,7 @@ import javax.ejb.Local;
@Local
public interface CoachingSummaryEJBLocal extends ValidatorLocal
{
public String getCoachingData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException;
public String getCoachingData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException;
}
......@@ -11,6 +11,6 @@ import javax.ejb.Remote;
public interface CoachingSummaryEJBRemote extends ValidatorRemote
{
public String getCoachingData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId) throws RemoteException,ITMException;
public String getCoachingData(String loginCode, String dataSourceName, String fromDate, String toDate, String teamArgs ,String surveyId,String profileId,String empCode) throws RemoteException,ITMException;
}
......@@ -44,6 +44,7 @@ public class AssessMentGraphServlet extends HttpServlet
String profileId = "";
String teamArgs = "";
String surveyId = "";
String empCode = "";
try
{
......@@ -56,6 +57,7 @@ public class AssessMentGraphServlet extends HttpServlet
if( userInfo != null && userInfo.getTransDB() != null )
{
dataSourceName = userInfo.getTransDB();
empCode = userInfo.getEmpCode();
}
fromDate = E12GenericUtility.checkNull(request.getParameter("from_date"));
toDate = E12GenericUtility.checkNull(request.getParameter("to_date"));
......@@ -66,7 +68,7 @@ public class AssessMentGraphServlet extends HttpServlet
//assessmentLocal = (AssessMentEJBLocal) context.lookup("ibase/AssessMentEJB/local");
//jsonObjData = (String) assessmentLocal.getGraphStructureData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId);
assessment = new AssessMentEJB();
jsonObjData = (String) assessment.getGraphStructureData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId);
jsonObjData = (String) assessment.getGraphStructureData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId,empCode);
outputStream = response.getOutputStream();
outputStream.write(jsonObjData.getBytes());
outputStream.flush();
......
......@@ -44,6 +44,7 @@ public class AssessMentTreeServlet extends HttpServlet
String profileId = "";
String teamArgs = "";
String surveyId = "";
String empCode = "";
try
{
......@@ -56,6 +57,7 @@ public class AssessMentTreeServlet extends HttpServlet
if( userInfo != null && userInfo.getTransDB() != null )
{
dataSourceName = userInfo.getTransDB();
empCode = userInfo.getEmpCode();
}
fromDate = E12GenericUtility.checkNull(request.getParameter("from_date"));
......@@ -67,7 +69,7 @@ public class AssessMentTreeServlet extends HttpServlet
//assessmentLocal = (AssessMentEJBLocal) context.lookup("ibase/AssessMentEJB/local");
//jsonObjData = (String) assessmentLocal.getTreeStructureData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId);
assessment = new AssessMentEJB();
jsonObjData = (String) assessment.getTreeStructureData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId);
jsonObjData = (String) assessment.getTreeStructureData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId,empCode);
outputStream = response.getOutputStream();
outputStream.write(jsonObjData.getBytes());
outputStream.flush();
......
......@@ -50,6 +50,7 @@ public class CoachingSummaryServlet extends HttpServlet
String profileId = "";
String teamArgs = "";
String surveyId = "";
String empCode = "";
try
{
......@@ -62,6 +63,7 @@ public class CoachingSummaryServlet extends HttpServlet
if( userInfo != null && userInfo.getTransDB() != null )
{
dataSourceName = userInfo.getTransDB();
empCode = userInfo.getEmpCode();
}
fromDate = E12GenericUtility.checkNull(request.getParameter("from_date"));
toDate = E12GenericUtility.checkNull(request.getParameter("to_date"));
......@@ -72,7 +74,7 @@ public class CoachingSummaryServlet extends HttpServlet
//coachingLocal = (CoachingSummaryEJBLocal) context.lookup("ibase/CoachingSummaryEJB/local");
//jsonObjData = (String) coachingLocal.getCoachingData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId);
coaching = new CoachingSummaryEJB();
jsonObjData = (String) coaching.getCoachingData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId);
jsonObjData = (String) coaching.getCoachingData(loginCode,dataSourceName,fromDate,toDate,teamArgs,surveyId,profileId,empCode);
outputStream = response.getOutputStream();
outputStream.write(jsonObjData.getBytes());
outputStream.flush();
......
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