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.

143 lines
5.1 KiB

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