Commit 740b61d9 authored by sdhaul's avatar sdhaul

Added ConsumerGoodsCRM Components (for CG-CRM Dashboard)

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@200649 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ef5c3488
This diff is collapsed.
package ibase.dashboard.sfa.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
@Local
public interface ConsumerGoodsCRMLocal extends ValidatorLocal
{
public JSONArray getWorkSummary(String dataSourceName, String fromDate, String toDate, String salePerson) throws RemoteException, ITMException;
public JSONArray getKPISummary(String dataSourceName, String fromDate, String toDate, String salePerson) throws RemoteException, ITMException;
public JSONArray getWorkDetails(String dataSourceName, String fromDate, String toDate, String salePerson) throws RemoteException, ITMException;
}
package ibase.dashboard.sfa.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
@Remote
public interface ConsumerGoodsCRMRemote extends ValidatorRemote
{
public JSONArray getWorkSummary(String dataSourceName, String fromDate, String toDate, String salePerson) throws RemoteException, ITMException;
public JSONArray getKPISummary(String dataSourceName, String fromDate, String toDate, String salePerson) throws RemoteException, ITMException;
public JSONArray getWorkDetails(String dataSourceName, String fromDate, String toDate, String salePerson) throws RemoteException, ITMException;
}
package ibase.dashboard.sfa.servlet;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import ibase.dashboard.sfa.ejb.ConsumerGoodsCRM;
import ibase.webitm.utility.ITMException;
public class ConsumerGoodsCRMServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ConsumerGoodsCRM consumerGoodsCRM = null;
String dataSourceName = "";
String loginUser ="";
String salePerson = "";
String fromDate = "";
String toDate = "";
JSONObject finalCRMData = new JSONObject();
try
{
response.setContentType("application/xml");
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) request.getSession().getAttribute("USER_INFO");
if(userInfo != null)
{
loginUser = userInfo.getLoginCode();
dataSourceName = userInfo.getTransDB();
}
fromDate = request.getParameter("fromDate");
toDate = request.getParameter("toDate");
salePerson = request.getParameter("aseName");
if(salePerson == null || salePerson.length()== 0)
{
salePerson = loginUser;
}
consumerGoodsCRM = new ConsumerGoodsCRM();
JSONArray workSummary = consumerGoodsCRM.getWorkSummary(dataSourceName, fromDate, toDate, salePerson);
JSONArray kpiSummary = consumerGoodsCRM.getKPISummary(dataSourceName, fromDate, toDate, salePerson);
JSONArray workDetails = consumerGoodsCRM.getWorkDetails(dataSourceName, fromDate, toDate, salePerson);
finalCRMData.put("WORK_SUMMARY", workSummary);
finalCRMData.put("KPI_SUMMARY", kpiSummary);
finalCRMData.put("WORK_DETAIL", workDetails);
OutputStream outputStream = response.getOutputStream();
outputStream.write(finalCRMData.toString().getBytes());
outputStream.flush();
outputStream.close();
}
catch (Exception e)
{
System.out.println("Exception : ConsumerGoodsCRMServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
finally
{
if(consumerGoodsCRM != null)
{
consumerGoodsCRM = 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