You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.4 KiB
127 lines
4.4 KiB
package in.gov.chennaicorporation.gccoffice.cmdashboard.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpMethod;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
import in.gov.chennaicorporation.gccoffice.cmdashboard.service.CmDashboardService;
|
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
|
|
|
|
|
|
|
|
@RequestMapping("/gcc/api/cmdashboard")
|
|
@RestController("cmdashboard")
|
|
public class APIController
|
|
{
|
|
private CmDashboardService cmdashboards;
|
|
|
|
|
|
@Autowired
|
|
private AppConfig appConfig;
|
|
|
|
@Autowired
|
|
public APIController(CmDashboardService cmdashboards) {
|
|
this.cmdashboards = cmdashboards;
|
|
}
|
|
|
|
@GetMapping(value = "/getCmDashboardReports")
|
|
public List getCombinedCmDashboardReports(@RequestParam("zonename") String zonename) {
|
|
|
|
return cmdashboards.getCombinedCmDashboardReports(zonename);
|
|
}
|
|
|
|
@GetMapping(value = "/getCmDashboardAllReports")
|
|
public List getCmDashboardAllReports() {
|
|
|
|
return cmdashboards.getCmDashboardAllReports();
|
|
}
|
|
|
|
@GetMapping(value = "/getRegionCounts")
|
|
public List<Map<String, Object>> getRegionCounts() {
|
|
return cmdashboards.getRegionCounts();
|
|
}
|
|
|
|
@GetMapping(value = "/getZoneCounts")
|
|
public List<Map<String, Object>> getZoneCounts() {
|
|
return cmdashboards.getZoneCounts();
|
|
}
|
|
|
|
@GetMapping(value = "/getSchemeDetails")
|
|
public Map<String, Object> getSchemeDetails(@RequestParam("schemename") String schemename, @RequestParam("zonename") String zonename) {
|
|
return cmdashboards.getSchemeDetails(schemename, zonename);
|
|
}
|
|
|
|
@GetMapping(value="/getTypeOfWorkDetails")
|
|
public Map<String, Object> getTypeOfWorkDetails(@RequestParam("typeofwork") String typeofwork, @RequestParam("zonename") String zonename){
|
|
return cmdashboards.getTypeOfWorkDetails(typeofwork, zonename);
|
|
}
|
|
|
|
@GetMapping(value="/getRegionzones")
|
|
public Map<String,Object> getRegionsZonesDetails(@RequestParam("regionname") String regionname){
|
|
return cmdashboards.getRegionDetails(regionname);
|
|
}
|
|
|
|
@GetMapping("/all-list/{id}")
|
|
public Map<String, Object> getCMDetails(@PathVariable int id)
|
|
{
|
|
return cmdashboards.getCMDetails(id);
|
|
}
|
|
|
|
// Rest Api From ERP
|
|
// @GetMapping(value = "/getZoneNo")
|
|
// public String getZoneNo() {
|
|
//
|
|
// String urlString = appConfig.getErpUrl()+"serviceId=getZones";
|
|
// ResponseEntity<String> response = null;
|
|
// RestTemplate restTemplate = new RestTemplate();
|
|
// String bodyMessage = "";
|
|
// HttpHeaders headers = new HttpHeaders();
|
|
// try {
|
|
// HttpEntity<String> postData = new HttpEntity<String>(headers);
|
|
// response = restTemplate.exchange(urlString, HttpMethod.POST, postData, String.class);
|
|
// bodyMessage = response.getBody();
|
|
// //System.out.println("BodyMessage" + bodyMessage);
|
|
// } catch (Exception e) {
|
|
// e.printStackTrace();
|
|
// //System.out.print("\n ERROR---: " + e);
|
|
// bodyMessage = "Error";
|
|
// }
|
|
// return bodyMessage;
|
|
// }
|
|
//
|
|
// @GetMapping(value = "/getDiv")
|
|
// public String getDiv(@RequestParam String zoneId) {
|
|
// String urlString = appConfig.getErpUrl()+"serviceId=getWards&Zoneid="+zoneId+"";
|
|
// ResponseEntity<String> response = null;
|
|
// RestTemplate restTemplate = new RestTemplate();
|
|
// String bodyMessage = "";
|
|
// HttpHeaders headers = new HttpHeaders();
|
|
// try {
|
|
// HttpEntity<String> postData = new HttpEntity<String>(headers);
|
|
// response = restTemplate.exchange(urlString, HttpMethod.POST, postData, String.class);
|
|
// bodyMessage = response.getBody();
|
|
// //System.out.println("bodyMessage" + bodyMessage);
|
|
//
|
|
// } catch (Exception e) {
|
|
// e.printStackTrace();
|
|
// //System.out.print("\n ERROR---: " + e);
|
|
// bodyMessage = "Error";
|
|
// }
|
|
// return bodyMessage;
|
|
// }
|
|
|
|
}
|