604 changed files with 212411 additions and 8183 deletions
-
BIN.DS_Store
-
BINbin/target/gccoffice-0.0.1.jar
-
BINgccoffice_uploads/.DS_Store
-
BINgccoffice_uploads/app_uploads/.DS_Store
-
BINgccoffice_uploads/com_petition/.DS_Store
-
BINgccoffice_uploads/gcc_minutes_files_uploads/.DS_Store
-
BINgccoffice_uploads/gcc_works_files/.DS_Store
-
BINgccoffice_uploads/gcc_works_files/2025/.DS_Store
-
BINgccoffice_uploads/gcc_works_files/works/.DS_Store
-
BINgccoffice_uploads/gcc_works_files/works/erp/.DS_Store
-
BINgccoffice_uploads/gcc_works_files/works/nonerp/.DS_Store
-
BINgccoffice_uploads/gcc_works_files/works/projectStatus/.DS_Store
-
BINgccoffice_uploads/gcc_works_files2025/.DS_Store
-
BINgccoffice_uploads/m_petition/.DS_Store
-
BINgccoffice_uploads/m_petition/m_action_file/.DS_Store
-
BINgccoffice_uploads/zh_petition/.DS_Store
-
8pom.xml
-
84src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/Petition.java
-
17src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/AgentAssignAPIController.java
-
181src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/AgentsAPIController.java
-
521src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/CampaignAPIController.java
-
29src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/CampaignDropdownApiController.java
-
100src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/CampaignReportAPIController.java
-
229src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/CategoryAPIController.java
-
57src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/controller/MainController.java
-
246src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/AddcategoryServices.java
-
119src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/AgentAssignService.java
-
403src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/AgentsService.java
-
29src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/CampaignDropdownApiService.java
-
494src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/CampaignReportService.java
-
492src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/CampaignService.java
-
36src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/AttendanceApiController.java
-
71src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/AttendanceMainController.java
-
441src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ComplaintController.java
-
31src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ComplaintStatusMainController.java
-
10src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/FollowUpController.java
-
10src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/InprogresscallController.java
-
136src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/MainController.java
-
10src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/PublicFollowUpController.java
-
118src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAPIController.java
-
208src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAdminSettingsApiController.java
-
47src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAdminSettingsMainController.java
-
15src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAgentAssignAPIController.java
-
18src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAgentsAPIController.java
-
30src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcCallsController.java
-
26src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcPgrComplaintsMainController.java
-
6src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcTaskListAPIController.java
-
58src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ReportsMainController.java
-
349src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/SocialMediaApiController.java
-
41src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/SocialMediaMainController.java
-
10src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/StatusCountController.java
-
14src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/FollowUpService.java
-
6src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/InprogresscallService.java
-
24src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAdminSettingService.java
-
73src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAgentAssignService.java
-
16src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAgentsService.java
-
22src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcCallsService.java
-
218src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcService.java
-
57src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcTaskListService.java
-
16src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/SocialMediaService.java
-
60src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/StatusCountService.java
-
174src/main/java/in/gov/chennaicorporation/gccoffice/cdwaste/controller/DumpRegistrationAPIController.java
-
75src/main/java/in/gov/chennaicorporation/gccoffice/cdwaste/controller/MainController.java
-
161src/main/java/in/gov/chennaicorporation/gccoffice/cdwaste/service/OfficerService.java
-
40src/main/java/in/gov/chennaicorporation/gccoffice/cdwaste/service/SMSService.java
-
44src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/APIController.java
-
104src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/service/Petition.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java
-
91src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
-
2src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java
-
22src/main/java/in/gov/chennaicorporation/gccoffice/controller/MenuController.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/entity/SubMenuItemAccessEntity.java
-
12src/main/java/in/gov/chennaicorporation/gccoffice/entity/SubMenuItemEntity.java
-
13src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java
-
194src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java
-
57src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java
-
77src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmController.java
-
139src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java
-
56src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/CompletedApiController.java
-
241src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DashboardApiController.java
-
129src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DepartmentForwardApiController.java
-
720src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DepartmentMainController.java
-
176src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DepartmentReceivedApiController.java
-
189src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DeptAuditApiController.java
-
110src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DeptPartiallyCompApiController.java
-
46src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DropdownApiController.java
-
120src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/FileClosingApiController.java
-
60src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/FileClosingMainController.java
-
334src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/NewEntryAPIController.java
-
201src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/PendencyAutoConversionApiController.java
-
134src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/PensionAuditApiController.java
-
110src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/PensionPartiallyCompApiController.java
-
94src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/PensionReceivedApiController.java
-
625src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/PensionerMainController.java
-
145src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/ReceivedDeptProvisionalApiController.java
-
143src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/ReportApiController.java
-
129src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/ReturnFromAuditApiController.java
-
229src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/scheduler/PendencyAutoConversionScheduler.java
-
180src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/service/CompletedService.java
-
402src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/service/DashboardApiService.java
@ -0,0 +1,29 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenter.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
|
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenter.service.CampaignDropdownApiService; |
||||
|
|
||||
|
@RequestMapping("gcc/api") |
||||
|
@RestController |
||||
|
public class CampaignDropdownApiController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private CampaignDropdownApiService dropdownApiService; |
||||
|
|
||||
|
@GetMapping("/getAnswerTypes") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getAnswerTypes() { |
||||
|
return dropdownApiService.getAnswerTypes(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenter.controller; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.io.PrintWriter; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenter.service.CampaignReportService; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("gcc/api/campaignreport") |
||||
|
public class CampaignReportAPIController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CampaignReportService campaignReportService; |
||||
|
|
||||
|
@GetMapping("/getcampaignData") |
||||
|
public List<Map<String, Object>> getCampaignData( |
||||
|
@RequestParam(required = false) String startDate, |
||||
|
@RequestParam(required = false) String endDate) { |
||||
|
|
||||
|
List<Map<String, Object>> campaignData = campaignReportService.getCampaignData(startDate, endDate); |
||||
|
//System.out.println("Campaign Data: " + campaignData); // Debugging log |
||||
|
return campaignData; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getagentdatacount") |
||||
|
public List<Map<String, Object>> getAgentwiseData(@RequestParam String campaign_id) { |
||||
|
List<Map<String, Object>> agentData = campaignReportService.getAgentwiseData(campaign_id); |
||||
|
//System.out.println("Agent Data: " + agentData); |
||||
|
return agentData; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getReportCampaignid") |
||||
|
public ResponseEntity<?> getAgentReportCampaignId(@RequestParam String campaign_id) { |
||||
|
|
||||
|
List<Map<String, Object>> agentData = campaignReportService.getAgentReportCampaignId(campaign_id); |
||||
|
//System.out.println("Agent Data: " + agentData); |
||||
|
return ResponseEntity.ok(agentData); |
||||
|
} |
||||
|
|
||||
|
//question and answers report page api |
||||
|
@GetMapping("/question-answers") |
||||
|
public ResponseEntity<?> getQuestionAnswers(@RequestParam int campaign_id) { |
||||
|
List<Map<String, Object>> response = campaignReportService.getQuestionAnswers(campaign_id); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
// @GetMapping("/download-excel") |
||||
|
// public void downloadFilteredCSV( |
||||
|
// @RequestParam int categoryId, |
||||
|
// @RequestParam int campaignId, |
||||
|
// |
||||
|
// |
||||
|
// |
||||
|
// HttpServletResponse response) throws IOException { |
||||
|
// |
||||
|
// // Set response headers |
||||
|
// response.setContentType("text/csv"); |
||||
|
// response.setHeader("Content-Disposition", "attachment; filename=filtered_data.csv"); |
||||
|
// |
||||
|
// // Generate CSV and write to response |
||||
|
// PrintWriter writer = response.getWriter(); |
||||
|
// campaignReportService.generateCSV(categoryId, campaignId, writer); |
||||
|
// writer.flush(); |
||||
|
// writer.close(); |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
@GetMapping("/download-excel") |
||||
|
public void downloadFilteredCSV( |
||||
|
@RequestParam int categoryId, |
||||
|
@RequestParam int campaignId, |
||||
|
HttpServletResponse response) throws IOException { |
||||
|
|
||||
|
String filename = campaignReportService.getCampaignName(campaignId); |
||||
|
// Format campaign name for file safety (remove spaces/special characters) |
||||
|
//String safeCampaignName = filename.replaceAll("[^a-zA-Z0-9]", "_"); |
||||
|
|
||||
|
// Set response headers |
||||
|
response.setContentType("text/csv"); |
||||
|
response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".csv"); |
||||
|
|
||||
|
// Generate CSV and write to response |
||||
|
PrintWriter writer = response.getWriter(); |
||||
|
campaignReportService.generateCSV(categoryId, campaignId, writer); |
||||
|
writer.flush(); |
||||
|
writer.close(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenter.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class CampaignDropdownApiService { |
||||
|
|
||||
|
@Autowired |
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSource(@Qualifier("mysql1913CampaignDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String,Object>> getAnswerTypes(){ |
||||
|
String sql = "SELECT answer_type_id,type_name FROM answer_type"; |
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,494 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenter.service; |
||||
|
|
||||
|
import java.io.PrintWriter; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.LinkedHashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class CampaignReportService { |
||||
|
|
||||
|
|
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSourcemysql(@Qualifier("mysql1913CampaignDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSource2(@Qualifier("mysql1913QAQCDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getCampaignData(String startDate, String endDate) { |
||||
|
StringBuilder query = new StringBuilder( |
||||
|
"SELECT " + |
||||
|
" cr.campaign_id, " + |
||||
|
" cr.category_id, " + |
||||
|
" cr.campaign_name, " + |
||||
|
" cc.category_name, " + |
||||
|
" cr.start_date, " + |
||||
|
" cr.end_date, " + |
||||
|
" COUNT(ud.campaign_id) AS total_count, " + |
||||
|
" COUNT(ud.agent_id) AS assigned_count, " + |
||||
|
" COUNT(ud.campaign_id) - COUNT(ud.agent_id) AS not_assigned_count, " + |
||||
|
" COUNT(CASE WHEN ud.call_status = 'INFORMATION GIVEN' THEN 1 ELSE NULL END) AS informationgiven_count, " + |
||||
|
" COUNT(CASE WHEN ud.call_status = 'CALL BACK LATER' THEN 1 ELSE NULL END) AS callback_count, " + |
||||
|
" COUNT(CASE WHEN ud.call_status = 'UNATTENDED' THEN 1 ELSE NULL END) AS unattended_count, " + |
||||
|
" COUNT(CASE WHEN ud.call_status = 'SWITCH OFF' THEN 1 ELSE NULL END) AS switchoff_count, " + |
||||
|
" COUNT(CASE WHEN ud.call_status = 'WRONG NUMBER' THEN 1 ELSE NULL END) AS wrongnumber_count " + |
||||
|
"FROM gcc_1913_campaign.campaign_request cr " + |
||||
|
"JOIN gcc_1913_campaign.upload_data ud ON cr.campaign_id = ud.campaign_id " + |
||||
|
"JOIN gcc_1913_campaign.category cc ON cr.category_id = cc.category_id " + |
||||
|
"WHERE cr.campaign_status IN ('ONGOING', 'CLOSED') " + |
||||
|
"AND ud.agent_id IS NOT NULL " |
||||
|
); |
||||
|
|
||||
|
// Apply date filter dynamically if dates are provided |
||||
|
if (startDate != null && endDate != null) { |
||||
|
query.append("AND DATE(cr.created_date) BETWEEN ? AND ? "); |
||||
|
} |
||||
|
|
||||
|
query.append("GROUP BY cr.campaign_id "); |
||||
|
query.append("ORDER BY cr.campaign_id DESC"); |
||||
|
|
||||
|
// Execute query with or without parameters |
||||
|
if (startDate != null && endDate != null) { |
||||
|
return jdbcTemplate.queryForList(query.toString(), startDate, endDate); |
||||
|
} else { |
||||
|
return jdbcTemplate.queryForList(query.toString()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getAgentwiseData(String campaignId) { |
||||
|
String query = "SELECT aa.agent_id, al.agent_name, \r\n" |
||||
|
+ " COUNT(ud.agent_id) AS assigned_count, \r\n" |
||||
|
+ " COUNT(CASE WHEN ud.is_processed = 1 THEN 1 ELSE NULL END) AS completed_count, \r\n" |
||||
|
+ " COUNT(ud.agent_id) - COUNT(CASE WHEN ud.is_processed = 1 THEN 1 ELSE NULL END) AS pending_count, \r\n" |
||||
|
+ " COUNT(CASE WHEN ud.call_status = 'INFORMATION GIVEN' THEN 1 ELSE NULL END) AS informationgiven_count, \r\n" |
||||
|
+ " COUNT(CASE WHEN ud.call_status = 'CALL BACK LATER' THEN 1 ELSE NULL END) AS callback_count, \r\n" |
||||
|
+ " COUNT(CASE WHEN ud.call_status = 'UNATTENDED' THEN 1 ELSE NULL END) AS unattended_count, \r\n" |
||||
|
+ " COUNT(CASE WHEN ud.call_status = 'SWITCH OFF' THEN 1 ELSE NULL END) AS switchoff_count, \r\n" |
||||
|
+ " COUNT(CASE WHEN ud.call_status = 'WRONG NUMBER' THEN 1 ELSE NULL END) AS wrongnumber_count, \r\n" |
||||
|
+ " CASE \r\n" |
||||
|
+ " WHEN COUNT(ud.agent_id) = 0 THEN 0 \r\n" |
||||
|
+ " ELSE FLOOR((COUNT(CASE WHEN ud.is_processed = 1 THEN 1 ELSE NULL END) * 100) / COUNT(ud.agent_id))\r\n" |
||||
|
+ " END AS completed_percentage\r\n" |
||||
|
+ "FROM gcc_1913_campaign.agent_assign aa \r\n" |
||||
|
+ "JOIN gcc_1913_qaqc.agents_list al ON al.agent_id = aa.agent_id \r\n" |
||||
|
+ "JOIN gcc_1913_campaign.upload_data ud ON ud.agent_id = aa.agent_id AND ud.campaign_id = aa.campaign_id\r\n" |
||||
|
+ "WHERE aa.campaign_id = ? AND aa.isactive = 1 AND aa.isdelete = 0 AND ud.agent_id IS NOT NULL \r\n" |
||||
|
+ "GROUP BY aa.agent_id, al.agent_name \r\n" |
||||
|
+ "ORDER BY aa.agent_id"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(query, campaignId); |
||||
|
} |
||||
|
|
||||
|
//report for campaign details |
||||
|
public List<Map<String, Object>> getAgentReportCampaignId(String campaignId) { |
||||
|
String query = "SELECT cr.category_id,cr.campaign_id, cc.category_name, \r\n" |
||||
|
+ " cr.start_date, cr.end_date, \r\n" |
||||
|
+ " cr.description, date (cr.created_date) as created_date \r\n" |
||||
|
+ " FROM gcc_1913_campaign.category cc \r\n" |
||||
|
+ " join gcc_1913_campaign.campaign_request cr on cr.category_id = cc.category_id \r\n" |
||||
|
+ " where cr.campaign_id = ?;"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(query, campaignId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//get campaignname |
||||
|
public String getCampaignName(int campaignId) { |
||||
|
String query = "SELECT campaign_name FROM gcc_1913_campaign.campaign_request WHERE campaign_id = ?"; |
||||
|
|
||||
|
return jdbcTemplate.queryForObject(query, String.class, campaignId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//question and answers counts with percentage in report page method |
||||
|
|
||||
|
public List<Map<String, Object>> getQuestionAnswers(int campaignId) { |
||||
|
String sql = "SELECT cq.question_id, cq.questions, ca.campaign_answer," |
||||
|
+ " COUNT(qa.campaign_answer) AS answer_count," |
||||
|
+ " FLOOR(" |
||||
|
+ " IFNULL((COUNT(qa.campaign_answer) / NULLIF(total_info.total_information_given, 0)) * 100, 0)" |
||||
|
+ " ) AS answer_percentage" |
||||
|
+ " FROM " |
||||
|
+ " gcc_1913_campaign.campaign_questions cq" |
||||
|
+ " JOIN " |
||||
|
+ " gcc_1913_campaign.campaign_answers ca " |
||||
|
+ " ON cq.question_id = ca.question_id AND cq.campaign_id = ca.campaign_id" |
||||
|
+ " LEFT JOIN " |
||||
|
+ " gcc_1913_campaign.questions_answers qa " |
||||
|
+ " ON cq.question_id = qa.question_id " |
||||
|
+ " AND ca.campaign_answer = qa.campaign_answer " |
||||
|
+ " AND cq.campaign_id = qa.campaign_id" |
||||
|
+ " LEFT JOIN (" |
||||
|
+ " SELECT campaign_id, COUNT(*) AS total_information_given" |
||||
|
+ " FROM gcc_1913_campaign.upload_data " |
||||
|
+ " WHERE call_status = 'INFORMATION GIVEN'" |
||||
|
+ " GROUP BY campaign_id" |
||||
|
+ " ) AS total_info ON total_info.campaign_id = cq.campaign_id" |
||||
|
+ " WHERE " |
||||
|
+ " cq.campaign_id = ? " |
||||
|
+ " AND cq.isactive = 1 " |
||||
|
+ " AND cq.isdelete = 0" |
||||
|
+ " GROUP BY " |
||||
|
+ " cq.question_id, cq.questions, ca.campaign_answer, total_info.total_information_given" |
||||
|
+ " ORDER BY " |
||||
|
+ " cq.question_id"; |
||||
|
|
||||
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, campaignId); |
||||
|
Map<Integer, Map<String, Object>> responseMap = new LinkedHashMap<>(); |
||||
|
|
||||
|
for (Map<String, Object> row : result) { |
||||
|
int questionId = (int) row.get("question_id"); |
||||
|
if (!responseMap.containsKey(questionId)) { |
||||
|
Map<String, Object> questionData = new HashMap<>(); |
||||
|
questionData.put("question_id", questionId); |
||||
|
questionData.put("questions", row.get("questions")); |
||||
|
questionData.put("answers", new ArrayList<>()); |
||||
|
responseMap.put(questionId, questionData); |
||||
|
} |
||||
|
|
||||
|
Map<String, Object> answerData = new HashMap<>(); |
||||
|
answerData.put("campaign_answer", row.get("campaign_answer")); |
||||
|
answerData.put("answer_count", row.get("answer_count")); |
||||
|
answerData.put("answer_percentage", row.get("answer_percentage")); |
||||
|
|
||||
|
((List<Map<String, Object>>) responseMap.get(questionId).get("answers")).add(answerData); |
||||
|
} |
||||
|
|
||||
|
return new ArrayList<>(responseMap.values()); |
||||
|
} |
||||
|
|
||||
|
// |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// public void generateCSV(int categoryId, int campaignId, PrintWriter writer) { |
||||
|
// List<Map<String, Object>> resultList = new ArrayList<>(); |
||||
|
// |
||||
|
// // Fetch ordered field column names |
||||
|
// String fetchColumnsSQL = "SELECT COLUMN_NAME " + |
||||
|
// "FROM INFORMATION_SCHEMA.COLUMNS " + |
||||
|
// "WHERE TABLE_SCHEMA = 'gcc_1913_campaign' " + |
||||
|
// "AND TABLE_NAME = 'upload_data' " + |
||||
|
// "AND COLUMN_NAME LIKE 'field_%' " + |
||||
|
// "ORDER BY CAST(SUBSTRING(COLUMN_NAME, 7) AS UNSIGNED)"; |
||||
|
// |
||||
|
// List<String> fieldColumns = jdbcTemplate.queryForList(fetchColumnsSQL, String.class); |
||||
|
// |
||||
|
// if (fieldColumns.isEmpty()) { |
||||
|
// writer.println("No matching columns found"); |
||||
|
// return; |
||||
|
// } |
||||
|
// |
||||
|
// // Fetch ordered fields data based on campaign_id, including data_id, agent_id, and call_status |
||||
|
// String query1 = "SELECT data_id, " + String.join(", ", fieldColumns) + ", agent_id, call_status,remarks " + |
||||
|
// "FROM gcc_1913_campaign.upload_data WHERE campaign_id = ?"; |
||||
|
// |
||||
|
// List<Map<String, Object>> orderedFieldsList = jdbcTemplate.queryForList(query1, campaignId); |
||||
|
// |
||||
|
// if (orderedFieldsList.isEmpty()) { |
||||
|
// writer.println("No data found for campaign_id: " + campaignId); |
||||
|
// return; |
||||
|
// } |
||||
|
// |
||||
|
// // Fetch category columns |
||||
|
// String query2 = "SELECT column_name FROM gcc_1913_campaign.category_columns WHERE category_id = ? AND isactive=1"; |
||||
|
// List<String> categoryColumns = jdbcTemplate.queryForList(query2, String.class, categoryId); |
||||
|
// |
||||
|
// if (categoryColumns.isEmpty()) { |
||||
|
// writer.println("No category columns found for category_id: " + categoryId); |
||||
|
// return; |
||||
|
// } |
||||
|
// |
||||
|
// int categoryCount = categoryColumns.size(); |
||||
|
// |
||||
|
// // Fetch Agent Names from agent_id |
||||
|
// String fetchAgentSQL = "SELECT agent_id, agent_name FROM gcc_1913_qaqc.agents_list"; |
||||
|
// Map<Integer, String> agentMap = jdbcTemplate.query(fetchAgentSQL, rs -> { |
||||
|
// Map<Integer, String> map = new HashMap<>(); |
||||
|
// while (rs.next()) { |
||||
|
// map.put(rs.getInt("agent_id"), rs.getString("agent_name")); |
||||
|
// } |
||||
|
// return map; |
||||
|
// }); |
||||
|
// |
||||
|
// // Fetch Questions for given campaign_id |
||||
|
// String fetchQuestionsQuery = "SELECT question_id, questions FROM gcc_1913_campaign.campaign_questions WHERE campaign_id = ?"; |
||||
|
// Map<Integer, String> questionsMap = jdbcTemplate.query(fetchQuestionsQuery, rs -> { |
||||
|
// Map<Integer, String> map = new LinkedHashMap<>(); |
||||
|
// while (rs.next()) { |
||||
|
// map.put(rs.getInt("question_id"), rs.getString("questions")); |
||||
|
// } |
||||
|
// return map; |
||||
|
// }, campaignId); |
||||
|
// |
||||
|
// // Fetch Answers mapped to questions and grouped by data_id |
||||
|
// String fetchAnswersQuery = "SELECT data_id, question_id, campaign_answer FROM gcc_1913_campaign.questions_answers " + |
||||
|
// "WHERE campaign_id = ?"; |
||||
|
// Map<Integer, Map<Integer, String>> answersMap = jdbcTemplate.query(fetchAnswersQuery, rs -> { |
||||
|
// Map<Integer, Map<Integer, String>> map = new HashMap<>(); |
||||
|
// while (rs.next()) { |
||||
|
// int dataId = rs.getInt("data_id"); |
||||
|
// int questionId = rs.getInt("question_id"); |
||||
|
// String answer = rs.getString("campaign_answer"); |
||||
|
// |
||||
|
// map.computeIfAbsent(dataId, k -> new HashMap<>()).put(questionId, answer); |
||||
|
// } |
||||
|
// return map; |
||||
|
// }, campaignId); |
||||
|
// |
||||
|
// // Process each row and collect data |
||||
|
// for (Map<String, Object> orderedFields : orderedFieldsList) { |
||||
|
// List<Object> nonNullValues = new ArrayList<>(); |
||||
|
// for (String field : fieldColumns) { |
||||
|
// Object value = orderedFields.get(field); |
||||
|
// if (value != null) { |
||||
|
// nonNullValues.add(value); |
||||
|
// if (nonNullValues.size() == categoryCount) { |
||||
|
// break; // Stop after collecting required count |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
// |
||||
|
// if (nonNullValues.size() < categoryCount) { |
||||
|
// continue; // Skip if not enough non-null values |
||||
|
// } |
||||
|
// |
||||
|
// Integer dataId = orderedFields.get("data_id") != null ? ((Number) orderedFields.get("data_id")).intValue() : null; |
||||
|
// |
||||
|
// // Map category columns to non-null ordered field values |
||||
|
// Map<String, Object> finalMapping = new LinkedHashMap<>(); |
||||
|
// |
||||
|
// // Add category columns |
||||
|
// for (int i = 0; i < categoryCount; i++) { |
||||
|
// finalMapping.put(categoryColumns.get(i), nonNullValues.get(i)); |
||||
|
// } |
||||
|
// |
||||
|
// // Add Questions and Corresponding Answers for this specific data_id |
||||
|
// Map<Integer, String> currentAnswers = answersMap.getOrDefault(dataId, new HashMap<>()); |
||||
|
// for (Map.Entry<Integer, String> entry : questionsMap.entrySet()) { |
||||
|
// Integer questionId = entry.getKey(); |
||||
|
// String questionText = entry.getValue(); |
||||
|
// String answer = currentAnswers.getOrDefault(questionId, "-"); // Default to "-" |
||||
|
// |
||||
|
// finalMapping.put(questionText, answer); |
||||
|
// } |
||||
|
// |
||||
|
// //Integer agentId = ((Number) orderedFields.get("agent_id")).intValue(); |
||||
|
// |
||||
|
// Integer agentId = orderedFields.get("agent_id") != null ? ((Number) orderedFields.get("agent_id")).intValue() : null; |
||||
|
// String agentName = agentMap.getOrDefault(agentId, "Not Assigned"); |
||||
|
// finalMapping.put("Agent Name", agentName); |
||||
|
// |
||||
|
// String callstatus = orderedFields.get("call_status") != null ? orderedFields.get("call_status").toString() : "-"; |
||||
|
// finalMapping.put("Call Status", callstatus); |
||||
|
// |
||||
|
// // Add Remarks |
||||
|
// String remarks = orderedFields.get("remarks") != null ? orderedFields.get("remarks").toString() : "-"; |
||||
|
// |
||||
|
// finalMapping.put("Remarks", remarks); |
||||
|
// |
||||
|
// resultList.add(finalMapping); |
||||
|
// } |
||||
|
// |
||||
|
// // Write CSV data |
||||
|
// if (resultList.isEmpty()) { |
||||
|
// writer.println("No Data Available"); |
||||
|
// return; |
||||
|
// } |
||||
|
// |
||||
|
// // Extract headers from the first row |
||||
|
// String headers = String.join(",", resultList.get(0).keySet()); |
||||
|
// writer.println(headers); |
||||
|
// |
||||
|
// // Write data rows |
||||
|
// for (Map<String, Object> rowData : resultList) { |
||||
|
// List<String> values = rowData.values().stream() |
||||
|
// .map(value -> value != null ? value.toString() : "") |
||||
|
// .collect(Collectors.toList()); |
||||
|
// writer.println(String.join(",", values)); |
||||
|
// } |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
// Method to escape CSV values |
||||
|
private String escapeCsvValue(String value) { |
||||
|
if (value == null) return ""; |
||||
|
|
||||
|
// If the value contains commas, double quotes, or newlines, wrap it in quotes and escape inner quotes |
||||
|
if (value.contains(",") || value.contains("\"") || value.contains("\n")) { |
||||
|
value = "\"" + value.replace("\"", "\"\"") + "\""; |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public void generateCSV(int categoryId, int campaignId, PrintWriter writer) { |
||||
|
List<Map<String, Object>> resultList = new ArrayList<>(); |
||||
|
|
||||
|
// Fetch ordered field column names |
||||
|
String fetchColumnsSQL = "SELECT COLUMN_NAME " + |
||||
|
"FROM INFORMATION_SCHEMA.COLUMNS " + |
||||
|
"WHERE TABLE_SCHEMA = 'gcc_1913_campaign' " + |
||||
|
"AND TABLE_NAME = 'upload_data' " + |
||||
|
"AND COLUMN_NAME LIKE 'field_%' " + |
||||
|
"ORDER BY CAST(SUBSTRING(COLUMN_NAME, 7) AS UNSIGNED)"; |
||||
|
|
||||
|
List<String> fieldColumns = jdbcTemplate.queryForList(fetchColumnsSQL, String.class); |
||||
|
|
||||
|
if (fieldColumns.isEmpty()) { |
||||
|
writer.println("No matching columns found"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// Fetch ordered fields data based on campaign_id, including data_id, agent_id, and call_status |
||||
|
String query1 = "SELECT data_id, " + String.join(", ", fieldColumns) + ", agent_id, call_status,remarks " + |
||||
|
"FROM gcc_1913_campaign.upload_data WHERE campaign_id = ?"; |
||||
|
|
||||
|
List<Map<String, Object>> orderedFieldsList = jdbcTemplate.queryForList(query1, campaignId); |
||||
|
|
||||
|
if (orderedFieldsList.isEmpty()) { |
||||
|
writer.println("No data found for campaign_id: " + campaignId); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// Fetch category columns |
||||
|
String query2 = "SELECT column_name FROM gcc_1913_campaign.category_columns WHERE category_id = ? AND isactive=1"; |
||||
|
List<String> categoryColumns = jdbcTemplate.queryForList(query2, String.class, categoryId); |
||||
|
|
||||
|
if (categoryColumns.isEmpty()) { |
||||
|
writer.println("No category columns found for category_id: " + categoryId); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
int categoryCount = categoryColumns.size(); |
||||
|
|
||||
|
// Fetch Agent Names from agent_id |
||||
|
String fetchAgentSQL = "SELECT agent_id, agent_name FROM gcc_1913_qaqc.agents_list"; |
||||
|
Map<Integer, String> agentMap = jdbcTemplate.query(fetchAgentSQL, rs -> { |
||||
|
Map<Integer, String> map = new HashMap<>(); |
||||
|
while (rs.next()) { |
||||
|
map.put(rs.getInt("agent_id"), rs.getString("agent_name")); |
||||
|
} |
||||
|
return map; |
||||
|
}); |
||||
|
|
||||
|
// Fetch Questions for given campaign_id |
||||
|
String fetchQuestionsQuery = "SELECT question_id, questions FROM gcc_1913_campaign.campaign_questions WHERE campaign_id = ?"; |
||||
|
Map<Integer, String> questionsMap = jdbcTemplate.query(fetchQuestionsQuery, rs -> { |
||||
|
Map<Integer, String> map = new LinkedHashMap<>(); |
||||
|
while (rs.next()) { |
||||
|
map.put(rs.getInt("question_id"), rs.getString("questions")); |
||||
|
} |
||||
|
return map; |
||||
|
}, campaignId); |
||||
|
|
||||
|
// Fetch Answers mapped to questions and grouped by data_id |
||||
|
String fetchAnswersQuery = "SELECT data_id, question_id, campaign_answer FROM gcc_1913_campaign.questions_answers " + |
||||
|
"WHERE campaign_id = ?"; |
||||
|
Map<Integer, Map<Integer, String>> answersMap = jdbcTemplate.query(fetchAnswersQuery, rs -> { |
||||
|
Map<Integer, Map<Integer, String>> map = new HashMap<>(); |
||||
|
while (rs.next()) { |
||||
|
int dataId = rs.getInt("data_id"); |
||||
|
int questionId = rs.getInt("question_id"); |
||||
|
String answer = rs.getString("campaign_answer"); |
||||
|
|
||||
|
map.computeIfAbsent(dataId, k -> new HashMap<>()).put(questionId, answer); |
||||
|
} |
||||
|
return map; |
||||
|
}, campaignId); |
||||
|
|
||||
|
// Process each row and collect data |
||||
|
for (Map<String, Object> orderedFields : orderedFieldsList) { |
||||
|
List<Object> nonNullValues = new ArrayList<>(); |
||||
|
for (String field : fieldColumns) { |
||||
|
Object value = orderedFields.get(field); |
||||
|
if (value != null) { |
||||
|
nonNullValues.add(value); |
||||
|
if (nonNullValues.size() == categoryCount) { |
||||
|
break; // Stop after collecting required count |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (nonNullValues.size() < categoryCount) { |
||||
|
continue; // Skip if not enough non-null values |
||||
|
} |
||||
|
|
||||
|
Integer dataId = orderedFields.get("data_id") != null ? ((Number) orderedFields.get("data_id")).intValue() : null; |
||||
|
|
||||
|
// Map category columns to non-null ordered field values |
||||
|
Map<String, Object> finalMapping = new LinkedHashMap<>(); |
||||
|
|
||||
|
// Add category columns |
||||
|
for (int i = 0; i < categoryCount; i++) { |
||||
|
finalMapping.put(categoryColumns.get(i), nonNullValues.get(i)); |
||||
|
} |
||||
|
|
||||
|
// Add Questions and Corresponding Answers for this specific data_id |
||||
|
Map<Integer, String> currentAnswers = answersMap.getOrDefault(dataId, new HashMap<>()); |
||||
|
for (Map.Entry<Integer, String> entry : questionsMap.entrySet()) { |
||||
|
Integer questionId = entry.getKey(); |
||||
|
String questionText = entry.getValue(); |
||||
|
String answer = currentAnswers.getOrDefault(questionId, "-"); // Default to "-" |
||||
|
|
||||
|
finalMapping.put(questionText, answer); |
||||
|
} |
||||
|
|
||||
|
Integer agentId = orderedFields.get("agent_id") != null ? ((Number) orderedFields.get("agent_id")).intValue() : null; |
||||
|
String agentName = agentMap.getOrDefault(agentId, "Not Assigned"); |
||||
|
finalMapping.put("Agent Name", agentName); |
||||
|
|
||||
|
String callstatus = orderedFields.get("call_status") != null ? orderedFields.get("call_status").toString() : "-"; |
||||
|
finalMapping.put("Call Status", callstatus); |
||||
|
|
||||
|
// Add Remarks |
||||
|
String remarks = orderedFields.get("remarks") != null ? orderedFields.get("remarks").toString() : "-"; |
||||
|
finalMapping.put("Remarks", remarks); |
||||
|
|
||||
|
resultList.add(finalMapping); |
||||
|
} |
||||
|
|
||||
|
// Write CSV data |
||||
|
if (resultList.isEmpty()) { |
||||
|
writer.println("No Data Available"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// Extract headers from the first row and escape them |
||||
|
String headers = resultList.get(0).keySet().stream() |
||||
|
.map(this::escapeCsvValue) // Escape each header value |
||||
|
.collect(Collectors.joining(",")); |
||||
|
writer.println(headers); |
||||
|
|
||||
|
// Write data rows |
||||
|
for (Map<String, Object> rowData : resultList) { |
||||
|
List<String> values = rowData.values().stream() |
||||
|
.map(value -> escapeCsvValue(value != null ? value.toString() : "")) |
||||
|
.collect(Collectors.toList()); |
||||
|
writer.println(String.join(",", values)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
@ -0,0 +1,36 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
|
||||
|
|
||||
|
@RequestMapping("/gcc/api/callenter/attendance") |
||||
|
@RestController |
||||
|
public class AttendanceApiController { |
||||
|
|
||||
|
private AppConfig appConfig; |
||||
|
private final RestTemplate restTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
public AttendanceApiController(RestTemplate restTemplate, AppConfig appConfig) { |
||||
|
this.restTemplate = restTemplate; |
||||
|
this.appConfig = appConfig; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getAttendancedetails") |
||||
|
public String getAttendancedetails(@RequestParam String fromDate,@RequestParam String toDate){ |
||||
|
String apiUrl = appConfig.attendanceReport + "/callcenter/api/attendance/getattendancereport"+"?fromDate="+ fromDate + "&toDate="+ toDate; |
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
return responseEntity.getBody(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,71 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.type.TypeReference; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterattendance") |
||||
|
@Controller("callCenterAttendanceController") |
||||
|
public class AttendanceMainController { |
||||
|
|
||||
|
@Autowired |
||||
|
private AppConfig appConfig; |
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
@GetMapping("/attendancereport") |
||||
|
public String AttendanceList( |
||||
|
@RequestParam(required = false) String fromDate, |
||||
|
@RequestParam(required = false) String toDate, |
||||
|
Model model) { |
||||
|
List<Map<String, Object>> attendanceData = Collections.emptyList(); |
||||
|
|
||||
|
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
||||
|
String apiUrl = appConfig.attendanceReport + "/callcenter/api/attendance/getattendancereport?fromDate=" + fromDate + "&toDate=" + toDate; |
||||
|
|
||||
|
try { |
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
String responseBody = responseEntity.getBody(); |
||||
|
|
||||
|
if (responseBody != null && !responseBody.isEmpty()) { |
||||
|
ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
if (responseBody.trim().startsWith("{")) { |
||||
|
// Single object response |
||||
|
Map<String, Object> singleData = objectMapper.readValue(responseBody, new TypeReference<>() {}); |
||||
|
attendanceData = List.of(singleData); |
||||
|
} else { |
||||
|
// Array response |
||||
|
attendanceData = objectMapper.readValue(responseBody, new TypeReference<>() {}); |
||||
|
} |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
System.err.println("Error fetching attendance data: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
model.addAttribute("attendanceData", attendanceData); |
||||
|
model.addAttribute("fromDate", fromDate); |
||||
|
model.addAttribute("toDate", toDate); |
||||
|
model.addAttribute("LoginUserId", LoginUserInfo.getLoginUserId()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
return "modules/callcenter/attendancereport"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterqaqccomplaintstatus") |
||||
|
@Controller("callCenterQaQcComplaintStatusController") |
||||
|
public class ComplaintStatusMainController { |
||||
|
|
||||
|
@GetMapping("/complaintstatus") |
||||
|
public String viewstatuscheck(Model model) { |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String agent_name=LoginUserInfo.getCurrentUserDetails().getUsername(); |
||||
|
model.addAttribute("agent_name", agent_name); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
|
||||
|
|
||||
|
return "modules/callcenterqaqc/complaintstatus"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,208 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.logging.Level; |
||||
|
import java.util.logging.Logger; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.QaqcAdminSettingService; |
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
|
||||
|
@RequestMapping("gcc/api/callcenterqaqc/adminsettings") |
||||
|
@RestController |
||||
|
public class QaqcAdminSettingsApiController { |
||||
|
|
||||
|
private final RestTemplate restTemplate; |
||||
|
private final AppConfig appConfig; |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
public QaqcAdminSettingsApiController(RestTemplate restTemplate, AppConfig appConfig) { |
||||
|
this.restTemplate = restTemplate; |
||||
|
this.appConfig = appConfig; |
||||
|
} |
||||
|
|
||||
|
@Autowired |
||||
|
private QaqcAdminSettingService adminService; |
||||
|
|
||||
|
@PostMapping("/saveproductivity") |
||||
|
public ResponseEntity<Map<String, String>> saveproductivity(@RequestParam int productivity_count) |
||||
|
{ |
||||
|
Map<String, String> response = new HashMap<>(); |
||||
|
try { |
||||
|
|
||||
|
// Save task ID |
||||
|
int rowsInserted = adminService.saveProductivity(productivity_count); |
||||
|
|
||||
|
if (rowsInserted > 0) { |
||||
|
response.put("status", "success"); |
||||
|
response.put("message", "Productivity inserted successfully"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
response.put("status", "fail"); |
||||
|
response.put("message", "Productivity not saved"); |
||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); // Change to BAD_REQUEST for failure |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
// Logging the error |
||||
|
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Error saving task", e); |
||||
|
|
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Failed to save productivity"); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateproductivity") |
||||
|
public ResponseEntity<Map<String, String>> updateProductivityById(@RequestBody Map<String, Integer> requestData) |
||||
|
{ Map<String, String> response = new HashMap<>(); |
||||
|
try { |
||||
|
|
||||
|
// Save task ID |
||||
|
int productivityCount = requestData.getOrDefault("productivity_count", 0); // Default to 0 if not provided |
||||
|
int rowsUpdated = adminService.updateProductivity(productivityCount); |
||||
|
|
||||
|
|
||||
|
if (rowsUpdated > 0) { |
||||
|
response.put("status", "success"); |
||||
|
response.put("message", "Productivity saved successfully"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
response.put("status", "fail"); |
||||
|
response.put("message", "Productivity not saved"); |
||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); // Change to BAD_REQUEST for failure |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
// Logging the error |
||||
|
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Error saving task", e); |
||||
|
|
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Failed to save productivity"); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getproductivity") |
||||
|
public Integer getProductivity() |
||||
|
{ |
||||
|
return adminService.getProductivity(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getadminsettingcounts") |
||||
|
public List<Map<String, Object>> getadminsettingcounts() |
||||
|
{ |
||||
|
return adminService.getAdminSettingCounts(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@GetMapping("/assigncallingtype") |
||||
|
public List<Map<String, Object>> assigncallingtype() |
||||
|
{ |
||||
|
return adminService.getAgentsForCallingtype(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@PostMapping("/updateCallType") // Bulk update endpoint |
||||
|
public ResponseEntity<Map<String, String>> updateCallType(@RequestBody List<Map<String, Object>> selectedAgents) { |
||||
|
|
||||
|
Map<String, String> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
int rowsUpdated = 0; |
||||
|
|
||||
|
// Loop through each selected agent and update their calling_type |
||||
|
for (Map<String, Object> agent : selectedAgents) { |
||||
|
String callingType = (String) agent.get("calling_type"); |
||||
|
|
||||
|
// Parse agent_id to Integer if it's passed as a String |
||||
|
int agentId = Integer.parseInt(agent.get("agent_id").toString()); // Ensure it's parsed as Integer |
||||
|
|
||||
|
// Update calling type for the agent |
||||
|
rowsUpdated += adminService.updateCallType(callingType, agentId); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
adminService.saveCallingTypeInSettings(); |
||||
|
|
||||
|
if (rowsUpdated > 0) { |
||||
|
response.put("status", "success"); |
||||
|
response.put("message", "Agents Assigned successfully"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} else { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "No agents updated"); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Error occurred while updating calling types: " + e.getMessage()); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/updateagentname") |
||||
|
public ResponseEntity<Map<String, String>> updateAgentnameById(@RequestBody Map<String, String> requestData){ |
||||
|
Map<String, String> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
// Extract and convert agent_id to int |
||||
|
String agentIdStr = requestData.get("agent_id"); |
||||
|
String updatedName = requestData.get("agent_name"); |
||||
|
|
||||
|
// Validate input |
||||
|
if (agentIdStr == null || updatedName == null || updatedName.trim().isEmpty()) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Agent ID and name are required!"); |
||||
|
return ResponseEntity.badRequest().body(response); |
||||
|
} |
||||
|
|
||||
|
int agentId; |
||||
|
try { |
||||
|
agentId = Integer.parseInt(agentIdStr); |
||||
|
} catch (NumberFormatException e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Invalid Agent ID format!"); |
||||
|
return ResponseEntity.badRequest().body(response); |
||||
|
} |
||||
|
|
||||
|
// Call service layer to update the agent name |
||||
|
int updatedRows = adminService.updateAgentName(agentId, updatedName); // Now agentId is an int |
||||
|
|
||||
|
if (updatedRows == -1) { // If name already exists |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Agent name already exists!"); |
||||
|
return ResponseEntity.status(HttpStatus.CONFLICT).body(response); |
||||
|
} else if (updatedRows > 0) { |
||||
|
response.put("status", "success"); |
||||
|
response.put("message", "Agent name updated successfully!"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} else { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Agent not found or update failed."); |
||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(response); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Error occurred while updating Agent name " + e.getMessage()); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.QaqcAdminSettingService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterqaqcadminsettings") |
||||
|
@Controller("callCenterQaQcAdminSettingsController") |
||||
|
public class QaqcAdminSettingsMainController { |
||||
|
|
||||
|
@Autowired |
||||
|
private QaqcAdminSettingService adminService; |
||||
|
|
||||
|
@GetMapping("/adminsettings") |
||||
|
public String viewAdminSettings(Model model) { |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
|
||||
|
|
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String agent_name=LoginUserInfo.getCurrentUserDetails().getUsername(); |
||||
|
model.addAttribute("agent_name", agent_name); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
|
||||
|
List<Map<String, Object>> Counts=adminService.getAdminSettingCounts(); |
||||
|
model.addAttribute("Counts", Counts); |
||||
|
|
||||
|
List<Map<String, Object>> agents=adminService.getAgentsForCallingtype(); |
||||
|
model.addAttribute("Agents", agents); |
||||
|
|
||||
|
|
||||
|
return "modules/callcenterqaqc/qaqcadminsettings"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterqaqccomplaintsregistration") |
||||
|
@Controller("callCenterQaQcComplaintsRegistrationController") |
||||
|
public class QaqcPgrComplaintsMainController { |
||||
|
|
||||
|
@GetMapping("/pgrcomplaint") |
||||
|
public String viewPGRpage(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
return "modules/callcenterqaqc/pgrcomplaints"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,58 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterqaqcreports") |
||||
|
@Controller("callCenterQaQcReportsController") |
||||
|
public class ReportsMainController { |
||||
|
|
||||
|
|
||||
|
@GetMapping("/overallreport") |
||||
|
public String viewOverallReports(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
return "modules/callcenterqaqc/overallreport"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/qaqctasklist") |
||||
|
public String viewqaqctasklist(Model model) { |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
|
||||
|
|
||||
|
return "modules/callcenterqaqc/qaqctasklist"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/qaqcagentperformance") |
||||
|
public String viewAgentPerformance(Model model) { |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String agent_name=LoginUserInfo.getCurrentUserDetails().getUsername(); |
||||
|
model.addAttribute("agent_name", agent_name); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
|
||||
|
return "modules/callcenterqaqc/qaqcagentperformance"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,349 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.io.InputStream; |
||||
|
import java.net.URL; |
||||
|
import java.net.URLConnection; |
||||
|
import java.net.URLEncoder; |
||||
|
import java.nio.charset.StandardCharsets; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.time.LocalDate; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.time.format.DateTimeParseException; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.SocialMediaService; |
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
|
||||
|
@RequestMapping("gcc/api/callcenterqaqc/socialmedia") |
||||
|
@RestController |
||||
|
public class SocialMediaApiController { |
||||
|
|
||||
|
private final RestTemplate restTemplate; |
||||
|
private final AppConfig appConfig; |
||||
|
|
||||
|
@Autowired |
||||
|
public SocialMediaService socialservice; |
||||
|
|
||||
|
@Autowired |
||||
|
public SocialMediaApiController(RestTemplate restTemplate, AppConfig appConfig) { |
||||
|
this.restTemplate = restTemplate; |
||||
|
this.appConfig = appConfig; |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/update") |
||||
|
@ResponseBody |
||||
|
public ResponseEntity<String> updateCallDetails(@RequestParam("complaintNumber") String complaintNumber, |
||||
|
@RequestParam("userId") String userId,@RequestParam("action") String action,@RequestParam("remarks") String remarks |
||||
|
) { |
||||
|
try { |
||||
|
// System.out.println("Updating Complaint Number: " + complaintNumber); |
||||
|
// System.out.println("userId= " + userId); |
||||
|
// System.out.println("action= " + action); |
||||
|
// System.out.println("remarks="+remarks); |
||||
|
int updated_agent = Integer.parseInt(userId); |
||||
|
// System.out.println("updated_agent: " + updated_agent); |
||||
|
if(remarks.isEmpty()) |
||||
|
{ |
||||
|
remarks="N/A"; |
||||
|
} |
||||
|
|
||||
|
String erp_name=socialservice.getErpusernamebyId(userId); |
||||
|
// System.out.println("erp_name=="+erp_name); |
||||
|
if (erp_name.isEmpty()) { |
||||
|
return ResponseEntity.ok("erpname"); |
||||
|
} |
||||
|
|
||||
|
if ("COMPLETED".equals(action) || "REOPEN".equals(action)) |
||||
|
{ |
||||
|
boolean statusUpdated =ChangeStatusInErp(complaintNumber,action,remarks,erp_name); |
||||
|
System.out.println("statusUpdated="+statusUpdated); |
||||
|
|
||||
|
if (!statusUpdated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("error"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
Map<String, Object> details =getDetailsByComplaintNumber(complaintNumber); |
||||
|
int rowInserted=socialservice.uploadComplaintDetailsInLogs(details,action,remarks,updated_agent); |
||||
|
if(rowInserted!=1) |
||||
|
{ |
||||
|
return ResponseEntity.ok("save"); |
||||
|
} |
||||
|
return ResponseEntity.ok("Success"); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public Map<String, Object> getDetailsByComplaintNumber(String complaintNumber) { |
||||
|
|
||||
|
Map<String, Object> resultMap = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintByID&ComplaintId=" |
||||
|
+ complaintNumber + "&imgUrlonly=yes"; |
||||
|
System.out.println("Request URL: " + url); |
||||
|
|
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); |
||||
|
|
||||
|
if (responseEntity.getStatusCode().is2xxSuccessful()) { |
||||
|
String responseBody = responseEntity.getBody(); |
||||
|
//System.out.println("Response Body: " + responseBody); |
||||
|
|
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
JsonNode rootNode = mapper.readTree(responseBody); |
||||
|
|
||||
|
JsonNode complaintDetails = rootNode.path(0).path("ComplaintListHistory").path(0); |
||||
|
|
||||
|
String registerDate=complaintDetails.path("complaintopendate").asText("N/A"); |
||||
|
//System.out.println("registerdate====="+registerDate); |
||||
|
|
||||
|
String formattedDate = "N/A"; // Default value if parsing fails |
||||
|
|
||||
|
if (!registerDate.equals("N/A") && !registerDate.isEmpty()) { |
||||
|
try { |
||||
|
// Parse the input date string |
||||
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
||||
|
Date date = inputFormat.parse(registerDate); |
||||
|
|
||||
|
// Format the date to dd-MM-yyyy |
||||
|
SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM-yyyy"); |
||||
|
formattedDate = outputFormat.format(date); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); // Log exception for debugging |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!complaintDetails.isMissingNode()) { |
||||
|
// Existing fields |
||||
|
resultMap.put("complaintid", complaintDetails.path("complaintid").asText("N/A")); |
||||
|
resultMap.put("complaintdate", formattedDate); |
||||
|
resultMap.put("complainantName", complaintDetails.path("CustomerName").asText("N/A")); |
||||
|
resultMap.put("mobileNumber", complaintDetails.path("CustomerMobile").asText("N/A")); |
||||
|
resultMap.put("complaintType", complaintDetails.path("complainttype").asText("N/A")); |
||||
|
resultMap.put("description", complaintDetails.path("complaintdetails").asText("N/A")); |
||||
|
resultMap.put("currentStatus", complaintDetails.path("complaintcurrentstatus").asText("N/A")); |
||||
|
resultMap.put("Street", complaintDetails.path("Street").asText("N/A")); |
||||
|
resultMap.put("Area", complaintDetails.path("Area").asText("N/A")); |
||||
|
resultMap.put("Landmark", complaintDetails.path("Landmark").asText("N/A")); |
||||
|
resultMap.put("Location", complaintDetails.path("Location").asText("N/A")); |
||||
|
resultMap.put("Zone", complaintDetails.path("Zone").asText("N/A")); |
||||
|
resultMap.put("Division", complaintDetails.path("Division").asText("N/A")); |
||||
|
resultMap.put("OfficialMobile", complaintDetails.path("OfficialMobile").asText("N/A")); |
||||
|
resultMap.put("gender", complaintDetails.path("GENDER").asText("N/A")); |
||||
|
resultMap.put("deptname",complaintDetails.path("DEPT_NAME").asText("N/A")); |
||||
|
resultMap.put("compmode", complaintDetails.path("COMP_MODE").asText("N/A")); |
||||
|
resultMap.put("Officialname", complaintDetails.path("Officialname").asText("N/A")); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} else { |
||||
|
resultMap.put("error", "Failed to retrieve complaint details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
resultMap.put("error", "Error processing request"); |
||||
|
} |
||||
|
|
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public boolean ChangeStatusInErp(String complaintNumber,String action ,String remarks,String erp_name) { |
||||
|
String baseUrl = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?"; |
||||
|
String status = ""; |
||||
|
|
||||
|
|
||||
|
//String Erpname ="QAops1"; |
||||
|
|
||||
|
try { |
||||
|
// Encode parameters |
||||
|
String encodedComplaintNumber = URLEncoder.encode(complaintNumber, StandardCharsets.UTF_8.toString()).replace("+", "%20"); |
||||
|
String encodedRemarks = URLEncoder.encode(remarks, StandardCharsets.UTF_8.toString()).replace("+", "%20"); |
||||
|
String encodedErpname = URLEncoder.encode(erp_name, StandardCharsets.UTF_8.toString()).replace("+", "%20"); |
||||
|
|
||||
|
// Determine status based on action |
||||
|
if ("COMPLETED".equals(action)) { |
||||
|
status = "11"; |
||||
|
} else if ("REOPEN".equals(action)) { |
||||
|
status = "9"; |
||||
|
} else { |
||||
|
return false; // Invalid action, return false |
||||
|
} |
||||
|
|
||||
|
// Construct the URL |
||||
|
String urlString = baseUrl |
||||
|
+ "serviceId=UpdateComplaint" |
||||
|
+ "&ComplaintId=" + encodedComplaintNumber |
||||
|
+ "&Message=" + encodedRemarks |
||||
|
+ "&UserType=Official" |
||||
|
+ "&Status=" + status |
||||
|
+ "&Comp_Image=" |
||||
|
+ "&erp_username=" + encodedErpname; |
||||
|
|
||||
|
System.out.println("ERP Hitting URL="+urlString); |
||||
|
|
||||
|
// Send the request |
||||
|
return sendRequest(urlString); |
||||
|
// return true; |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private boolean sendRequest(String urlString) { |
||||
|
try { |
||||
|
URL url = new URL(urlString); |
||||
|
URLConnection urlcon = url.openConnection(); |
||||
|
InputStream stream = urlcon.getInputStream(); |
||||
|
StringBuilder responseBuilder = new StringBuilder(); |
||||
|
int i; |
||||
|
while ((i = stream.read()) != -1) { |
||||
|
responseBuilder.append((char) i); |
||||
|
} |
||||
|
stream.close(); |
||||
|
|
||||
|
// Parse the response |
||||
|
String response = responseBuilder.toString(); |
||||
|
//System.out.println("Raw Response: " + response); |
||||
|
|
||||
|
// Check ResultStatus in the response |
||||
|
if (response.contains("\"ResultStatus\": true")) { |
||||
|
//System.out.println("ResultStatus is true in the response."); |
||||
|
return true; |
||||
|
} else { |
||||
|
System.out.println("ResultStatus is false or not present in the response."); |
||||
|
return false; |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getsocialmediacomps") |
||||
|
public Map<String, Object> viewSocialMediaData( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam String status, |
||||
|
@RequestParam String group, |
||||
|
@RequestParam String type, |
||||
|
@RequestParam String zone) { |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
LocalDate fromLocalDate = LocalDate.parse(startDate, DateTimeFormatter.ISO_DATE); |
||||
|
LocalDate toLocalDate = LocalDate.parse(endDate, DateTimeFormatter.ISO_DATE); |
||||
|
String formattedFromDate = fromLocalDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")); |
||||
|
String formattedToDate = toLocalDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")); |
||||
|
|
||||
|
String mode="SOCIAL MEDIA"; |
||||
|
|
||||
|
String encoded_mode=URLEncoder.encode(mode, StandardCharsets.UTF_8.toString()).replace("+", "%20"); |
||||
|
|
||||
|
//String url="https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=ms_dashboard_details&From_date="+formattedFromDate+"&To_date="+formattedToDate+"&jsonResp=Yes&Status="+status+"&isQcuser=Yes"+"&ComplaintType="+type+"&ComplaintGroupId="+group+"&compmode="+encoded_mode+"&Zoneid="+zone; |
||||
|
|
||||
|
String url="https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=ms_dashboard_details&From_date="+formattedFromDate+"&To_date="+formattedToDate+"&jsonResp=Yes&Status="+status+"&isQcuser=Yes"+"&ComplaintType="+type+"&ComplaintGroupId="+group+"&compmode="+mode+"&Zoneid="+zone; |
||||
|
|
||||
|
System.out.println(url); |
||||
|
|
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
|
||||
|
// Fetch response as String |
||||
|
ResponseEntity<String> responses = restTemplate.getForEntity(url, String.class); |
||||
|
String rawResponse = responses.getBody(); |
||||
|
|
||||
|
// Preprocess response to remove invalid characters if needed |
||||
|
if (rawResponse != null) { |
||||
|
//rawResponse = rawResponse.replaceAll("\"\"", "\""); // Replace double-double quotes |
||||
|
//rawResponse = rawResponse.replaceAll("(?<![,{])\"R", "\"R"); // Example: Fix missing commas |
||||
|
} |
||||
|
ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
Map<String, Object> responseMap = objectMapper.readValue(rawResponse, Map.class); |
||||
|
List<Map<String, Object>> details = (List<Map<String, Object>>) responseMap.get("Details"); |
||||
|
//System.out.println(details); |
||||
|
if (details == null) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("message", "No Data, please change criteria"); |
||||
|
} |
||||
|
else { |
||||
|
response.put("status", "success"); |
||||
|
response.put("details", details); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "An error occurred while fetching data."); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/socialmediacompletedlist") |
||||
|
public Map<String, Object> viewSocialMediaCompletedData( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate, @RequestParam String status, |
||||
|
@RequestParam String zone) { |
||||
|
|
||||
|
System.out.printf("==================="+startDate,endDate,zone); |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
LocalDate fromLocalDate = LocalDate.parse(startDate, DateTimeFormatter.ISO_DATE); |
||||
|
LocalDate toLocalDate = LocalDate.parse(endDate, DateTimeFormatter.ISO_DATE); |
||||
|
String formattedFromDate = fromLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
||||
|
String formattedToDate = toLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
||||
|
|
||||
|
List<Map<String, Object>> details= socialservice.getdetails(formattedFromDate,formattedToDate,status,zone); |
||||
|
if(details==null) |
||||
|
{ |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("message", "No data for Selected filter"); |
||||
|
} |
||||
|
else { |
||||
|
response.put("status", "success"); |
||||
|
response.put("details", details); |
||||
|
} |
||||
|
} |
||||
|
catch (DateTimeParseException e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Invalid date format. Please use 'yyyy-MM-dd'."); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "An error occurred while fetching data."); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterqaqcsocialmedia") |
||||
|
@Controller("callCenterQaQcSocialMediaController") |
||||
|
public class SocialMediaMainController { |
||||
|
|
||||
|
@GetMapping("/socialmediacomplaints") |
||||
|
public String viewSocialMediaComplaints(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId", userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
return "modules/callcenterqaqc/socialmediacomplaints"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/smfinishedcomplaints") |
||||
|
public String viewSocialMediaCompletedComplaints(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId", userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
return "modules/callcenterqaqc/socialmediacompletedlist"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,174 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.cdwaste.controller; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.cdwaste.service.OfficerService; |
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
|
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/gcc/api/dumpregistration") |
||||
|
public class DumpRegistrationAPIController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private OfficerService officerService; |
||||
|
|
||||
|
private final RestTemplate restTemplate; |
||||
|
private final AppConfig appConfig; |
||||
|
|
||||
|
@Autowired |
||||
|
public DumpRegistrationAPIController(RestTemplate restTemplate, AppConfig appConfig) { |
||||
|
this.restTemplate = restTemplate; |
||||
|
this.appConfig = appConfig; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/wastecollectorlist") |
||||
|
public ResponseEntity<String> getWasteCollectorList( |
||||
|
@RequestParam(required = false) Long mobileNo, |
||||
|
@RequestParam(required = false) Long refId) { |
||||
|
|
||||
|
StringBuilder apiUrl = new StringBuilder(appConfig.dumpregister + "/dumpregistration/api/wastecollectorlist"); |
||||
|
|
||||
|
// If at least one param is present, append '?' |
||||
|
if (mobileNo != null || refId != null) { |
||||
|
apiUrl.append("?"); |
||||
|
} |
||||
|
|
||||
|
// Append parameters |
||||
|
List<String> params = new ArrayList<>(); |
||||
|
if (mobileNo != null) { |
||||
|
params.add("mobileNo=" + mobileNo); |
||||
|
} |
||||
|
if (refId != null) { |
||||
|
params.add("refId=" + refId); |
||||
|
} |
||||
|
|
||||
|
apiUrl.append(String.join("&", params)); |
||||
|
|
||||
|
try { |
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl.toString(), String.class); |
||||
|
return ResponseEntity.ok(responseEntity.getBody()); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Failed to fetch data: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getallcharges") |
||||
|
public ResponseEntity<String> getpaymentcharges() { |
||||
|
String apiUrl = appConfig.dumpregister + "/dumpregistration/dropdown/api/getallcharges"; |
||||
|
|
||||
|
try { |
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
return ResponseEntity.ok(responseEntity.getBody()); // Return the real response, not a fixed string |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Failed to fetch data: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@PostMapping("/saveWasteRequest") |
||||
|
public ResponseEntity<String> saveWasteRequest(@RequestBody Map<String, Object> payload) { |
||||
|
try { |
||||
|
officerService.saveRequestDetails(payload); |
||||
|
return ResponseEntity.ok("Saved successfully"); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error saving request"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getless1tonlist") |
||||
|
public ResponseEntity<String> getWasteCollectorLess1TonList() { |
||||
|
StringBuilder apiUrl = new StringBuilder(appConfig.dumpregister + "/dumpregistration/api/getless1tonlist"); |
||||
|
|
||||
|
try { |
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl.toString(), String.class); |
||||
|
return ResponseEntity.ok(responseEntity.getBody()); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Failed to fetch data: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getless1tonlistbyId") |
||||
|
public ResponseEntity<String> getWasteCollectorLess1TonListbyId(@RequestParam(required = true) Long refId) { |
||||
|
if (refId == null) { |
||||
|
return ResponseEntity.badRequest().body("refId is required"); |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
String apiUrl = appConfig.dumpregister + "/dumpregistration/api/getless1tonlistbyid?refId=" + refId; |
||||
|
|
||||
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
return ResponseEntity.ok(responseEntity.getBody()); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Failed to fetch data: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getAllDetails") |
||||
|
public ResponseEntity<?> getAllRequestDetails( |
||||
|
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate, |
||||
|
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate toDate, |
||||
|
@RequestParam(required = false) String wastequantity, |
||||
|
@RequestParam(required = false) String zone) { |
||||
|
try { |
||||
|
|
||||
|
List<Map<String, Object>> response = officerService.getAllRequestDetails(fromDate, toDate, wastequantity, zone); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body(Collections.singletonMap("error", "Failed to fetch data: " + e.getMessage())); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getquantity") |
||||
|
public List<Map<String, Object>> getwastequantity() { |
||||
|
return officerService.getAllwastequantity(); |
||||
|
} |
||||
|
|
||||
|
//fetch all zones |
||||
|
|
||||
|
@GetMapping("/getzones") |
||||
|
public ResponseEntity<?> getAllZones() { |
||||
|
try { |
||||
|
List<Map<String, Object>> response = officerService.getZonesList(); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body(Collections.singletonMap("error", "Failed to fetch data: " + e.getMessage())); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,75 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.cdwaste.controller; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/dumpregistration") |
||||
|
@Controller("dumpregistrationMainController") |
||||
|
public class MainController { |
||||
|
|
||||
|
private final LoginUserInfo loginUserInfo; |
||||
|
private final RestTemplate restTemplate; |
||||
|
private final AppConfig appConfig; |
||||
|
|
||||
|
@Autowired |
||||
|
public MainController(RestTemplate restTemplate,LoginUserInfo loginUserInfo, |
||||
|
AppConfig appConfig) { |
||||
|
this.restTemplate = restTemplate; |
||||
|
this.appConfig = appConfig; |
||||
|
this.loginUserInfo = loginUserInfo; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/officer") |
||||
|
public String viewOfficer(Model model) |
||||
|
{ |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
|
||||
|
|
||||
|
return "modules/cdwastecollect/officer"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/lessthanoneton") |
||||
|
public String viewLessoneTonList(Model model) |
||||
|
{ |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
|
||||
|
return "modules/cdwastecollect/lessoneton"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/overallreport") |
||||
|
public String wasteCollectionReports(Model model) |
||||
|
{ |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
|
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
model.addAttribute("UserRole", UserRole); |
||||
|
return "modules/cdwastecollect/reports"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,161 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.cdwaste.service; |
||||
|
|
||||
|
import java.net.URLEncoder; |
||||
|
import java.nio.charset.StandardCharsets; |
||||
|
import java.time.LocalDate; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalTime; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
@Service |
||||
|
public class OfficerService { |
||||
|
|
||||
|
@Autowired |
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
private SMSService smsService; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSourcemysql(@Qualifier("mysqlCDManagerSystemDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Transactional |
||||
|
public void saveRequestDetails(Map<String, Object> payload) { |
||||
|
double actualWeight = Double.parseDouble(payload.get("actualWeight").toString()); |
||||
|
String paymentType = payload.get("paymentType").toString(); |
||||
|
/* |
||||
|
* double processingCharge = |
||||
|
* Double.parseDouble(payload.get("processingCharge").toString()); double |
||||
|
* wasteCharge = Double.parseDouble(payload.get("wasteCharge").toString()); |
||||
|
*/ |
||||
|
|
||||
|
double processingCharge = payload.get("processingCharge") != null |
||||
|
? Double.parseDouble(payload.get("processingCharge").toString()) |
||||
|
: 0.0; |
||||
|
|
||||
|
double wasteCharge = payload.get("wasteCharge") != null |
||||
|
? Double.parseDouble(payload.get("wasteCharge").toString()) |
||||
|
: 0.0; |
||||
|
double totalCharge = Double.parseDouble(payload.get("totalCharge").toString()); |
||||
|
String paymentMobNo = payload.get("paymentMobileNo") != null ? payload.get("paymentMobileNo").toString() : null; |
||||
|
String refId = payload.get("refId") != null ? payload.get("refId").toString() : null; |
||||
|
|
||||
|
// ✅ Check if record exists |
||||
|
String checkSql = "SELECT COUNT(*) FROM waste_collectors_request WHERE refid = ?"; |
||||
|
Integer count = jdbcTemplate.queryForObject(checkSql, new Object[]{refId}, Integer.class); |
||||
|
|
||||
|
if (count != null && count > 0) { |
||||
|
// ✅ Update the existing record |
||||
|
String updateSql = "UPDATE waste_collectors_request SET actual_weight = ?, payment_type = ?, processing_charge = ?, waste_collection_charge = ?, total_charge = ?, payment_mobile_no = ? WHERE refid = ?"; |
||||
|
jdbcTemplate.update(updateSql, actualWeight, paymentType, processingCharge, wasteCharge, totalCharge, paymentMobNo, refId); |
||||
|
|
||||
|
// ✅ Send WhatsApp message if payment type is 'generateLink' and mobile number is provided |
||||
|
if ("generateLink".equalsIgnoreCase(paymentType) && paymentMobNo != null && !paymentMobNo.isBlank()) { |
||||
|
sendWhatsappMessage(refId, actualWeight, totalCharge, paymentMobNo); |
||||
|
} |
||||
|
} else { |
||||
|
throw new RuntimeException("No request found for Ref ID: " + refId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public void sendWhatsappMessage(String refId, double actualWeight, double totalCharge, String mobileNumber) { |
||||
|
try { |
||||
|
String message = String.format( |
||||
|
"Your request (Request ID: *%s*) has been processed. Please proceed with the payment.\n\nActual Weight: *%.0f kg*\nAmount Payable: *%.0f*", |
||||
|
refId, actualWeight, totalCharge |
||||
|
); |
||||
|
|
||||
|
String encodedMessage = URLEncoder.encode(message, StandardCharsets.UTF_8); |
||||
|
String encodedHeader = URLEncoder.encode("C&D Waste Collection – Payment Request", StandardCharsets.UTF_8); |
||||
|
String encodedFooter = URLEncoder.encode("Greater Chennai Corporation", StandardCharsets.UTF_8); |
||||
|
|
||||
|
String redirectUrlParam = URLEncoder.encode("dumpregistration/paymentform?requestId=" + refId, StandardCharsets.UTF_8); |
||||
|
|
||||
|
String apiUrl = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507" + |
||||
|
"&password=h2YjFNcJ" + |
||||
|
"&send_to=" + mobileNumber + |
||||
|
"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE" + |
||||
|
"&msg=" + encodedMessage + |
||||
|
"&isTemplate=true" + |
||||
|
"&header=" + encodedHeader + |
||||
|
"&footer=" + encodedFooter + |
||||
|
"&buttonUrlParam=" + redirectUrlParam; |
||||
|
|
||||
|
// Optional: log URL before hitting for debugging |
||||
|
System.out.println("WhatsApp API URL: " + apiUrl); |
||||
|
|
||||
|
// Make API call |
||||
|
// restTemplate.getForObject(apiUrl, String.class); |
||||
|
smsService.sendMsg(apiUrl); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
// Optionally log or alert failure |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getAllRequestDetails(LocalDate fromDate, LocalDate toDate, String wastequantity, String zone) { |
||||
|
StringBuilder query = new StringBuilder( |
||||
|
"SELECT wcr.id, wcr.name, wcr.mobile_no, wcr.area, wcr.zone, qm.quantity, " + |
||||
|
"wtm.waste_type, dl.location, wcr.actual_weight, wcr.payment_status,wcr.waste_collection_charge, " + |
||||
|
"wcr.processing_charge, wcr.total_charge, DATE_FORMAT(wcr.cdate, '%d-%m-%Y') AS request_date, wcr.refid " + |
||||
|
"FROM waste_collectors_request wcr " + |
||||
|
"JOIN dumping_location dl ON wcr.dump_location_id = dl.id " + |
||||
|
"JOIN waste_type_master wtm ON wcr.waste_type_id = wtm.id " + |
||||
|
"JOIN quantity_master qm ON wcr.waste_quantity_id = qm.id " + |
||||
|
"WHERE wcr.cdate BETWEEN ? AND ?"); |
||||
|
|
||||
|
LocalDateTime fromDateTime = fromDate.atStartOfDay(); |
||||
|
LocalDateTime toDateTime = toDate.atTime(LocalTime.MAX); |
||||
|
|
||||
|
List<Object> params = new ArrayList<>(); |
||||
|
params.add(fromDateTime); |
||||
|
params.add(toDateTime); |
||||
|
|
||||
|
if (wastequantity != null && !wastequantity.isEmpty()) { |
||||
|
query.append(" AND qm.quantity = ?"); |
||||
|
params.add(wastequantity); |
||||
|
} |
||||
|
|
||||
|
if (zone != null && !zone.isEmpty()) { |
||||
|
query.append(" AND wcr.zone = ?"); |
||||
|
params.add(zone); |
||||
|
} |
||||
|
|
||||
|
return jdbcTemplate.queryForList(query.toString(), params.toArray()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getAllwastequantity() { |
||||
|
String sql = " SELECT id,quantity FROM quantity_master where is_active = 1 "; |
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getZonesList() { |
||||
|
String sql = " SELECT id,zone_name from zones where is_active = 1 "; |
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.cdwaste.service; |
||||
|
|
||||
|
|
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import java.net.HttpURLConnection; |
||||
|
import java.net.URL; |
||||
|
|
||||
|
@Service |
||||
|
public class SMSService { |
||||
|
public String sendMsg(String msgUrl) { |
||||
|
System.out.println("Whatsapp URL :-"+msgUrl); |
||||
|
|
||||
|
String response =""; |
||||
|
try{ |
||||
|
HttpURLConnection connection =null; |
||||
|
|
||||
|
URL url = new URL(msgUrl); |
||||
|
connection = (HttpURLConnection) url.openConnection(); |
||||
|
connection.setRequestMethod("GET"); |
||||
|
|
||||
|
int responseCode = connection.getResponseCode(); |
||||
|
response=responseCode+""; |
||||
|
System.out.println("Response Code: " + responseCode); |
||||
|
|
||||
|
}catch (Exception e){ |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
public String sendSMS(String SMS_Url) { |
||||
|
System.out.println("SMS URL:- "+ SMS_Url); |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
String response =restTemplate.getForObject(SMS_Url,String.class); |
||||
|
return response; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
import java.util.List; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.CompletedService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/department/completed") |
||||
|
@RestController |
||||
|
public class CompletedApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CompletedService completedService; |
||||
|
|
||||
|
@Autowired |
||||
|
public CompletedApiController(CompletedService completedService) { |
||||
|
this.completedService = completedService; |
||||
|
} |
||||
|
|
||||
|
// Combined method to handle both cases (with and without emp_no parameter) |
||||
|
@GetMapping("/cpslist") |
||||
|
public ResponseEntity<?> getCPSList(@RequestParam(value = "emp_no", required = false) String empNo, |
||||
|
@RequestParam(required = false)Integer file_cat, |
||||
|
@RequestParam(required = false)Integer deptId) { |
||||
|
try { |
||||
|
List<Map<String, Object>> cpsList; |
||||
|
|
||||
|
// If emp_no is provided, fetch filtered records |
||||
|
if (empNo != null && !empNo.isEmpty()) { |
||||
|
cpsList = completedService.getCPSListByEmpNo(empNo); |
||||
|
} else { |
||||
|
// If emp_no is not provided, fetch all records |
||||
|
cpsList = completedService.getCPSList(file_cat,deptId); |
||||
|
} |
||||
|
|
||||
|
// Return response based on the data |
||||
|
if (cpsList.isEmpty()) { |
||||
|
return ResponseEntity.noContent().build(); // No records found |
||||
|
} |
||||
|
|
||||
|
return ResponseEntity.ok(cpsList); // Return the records |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Error occurred while fetching completed service records."); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,241 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DashboardApiService; |
||||
|
@RestController |
||||
|
public class DashboardApiController { |
||||
|
@Autowired |
||||
|
private DashboardApiService dashboardApiService; |
||||
|
|
||||
|
@GetMapping("/dashboard") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getDashboardData() { |
||||
|
|
||||
|
return dashboardApiService.fetchCategoryCounts(); |
||||
|
} |
||||
|
/*@GetMapping("/dashboardsearch") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> fetchDashboardData( |
||||
|
@RequestParam(required = false) String startdate, |
||||
|
@RequestParam(required = false) String enddate) { |
||||
|
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate); |
||||
|
try { |
||||
|
return dashboardApiService.fetchCategorysearchCounts(startdate, enddate); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs |
||||
|
throw e; // Rethrow the exception to propagate the 500 error |
||||
|
} |
||||
|
} |
||||
|
@GetMapping("/categoryCounts") |
||||
|
public List<Map<String, Object>> getCategoryCounts() { |
||||
|
return dashboardApiService.fetchCategoryCounts(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getEmpNoByFileName") |
||||
|
public List<Map<String, Object>> getEmployeeDetails(@RequestParam("file_id") String FileId) { |
||||
|
System.out.println("before fetch"); |
||||
|
return dashboardApiService.getEmployeeDetails(FileId); |
||||
|
} |
||||
|
@GetMapping("/stageWiseCounts") |
||||
|
public ResponseEntity<List<Map<String, Object>>> getStageWiseCounts() { |
||||
|
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getStageWiseCounts(); |
||||
|
return ResponseEntity.ok(stageWiseCounts); |
||||
|
}*/ |
||||
|
|
||||
|
@GetMapping("/getDepartments") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getDepartment() { |
||||
|
return dashboardApiService.getDepartment(); |
||||
|
} |
||||
|
@GetMapping("/getEmpNoByFileName") |
||||
|
public List<Map<String, Object>> getEmployeeDetails(@RequestParam("file_id") String FileId) { |
||||
|
System.out.println("before fetch"); |
||||
|
return dashboardApiService.getEmployeeDetails(FileId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//department |
||||
|
|
||||
|
@GetMapping("/deparmentdashboard") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getDepartmentDashboardData(@RequestParam(required = false) String deptId) { |
||||
|
System.out.println("deptid"+ deptId); |
||||
|
return dashboardApiService.DepartmenfetchCategoryCounts(deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* @GetMapping("/deparmentcategoryCounts") |
||||
|
public List<Map<String, Object>> getDepartmenCategoryCounts(@RequestParam(required = false) String deptId) { |
||||
|
return dashboardApiService.DepartmenfetchCategoryCounts(deptId); |
||||
|
} |
||||
|
//DepartmentstageWiseCounts |
||||
|
|
||||
|
@GetMapping("/DepartmentstageWiseCounts") |
||||
|
public ResponseEntity<List<Map<String, Object>>> getDepartmentStageWiseCounts(@RequestParam(required = false) String deptId) { |
||||
|
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getDepartmentStageWiseCounts(deptId); |
||||
|
return ResponseEntity.ok(stageWiseCounts); |
||||
|
}*/ |
||||
|
|
||||
|
|
||||
|
@GetMapping("/stageWiseCounts") |
||||
|
public ResponseEntity<List<Map<String, Object>>> getDepartmentStageWiseCounts( |
||||
|
@RequestParam(required = false) String deptId, |
||||
|
@RequestParam(required = false) String startDate, |
||||
|
@RequestParam(required = false) String endDate) { |
||||
|
|
||||
|
if(startDate.isEmpty()) |
||||
|
{ |
||||
|
startDate=null; |
||||
|
} |
||||
|
if(endDate.isEmpty()) |
||||
|
{ |
||||
|
endDate=null; |
||||
|
} |
||||
|
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getStageWiseCounts(deptId, startDate, endDate); |
||||
|
return ResponseEntity.ok(stageWiseCounts); |
||||
|
} |
||||
|
@GetMapping("/categoryCounts") |
||||
|
public List<Map<String, Object>> getDepartmenCategoryCounts( |
||||
|
@RequestParam(required = false) String deptId, |
||||
|
@RequestParam(required = false) String startDate, |
||||
|
@RequestParam(required = false) String endDate) { |
||||
|
|
||||
|
if(startDate.isEmpty()) |
||||
|
{ |
||||
|
startDate=null; |
||||
|
} |
||||
|
if(endDate.isEmpty()) |
||||
|
{ |
||||
|
endDate=null; |
||||
|
} |
||||
|
|
||||
|
return dashboardApiService.fetchchartCategoryCounts(deptId, startDate, endDate); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/dashboardsearch") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> fetchDeparmentDashboardData( |
||||
|
@RequestParam(required = false) String startdate, |
||||
|
@RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) { |
||||
|
if(deptId.isEmpty()) |
||||
|
{ |
||||
|
deptId=null; |
||||
|
} |
||||
|
|
||||
|
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate); |
||||
|
try { |
||||
|
return dashboardApiService.fetchCategorysearchCounts(startdate, enddate,deptId); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs |
||||
|
throw e; // Rethrow the exception to propagate the 500 error |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//pension |
||||
|
|
||||
|
@GetMapping("/pensiondashboard") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getPensionDashboardData(@RequestParam(required = false) String deptId) { |
||||
|
System.out.println("deptid"+ deptId); |
||||
|
return dashboardApiService.DepartmenfetchCategoryCounts(deptId); |
||||
|
} |
||||
|
/* @GetMapping("/pensiondashboardsearch") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> fetchpensionDashboardData( |
||||
|
@RequestParam(required = false) String startdate, |
||||
|
@RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) { |
||||
|
|
||||
|
if(deptId.isEmpty()) |
||||
|
{ |
||||
|
deptId=null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate); |
||||
|
try { |
||||
|
return dashboardApiService.fetchDeparmentCategorysearchCounts(startdate, enddate,deptId); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs |
||||
|
throw e; // Rethrow the exception to propagate the 500 error |
||||
|
} |
||||
|
}*/ |
||||
|
|
||||
|
|
||||
|
/* @GetMapping("/pensioncategoryCounts") |
||||
|
public List<Map<String, Object>> getpensionCategoryCounts( |
||||
|
@RequestParam(required = false) String deptId, |
||||
|
@RequestParam(required = false) String startDate, |
||||
|
@RequestParam(required = false) String endDate) { |
||||
|
|
||||
|
if(startDate.isEmpty()) |
||||
|
{ |
||||
|
startDate=null; |
||||
|
} |
||||
|
if(endDate.isEmpty()) |
||||
|
{ |
||||
|
endDate=null; |
||||
|
} |
||||
|
|
||||
|
return dashboardApiService.DepartmenfetchDepartmentCategoryCounts(deptId, startDate, endDate); |
||||
|
}*/ |
||||
|
|
||||
|
|
||||
|
/* @GetMapping("/pensionstageWiseCounts") |
||||
|
public ResponseEntity<List<Map<String, Object>>> getpensionStageWiseCounts( |
||||
|
@RequestParam(required = false) String deptId, |
||||
|
@RequestParam(required = false) String startDate, |
||||
|
@RequestParam(required = false) String endDate) { |
||||
|
|
||||
|
if(startDate.isEmpty()) |
||||
|
{ |
||||
|
startDate=null; |
||||
|
} |
||||
|
if(endDate.isEmpty()) |
||||
|
{ |
||||
|
endDate=null; |
||||
|
} |
||||
|
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getDepartmentStageWiseCounts(deptId, startDate, endDate); |
||||
|
return ResponseEntity.ok(stageWiseCounts); |
||||
|
}*/ |
||||
|
|
||||
|
@GetMapping("/fetchEmpDetails") |
||||
|
public List<Map<String, Object>> getEmpDetails(@RequestParam(required = false) String Empcode) { |
||||
|
System.out.println("checking"); |
||||
|
System.out.println(Empcode); |
||||
|
|
||||
|
return dashboardApiService.getEmpDetails(Empcode); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/fetchPensionEmpDetails") |
||||
|
public List<Map<String, Object>> getPensionEmpDetails(@RequestParam(required = false) String Empcode) { |
||||
|
System.out.println("checking"); |
||||
|
System.out.println(Empcode); |
||||
|
|
||||
|
return dashboardApiService.getPensionEmpDetails(Empcode); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/fetchTempDetails") |
||||
|
public List<Map<String, Object>> getTempEmpDetails(@RequestParam(required = false) String tempId) { |
||||
|
System.out.println("checking"); |
||||
|
System.out.println(tempId); |
||||
|
|
||||
|
return dashboardApiService.getTempEmpDetails(tempId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,129 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentForwardService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/pension/forward") |
||||
|
@RestController |
||||
|
public class DepartmentForwardApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DepartmentForwardService departmentForwardService; |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
boolean isSaved = departmentForwardService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=departmentForwardService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Forward to Department successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//family pension |
||||
|
@PostMapping("/updateForwardFamilyPension") |
||||
|
public ResponseEntity<String> updateForwardFamilyPension(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = departmentForwardService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=departmentForwardService.saveFamilyPensionForwardHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Forward to Department successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/updateForwardPendency") |
||||
|
public ResponseEntity<String> updateForwardPendency(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = departmentForwardService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=departmentForwardService.savePendencyForwardHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Forward to Department successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,720 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
|
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.CompletedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentForwardService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentReceivedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptPartiallyCompService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReturnFromAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/department") |
||||
|
@Controller("gccpensioner") |
||||
|
public class DepartmentMainController { |
||||
|
|
||||
|
@Autowired |
||||
|
private NewEntryService newEntryService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ReturnFromAuditService returnFromAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionAuditService pensionAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DepartmentForwardService departmentForwardService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionReceivedService pensionReceivedService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DepartmentReceivedService departmentReceivedService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ReceivedDeptProvisionalService receivedDeptProvisionalService; |
||||
|
|
||||
|
@Autowired |
||||
|
private CompletedService completedService; |
||||
|
|
||||
|
@Autowired |
||||
|
public DeptPartiallyCompService deptPartiallyCompleteService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
//////////////////////department pages///////////////////////////////// |
||||
|
|
||||
|
//yogi |
||||
|
@GetMapping("/newentry/retirement") |
||||
|
public String newentryretirement( Model model) { |
||||
|
|
||||
|
|
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
return "modules/pensioner/department/newentry/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/newentry/familypension") |
||||
|
public String newentryfamilypension(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
return "modules/pensioner/department/newentry/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/newentry/pendency") |
||||
|
public String newentrypendency(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
return "modules/pensioner/department/newentry/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/newentry/gis") |
||||
|
public String newentrygis(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getGISFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
return "modules/pensioner/department/newentry/gis"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/newentry/provisionalretirement") |
||||
|
public String newentryprovisional(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getPRFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
return "modules/pensioner/department/newentry/provisionalretirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/newentry/contributorypensionscheme") |
||||
|
public String newentrycontributory(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getCPSFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
return "modules/pensioner/department/newentry/contributorypensionscheme"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//sanjay//////////////AUDIT LIST PAGES////////////////// |
||||
|
|
||||
|
@GetMapping("/audit/retirement") |
||||
|
public String auditretirement(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist=deptAuditService.fetchEmployeeDetailsByTable(deptId,file_cat); |
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/department/audit/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/audit/familypension") |
||||
|
public String auditfamilypension(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
|
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist=deptAuditService.fetchEmployeeDetailsByTable(deptId,file_cat); |
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
|
||||
|
return "modules/pensioner/department/audit/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/audit/pendency") |
||||
|
public String auditpendency(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
|
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist=deptAuditService.fetchEmployeeDetailsByTable(deptId,file_cat); |
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/department/audit/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
///////////////////PARTIAL LIST PAGES////////////////////// |
||||
|
|
||||
|
@GetMapping("/partial/retirement") |
||||
|
public String partialretirement(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist=deptPartiallyCompleteService.fetchDepatmentPartialEmpfiles(deptId,file_cat); |
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/department/partial/retirement"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/partial/familypension") |
||||
|
public String partialfamilypension(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist=deptPartiallyCompleteService.fetchDepatmentPartialEmpfiles(deptId,file_cat); |
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/department/partial/familypension"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/partial/pendency") |
||||
|
public String partialpendency(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist=deptPartiallyCompleteService.fetchDepatmentPartialEmpfiles(deptId,file_cat); |
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/department/partial/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//dizho/////////////RETURN LIST PAGES////////////////// |
||||
|
|
||||
|
@GetMapping("/return/retirement") |
||||
|
public String returnretirement(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>returnlist=returnFromAuditService.fetchReturnEmpfiles(deptId,file_cat); |
||||
|
System.out.println("returnlist===="+returnlist); |
||||
|
model.addAttribute("returnlist", returnlist); |
||||
|
|
||||
|
return "modules/pensioner/department/return/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/return/familypension") |
||||
|
public String returnfamilypension(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>returnlist=returnFromAuditService.fetchReturnEmpfiles(deptId,file_cat); |
||||
|
System.out.println("returnlist===="+returnlist); |
||||
|
model.addAttribute("returnlist", returnlist); |
||||
|
|
||||
|
return "modules/pensioner/department/return/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/return/pendency") |
||||
|
public String returnpendency(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
|
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>returnlist=returnFromAuditService.fetchReturnEmpfiles(deptId,file_cat); |
||||
|
System.out.println("returnlist===="+returnlist); |
||||
|
model.addAttribute("returnlist", returnlist); |
||||
|
|
||||
|
return "modules/pensioner/department/return/pendency"; |
||||
|
} |
||||
|
|
||||
|
//////////////////RECEIVED LIST PAGES///////////////////// |
||||
|
|
||||
|
|
||||
|
@GetMapping("/received/retirement") |
||||
|
public String receivedretirement(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>receivedlist=pensionReceivedService.fetchReceivedDepartmentEmpfiles(deptId,file_cat); |
||||
|
System.out.println("receivedlist===="+receivedlist); |
||||
|
model.addAttribute("receivedlist", receivedlist); |
||||
|
|
||||
|
return "modules/pensioner/department/received/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/received/familypension") |
||||
|
public String receivedfamilypension(Model model) { |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>receivedlist=pensionReceivedService.fetchReceivedDepartmentEmpfiles(deptId,file_cat); |
||||
|
System.out.println("receivedlist===="+receivedlist); |
||||
|
model.addAttribute("receivedlist", receivedlist); |
||||
|
|
||||
|
return "modules/pensioner/department/received/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/received/pendency") |
||||
|
public String receivedpendency(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
List<Map<String, Object>>receivedlist=pensionReceivedService.fetchReceivedDepartmentEmpfiles(deptId,file_cat); |
||||
|
System.out.println("receivedlist===="+receivedlist); |
||||
|
model.addAttribute("receivedlist", receivedlist); |
||||
|
|
||||
|
return "modules/pensioner/department/received/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/received/provisionalretirement") |
||||
|
public String receivedprovisionalretirement(Model model) { |
||||
|
int file_cat= newEntryService.getPRFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>provisionallist= receivedDeptProvisionalService.fetchDetailsProvisionalDepartment(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+provisionallist); |
||||
|
model.addAttribute("provisionallist", provisionallist); |
||||
|
|
||||
|
return "modules/pensioner/department/received/provisionalretirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
////////////////COMPLETED LIST PAGES///////////////////////////// |
||||
|
|
||||
|
@GetMapping("/completed/retirement") |
||||
|
public String completedretirement(Model model) { |
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>retirementcompletedlist= completedService.fetchDetailsCompletedRetirement(file_cat,deptId); |
||||
|
|
||||
|
System.out.println("provisionallist"+retirementcompletedlist); |
||||
|
model.addAttribute("provisionallist", retirementcompletedlist); |
||||
|
|
||||
|
return "modules/pensioner/department/completed/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/familypension") |
||||
|
public String completedfamilypension(Model model) { |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>familypensioncompletedlist= completedService.fetchDetailsCompletedFamilyPension(file_cat,deptId); |
||||
|
|
||||
|
System.out.println("provisionallist===="+familypensioncompletedlist); |
||||
|
model.addAttribute("provisionallist", familypensioncompletedlist); |
||||
|
|
||||
|
return "modules/pensioner/department/completed/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/pendency") |
||||
|
public String completedpendency(Model model) { |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>pendencycompletedlist= completedService.fetchDetailsCompletedPendency(file_cat,deptId); |
||||
|
|
||||
|
System.out.println("provisionallist===="+pendencycompletedlist); |
||||
|
model.addAttribute("provisionallist", pendencycompletedlist); |
||||
|
|
||||
|
return "modules/pensioner/department/completed/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/gis") |
||||
|
public String completedgis(Model model) { |
||||
|
int file_cat= newEntryService.getGISFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>gislist= completedService.fetchDetailsForrecivedGiscompleted(file_cat,deptId); |
||||
|
|
||||
|
System.out.println("auditlist===="+gislist); |
||||
|
model.addAttribute("auditlist", gislist); |
||||
|
|
||||
|
return "modules/pensioner/department/completed/gis"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/completed/provisionalretirement") |
||||
|
public String completedprovisionalretirement(Model model) { |
||||
|
int file_cat= newEntryService.getPRFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>provisionallist= completedService.fetchDetailsProvisionalDepartmentCompleted(file_cat,deptId); |
||||
|
|
||||
|
System.out.println("provisionallist===="+provisionallist); |
||||
|
model.addAttribute("provisionallist", provisionallist); |
||||
|
|
||||
|
return "modules/pensioner/department/completed/provisionalretirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/contributorypensionscheme") |
||||
|
public String completedContributoryPensionScheme( |
||||
|
|
||||
|
Model model) { |
||||
|
// Get logged-in user details |
||||
|
|
||||
|
int file_cat= newEntryService.getCPSFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>completedCPSList= completedService.getCPSList(file_cat,deptId); |
||||
|
|
||||
|
System.out.println("provisionallist===="+completedCPSList); |
||||
|
model.addAttribute("provisionallist", completedCPSList); |
||||
|
// Add the list to the model |
||||
|
model.addAttribute("completedCPSList", completedCPSList); |
||||
|
|
||||
|
return "modules/pensioner/department/completed/contributorypensionscheme"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//Ajith ////////////////REPORTS LIST PAGES////////////////////// |
||||
|
|
||||
|
@GetMapping("/reports") |
||||
|
public String reports(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
return "modules/pensioner/department/reports"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/dashboard") |
||||
|
public String dashboard(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
|
||||
|
return "modules/pensioner/department/dashboard"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,176 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentReceivedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/pension/received") |
||||
|
@RestController |
||||
|
public class DepartmentReceivedApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DepartmentReceivedService departmentReceivedService; |
||||
|
|
||||
|
@PostMapping("/updateforretirementcompleted") |
||||
|
public ResponseEntity<String> updateRetirementEmployeeDetailsCompleted(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Extract request parameters |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby = (String) requestData.get("filemovedby"); |
||||
|
int file_Status = 0; // Initialize file_status |
||||
|
|
||||
|
// Call service method to save the details |
||||
|
boolean isSaved = departmentReceivedService.updateEntryCompletedDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
// Fetch employee details |
||||
|
List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:" + emp_details); |
||||
|
|
||||
|
// Fetch pension benefits details |
||||
|
List<Map<String, Object>> pension_details = departmentReceivedService.fetchPensionbenefitsById(tempId); |
||||
|
System.out.println("pension_details:==:" + pension_details); |
||||
|
|
||||
|
// Save retirement completed history |
||||
|
boolean updated = departmentReceivedService.saveRetirementCompletedhistory(emp_details, pension_details, filemovedby); |
||||
|
|
||||
|
// Retrieve file_status from emp_details |
||||
|
if (!emp_details.isEmpty()) { |
||||
|
Map<String, Object> firstEmployeeDetails = emp_details.get(0); |
||||
|
Object fileStatusObj = firstEmployeeDetails.get("file_status"); |
||||
|
|
||||
|
if (fileStatusObj != null) { |
||||
|
try { |
||||
|
file_Status = Integer.parseInt(fileStatusObj.toString()); |
||||
|
System.out.println("Parsed file_status: " + file_Status); |
||||
|
} catch (NumberFormatException e) { |
||||
|
System.err.println("Failed to parse file_status: " + fileStatusObj); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("file_status is null in emp_details."); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("emp_details is empty."); |
||||
|
} |
||||
|
|
||||
|
// Final response logic |
||||
|
if (updated && file_Status != 0) { |
||||
|
if (file_Status == 11) { |
||||
|
return ResponseEntity.ok("File Completed successfully!"); |
||||
|
} else if(file_Status == 9) { |
||||
|
//return ResponseEntity.ok("File Moved Department to Complete Pending fields!"); |
||||
|
return ResponseEntity.ok("File Moved to Department Partially Completed!"); |
||||
|
} |
||||
|
else { |
||||
|
//return ResponseEntity.ok("File Moved Department to Complete Pending fields!"); |
||||
|
return ResponseEntity.ok("File Moved to Pension Partially Completed!"); |
||||
|
} |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Failed to save details in history or invalid file_status."); |
||||
|
} |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details for completed."); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateforretirementpending") |
||||
|
public ResponseEntity<String> updateRetirementEmployeeDetailsPending(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Extract request parameters |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby = (String) requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
// Call service method to save the details |
||||
|
boolean isSaved = departmentReceivedService.updateEntryPendingDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
// Fetch employee details |
||||
|
List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:" + emp_details); |
||||
|
|
||||
|
// Fetch pension benefits details |
||||
|
List<Map<String, Object>> pension_details = departmentReceivedService.fetchPensionbenefitsById(tempId); |
||||
|
System.out.println("pension_details:==:" + pension_details); |
||||
|
|
||||
|
// Save retirement completed history |
||||
|
boolean updated = departmentReceivedService.saveRetirementPendinghistory(emp_details, pension_details, filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File is Pending!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details for pending."); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateforretirementreturn") |
||||
|
public ResponseEntity<String> updateRetirementEmployeeDetailsReturn(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Extract request parameters |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby = (String) requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
// Call service method to save the details |
||||
|
boolean isSaved = departmentReceivedService.updateEntryReturnDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
// Fetch employee details |
||||
|
List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:" + emp_details); |
||||
|
|
||||
|
// Save retirement completed history |
||||
|
boolean updated = departmentReceivedService.saveRetirementreturnhistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Returned to Department!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details for pending."); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,189 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/department/audit") |
||||
|
@RestController |
||||
|
public class DeptAuditApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getemployeedetails") |
||||
|
public List<Map<String, Object>> getEmployeedetailsbyCode( |
||||
|
@RequestParam String tempId) { |
||||
|
|
||||
|
List<Map<String, Object>> employeeDetails = deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("employeeDetails==="+employeeDetails); |
||||
|
return employeeDetails; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getemployeedetailscps") |
||||
|
public List<Map<String, Object>> getEmployeedetailsbyCodeCps( |
||||
|
@RequestParam String tempId) { |
||||
|
|
||||
|
List<Map<String, Object>> employeeDetails = deptAuditService.fetchEmployeeByIdCps(tempId); |
||||
|
System.out.println("employeeDetails==="+employeeDetails); |
||||
|
return employeeDetails; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getzonebenefitsdetails") |
||||
|
public List<Map<String, Object>> getdetailsWithZonebenefits( |
||||
|
@RequestParam String tempId) { |
||||
|
|
||||
|
List<Map<String, Object>> zoneBenefitDetails = deptAuditService.fetchDetailsWithZoneBenefitsById(tempId); |
||||
|
System.out.println("zoneBenefitDetails==="+zoneBenefitDetails); |
||||
|
return zoneBenefitDetails; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getfilependingbenefits") |
||||
|
public List<Map<String, Object>> getAllBenefitsDetails( |
||||
|
@RequestParam String tempId) { |
||||
|
|
||||
|
List<Map<String, Object>> allBenefitDetails = deptAuditService.fetchFilePendingBenefits(tempId); |
||||
|
System.out.println("allBenefitDetails==="+allBenefitDetails); |
||||
|
return allBenefitDetails; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getpartialdetails") |
||||
|
public List<Map<String, Object>> getAllPartialDetails( |
||||
|
@RequestParam String tempId) { |
||||
|
|
||||
|
List<Map<String, Object>> partialDetails = deptAuditService.fetchPartialCompleted(tempId); |
||||
|
System.out.println("partialDetails==="+partialDetails); |
||||
|
return partialDetails; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/fileMovementhistory") |
||||
|
public List<Map<String, Object>> getFileMovementHistory(@RequestParam String tempId) { |
||||
|
List<Map<String, Object>> fileHistory = deptAuditService.fetchFileMovementHistory(tempId); |
||||
|
|
||||
|
return fileHistory; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = deptAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=deptAuditService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//update the family pension details |
||||
|
|
||||
|
@PostMapping("/updateFamilyPensionDetails") |
||||
|
public ResponseEntity<String> updateFamilyPensionDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = deptAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=deptAuditService.saveFamilyPensionHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//pendency |
||||
|
@PostMapping("/updatePendencyDetails") |
||||
|
public ResponseEntity<String> updatePendencyDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = deptAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=deptAuditService.savePendencyHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,110 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptPartiallyCompService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/department/partial") |
||||
|
@RestController |
||||
|
public class DeptPartiallyCompApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
public DeptPartiallyCompService deptPartiallyCompleteService; |
||||
|
|
||||
|
@Autowired |
||||
|
public DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
public PensionReceivedService pensionReceivedService; |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
int fs1=0; |
||||
|
|
||||
|
boolean isSaved = deptPartiallyCompleteService.updateEntryCompletedDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchPartialCompleted(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
|
||||
|
|
||||
|
List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId); |
||||
|
System.out.println("zone_benefits:==:"+zone_benefits); |
||||
|
|
||||
|
List<Map<String, Object>> pension_benefits=pensionReceivedService.fetchPensionbenefitsById(tempId); |
||||
|
System.out.println("pension_benefits:==:"+pension_benefits); |
||||
|
|
||||
|
|
||||
|
boolean updated=deptPartiallyCompleteService.saveHistory(emp_details,zone_benefits,pension_benefits,filemovedby); |
||||
|
|
||||
|
if (!emp_details.isEmpty()) { // Ensure list is not empty |
||||
|
Map<String, Object> empDetailMap = emp_details.get(0); // Get first map from the list |
||||
|
|
||||
|
// Ensure the key exists in the map |
||||
|
if (empDetailMap.containsKey("file_status")) { |
||||
|
Object fileStatusObj = empDetailMap.get("file_status"); |
||||
|
|
||||
|
if (fileStatusObj != null) { |
||||
|
String fs = fileStatusObj.toString(); // Convert to String safely |
||||
|
fs1 = Integer.parseInt(fs); // Convert to integer if needed |
||||
|
System.out.println("file_status: " + fs1); |
||||
|
} else { |
||||
|
System.out.println("file_status is null"); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("Key 'file_status' not found in emp_details"); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("emp_details list is empty"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
if(fs1==11 && fs1!=0) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Completed successfully!"); |
||||
|
} |
||||
|
else if(fs1==9 && fs1!=0) { |
||||
|
return ResponseEntity.ok("File Partially Completed!"); |
||||
|
} |
||||
|
else if(fs1==10 && fs1!=0){ |
||||
|
return ResponseEntity.ok("File Moved to Pension Partially Completed!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.ok("File Status is 0!"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DropdownService; |
||||
|
|
||||
|
@RequestMapping("gcc/api") |
||||
|
@Controller |
||||
|
public class DropdownApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DropdownService dropdownService; |
||||
|
|
||||
|
@GetMapping("/getRetrimentTypes") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getRetrimentTypes() { |
||||
|
return dropdownService.getRetrimentTypes(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getCategoryTypes") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getCategoryTypes() { |
||||
|
return dropdownService.getCategoryTypes(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getProvisionalReasonTypes") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getProvisionalReasonTypes() { |
||||
|
return dropdownService.getProvisionalReasonTypes(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getGisEntryTypes") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getGisEntryTypes() { |
||||
|
return dropdownService.getGisEntryTypes(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,120 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.FileClosingService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/fileclosing") |
||||
|
@RestController |
||||
|
public class FileClosingApiController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private FileClosingService fileClosingService; |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private NewEntryService newEntryService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@GetMapping("/getdetails") |
||||
|
public List<Map<String, Object>> getEmployeedetailsbyCode( @RequestParam String empCode, @RequestParam String deptId){ |
||||
|
|
||||
|
int dept_id=Integer.parseInt(deptId); |
||||
|
|
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
System.out.println("file_cat>>>>>>"+file_cat); |
||||
|
String tempId=fileClosingService.getTempId(empCode,dept_id,file_cat); |
||||
|
|
||||
|
System.out.println("empCode>>>>>"+empCode); |
||||
|
System.out.println("deptId>>>>>>"+dept_id); |
||||
|
System.out.println("tempId>>>>>>"+tempId); |
||||
|
|
||||
|
List<Map<String, Object>> employeeDetails = fileClosingService.fetchEmployeeByTempId(tempId); |
||||
|
System.out.println("employeeDetails==="+employeeDetails); |
||||
|
|
||||
|
return employeeDetails; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getemployeedetails") |
||||
|
public List<Map<String, Object>> getEmployeedetailsbyCode( |
||||
|
@RequestParam String tempId) { |
||||
|
|
||||
|
System.out.println("temporary==="+tempId); |
||||
|
|
||||
|
List<Map<String, Object>> employeeDetails = fileClosingService.fetchEmployeeById(tempId); |
||||
|
System.out.println("employeeDetails==="+employeeDetails); |
||||
|
return employeeDetails; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateDetails") |
||||
|
public ResponseEntity<String> updateDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
System.out.println("data"+requestData); |
||||
|
|
||||
|
boolean isSaved = fileClosingService.updateEntryDetails(requestData); |
||||
|
|
||||
|
|
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=fileClosingService.saveclosinghistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Closed successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//closed list api |
||||
|
|
||||
|
@GetMapping("/getcloseddetails") |
||||
|
public List<Map<String, Object>> getClosedEmployeedetails(){ |
||||
|
|
||||
|
List<Map<String, Object>> employeeDetails = fileClosingService.fetchClosingEmployee(); |
||||
|
System.out.println("employeeDetails==="+employeeDetails); |
||||
|
|
||||
|
return employeeDetails; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,60 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
|
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
|
||||
|
@RequestMapping("/gcc/departmentfileclosing") |
||||
|
@Controller("gccpensionerfileclosing") |
||||
|
|
||||
|
|
||||
|
public class FileClosingMainController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
|
||||
|
private NewEntryService newEntryService; |
||||
|
|
||||
|
|
||||
|
@GetMapping("/fileclosing") |
||||
|
public String searchEmployee(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
|
||||
|
return "modules/pensioner/department/fileclosing"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/closedlist") |
||||
|
public String closedEmployeeList(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
|
||||
|
return "modules/pensioner/department/closedList"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,334 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
|
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.time.format.DateTimeParseException; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Set; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import org.apache.xmlbeans.impl.xb.xsdschema.Public; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("gcc/api/department/newentry") |
||||
|
@RestController |
||||
|
public class NewEntryAPIController { |
||||
|
|
||||
|
@Autowired |
||||
|
private NewEntryService newEntryService; |
||||
|
|
||||
|
@Autowired |
||||
|
public NewEntryAPIController(NewEntryService newEntryService) { |
||||
|
this.newEntryService = newEntryService; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/retirementdetails") |
||||
|
public Map<String, Object> getRetriedDetails( |
||||
|
@RequestParam(value = "deptId", required = false) Integer deptId, |
||||
|
@RequestParam(value = "file_category", required = false) Integer file_category, |
||||
|
@RequestParam(value = "fromDate", required = false) String fromDate1, |
||||
|
@RequestParam(value = "toDate", required = false) String toDate1) |
||||
|
{ |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
if (deptId == null) { |
||||
|
response.put("status", "deptid"); |
||||
|
response.put("message", "Department Id is null"); |
||||
|
return response; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
System.out.println("Received deptId: " + deptId); |
||||
|
System.out.println("Received fromDate: " + fromDate1); |
||||
|
System.out.println("Received toDate: " + toDate1); |
||||
|
|
||||
|
LocalDate fromDate; |
||||
|
LocalDate toDate ; |
||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
LocalDate now = LocalDate.now(); |
||||
|
int currentYear = now.getYear(); |
||||
|
|
||||
|
if(fromDate1.isEmpty()) { |
||||
|
fromDate = LocalDate.of(currentYear, 4, 1); |
||||
|
} |
||||
|
|
||||
|
if(toDate1.isEmpty()) { |
||||
|
toDate = LocalDate.of(currentYear + 1, 3, 31); // March 31 of the next year |
||||
|
} |
||||
|
|
||||
|
if(fromDate1.isEmpty() && toDate1.isEmpty()) { |
||||
|
fromDate = LocalDate.of(currentYear, 4, 1); // April 1 of the current year |
||||
|
toDate = LocalDate.of(currentYear + 1, 3, 31); // March 31 of the next year |
||||
|
|
||||
|
} |
||||
|
else { |
||||
|
try { |
||||
|
|
||||
|
// Check if the input date is in yyyy-MM-dd format |
||||
|
if (fromDate1.matches("\\d{4}-\\d{2}-\\d{2}") && toDate1.matches("\\d{4}-\\d{2}-\\d{2}")) { |
||||
|
// Parse from yyyy-MM-dd format |
||||
|
fromDate = LocalDate.parse(fromDate1); |
||||
|
toDate = LocalDate.parse(toDate1); |
||||
|
} else { |
||||
|
// Parse from dd-MM-yyyy format |
||||
|
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
fromDate = LocalDate.parse(fromDate1, formatter1); |
||||
|
toDate = LocalDate.parse(toDate1, formatter1); |
||||
|
} |
||||
|
|
||||
|
} catch (DateTimeParseException e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Invalid date format. Expected format: dd-MM-yyyy"); |
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
// Format the dates if needed (e.g., for logging or passing in a specific format) |
||||
|
|
||||
|
String formattedFromDate = fromDate.format(formatter); |
||||
|
String formattedToDate = toDate.format(formatter); |
||||
|
|
||||
|
System.out.println("Received deptId after date: " + deptId); |
||||
|
System.out.println("Fetching data from " + formattedFromDate + " to " + formattedToDate); |
||||
|
|
||||
|
|
||||
|
Map<String, Object> datalist = newEntryService.fetchEmplyeeDetails(formattedFromDate, formattedToDate, deptId); |
||||
|
System.out.println("datalist="+datalist); |
||||
|
List<String> emps= newEntryService.getRegisteredEmps(deptId); |
||||
|
|
||||
|
// Format the dates for frontend in "yyyy-MM-dd" |
||||
|
DateTimeFormatter frontendFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
String frontendFromDate = fromDate.format(frontendFormatter); |
||||
|
String frontendToDate = toDate.format(frontendFormatter); |
||||
|
response.put("fromDate", frontendFromDate); |
||||
|
response.put("toDate", frontendToDate); |
||||
|
|
||||
|
// Extract emp_no values from emps |
||||
|
// Set<String> empNos = emps.stream().map(emp -> (String) emp.get("emp_no")).collect(Collectors.toSet()); |
||||
|
|
||||
|
//System.out.println("rrrrrrrrrrrr"); |
||||
|
if (datalist.containsKey("list") && datalist.get("list") instanceof List) { |
||||
|
List<?> list = (List<?>) datalist.get("list"); |
||||
|
if (list.isEmpty()) { |
||||
|
System.out.println("inside>>>>>"); |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("message", "No data available for the selected date range"); |
||||
|
} |
||||
|
else { |
||||
|
//System.out.println("ttttttttttttt"); |
||||
|
// Filter the datalist "list" to exclude matching EMPLOYEE_CODE values |
||||
|
List<Map<String, Object>> filteredList = ((List<Map<String, Object>>) datalist.get("list")).stream() |
||||
|
.filter(employee -> !emps.contains(employee.get("EMPLOYEE_CODE"))) |
||||
|
.collect(Collectors.toList()); |
||||
|
|
||||
|
if (filteredList.isEmpty()) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("message", "No data available for the selected date range"); |
||||
|
} else { |
||||
|
datalist.put("list", filteredList); |
||||
|
response.put("status", "success"); |
||||
|
response.put("details", datalist); |
||||
|
System.out.println("Received datalist:"+datalist); |
||||
|
System.out.println("Received filteredList:"+filteredList); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/employeedetails") |
||||
|
public ResponseEntity<Map<String, Object>> getEmployeedetailsbyCode( |
||||
|
@RequestParam String empCode) { |
||||
|
|
||||
|
Map<String, Object> datalistbycode = newEntryService.fetchEmplyeeDetailsbyCode(empCode); |
||||
|
return ResponseEntity.ok(datalistbycode); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/saveEmployeeDetails") |
||||
|
public ResponseEntity<String> saveRetirementEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save details |
||||
|
boolean isSaved = newEntryService.saveRetirementEmployeeDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
return ResponseEntity.ok("File moved to Audit successfully!"); |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//family pension |
||||
|
@PostMapping("/saveFamilyPensionDetails") |
||||
|
public ResponseEntity<String> saveFamilyPensionDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
|
||||
|
// Call service method to save details |
||||
|
boolean isSaved = newEntryService.saveFamilyPensionDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
return ResponseEntity.ok("File moved to Audit successfully!"); |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//pendency api |
||||
|
|
||||
|
@PostMapping("/savePendecnyDetails") |
||||
|
public ResponseEntity<String> savePendecnyDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save detailstypeOfRetirement |
||||
|
boolean isSaved = newEntryService.savePendencyDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
return ResponseEntity.ok("File moved to Audit successfully!"); |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//gis saving api controller |
||||
|
@PostMapping("/saveEmployeeDetailsGis") |
||||
|
public ResponseEntity<String> saveEmployeeDetailsingis(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Extract data from the request body |
||||
|
|
||||
|
|
||||
|
// Call service method to save details |
||||
|
boolean isSaved = newEntryService.savenewEntryDetailsGis(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
return ResponseEntity.ok("File moved to Pension successfully!"); |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//provsionalretirement saving api controller |
||||
|
@PostMapping("/saveEmployeeDetailsProvisionalretirement") |
||||
|
public ResponseEntity<String> saveEmployeeDetailsProvisionalretirement(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Extract data from the request body |
||||
|
|
||||
|
|
||||
|
// Call service method to save details |
||||
|
boolean isSaved = newEntryService.savenewEntryDetailsProvisionalretirement(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
return ResponseEntity.ok("File moved to Pension successfully!"); |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//cps saving api controller |
||||
|
@PostMapping("/saveEmployeeDetailsPensionScheme") |
||||
|
public ResponseEntity<String> saveEmployeeDetailspensionscheme(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Extract data from the request body |
||||
|
|
||||
|
|
||||
|
// Call service method to save details |
||||
|
boolean isSaved = newEntryService.savenewEntryDetailspensionscheme(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
return ResponseEntity.ok("File Submitted successfully!"); |
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/exists") |
||||
|
public ResponseEntity<Map<String, Boolean>> checkEmployeeExists(@RequestParam String empCode) { |
||||
|
boolean exists = newEntryService.doesEmployeeExist(empCode); |
||||
|
Map<String, Boolean> response = new HashMap<>(); |
||||
|
response.put("exists", exists); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/cpsexists") |
||||
|
public ResponseEntity<Map<String, Boolean>> checkEmployeeExistsCps(@RequestParam String empCode) { |
||||
|
boolean exists = newEntryService.doesEmployeeExistgis(empCode); |
||||
|
Map<String, Boolean> response = new HashMap<>(); |
||||
|
response.put("exists", exists); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/prexists") |
||||
|
public ResponseEntity<Map<String, Boolean>> checkEmployeeExistsRpr(@RequestParam String empCode) { |
||||
|
boolean exists = newEntryService.doesEmployeeExistRPR(empCode); |
||||
|
Map<String, Boolean> response = new HashMap<>(); |
||||
|
response.put("exists", exists); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/familypensionexists") |
||||
|
public ResponseEntity<Map<String, Boolean>> checkEmployeeExistsfp(@RequestParam String empCode) { |
||||
|
boolean exists = newEntryService.doesEmployeeExistfp(empCode); |
||||
|
Map<String, Boolean> response = new HashMap<>(); |
||||
|
response.put("exists", exists); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,201 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
|
||||
|
|
||||
|
import java.time.Period; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.time.temporal.ChronoUnit; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PendencyAutoConversionService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/pensioner/autoconversion") |
||||
|
@RestController |
||||
|
public class PendencyAutoConversionApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
// @Autowired |
||||
|
// private DeptAuditService deptAuditService; |
||||
|
// |
||||
|
// @Autowired |
||||
|
// public PendencyAutoConversionService pendencyAutoConversionService; |
||||
|
// |
||||
|
// @GetMapping("/updateintopendency") |
||||
|
// public boolean updateIfRetirementDateCrossed() { |
||||
|
// try { |
||||
|
// List<Map<String, Object>> covertList = pendencyAutoConversionService.getConvertingTempIds(); |
||||
|
// System.out.println("covertList===" + covertList); |
||||
|
// |
||||
|
// if (!covertList.isEmpty()) { |
||||
|
// for (Map<String, Object> tempIdMap : covertList) { |
||||
|
// try { |
||||
|
// // Extract temp_id and convert it to a String |
||||
|
// Object tempIdRaw = tempIdMap.get("temp_id"); |
||||
|
// String tempId = tempIdRaw != null ? String.valueOf(tempIdRaw) : null; |
||||
|
// |
||||
|
// System.out.println("Converted tempId: " + tempId); |
||||
|
// |
||||
|
// // Ensure tempId is not null before processing |
||||
|
// if (tempId != null && !tempId.trim().isEmpty()) { |
||||
|
// |
||||
|
// String fileMovedBy=pendencyAutoConversionService.getFileMovedByTempId(tempId); |
||||
|
// |
||||
|
// if(fileMovedBy!=null) { |
||||
|
// boolean isProcessed = pendencyAutoConversionService.updateEntryDetails(tempId); |
||||
|
// |
||||
|
// if (isProcessed) { |
||||
|
// List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
||||
|
// System.out.println("emp_details: " + emp_details); |
||||
|
// |
||||
|
// boolean updated = pendencyAutoConversionService.saveHistory(emp_details,fileMovedBy); |
||||
|
// |
||||
|
// if (!updated) { |
||||
|
// System.out.println("Failed to save history for tempId: " + tempId); |
||||
|
// continue; |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
// else { |
||||
|
// System.out.println("fileMovedBy is NUll for temp_id="+tempId); |
||||
|
// } |
||||
|
// |
||||
|
// } |
||||
|
// } catch (Exception innerEx) { |
||||
|
// System.err.println("Error processing tempId: " + tempIdMap.get("temp_id")); |
||||
|
// innerEx.printStackTrace(); |
||||
|
// continue; // Continue processing the next record |
||||
|
// } |
||||
|
// } |
||||
|
// return true; |
||||
|
// } else { |
||||
|
// System.out.println("No records found for processing."); |
||||
|
// return false; |
||||
|
// } |
||||
|
// } catch (Exception e) { |
||||
|
// System.err.println("Exception in updateIfRetirementDateCrossed: " + e.getMessage()); |
||||
|
// e.printStackTrace(); |
||||
|
// return false; |
||||
|
// } |
||||
|
// } |
||||
|
|
||||
|
@Scheduled(cron = "*/40 * * * * ?") // Runs every 40 seconds |
||||
|
public void scheduledPendencyUpdate() { |
||||
|
System.out.println("Scheduled Task Started: Updating Pensioner Pending Duration 40"); |
||||
|
|
||||
|
Map<String, Object> result = GetRecordsUpdatePendencyDuration(); |
||||
|
|
||||
|
System.out.println("Scheduled Task Completed: " + result); |
||||
|
|
||||
|
// Fetch the pending pensioners count after the update |
||||
|
int pendingCount = getPendingPensionersCount(); |
||||
|
System.out.println("Total pending pensioners after update: " + pendingCount); |
||||
|
} |
||||
|
|
||||
|
public Map<String, Object> GetRecordsUpdatePendencyDuration() { |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
// Lists to store tempIds based on update success or failure |
||||
|
List<String> successfulUpdates = new ArrayList<>(); |
||||
|
List<String> failedUpdates = new ArrayList<>(); |
||||
|
|
||||
|
String sqlQuery = "SELECT * FROM pensioner_details WHERE file_category=3 AND pending_duration='yes' AND file_status < 11"; |
||||
|
List<Map<String, Object>> details = jdbcTemplate.queryForList(sqlQuery); |
||||
|
|
||||
|
for (Map<String, Object> tempIdMap : details) { |
||||
|
String tempId = tempIdMap.get("temp_id") != null ? String.valueOf(tempIdMap.get("temp_id")) : null; |
||||
|
String retirementDateStr = tempIdMap.get("retirement_date") != null ? String.valueOf(tempIdMap.get("retirement_date")) : null; |
||||
|
|
||||
|
if (retirementDateStr != null && !retirementDateStr.trim().isEmpty()) { |
||||
|
try { |
||||
|
// Convert retirement_date to LocalDate |
||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
LocalDate startDate = LocalDate.parse(retirementDateStr, formatter); |
||||
|
LocalDate endDate = LocalDate.now(); // Current date |
||||
|
|
||||
|
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId, startDate, endDate); |
||||
|
|
||||
|
// Calculate duration |
||||
|
String updateDuration = calculatePendingDuration(startDate, endDate); |
||||
|
System.out.println("Updated Duration: " + updateDuration); |
||||
|
|
||||
|
// Update the record in the database |
||||
|
boolean isUpdated = updatePendingDuration(updateDuration, tempId); |
||||
|
|
||||
|
// Add tempId to the respective list |
||||
|
if (isUpdated) { |
||||
|
successfulUpdates.add(tempId); |
||||
|
} else { |
||||
|
failedUpdates.add(tempId); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.err.println("Error parsing retirement_date for tempId " + tempId + ": " + e.getMessage()); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("Skipping: Retirement date is null or empty for tempId: " + tempId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
response.put("status", "Success"); |
||||
|
response.put("message", "Pendency duration updated"); |
||||
|
response.put("total_records_processed", details.size()); |
||||
|
response.put("successful_updates_count", successfulUpdates.size()); |
||||
|
response.put("failed_updates_count", failedUpdates.size()); |
||||
|
response.put("successful_updates", successfulUpdates); |
||||
|
response.put("failed_updates", failedUpdates); |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
public String calculatePendingDuration(LocalDate startDate, LocalDate endDate) { |
||||
|
Period period = Period.between(startDate, endDate); |
||||
|
|
||||
|
int years = period.getYears(); |
||||
|
int months = period.getMonths(); |
||||
|
int days = period.getDays(); |
||||
|
|
||||
|
return (years > 0 ? years + " year " : "") + |
||||
|
(months > 0 ? months + " month " : "") + |
||||
|
(days > 0 ? days + " day" : ""); |
||||
|
} |
||||
|
|
||||
|
public boolean updatePendingDuration(String updateDuration, String tempId) { |
||||
|
String sqlQuery = "UPDATE pensioner_details SET reason_for_pending=? WHERE temp_id=?"; |
||||
|
int rowsUpdated = jdbcTemplate.update(sqlQuery, updateDuration, tempId); |
||||
|
System.out.println("Temp ID: " + tempId + " | Rows Updated: " + rowsUpdated); |
||||
|
return rowsUpdated > 0; |
||||
|
} |
||||
|
|
||||
|
// New method to get the count of pending pensioners |
||||
|
public int getPendingPensionersCount() { |
||||
|
String sqlQuery = "SELECT COUNT(*) FROM pensioner_details WHERE file_category=3 AND pending_duration='yes' AND file_status < 11"; |
||||
|
Integer count = jdbcTemplate.queryForObject(sqlQuery, Integer.class); |
||||
|
return count != null ? count : 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,134 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionAuditService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/pensioner/audit") |
||||
|
@RestController |
||||
|
public class PensionAuditApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionAuditService pensionAuditService; |
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = pensionAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=pensionAuditService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("Audit Certificate Received successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateFamilyPensionDetails") |
||||
|
public ResponseEntity<String> updateFamilyPensionDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = pensionAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=pensionAuditService.saveFamilyPensionHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("Audit Certificate Received successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//pendency |
||||
|
@PostMapping("/updatePendencyDetails") |
||||
|
public ResponseEntity<String> updatePendencyDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = pensionAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=pensionAuditService.savePendencyHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("Audit Certificate Received successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,110 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptPartiallyCompService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionPartiallyCompService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/pensioner/partial") |
||||
|
@RestController |
||||
|
public class PensionPartiallyCompApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
public DeptPartiallyCompService deptPartiallyCompleteService; |
||||
|
|
||||
|
@Autowired |
||||
|
public DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
public PensionReceivedService pensionReceivedService; |
||||
|
|
||||
|
@Autowired |
||||
|
public PensionPartiallyCompService pensionPartiallyCompService; |
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
int fs1=0; |
||||
|
|
||||
|
boolean isSaved = pensionPartiallyCompService.updateEntryCompletedDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchPartialCompleted(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
|
||||
|
|
||||
|
List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId); |
||||
|
System.out.println("zone_benefits:==:"+zone_benefits); |
||||
|
|
||||
|
List<Map<String, Object>> pension_benefits=pensionReceivedService.fetchPensionbenefitsById(tempId); |
||||
|
System.out.println("pension_benefits:==:"+pension_benefits); |
||||
|
|
||||
|
|
||||
|
boolean updated=pensionPartiallyCompService.saveHistory(emp_details,zone_benefits,pension_benefits,filemovedby); |
||||
|
|
||||
|
if (!emp_details.isEmpty()) { // Ensure list is not empty |
||||
|
Map<String, Object> empDetailMap = emp_details.get(0); // Get first map from the list |
||||
|
|
||||
|
// Ensure the key exists in the map |
||||
|
if (empDetailMap.containsKey("file_status")) { |
||||
|
Object fileStatusObj = empDetailMap.get("file_status"); |
||||
|
|
||||
|
if (fileStatusObj != null) { |
||||
|
String fs = fileStatusObj.toString(); // Convert to String safely |
||||
|
fs1 = Integer.parseInt(fs); // Convert to integer if needed |
||||
|
System.out.println("file_status: " + fs1); |
||||
|
} else { |
||||
|
System.out.println("file_status is null"); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("Key 'file_status' not found in emp_details"); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("emp_details list is empty"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
if(fs1==11 && fs1!=0) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Completed successfully!"); |
||||
|
} |
||||
|
else if(fs1==10 && fs1!=0){ |
||||
|
return ResponseEntity.ok("File Partially Completed!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.ok("File Status is 0!"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,94 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/department/received") |
||||
|
@RestController |
||||
|
public class PensionReceivedApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionReceivedService pensionReceivedService; |
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
// Call service method to save |
||||
|
String empNo = (String) requestData.get("empNo"); |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
boolean isSaved = pensionReceivedService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId); |
||||
|
System.out.println("zone_benefits:==:"+zone_benefits); |
||||
|
|
||||
|
boolean updated=pensionReceivedService.saveHistory(emp_details,zone_benefits,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File moved to Pension successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//gis |
||||
|
@PostMapping("/updateEmployeeDetailsgis") |
||||
|
public ResponseEntity<String> updateEmployeeDetailsGis(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
boolean isSaved = pensionReceivedService.updateEntryGisDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=pensionReceivedService.savehistoryGis(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File completed successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,625 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.CompletedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentForwardService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentReceivedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionPartiallyCompService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReportApiService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReturnFromAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@Controller |
||||
|
@RequestMapping("/gcc/pensioner") |
||||
|
public class PensionerMainController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private NewEntryService newEntryService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ReturnFromAuditService returnFromAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionAuditService pensionAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DepartmentForwardService departmentForwardService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionReceivedService pensionReceivedService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DepartmentReceivedService departmentReceivedService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ReceivedDeptProvisionalService receivedDeptProvisionalService; |
||||
|
|
||||
|
@Autowired |
||||
|
private CompletedService completedService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PensionPartiallyCompService pensionPartiallyCompService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ReportApiService reportApiService; |
||||
|
|
||||
|
|
||||
|
//////////////////////////////Pensioner pages//////////////////////////////// |
||||
|
|
||||
|
//yogi |
||||
|
@GetMapping("/audit/retirement") |
||||
|
public String pensionerauditretirment(Model model) { |
||||
|
|
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist= pensionAuditService.fetchDetailsForAudit(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/audit/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/audit/familypension") |
||||
|
public String pensionerfamilypension(Model model) { |
||||
|
|
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
|
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
List<Map<String, Object>>auditlist= pensionAuditService.fetchDetailsForAudit(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/audit/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/audit/pendency") |
||||
|
public String pensionerpendency(Model model) { |
||||
|
|
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
|
||||
|
|
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
|
||||
|
|
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
List<Map<String, Object>>auditlist= pensionAuditService.fetchDetailsForAudit(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/audit/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
///////////////////COMPLETED LIST PAGES////////////// |
||||
|
|
||||
|
@GetMapping("/completed/retirement") |
||||
|
public String pensionerretirement(Model model) { |
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>provisionallist= completedService.fetchDetailsCompletedRetirementPensionside(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+provisionallist); |
||||
|
model.addAttribute("provisionallist", provisionallist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/completed/retirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/familypension") |
||||
|
public String pensionercompleted(Model model) { |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>familypensioncompletedlist= completedService.fetchDetailsCompletedFamilyPensionPensionSide(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+familypensioncompletedlist); |
||||
|
model.addAttribute("provisionallist", familypensioncompletedlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/completed/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/pendency") |
||||
|
public String pensionercompletedpendency(Model model) { |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>pendencycompletedlist= completedService.fetchDetailsCompletedPendencyPensionSide(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+pendencycompletedlist); |
||||
|
model.addAttribute("provisionallist", pendencycompletedlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/completed/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/gis") |
||||
|
public String pensionercompletedgis(Model model) { |
||||
|
int file_cat= newEntryService.getGISFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>gislist= completedService.fetchDetailsForrecivedGiscompletedPensionside(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+gislist); |
||||
|
model.addAttribute("auditlist", gislist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/completed/gis"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/completed/provisionalretirement") |
||||
|
public String pensionercompletedretirement(Model model) { |
||||
|
int file_cat= newEntryService.getPRFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>provisionallist= completedService.fetchDetailsProvisionalDepartmentPensionside(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+provisionallist); |
||||
|
model.addAttribute("provisionallist", provisionallist); |
||||
|
|
||||
|
|
||||
|
return "modules/pensioner/pensioner/completed/provisionalretirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/completed/contributorypensionscheme") |
||||
|
public String pensionercompletedcontributory( |
||||
|
Model model) { |
||||
|
int file_cat= newEntryService.getCPSFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>completedCPSList= completedService.getCPSListPensionside(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+completedCPSList); |
||||
|
model.addAttribute("provisionallist", completedCPSList); |
||||
|
// Add the list to the model |
||||
|
model.addAttribute("completedCPSList", completedCPSList); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/completed/contributorypensionscheme"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//Ajith |
||||
|
|
||||
|
@GetMapping("/forward/retirement") |
||||
|
public String pensioneretirement(Model model) { |
||||
|
|
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>forwardlist= departmentForwardService.fetchDepatmentForwardEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("forwardlist===="+forwardlist); |
||||
|
model.addAttribute("forwardlist", forwardlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/forward/retirement"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/forward/familypension") |
||||
|
public String pensionfamily(Model model) { |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>forwardlist= departmentForwardService.fetchDepatmentForwardEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("forwardlist===="+forwardlist); |
||||
|
model.addAttribute("forwardlist", forwardlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/forward/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/forward/pendency") |
||||
|
public String pensionerforward(Model model) { |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>forwardlist= departmentForwardService.fetchDepatmentForwardEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("forwardlist===="+forwardlist); |
||||
|
model.addAttribute("forwardlist", forwardlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/forward/pendency"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//dizho |
||||
|
|
||||
|
@GetMapping("/received/retirement") |
||||
|
public String pensionerreceivedretirement(Model model) { |
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>forwardlist= departmentReceivedService.fetchPensionReceivedEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("forwardlist===="+forwardlist); |
||||
|
model.addAttribute("forwardlist", forwardlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/received/retirement"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/received/familypension") |
||||
|
public String pensionerreceivedfamilypension(Model model) { |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>forwardlist= departmentReceivedService.fetchPensionReceivedEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("forwardlist===="+forwardlist); |
||||
|
model.addAttribute("forwardlist", forwardlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/received/familypension"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/received/pendency") |
||||
|
public String pensionerreceived(Model model) { |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>forwardlist= departmentReceivedService.fetchPensionReceivedEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("forwardlist===="+forwardlist); |
||||
|
model.addAttribute("forwardlist", forwardlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/received/pendency"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/received/gis") |
||||
|
public String pensionerreceivedgis(Model model) { |
||||
|
int file_cat= newEntryService.getGISFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>gislist= pensionAuditService.fetchDetailsForrecivedGis(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+gislist); |
||||
|
model.addAttribute("auditlist", gislist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/received/gis"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/received/provisionalretirement") |
||||
|
public String pensionerprovisionalretirement(Model model) { |
||||
|
|
||||
|
int file_cat= newEntryService.getPRFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>provisionallist= receivedDeptProvisionalService.fetchDetailsProvisionalPension(file_cat); |
||||
|
|
||||
|
System.out.println("provisionallist===="+provisionallist); |
||||
|
model.addAttribute("provisionallist", provisionallist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/received/provisionalretirement"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//sanjay |
||||
|
|
||||
|
@GetMapping("/partial/pendency") |
||||
|
public String pensionerpartial(Model model) { |
||||
|
int file_cat= newEntryService.getPendencyFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist= pensionPartiallyCompService.fetchPensionPartialEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/partial/pendency"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/partial/retirement") |
||||
|
public String pensionerpartialretirement(Model model) { |
||||
|
int file_cat= newEntryService.getRetirementFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist= pensionPartiallyCompService.fetchPensionPartialEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
return "modules/pensioner/pensioner/partial/retirement"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/partial/familypension") |
||||
|
public String pensionerpartialfamily(Model model) { |
||||
|
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
||||
|
model.addAttribute("filecategory", file_cat); |
||||
|
|
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
String deptname=newEntryService.getDeptNameById(deptId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
System.out.println("deptId:"+ deptId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
model.addAttribute("deptname", deptname); |
||||
|
model.addAttribute("userId", userId); |
||||
|
|
||||
|
List<Map<String, Object>>auditlist= pensionPartiallyCompService.fetchPensionPartialEmpfiles(file_cat); |
||||
|
|
||||
|
System.out.println("auditlist===="+auditlist); |
||||
|
model.addAttribute("auditlist", auditlist); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/partial/familypension"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/reports") |
||||
|
public String report(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
Integer deptId = newEntryService.getloginuserDeptId(userId); |
||||
|
model.addAttribute("deptId", deptId); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/reports"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/dashboard") |
||||
|
public String pensionerdashboardpage(Model model) { |
||||
|
String LoginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(LoginUserId); |
||||
|
model.addAttribute("LoginUserId",LoginUserId); |
||||
|
String UserRole = LoginUserInfo.getUserRole(); |
||||
|
|
||||
|
return "modules/pensioner/pensioner/dashboard"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,145 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("gcc/api/pensioner/received/provisional") |
||||
|
public class ReceivedDeptProvisionalApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ReceivedDeptProvisionalService receivedDeptProvisionalService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
public ReceivedDeptProvisionalApiController(ReceivedDeptProvisionalService receivedDeptProvisionalService) { |
||||
|
this.receivedDeptProvisionalService = receivedDeptProvisionalService; |
||||
|
} |
||||
|
|
||||
|
//sent to completed list |
||||
|
@PostMapping("/updateEmployeeDetailsCompleted") |
||||
|
public ResponseEntity<String> updateEmployeeDetailsCompleted(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = receivedDeptProvisionalService.updateEntryDetailsCompleted(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=receivedDeptProvisionalService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File Completed successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// returned from pension to department |
||||
|
@PostMapping("/updateEmployeeDetailsReturn") |
||||
|
public ResponseEntity<String> updateEmployeeDetailsReturn(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = receivedDeptProvisionalService.updateEntryDetailsReturntoDepartment(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=receivedDeptProvisionalService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File moved to Department successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//sent again to pension from department |
||||
|
@PostMapping("/updateEmployeeDetailsSentToPension") |
||||
|
public ResponseEntity<String> updateEntryDetailsSenttoPension(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = receivedDeptProvisionalService.updateEntryDetailsSenttoPension(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=receivedDeptProvisionalService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File moved to Pension successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,143 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.hibernate.internal.build.AllowSysOut; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReportApiService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/report") |
||||
|
@RestController |
||||
|
public class ReportApiController { |
||||
|
@Autowired |
||||
|
private ReportApiService reportApiService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
//pensioner and report side common dropdown |
||||
|
@GetMapping("/getFileCategories") |
||||
|
@ResponseBody |
||||
|
public ResponseEntity<?> getFileCategories() { |
||||
|
try { |
||||
|
List<Map<String, Object>> categories = reportApiService.getFileCategories(); |
||||
|
return ResponseEntity.ok(categories); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body(Collections.singletonMap("error", "Failed to fetch categories")); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getReportData") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getReportData(@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam String deptId |
||||
|
) { |
||||
|
return reportApiService.getReportData(startDate, endDate, deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getReportDetails") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getReportDetails(@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam Integer deptId, |
||||
|
@RequestParam Integer fileCatId, |
||||
|
@RequestParam(required = false) List<String> fileStatus |
||||
|
) { |
||||
|
System.out.println("startdate>>>>>"+startDate); |
||||
|
System.out.println("endDate>>>>>"+endDate); |
||||
|
System.out.println("deptId>>>>>"+deptId); |
||||
|
System.out.println("fileCatId>>>>>"+fileCatId); |
||||
|
System.out.println("fileStatus>>>>>"+fileStatus); |
||||
|
|
||||
|
|
||||
|
return reportApiService.getReportDetails(startDate, endDate, deptId,fileCatId,fileStatus); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//pensioner side report dropdown |
||||
|
|
||||
|
@GetMapping("/getdepartment") |
||||
|
@ResponseBody |
||||
|
public ResponseEntity<?> getdepartment() { |
||||
|
try { |
||||
|
List<Map<String, Object>> categories = reportApiService.getdepartment(); |
||||
|
return ResponseEntity.ok(categories); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body(Collections.singletonMap("error", "Failed to fetch categories")); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getstatus") |
||||
|
@ResponseBody |
||||
|
public ResponseEntity<?> getstatus() { |
||||
|
try { |
||||
|
List<Map<String, Object>> categories = reportApiService.getstatus(); |
||||
|
return ResponseEntity.ok(categories); |
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
||||
|
.body(Collections.singletonMap("error", "Failed to fetch categories")); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getReportDatapension") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getReportDatapension(@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam(required = true) String fileCategoryId) |
||||
|
{ |
||||
|
System.out.println("fileCategoryId ========>"+fileCategoryId); |
||||
|
return reportApiService.getReportDatapension(startDate, endDate, fileCategoryId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getReportDetailspension") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getReportDetailspension(@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam List<String> deptIds, |
||||
|
@RequestParam Integer fileCatId, |
||||
|
@RequestParam(required = false) List<String> fileStatus) { |
||||
|
|
||||
|
System.out.println("startdate>>>>>"+startDate); |
||||
|
System.out.println("endDate>>>>>"+endDate); |
||||
|
System.out.println("deptIds: " + deptIds); |
||||
|
System.out.println("fileCatId>>>>>"+fileCatId); |
||||
|
System.out.println("fileStatus>>>>>"+fileStatus); |
||||
|
|
||||
|
return reportApiService.getReportDetailspension(startDate, endDate, deptIds, fileCatId, fileStatus); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getPensionerDetails") |
||||
|
@ResponseBody |
||||
|
public List<Map<String, Object>> getDepartmentpending(@RequestParam int file_category ) { |
||||
|
return reportApiService.getDepartmentpending(file_category); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,129 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReturnFromAuditService; |
||||
|
|
||||
|
@RequestMapping("gcc/api/department/return") |
||||
|
@RestController |
||||
|
public class ReturnFromAuditApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ReturnFromAuditService returnFromAuditService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DeptAuditService deptAuditService; |
||||
|
|
||||
|
@PostMapping("/updateEmployeeDetails") |
||||
|
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
boolean isSaved = returnFromAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=returnFromAuditService.savehistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File sent to Audit successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateReturnFamilyPension") |
||||
|
public ResponseEntity<String> updateReturnFamilyPension(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = returnFromAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=returnFromAuditService.saveFamilyPensionReturnHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File sent to Audit successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/updateReturnPendency") |
||||
|
public ResponseEntity<String> updatePendencyPension(@RequestBody Map<String, Object> requestData) { |
||||
|
try { |
||||
|
|
||||
|
// Call service method to save |
||||
|
String tempId = (String) requestData.get("tempId"); |
||||
|
String filemovedby =(String)requestData.get("filemovedby"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
boolean isSaved = returnFromAuditService.updateEntryDetails(requestData); |
||||
|
|
||||
|
if (isSaved) { |
||||
|
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
||||
|
System.out.println("emp_details:==:"+emp_details); |
||||
|
boolean updated=returnFromAuditService.savePendencyHistory(emp_details,filemovedby); |
||||
|
|
||||
|
if(updated) |
||||
|
{ |
||||
|
return ResponseEntity.ok("File sent Audit successfully!"); |
||||
|
} |
||||
|
else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,229 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.scheduler; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.time.Period; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.PendencyAutoConversionService; |
||||
|
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
||||
|
|
||||
|
@Component |
||||
|
public class PendencyAutoConversionScheduler { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private PendencyAutoConversionService pendencyAutoConversionService; |
||||
|
|
||||
|
@Autowired |
||||
|
public ReceivedDeptProvisionalService ReceivedDeptProvisionalservice; |
||||
|
|
||||
|
/** |
||||
|
* Scheduled method that runs every day 3.00am and 4.00 am to process auto-conversion tasks. |
||||
|
*/ |
||||
|
|
||||
|
@Scheduled(cron = "0 0 3 * * ?", zone = "Asia/Kolkata")// Runs every 3.00 am |
||||
|
public void executeAutoConversion() { |
||||
|
try { |
||||
|
System.out.println(" Running scheduled auto-conversion task... at 3.00 am"); |
||||
|
|
||||
|
// Step 1: Fetch temp IDs that need processing |
||||
|
List<Map<String, Object>> tempIds = pendencyAutoConversionService.getConvertingTempIds(); |
||||
|
|
||||
|
if (tempIds == null || tempIds.isEmpty()) { |
||||
|
System.out.println(" No records found for auto-conversion."); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
System.out.println(" Found " + tempIds.size() + " records for processing."); |
||||
|
|
||||
|
// Step 2: Process each tempId |
||||
|
for (Map<String, Object> tempIdMap : tempIds) { |
||||
|
String tempId = tempIdMap.get("temp_id") != null ? tempIdMap.get("temp_id").toString() : null; |
||||
|
|
||||
|
if (tempId == null || tempId.trim().isEmpty()) { |
||||
|
System.out.println(" Skipping empty temp_id."); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
System.out.println(" Processing tempId: " + tempId); |
||||
|
|
||||
|
// Step 3: Call service method to process auto-conversion |
||||
|
boolean success = pendencyAutoConversionService.processAutoConversionForTempId(tempId); |
||||
|
|
||||
|
if (success) { |
||||
|
System.out.println(" Auto-conversion completed for tempId: " + tempId); |
||||
|
} else { |
||||
|
System.out.println(" Auto-conversion failed for tempId: " + tempId); |
||||
|
} |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
System.err.println(" Error during auto-conversion task: " + e.getMessage()); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Scheduled(cron = "0 0 4 * * ?", zone = "Asia/Kolkata") // Runs every day 4.00am |
||||
|
public void scheduledPendencyUpdate() { |
||||
|
System.out.println("Scheduled Task Started 4.00 am: Updating Pensioner Pending Duration"); |
||||
|
|
||||
|
Map<String, Object> result = GetRecordsUpdatePendencyDuration(); |
||||
|
|
||||
|
System.out.println("Scheduled Task Completed: " + result); |
||||
|
|
||||
|
// Fetch the pending pensioners count after the update |
||||
|
int pendingCount = pendencyAutoConversionService.getPendingPensionersCount(); |
||||
|
System.out.println("Total pending pensioners after update: " + pendingCount); |
||||
|
} |
||||
|
|
||||
|
public Map<String, Object> GetRecordsUpdatePendencyDuration() { |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
// Lists to store tempIds based on update success or failure |
||||
|
List<String> successfulUpdates = new ArrayList<>(); |
||||
|
List<String> failedUpdates = new ArrayList<>(); |
||||
|
|
||||
|
List<Map<String, Object>> details = pendencyAutoConversionService.getPendencyUpdatingDuration(); |
||||
|
|
||||
|
List<Map<String, Object>> prdetails = pendencyAutoConversionService.getProvisionalNoPendingDuration(); |
||||
|
if(!prdetails.isEmpty()) { |
||||
|
|
||||
|
for (Map<String, Object> prdetail : prdetails) { |
||||
|
String tempId1 = prdetail.get("temp_id") != null ? String.valueOf(prdetail.get("temp_id")) : null; |
||||
|
String retirementDateStr1 = prdetail.get("retirement_date") != null ? String.valueOf(prdetail.get("retirement_date")) : null; |
||||
|
|
||||
|
try { |
||||
|
// Convert retirement_date to LocalDate |
||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
LocalDate startDate1 = LocalDate.parse(retirementDateStr1, formatter); |
||||
|
LocalDate endDate1 = LocalDate.now(); |
||||
|
|
||||
|
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId1, startDate1, endDate1); |
||||
|
|
||||
|
String updateDuration1 = pendencyAutoConversionService.calculatePendingDuration(startDate1, endDate1); |
||||
|
System.out.println("Updated Duration: " + updateDuration1); |
||||
|
|
||||
|
boolean isUpdated1 = pendencyAutoConversionService.updatePendingDurationforPR(updateDuration1, tempId1); |
||||
|
|
||||
|
if (isUpdated1) { |
||||
|
successfulUpdates.add(tempId1); |
||||
|
String filemovedby=pendencyAutoConversionService.getFileMovedByTempId(tempId1); |
||||
|
List<Map<String, Object>> empDetails=pendencyAutoConversionService.fetchEmployeeDetails(tempId1); |
||||
|
boolean historySaved = ReceivedDeptProvisionalservice.savehistory(empDetails, filemovedby); |
||||
|
if (!historySaved) { |
||||
|
System.out.println("Failed to save prno history for tempId: " + tempId1); |
||||
|
} |
||||
|
} else { |
||||
|
failedUpdates.add(tempId1); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
System.err.println("Error parsing retirement_date for tempId " + tempId1 + ": " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
if(!details.isEmpty()) { |
||||
|
|
||||
|
for (Map<String, Object> tempIdMap : details) { |
||||
|
String tempId = tempIdMap.get("temp_id") != null ? String.valueOf(tempIdMap.get("temp_id")) : null; |
||||
|
String retirementDateStr = tempIdMap.get("retirement_date") != null ? String.valueOf(tempIdMap.get("retirement_date")) : null; |
||||
|
String serviceDeathDate = tempIdMap.get("service_death") != null ? String.valueOf(tempIdMap.get("service_death")) : null; |
||||
|
// Corrected parsing for file_category |
||||
|
int fileCat = tempIdMap.get("file_category") != null ? Integer.parseInt(tempIdMap.get("file_category").toString()) : null; |
||||
|
|
||||
|
if(fileCat==3 || fileCat==5) { |
||||
|
|
||||
|
if (retirementDateStr != null && !retirementDateStr.trim().isEmpty()) { |
||||
|
try { |
||||
|
// Convert retirement_date to LocalDate |
||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
LocalDate startDate = LocalDate.parse(retirementDateStr, formatter); |
||||
|
LocalDate endDate = LocalDate.now(); // Current date |
||||
|
|
||||
|
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId, startDate, endDate); |
||||
|
|
||||
|
// Calculate duration |
||||
|
String updateDuration = pendencyAutoConversionService.calculatePendingDuration(startDate, endDate); |
||||
|
System.out.println("Updated Duration: " + updateDuration); |
||||
|
|
||||
|
// Update the record in the database |
||||
|
boolean isUpdated = pendencyAutoConversionService.updatePendingDuration(updateDuration, tempId); |
||||
|
|
||||
|
// Add tempId to the respective list |
||||
|
if (isUpdated) { |
||||
|
successfulUpdates.add(tempId); |
||||
|
} else { |
||||
|
failedUpdates.add(tempId); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.err.println("Error parsing retirement_date for tempId " + tempId + ": " + e.getMessage()); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("Skipping: Retirement date is null or empty for tempId: " + tempId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if(fileCat==2) { |
||||
|
|
||||
|
if (serviceDeathDate != null && !serviceDeathDate.trim().isEmpty()) { |
||||
|
try { |
||||
|
// Convert retirement_date to LocalDate |
||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
LocalDate startDate = LocalDate.parse(serviceDeathDate, formatter); |
||||
|
LocalDate endDate = LocalDate.now(); // Current date |
||||
|
|
||||
|
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId, startDate, endDate); |
||||
|
|
||||
|
// Calculate duration |
||||
|
String updateDuration = pendencyAutoConversionService.calculatePendingDuration(startDate, endDate); |
||||
|
System.out.println("Updated Duration: " + updateDuration); |
||||
|
|
||||
|
// Update the record in the database |
||||
|
boolean isUpdated = pendencyAutoConversionService.updatePendingDuration(updateDuration, tempId); |
||||
|
|
||||
|
// Add tempId to the respective list |
||||
|
if (isUpdated) { |
||||
|
successfulUpdates.add(tempId); |
||||
|
} else { |
||||
|
failedUpdates.add(tempId); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.err.println("Error parsing service death date for tempId " + tempId + ": " + e.getMessage()); |
||||
|
} |
||||
|
} else { |
||||
|
System.out.println("Skipping: service death date is null or empty for tempId: " + tempId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
response.put("status", "Success"); |
||||
|
response.put("message", "Pendency duration updated"); |
||||
|
response.put("total_records_processed", details.size()); |
||||
|
response.put("successful_updates_count", successfulUpdates.size()); |
||||
|
response.put("failed_updates_count", failedUpdates.size()); |
||||
|
response.put("successful_updates", successfulUpdates); |
||||
|
response.put("failed_updates", failedUpdates); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
response.put("status", "No Data"); |
||||
|
response.put("message", "No Updation in Pending Duration"); |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,180 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
|
||||
|
@Service |
||||
|
public class CompletedService { |
||||
|
|
||||
|
@Autowired |
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
private RestTemplate restTemplate; |
||||
|
private ObjectMapper objectMapper; |
||||
|
@Autowired |
||||
|
private AppConfig appconfig; |
||||
|
|
||||
|
public CompletedService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
||||
|
this.restTemplate = restTemplate; |
||||
|
this.objectMapper = objectMapper; |
||||
|
} |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
@Autowired |
||||
|
public GetFileStatusService getFileStatus; |
||||
|
|
||||
|
public List<Map<String, Object>> getCPSList(Integer file_cat,Integer deptId) { |
||||
|
String query = "SELECT * FROM cps_pensioner_details where file_category = ? and dept_id=? and file_status=11 "; |
||||
|
|
||||
|
try { |
||||
|
return jdbcTemplate.queryForList(query,file_cat,deptId); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
///////////////////CPS completed list method/////////// |
||||
|
|
||||
|
public List<Map<String, Object>> getCPSListPensionside(Integer file_cat) { |
||||
|
String query = "SELECT * FROM cps_pensioner_details where file_category = ? and file_status=11 "; |
||||
|
|
||||
|
try { |
||||
|
return jdbcTemplate.queryForList(query,file_cat); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getCPSListByEmpNo(String empNo) { |
||||
|
String query = "SELECT * FROM cps_pensioner_details WHERE emp_no = ?"; |
||||
|
|
||||
|
try { |
||||
|
return jdbcTemplate.queryForList(query, empNo); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//////////////////////////// |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
////////Retirement completed list method/////////////////// |
||||
|
public List<Map<String, Object>> fetchDetailsCompletedRetirement(Integer file_cat,Integer deptId) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? AND dept_id=? and file_status=11 AND is_closed=0"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat,deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsCompletedRetirementPensionside(Integer file_cat) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? and file_status=11 AND is_closed=0"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat); |
||||
|
} |
||||
|
///////////////////////// |
||||
|
|
||||
|
|
||||
|
|
||||
|
///////////////////Family pension completed list method////////////// |
||||
|
public List<Map<String, Object>> fetchDetailsCompletedFamilyPension(Integer file_cat,Integer deptId) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? AND dept_id=? and file_status=11"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat,deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsCompletedFamilyPensionPensionSide(Integer file_cat) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? and file_status=11"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat); |
||||
|
} |
||||
|
////////////////////////// |
||||
|
|
||||
|
|
||||
|
|
||||
|
///////////////Pendency completed method//////////////// |
||||
|
public List<Map<String, Object>> fetchDetailsCompletedPendency(Integer file_cat,Integer deptId) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? AND dept_id=? and file_status=11"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat,deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsCompletedPendencyPensionSide(Integer file_cat) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? and file_status=11"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat); |
||||
|
} |
||||
|
////////////////////// |
||||
|
|
||||
|
|
||||
|
|
||||
|
////////////Gis completed list method |
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsForrecivedGiscompleted(Integer file_cat,Integer deptId) { |
||||
|
String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND dept_id=? AND file_status = 11"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(query,file_cat,deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsForrecivedGiscompletedPensionside(Integer file_cat) { |
||||
|
String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND file_status = 11"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(query,file_cat); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
////////////////Provisional retirement completed list method |
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsProvisionalDepartmentCompleted(Integer file_cat,Integer deptId) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? AND dept_id=? and file_status=11"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat,deptId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchDetailsProvisionalDepartmentPensionside(Integer file_cat) { |
||||
|
String query = "SELECT * " + |
||||
|
"FROM pensioner_details " + |
||||
|
"WHERE file_category=? and file_status=11"; |
||||
|
return jdbcTemplate.queryForList(query,file_cat); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,402 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
|
||||
|
@Service |
||||
|
public class DashboardApiService { |
||||
|
@Autowired |
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
@Autowired |
||||
|
public GetFileStatusService getFileStatus; |
||||
|
|
||||
|
public List<Map<String, Object>> getTempEmpDetails(String tempId) { |
||||
|
System.out.println("service"); |
||||
|
System.out.println(tempId); |
||||
|
|
||||
|
String sql = "SELECT MH.file_moved_date,sm.file_status,MH.remarks FROM file_movement_history MH" |
||||
|
+ " inner join file_status_master sm on MH.file_status= sm.id where temp_id=? order by MH.file_moved_date desc "; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql, tempId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getEmpDetails(String empNo) { |
||||
|
System.out.println("service"); |
||||
|
System.out.println(empNo); |
||||
|
|
||||
|
String sql = "SELECT dm.dept_name,fm.file_name, sm.file_status ,pd.temp_id " + |
||||
|
"FROM pensioner_details pd " + |
||||
|
"INNER JOIN file_category_master fm ON pd.file_category = fm.id " + |
||||
|
"INNER JOIN file_status_master sm ON sm.id = pd.file_status " + |
||||
|
"inner join department_master dm on dm.id=pd.dept_id "+ |
||||
|
|
||||
|
"WHERE pd.emp_no = ? " + |
||||
|
|
||||
|
"UNION " + |
||||
|
"SELECT dm.dept_name,fm.file_name, sm.file_status ,cps.temp_id " + |
||||
|
"FROM cps_pensioner_details cps " + |
||||
|
"INNER JOIN file_category_master fm ON cps.file_category = fm.id " + |
||||
|
"INNER JOIN file_status_master sm ON sm.id = cps.file_status " + |
||||
|
"inner join department_master dm on dm.id=cps.dept_id "+ |
||||
|
|
||||
|
"WHERE cps.emp_no = ?"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql, empNo, empNo); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getPensionEmpDetails(String empNo) { |
||||
|
System.out.println("service"); |
||||
|
System.out.println(empNo); |
||||
|
|
||||
|
String sql = "SELECT dm.dept_name,fm.file_name, sm.file_status ,pd.temp_id " + |
||||
|
"FROM pensioner_details pd " + |
||||
|
"INNER JOIN file_category_master fm ON pd.file_category = fm.id " + |
||||
|
"INNER JOIN file_status_master sm ON sm.id = pd.file_status " + |
||||
|
"inner join department_master dm on dm.id=pd.dept_id "+ |
||||
|
"WHERE pd.emp_no = ? " + |
||||
|
"UNION " + |
||||
|
"SELECT dm.dept_name,fm.file_name, sm.file_status ,cps.temp_id " + |
||||
|
"FROM cps_pensioner_details cps " + |
||||
|
"INNER JOIN file_category_master fm ON cps.file_category = fm.id " + |
||||
|
"INNER JOIN file_status_master sm ON sm.id = cps.file_status " + |
||||
|
"inner join department_master dm on dm.id=cps.dept_id "+ |
||||
|
"WHERE cps.emp_no = ?"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql, empNo, empNo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/* public List<Map<String, Object>> getEmployeeDetailss(String fileName) { |
||||
|
|
||||
|
|
||||
|
String sql = "SELECT emp_no FROM gcc_pensioner.pensioner_details pd " + |
||||
|
"INNER JOIN gcc_pensioner.file_category_master cm ON pd.file_category = cm.id " + |
||||
|
"WHERE cm.file_name = ?"; |
||||
|
return jdbcTemplate .queryForList(sql, new Object[]{fileName}); |
||||
|
}*/ |
||||
|
/* public List<Map<String, Object>> getStageWiseCounts() { |
||||
|
String sql = |
||||
|
"SELECT category, SUM(category_count) AS category_count FROM (" + |
||||
|
" SELECT " + |
||||
|
" CASE " + |
||||
|
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
||||
|
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
||||
|
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
||||
|
" WHEN sm.id = 11 THEN 'Completed' " + |
||||
|
|
||||
|
" END AS category, " + |
||||
|
" COUNT(*) AS category_count " + |
||||
|
" FROM gcc_pensioner.pensioner_details pd " + |
||||
|
" INNER JOIN gcc_pensioner.file_status_master sm ON pd.file_status = sm.id " + |
||||
|
" GROUP BY category " + |
||||
|
|
||||
|
" UNION ALL " + |
||||
|
|
||||
|
" SELECT " + |
||||
|
" CASE " + |
||||
|
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
||||
|
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
||||
|
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
||||
|
" WHEN sm.id = 11 THEN 'Completed' " + |
||||
|
|
||||
|
" END AS category, " + |
||||
|
" COUNT(*) AS category_count " + |
||||
|
" FROM gcc_pensioner.cps_pensioner_details cps " + |
||||
|
" INNER JOIN gcc_pensioner.file_status_master sm ON cps.file_status = sm.id " + |
||||
|
" GROUP BY category " + |
||||
|
") AS combined_results " + |
||||
|
"GROUP BY category;"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
|
||||
|
}*/ |
||||
|
|
||||
|
public List<Map<String, Object>> getEmployeeDetails(String FileId) { |
||||
|
String query; |
||||
|
|
||||
|
switch (FileId) { |
||||
|
case "1": |
||||
|
case "2": |
||||
|
case "3": |
||||
|
case "4": |
||||
|
case "5": |
||||
|
query = "SELECT pd.emp_no " + |
||||
|
"FROM pensioner_details pd " + |
||||
|
"INNER JOIN file_category_master cm " + |
||||
|
"ON pd.file_category = cm.id " + |
||||
|
"WHERE cm.id = ?"; |
||||
|
break; |
||||
|
|
||||
|
case "6": |
||||
|
query = "SELECT cps.emp_no " + |
||||
|
"FROM cps_pensioner_details cps " + |
||||
|
"INNER JOIN file_category_master cm " + |
||||
|
"ON cps.file_category = cm.id " + |
||||
|
"WHERE cm.id = ?"; |
||||
|
break; |
||||
|
|
||||
|
default: |
||||
|
return Collections.emptyList(); |
||||
|
} |
||||
|
|
||||
|
return jdbcTemplate.queryForList(query, FileId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchCategoryCounts() { |
||||
|
String sql = "SELECT file_name, id, COALESCE(SUM(category_count), 0) AS category_count " + |
||||
|
"FROM ( " + |
||||
|
" SELECT cm.file_name, cm.id,COUNT(pd.file_category) AS category_count " + |
||||
|
" FROM file_category_master cm " + |
||||
|
" LEFT JOIN pensioner_details pd " + |
||||
|
" ON pd.file_category = cm.id " + |
||||
|
" AND pd.is_closed='0' " + |
||||
|
|
||||
|
|
||||
|
" GROUP BY cm.file_name,cm.id" + |
||||
|
" UNION ALL " + |
||||
|
" SELECT cm.file_name, cm.id,COUNT(cps.file_category) AS category_count " + |
||||
|
" FROM file_category_master cm " + |
||||
|
" LEFT JOIN cps_pensioner_details cps " + |
||||
|
" ON cps.file_category = cm.id " + |
||||
|
|
||||
|
|
||||
|
" GROUP BY cm.file_name ,cm.id " + |
||||
|
") combined_counts " + |
||||
|
"GROUP BY file_name,id"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
public List<Map<String, Object>> fetchCategorysearchCounts(String startdate, String enddate) { |
||||
|
String sql = "SELECT cm.file_name, COALESCE(SUM(category_count), 0) AS category_count " + |
||||
|
"FROM ( " + |
||||
|
" SELECT cm.file_name, COUNT(pd.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.file_category_master cm " + |
||||
|
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
||||
|
" ON pd.file_category = cm.id " + |
||||
|
" AND (? IS NULL OR (? = ? AND DATE(pd.created_date) = ?) OR (DATE(pd.created_date) >= ? AND DATE(pd.created_date) <= ?)) " + |
||||
|
|
||||
|
" GROUP BY cm.file_name " + |
||||
|
" UNION ALL " + |
||||
|
" SELECT cm.file_name, COUNT(cps.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.file_category_master cm " + |
||||
|
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
||||
|
" ON cps.file_category = cm.id " + |
||||
|
" AND (? IS NULL OR (? = ? AND DATE(cps.created_date) = ?) OR (DATE(cps.created_date) >= ? AND DATE(cps.created_date) <= ?)) " + |
||||
|
|
||||
|
" GROUP BY cm.file_name " + |
||||
|
") combined_counts " + |
||||
|
"RIGHT JOIN gcc_pensioner.file_category_master cm " + |
||||
|
"ON combined_counts.file_name = cm.file_name " + |
||||
|
|
||||
|
"GROUP BY cm.file_name"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql, new Object[]{ |
||||
|
startdate, startdate, enddate, startdate, // For `pd.created_date` exact match or range |
||||
|
startdate, enddate, // For `pd.created_date` range |
||||
|
startdate, startdate, enddate, startdate, // For `cps.created_date` exact match or range |
||||
|
startdate, enddate // For `cps.created_date` range |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
}//department*/ |
||||
|
public List<Map<String, Object>> getDepartment() { |
||||
|
String sql = "SELECT dept_id,dept_name FROM department_master WHERE dept_id <> 2000"; |
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> DepartmenfetchCategoryCounts(String deptId) { |
||||
|
String sql = "SELECT cm.file_name, cm.id, " + |
||||
|
" COALESCE(pd.category_count, 0) + COALESCE(cps.category_count, 0) AS category_count " + |
||||
|
"FROM file_category_master cm " + |
||||
|
"LEFT JOIN ( " + |
||||
|
" SELECT file_category, COUNT(*) AS category_count " + |
||||
|
" FROM pensioner_details " + |
||||
|
" WHERE (? IS NULL OR dept_id = ?) " + |
||||
|
" AND is_closed='0' " + |
||||
|
" GROUP BY file_category " + |
||||
|
") pd ON cm.id = pd.file_category " + |
||||
|
"LEFT JOIN ( " + |
||||
|
" SELECT file_category, COUNT(*) AS category_count " + |
||||
|
" FROM cps_pensioner_details " + |
||||
|
" WHERE (? IS NULL OR dept_id = ?) " + |
||||
|
" GROUP BY file_category " + |
||||
|
") cps ON cm.id = cps.file_category"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql, deptId, deptId, deptId, deptId); |
||||
|
|
||||
|
|
||||
|
} public List<Map<String, Object>> fetchchartCategoryCounts(String deptId, String startDate, String endDate) { |
||||
|
String sql = "SELECT cm.file_name, cm.id, " + |
||||
|
" COALESCE(pd.category_count, 0) + COALESCE(cps.category_count, 0) AS category_count " + |
||||
|
"FROM file_category_master cm " + |
||||
|
"LEFT JOIN ( " + |
||||
|
" SELECT file_category, COUNT(*) AS category_count " + |
||||
|
" FROM pensioner_details " + |
||||
|
" WHERE (? IS NULL OR dept_id = ?) " + |
||||
|
" AND (? IS NULL OR date(created_date) >= ?) " + |
||||
|
" AND (? IS NULL OR date(created_date) <= ?) " + |
||||
|
" AND is_closed='0' " + |
||||
|
" GROUP BY file_category " + |
||||
|
") pd ON cm.id = pd.file_category " + |
||||
|
"LEFT JOIN ( " + |
||||
|
" SELECT file_category, COUNT(*) AS category_count " + |
||||
|
" FROM gcc_pensioner.cps_pensioner_details " + |
||||
|
" WHERE (? IS NULL OR dept_id = ?) " + |
||||
|
" AND (? IS NULL OR date(created_date) >= ?) " + |
||||
|
" AND (? IS NULL OR date(created_date) <= ?) " + |
||||
|
" GROUP BY file_category " + |
||||
|
") cps ON cm.id = cps.file_category"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList( |
||||
|
sql, deptId, deptId, startDate, startDate, endDate, endDate, |
||||
|
deptId, deptId, startDate, startDate, endDate, endDate |
||||
|
); |
||||
|
} |
||||
|
public List<Map<String, Object>> getStageWiseCounts(String deptId, String startDate, String endDate) { |
||||
|
String sql = |
||||
|
"WITH categories AS (" + |
||||
|
" SELECT 'Audit Pending' AS category UNION ALL " + |
||||
|
" SELECT 'Department Pending' UNION ALL " + |
||||
|
" SELECT 'Pension Pending' UNION ALL " + |
||||
|
" SELECT 'Completed' " + |
||||
|
") " + |
||||
|
"SELECT c.category, COALESCE(SUM(cr.category_count), 0) AS category_count " + |
||||
|
"FROM categories c " + |
||||
|
"LEFT JOIN ( " + |
||||
|
" SELECT category, SUM(category_count) AS category_count FROM ( " + |
||||
|
" SELECT " + |
||||
|
" CASE " + |
||||
|
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
||||
|
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
||||
|
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
||||
|
" WHEN sm.id = 11 THEN 'Completed' " + |
||||
|
" END AS category, " + |
||||
|
" COUNT(*) AS category_count " + |
||||
|
" FROM gcc_pensioner.pensioner_details pd " + |
||||
|
" INNER JOIN gcc_pensioner.file_status_master sm ON pd.file_status = sm.id " + |
||||
|
" WHERE (? IS NULL OR pd.dept_id = ?) " + |
||||
|
" AND (? IS NULL OR DATE(pd.created_date) >= ?) " + |
||||
|
" AND (? IS NULL OR DATE(pd.created_date) <= ?) " + |
||||
|
" AND pd.is_closed='0' " + |
||||
|
" GROUP BY category " + |
||||
|
|
||||
|
" UNION ALL " + |
||||
|
|
||||
|
" SELECT " + |
||||
|
" CASE " + |
||||
|
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
||||
|
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
||||
|
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
||||
|
" WHEN sm.id = 11 THEN 'Completed' " + |
||||
|
" END AS category, " + |
||||
|
" COUNT(*) AS category_count " + |
||||
|
" FROM gcc_pensioner.cps_pensioner_details cps " + |
||||
|
" INNER JOIN gcc_pensioner.file_status_master sm ON cps.file_status = sm.id " + |
||||
|
" WHERE (? IS NULL OR cps.dept_id = ?) " + |
||||
|
" AND (? IS NULL OR DATE(cps.created_date) >= ?) " + |
||||
|
" AND (? IS NULL OR DATE(cps.created_date) <= ?) " + |
||||
|
" GROUP BY category " + |
||||
|
" ) AS combined_results " + |
||||
|
" GROUP BY category " + |
||||
|
") cr ON c.category = cr.category " + |
||||
|
"GROUP BY c.category;"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList( |
||||
|
sql, deptId, deptId, startDate, startDate, endDate, endDate, |
||||
|
deptId, deptId, startDate, startDate, endDate, endDate |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//simple |
||||
|
public List<Map<String, Object>> fetchCategorysearchCounts(String startdate, String enddate,String deptId) { |
||||
|
String sql = "SELECT cm.file_name, COALESCE(SUM(category_count), 0) AS category_count " + |
||||
|
"FROM gcc_pensioner.file_category_master cm " + |
||||
|
"LEFT JOIN ( " + |
||||
|
" SELECT pd.file_category, COUNT(pd.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.pensioner_details pd " + |
||||
|
" WHERE (? IS NULL OR DATE(pd.created_date) = ? OR (DATE(pd.created_date) BETWEEN ? AND ?)) " + |
||||
|
" AND (? IS NULL OR pd.dept_id = ?) " + |
||||
|
" AND pd.is_closed='0' " + |
||||
|
" GROUP BY pd.file_category " + |
||||
|
|
||||
|
" UNION ALL " + |
||||
|
" SELECT cps.file_category, COUNT(cps.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.cps_pensioner_details cps " + |
||||
|
" WHERE (? IS NULL OR DATE(cps.created_date) = ? OR (DATE(cps.created_date) BETWEEN ? AND ?)) " + |
||||
|
" AND (? IS NULL OR cps.dept_id = ?) " + |
||||
|
" GROUP BY cps.file_category " + |
||||
|
") combined_counts ON cm.id = combined_counts.file_category " + |
||||
|
"GROUP BY cm.file_name"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql, new Object[]{ |
||||
|
startdate, startdate, startdate, enddate, deptId, deptId, // For `pd.created_date` and `dept_id` |
||||
|
startdate, startdate, startdate, enddate, deptId, deptId // For `cps.created_date` and `dept_id` |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
//total 5 changes for is_closed=0 |
||||
|
/* this is with pendency file category |
||||
|
* "SELECT file_name, SUM(category_count) AS category_count " + |
||||
|
"FROM ( " + |
||||
|
" SELECT cm.file_name, COUNT(pd.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.file_category_master cm " + |
||||
|
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
||||
|
" ON pd.file_category = cm.id " + |
||||
|
" GROUP BY cm.file_name " + |
||||
|
" UNION ALL " + |
||||
|
" SELECT cm.file_name, COUNT(cps.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.file_category_master cm " + |
||||
|
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
||||
|
" ON cps.file_category = cm.id " + |
||||
|
" GROUP BY cm.file_name " + |
||||
|
") combined_counts " + |
||||
|
"GROUP BY file_name";--------------------------------------------------------------------------"SELECT cm.file_name, COALESCE(SUM(category_count), 0) AS category_count " + |
||||
|
"FROM ( " + |
||||
|
" SELECT cm.file_name, COUNT(pd.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.file_category_master cm " + |
||||
|
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
||||
|
" ON pd.file_category = cm.id " + |
||||
|
" AND (? IS NULL OR (? = ? AND DATE(pd.created_date) = ?) OR (DATE(pd.created_date) >= ? AND DATE(pd.created_date) <= ?)) " + |
||||
|
" GROUP BY cm.file_name " + |
||||
|
" UNION ALL " + |
||||
|
" SELECT cm.file_name, COUNT(cps.file_category) AS category_count " + |
||||
|
" FROM gcc_pensioner.file_category_master cm " + |
||||
|
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
||||
|
" ON cps.file_category = cm.id " + |
||||
|
" AND (? IS NULL OR (? = ? AND DATE(cps.created_date) = ?) OR (DATE(cps.created_date) >= ? AND DATE(cps.created_date) <= ?)) " + |
||||
|
" GROUP BY cm.file_name " + |
||||
|
") combined_counts " + |
||||
|
"RIGHT JOIN gcc_pensioner.file_category_master cm " + |
||||
|
"ON combined_counts.file_name = cm.file_name " + |
||||
|
"GROUP BY cm.file_name"; */ |
||||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue