Commit 3a8bc627 authored by shishir suman's avatar shishir suman
Browse files

new API for ticket statistics

1 merge request!48Uphrh 7903 mobile otp
Showing with 15 additions and 5 deletions
+15 -5
package org.upsmf.grievance.controller;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
......@@ -79,9 +80,9 @@ public class TicketController {
}
@PostMapping("/statistic")
public ResponseEntity upload(@RequestParam("userId") Long userId) {
public ResponseEntity upload(@RequestBody JsonNode userData) {
try {
TicketStatistics ticketStatisticsByUser = dashboardService.getTicketStatisticsByUser(userId);
TicketStatistics ticketStatisticsByUser = dashboardService.getTicketStatisticsByUser(userData);
Response response = new Response(HttpStatus.OK.value(), ticketStatisticsByUser);
return new ResponseEntity<Response>(response, HttpStatus.OK);
} catch (Exception e) {
......
package org.upsmf.grievance.service;
import com.fasterxml.jackson.databind.JsonNode;
import org.upsmf.grievance.dto.SearchRequest;
import org.upsmf.grievance.model.TicketStatistics;
import org.upsmf.grievance.model.es.Feedback;
......@@ -13,5 +14,5 @@ public interface DashboardService {
public List<Feedback> getFeedbackByTicketId(String ticketId);
public TicketStatistics getTicketStatisticsByUser(Long userId);
public TicketStatistics getTicketStatisticsByUser(JsonNode data);
}
package org.upsmf.grievance.service.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.extern.slf4j.Slf4j;
......@@ -631,11 +632,17 @@ public class DashboardServiceImpl implements DashboardService {
/**
* Method to give ticket statistical data for logged in user
* @param userId
* @param userData
* @return
*/
@Override
public TicketStatistics getTicketStatisticsByUser(Long userId) {
public TicketStatistics getTicketStatisticsByUser(JsonNode userData) {
Long userId = null;
log.info("Json node data - {}", userData);
if(userData != null && userData.has("userId")) {
userId = userData.get("userId").asLong();
}
log.info("assigned userID - {}", userId);
// validate payload
Long escalatedToMeCount = null;
Long nudgedTicketCount = null;
......@@ -669,6 +676,7 @@ public class DashboardServiceImpl implements DashboardService {
.junkTicketCount(junkTicketCount)
.priorityTicketCount(priorityTicketCount)
.build();
log.info("statistic data - {}", ticketStatistics);
return ticketStatistics;
}
......
Supports Markdown
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