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.

241 lines
8.4 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.pensioner.controller;
  2. import java.util.List;
  3. import java.util.Map;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.http.ResponseEntity;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.ui.Model;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.RequestParam;
  10. import org.springframework.web.bind.annotation.ResponseBody;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import in.gov.chennaicorporation.gccoffice.pensioner.service.DashboardApiService;
  13. @RestController
  14. public class DashboardApiController {
  15. @Autowired
  16. private DashboardApiService dashboardApiService;
  17. @GetMapping("/dashboard")
  18. @ResponseBody
  19. public List<Map<String, Object>> getDashboardData() {
  20. return dashboardApiService.fetchCategoryCounts();
  21. }
  22. /*@GetMapping("/dashboardsearch")
  23. @ResponseBody
  24. public List<Map<String, Object>> fetchDashboardData(
  25. @RequestParam(required = false) String startdate,
  26. @RequestParam(required = false) String enddate) {
  27. System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate);
  28. try {
  29. return dashboardApiService.fetchCategorysearchCounts(startdate, enddate);
  30. } catch (Exception e) {
  31. e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs
  32. throw e; // Rethrow the exception to propagate the 500 error
  33. }
  34. }
  35. @GetMapping("/categoryCounts")
  36. public List<Map<String, Object>> getCategoryCounts() {
  37. return dashboardApiService.fetchCategoryCounts();
  38. }
  39. @GetMapping("/getEmpNoByFileName")
  40. public List<Map<String, Object>> getEmployeeDetails(@RequestParam("file_id") String FileId) {
  41. System.out.println("before fetch");
  42. return dashboardApiService.getEmployeeDetails(FileId);
  43. }
  44. @GetMapping("/stageWiseCounts")
  45. public ResponseEntity<List<Map<String, Object>>> getStageWiseCounts() {
  46. List<Map<String, Object>> stageWiseCounts = dashboardApiService.getStageWiseCounts();
  47. return ResponseEntity.ok(stageWiseCounts);
  48. }*/
  49. @GetMapping("/getDepartments")
  50. @ResponseBody
  51. public List<Map<String, Object>> getDepartment() {
  52. return dashboardApiService.getDepartment();
  53. }
  54. @GetMapping("/getEmpNoByFileName")
  55. public List<Map<String, Object>> getEmployeeDetails(@RequestParam("file_id") String FileId) {
  56. System.out.println("before fetch");
  57. return dashboardApiService.getEmployeeDetails(FileId);
  58. }
  59. //department
  60. @GetMapping("/deparmentdashboard")
  61. @ResponseBody
  62. public List<Map<String, Object>> getDepartmentDashboardData(@RequestParam(required = false) String deptId) {
  63. System.out.println("deptid"+ deptId);
  64. return dashboardApiService.DepartmenfetchCategoryCounts(deptId);
  65. }
  66. /* @GetMapping("/deparmentcategoryCounts")
  67. public List<Map<String, Object>> getDepartmenCategoryCounts(@RequestParam(required = false) String deptId) {
  68. return dashboardApiService.DepartmenfetchCategoryCounts(deptId);
  69. }
  70. //DepartmentstageWiseCounts
  71. @GetMapping("/DepartmentstageWiseCounts")
  72. public ResponseEntity<List<Map<String, Object>>> getDepartmentStageWiseCounts(@RequestParam(required = false) String deptId) {
  73. List<Map<String, Object>> stageWiseCounts = dashboardApiService.getDepartmentStageWiseCounts(deptId);
  74. return ResponseEntity.ok(stageWiseCounts);
  75. }*/
  76. @GetMapping("/stageWiseCounts")
  77. public ResponseEntity<List<Map<String, Object>>> getDepartmentStageWiseCounts(
  78. @RequestParam(required = false) String deptId,
  79. @RequestParam(required = false) String startDate,
  80. @RequestParam(required = false) String endDate) {
  81. if(startDate.isEmpty())
  82. {
  83. startDate=null;
  84. }
  85. if(endDate.isEmpty())
  86. {
  87. endDate=null;
  88. }
  89. List<Map<String, Object>> stageWiseCounts = dashboardApiService.getStageWiseCounts(deptId, startDate, endDate);
  90. return ResponseEntity.ok(stageWiseCounts);
  91. }
  92. @GetMapping("/categoryCounts")
  93. public List<Map<String, Object>> getDepartmenCategoryCounts(
  94. @RequestParam(required = false) String deptId,
  95. @RequestParam(required = false) String startDate,
  96. @RequestParam(required = false) String endDate) {
  97. if(startDate.isEmpty())
  98. {
  99. startDate=null;
  100. }
  101. if(endDate.isEmpty())
  102. {
  103. endDate=null;
  104. }
  105. return dashboardApiService.fetchchartCategoryCounts(deptId, startDate, endDate);
  106. }
  107. @GetMapping("/dashboardsearch")
  108. @ResponseBody
  109. public List<Map<String, Object>> fetchDeparmentDashboardData(
  110. @RequestParam(required = false) String startdate,
  111. @RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) {
  112. if(deptId.isEmpty())
  113. {
  114. deptId=null;
  115. }
  116. System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate);
  117. try {
  118. return dashboardApiService.fetchCategorysearchCounts(startdate, enddate,deptId);
  119. } catch (Exception e) {
  120. e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs
  121. throw e; // Rethrow the exception to propagate the 500 error
  122. }
  123. }
  124. //pension
  125. @GetMapping("/pensiondashboard")
  126. @ResponseBody
  127. public List<Map<String, Object>> getPensionDashboardData(@RequestParam(required = false) String deptId) {
  128. System.out.println("deptid"+ deptId);
  129. return dashboardApiService.DepartmenfetchCategoryCounts(deptId);
  130. }
  131. /* @GetMapping("/pensiondashboardsearch")
  132. @ResponseBody
  133. public List<Map<String, Object>> fetchpensionDashboardData(
  134. @RequestParam(required = false) String startdate,
  135. @RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) {
  136. if(deptId.isEmpty())
  137. {
  138. deptId=null;
  139. }
  140. System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate);
  141. try {
  142. return dashboardApiService.fetchDeparmentCategorysearchCounts(startdate, enddate,deptId);
  143. } catch (Exception e) {
  144. e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs
  145. throw e; // Rethrow the exception to propagate the 500 error
  146. }
  147. }*/
  148. /* @GetMapping("/pensioncategoryCounts")
  149. public List<Map<String, Object>> getpensionCategoryCounts(
  150. @RequestParam(required = false) String deptId,
  151. @RequestParam(required = false) String startDate,
  152. @RequestParam(required = false) String endDate) {
  153. if(startDate.isEmpty())
  154. {
  155. startDate=null;
  156. }
  157. if(endDate.isEmpty())
  158. {
  159. endDate=null;
  160. }
  161. return dashboardApiService.DepartmenfetchDepartmentCategoryCounts(deptId, startDate, endDate);
  162. }*/
  163. /* @GetMapping("/pensionstageWiseCounts")
  164. public ResponseEntity<List<Map<String, Object>>> getpensionStageWiseCounts(
  165. @RequestParam(required = false) String deptId,
  166. @RequestParam(required = false) String startDate,
  167. @RequestParam(required = false) String endDate) {
  168. if(startDate.isEmpty())
  169. {
  170. startDate=null;
  171. }
  172. if(endDate.isEmpty())
  173. {
  174. endDate=null;
  175. }
  176. List<Map<String, Object>> stageWiseCounts = dashboardApiService.getDepartmentStageWiseCounts(deptId, startDate, endDate);
  177. return ResponseEntity.ok(stageWiseCounts);
  178. }*/
  179. @GetMapping("/fetchEmpDetails")
  180. public List<Map<String, Object>> getEmpDetails(@RequestParam(required = false) String Empcode) {
  181. System.out.println("checking");
  182. System.out.println(Empcode);
  183. return dashboardApiService.getEmpDetails(Empcode);
  184. }
  185. @GetMapping("/fetchPensionEmpDetails")
  186. public List<Map<String, Object>> getPensionEmpDetails(@RequestParam(required = false) String Empcode) {
  187. System.out.println("checking");
  188. System.out.println(Empcode);
  189. return dashboardApiService.getPensionEmpDetails(Empcode);
  190. }
  191. @GetMapping("/fetchTempDetails")
  192. public List<Map<String, Object>> getTempEmpDetails(@RequestParam(required = false) String tempId) {
  193. System.out.println("checking");
  194. System.out.println(tempId);
  195. return dashboardApiService.getTempEmpDetails(tempId);
  196. }
  197. }