Commit d9ac0a01 authored by kpandey's avatar kpandey

Updated to get brand details

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@195608 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 42a88838
......@@ -335,7 +335,7 @@ public class CustomerInfoDao {
String strgCode = custCallHistJson.getString("STRG_CODE");
JSONArray custOrders = getCustomerOrders(dcrId, strgCode);
JSONArray dispDetails = getDisplayDetails(dcrId, strgCode);
JSONArray brandDetails = getBrandDetails();
JSONArray brandDetails = getBrandDetails(dcrId, strgCode);
custHistArr.getJSONObject(i).put("ORDER_DETAILS", custOrders);
custHistArr.getJSONObject(i).put("DISPLAY_DETAILS", dispDetails);
......@@ -521,8 +521,74 @@ public class CustomerInfoDao {
return dispDetailArr;
}
public JSONArray getBrandDetails() {
public JSONArray getBrandDetails(String dcrId, String strgCode) throws ITMException {
JSONArray brandDetailArr = new JSONArray();
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn =null;
boolean isLocalConn =false;
try
{
if(conn == null)
{
conn = getConnection();
isLocalConn =true;
}
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 " +
"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";
System.out.println("brandDetailSql+++"+brandDetailSql);
pstmt = conn.prepareStatement(brandDetailSql);
rs = pstmt.executeQuery();
while(rs.next())
{
JSONObject brandDetailJson = new JSONObject();
String brand = rs.getString("brand");
String actual_order = rs.getString("actual_order");
brandDetailJson.put("BRAND", brand);
brandDetailJson.put("ACTUAL_ORDER", actual_order);
brandDetailArr.put(brandDetailJson);
}
}
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)
{
}
}
return brandDetailArr;
}
......
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