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.

94 lines
3.9 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
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.HttpStatus;
  6. import org.springframework.http.ResponseEntity;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService;
  12. import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService;
  13. @RequestMapping("gcc/api/department/received")
  14. @RestController
  15. public class PensionReceivedApiController {
  16. @Autowired
  17. private DeptAuditService deptAuditService;
  18. @Autowired
  19. private PensionReceivedService pensionReceivedService;
  20. @PostMapping("/updateEmployeeDetails")
  21. public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) {
  22. try {
  23. // Call service method to save
  24. String empNo = (String) requestData.get("empNo");
  25. String tempId = (String) requestData.get("tempId");
  26. String filemovedby =(String)requestData.get("filemovedby");
  27. boolean isSaved = pensionReceivedService.updateEntryDetails(requestData);
  28. if (isSaved) {
  29. List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId);
  30. System.out.println("emp_details:==:"+emp_details);
  31. List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId);
  32. System.out.println("zone_benefits:==:"+zone_benefits);
  33. boolean updated=pensionReceivedService.saveHistory(emp_details,zone_benefits,filemovedby);
  34. if(updated)
  35. {
  36. return ResponseEntity.ok("File moved to Pension successfully!");
  37. }
  38. else {
  39. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history.");
  40. }
  41. } else {
  42. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details.");
  43. }
  44. } catch (Exception e) {
  45. e.printStackTrace();
  46. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details.");
  47. }
  48. }
  49. //gis
  50. @PostMapping("/updateEmployeeDetailsgis")
  51. public ResponseEntity<String> updateEmployeeDetailsGis(@RequestBody Map<String, Object> requestData) {
  52. try {
  53. // Call service method to save
  54. String tempId = (String) requestData.get("tempId");
  55. String filemovedby =(String)requestData.get("filemovedby");
  56. boolean isSaved = pensionReceivedService.updateEntryGisDetails(requestData);
  57. if (isSaved) {
  58. List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId);
  59. System.out.println("emp_details:==:"+emp_details);
  60. boolean updated=pensionReceivedService.savehistoryGis(emp_details,filemovedby);
  61. if(updated)
  62. {
  63. return ResponseEntity.ok("File completed successfully!");
  64. }
  65. else {
  66. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history.");
  67. }
  68. } else {
  69. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details.");
  70. }
  71. } catch (Exception e) {
  72. e.printStackTrace();
  73. return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details.");
  74. }
  75. }
  76. }