| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.common.services;
|
1 |
package com.spice.profitmandi.common.services;
|
| 2 |
|
2 |
|
| 3 |
import java.util.Collections;
|
3 |
import com.fasterxml.jackson.databind.JavaType;
|
| 4 |
import java.util.HashMap;
|
4 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 5 |
import java.util.List;
|
5 |
import com.fasterxml.jackson.databind.ObjectReader;
|
| 6 |
import java.util.Map;
|
6 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| - |
|
7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
8 |
import com.spice.profitmandi.common.model.ReporticoResponseModel;
|
| 7 |
import java.util.Set;
|
9 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 8 |
|
- |
|
| 9 |
import org.apache.http.HttpResponse;
|
10 |
import org.apache.http.HttpResponse;
|
| 10 |
import org.apache.http.conn.HttpHostConnectException;
|
11 |
import org.apache.http.conn.HttpHostConnectException;
|
| 11 |
import org.apache.logging.log4j.LogManager;
|
12 |
import org.apache.logging.log4j.LogManager;
|
| 12 |
import org.apache.logging.log4j.Logger;
|
13 |
import org.apache.logging.log4j.Logger;
|
| 13 |
import org.springframework.beans.factory.annotation.Autowired;
|
14 |
import org.springframework.beans.factory.annotation.Autowired;
|
| Line 20... |
Line 21... |
| 20 |
import org.springframework.http.ResponseEntity;
|
21 |
import org.springframework.http.ResponseEntity;
|
| 21 |
import org.springframework.stereotype.Component;
|
22 |
import org.springframework.stereotype.Component;
|
| 22 |
import org.springframework.web.client.RestTemplate;
|
23 |
import org.springframework.web.client.RestTemplate;
|
| 23 |
import org.springframework.web.util.UriComponentsBuilder;
|
24 |
import org.springframework.web.util.UriComponentsBuilder;
|
| 24 |
|
25 |
|
| 25 |
import com.fasterxml.jackson.databind.JavaType;
|
26 |
import java.util.*;
|
| 26 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
- |
|
| 27 |
import com.fasterxml.jackson.databind.ObjectReader;
|
- |
|
| 28 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
- |
|
| 29 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
- |
|
| 30 |
import com.spice.profitmandi.common.model.ReporticoResponseModel;
|
- |
|
| 31 |
import com.spice.profitmandi.common.web.client.RestClient;
|
- |
|
| 32 |
|
27 |
|
| 33 |
@Component
|
28 |
@Component
|
| 34 |
public class ReporticoService {
|
29 |
public class ReporticoService {
|
| 35 |
|
30 |
|
| 36 |
private static final Logger LOGGER = LogManager.getLogger(ReporticoService.class);
|
31 |
private static final Logger LOGGER = LogManager.getLogger(ReporticoService.class);
|
| Line 77... |
Line 72... |
| 77 |
Map<String, String> authMap = projectAuthMap.get(projectName);
|
72 |
Map<String, String> authMap = projectAuthMap.get(projectName);
|
| 78 |
Map<String, String> params = new HashMap<>(authMap);
|
73 |
Map<String, String> params = new HashMap<>(authMap);
|
| 79 |
params.put("xmlin", reportName);
|
74 |
params.put("xmlin", reportName);
|
| 80 |
params.put("target_format", "CSV");
|
75 |
params.put("target_format", "CSV");
|
| 81 |
params.put("execute_mode", "EXECUTE");
|
76 |
params.put("execute_mode", "EXECUTE");
|
| 82 |
return restClient.getResponse(reporticoUrl, params, new HashMap<>());
|
77 |
return restClient.getResponse(reporticoUrl, params, null);
|
| 83 |
}
|
78 |
}
|
| 84 |
|
79 |
|
| 85 |
public InputStreamSource getReportInputStreamSource(ReporticoProject projectName, String reportName)
|
80 |
public InputStreamSource getReportInputStreamSource(ReporticoProject projectName, String reportName)
|
| 86 |
throws HttpHostConnectException, ProfitMandiBusinessException {
|
81 |
throws HttpHostConnectException, ProfitMandiBusinessException {
|
| 87 |
|
82 |
|