Commit d51dbc69 authored by pborate's avatar pborate

Update changes for customer info dashboard


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205860 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8fcb0492
......@@ -80,18 +80,18 @@ public class CustomerInfoDao {
String email_addr = rs.getString("EMAIL_ADDR");
String spec_descr = rs.getString("SPECIALITY_DESCR");
customerInfoJson.put("SC_CODE", checkNull(sc_code).trim());
customerInfoJson.put("PREFIX", prefix);
customerInfoJson.put("SC_NAME", sc_name);
customerInfoJson.put("QUALIFICATION", qualification);
customerInfoJson.put("CLASS_CODE", class_code);
customerInfoJson.put("CLASS_CODE_DESCR", class_code_descr);
customerInfoJson.put("ADDR1", addr1);
customerInfoJson.put("ADDR2", addr2);
customerInfoJson.put("ADDR3", addr3);
customerInfoJson.put("MOBILE_NO", mobile_no);
customerInfoJson.put("EMAIL_ADDR", email_addr);
customerInfoJson.put("SPECIALITY_DESCR", spec_descr);
customerInfoJson.put("SC_CODE", checkNull(sc_code,""));
customerInfoJson.put("PREFIX", checkNull(prefix,""));
customerInfoJson.put("SC_NAME", checkNull(sc_name,"NA"));
customerInfoJson.put("QUALIFICATION", checkNull(qualification,"NA"));
customerInfoJson.put("CLASS_CODE", checkNull(class_code,"NA"));
customerInfoJson.put("CLASS_CODE_DESCR", checkNull(class_code_descr,""));
customerInfoJson.put("ADDR1", checkNull(addr1,""));
customerInfoJson.put("ADDR2", checkNull(addr2,""));
customerInfoJson.put("ADDR3", checkNull(addr3,""));
customerInfoJson.put("MOBILE_NO", checkNull(mobile_no,""));
customerInfoJson.put("EMAIL_ADDR", checkNull(email_addr,"NA"));
customerInfoJson.put("SPECIALITY_DESCR", checkNull(spec_descr,""));
}
}
......@@ -304,8 +304,8 @@ public class CustomerInfoDao {
Integer brandPitchCnt = rs.getInt("BRAND_PITCH_CNT");
String colour = rs.getString("COLOUR");
custCallHistJson.put("BRAND_CODE", checkNull(brandCode));
custCallHistJson.put("DESCRIPTION", checkNull(descr));
custCallHistJson.put("BRAND_CODE", checkNull(brandCode,""));
custCallHistJson.put("DESCRIPTION", checkNull(descr,""));
custCallHistJson.put("BRAND_PITCH_CNT", brandPitchCnt);
custCallHistJson.put("COLOUR", colour);
custCallHistJsonArr.put(custCallHistJson);
......@@ -348,21 +348,35 @@ public class CustomerInfoDao {
return custCallHistJsonArr;
}
public JSONArray getCustomerDetails(JSONArray custHistArr) throws JSONException, ITMException{
public JSONArray getCustomerDetails(JSONArray custHistArr) throws ITMException{
for(int i = 0; i < custHistArr.length(); i++) {
JSONObject custCallHistJson = custHistArr.getJSONObject(i);
String dcrId = custCallHistJson.getString("DCR_ID");
String strgCode = custCallHistJson.getString("STRG_CODE");
JSONArray custOrders = getCustomerOrders(dcrId, strgCode);
JSONArray dispDetails = getDisplayDetails(dcrId, strgCode);
JSONArray brandDetails = getBrandDetails(dcrId, strgCode);
try
{
custHistArr.getJSONObject(i).put("ORDER_DETAILS", custOrders);
custHistArr.getJSONObject(i).put("DISPLAY_DETAILS", dispDetails);
custHistArr.getJSONObject(i).put("BRAND_DETAILS", brandDetails);
System.out.println("Inside getCustomerDetails");
for(int i = 0; i < custHistArr.length(); i++) {
JSONObject custCallHistJson = custHistArr.getJSONObject(i);
String dcrId = checkNull(custCallHistJson.optString("DCR_ID"),"");
String strgCode = checkNull(custCallHistJson.optString("STRG_CODE"),"");
System.out.println("dcr id "+dcrId+" and strgCode "+strgCode);
JSONArray custOrders = getCustomerOrders(dcrId, strgCode);
JSONArray dispDetails = getDisplayDetails(dcrId, strgCode);
JSONArray brandDetails = getBrandDetails(dcrId, strgCode);
custHistArr.getJSONObject(i).put("ORDER_DETAILS", custOrders);
custHistArr.getJSONObject(i).put("DISPLAY_DETAILS", dispDetails);
custHistArr.getJSONObject(i).put("BRAND_DETAILS", brandDetails);
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return custHistArr;
}
......@@ -800,15 +814,15 @@ public class CustomerInfoDao {
String callOutcomeDesc = rs.getString("CALL_OUTCOME_DESCR");
String remarks = rs.getString("REMARKS");
custCallHistJson.put("DCR_ID", dcrId);
custCallHistJson.put("SALES_PERS", salesPers);
custCallHistJson.put("STRG_CODE", strg_code);
custCallHistJson.put("EVENT_DATE", eventDate);
custCallHistJson.put("EVENT_TIME_START", eventTimeStrt);
custCallHistJson.put("EVENT_TIME_END", eventTimeEnd);
custCallHistJson.put("CALL_OUTCOME", callOutcome);
custCallHistJson.put("CALL_OUTCOME_DESCR", callOutcomeDesc);
custCallHistJson.put("REMARKS", remarks);
custCallHistJson.put("DCR_ID", checkNull(dcrId,""));
custCallHistJson.put("SALES_PERS", checkNull(salesPers,"NA"));
custCallHistJson.put("STRG_CODE", checkNull(strg_code,""));
custCallHistJson.put("EVENT_DATE", checkNull(eventDate,""));
custCallHistJson.put("EVENT_TIME_START", checkNull(eventTimeStrt,""));
custCallHistJson.put("EVENT_TIME_END", checkNull(eventTimeEnd,""));
custCallHistJson.put("CALL_OUTCOME", checkNull(callOutcome,"NA"));
custCallHistJson.put("CALL_OUTCOME_DESCR", checkNull(callOutcomeDesc,"NA"));
custCallHistJson.put("REMARKS", checkNull(remarks,"NA"));
custCallHistJsonArr.put(custCallHistJson);
}
......@@ -850,11 +864,11 @@ public class CustomerInfoDao {
return custCallHistJsonArr;
}
public String checkNull(String input)
public String checkNull(String input,String alternateValue)
{
if (input == null || "null".equalsIgnoreCase(input))
{
input= "";
input= alternateValue;
}
return input.trim();
}
......
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