Commit 1de45923 authored by sdhaul's avatar sdhaul

Updated to set filter params

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@188739 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5d025889
...@@ -12,6 +12,7 @@ import org.json.JSONException; ...@@ -12,6 +12,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean; import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
...@@ -128,8 +129,17 @@ public class CustomerInfoDao { ...@@ -128,8 +129,17 @@ public class CustomerInfoDao {
return customerInfoJson; return customerInfoJson;
} }
public JSONArray getCustomerCallHistory(String strgCode) throws ITMException { public JSONArray getCustomerCallHistory(String strgCode, String fromDate, String toDate) throws Exception {
System.out.println("Inside getCustomerCallHistory:::::::::::::::::: strgCode["+strgCode+"]"); System.out.println("Inside getCustomerCallHistory:::::::::::::::::: strgCode["+strgCode+"]");
E12GenericUtility genericUtility = new E12GenericUtility();
String sourceDateFormat=genericUtility.getApplDateFormat();
String targetDateFormat=genericUtility.getDBDateFormat();
fromDate=genericUtility.getValidDateString(fromDate, sourceDateFormat, targetDateFormat);
toDate=genericUtility.getValidDateString(toDate, sourceDateFormat, targetDateFormat);
System.out.println("Formatted fromDate :::::["+fromDate+"] toDate ["+toDate+"]");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
Connection conn =null; Connection conn =null;
...@@ -154,6 +164,7 @@ public class CustomerInfoDao { ...@@ -154,6 +164,7 @@ public class CustomerInfoDao {
" from strg_meet sm" + " from strg_meet sm" +
" where event_type <>'PR'" + " where event_type <>'PR'" +
" and strg_code = '"+strgCode+"'" + " and strg_code = '"+strgCode+"'" +
" and sm.event_date between TO_DATE('"+fromDate+"','YYYY-MM-dd') and TO_DATE('"+toDate+"','YYYY-MM-dd')" +
" order by sm.event_date desc"; " order by sm.event_date desc";
System.out.println("custInfoSql+++"+custCallHistSql); System.out.println("custInfoSql+++"+custCallHistSql);
...@@ -163,7 +174,6 @@ public class CustomerInfoDao { ...@@ -163,7 +174,6 @@ public class CustomerInfoDao {
while(rs.next()) while(rs.next())
{ {
JSONObject custCallHistJson = new JSONObject(); JSONObject custCallHistJson = new JSONObject();
System.out.println("DCR_ID in while :: ["+rs.getString("DCR_ID")+"]");
String dcrId = rs.getString("DCR_ID"); String dcrId = rs.getString("DCR_ID");
String salesPers = rs.getString("SALES_PERS"); String salesPers = rs.getString("SALES_PERS");
...@@ -374,6 +384,13 @@ public class CustomerInfoDao { ...@@ -374,6 +384,13 @@ public class CustomerInfoDao {
despDetJson.put("DISPLAY_AREA", dispArea); despDetJson.put("DISPLAY_AREA", dispArea);
despDetJson.put("DOC_ID", docId); despDetJson.put("DOC_ID", docId);
JSONObject docDetailJson = getDocumentDetail(docId);
String doc_id = docDetailJson.optString("DOC_ID");
String fileTypeAttch = docDetailJson.optString("FILE_TYPE_ATTACH");
String displayImgUrl = "ibase/WebITMDocumentHandlerServlet?ACTION=GET_DOCUMENT&DOC_ID="+doc_id+"&DOC_TYPE="+fileTypeAttch;
despDetJson.put("DISPLAY_IMAGE", displayImgUrl);
dispDetailArr.put(despDetJson); dispDetailArr.put(despDetJson);
} }
} }
...@@ -418,6 +435,78 @@ public class CustomerInfoDao { ...@@ -418,6 +435,78 @@ public class CustomerInfoDao {
return brandDetailArr; return brandDetailArr;
} }
public JSONObject getDocumentDetail( String refId ) throws ITMException
{
System.out.println("Inside getDocumentDetail:::::::::::::::::: refId["+refId+"]");
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn =null;
boolean isLocalConn =false;
JSONObject docDetailJson = new JSONObject();
try
{
if(conn == null)
{
conn = getConnection();
isLocalConn =true;
}
String docInfoSql="";
docInfoSql = "select doc_id, file_type_attach from DOC_TRANSACTION_LINK " +
"where ref_id = '"+refId+"'";
System.out.println("docInfoSql+++"+docInfoSql);
pstmt = conn.prepareStatement(docInfoSql);
rs = pstmt.executeQuery();
if(rs.next())
{
String doc_id = rs.getString("DOC_ID");
String file_type_attach = rs.getString("FILE_TYPE_ATTACH");
docDetailJson.put("DOC_ID", doc_id);
docDetailJson.put("FILE_TYPE_ATTACH", file_type_attach);
}
}
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(isLocalConn && conn != null && ! conn.isClosed() )
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
}
}
System.out.println("docDetailJson ::"+docDetailJson);
return docDetailJson;
}
public Connection getConnection() public Connection getConnection()
{ {
Connection conn = null; Connection conn = null;
......
package ibase.dashboard.common.webService; package ibase.dashboard.common.webService;
import java.text.SimpleDateFormat;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
...@@ -16,6 +18,7 @@ import org.json.JSONObject; ...@@ -16,6 +18,7 @@ import org.json.JSONObject;
import ibase.dashboard.common.hibernate.dao.CustomerInfoDao; import ibase.dashboard.common.hibernate.dao.CustomerInfoDao;
import ibase.hibernate.bean.UserDocContent; import ibase.hibernate.bean.UserDocContent;
import ibase.utility.BaseException; import ibase.utility.BaseException;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean; import ibase.utility.UserInfoBean;
@Path("/customerInfo") @Path("/customerInfo")
...@@ -26,22 +29,39 @@ public class CustomerInfoService { ...@@ -26,22 +29,39 @@ public class CustomerInfoService {
@GET @GET
@Path("/") @Path("/")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getCustomerInfo(@QueryParam("strgCode") String strgCode) throws Exception public String getCustomerInfo(@QueryParam("STRG_CODE") String strgCode,
@QueryParam("fromDate") String fromDate,
@QueryParam("toDate") String toDate) throws Exception
{ {
System.out.println("In getCustomerInfo:: strgCode["+strgCode+"]"); System.out.println("In getCustomerInfo:: strgCode["+strgCode+"] fromDate:: ["+fromDate+"] toDate:: ["+toDate+"]");
JSONObject customerInfoObj = new JSONObject(); JSONObject customerInfoObj = new JSONObject();
UserInfoBean userInfo = getUserInfo(); UserInfoBean userInfo = getUserInfo();
E12GenericUtility genericUtility = new E12GenericUtility();
try try
{ {
if( userInfo != null ) if( userInfo != null )
{ {
if (fromDate == null || fromDate == "" )
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
fromDate = sdf.format(new java.util.Date());
System.out.println("getCustomerInfo fromDate [" + fromDate + "]");
}
if (toDate == null || toDate == "")
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
toDate = sdf.format(new java.util.Date());
System.out.println("getCustomerInfo toDate [" + toDate + "]");
}
CustomerInfoDao customerInfoDao = new CustomerInfoDao(); CustomerInfoDao customerInfoDao = new CustomerInfoDao();
customerInfoDao.setUserInfo(userInfo); customerInfoDao.setUserInfo(userInfo);
customerInfoObj = customerInfoDao.getCustInfoData(strgCode); customerInfoObj = customerInfoDao.getCustInfoData(strgCode);
JSONArray custHistArr = customerInfoDao.getCustomerCallHistory(strgCode); JSONArray custHistArr = customerInfoDao.getCustomerCallHistory(strgCode, fromDate, toDate);
custHistArr = customerInfoDao.getCustomerDetails(custHistArr); custHistArr = customerInfoDao.getCustomerDetails(custHistArr);
customerInfoObj.put("CALL_HISTORY", custHistArr); customerInfoObj.put("CALL_HISTORY", custHistArr);
} }
......
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