Commit 608567f0 authored by pborate's avatar pborate

Updated changes for todays call dashboard

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@209128 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8849f0db
......@@ -2136,7 +2136,15 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
//rawDataPlanDtlJson.put("ACTIVITY_END_LOCALITY",sourceDestination.get("ACTIVITY_END_LOCALITY"));
System.out.println("after rawDataPlanDtlJson 1 "+rawDataPlanDtlJson);
org.json.JSONObject countListed=countOfListedUnlisted(salePersons,validFromDate,validToDate,dataSourceName,targetDateFormat, enterprise);
String orgUnit = "ENTERPRISE:"+enterprise;
String custTypes = getSfaParmVal(dataSourceName, orgUnit.trim(), "TODAY_CALLS_INFO");
if(custTypes == null || custTypes.length() == 0)
{
custTypes = "D,S,C,U,W";
}
org.json.JSONObject countListed=countOfListedUnlisted(salePersons,validFromDate,validToDate,dataSourceName,targetDateFormat, enterprise,custTypes);
System.out.println("after countListed "+countListed);
rawDataPlanDtlJson.put("TODAYS_SUMMARY",countListed.get("TODAYS_SUMMARY"));
......@@ -2148,7 +2156,10 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
org.json.JSONArray doctorArray=new org.json.JSONArray();
doctorArray=getTodaysCallData(salePersons,validFromDate,validToDate,dataSourceName,targetDateFormat,unListedDocList);
System.out.println("after doctorArray 1::: "+doctorArray);
doctorArray=getDoctorAryLoc(doctorArray);
//Change by Priyanka B 9-Oct-2019 Start
doctorArray=getDoctorAryLoc(doctorArray,custTypes);
//Change by Priyanka B 9-Oct-2019 End
System.out.println("after doctorArray 2"+doctorArray);
//rawDataPlanDtlJson.put("TODAYS_CALL",doctorArray);
rawDataPlanDtlJson.put("CALL_DETAILS",doctorArray);
......@@ -2166,7 +2177,8 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
return rawDataPlanDtlJson;
}
private org.json.JSONArray getDoctorAryLoc(org.json.JSONArray doctorArray) throws ITMException, Exception {
//private org.json.JSONArray getDoctorAryLoc(org.json.JSONArray doctorArray) throws ITMException, Exception {
private org.json.JSONArray getDoctorAryLoc(org.json.JSONArray doctorArray,String custTypes) throws ITMException, Exception {
// TODO Auto-generated method stub
org.json.JSONArray doctorFinalArray =new org.json.JSONArray();
org.json.JSONArray callsFinalArray =new org.json.JSONArray();
......@@ -2235,6 +2247,7 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
System.out.println("Exception in getDoctorAryLoc method"+e);
}
doctorObjectNew.put("EVENT_DATE", event_date);
doctorObjectNew.put("CUST_TYPES", custTypes);
doctorFinalArray.put(doctorObjectNew);
}
......@@ -2382,8 +2395,8 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
return sourceDes;
}
private org.json.JSONObject countOfListedUnlisted(String salePersons,String validFromDate, String validToDate, String dataSourceName,String targetDateFormat, String enterprise)throws Exception {
//private org.json.JSONObject countOfListedUnlisted(String salePersons,String validFromDate, String validToDate, String dataSourceName,String targetDateFormat, String enterprise)throws Exception {
private org.json.JSONObject countOfListedUnlisted(String salePersons,String validFromDate, String validToDate, String dataSourceName,String targetDateFormat, String enterprise,String custTypes)throws Exception {
System.out.println("Inside getSourceDestination : "+salePersons);
JSONObject listOfCount=new JSONObject();
JSONArray finalArray=new JSONArray();
......@@ -2412,6 +2425,7 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
//Changes By Prajyot on 03-OCT-2019 [To add JOIN with SPRS_CODE__WW in case it is not null]
//" AND SM.SALES_PERS=SS.SALES_PERS" +
" AND SS.SALES_PERS = ( CASE WHEN SM.SPRS_CODE__WW IS NULL THEN SM.SALES_PERS ELSE SM.SPRS_CODE__WW END ) " +
" AND SM.ROUTE_ID=SS.ROUTE_ID "+
" INNER JOIN SALES_PERS SP" +
" ON SP.SALES_PERS=SS.SALES_PERS" +
" INNER JOIN STRG_CUSTOMER SC" +
......@@ -2433,67 +2447,26 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
int listedCount=0;
HashMap<String, String> visitSummaryMap = new HashMap<String, String>();
while(rs.next())
{
JSONObject visitSummerObj=new JSONObject();
String custType=rs.getString("TYPE");
String optionName=rs.getString("SH_DESCR");
int count1=Integer.parseInt(rs.getString("COUNT"));
System.out.println("count in countOfListedUnlisted 1 "+count1);
visitSummaryMap.put(custType, ""+count1);
listedCount=listedCount+count1;
}
String orgUnit = "ENTERPRISE:"+enterprise;
String sfaParmVal = getSfaParmVal(dataSourceName, orgUnit.trim(), "TODAY_CALLS_INFO");
if(sfaParmVal == null || sfaParmVal.length() == 0)
{
sfaParmVal = "D,S,C,U,W";
}
JSONObject visitSummerObj=new JSONObject();
if(sfaParmVal.indexOf("D") != -1)
{
String drCount = visitSummaryMap.get("D");
drCount = drCount != null ? drCount : "0";
visitSummerObj.put("OPTION_NAME", "Doctor");
visitSummerObj.put("OPTION_VALUE", drCount);
visitSummeryArray.add(visitSummerObj);
}
if(sfaParmVal.indexOf("S") != -1)
{
String stkCount = visitSummaryMap.get("S");
stkCount = stkCount != null ? stkCount : "0";
visitSummerObj=new JSONObject();
visitSummerObj.put("OPTION_NAME", "Distributer");
visitSummerObj.put("OPTION_VALUE", stkCount);
if(custTypes.indexOf(custType) != -1){
String custTypeCount = "" + count1;
custTypeCount = custTypeCount != null ? custTypeCount : "0";
visitSummerObj.put("OPTION_TYPE", custType);
visitSummerObj.put("OPTION_NAME", optionName);
visitSummerObj.put("OPTION_VALUE", custTypeCount);
visitSummeryArray.add(visitSummerObj);
}
if(sfaParmVal.indexOf("C") != -1)
{
String chmCount = visitSummaryMap.get("C");
chmCount = chmCount != null ? chmCount : "0";
visitSummerObj=new JSONObject();
visitSummerObj.put("OPTION_NAME", "Retailer");
visitSummerObj.put("OPTION_VALUE", chmCount);
visitSummeryArray.add(visitSummerObj);
}
if(sfaParmVal.indexOf("W") != -1)
{
String chmCount = visitSummaryMap.get("W");
chmCount = chmCount != null ? chmCount : "0";
visitSummerObj=new JSONObject();
visitSummerObj.put("OPTION_NAME", "Wholesaler");
visitSummerObj.put("OPTION_VALUE", chmCount);
visitSummeryArray.add(visitSummerObj);
}
System.out.println("visitSummeryArray in countOfListedUnlisted 1 "+visitSummeryArray);
System.out.println("listed in countOfListedUnlisted "+listedCount);
JSONObject todaysSummyObjList=new JSONObject();
......@@ -2541,9 +2514,11 @@ public JSONObject getTodaysCallsSummary(String dataSourceName,String loginCode,S
}
}
System.out.println("scCode str ["+ScCodeStr+"] unlisted count ["+unlisted+"]");
if(sfaParmVal.indexOf("U") != -1)
if(custTypes.indexOf("U") != -1)
{
JSONObject visitSummerObj=new JSONObject();
visitSummerObj=new JSONObject();
visitSummerObj.put("OPTION_TYPE", "U");
visitSummerObj.put("OPTION_NAME", "Unlisted");
visitSummerObj.put("OPTION_VALUE", unlisted);
visitSummeryArray.add(visitSummerObj);
......
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