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.

140 lines
5.0 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.pensioner.controller;
  2. import java.util.Collections;
  3. import java.util.List;
  4. import java.util.Map;
  5. import org.hibernate.internal.build.AllowSysOut;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.http.HttpStatus;
  8. import org.springframework.http.ResponseEntity;
  9. import org.springframework.stereotype.Controller;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13. import in.gov.chennaicorporation.gccoffice.pensioner.service.ReportApiService;
  14. @Controller
  15. public class ReportApiController {
  16. @Autowired
  17. private ReportApiService reportApiService;
  18. //pensioner and report side common dropdown
  19. @GetMapping("/getFileCategories")
  20. @ResponseBody
  21. public ResponseEntity<?> getFileCategories() {
  22. try {
  23. List<Map<String, Object>> categories = reportApiService.getFileCategories();
  24. return ResponseEntity.ok(categories);
  25. } catch (Exception e) {
  26. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
  27. .body(Collections.singletonMap("error", "Failed to fetch categories"));
  28. }
  29. }
  30. @GetMapping("/getReportData")
  31. @ResponseBody
  32. public List<Map<String, Object>> getReportData(@RequestParam String startDate,
  33. @RequestParam String endDate,
  34. @RequestParam String deptId
  35. ) {
  36. return reportApiService.getReportData(startDate, endDate, deptId);
  37. }
  38. @GetMapping("/getReportDetails")
  39. @ResponseBody
  40. public List<Map<String, Object>> getReportDetails(@RequestParam String startDate,
  41. @RequestParam String endDate,
  42. @RequestParam Integer deptId,
  43. @RequestParam Integer fileCatId,
  44. @RequestParam(required = false) List<String> fileStatus
  45. ) {
  46. System.out.println("startdate>>>>>"+startDate);
  47. System.out.println("endDate>>>>>"+endDate);
  48. System.out.println("deptId>>>>>"+deptId);
  49. System.out.println("fileCatId>>>>>"+fileCatId);
  50. System.out.println("fileStatus>>>>>"+fileStatus);
  51. return reportApiService.getReportDetails(startDate, endDate, deptId,fileCatId,fileStatus);
  52. }
  53. //pensioner side report dropdown
  54. @GetMapping("/getdepartment")
  55. @ResponseBody
  56. public ResponseEntity<?> getdepartment() {
  57. try {
  58. List<Map<String, Object>> categories = reportApiService.getdepartment();
  59. return ResponseEntity.ok(categories);
  60. } catch (Exception e) {
  61. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
  62. .body(Collections.singletonMap("error", "Failed to fetch categories"));
  63. }
  64. }
  65. @GetMapping("/getstatus")
  66. @ResponseBody
  67. public ResponseEntity<?> getstatus() {
  68. try {
  69. List<Map<String, Object>> categories = reportApiService.getstatus();
  70. return ResponseEntity.ok(categories);
  71. } catch (Exception e) {
  72. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
  73. .body(Collections.singletonMap("error", "Failed to fetch categories"));
  74. }
  75. }
  76. @GetMapping("/getReportDatapension")
  77. @ResponseBody
  78. public List<Map<String, Object>> getReportDatapension(@RequestParam String startDate,
  79. @RequestParam String endDate,
  80. @RequestParam(required = true) String fileCategoryId)
  81. {
  82. System.out.println("fileCategoryId ========>"+fileCategoryId);
  83. return reportApiService.getReportDatapension(startDate, endDate, fileCategoryId);
  84. }
  85. @GetMapping("/getReportDetailspension")
  86. @ResponseBody
  87. public List<Map<String, Object>> getReportDetailspension(@RequestParam String startDate,
  88. @RequestParam String endDate,
  89. @RequestParam List<String> deptIds,
  90. @RequestParam Integer fileCatId,
  91. @RequestParam(required = false) List<String> fileStatus) {
  92. System.out.println("startdate>>>>>"+startDate);
  93. System.out.println("endDate>>>>>"+endDate);
  94. System.out.println("deptIds: " + deptIds);
  95. System.out.println("fileCatId>>>>>"+fileCatId);
  96. System.out.println("fileStatus>>>>>"+fileStatus);
  97. return reportApiService.getReportDetailspension(startDate, endDate, deptIds, fileCatId, fileStatus);
  98. }
  99. @GetMapping("/getPensionerDetails")
  100. @ResponseBody
  101. public List<Map<String, Object>> getDepartmentpending(@RequestParam int file_category ) {
  102. return reportApiService.getDepartmentpending(file_category);
  103. }
  104. }