Commit 835d3660 authored by prumde's avatar prumde

- Added SALES PERSON in condition where strg_meet.strg_code and dcr_id are use...

- Added SALES PERSON in condition where strg_meet.strg_code and dcr_id are use and where join with strg_series
- Added SOP in finally catch block

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@209867 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7d0a3d49
...@@ -49,6 +49,7 @@ public class CustomerInfoDao { ...@@ -49,6 +49,7 @@ public class CustomerInfoDao {
conn = getConnection(); conn = getConnection();
isLocalConn =true; isLocalConn =true;
} }
String empCode= this.userInfo.getEmpCode();
String custInfoSql=""; String custInfoSql="";
custInfoSql = "SELECT sc.sc_code, sc.prefix, sc.first_name ||' '|| sc.last_name AS sc_name, sc.qualification, sc.class_code," + custInfoSql = "SELECT sc.sc_code, sc.prefix, sc.first_name ||' '|| sc.last_name AS sc_name, sc.qualification, sc.class_code," +
...@@ -57,7 +58,9 @@ public class CustomerInfoDao { ...@@ -57,7 +58,9 @@ public class CustomerInfoDao {
" (SELECT LISTAGG(s.descr, ', ') WITHIN GROUP (ORDER BY s.spl_code DESC) " + " (SELECT LISTAGG(s.descr, ', ') WITHIN GROUP (ORDER BY s.spl_code DESC) " +
" FROM speciality s, strg_series ss" + " FROM speciality s, strg_series ss" +
" WHERE ss.spl_code = s.spl_code" + " WHERE ss.spl_code = s.spl_code" +
" AND ss.sc_code = sc.sc_code) as speciality_descr" + //Changes by Prajyot on 17OCT2019 - Added SALES PERSON in condition
//" AND ss.sc_code = sc.sc_code) as speciality_descr" +
" AND ss.sc_code = sc.sc_code AND ss.sales_pers = '"+ empCode +"') as speciality_descr" +
" FROM strg_customer sc" + " FROM strg_customer sc" +
" WHERE sc.sc_code = '"+strgCode+"'"; " WHERE sc.sc_code = '"+strgCode+"'";
...@@ -153,6 +156,7 @@ public class CustomerInfoDao { ...@@ -153,6 +156,7 @@ public class CustomerInfoDao {
conn = getConnection(); conn = getConnection();
isLocalConn =true; isLocalConn =true;
} }
String empCode= this.userInfo.getEmpCode();
StringBuffer custCallHistSql=new StringBuffer(); StringBuffer custCallHistSql=new StringBuffer();
/* /*
...@@ -184,7 +188,9 @@ public class CustomerInfoDao { ...@@ -184,7 +188,9 @@ public class CustomerInfoDao {
.append(" 'type:R', 'Request'),'type:Q', 'Query'),'type:I', 'Interested'),'type:N', 'No Response'),'type:M', 'Mini Mithas'),'type:K', 'Kiosk Activity') AS REMARKS") .append(" 'type:R', 'Request'),'type:Q', 'Query'),'type:I', 'Interested'),'type:N', 'No Response'),'type:M', 'Mini Mithas'),'type:K', 'Kiosk Activity') AS REMARKS")
.append(" from strg_meet sm") .append(" from strg_meet sm")
.append(" where sm.event_type <>'PR'") .append(" where sm.event_type <>'PR'")
.append(" and sm.strg_code = '"+strgCode+"'") //Changes by Prajyot on 17OCT2019 - Added SALES PERSON in condition
//.append(" and sm.strg_code = '"+strgCode+"'")
.append(" and sm.strg_code = '" + strgCode + "' AND sm.sales_pers = '" + empCode + "'")
.append(" and sm.event_date between TO_DATE('"+fromDate+"','YYYY-MM-dd') and TO_DATE('"+toDate+"','YYYY-MM-dd')") .append(" and sm.event_date between TO_DATE('"+fromDate+"','YYYY-MM-dd') and TO_DATE('"+toDate+"','YYYY-MM-dd')")
.append(" order by sm.event_date desc"); .append(" order by sm.event_date desc");
...@@ -247,7 +253,8 @@ public class CustomerInfoDao { ...@@ -247,7 +253,8 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getCustomerCallHistory Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
...@@ -339,7 +346,8 @@ public class CustomerInfoDao { ...@@ -339,7 +346,8 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getTopBrands Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
...@@ -352,7 +360,7 @@ public class CustomerInfoDao { ...@@ -352,7 +360,7 @@ public class CustomerInfoDao {
try try
{ {
String empCode = this.userInfo.getEmpCode();
System.out.println("Inside getCustomerDetails"); System.out.println("Inside getCustomerDetails");
for(int i = 0; i < custHistArr.length(); i++) { for(int i = 0; i < custHistArr.length(); i++) {
JSONObject custCallHistJson = custHistArr.getJSONObject(i); JSONObject custCallHistJson = custHistArr.getJSONObject(i);
...@@ -360,9 +368,9 @@ public class CustomerInfoDao { ...@@ -360,9 +368,9 @@ public class CustomerInfoDao {
String strgCode = checkNull(custCallHistJson.optString("STRG_CODE"),""); String strgCode = checkNull(custCallHistJson.optString("STRG_CODE"),"");
System.out.println("dcr id "+dcrId+" and strgCode "+strgCode); System.out.println("dcr id "+dcrId+" and strgCode "+strgCode);
JSONArray custOrders = getCustomerOrders(dcrId, strgCode); JSONArray custOrders = getCustomerOrders(dcrId, strgCode, empCode);
JSONArray dispDetails = getDisplayDetails(dcrId, strgCode); JSONArray dispDetails = getDisplayDetails(dcrId, strgCode, empCode);
JSONArray brandDetails = getBrandDetails(dcrId, strgCode); JSONArray brandDetails = getBrandDetails(dcrId, strgCode, empCode);
custHistArr.getJSONObject(i).put("ORDER_DETAILS", custOrders); custHistArr.getJSONObject(i).put("ORDER_DETAILS", custOrders);
custHistArr.getJSONObject(i).put("DISPLAY_DETAILS", dispDetails); custHistArr.getJSONObject(i).put("DISPLAY_DETAILS", dispDetails);
...@@ -380,7 +388,8 @@ public class CustomerInfoDao { ...@@ -380,7 +388,8 @@ public class CustomerInfoDao {
return custHistArr; return custHistArr;
} }
public JSONArray getCustomerOrders(String dcrId, String strgCode) throws ITMException { //public JSONArray getCustomerOrders(String dcrId, String strgCode) throws ITMException {
public JSONArray getCustomerOrders(String dcrId, String strgCode, String empCode) throws ITMException {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
Connection conn =null; Connection conn =null;
...@@ -403,7 +412,9 @@ public class CustomerInfoDao { ...@@ -403,7 +412,9 @@ public class CustomerInfoDao {
" and sm.dcr_id = '"+dcrId+"'" + " and sm.dcr_id = '"+dcrId+"'" +
" and smo.item_code = itm.item_code" + " and smo.item_code = itm.item_code" +
" and sm.strg_code = '"+strgCode+"'" + " and sm.strg_code = '"+strgCode+"'" +
" and sm.strg_code = smo.strg_code"; " and sm.strg_code = smo.strg_code" +
//Changes by Prajyot on 17OCT2019 - Added SALES PERSON in condition
" and sm.sales_pers = '" + empCode + "'";
System.out.println("custOrdersSql+++"+custOrdersSql); System.out.println("custOrdersSql+++"+custOrdersSql);
pstmt = conn.prepareStatement(custOrdersSql); pstmt = conn.prepareStatement(custOrdersSql);
...@@ -462,14 +473,16 @@ public class CustomerInfoDao { ...@@ -462,14 +473,16 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getCustomerOrders Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
return custOrders; return custOrders;
} }
public JSONArray getDisplayDetails(String dcrId, String strgCode) throws ITMException { //public JSONArray getDisplayDetails(String dcrId, String strgCode) throws ITMException {
public JSONArray getDisplayDetails(String dcrId, String strgCode, String empCode) throws ITMException {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
Connection conn =null; Connection conn =null;
...@@ -491,7 +504,9 @@ public class CustomerInfoDao { ...@@ -491,7 +504,9 @@ public class CustomerInfoDao {
" and event_type <>'PR'" + " and event_type <>'PR'" +
" and sm.dcr_id = '"+dcrId+"'" + " and sm.dcr_id = '"+dcrId+"'" +
" and sm.strg_code = '"+strgCode+"'" + " and sm.strg_code = '"+strgCode+"'" +
" and sm.strg_code = sidisp.strg_code"; " and sm.strg_code = sidisp.strg_code" +
//Changes by Prajyot on 17OCT2019 - Added SALES PERSON in condition
" and sm.sales_pers = '" + empCode + "'";
System.out.println("dispDetailSql+++"+dispDetailSql); System.out.println("dispDetailSql+++"+dispDetailSql);
pstmt = conn.prepareStatement(dispDetailSql); pstmt = conn.prepareStatement(dispDetailSql);
...@@ -551,14 +566,16 @@ public class CustomerInfoDao { ...@@ -551,14 +566,16 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getDisplayDetails Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
return dispDetailArr; return dispDetailArr;
} }
public JSONArray getBrandDetails(String dcrId, String strgCode) throws ITMException { //public JSONArray getBrandDetails(String dcrId, String strgCode) throws ITMException {
public JSONArray getBrandDetails(String dcrId, String strgCode, String empCode) throws ITMException {
JSONArray brandDetailArr = new JSONArray(); JSONArray brandDetailArr = new JSONArray();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -574,8 +591,17 @@ public class CustomerInfoDao { ...@@ -574,8 +591,17 @@ public class CustomerInfoDao {
} }
String brandDetailSql=""; String brandDetailSql="";
brandDetailSql = "select b.description as brand,sbp.pitch_sequence as actual_order,sm.dcr_id,sm.strg_code,sm.sales_pers from strg_meet sm,strg_brand_pitch sbp,brand b where sm.dcr_id=sbp.dcr_id and sbp.brand_code=b.brand_code and " + brandDetailSql = "select b.description as brand, sbp.pitch_sequence as actual_order, sm.dcr_id,sm.strg_code, sm.sales_pers "
"sm.event_type <>'PR' and sm.dcr_id = '"+dcrId+"' and sm.strg_code = '"+strgCode+"' and sm.strg_code=sbp.sc_code order by sbp.PITCH_SEQUENCE"; + " from strg_meet sm,strg_brand_pitch sbp,brand b "
+ " where sm.dcr_id=sbp.dcr_id "
+ " and sbp.brand_code=b.brand_code "
+ " and sm.event_type <>'PR' "
+ " and sm.dcr_id = '"+dcrId+"' "
+ " and sm.strg_code = '"+strgCode+"' "
+ " and sm.strg_code=sbp.sc_code "
//Changes by Prajyot on 17OCT2019 - Added SALES PERSON in condition
+ " and sm.sales_pers = '" + empCode + "'"
+ " order by sbp.PITCH_SEQUENCE";
System.out.println("brandDetailSql+++"+brandDetailSql); System.out.println("brandDetailSql+++"+brandDetailSql);
pstmt = conn.prepareStatement(brandDetailSql); pstmt = conn.prepareStatement(brandDetailSql);
...@@ -623,7 +649,8 @@ public class CustomerInfoDao { ...@@ -623,7 +649,8 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getBrandDetails Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
...@@ -693,7 +720,8 @@ public class CustomerInfoDao { ...@@ -693,7 +720,8 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getDocumentDetail Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
...@@ -759,7 +787,7 @@ public class CustomerInfoDao { ...@@ -759,7 +787,7 @@ public class CustomerInfoDao {
conn = getConnection(); conn = getConnection();
isLocalConn =true; isLocalConn =true;
} }
String empCode= this.userInfo.getEmpCode();
StringBuffer custCallHistSql=new StringBuffer(); StringBuffer custCallHistSql=new StringBuffer();
/* /*
...@@ -792,7 +820,9 @@ public class CustomerInfoDao { ...@@ -792,7 +820,9 @@ public class CustomerInfoDao {
.append(" 'type:R', 'Request'),'type:Q', 'Query'),'type:I', 'Interested'),'type:N', 'No Response'),'type:M', 'Mini Mithas'),'type:K', 'Kiosk Activity') AS REMARKS") .append(" 'type:R', 'Request'),'type:Q', 'Query'),'type:I', 'Interested'),'type:N', 'No Response'),'type:M', 'Mini Mithas'),'type:K', 'Kiosk Activity') AS REMARKS")
.append(" from strg_meet sm") .append(" from strg_meet sm")
.append(" where sm.event_type <>'PR'") .append(" where sm.event_type <>'PR'")
.append(" and sm.strg_code = '"+strgCode+"'") //Changes by Prajyot on 17OCT2019 - Added SALES PERSON in condition
//.append(" and sm.strg_code = '"+strgCode+"'")
.append(" and sm.strg_code = '"+strgCode+"' AND sm.sales_pers = '" + empCode + "'")
.append(" order by sm.event_date desc )") .append(" order by sm.event_date desc )")
.append(" where Rownum <= "+callsCount); .append(" where Rownum <= "+callsCount);
...@@ -855,7 +885,8 @@ public class CustomerInfoDao { ...@@ -855,7 +885,8 @@ public class CustomerInfoDao {
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Inside getCustomerLastCallHistory Finally Block :: "+e.getMessage());
e.printStackTrace();
} }
} }
......
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