CM works overall dashboard integrate with gcc_office_portal
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

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.cmdashboard.controller;
  2. import java.util.List;
  3. import java.util.Map;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.http.HttpEntity;
  6. import org.springframework.http.HttpHeaders;
  7. import org.springframework.http.HttpMethod;
  8. import org.springframework.http.ResponseEntity;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PathVariable;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RequestParam;
  13. import org.springframework.web.bind.annotation.ResponseBody;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import org.springframework.web.client.RestTemplate;
  16. import in.gov.chennaicorporation.gccoffice.cmdashboard.service.CmDashboardService;
  17. import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
  18. @RequestMapping("/gcc/api/cmdashboard")
  19. @RestController("cmdashboard")
  20. public class APIController
  21. {
  22. private CmDashboardService cmdashboards;
  23. @Autowired
  24. private AppConfig appConfig;
  25. @Autowired
  26. public APIController(CmDashboardService cmdashboards) {
  27. this.cmdashboards = cmdashboards;
  28. }
  29. @GetMapping(value = "/getCmDashboardReports")
  30. public List getCombinedCmDashboardReports(@RequestParam("zonename") String zonename) {
  31. return cmdashboards.getCombinedCmDashboardReports(zonename);
  32. }
  33. @GetMapping(value = "/getCmDashboardAllReports")
  34. public List getCmDashboardAllReports() {
  35. return cmdashboards.getCmDashboardAllReports();
  36. }
  37. @GetMapping(value = "/getRegionCounts")
  38. public List<Map<String, Object>> getRegionCounts() {
  39. return cmdashboards.getRegionCounts();
  40. }
  41. @GetMapping(value = "/getZoneCounts")
  42. public List<Map<String, Object>> getZoneCounts() {
  43. return cmdashboards.getZoneCounts();
  44. }
  45. @GetMapping(value = "/getSchemeDetails")
  46. public Map<String, Object> getSchemeDetails(@RequestParam("schemename") String schemename, @RequestParam("zonename") String zonename) {
  47. return cmdashboards.getSchemeDetails(schemename, zonename);
  48. }
  49. @GetMapping(value="/getTypeOfWorkDetails")
  50. public Map<String, Object> getTypeOfWorkDetails(@RequestParam("typeofwork") String typeofwork, @RequestParam("zonename") String zonename){
  51. return cmdashboards.getTypeOfWorkDetails(typeofwork, zonename);
  52. }
  53. @GetMapping(value="/getRegionzones")
  54. public Map<String,Object> getRegionsZonesDetails(@RequestParam("regionname") String regionname){
  55. return cmdashboards.getRegionDetails(regionname);
  56. }
  57. @GetMapping("/all-list/{id}")
  58. public Map<String, Object> getCMDetails(@PathVariable int id)
  59. {
  60. return cmdashboards.getCMDetails(id);
  61. }
  62. // Rest Api From ERP
  63. // @GetMapping(value = "/getZoneNo")
  64. // public String getZoneNo() {
  65. //
  66. // String urlString = appConfig.getErpUrl()+"serviceId=getZones";
  67. // ResponseEntity<String> response = null;
  68. // RestTemplate restTemplate = new RestTemplate();
  69. // String bodyMessage = "";
  70. // HttpHeaders headers = new HttpHeaders();
  71. // try {
  72. // HttpEntity<String> postData = new HttpEntity<String>(headers);
  73. // response = restTemplate.exchange(urlString, HttpMethod.POST, postData, String.class);
  74. // bodyMessage = response.getBody();
  75. // //System.out.println("BodyMessage" + bodyMessage);
  76. // } catch (Exception e) {
  77. // e.printStackTrace();
  78. // //System.out.print("\n ERROR---: " + e);
  79. // bodyMessage = "Error";
  80. // }
  81. // return bodyMessage;
  82. // }
  83. //
  84. // @GetMapping(value = "/getDiv")
  85. // public String getDiv(@RequestParam String zoneId) {
  86. // String urlString = appConfig.getErpUrl()+"serviceId=getWards&Zoneid="+zoneId+"";
  87. // ResponseEntity<String> response = null;
  88. // RestTemplate restTemplate = new RestTemplate();
  89. // String bodyMessage = "";
  90. // HttpHeaders headers = new HttpHeaders();
  91. // try {
  92. // HttpEntity<String> postData = new HttpEntity<String>(headers);
  93. // response = restTemplate.exchange(urlString, HttpMethod.POST, postData, String.class);
  94. // bodyMessage = response.getBody();
  95. // //System.out.println("bodyMessage" + bodyMessage);
  96. //
  97. // } catch (Exception e) {
  98. // e.printStackTrace();
  99. // //System.out.print("\n ERROR---: " + e);
  100. // bodyMessage = "Error";
  101. // }
  102. // return bodyMessage;
  103. // }
  104. }