|
@@ -350,13 +350,14 @@ public SuggestionVO KeywordForSuggestions(HashMap<String,String> header, String
|
|
|
List<TrafficBO> list = new ArrayList<>();
|
|
|
JSONArray organics = postObject.getByPath("tasks[0].result[0].items[0].metrics.organic", JSONArray.class);
|
|
|
JSONArray paids = postObject.getByPath("tasks[0].result[0].items[0].metrics.paid", JSONArray.class);
|
|
|
- Map<Integer, Long> temp = new HashMap<>();
|
|
|
+ Map<String, Long> temp = new HashMap<>();
|
|
|
if(organics!=null&&!organics.isEmpty()){
|
|
|
for (Object organic : organics) {
|
|
|
JSONObject obj = (JSONObject) organic;
|
|
|
int month = obj.getByPath("month", Integer.class);
|
|
|
+ int year = obj.getByPath("year", Integer.class);
|
|
|
long organicCount = obj.getByPath("count", Long.class);
|
|
|
- temp.put(month,organicCount);
|
|
|
+ temp.put(year+"-"+month,organicCount);
|
|
|
}
|
|
|
}
|
|
|
if(paids!=null&&!paids.isEmpty()){
|
|
@@ -364,9 +365,10 @@ public SuggestionVO KeywordForSuggestions(HashMap<String,String> header, String
|
|
|
TrafficBO bo = new TrafficBO();
|
|
|
JSONObject obj = (JSONObject) paid;
|
|
|
int month = obj.getByPath("month", Integer.class);
|
|
|
+ int year = obj.getByPath("year", Integer.class);
|
|
|
long paidCount = obj.getByPath("count", Long.class);
|
|
|
- long organicCount = temp.get(month);
|
|
|
- bo.setX_axis(month);
|
|
|
+ long organicCount = temp.get(year+"-"+month);
|
|
|
+ bo.setX_axis(year+"-"+month);
|
|
|
bo.setPaid(paidCount);
|
|
|
bo.setOrganic(organicCount);
|
|
|
list.add(bo);
|