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.

177 lines
5.9 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.pensioner.service;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Map;
  5. import javax.sql.DataSource;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.beans.factory.annotation.Qualifier;
  8. import org.springframework.jdbc.core.JdbcTemplate;
  9. import org.springframework.stereotype.Service;
  10. import org.springframework.web.client.RestTemplate;
  11. import com.fasterxml.jackson.databind.ObjectMapper;
  12. import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
  13. @Service
  14. public class CompletedService {
  15. @Autowired
  16. private JdbcTemplate jdbcTemplate;
  17. private RestTemplate restTemplate;
  18. private ObjectMapper objectMapper;
  19. @Autowired
  20. private AppConfig appconfig;
  21. public CompletedService(RestTemplate restTemplate, ObjectMapper objectMapper) {
  22. this.restTemplate = restTemplate;
  23. this.objectMapper = objectMapper;
  24. }
  25. @Autowired
  26. public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) {
  27. this.jdbcTemplate = new JdbcTemplate(dataSource);
  28. }
  29. public List<Map<String, Object>> getCPSList(Integer file_cat,Integer deptId) {
  30. String query = "SELECT * FROM cps_pensioner_details where file_category = ? and dept_id=? and file_status=11 ";
  31. try {
  32. return jdbcTemplate.queryForList(query,file_cat,deptId);
  33. } catch (Exception e) {
  34. e.printStackTrace();
  35. return new ArrayList<>();
  36. }
  37. }
  38. ///////////////////CPS completed list method///////////
  39. public List<Map<String, Object>> getCPSListPensionside(Integer file_cat) {
  40. String query = "SELECT * FROM cps_pensioner_details where file_category = ? and file_status=11 ";
  41. try {
  42. return jdbcTemplate.queryForList(query,file_cat);
  43. } catch (Exception e) {
  44. e.printStackTrace();
  45. return new ArrayList<>();
  46. }
  47. }
  48. public List<Map<String, Object>> getCPSListByEmpNo(String empNo) {
  49. String query = "SELECT * FROM cps_pensioner_details WHERE emp_no = ?";
  50. try {
  51. return jdbcTemplate.queryForList(query, empNo);
  52. } catch (Exception e) {
  53. e.printStackTrace();
  54. return new ArrayList<>();
  55. }
  56. }
  57. ////////////////////////////
  58. ////////Retirement completed list method///////////////////
  59. public List<Map<String, Object>> fetchDetailsCompletedRetirement(Integer file_cat,Integer deptId) {
  60. String query = "SELECT * " +
  61. "FROM pensioner_details " +
  62. "WHERE file_category=? AND dept_id=? and file_status=11 AND is_closed=0";
  63. return jdbcTemplate.queryForList(query,file_cat,deptId);
  64. }
  65. public List<Map<String, Object>> fetchDetailsCompletedRetirementPensionside(Integer file_cat) {
  66. String query = "SELECT * " +
  67. "FROM pensioner_details " +
  68. "WHERE file_category=? and file_status=11 AND is_closed=0";
  69. return jdbcTemplate.queryForList(query,file_cat);
  70. }
  71. /////////////////////////
  72. ///////////////////Family pension completed list method//////////////
  73. public List<Map<String, Object>> fetchDetailsCompletedFamilyPension(Integer file_cat,Integer deptId) {
  74. String query = "SELECT * " +
  75. "FROM pensioner_details " +
  76. "WHERE file_category=? AND dept_id=? and file_status=11";
  77. return jdbcTemplate.queryForList(query,file_cat,deptId);
  78. }
  79. public List<Map<String, Object>> fetchDetailsCompletedFamilyPensionPensionSide(Integer file_cat) {
  80. String query = "SELECT * " +
  81. "FROM pensioner_details " +
  82. "WHERE file_category=? and file_status=11";
  83. return jdbcTemplate.queryForList(query,file_cat);
  84. }
  85. //////////////////////////
  86. ///////////////Pendency completed method////////////////
  87. public List<Map<String, Object>> fetchDetailsCompletedPendency(Integer file_cat,Integer deptId) {
  88. String query = "SELECT * " +
  89. "FROM pensioner_details " +
  90. "WHERE file_category=? AND dept_id=? and file_status=11";
  91. return jdbcTemplate.queryForList(query,file_cat,deptId);
  92. }
  93. public List<Map<String, Object>> fetchDetailsCompletedPendencyPensionSide(Integer file_cat) {
  94. String query = "SELECT * " +
  95. "FROM pensioner_details " +
  96. "WHERE file_category=? and file_status=11";
  97. return jdbcTemplate.queryForList(query,file_cat);
  98. }
  99. //////////////////////
  100. ////////////Gis completed list method
  101. public List<Map<String, Object>> fetchDetailsForrecivedGiscompleted(Integer file_cat,Integer deptId) {
  102. String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND dept_id=? AND file_status = 11";
  103. return jdbcTemplate.queryForList(query,file_cat,deptId);
  104. }
  105. public List<Map<String, Object>> fetchDetailsForrecivedGiscompletedPensionside(Integer file_cat) {
  106. String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND file_status = 11";
  107. return jdbcTemplate.queryForList(query,file_cat);
  108. }
  109. ////////////////Provisional retirement completed list method
  110. public List<Map<String, Object>> fetchDetailsProvisionalDepartmentCompleted(Integer file_cat,Integer deptId) {
  111. String query = "SELECT * " +
  112. "FROM pensioner_details " +
  113. "WHERE file_category=? AND dept_id=? and file_status=11";
  114. return jdbcTemplate.queryForList(query,file_cat,deptId);
  115. }
  116. public List<Map<String, Object>> fetchDetailsProvisionalDepartmentPensionside(Integer file_cat) {
  117. String query = "SELECT * " +
  118. "FROM pensioner_details " +
  119. "WHERE file_category=? and file_status=11";
  120. return jdbcTemplate.queryForList(query,file_cat);
  121. }
  122. }