Commit 1cea4103 authored by piyush's avatar piyush

Updated CRM Dashboard - Contact Communication Schedule - Components and Resource files


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@105544 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 437bafc7
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ibase</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
package ibase.dashboard.crm.ejb;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
@Stateless
public class ContactCommDashboard implements ContactCommDashboardLocal, ContactCommDashboardRemote
{
E12GenericUtility e12GenericUtility = new E12GenericUtility();
public ContactCommDashboard()
{
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getCommunicationSchedule(String dataSourceName) throws RemoteException, ITMException
{
StringBuffer xmlString = null;
JSONObject rowDataBasicJsn = new JSONObject();
JSONObject rowData = null;
String sql = "" ,sql1 = "" , sql2 = "";
ResultSet rs = null,rs1 = null,rs2 = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
int count = 0;
String commPlanId ="",plandate = "",salesPers ="",sconCode = "",commDate = "",contactType = "",
activityCode = "",planDetail = "",commId = "",resultFlag = "",spName = "";
Date planDate1= null,commDate1 = null;
String newPlanDate = "",newCommDate = "";
String firstName ="",lastName = "",emailAddr = "" ,mobileNo = "",sorgCode = "",sorgName = "",contactPerson = "";
try
{
xmlString = new StringBuffer("<table class='mtBackgroundWhite' border=''><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 4%;'>Sales Person</th>"
+"<th class='mtBackgroundWhite' colspan='2' style='width: 4%;'> Date </th>"
+"<th class='mtBackgroundWhite' colspan='' style='width: 4%;'> Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 4%;'>Orgnization</th>"
+"<th class='mtBackgroundWhite' style='width: 4%;'>Plan Detail</th>"
+"</tr>");
conn = connDriver.getConnectDB(dataSourceName);
sql = "SELECT (STR.FIRST_NAME||' '||STR.LAST_NAME) AS CONTACT_PERSON,"+
" STR.SORG_CODE, "+
" STR.EMAIL_ADDR, "+
" STR.MOBILE_NO, "+
" SP.SP_NAME, "+
" COM.COMM_PLAN_ID, "+
" COM.PLAN_DATE, "+
" COM.ACTIVITY_CODE, "+
" COM.COMM_ID, "+
" COM.RESULT_FLAG, "+
" COM.SALES_PERS, "+
" COM.SCON_CODE, "+
" TO_CHAR(COM.COMM_DATE,'DD-MM-YYYY')AS NEW_COMM_DATE, "+
" CASE COM.CONTACT_TYPE WHEN '1' THEN 'CALL' WHEN '2' THEN 'MAIL' WHEN '3' THEN 'MEETING' WHEN '4' "+
" THEN 'VIDEOCONFERENCING'WHEN '5' THEN 'OTHERS'END AS DESCR," +
" COM.PLAN_DETAIL," +
" COM.START_TIME," +
" COM.END_TIME "+
" FROM CONTACT_COMM_PLAN COM " +
" INNER JOIN STRG_CONTACT STR ON COM.SCON_CODE=STR.SCON_CODE " +
" INNER JOIN SALES_PERS SP ON COM.SALES_PERS=SP.SALES_PERS "+
" WHERE COMM_DATE >= SYSDATE ORDER BY SP.SP_NAME,NEW_COMM_DATE";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next())
{
spName = checkNull(rs.getString("sp_name"));
System.out.println("Sales Person Name ::: [ "+ spName + " ]");
contactPerson = checkNull(rs.getString("contact_person"));
System.out.println("Contact Person ::: [ "+contactPerson+" ]");
sorgCode = checkNull(rs.getString("sorg_code"));
emailAddr = checkNull(rs.getString("email_addr"));
mobileNo = checkNull(rs.getString("mobile_no"));
System.out.println("sorgCode ["+sorgCode+" ]:::emailAddr:::[ "+emailAddr+" ]:::mobileNo:::[ "+mobileNo+" ]");
commDate = checkNull(rs.getString("new_comm_date"));
System.out.println("commDate [ "+commDate+" ]");
sql1="";
sql1 = "select sorg_name from strg_org where sorg_code = ?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1,sorgCode);
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
sorgName = rs1.getString("sorg_name");
System.out.println("Organization name :::: ["+sorgName+"]");
}
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' rowspan='3' style='width: 4%;'>"+spName+"</td>");
xmlString.append("<td colspan='2' class= 'cardHtmlTableBodyAlignLft' style='width: 4%;'>"+commDate+"</td> ");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;'>"+contactPerson+"</td>");
xmlString.append("<td rowspan='3' class= 'cardHtmlTableBodyAlignLft' style='width: 4%;'>"+sorgName+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' rowspan='3'style='width: 4%;'>"+checkNull(rs.getString("plan_detail"))+"</td></tr>");
xmlString.append("<tr><td ROWSPAN='2' colspan='2' class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;vertical-align:top;'>From:"+checkNull(rs.getString("start_time"))+" To:"+checkNull(rs.getString("end_time"))+"</td> ");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;'>"+emailAddr+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;'><img src='../webitm/images/Standard/tele-1-1.ico' style='width:10px;height:10px;'>"+mobileNo+"</td></tr>");
count++;
}
System.out.println("xmlString ::::[ "+xmlString+" ]");
xmlString.append("</tbody></table>");
rowData =new JSONObject();
rowData.put("xmlString", xmlString.toString());
rowDataBasicJsn.put(0,rowData);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
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;
}
if (conn != null)
{
conn.close();
conn = null;
}
conn = null;
}
catch (Exception d)
{
d.printStackTrace();
System.out.println("Exception in : ContactCommDashboard : ContactCommDashboard :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataBasicJsn;
}
private String checkNull(String str)
{
if (str == null)
{
return "";
} else
{
return str.trim();
}
}
}
\ No newline at end of file
package ibase.dashboard.crm.ejb;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.json.simple.JSONObject;
public interface ContactCommDashboardLocal
{
public JSONObject getCommunicationSchedule(String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.crm.ejb;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
@Stateless
public interface ContactCommDashboardRemote
{
public JSONObject getCommunicationSchedule(String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.crm.servlet;
import ibase.dashboard.crm.ejb.ContactCommDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
public class ContactCommDashboardServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
String dataSourceName = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
ContactCommDashboardRemote contactCommDashboardRemote = null;
try
{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
context = new InitialContext(appConnectParm.getProperty());
contactCommDashboardRemote = (ContactCommDashboardRemote)context.lookup("ibase/ContactCommDashboard/remote");
JSONObject jsonObjData = (JSONObject) contactCommDashboardRemote.getCommunicationSchedule(dataSourceName);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for ContactCommDashboardServlet===" + jsonObjData);
}
catch (Exception e)
{
System.out.println("Exception : ContactCommDashboardServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
SET DEFINE OFF;
--- 09/05/2017.Start ---
--- Dashboard Name: Contact Communication schedule.Start ---
Insert into DASHBOARD_PAGES (USER_ID,PAGE_ID,TITLE,URI,IMAGE_URI,PAGE_TYPE,ENTITY_TYPE,ENTITY_CODE,COMP_TYPE,CHG_USER,CHG_TERM,CHG_DATE) values ('E11555',4,'CRM','/ibase/dwh/GwtDashboardPage.html?metadataname=contactcommdashboard',null,'T','U','E11555','DBR','Base','Base',SYSDATE);
Insert into DASHBOARD_COMP (USER_ID,PAGE_ID,COMP_ID,TITLE,URI,WIDTH,HEIGHT,ROW_NO,COLUMN_NO,COMP_TYPE,COMP_NAME,ENTITY_TYPE,ENTITY_CODE,DBR_RESOURCE) values ('E11555',4,1,'CRM','/ibase/dwh/GwtDashboardPage.html?metadataname=contactcommdashboard',350,0,0,1,null,null,'U','E11555','contactcommdashboard');
COMMIT;
--- Dashboard Name: Contact Communication schedule.End ---
--- 09/05/2017.End ---
----- 09/05/2017.Start ------
--- Dashboard Name: Contact Comm Dashboard.Start ---
Jar Deploy in following path:
/home/base1/wildfly-9.0.0.Final/server/default/deploy/ibase.ear/
metadata deploy in following path:
/home/base1/wildfly-9.0.0.Final/server/default/deploy/ibase.ear/ibase.war/dashboard/metadataxml/
Servlet entry :
/home/base1/wildfly-9.0.0.Final/server/default/deploy/ibase.ear/ibase.war/WEB-INF/web.xml
--- Dashboard Name: Contact Comm Dashboard.End ---
----- 09/05/2017.End ------
<?xml version='1.0'?>
<Root>
<page_title><![CDATA[CRM]]></page_title>
<datasource id ='1' driverName='DriverITM'><![CDATA[ContactCommDashboardServlet]]></datasource>
<view id='1' name='Order'>
<component datasource='1' id='1' type='CARD'>
<ComponentTitle><![CDATA[Schedule]]></ComponentTitle>
<component_icon><![CDATA[reportswht.png]]></component_icon>
<component_css><![CDATA[outerChartContainerPos1of1]]></component_css>
<height><![CDATA[300]]></height>
<width><![CDATA[100%]]></width>
<display_panel><![CDATA[]]></display_panel>
<layout> <html><![CDATA[<div>{xmlString}</div>]]>
</html></layout>
</component>
</view>
</Root>
<!-- 09/05/2017 - CRM Dashboard for Contact Communication Schedule.Start -->
<servlet>
<servlet-name>ContactCommDashboardServlet</servlet-name>
<servlet-class>ibase.dashboard.crm.servlet.ContactCommDashboardServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ContactCommDashboardServlet</servlet-name>
<url-pattern>/ContactCommDashboardServlet</url-pattern>
</servlet-mapping>
<!-- 09/05/2017 - CRM Dashboard for Contact Communication Schedule.End -->
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