| Line 6... |
Line 6... |
| 6 |
import java.util.Map;
|
6 |
import java.util.Map;
|
| 7 |
import java.util.Set;
|
7 |
import java.util.Set;
|
| 8 |
|
8 |
|
| 9 |
import org.apache.http.HttpResponse;
|
9 |
import org.apache.http.HttpResponse;
|
| 10 |
import org.apache.http.conn.HttpHostConnectException;
|
10 |
import org.apache.http.conn.HttpHostConnectException;
|
| - |
|
11 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
12 |
import org.apache.logging.log4j.Logger;
|
| 11 |
import org.springframework.beans.factory.annotation.Autowired;
|
13 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 12 |
import org.springframework.beans.factory.annotation.Value;
|
14 |
import org.springframework.beans.factory.annotation.Value;
|
| 13 |
import org.springframework.core.io.ByteArrayResource;
|
15 |
import org.springframework.core.io.ByteArrayResource;
|
| 14 |
import org.springframework.core.io.InputStreamSource;
|
16 |
import org.springframework.core.io.InputStreamSource;
|
| 15 |
import org.springframework.http.HttpEntity;
|
17 |
import org.springframework.http.HttpEntity;
|
| Line 29... |
Line 31... |
| 29 |
import com.spice.profitmandi.common.web.client.RestClient;
|
31 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 30 |
|
32 |
|
| 31 |
@Component
|
33 |
@Component
|
| 32 |
public class ReporticoService {
|
34 |
public class ReporticoService {
|
| 33 |
|
35 |
|
| - |
|
36 |
private static final Logger LOGGER = LogManager.getLogger(ReporticoService.class);
|
| - |
|
37 |
|
| 34 |
// private String reporticoUrl="http://192.168.134.118/reports/run.php";
|
38 |
// private String reporticoUrl="http://192.168.134.118/reports/run.php";
|
| 35 |
@Value("${reportico.url}")
|
39 |
@Value("${reportico.url}")
|
| 36 |
private String reporticoUrl;
|
40 |
private String reporticoUrl;
|
| 37 |
|
41 |
|
| 38 |
@Autowired
|
42 |
@Autowired
|
| Line 152... |
Line 156... |
| 152 |
}
|
156 |
}
|
| 153 |
|
157 |
|
| 154 |
public <T> List<T> getReports(Class<T> className, ReporticoProject project, String reportName,
|
158 |
public <T> List<T> getReports(Class<T> className, ReporticoProject project, String reportName,
|
| 155 |
Map<String, String> params) throws Exception {
|
159 |
Map<String, String> params) throws Exception {
|
| 156 |
HttpResponse reportResponse = this.getJsonFile(project, reportName, params);
|
160 |
HttpResponse reportResponse = this.getJsonFile(project, reportName, params);
|
| - |
|
161 |
|
| - |
|
162 |
LOGGER.info("reportResponse {}", reportResponse);
|
| 157 |
JavaType type = objectMapper.getTypeFactory().constructParametricType(ReporticoResponseModel.class, className);
|
163 |
JavaType type = objectMapper.getTypeFactory().constructParametricType(ReporticoResponseModel.class, className);
|
| 158 |
ObjectReader or = objectMapper.readerFor(type);
|
164 |
ObjectReader or = objectMapper.readerFor(type);
|
| 159 |
ReporticoResponseModel<T> responseObj = or.readValue(reportResponse.getEntity().getContent());
|
165 |
ReporticoResponseModel<T> responseObj = or.readValue(reportResponse.getEntity().getContent());
|
| - |
|
166 |
|
| - |
|
167 |
LOGGER.info("responseObj {}", responseObj);
|
| - |
|
168 |
|
| 160 |
return responseObj.getData();
|
169 |
return responseObj.getData();
|
| 161 |
}
|
170 |
}
|
| 162 |
}
|
171 |
}
|