| Line 4... |
Line 4... |
| 4 |
import java.util.HashMap;
|
4 |
import java.util.HashMap;
|
| 5 |
import java.util.Map;
|
5 |
import java.util.Map;
|
| 6 |
|
6 |
|
| 7 |
import org.apache.http.HttpResponse;
|
7 |
import org.apache.http.HttpResponse;
|
| 8 |
import org.apache.http.conn.HttpHostConnectException;
|
8 |
import org.apache.http.conn.HttpHostConnectException;
|
| - |
|
9 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 9 |
import org.springframework.stereotype.Component;
|
10 |
import org.springframework.stereotype.Component;
|
| 10 |
|
11 |
|
| 11 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
12 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 12 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
13 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 13 |
import com.spice.profitmandi.common.web.client.RestClient;
|
14 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| Line 16... |
Line 17... |
| 16 |
public class ReporticoService {
|
17 |
public class ReporticoService {
|
| 17 |
|
18 |
|
| 18 |
//private String reporticoUrl="http://192.168.134.118/reports/run.php";
|
19 |
//private String reporticoUrl="http://192.168.134.118/reports/run.php";
|
| 19 |
private String reporticoUrl="http://50.116.10.120/reports/run.php";
|
20 |
private String reporticoUrl="http://50.116.10.120/reports/run.php";
|
| 20 |
|
21 |
|
| - |
|
22 |
@Autowired
|
| - |
|
23 |
RestClient restClient;
|
| - |
|
24 |
|
| 21 |
public static final Map<ReporticoProject, Map<String, String>> projectAuthMap = Collections.unmodifiableMap(
|
25 |
public static final Map<ReporticoProject, Map<String, String>> projectAuthMap = Collections.unmodifiableMap(
|
| 22 |
new HashMap<ReporticoProject, Map<String, String>>() {
|
26 |
new HashMap<ReporticoProject, Map<String, String>>() {
|
| 23 |
{
|
27 |
{
|
| 24 |
put(ReporticoProject.FOCO, new HashMap<String, String>() {
|
28 |
put(ReporticoProject.FOCO, new HashMap<String, String>() {
|
| 25 |
{
|
29 |
{
|
| Line 36... |
Line 40... |
| 36 |
}
|
40 |
}
|
| 37 |
});
|
41 |
});
|
| 38 |
|
42 |
|
| 39 |
public HttpResponse getReportFile(ReporticoProject projectName, String reportName) throws HttpHostConnectException, ProfitMandiBusinessException {
|
43 |
public HttpResponse getReportFile(ReporticoProject projectName, String reportName) throws HttpHostConnectException, ProfitMandiBusinessException {
|
| 40 |
|
44 |
|
| 41 |
RestClient restClient = new RestClient();
|
- |
|
| 42 |
Map<String, String> authMap = projectAuthMap.get(projectName);
|
45 |
Map<String, String> authMap = projectAuthMap.get(projectName);
|
| 43 |
|
46 |
|
| 44 |
Map<String, String> params = new HashMap<>(authMap);
|
47 |
Map<String, String> params = new HashMap<>(authMap);
|
| 45 |
params.put("xmlin", reportName);
|
48 |
params.put("xmlin", reportName);
|
| 46 |
params.put("target_format", "CSV");
|
49 |
params.put("target_format", "CSV");
|
| Line 48... |
Line 51... |
| 48 |
return restClient.getResponse(reporticoUrl, params, new HashMap<>());
|
51 |
return restClient.getResponse(reporticoUrl, params, new HashMap<>());
|
| 49 |
}
|
52 |
}
|
| 50 |
|
53 |
|
| 51 |
public HttpResponse getReportFile(int fofoId, ReporticoProject projectName, String reportName) throws HttpHostConnectException, ProfitMandiBusinessException {
|
54 |
public HttpResponse getReportFile(int fofoId, ReporticoProject projectName, String reportName) throws HttpHostConnectException, ProfitMandiBusinessException {
|
| 52 |
|
55 |
|
| 53 |
RestClient restClient = new RestClient();
|
- |
|
| 54 |
Map<String, String> authMap = projectAuthMap.get(projectName);
|
56 |
Map<String, String> authMap = projectAuthMap.get(projectName);
|
| 55 |
|
57 |
|
| 56 |
Map<String, String> params = new HashMap<>(authMap);
|
58 |
Map<String, String> params = new HashMap<>(authMap);
|
| 57 |
params.put("xmlin", reportName);
|
59 |
params.put("xmlin", reportName);
|
| 58 |
params.put("target_format", "CSV");
|
60 |
params.put("target_format", "CSV");
|