Browse Source

New Modules & Update scripts

main
Balaji 1 year ago
parent
commit
3f8518fd02
  1. BIN
      .DS_Store
  2. 2
      pom.xml
  3. BIN
      src/.DS_Store
  4. BIN
      src/main/.DS_Store
  5. BIN
      src/main/java/.DS_Store
  6. BIN
      src/main/java/in/.DS_Store
  7. BIN
      src/main/java/in/gov/.DS_Store
  8. BIN
      src/main/java/in/gov/chennaicorporation/.DS_Store
  9. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store
  10. 7
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/CampaignReportService.java
  11. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/.DS_Store
  12. 3
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ComplaintController.java
  13. 8
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/FollowUpController.java
  14. 6
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/InprogresscallController.java
  15. 7
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/PublicFollowUpController.java
  16. 4
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAPIController.java
  17. 160
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAdminSettingsController.java
  18. 13
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcCallsController.java
  19. 12
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcPgrComplaintsMainController.java
  20. 11
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/SocialMediaApiController.java
  21. 346
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/SocialMediaController.java
  22. 30
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ComplaintService.java
  23. 54
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/FollowUpService.java
  24. 517
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAgentAssignService.java
  25. 19
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcService.java
  26. 4
      src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/StatusCountService.java
  27. 3
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java
  28. 21
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
  29. 5
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java
  30. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/nulm/.DS_Store
  31. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/.DS_Store
  32. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/.DS_Store
  33. 136
      src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DashboardApiController.java
  34. 43
      src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/service/DepartmentReceivedService.java
  35. 2
      src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/service/ReturnFromAuditService.java
  36. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/school/.DS_Store
  37. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/.DS_Store
  38. 1061
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/BuildingAssetController.java
  39. 907
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/DropdownsController.java
  40. 67
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/MainController.java
  41. 462
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/SchoolPropertyController.java
  42. 20
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/SchoolReportController.java
  43. 127
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/StudentInfoController.java
  44. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/.DS_Store
  45. 262
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/BuildingAssetService.java
  46. 6
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/DropdownsService.java
  47. 782
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/SchoolPropertyService.java
  48. 298
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/SchoolReportService.java
  49. 857
      src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/StudentInfoService.java
  50. 480
      src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java
  51. 126
      src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/CreateEventAPIController.java
  52. 147
      src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java
  53. 37
      src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/DateTimeUtil.java
  54. 484
      src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java
  55. 167
      src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java
  56. 46
      src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java
  57. 9
      src/main/java/in/gov/chennaicorporation/gccoffice/works/service/ERPEstimateService.java
  58. 8
      src/main/java/in/gov/chennaicorporation/gccoffice/works/service/EstimateService.java
  59. BIN
      src/main/resources/.DS_Store
  60. 6
      src/main/resources/application.properties
  61. BIN
      src/main/resources/static/.DS_Store
  62. BIN
      src/main/resources/static/assets/node_modules/.DS_Store
  63. BIN
      src/main/resources/static/assets/node_modules/ammap3/.DS_Store
  64. BIN
      src/main/resources/static/assets/node_modules/ammap3/ammap/.DS_Store
  65. BIN
      src/main/resources/templates/.DS_Store
  66. BIN
      src/main/resources/templates/fragments/.DS_Store
  67. BIN
      src/main/resources/templates/fragments/modules/.DS_Store
  68. 1
      src/main/resources/templates/fragments/modules/com_petition/petition_view_script.html
  69. BIN
      src/main/resources/templates/modules/.DS_Store
  70. 692
      src/main/resources/templates/modules/callcenter/assignagents.html
  71. 71
      src/main/resources/templates/modules/callcenter/campaignreport.html
  72. BIN
      src/main/resources/templates/modules/callcenterqaqc/.DS_Store
  73. 156
      src/main/resources/templates/modules/callcenterqaqc/agentqaqccalls.html
  74. 148
      src/main/resources/templates/modules/callcenterqaqc/agentqaqcfollowupcalls.html
  75. 149
      src/main/resources/templates/modules/callcenterqaqc/agentqaqcinprogresscalls.html
  76. 151
      src/main/resources/templates/modules/callcenterqaqc/agentqaqcpublicfollowupcalls.html
  77. 477
      src/main/resources/templates/modules/callcenterqaqc/pgrcomplaints.html
  78. 29
      src/main/resources/templates/modules/callcenterqaqc/qaqcadminsettings.html
  79. 68
      src/main/resources/templates/modules/callcenterqaqc/qaqcgrievancedashboard.html
  80. 57
      src/main/resources/templates/modules/callcenterqaqc/socialmediacomplaints.html
  81. 292
      src/main/resources/templates/modules/cdwaste/approval.html
  82. 163
      src/main/resources/templates/modules/cdwaste/pending.html
  83. 303
      src/main/resources/templates/modules/cdwaste/rejected.html
  84. 4
      src/main/resources/templates/modules/com_petition/petition_list.html
  85. 8
      src/main/resources/templates/modules/com_petition/petition_view_modal_page.html
  86. 6
      src/main/resources/templates/modules/m_petition/petition_list.html
  87. BIN
      src/main/resources/templates/modules/pensioner/.DS_Store
  88. BIN
      src/main/resources/templates/modules/pensioner/department/.DS_Store
  89. 40
      src/main/resources/templates/modules/pensioner/department/dashboard.html
  90. BIN
      src/main/resources/templates/modules/pensioner/department/newentry/.DS_Store
  91. 72
      src/main/resources/templates/modules/pensioner/department/newentry/gis.html
  92. 2
      src/main/resources/templates/modules/pensioner/department/received/provisionalretirement.html
  93. BIN
      src/main/resources/templates/modules/pensioner/pensioner/.DS_Store
  94. 26
      src/main/resources/templates/modules/pensioner/pensioner/dashboard.html
  95. BIN
      src/main/resources/templates/modules/school/.DS_Store
  96. 42
      src/main/resources/templates/modules/school/addelectricalasset.html
  97. 30
      src/main/resources/templates/modules/school/addfurnitureasset.html
  98. 168
      src/main/resources/templates/modules/school/assetmanagement.html
  99. 68
      src/main/resources/templates/modules/school/building.html
  100. 1
      src/main/resources/templates/modules/school/dashboard.html

BIN
.DS_Store

2
pom.xml

@ -130,7 +130,7 @@
</dependencies>
<!-- Spring Cloud dependencies -->
<!--
<!--
<dependencyManagement>
<dependencies>
<dependency>

BIN
src/.DS_Store

BIN
src/main/.DS_Store

BIN
src/main/java/.DS_Store

BIN
src/main/java/in/.DS_Store

BIN
src/main/java/in/gov/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store

7
src/main/java/in/gov/chennaicorporation/gccoffice/callcenter/service/CampaignReportService.java

@ -360,8 +360,8 @@ public class CampaignReportService {
}
// 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 = ?";
String query1 = "SELECT data_id, " + String.join(", ", fieldColumns) + ", agent_id, call_status,remarks,DATE(updated_date) as updated_date " +
"FROM gcc_1913_campaign.upload_data WHERE campaign_id = ?";
List<Map<String, Object>> orderedFieldsList = jdbcTemplate.queryForList(query1, campaignId);
@ -464,6 +464,9 @@ public class CampaignReportService {
String remarks = orderedFields.get("remarks") != null ? orderedFields.get("remarks").toString() : "-";
finalMapping.put("Remarks", remarks);
String up_date = orderedFields.get("updated_date") != null ? orderedFields.get("updated_date").toString() : "-";
finalMapping.put("Updated_Date", up_date);
resultList.add(finalMapping);
}

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/.DS_Store

3
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ComplaintController.java

@ -625,7 +625,7 @@ public class ComplaintController {
// 3. Construct external URL
String externalUrl = String.format(
"https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintListWithImg" +
"https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=getComplaintListWithImg" +
"&From_date=%s&To_date=%s&jsonResp=Yes&UserType=Public&Token=&PageIndex=null&Status=null&repYear=%d&MobileNo=%s",
startDate, endDate, repYear, mobileNo
);
@ -669,5 +669,4 @@ public class ComplaintController {
}
}
}

8
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/FollowUpController.java

@ -1,10 +1,12 @@
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.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;
@ -74,4 +76,10 @@ public class FollowUpController {
}
}
@GetMapping("/getoffsubmittedcalls")
public List<Map<String, Object>> getFollowupSubmitDetails(@RequestParam int userId)
{
return followService.getFollowupSubmitDetails(userId);
}
}

6
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/InprogresscallController.java

@ -87,4 +87,10 @@ public class InprogresscallController {
}
}
@GetMapping("/getinprogresssubmittedcalls")
public List<Map<String, Object>> getInprogressSubmitDetails(@RequestParam int userId)
{
return inprogresscallService.getInprogressSubmitDetails(userId);
}
}

7
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/PublicFollowUpController.java

@ -1,10 +1,12 @@
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.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;
@ -79,4 +81,9 @@ public class PublicFollowUpController {
}
}
@GetMapping("/getpubsubmittedcalls")
public List<Map<String, Object>> getFollowupSubmitDetails(@RequestParam int userId)
{
return publicService.getFollowupSubmitDetails(userId);
}
}

4
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAPIController.java

@ -77,7 +77,7 @@ public class QaqcAPIController {
Map<String, Object> resultMap = new HashMap<>();
try {
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintByID&ComplaintId="
String url = "https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=getComplaintByID&ComplaintId="
+ complaintNumber + "&imgUrlonly=yes";
System.out.println("Request URL: " + url);
@ -252,7 +252,7 @@ public class QaqcAPIController {
String formattedFromDate = fromLocalDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy"));
String formattedToDate = toLocalDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy"));
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+"&RegionId="+region;
String url="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=ms_dashboard_details&From_date="+formattedFromDate+"&To_date="+formattedToDate+"&jsonResp=Yes&Status="+status+"&isQcuser=Yes"+"&ComplaintType="+type+"&ComplaintGroupId="+group+"&compmode="+mode+"&Zoneid="+zone+"&RegionId="+region;
System.out.println(url);
RestTemplate restTemplate = new RestTemplate();

160
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcAdminSettingsController.java

@ -1,160 +0,0 @@
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 QaqcAdminSettingsController {
private final RestTemplate restTemplate;
private final AppConfig appConfig;
@Autowired
public QaqcAdminSettingsController(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);
}
}
}

13
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcCallsController.java

@ -126,7 +126,7 @@ public class QaqcCallsController {
Map<String, Object> resultMap = new HashMap<>();
try {
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintByID&ComplaintId="
String url = "https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=getComplaintByID&ComplaintId="
+ complaintNumber + "&imgUrlonly=yes&isQcuser=Yes&jsonResp=Yes";
System.out.println("Request URL: " + url);
@ -293,7 +293,7 @@ public class QaqcCallsController {
// System.out.println("Formatted Start Date: " + startDate);
// System.out.println("Formatted End Date: " + endDate);
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintListWithImg&From_date="
String url = "https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=getComplaintListWithImg&From_date="
+ startDate + "&To_date=" + endDate
+ "&jsonResp=Yes&UserType=Public&Token=&PageIndex=null&Status=null&repYear=" + complaintYear
+ "&MobileNo=" + complaintMobileNumber;
@ -389,6 +389,13 @@ public class QaqcCallsController {
return resultMap;
}
@GetMapping("/getqcsubmittedcalls")
public List<Map<String, Object>> getSubmittedList(@RequestParam int userId)
{
return qaqcCallsService.getSubmitDetails(userId);
}
/*
* System.out.println("Computed Start Date: " + startDate);
* System.out.println("Computed End Date: " + endDate);
@ -396,7 +403,7 @@ public class QaqcCallsController {
* System.out.println("Computed MobileNumber: " + complaintMobileNumber);
*
* String url
* ="https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintListWithImg&From_date="
* ="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=getComplaintListWithImg&From_date="
* +startDate+"&To_date="+endDate+
* "&jsonResp=Yes&UserType=Public&Token=&PageIndex=null&Status=null&repYear="+
* complaintYear+"&MobileNo="+complaintMobileNumber;

12
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/QaqcPgrComplaintsMainController.java

@ -1,25 +1,37 @@
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.QaqcAgentsService;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("/gcc/callcenterqaqccomplaintsregistration")
@Controller("callCenterQaQcComplaintsRegistrationController")
public class QaqcPgrComplaintsMainController {
@Autowired
private QaqcAgentsService agentsService;
@GetMapping("/pgrcomplaint")
public String viewPGRpage(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());
List<Map<String, Object>> agent=agentsService.getAgentName(userId);
model.addAttribute("agent", agent);
return "modules/callcenterqaqc/pgrcomplaints";
}

11
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/SocialMediaApiController.java

@ -101,7 +101,7 @@ public class SocialMediaApiController {
Map<String, Object> resultMap = new HashMap<>();
try {
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getComplaintByID&ComplaintId="
String url = "https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=getComplaintByID&ComplaintId="
+ complaintNumber + "&imgUrlonly=yes";
System.out.println("Request URL: " + url);
@ -251,7 +251,8 @@ public class SocialMediaApiController {
@RequestParam String status,
@RequestParam String group,
@RequestParam String type,
@RequestParam String zone) {
@RequestParam String zone,
@RequestParam String region) {
Map<String, Object> response = new HashMap<>();
try {
@ -265,9 +266,11 @@ public class SocialMediaApiController {
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/newmobileservice?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/newmobileservice?serviceId=ms_dashboard_details&From_date="+formattedFromDate+"&To_date="+formattedToDate+"&jsonResp=Yes&Status="+status+"&isQcuser=Yes"+"&ComplaintType="+type+"&ComplaintGroupId="+group+"&compmode="+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;
String url="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=ms_dashboard_details&From_date="+formattedFromDate+"&To_date="+formattedToDate+"&jsonResp=Yes&Status="+status+"&isQcuser=Yes"+"&ComplaintType="+type+"&ComplaintGroupId="+group+"&compmode="+mode+"&Zoneid="+zone+"&RegionId="+region;
System.out.println(url);

346
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/SocialMediaController.java

@ -1,346 +0,0 @@
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 SocialMediaController {
private final RestTemplate restTemplate;
private final AppConfig appConfig;
@Autowired
public SocialMediaService socialservice;
@Autowired
public SocialMediaController(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);
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;
}
}

30
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ComplaintService.java

@ -8,15 +8,30 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.sql.DataSource;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.naming.java.javaURLContextFactory;
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;
@Service
public class ComplaintService {
private final String baseUrl = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice";
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
public void setDataSource(@Qualifier("mysql1913QAQCDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
private final String baseUrl = "https://erp.chennaicorporation.gov.in/pgr/newmobileservice";
public String fetchComplaintCategories() {
RestTemplate restTemplate = new RestTemplate();
@ -62,6 +77,19 @@ public class ComplaintService {
}
}
public int saveInLogs(String mobileNo, String complaintNo,String userId) {
int agent_id;
try {
agent_id = Integer.parseInt(userId);
} catch (NumberFormatException e) {
return 0;
}
String sql = "INSERT INTO pgr_complaint_reg (user_mobile_num, complaint_number, agent_id) VALUES (?, ?, ?)";
return jdbcTemplate.update(sql, mobileNo, complaintNo, agent_id);
}
}

54
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/FollowUpService.java

@ -68,6 +68,58 @@ public class FollowUpService {
//System.out.println("Rows Updated in upload data: " + rowsUpdated);
}
@Transactional
public int uploadComplaintDetailsInLogs(Map<String, Object> logDetails, String action, String complaintNumber, String remainderDate) {
//System.out.println("Complaint Details: " + logDetails);
// Extract other field values from complaintDetails
int qaqcid = (int) logDetails.get("qaqc_id");
String ccategory = logDetails.get("call_category").toString();
String personName = logDetails.get("complaint_person_name").toString();
String personMobNo = logDetails.get("complaint_mobilenumber").toString();
String complaintDate = logDetails.get("complaint_date").toString();
String cType = logDetails.get("complaint_type").toString();
String cMode = logDetails.get("complaint_mode").toString();
String department = logDetails.get("department").toString();
String cGroup = logDetails.get("complaint_group").toString();
String officialName = logDetails.get("official_name").toString();
String officialMobileNum = logDetails.get("official_mobilenum").toString();
String callStatus = logDetails.get("call_status").toString();
String remarks = logDetails.get("remarks").toString();
int agentId = (int) logDetails.get("agent_id");
int updated_agent=(int)logDetails.get("updated_agent");
boolean isProcessed = (boolean)logDetails.get("is_processed");
LocalDateTime currentDate = LocalDateTime.now();
// Determine which table to insert into based on the action
if (action.equals("FOLLOWUP")) {
String query ="INSERT INTO gcc_1913_qaqc.qaqc_followup_call_logs (qaqc_id, call_category, agent_id, complaint_number, complaint_date,complaint_person_name, "
+ "complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name,remainder_date, official_mobilenum, call_status, remarks,updated_agent) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)";
int rowsAffected = jdbcTemplate.update(query, qaqcid, ccategory, agentId, complaintNumber, complaintDate,personName,
personMobNo, cType, cMode, department, cGroup, officialName,remainderDate, officialMobileNum, callStatus, remarks,
updated_agent);
//System.out.println("Rows Updated in qaqc_followup_call_logs : " + rowsAffected);
}
String query1 = "INSERT INTO gcc_1913_qaqc.qaqc_call_logs (qaqc_id, call_category, agent_id, complaint_number,complaint_date, complaint_person_name, "
+ "complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, call_status, remarks, is_processed,updated_agent) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)";
int rowsAffected1 = jdbcTemplate.update(query1, qaqcid, ccategory, agentId, complaintNumber,complaintDate, personName,
personMobNo, cType, cMode, department, cGroup, officialName, officialMobileNum, callStatus, remarks,
isProcessed,updated_agent);
//System.out.println("Rows Updated in qaqc_call_logs: " + rowsAffected1);
return rowsAffected1;
}
/*
@Transactional
public int uploadComplaintDetailsInLogs(Map<String, Object> logDetails, String action, String complaintNumber, String remainderDate) {
//System.out.println("Complaint Details: " + logDetails);
@ -135,7 +187,7 @@ public class FollowUpService {
return rowsAffected + rowsAffected1;
}
}
*/
public List<Map<String, Object>> getCallHistory(String complaintNumber)
{

517
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAgentAssignService.java

@ -164,7 +164,7 @@ public class QaqcAgentAssignService {
// Step 4: Save upload data
if (!"officialfollowup".equalsIgnoreCase(status) && !"publicfollowup".equalsIgnoreCase(status))
{
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+"&RegionId="+region;
String url="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=ms_dashboard_details&From_date="+formattedFromDate+"&To_date="+formattedToDate+"&jsonResp=Yes&Status="+status+"&isQcuser=Yes"+"&ComplaintType="+type+"&ComplaintGroupId="+group+"&compmode="+mode+"&Zoneid="+zone+"&RegionId="+region;
System.out.println("url=="+url);
boolean isSaved = processAndSaveDetails(url, qaqcId, agents, status,assignedIDList, mode);
if (!isSaved) {
@ -197,13 +197,15 @@ public class QaqcAgentAssignService {
String formattedFromDate = formattedDate.format(outputFormatter);
if (!"officialfollowup".equalsIgnoreCase(status))
{
String sqlQuery = "SELECT * FROM gcc_1913_qaqc.qaqc_followup_call_logs WHERE remainder_date = ? AND call_status='FOLLOWUP' AND call_category IN ('CLOSED','PUBLICFOLLOWUP')";
return jdbcTemplate.queryForList(sqlQuery, formattedFromDate);
//String sqlQuery = "SELECT * FROM gcc_1913_qaqc.qaqc_followup_call_logs WHERE remainder_date = ? AND call_status='FOLLOWUP' AND call_category IN ('CLOSED','PUBLICFOLLOWUP')";
String sqlQuery = "SELECT * FROM gcc_1913_qaqc.qaqc_followup_call_logs WHERE remainder_date = ? AND call_status='FOLLOWUP' AND call_category IN ('CLOSED','PUBLICFOLLOWUP') AND isactive=1";
return jdbcTemplate.queryForList(sqlQuery, formattedFromDate);
}
else
{
String sqlQuery = "SELECT * FROM gcc_1913_qaqc.qaqc_followup_call_logs WHERE remainder_date = ? AND call_status='FOLLOWUP' AND call_category NOT IN ('CLOSED','PUBLICFOLLOWUP')";
return jdbcTemplate.queryForList(sqlQuery, formattedFromDate);
//String sqlQuery = "SELECT * FROM gcc_1913_qaqc.qaqc_followup_call_logs WHERE remainder_date = ? AND call_status='FOLLOWUP' AND call_category NOT IN ('CLOSED','PUBLICFOLLOWUP')";
String sqlQuery = "SELECT * FROM gcc_1913_qaqc.qaqc_followup_call_logs WHERE remainder_date = ? AND call_status='FOLLOWUP' AND call_category NOT IN ('CLOSED','PUBLICFOLLOWUP') AND isactive=1";
return jdbcTemplate.queryForList(sqlQuery, formattedFromDate);
}
} catch (DateTimeParseException e) {
@ -211,6 +213,98 @@ public class QaqcAgentAssignService {
}
}
@Transactional
public boolean processAndSaveFollowupDetails(int qaqc_id, List<Map<String, Object>> agents, String status,
String fromdate) {
try {
List<Map<String, Object>> detail = getfollowupdata(fromdate, status);
int index = 0;
for (Map<String, Object> agent : agents) {
int remainingDataCountForAgent = Integer.parseInt(agent.get("callsPerAgent").toString());
// System.out.println(remainingDataCountForAgent);
int currentAgentId = Integer.parseInt(agent.get("agentId").toString());
// System.out.println(agent.get("agentName").toString());
for (int i = 0; i < remainingDataCountForAgent && index < detail.size(); i++, index++) {
// System.out.println(i +" "+index);
// Save the current complaint details with the current agent_id
Integer isactive_id=(Integer) detail.get(index).get("id");
String complaintNumber = (String) detail.get(index).get("complaint_number");
String complaintDate = (String) detail.get(index).get("complaint_date");
String complanitPersonName = (String) detail.get(index).get("complaint_person_name");
String complaintPersonMobileNum = (String) detail.get(index).get("complaint_mobilenumber");
String complaintType = (String) detail.get(index).get("complaint_type");
String complaintMode = (String) detail.get(index).get("complaint_mode");
String department = (String) detail.get(index).get("department");
String complaintGroup = (String) detail.get(index).get("complaint_group");
String officerName = (String) detail.get(index).get("official_name");
String officerMobileNumber = (String) detail.get(index).get("official_mobilenum");
String status3 = status.toUpperCase();
// Insert into the database
String insertQuery = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data (qaqc_id, call_category, complaint_number, complaint_date,complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// jdbcTemplate.update(insertQuery, qaqc_id,status3
// ,complaintNumber,complaintDate, complanitPersonName,
// complaintPersonMobileNum, complaintType, complaintMode, department,
// complaintGroup, officerName, officerMobileNumber, currentAgentId);
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(insertQuery,
Statement.RETURN_GENERATED_KEYS);
ps.setInt(1, qaqc_id);
ps.setString(2, status3);
ps.setString(3, complaintNumber);
ps.setString(4, complaintDate);
ps.setString(5, complanitPersonName);
ps.setString(6, complaintPersonMobileNum);
ps.setString(7, complaintType);
ps.setString(8, complaintMode);
ps.setString(9, department);
ps.setString(10, complaintGroup);
ps.setString(11, officerName);
ps.setString(12, officerMobileNumber);
ps.setInt(13, currentAgentId);
return ps;
}, keyHolder);
Number generatedDataId = keyHolder.getKey();
if (generatedDataId != null) {
long dataId = generatedDataId.longValue();
// System.out.println("followdataId=="+dataId);
// Use the dataId in the next insert for qaqc_upload_data_history
String sql = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data_history "
+ "(qaqc_id, call_category, complaint_number, complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id, data_id) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, qaqc_id, status3, complaintNumber, complaintDate, complanitPersonName,
complaintPersonMobileNum, complaintType, complaintMode, department, complaintGroup,
officerName, officerMobileNumber, currentAgentId, dataId);
}
//System.out.println("isactive_id===="+isactive_id);
String upsql2 = "UPDATE gcc_1913_qaqc.qaqc_followup_call_logs set isactive=0 where id=?";
jdbcTemplate.update(upsql2, isactive_id);
}
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/*
@Transactional
public boolean processAndSaveFollowupDetails(int qaqc_id, List<Map<String, Object>> agents,String status,String fromdate) {
try {
@ -288,7 +382,8 @@ public class QaqcAgentAssignService {
return false;
}
}
*/
/*
@Transactional
public boolean processAndSaveDetails(String url, int qaqc_id, List<Map<String, Object>> agents,String status,List<Map<String, Object>> assignedIDList, String mode) {
try {
@ -529,10 +624,418 @@ public class QaqcAgentAssignService {
return false;
}
}
*/
@Transactional
public boolean processAndSaveDetails(String url, int qaqc_id, List<Map<String, Object>> agents, String status,
List<Map<String, Object>> assignedIDList, String mode) {
try {
RestTemplate restTemplate = new RestTemplate();
// Fetch response as String
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
String rawResponse = response.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
}
// Log raw response
// System.out.println("Raw Response: " + rawResponse);
// Parse JSON
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> responseMap = objectMapper.readValue(rawResponse, Map.class);
// Target the specific field where double-double quotes might appear
String targetField = "Address"; // Replace with the actual field name
if (responseMap.containsKey(targetField)) {
String fieldValue = (String) responseMap.get(targetField);
if (fieldValue != null && fieldValue.contains("\"\"")) {
// Clean double-double quotes in the field value
fieldValue = fieldValue.replaceAll("\"\"", "\"");
responseMap.put(targetField, fieldValue); // Update the field with cleaned value
}
}
// Extract "Details" array from the response
List<Map<String, Object>> details = (List<Map<String, Object>>) responseMap.get("Details");
// System.out.println(details);
if (details == null) {
System.err.println("No 'Details' found in the response.");
return false; // Or handle as per your requirement
}
if (mode.isEmpty() || mode.isBlank() || mode == null) {
details = details.stream().filter(map -> !map.get("Complaint Mode").equals("SOCIAL MEDIA"))
.collect(Collectors.toList());
}
// Apply filtering based on the status value
if ("withdraw".equalsIgnoreCase(status)) {
// Keep only records where "Current Status" is "Completed"
//details = details.stream().filter(entry -> "Completed".equals(entry.get("Current Status"))).toList();
details = details.stream()
.filter(entry -> "Completed".equals(entry.get("Current Status")))
.collect(Collectors.toList());
} else {
// Remove records where "Current Status" is "Completed"
//details = details.stream().filter(entry -> !"Completed".equals(entry.get("Current Status"))).toList();
details = details.stream()
.filter(entry -> !"Completed".equals(entry.get("Current Status")))
.collect(Collectors.toList());
}
int index = 0;
List<Map<String, Object>> followupData = getFollowupData();
System.out.println("followupData=" + followupData);
List<Map<String, Object>> countDetails = new ArrayList<>();
for (Map<String, Object> agent : agents) {
int remainingDataCountForAgent = Integer.parseInt(agent.get("callsPerAgent").toString());
// System.out.println(remainingDataCountForAgent);
int currentAgentId = Integer.parseInt(agent.get("agentId").toString());
// System.out.println(agent.get("agentName").toString());
Map<String, Object> countResult = new HashMap<>();
int assignedCount = 0;
for (int i = 0; i < remainingDataCountForAgent && index < details.size(); i++, index++) {
//System.out.println("CHECK = " + index + " " + details.get(index).get("Complaint Mode"));
// System.out.println(i +" "+index);
String complaintNumber1 = (String) details.get(index).get("Complaint Number");
// System.out.println("complaintNumber = "+complaintNumber1);
Map<String, Object> result = followupData.stream()
.filter(map -> complaintNumber1.equals(map.get("complaint_number"))).findFirst()
.orElse(null);
String compnum = "";
String callstatus = "";
String callcat = "";
Integer isactive_id = 0;
Date calldate = null;
if (result != null) {
compnum = (String) result.get("complaint_number");
callstatus = (String) result.get("call_status");
calldate = (Date) result.get("remainder_date");
callcat = (String) result.get("call_category");
isactive_id = (Integer) result.get("id");
}
if (!compnum.equals("") && compnum.equals(complaintNumber1)) {
//System.out.println("1 if complaintNumber = " + complaintNumber1);
Date currentDate = new Date();
if (status.equalsIgnoreCase("CLOSED") || status.equalsIgnoreCase("PUBLICFOLLOWUP")) {
if ((callcat.equalsIgnoreCase("CLOSED") || callcat.equalsIgnoreCase("PUBLICFOLLOWUP"))
&& calldate.before(currentDate)) {
//System.out.println("2 if complaintNumber = " + complaintNumber1);
String complaintDate = (String) details.get(index).get("Complaint Opened Date");
String complanitPersonName = (String) details.get(index).get("Complaint Person Name");
String complaintPersonMobileNum = (String) details.get(index)
.get("Complaint Person Number");
String complaintType = (String) details.get(index).get("Complaint Type");
String complaintMode = (String) details.get(index).get("Complaint Mode");
String department = (String) details.get(index).get("Department");
String complaintGroup = (String) details.get(index).get("Complaint Group");
String officerName = (String) details.get(index).get("Assign To");
String officerMobileNumber = (String) details.get(index).get("Official Contact Number");
String status1 = status.toUpperCase();
// Insert into the database
String insertQuery = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data (qaqc_id, call_category, complaint_number,complaint_date, "
+ "complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, "
+ "official_mobilenum, agent_id) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// jdbcTemplate.update(insertQuery, qaqc_id, status1,
// complaintNumber1,complaintDate, complanitPersonName,
// complaintPersonMobileNum, complaintType, complaintMode, department,
// complaintGroup, officerName, officerMobileNumber, currentAgentId);
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(insertQuery,
Statement.RETURN_GENERATED_KEYS);
ps.setInt(1, qaqc_id);
ps.setString(2, status);
ps.setString(3, complaintNumber1);
ps.setString(4, complaintDate);
ps.setString(5, complanitPersonName);
ps.setString(6, complaintPersonMobileNum);
ps.setString(7, complaintType);
ps.setString(8, complaintMode);
ps.setString(9, department);
ps.setString(10, complaintGroup);
ps.setString(11, officerName);
ps.setString(12, officerMobileNumber);
ps.setInt(13, currentAgentId);
return ps;
}, keyHolder);
// Retrieve the generated data_id
Number generatedDataId = keyHolder.getKey();
if (generatedDataId != null) {
long dataId = generatedDataId.longValue();
// System.out.println("dataId if=="+dataId);
// Use the dataId in the next insert for qaqc_upload_data_history
String sql = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data_history "
+ "(qaqc_id, call_category, complaint_number, complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id, data_id) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, qaqc_id, status1, complaintNumber1, complaintDate,
complanitPersonName, complaintPersonMobileNum, complaintType, complaintMode,
department, complaintGroup, officerName, officerMobileNumber,
currentAgentId, dataId);
}
assignedCount++;
String upsql = "UPDATE gcc_1913_qaqc.qaqc_followup_call_logs set isactive=0 where id=?";
jdbcTemplate.update(upsql, isactive_id);
}
if (callcat.equalsIgnoreCase("REDRESSED") || callcat.equalsIgnoreCase("OFFICIALFOLLOWUP")) {
//System.out.println("3 if complaintNumber = " + complaintNumber1);
String complaintDate = (String) details.get(index).get("Complaint Opened Date");
String complanitPersonName = (String) details.get(index).get("Complaint Person Name");
String complaintPersonMobileNum = (String) details.get(index)
.get("Complaint Person Number");
String complaintType = (String) details.get(index).get("Complaint Type");
String complaintMode = (String) details.get(index).get("Complaint Mode");
String department = (String) details.get(index).get("Department");
String complaintGroup = (String) details.get(index).get("Complaint Group");
String officerName = (String) details.get(index).get("Assign To");
String officerMobileNumber = (String) details.get(index).get("Official Contact Number");
String status1 = status.toUpperCase();
// Insert into the database
String insertQuery = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data (qaqc_id, call_category, complaint_number,complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// jdbcTemplate.update(insertQuery, qaqc_id, status1,
// complaintNumber1,complaintDate, complanitPersonName,
// complaintPersonMobileNum, complaintType, complaintMode, department,
// complaintGroup, officerName, officerMobileNumber, currentAgentId);
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(insertQuery,
Statement.RETURN_GENERATED_KEYS);
ps.setInt(1, qaqc_id);
ps.setString(2, status);
ps.setString(3, complaintNumber1);
ps.setString(4, complaintDate);
ps.setString(5, complanitPersonName);
ps.setString(6, complaintPersonMobileNum);
ps.setString(7, complaintType);
ps.setString(8, complaintMode);
ps.setString(9, department);
ps.setString(10, complaintGroup);
ps.setString(11, officerName);
ps.setString(12, officerMobileNumber);
ps.setInt(13, currentAgentId);
return ps;
}, keyHolder);
// Retrieve the generated data_id
Number generatedDataId = keyHolder.getKey();
if (generatedDataId != null) {
long dataId = generatedDataId.longValue();
// System.out.println("dataId if=="+dataId);
// Use the dataId in the next insert for qaqc_upload_data_history
String sql = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data_history "
+ "(qaqc_id, call_category, complaint_number, complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id, data_id) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, qaqc_id, status1, complaintNumber1, complaintDate,
complanitPersonName, complaintPersonMobileNum, complaintType, complaintMode,
department, complaintGroup, officerName, officerMobileNumber,
currentAgentId, dataId);
}
assignedCount++;
String upsql1 = "UPDATE gcc_1913_qaqc.qaqc_followup_call_logs set isactive=0 where id=?";
jdbcTemplate.update(upsql1, isactive_id);
}
}
else if (status.equalsIgnoreCase("REDRESSED") || status.equalsIgnoreCase("OFFICIALFOLLOWUP")) {
if ((callcat.equalsIgnoreCase("REDRESSED") || callcat.equalsIgnoreCase("OFFICIALFOLLOWUP"))
&& calldate.before(currentDate)) {
//System.out.println("2 if complaintNumber = " + complaintNumber1);
String complaintDate = (String) details.get(index).get("Complaint Opened Date");
String complanitPersonName = (String) details.get(index).get("Complaint Person Name");
String complaintPersonMobileNum = (String) details.get(index)
.get("Complaint Person Number");
String complaintType = (String) details.get(index).get("Complaint Type");
String complaintMode = (String) details.get(index).get("Complaint Mode");
String department = (String) details.get(index).get("Department");
String complaintGroup = (String) details.get(index).get("Complaint Group");
String officerName = (String) details.get(index).get("Assign To");
String officerMobileNumber = (String) details.get(index).get("Official Contact Number");
String status1 = status.toUpperCase();
// Insert into the database
String insertQuery = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data (qaqc_id, call_category, complaint_number,complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// jdbcTemplate.update(insertQuery, qaqc_id, status1,
// complaintNumber1,complaintDate, complanitPersonName,
// complaintPersonMobileNum, complaintType, complaintMode, department,
// complaintGroup, officerName, officerMobileNumber, currentAgentId);
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(insertQuery,
Statement.RETURN_GENERATED_KEYS);
ps.setInt(1, qaqc_id);
ps.setString(2, status);
ps.setString(3, complaintNumber1);
ps.setString(4, complaintDate);
ps.setString(5, complanitPersonName);
ps.setString(6, complaintPersonMobileNum);
ps.setString(7, complaintType);
ps.setString(8, complaintMode);
ps.setString(9, department);
ps.setString(10, complaintGroup);
ps.setString(11, officerName);
ps.setString(12, officerMobileNumber);
ps.setInt(13, currentAgentId);
return ps;
}, keyHolder);
// Retrieve the generated data_id
Number generatedDataId = keyHolder.getKey();
if (generatedDataId != null) {
long dataId = generatedDataId.longValue();
// System.out.println("dataId if=="+dataId);
// Use the dataId in the next insert for qaqc_upload_data_history
String sql = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data_history "
+ "(qaqc_id, call_category, complaint_number, complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id, data_id) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, qaqc_id, status1, complaintNumber1, complaintDate,
complanitPersonName, complaintPersonMobileNum, complaintType, complaintMode,
department, complaintGroup, officerName, officerMobileNumber,
currentAgentId, dataId);
}
assignedCount++;
String upsql2 = "UPDATE gcc_1913_qaqc.qaqc_followup_call_logs set isactive=0 where id=?";
jdbcTemplate.update(upsql2, isactive_id);
}
}
} else {
//System.out.println("else complaintNumber = " + complaintNumber1);
String complaintDate2 = (String) details.get(index).get("Complaint Opened Date");
String complanitPersonName2 = (String) details.get(index).get("Complaint Person Name");
String complaintPersonMobileNum2 = (String) details.get(index).get("Complaint Person Number");
String complaintType2 = (String) details.get(index).get("Complaint Type");
String complaintMode2 = (String) details.get(index).get("Complaint Mode");
String department2 = (String) details.get(index).get("Department");
String complaintGroup2 = (String) details.get(index).get("Complaint Group");
String officerName2 = (String) details.get(index).get("Assign To");
String officerMobileNumber2 = (String) details.get(index).get("Official Contact Number");
String status2 = status.toUpperCase();
// Insert into the database
String insertQuery = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data (qaqc_id, call_category, complaint_number,complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// jdbcTemplate.update(insertQuery, qaqc_id, status2,
// complaintNumber1,complaintDate2, complanitPersonName2,
// complaintPersonMobileNum2, complaintType2, complaintMode2, department2,
// complaintGroup2, officerName2, officerMobileNumber2, currentAgentId);
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(insertQuery,
Statement.RETURN_GENERATED_KEYS);
ps.setInt(1, qaqc_id);
ps.setString(2, status2);
ps.setString(3, complaintNumber1);
ps.setString(4, complaintDate2);
ps.setString(5, complanitPersonName2);
ps.setString(6, complaintPersonMobileNum2);
ps.setString(7, complaintType2);
ps.setString(8, complaintMode2);
ps.setString(9, department2);
ps.setString(10, complaintGroup2);
ps.setString(11, officerName2);
ps.setString(12, officerMobileNumber2);
ps.setInt(13, currentAgentId);
return ps;
}, keyHolder);
Number generatedDataId = keyHolder.getKey();
if (generatedDataId != null) {
long dataId2 = generatedDataId.longValue();
// System.out.println("dataId2 else=="+dataId2);
// Use the dataId in the next insert for qaqc_upload_data_history
String sql = "INSERT INTO gcc_1913_qaqc.qaqc_upload_data_history "
+ "(qaqc_id, call_category, complaint_number, complaint_date, complaint_person_name, complaint_mobilenumber, complaint_type, complaint_mode, department, complaint_group, official_name, official_mobilenum, agent_id, data_id) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, qaqc_id, status2, complaintNumber1, complaintDate2,
complanitPersonName2, complaintPersonMobileNum2, complaintType2, complaintMode2,
department2, complaintGroup2, officerName2, officerMobileNumber2, currentAgentId,
dataId2);
}
assignedCount++;
}
}
countResult.put("assignedCount", assignedCount);
countResult.put("qaqc_id", qaqc_id);
countResult.put("agent_id", currentAgentId);
countDetails.add(countResult);
}
for (Map<String, Object> assgn : assignedIDList) {
for (Map<String, Object> count : countDetails) {
if (((int) assgn.get("agent_id")) == ((int) count.get("agent_id"))) {
int assignedid = (int) assgn.get("assigned_id");
int agentid = (int) assgn.get("agent_id");
int assignedCount = (int) count.get("assignedCount");
String sql = "UPDATE agent_assigned SET data_count = ? WHERE assigned_id = ? and agent_id = ?";
jdbcTemplate.update(sql, assignedCount, assignedid, agentid);
}
}
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
private List<Map<String, Object>> getFollowupData() {
String sqlQuery ="select complaint_number, remainder_date, call_status from qaqc_followup_call_logs";
//String sqlQuery ="select complaint_number, remainder_date, call_status from qaqc_followup_call_logs";
String sqlQuery = "select id, call_category,complaint_number, remainder_date, call_status from qaqc_followup_call_logs where isactive=1";
return jdbcTemplate.queryForList(sqlQuery);
}

19
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcService.java

@ -112,7 +112,7 @@ public class QaqcService {
return jdbcTemplate.queryForList(sql, params.toArray());
}
/*
public Map<String, Long> countFollowUpsByDateAndStatus(LocalDate today, String followupStatus) {
String sqlNotClosed = "SELECT COUNT(*) FROM qaqc_followup_call_logs " +
@ -130,6 +130,23 @@ public class QaqcService {
return result;
}
*/
public Map<String, Long> countFollowUpsByDateAndStatus(LocalDate today, String followupStatus) {
String sqlNotClosed = "SELECT COUNT(*) FROM qaqc_followup_call_logs " +
"WHERE call_status = ? AND DATE(remainder_date) = ? AND call_category NOT IN ('CLOSED','PUBLICFOLLOWUP')";
String sqlClosed = "SELECT COUNT(*) FROM qaqc_followup_call_logs " +
"WHERE call_status = ? AND DATE(remainder_date) = ? AND call_category IN ('CLOSED','PUBLICFOLLOWUP')";
long countNotClosed = jdbcTemplate.queryForObject(sqlNotClosed, new Object[]{followupStatus, today}, Long.class);
long countClosed = jdbcTemplate.queryForObject(sqlClosed, new Object[]{followupStatus, today}, Long.class);
Map<String, Long> result = new HashMap<>();
result.put("officialfollowup", countNotClosed);
result.put("publicfollowup", countClosed);
return result;
}
public List<Map<String, Object>> getUnattendedlist(Integer ucount) {

4
src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/StatusCountService.java

@ -32,7 +32,7 @@ public class StatusCountService {
}
public Map<String, Object> fetchComplaintCounts(String fromDate, String toDate, String compType, String zoneName, String compMode, String compGroup, String region) {
//https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=common_api&jsonResp=Yes&subService=dashboardAbs&fromDate=&toDate=&compType=&zoneName=&compMode=&compGroup=
//https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=common_api&jsonResp=Yes&subService=dashboardAbs&fromDate=&toDate=&compType=&zoneName=&compMode=&compGroup=
String apiUrl;
if ("SOCIAL MEDIA".equalsIgnoreCase(compMode)) {
@ -99,7 +99,7 @@ public class StatusCountService {
//System.out.println(fromDate);
//System.out.println(toDate);
String url="https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=ms_dashboard_details&From_date="+fromDate+"&To_date="+toDate+"&jsonResp=Yes&Status=closed&isQcuser=Yes&ComplaintType="+compType+"&ComplaintGroupId="+compGroup+"&compmode="+compMode+"&Zoneid="+zoneName+"&RegionId="+region;
String url="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?serviceId=ms_dashboard_details&From_date="+fromDate+"&To_date="+toDate+"&jsonResp=Yes&Status=closed&isQcuser=Yes&ComplaintType="+compType+"&ComplaintGroupId="+compGroup+"&compmode="+compMode+"&Zoneid="+zoneName+"&RegionId="+region;
System.out.println("url==="+url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> response1 = restTemplate.getForEntity(url, String.class);

3
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java

@ -18,9 +18,10 @@ public class AppConfig {
public String petRegistration = "http://117.232.67.158:8061";
public String garbageCollection = "http://117.232.67.158:8067"; //117.232.67.158
public String cdwastecollectors = "http://117.232.67.158:8071";
public String qaqcurl="https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?";
public String qaqcurl="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?";
public String attendanceReport = "http://117.232.67.158:8076";
public String dumpregister = "https://gccservices.in";
public String mobileservice="https://gccservices.in";
public String gccappsMysqlPassword = "";
@Bean

21
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java

@ -308,7 +308,6 @@ public class DataSourceConfig {
return dataSource;
}
//////////////////////////////(For gcc_c_d_waste_web) ////////////////////////
@Bean(name = "mysqlCDManagerSystemDataSource")
public DataSource mysqlCDManagerSystemDataSource() {
@ -331,6 +330,26 @@ public class DataSourceConfig {
return dataSource;
}
//////////////////////////////(For gcc_c_d_waste_web) ////////////////////////
@Bean(name = "mysqlGccStreetVendorDataSource")
public DataSource mysqlGccStreetVendorDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_street_vendor");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
//////////////////////////////(For vending committe) ////////////////////////
@Bean(name = "mysqlVendingCommitteDataSource")
public DataSource mysqlVendingCommitteDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/vendingcommitte");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
////////////////////////////// ORACLE ////////////////////////
@Bean(name = "oracleDataSource")
public DataSource oracleDataSource() {

5
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java

@ -109,7 +109,10 @@ public class Petition {
String datePattern = year + "-" + month + "-%"; // Example: "2025-02-%"
// Corrected SQL query using the proper date format
String sqlQuery = "SELECT * FROM petition WHERE (`isactive`=1 AND `isdelete`=0) AND DATE(cdate) LIKE ?";
String sqlQuery = "SELECT p.*, pt.name as petition_type_name FROM petition p "
+ "LEFT JOIN petition_master.petition_types pt ON pt.petition_type_id = p.petition_type "
+ "WHERE (p.`isactive`=1 AND p.`isdelete`=0) AND DATE(p.cdate) LIKE ?";
// Execute the query with the date pattern as parameter
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, datePattern);

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/nulm/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/.DS_Store

136
src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/controller/DashboardApiController.java

@ -5,88 +5,51 @@ 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.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import in.gov.chennaicorporation.gccoffice.pensioner.service.DashboardApiService;
@RequestMapping("/gcc/api/pensionerdashboard")
@RestController
public class DashboardApiController {
@Autowired
private DashboardApiService dashboardApiService;
@GetMapping("/dashboard")
@ResponseBody
//@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
//@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");
//System.out.println("before fetch");
return dashboardApiService.getEmployeeDetails(FileId);
}
//department
@GetMapping("/deparmentdashboard")
@ResponseBody
@GetMapping("/departmentdashboard")
//@ResponseBody
public List<Map<String, Object>> getDepartmentDashboardData(@RequestParam(required = false) String deptId) {
System.out.println("deptid"+ 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")
@ -104,8 +67,10 @@ public class DashboardApiController {
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,
@ -125,7 +90,7 @@ public class DashboardApiController {
}
@GetMapping("/dashboardsearch")
@ResponseBody
//@ResponseBody
public List<Map<String, Object>> fetchDeparmentDashboardData(
@RequestParam(required = false) String startdate,
@RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) {
@ -134,7 +99,7 @@ public class DashboardApiController {
deptId=null;
}
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate);
//System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate);
try {
return dashboardApiService.fetchCategorysearchCounts(startdate, enddate,deptId);
} catch (Exception e) {
@ -146,82 +111,25 @@ public class DashboardApiController {
//pension
@GetMapping("/pensiondashboard")
@ResponseBody
//@ResponseBody
public List<Map<String, Object>> getPensionDashboardData(@RequestParam(required = false) String deptId) {
System.out.println("deptid"+ 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);
//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);
//System.out.println("checking");
//System.out.println(Empcode);
return dashboardApiService.getPensionEmpDetails(Empcode);
}
@ -229,8 +137,8 @@ public class DashboardApiController {
@GetMapping("/fetchTempDetails")
public List<Map<String, Object>> getTempEmpDetails(@RequestParam(required = false) String tempId) {
System.out.println("checking");
System.out.println(tempId);
// System.out.println("checking");
// System.out.println(tempId);
return dashboardApiService.getTempEmpDetails(tempId);
}

43
src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/service/DepartmentReceivedService.java

@ -97,23 +97,32 @@ public class DepartmentReceivedService {
int rowsUpdated2 = jdbcTemplate.update(benefitQuery, empNo, tempId, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount);
}
if ("yes".equalsIgnoreCase(benefit_dcrg)) {
filestatus = CheckFieldsInDept(tempId) ? (CheckFieldsInPensioner(tempId) ? getFileStatus.getFileStatus11Id() : getFileStatus.getFileStatus10Id() ) : getFileStatus.getFileStatus9Id();
file_entry_type="FILE_COMPLETED";
}
else if("no".equalsIgnoreCase(benefit_dcrg) || "no".equalsIgnoreCase(benefit_pension)){
filestatus = getFileStatus.getFileStatus10Id();
file_entry_type="PENSION_PARTIAL";
}
else if(benefit_dcrg==null)
{
filestatus = getFileStatus.getFileStatus9Id();
file_entry_type="DEPARTMENT_PARTIAL";
}
// if ("yes".equalsIgnoreCase(benefit_dcrg)) {
filestatus = CheckFieldsInDept(tempId) ? (CheckFieldsInPensioner(tempId) ? getFileStatus.getFileStatus11Id() : getFileStatus.getFileStatus10Id() ) : getFileStatus.getFileStatus9Id();
if(filestatus == 11) {
file_entry_type="FILE_COMPLETED";
}
else if(filestatus == 10) {
file_entry_type="PENSION_PARTIAL";
}
else {
file_entry_type="DEPARTMENT_PARTIAL";
}
// }
// else if("no".equalsIgnoreCase(benefit_dcrg) || "no".equalsIgnoreCase(benefit_pension)){
//
// filestatus = getFileStatus.getFileStatus10Id();
// file_entry_type="PENSION_PARTIAL";
// }
// else if(benefit_dcrg==null)
// {
// filestatus = getFileStatus.getFileStatus9Id();
// file_entry_type="DEPARTMENT_PARTIAL";
// }
//getFileStatus.getFileStatus2Id();

2
src/main/java/in/gov/chennaicorporation/gccoffice/pensioner/service/ReturnFromAuditService.java

@ -141,7 +141,7 @@ public class ReturnFromAuditService {
String designation = emp.get("designation").toString();
String fileCategoryName = emp.get("file_category_name").toString();
String pendingDuration=emp.get("pending_duration").toString();
String pendingReason=emp.get("reason_for_pending").toString();
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null;
String sericeDeath = emp.get("service_death").toString();
String relationshipDeceased = emp.get("relationship_deceased").toString();
String sanctionedGis = emp.get("sanctioned_gis_amount").toString();

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/school/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/.DS_Store

1061
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/BuildingAssetController.java
File diff suppressed because it is too large
View File

907
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/DropdownsController.java

@ -17,483 +17,484 @@ import org.springframework.web.bind.annotation.RestController;
import in.gov.chennaicorporation.gccoffice.school.Service.DropdownsService;
@RestController
@RequestMapping("/gcc/api/gccschool/dropdown")
public class DropdownsController {
@Autowired
private DropdownsService dropdownsService;
@Autowired
public DropdownsController(DropdownsService dropdownsService) {
this.dropdownsService = dropdownsService;
}
@Autowired
public DropdownsController(DropdownsService dropdownsService) {
this.dropdownsService = dropdownsService;
}
// To Get Court Dropdown Data
@GetMapping("/getCourtData")
public ResponseEntity<Map<String, Object>> getCourtData() {
try {
List<Map<String, Object>> data = dropdownsService.getCourtData();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
@GetMapping("/getCourtData")
public ResponseEntity<Map<String, Object>> getCourtData() {
try {
List<Map<String, Object>> data = dropdownsService.getCourtData();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Equipmengt Dropdown Data
@GetMapping("/getEquipmentData")
public ResponseEntity<Map<String, Object>> getEquipmentData() {
try {
List<Map<String, Object>> data = dropdownsService.getEquipmentData();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Building Material Dropdown Data
@GetMapping("/getBuildingMaterial")
public ResponseEntity<Map<String, Object>> getBuildingMaterial() {
try {
List<Map<String, Object>> data = dropdownsService.getBuildingMaterial();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Roof Material Dropdown Data
@GetMapping("/getRoofMaterial")
public ResponseEntity<Map<String, Object>> getRoofMaterial() {
try {
List<Map<String, Object>> data = dropdownsService.getRoofMaterial();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Water Source Dropdown Data
@GetMapping("/getWaterSource")
public ResponseEntity<Map<String, Object>> getWaterSource() {
try {
List<Map<String, Object>> data = dropdownsService.getWaterSource();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Water Storage Dropdown Data
@GetMapping("/getWaterStorage")
public ResponseEntity<Map<String, Object>> getWaterStorage() {
try {
List<Map<String, Object>> data = dropdownsService.getWaterStorage();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Rooms Dropdown Data
@GetMapping("/getRooms")
public ResponseEntity<Map<String, Object>> getRooms() {
try {
List<Map<String, Object>> data = dropdownsService.getRooms();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
@GetMapping("/getFloorsByBuilding")
public ResponseEntity<Map<String, Object>> getFloorsByBuilding(@RequestParam("building_id") int buildingId) {
try {
List<Map<String, Object>> data = dropdownsService.getFloorsByBuilding(buildingId);
Map<String, Object> response = new HashMap<>();
if (!data.isEmpty()) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No floors found for the selected building.");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Failed to fetch floors."));
}
}
@GetMapping("/getBuildingsBySchoolId")
public ResponseEntity<Map<String, Object>> getBuildingsBySchoolId(@RequestParam int school_id) {
try {
List<Map<String, Object>> data = dropdownsService.getBuildingsBySchoolId(school_id);
Map<String, Object> response = new HashMap<>();
if (!data.isEmpty()) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No buildings found for the selected school.");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Failed to fetch buildings."));
}
}
@GetMapping("/getDropdownValues")
public List<Map<String, Object>> getDropdownValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
List<Map<String, Object>> udiseData = dropdownsService.getUdiseNumbersBySchoolId(schoolId);
if (!udiseData.isEmpty()) {
List<String> udiseList = udiseData.stream().map(m -> (String) m.get("udise")).collect(Collectors.toList());
// To Get Equipmengt Dropdown Data
@GetMapping("/getEquipmentData")
public ResponseEntity<Map<String, Object>> getEquipmentData() {
try {
List<Map<String, Object>> data = dropdownsService.getEquipmentData();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
response.put("Message", "Success");
response.put("Data", udiseList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getCategoryValues")
public List<Map<String, Object>> getCategoryValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
// To Get Building Material Dropdown Data
@GetMapping("/getBuildingMaterial")
public ResponseEntity<Map<String, Object>> getBuildingMaterial() {
try {
List<Map<String, Object>> data = dropdownsService.getBuildingMaterial();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
List<Map<String, Object>> categoryData = dropdownsService.getCategoryBySchoolId(schoolId);
if (!categoryData.isEmpty()) {
List<String> categoryList = categoryData.stream().map(m -> (String) m.get("category"))
.collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", categoryList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
// To Get Roof Material Dropdown Data
@GetMapping("/getRoofMaterial")
public ResponseEntity<Map<String, Object>> getRoofMaterial() {
try {
List<Map<String, Object>> data = dropdownsService.getRoofMaterial();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
resultList.add(response);
return resultList;
}
@GetMapping("/getZoneValues")
public List<Map<String, Object>> getZoneValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
// To Get Water Source Dropdown Data
@GetMapping("/getWaterSource")
public ResponseEntity<Map<String, Object>> getWaterSource() {
try {
List<Map<String, Object>> data = dropdownsService.getWaterSource();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
List<Map<String, Object>> zoneData = dropdownsService.getZoneBySchoolId(schoolId);
if (!zoneData.isEmpty()) {
List<String> zoneList = zoneData.stream().map(m -> (String) m.get("zone")).collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", zoneList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getwardValues")
public List<Map<String, Object>> getWardValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
List<Map<String, Object>> wardData = dropdownsService.getWardBySchoolId(schoolId);
if (!wardData.isEmpty()) {
List<String> wardList = wardData.stream().map(m -> (String) m.get("division")).collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", wardList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getAllDropdownValues")
public ResponseEntity<?> getAllDropdownValues(@RequestParam String user_id, @RequestParam String type) {
Map<String, Object> response = new HashMap<>();
List<String> dropdownList = Collections.emptyList();
// First get school_id(s) for this user
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId.equals("error")) {
response.put("Message", "Failed to fetch school ID");
response.put("Data", dropdownList);
return ResponseEntity.ok(Collections.singletonList(response));
}
// To Get Water Storage Dropdown Data
@GetMapping("/getWaterStorage")
public ResponseEntity<Map<String, Object>> getWaterStorage() {
try {
List<Map<String, Object>> data = dropdownsService.getWaterStorage();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
try {
List<Map<String, Object>> rawData;
switch (type.toLowerCase()) {
case "udise":
rawData = dropdownsService.getUdiseNumbersBySchoolId(schoolId);
dropdownList = rawData.stream().map(map -> String.valueOf(map.get("udise")))
.collect(Collectors.toList());
break;
case "category":
rawData = dropdownsService.getCategoryBySchoolId(schoolId);
dropdownList = rawData.stream().map(map -> String.valueOf(map.get("category"))).distinct()
.collect(Collectors.toList());
break;
case "zone":
rawData = dropdownsService.getZoneBySchoolId(schoolId);
dropdownList = rawData.stream().map(map -> String.valueOf(map.get("zone"))).distinct()
.collect(Collectors.toList());
break;
case "ward":
rawData = dropdownsService.getWardBySchoolId(schoolId);
dropdownList = rawData.stream().map(map -> String.valueOf(map.get("division"))).distinct()
.collect(Collectors.toList());
break;
default:
response.put("Message", "Invalid dropdown type");
response.put("Data", dropdownList);
return ResponseEntity.badRequest().body(Collections.singletonList(response));
}
response.put("Message", "Success");
response.put("Data", dropdownList);
return ResponseEntity.ok(Collections.singletonList(response));
} catch (Exception e) {
e.printStackTrace();
response.put("Message", "Error while processing dropdown values");
response.put("Data", dropdownList);
return ResponseEntity.ok(Collections.singletonList(response));
}
}
// To Get Asset Types Data
@GetMapping("/getAssetType")
public ResponseEntity<Map<String, Object>> getAssetType() {
try {
List<Map<String, Object>> data = dropdownsService.getAssetType();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Sub Asset Types Data
@GetMapping("/getSubAssetType")
public ResponseEntity<Map<String, Object>> getSubAssetType(int assetid) {
try {
List<Map<String, Object>> data = dropdownsService.getSubAssetType(assetid);
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
@GetMapping("/getSplSubAssetType")
public ResponseEntity<Map<String, Object>> getSplSubAssetType(int school_id, int assetid) {
try {
List<String> assets = dropdownsService.getAssetList(school_id, assetid);
List<Map<String, Object>> data = dropdownsService.getSplSubAssetType(assets, assetid);
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
// To Get Rooms Dropdown Data
@GetMapping("/getRooms")
public ResponseEntity<Map<String, Object>> getRooms() {
try {
List<Map<String, Object>> data = dropdownsService.getRooms();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
@GetMapping("/getFloorsByBuilding")
public ResponseEntity<Map<String, Object>> getFloorsByBuilding(@RequestParam("building_id") int buildingId) {
try {
List<Map<String, Object>> data = dropdownsService.getFloorsByBuilding(buildingId);
Map<String, Object> response = new HashMap<>();
if (!data.isEmpty()) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No floors found for the selected building.");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Failed to fetch floors."));
}
}
@GetMapping("/getBuildingsBySchoolId")
public ResponseEntity<Map<String, Object>> getBuildingsBySchoolId(@RequestParam int school_id) {
try {
List<Map<String, Object>> data = dropdownsService.getBuildingsBySchoolId(school_id);
Map<String, Object> response = new HashMap<>();
if (!data.isEmpty()) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No buildings found for the selected school.");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Failed to fetch buildings."));
}
}
@GetMapping("/getDropdownValues")
public List<Map<String, Object>> getDropdownValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
List<Map<String, Object>> udiseData = dropdownsService.getUdiseNumbersBySchoolId(schoolId);
if (!udiseData.isEmpty()) {
List<String> udiseList = udiseData.stream()
.map(m -> (String) m.get("udise"))
.collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", udiseList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getCategoryValues")
public List<Map<String, Object>> getCategoryValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
List<Map<String, Object>> categoryData = dropdownsService.getCategoryBySchoolId(schoolId);
if (!categoryData.isEmpty()) {
List<String> categoryList = categoryData.stream()
.map(m -> (String) m.get("category"))
.collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", categoryList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getZoneValues")
public List<Map<String, Object>> getZoneValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
List<Map<String, Object>> zoneData = dropdownsService.getZoneBySchoolId(schoolId);
if (!zoneData.isEmpty()) {
List<String> zoneList = zoneData.stream()
.map(m -> (String) m.get("zone"))
.collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", zoneList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getwardValues")
public List<Map<String, Object>> getWardValues(@RequestParam String user_id) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> response = new HashMap<>();
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId == null || schoolId.trim().isEmpty() || schoolId.equalsIgnoreCase("error")) {
response.put("Message", "Failure");
response.put("Data", List.of());
resultList.add(response);
return resultList;
}
List<Map<String, Object>> wardData = dropdownsService.getWardBySchoolId(schoolId);
if (!wardData.isEmpty()) {
List<String> wardList = wardData.stream()
.map(m -> (String) m.get("division"))
.collect(Collectors.toList());
response.put("Message", "Success");
response.put("Data", wardList);
} else {
response.put("Message", "No Data Found");
response.put("Data", List.of());
}
resultList.add(response);
return resultList;
}
@GetMapping("/getAllDropdownValues")
public ResponseEntity<?> getAllDropdownValues(@RequestParam String user_id, @RequestParam String type) {
Map<String, Object> response = new HashMap<>();
List<String> dropdownList = Collections.emptyList();
// First get school_id(s) for this user
String schoolId = dropdownsService.getSchoolId(user_id);
if (schoolId.equals("error")) {
response.put("Message", "Failed to fetch school ID");
response.put("Data", dropdownList);
return ResponseEntity.ok(Collections.singletonList(response));
}
try {
List<Map<String, Object>> rawData;
switch (type.toLowerCase()) {
case "udise":
rawData = dropdownsService.getUdiseNumbersBySchoolId(schoolId);
dropdownList = rawData.stream()
.map(map -> String.valueOf(map.get("udise")))
.collect(Collectors.toList());
break;
case "category":
rawData = dropdownsService.getCategoryBySchoolId(schoolId);
dropdownList = rawData.stream()
.map(map -> String.valueOf(map.get("category")))
.distinct()
.collect(Collectors.toList());
break;
case "zone":
rawData = dropdownsService.getZoneBySchoolId(schoolId);
dropdownList = rawData.stream()
.map(map -> String.valueOf(map.get("zone")))
.distinct()
.collect(Collectors.toList());
break;
case "ward":
rawData = dropdownsService.getWardBySchoolId(schoolId);
dropdownList = rawData.stream()
.map(map -> String.valueOf(map.get("division")))
.distinct()
.collect(Collectors.toList());
break;
default:
response.put("Message", "Invalid dropdown type");
response.put("Data", dropdownList);
return ResponseEntity.badRequest().body(Collections.singletonList(response));
}
response.put("Message", "Success");
response.put("Data", dropdownList);
return ResponseEntity.ok(Collections.singletonList(response));
} catch (Exception e) {
e.printStackTrace();
response.put("Message", "Error while processing dropdown values");
response.put("Data", dropdownList);
return ResponseEntity.ok(Collections.singletonList(response));
}
}
// To Get Asset Types Data
@GetMapping("/getAssetType")
public ResponseEntity<Map<String, Object>> getAssetType() {
try {
List<Map<String, Object>> data = dropdownsService.getAssetType();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
// To Get Sub Asset Types Data
@GetMapping("/getSubAssetType")
public ResponseEntity<Map<String, Object>> getSubAssetType(int assetid) {
try {
List<Map<String, Object>> data = dropdownsService.getSubAssetType(assetid);
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
@GetMapping("/getSplSubAssetType")
public ResponseEntity<Map<String, Object>> getSplSubAssetType(int school_id, int assetid) {
try {
List<String> assets = dropdownsService.getAssetList(school_id, assetid);
List<Map<String, Object>> data = dropdownsService.getSplSubAssetType(assets, assetid);
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
@GetMapping("/getSpecialCategory")
public ResponseEntity<Map<String, Object>> getSpecialCategory() {
try {
List<Map<String, Object>> data = dropdownsService.getSpecialCategory();
Map<String, Object> response = new HashMap<>();
if (data.size() != 0) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
// Log the exception details for debugging
e.printStackTrace();
// Provide a user-friendly error message
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error getting data: " + e.getMessage()));
}
}
}

67
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/MainController.java

@ -16,41 +16,37 @@ public class MainController {
return "modules/school/otherdetails";
}
@GetMapping("/schooldetails")
public String viewschool(Model model) {
return "modules/school/schooldetails";
}
@GetMapping("/schoolmodule")
public String viewmodule(Model model) {
String loginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("user_id", loginUserId);
System.out.println("loginUserId..........."+loginUserId);
model.addAttribute("user_id", loginUserId);
System.out.println("loginUserId..........." + loginUserId);
return "modules/school/dashboard";
}
@GetMapping("/staffdetails")
public String staffdetails(Model model) {
return "modules/school/staffdetails";
}
@GetMapping("/roomassets")
public String roomassets(Model model) {
@GetMapping("/staffdetails")
public String staffdetails(Model model) {
return "modules/school/staffdetails";
}
return "modules/school/roomassets";
}
@GetMapping("/roomassets")
public String roomassets(Model model) {
@GetMapping("/assetmanagement")
public String assetmanagement(Model model) {
return "modules/school/roomassets";
}
return "modules/school/assetmanagement";
}
@GetMapping("/assetmanagement")
public String assetmanagement(Model model) {
return "modules/school/assetmanagement";
}
// @GetMapping("/itassets")
// public String itassets(Model model) {
//
// System.out.println("okokokok===");
//
// return "modules/school/itassets";
// }
@GetMapping("/studentdetails")
public String studentdetails(Model model) {
@ -63,13 +59,13 @@ public class MainController {
return "modules/school/building";
}
@GetMapping("/room")
public String roomlist(Model model) {
return "modules/school/room";
}
@GetMapping("/playground")
public String playground(Model model) {
@ -88,7 +84,6 @@ public class MainController {
return "modules/school/toilets";
}
// @GetMapping("/electricalassets")
// public String electricalassets(Model model) {
//
@ -118,10 +113,28 @@ public class MainController {
return "modules/school/addfurnitureasset";
}
@GetMapping("/reports")
public String reportpage(Model model) {
@GetMapping("/reports")
public String reportpage(Model model) {
return "modules/school/reports";
}
@GetMapping("/studentregistration")
public String studentRegistrationPage() {
return "modules/school/studentregister";
}
@GetMapping("/aeoschoolentry/aeolist")
public String viewaeolist(Model model) {
return "modules/school/reports";
}
return "modules/school/reportfolder/aeolist";
}
@GetMapping("/aeoschoolentry/aeoallschools")
public String viewaeoallschools(Model model) {
return "modules/school/reportfolder/aeoallschools";
}
}

462
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/SchoolPropertyController.java

@ -61,7 +61,7 @@ public class SchoolPropertyController {
// For Other Details
@PostMapping(value = "/saveSchoolBuildupArea")
public String saveSchoolBuildupArea(@RequestParam("land_area") Double land_area,
@RequestParam("buildup_area") Double buildup_area, @RequestParam("is_compound") Boolean is_compound,
@RequestParam("buildup_area") Double buildup_area, @RequestParam("is_compound") int is_compound,
@RequestParam("is_nameboard") Boolean is_nameboard, @RequestParam("is_pasystem") Boolean is_pasystem,
@RequestParam("is_bell") Boolean is_bell, @RequestParam("is_generator") Boolean is_generator,
@RequestParam("school_id") int school_id) {
@ -74,9 +74,9 @@ public class SchoolPropertyController {
@PostMapping(value = "/saveStudentStrength")
public String saveStudentStrength(@RequestParam("total_students") int total_students,
@RequestParam("total_girls") int total_girls, @RequestParam("total_boys") int total_boys,
@RequestParam("others") int others, @RequestParam("school_id") int school_id) {
@RequestParam("others") int others, @RequestParam("special_child") int special_child,@RequestParam("school_id") int school_id) {
return schoolPropertyService.saveStudentStrength(total_students, total_girls, total_boys, others, school_id);
return schoolPropertyService.saveStudentStrength(total_students, total_girls, total_boys, others,special_child, school_id);
}
// For Staff Strength
@ -104,38 +104,66 @@ public class SchoolPropertyController {
// For Toilets
@PostMapping(value = "/saveToilets")
public String saveToilets(@RequestParam("total_toiletBlocks") int total_toiletBlocks,
public String saveToilets(@RequestParam(value = "total_toiletBlocks", required = false) Integer total_toiletBlocks,
@RequestParam("total_male_urinals") int total_male_urinals,
@RequestParam("total_female_urinals") int total_female_urinals,
@RequestParam("staff_male_toilets") int staff_male_toilets,
@RequestParam("staff_female_toilets") int staff_female_toilets,
@RequestParam("total_wc_male") int total_wc_male, @RequestParam("total_wc_female") int total_wc_female,
@RequestParam("total_diffAbled_toilet") int total_diffAbled_toilet,
@RequestParam("is_napkins") Boolean is_napkins, @RequestParam("school_id") int school_id) {
return schoolPropertyService.saveToilets(total_toiletBlocks, total_male_urinals, total_wc_male, total_wc_female,
return schoolPropertyService.saveToilets(total_toiletBlocks, total_male_urinals, total_female_urinals,staff_male_toilets,staff_female_toilets,total_wc_male, total_wc_female,
total_diffAbled_toilet, is_napkins, school_id);
}
// For Kitchen
@PostMapping(value = "/saveKitchen")
public String saveKitchen(@RequestParam(value = "is_cmbfs") Boolean is_cmbfs,
@RequestParam(value = "is_cmbfsIndividual", required = false) Boolean is_cmbfsIndividual,
@RequestParam(value = "is_noonmeal") Boolean is_noonmeal,
@RequestParam(value = "is_noonIndividual", required = false) Boolean is_noonIndividual,
@RequestParam(value = "is_vegGarden", required = false) Boolean is_vegGarden,
@RequestParam(value = "is_anganwadi") Boolean is_anganwadi,
@RequestParam(value = "anganwadi_unique", required = false) String anganwadi_unique,
@RequestParam(value = "is_anganwadiIndividual", required = false) Boolean is_anganwadiIndividual,
@RequestParam(value = "school_id") int school_id) {
if (anganwadi_unique != null && anganwadi_unique.trim().isEmpty()) {
anganwadi_unique = null;
public ResponseEntity<Map<String, String>> saveKitchen(@RequestBody Map<String, Object> payload) {
Map<String, String> response = new HashMap<>();
try {
Boolean is_cmbfs = payload.get("is_cmbfs") != null ? Boolean.parseBoolean(payload.get("is_cmbfs").toString()) : null;
Boolean is_cmbfsIndividual = payload.get("is_cmbfsIndividual") != null ? Boolean.parseBoolean(payload.get("is_cmbfsIndividual").toString()) : null;
Boolean is_noonmeal = payload.get("is_noonmeal") != null ? Boolean.parseBoolean(payload.get("is_noonmeal").toString()) : null;
Boolean is_noonIndividual = payload.get("is_noonIndividual") != null ? Boolean.parseBoolean(payload.get("is_noonIndividual").toString()) : null;
Boolean is_vegGarden = payload.get("is_vegGarden") != null ? Boolean.parseBoolean(payload.get("is_vegGarden").toString()) : null;
Boolean is_anganwadi = payload.get("is_anganwadi") != null ? Boolean.parseBoolean(payload.get("is_anganwadi").toString()) : null;
List<Map<String, Object>> anganwadi = (List<Map<String, Object>>) payload.get("anganwadi");
//System.out.println("anganwadi="+ anganwadi);
int school_id = Integer.parseInt(payload.get("school_id").toString());
int kitchen_id = schoolPropertyService.saveKitchen(is_cmbfs, is_cmbfsIndividual, is_noonmeal, is_noonIndividual,
is_vegGarden, is_anganwadi, school_id);
if(is_anganwadi) {
for(Map<String, Object> data:anganwadi) {
//System.out.println("hi");
String anganwadi_unique = data.get("anganwadi_unique")!= null ? data.get("anganwadi_unique").toString() : null;
Boolean is_anganwadiIndividual = data.get("is_anganwadiIndividual") != null ? Boolean.parseBoolean(data.get("is_anganwadiIndividual").toString()) : null;
//System.out.printf(anganwadi_unique,is_anganwadiIndividual);
schoolPropertyService.saveAnganwadi(anganwadi_unique, is_anganwadiIndividual, kitchen_id, school_id);
schoolPropertyService.updateAnganwadiCheck(anganwadi_unique, school_id);
}
}
return schoolPropertyService.saveKitchen(is_cmbfs, is_cmbfsIndividual, is_noonmeal, is_noonIndividual,
is_vegGarden, is_anganwadi, anganwadi_unique, is_anganwadiIndividual, school_id);
response.put("status", "OK");
response.put("message", "Kitchen Details saved successfully");
return ResponseEntity.ok(response);
}catch (Exception e) {
e.printStackTrace();
response.put("status", "ERROR");
response.put("message", "Failed to save Kitchen details");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
}
}
// For Playground
@PostMapping(value = "/savePlayground")
/*@PostMapping(value = "/savePlayground")
public ResponseEntity<Map<String, String>> savePlayground(@RequestBody Map<String, Object> payload) {
Map<String, String> response = new HashMap<>();
try {
@ -173,10 +201,56 @@ public class SchoolPropertyController {
response.put("message", "Failed to save playground details");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
}
}*/
@PostMapping("/savePlayground")
public ResponseEntity<Map<String, String>> savePlayground(@RequestBody Map<String, Object> payload) {
Map<String, String> response = new HashMap<>();
try {
Boolean is_playground = (Boolean) payload.get("is_playground");
Double playground_area = Double.valueOf(payload.get("playground_area").toString());
Boolean is_court = (Boolean) payload.get("is_court");
int school_id = Integer.parseInt(payload.get("school_id").toString());
List<String> equipmentidRaw = (List<String>) payload.get("equipmentid");
List<String> courtidRaw = (List<String>) payload.get("courtid");
int playground_id = schoolPropertyService.savePlayground(is_playground, playground_area, is_court, school_id);
boolean insertedAny = false;
for (String equipment_id : equipmentidRaw) {
if (schoolPropertyService.saveEquipmentDetails(equipment_id, school_id, playground_id)) {
insertedAny = true;
}
}
for (String court_id : courtidRaw) {
if (schoolPropertyService.saveCourtDetails(court_id, school_id, playground_id)) {
insertedAny = true;
}
}
if (insertedAny) {
response.put("status", "OK");
response.put("message", "Playground and related details saved successfully");
} else {
response.put("status", "SKIPPED");
response.put("message", "No new data inserted; records already exist");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
response.put("status", "ERROR");
response.put("message", "Failed to save playground details");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
}
}
//initial
// For Drinking Water
@PostMapping(value = "/saveDrinkingWater")
/*@PostMapping(value = "/saveDrinkingWater")
public ResponseEntity<Map<String, Object>> saveDrinkingWater(@RequestBody Map<String, Object> requestData) {
try {
// Extract data from the map
@ -217,25 +291,142 @@ public class SchoolPropertyController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error saving data: " + e.getMessage()));
}
}*/
@PostMapping("/saveDrinkingWater")
public ResponseEntity<Map<String, Object>> saveDrinkingWater(@RequestBody Map<String, Object> requestData) {
Map<String, Object> response = new HashMap<>();
try {
int schoolId = Integer.parseInt(requestData.get("school_id").toString());
// Check if data already exists for the school
boolean exists = schoolPropertyService.existsDrinkingWaterData(schoolId);
if (exists) {
// If data exists, respond with SKIPPED status and message
response.put("status", "SKIPPED");
response.put("message", "Data already exists for this school. Insert skipped.");
return ResponseEntity.ok(response);
}
// If no existing data, proceed with your save logic
List<Map<String, Object>> water = (List<Map<String, Object>>) requestData.get("water");
Boolean is_purifier = "1".equals(requestData.get("is_purifier"));
Double purifier_capacity = requestData.get("purifier_capacity") != null
? Double.valueOf(requestData.get("purifier_capacity").toString())
: null;
Boolean is_borewell = "1".equals(requestData.get("is_borewell"));
Integer borewell_count = requestData.get("borewell_count") != null
? Integer.valueOf(requestData.get("borewell_count").toString())
: null;
int drinkingwater_tap = requestData.get("drinkingwater_tap") != null
? Integer.valueOf(requestData.get("drinkingwater_tap").toString())
: null;
int handwash_tap = requestData.get("handwash_tap") != null
? Integer.valueOf(requestData.get("handwash_tap").toString())
: null;
Boolean is_storage = "1".equals(requestData.get("is_storage"));
List<Map<String, Object>> storage = (List<Map<String, Object>>) requestData.get("storage");
/*
int drinking_water_id = schoolPropertyService.saveDrinkingWater(is_purifier, purifier_capacity, is_borewell,
borewell_count, is_storage, schoolId);
*/
int drinking_water_id = schoolPropertyService.saveDrinkingWater(is_purifier, purifier_capacity, is_borewell,
borewell_count, is_storage, schoolId,drinkingwater_tap,handwash_tap);
for (Map<String, Object> waterSupply : water) {
int source_water_id = (int) waterSupply.get("source_water_id");
String supply_type = (String) waterSupply.get("supply_type");
schoolPropertyService.saveWaterSupply(source_water_id, supply_type, drinking_water_id, schoolId);
}
if (!storage.isEmpty()) {
for (Map<String, Object> waterStorage : storage) {
double capacity = Double.valueOf(waterStorage.get("capacity").toString());
int storage_water_id = (int) waterStorage.get("storage_water_id");
schoolPropertyService.saveWaterStorage(capacity, storage_water_id, drinking_water_id, schoolId);
}
}
response.put("status", "OK");
response.put("message", "Drinking water details submitted successfully!");
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
response.put("status", "ERROR");
response.put("message", "Error saving data: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
}
}
@PostMapping("/saveStaffStrength")
public String saveStaffStrength(@RequestParam int sgRegTeacher, @RequestParam int sgTempTeacher,@RequestParam int sgPtTeacher, @RequestParam int sgNgoTeacher,
@RequestParam int btRegTeacher,@RequestParam int btTempTeacher, @RequestParam int btPtTeacher, @RequestParam int btNgoTeacher,
@RequestParam int pgRegTeacher, @RequestParam int pgTempTeacher, @RequestParam int pgPtTeacher,@RequestParam int pgNgoTeacher,
@RequestParam int kgRegTeacher, @RequestParam int kgTempTeacher,
@RequestParam int petRegTeacher, @RequestParam int petTempTeacher, @RequestParam int petGrade1Teacher, @RequestParam int petGrade2Teacher,
@RequestParam int totOa, @RequestParam int kgAyah, @RequestParam int compAss, @RequestParam int watchmen,
@RequestParam int scavengers, @RequestParam int maintenanceWork, @RequestParam int schoolId) {
//initial
/*@PostMapping("/saveStaffStrength")
public String saveStaffStrength(@RequestParam int sgRegTeacher, @RequestParam int sgTempTeacher,
@RequestParam int sgPtTeacher, @RequestParam int sgNgoTeacher, @RequestParam int btRegTeacher,
@RequestParam int btTempTeacher, @RequestParam int btPtTeacher, @RequestParam int btNgoTeacher,
@RequestParam int pgRegTeacher, @RequestParam int pgTempTeacher, @RequestParam int pgPtTeacher,
@RequestParam int pgNgoTeacher, @RequestParam int kgRegTeacher, @RequestParam int kgTempTeacher,
@RequestParam int petRegTeacher, @RequestParam int petTempTeacher, @RequestParam int petGrade1Teacher,
@RequestParam int petGrade2Teacher, @RequestParam int totOa, @RequestParam int kgAyah,
@RequestParam int compAss, @RequestParam int watchmen, @RequestParam int scavengers,
@RequestParam int maintenanceWork, @RequestParam int schoolId) {
// Call service method
schoolPropertyService.saveStaffStrength(sgRegTeacher, sgTempTeacher, sgPtTeacher, sgNgoTeacher, btRegTeacher,
btTempTeacher, btPtTeacher, btNgoTeacher, pgRegTeacher, pgTempTeacher, pgPtTeacher, pgNgoTeacher,
kgRegTeacher, kgTempTeacher, petRegTeacher, petTempTeacher, petGrade1Teacher, petGrade2Teacher, totOa, kgAyah, compAss, watchmen, scavengers, maintenanceWork, schoolId);
kgRegTeacher, kgTempTeacher, petRegTeacher, petTempTeacher, petGrade1Teacher, petGrade2Teacher, totOa,
kgAyah, compAss, watchmen, scavengers, maintenanceWork, schoolId);
return "Staff strength details saved successfully!";
}*/
@PostMapping("/saveStaffStrength")
public String saveStaffStrength(@RequestBody Map<String, Object> payload) {
int sgRegTeacher = Integer.parseInt(payload.get("sgRegTeacher").toString());
int sgTempTeacher = Integer.parseInt(payload.get("sgTempTeacher").toString());
int sgPtTeacher = Integer.parseInt(payload.get("sgPtTeacher").toString());
int sgNgoTeacher = Integer.parseInt(payload.get("sgNgoTeacher").toString());
int btRegTeacher = Integer.parseInt(payload.get("btRegTeacher").toString());
int btTempTeacher = Integer.parseInt(payload.get("btTempTeacher").toString());
int btPtTeacher = Integer.parseInt(payload.get("btPtTeacher").toString());
int btNgoTeacher = Integer.parseInt(payload.get("btNgoTeacher").toString());
int pgRegTeacher = Integer.parseInt(payload.get("pgRegTeacher").toString());
int pgTempTeacher = Integer.parseInt(payload.get("pgTempTeacher").toString());
int pgPtTeacher = Integer.parseInt(payload.get("pgPtTeacher").toString());
int pgNgoTeacher = Integer.parseInt(payload.get("pgNgoTeacher").toString());
int kgRegTeacher = Integer.parseInt(payload.get("kgRegTeacher").toString());
int kgTempTeacher = Integer.parseInt(payload.get("kgTempTeacher").toString());
int petRegTeacher = Integer.parseInt(payload.get("petRegTeacher").toString());
int petTempTeacher = Integer.parseInt(payload.get("petTempTeacher").toString());
int petGrade1Teacher = Integer.parseInt(payload.get("petGrade1Teacher").toString());
int petGrade2Teacher = Integer.parseInt(payload.get("petGrade2Teacher").toString());
int petPtTeacher = Integer.parseInt(payload.get("petPtTeacher").toString());
Boolean is_hm = (Boolean) payload.get("hmAvailability");
int stRegTeacher = Integer.parseInt(payload.get("stRegTeacher").toString());
int stPtTeacher = Integer.parseInt(payload.get("stPtTeacher").toString());
int totOa = Integer.parseInt(payload.get("totOa").toString());
int kgAyah = Integer.parseInt(payload.get("kgAyah").toString());
int compAss = Integer.parseInt(payload.get("compAss").toString());
String watchmen = payload.get("watchmen").toString();
int scavengers = Integer.parseInt(payload.get("scavengers").toString());
int maintenanceWork = Integer.parseInt(payload.get("maintenanceWork").toString());
int schoolId = Integer.parseInt(payload.get("schoolId").toString());
List<String> specialCategoryId = (List<String>) payload.get("specialCategoryId");
return schoolPropertyService.saveStaffStrength(sgRegTeacher, sgTempTeacher, sgPtTeacher, sgNgoTeacher, btRegTeacher,
btTempTeacher, btPtTeacher, btNgoTeacher, pgRegTeacher, pgTempTeacher, pgPtTeacher, pgNgoTeacher,
kgRegTeacher, kgTempTeacher, petRegTeacher, petTempTeacher, petGrade1Teacher, petGrade2Teacher, petPtTeacher,
is_hm, stRegTeacher, stPtTeacher, totOa, kgAyah, compAss, watchmen, scavengers, maintenanceWork, schoolId, specialCategoryId);
}
// For login
@GetMapping(value = "/getLoginDetails")
public List<Map<String, Object>> getLoginDetails(@RequestParam String user_id) {
@ -296,7 +487,7 @@ public class SchoolPropertyController {
@PostMapping("/updateOtherDetails")
public String updateOtherDetails(@RequestParam("land_area") Double land_area,
@RequestParam("buildup_area") Double buildup_area, @RequestParam("is_compound") Boolean is_compound,
@RequestParam("buildup_area") Double buildup_area, @RequestParam("is_compound") int is_compound,
@RequestParam("is_nameboard") Boolean is_nameboard, @RequestParam("is_pasystem") Boolean is_pasystem,
@RequestParam("is_bell") Boolean is_bell, @RequestParam("is_generator") Boolean is_generator,
@RequestParam("school_id") int school_id) {
@ -312,11 +503,10 @@ public class SchoolPropertyController {
@PostMapping(value = "/updateStudentDetails")
public String updateStudentDetails(@RequestParam("total_students") int total_students,
@RequestParam("total_girls") int total_girls, @RequestParam("total_boys") int total_boys,
@RequestParam("others") int others, @RequestParam("school_id") int school_id) {
System.out.println("Update Request => total: " + total_students + ", boys: " + total_boys + ", girls: "
+ total_girls + ", others: " + others + ", school_id: " + school_id);
@RequestParam("others") int others,@RequestParam("special_child") int special_child , @RequestParam("school_id") int school_id) {
try {
return schoolPropertyService.updateStudentDetails(total_students, total_girls, total_boys, others,
return schoolPropertyService.updateStudentDetails(total_students, total_girls, total_boys, others,special_child,
school_id);
} catch (Exception e) {
e.printStackTrace();
@ -434,23 +624,66 @@ public class SchoolPropertyController {
}
@PostMapping(value = "/updateKitchenDetails")
public String updateKitchenDetails(@RequestParam(value = "is_cmbfs") Boolean is_cmbfs,
@RequestParam(value = "is_cmbfsIndividual", required = false) Boolean is_cmbfsIndividual,
@RequestParam(value = "is_noonmeal") Boolean is_noonmeal,
@RequestParam(value = "is_noonIndividual", required = false) Boolean is_noonIndividual,
@RequestParam(value = "is_vegGarden", required = false) Boolean is_vegGarden,
@RequestParam(value = "is_anganwadi") Boolean is_anganwadi,
@RequestParam(value = "anganwadi_unique", required = false) String anganwadi_unique,
@RequestParam(value = "is_anganwadiIndividual", required = false) Boolean is_anganwadiIndividual,
@RequestParam(value = "school_id") int school_id) {
public ResponseEntity<Map<String, String>> updateKitchenDetails(@RequestBody Map<String, Object> payload) {
Map<String, String> response = new HashMap<>();
try {
return schoolPropertyService.updateKitchenDetails(is_cmbfs, is_cmbfsIndividual, is_noonmeal,
is_noonIndividual, is_vegGarden, is_anganwadi, anganwadi_unique, is_anganwadiIndividual, school_id);
Map<String, Object> kitchenEdit = (Map<String, Object>) payload.get("kitchenEdit");
System.err.println("kitchenEdit="+kitchenEdit);
List<Map<String, Object>> oldAnganwadiEdit = (List<Map<String, Object>>) payload.get("oldAnganwadiEdit");
List<Map<String, Object>> newAnganwadiEdit = (List<Map<String, Object>>) payload.get("newAnganwadiEdit");
Boolean is_cmbfs = kitchenEdit.get("is_cmbfs") != null ? Boolean.parseBoolean(kitchenEdit.get("is_cmbfs").toString()) : null;
Boolean is_cmbfsIndividual = kitchenEdit.get("is_cmbfsIndividual") != null ? Boolean.parseBoolean(kitchenEdit.get("is_cmbfsIndividual").toString()) : null;
Boolean is_noonmeal = kitchenEdit.get("is_noonmeal") != null ? Boolean.parseBoolean(kitchenEdit.get("is_noonmeal").toString()) : null;
Boolean is_noonIndividual = kitchenEdit.get("is_noonIndividual") != null ? Boolean.parseBoolean(kitchenEdit.get("is_noonIndividual").toString()) : null;
Boolean is_vegGarden = kitchenEdit.get("is_vegGarden") != null ? Boolean.parseBoolean(kitchenEdit.get("is_vegGarden").toString()) : null;
Boolean is_anganwadi = kitchenEdit.get("is_anganwadi") != null ? Boolean.parseBoolean(kitchenEdit.get("is_anganwadi").toString()) : null;
int school_id = kitchenEdit.get("school_id") != null ?Integer.parseInt(kitchenEdit.get("school_id").toString()) : null;
schoolPropertyService.updateKitchenDetails(is_cmbfs, is_cmbfsIndividual, is_noonmeal, is_noonIndividual, is_vegGarden, is_anganwadi,school_id);
if(is_anganwadi) {
if(oldAnganwadiEdit != null) {
for(Map<String, Object> oldlist:oldAnganwadiEdit) {
String anganwadi_unique = oldlist.get("anganwadi_unique")!= null ? oldlist.get("anganwadi_unique").toString() : null;
Boolean is_anganwadiIndividual = oldlist.get("is_anganwadiIndividual") != null ? Boolean.parseBoolean(oldlist.get("is_anganwadiIndividual").toString()) : null;
schoolPropertyService.saveOldAnganwadi(anganwadi_unique, is_anganwadiIndividual, school_id);
}
}
if(newAnganwadiEdit != null) {
int kitchen_id=schoolPropertyService.getKitchenIdbySchId(school_id);
for(Map<String, Object> newlist:newAnganwadiEdit) {
String new_anganwadi_unique = newlist.get("anganwadi_unique")!= null ? newlist.get("anganwadi_unique").toString() : null;
Boolean new_is_anganwadiIndividual = newlist.get("is_anganwadiIndividual") != null ? Boolean.parseBoolean(newlist.get("is_anganwadiIndividual").toString()) : null;
schoolPropertyService.saveNewAnganwadi(new_anganwadi_unique, new_is_anganwadiIndividual,kitchen_id,school_id);
schoolPropertyService.updateAnganwadiCheck(new_anganwadi_unique, school_id);
}
}
}
response.put("status", "OK");
response.put("message", "Kitchen Details Updated successfully");
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return "Error";
response.put("status", "ERROR");
response.put("message", "Failed to save Kitchen details");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
}
}
@ -459,34 +692,60 @@ public class SchoolPropertyController {
public ResponseEntity<?> checkKitchenDetails(@RequestParam int school_id) {
Map<String, Object> kitchenDetails = schoolPropertyService.checkKitchenDetails(school_id);
List<Map<String, Object>> oldAnganwadiDetails = schoolPropertyService.checkOldAnganwadiDetails(school_id);
List<Map<String, Object>> newAnganwadiDetails = schoolPropertyService.checkNewAnganwadiDetails(school_id);
Map<String, Object> result = new HashMap<>();
result.put("Message", "Success");
result.put("Data", kitchenDetails);
result.put("kitchenDetails", kitchenDetails);
result.put("anganwadiDetails", oldAnganwadiDetails);
result.put("newAnganwadiDetails", newAnganwadiDetails);
return ResponseEntity.ok(Collections.singletonList(result));
}
@PostMapping(value = "/updateStaffDetails")
public String updateStaffDetails(@RequestParam int sgRegTeacher, @RequestParam int sgTempTeacher,
@RequestParam int sgPtTeacher, @RequestParam int sgNgoTeacher, @RequestParam int btRegTeacher,
@RequestParam int btTempTeacher, @RequestParam int btPtTeacher, @RequestParam int btNgoTeacher,
@RequestParam int pgRegTeacher, @RequestParam int pgTempTeacher, @RequestParam int pgPtTeacher,
@RequestParam int pgNgoTeacher, @RequestParam int kgRegTeacher, @RequestParam int kgTempTeacher,
@RequestParam int petRegTeacher, @RequestParam int petTempTeacher, @RequestParam int petGrade1Teacher, @RequestParam int petGrade2Teacher,
@RequestParam int totOa, @RequestParam int kgAyah, @RequestParam int compAss, @RequestParam int watchmen,
@RequestParam int scavengers, @RequestParam int maintenanceWork, @RequestParam int school_id) {
try {
return schoolPropertyService.updateStaffDetails(sgRegTeacher, sgTempTeacher, sgPtTeacher, sgNgoTeacher,
btRegTeacher, btTempTeacher, btPtTeacher, btNgoTeacher, pgRegTeacher, pgTempTeacher, pgPtTeacher,
pgNgoTeacher, kgRegTeacher, kgTempTeacher, petRegTeacher, petTempTeacher, petGrade1Teacher, petGrade2Teacher, totOa, kgAyah, compAss, watchmen, scavengers, maintenanceWork,
school_id);
@PostMapping("/updateStaffDetails")
public String updateStaffDetails(@RequestBody Map<String, Object> payload) {
int sgRegTeacher = Integer.parseInt(payload.get("modal_sgRegTeacher").toString());
int sgTempTeacher = Integer.parseInt(payload.get("modal_sgTempTeacher").toString());
int sgPtTeacher = Integer.parseInt(payload.get("modal_sgPtTeacher").toString());
int sgNgoTeacher = Integer.parseInt(payload.get("modal_sgNgoTeacher").toString());
int btRegTeacher = Integer.parseInt(payload.get("modal_btRegTeacher").toString());
int btTempTeacher = Integer.parseInt(payload.get("modal_btTempTeacher").toString());
int btPtTeacher = Integer.parseInt(payload.get("modal_btPtTeacher").toString());
int btNgoTeacher = Integer.parseInt(payload.get("modal_btNgoTeacher").toString());
int pgRegTeacher = Integer.parseInt(payload.get("modal_pgRegTeacher").toString());
int pgTempTeacher = Integer.parseInt(payload.get("modal_pgTempTeacher").toString());
int pgPtTeacher = Integer.parseInt(payload.get("modal_pgPtTeacher").toString());
int pgNgoTeacher = Integer.parseInt(payload.get("modal_pgNgoTeacher").toString());
int kgRegTeacher = Integer.parseInt(payload.get("modal_kgRegTeacher").toString());
int kgTempTeacher = Integer.parseInt(payload.get("modal_kgTempTeacher").toString());
int petRegTeacher = Integer.parseInt(payload.get("modal_petRegTeacher").toString());
int petTempTeacher = Integer.parseInt(payload.get("modal_petTempTeacher").toString());
int petGrade1Teacher = Integer.parseInt(payload.get("modal_petg1Teacher").toString());
int petGrade2Teacher = Integer.parseInt(payload.get("modal_petg2Teacher").toString());
int petPtTeacher = Integer.parseInt(payload.get("modal_petptTeacher").toString());
Boolean is_hm = (Boolean) payload.get("is_hmAvailability");
int stRegTeacher = Integer.parseInt(payload.get("modal_stRegTeacher").toString());
int stPtTeacher = Integer.parseInt(payload.get("modal_stPtTeacher").toString());
int totOa = Integer.parseInt(payload.get("modal_totOa").toString());
int kgAyah = Integer.parseInt(payload.get("modal_kgAyah").toString());
int compAss = Integer.parseInt(payload.get("modal_compAss").toString());
String watchmen = payload.get("modal_watchmen").toString();
int scavengers = Integer.parseInt(payload.get("modal_scavengers").toString());
int maintenanceWork = Integer.parseInt(payload.get("modal_maintenanceWork").toString());
int schoolId = Integer.parseInt(payload.get("schoolId").toString());
List<String> specialCategoryId = (List<String>) payload.get("specialCategoryId");
return schoolPropertyService.updateStaffStrength(sgRegTeacher, sgTempTeacher, sgPtTeacher, sgNgoTeacher, btRegTeacher,
btTempTeacher, btPtTeacher, btNgoTeacher, pgRegTeacher, pgTempTeacher, pgPtTeacher, pgNgoTeacher,
kgRegTeacher, kgTempTeacher, petRegTeacher, petTempTeacher, petGrade1Teacher, petGrade2Teacher, petPtTeacher,
is_hm, stRegTeacher, stPtTeacher, totOa, kgAyah, compAss, watchmen, scavengers, maintenanceWork, schoolId, specialCategoryId);
} catch (Exception e) {
e.printStackTrace();
return "Error";
}
}
/*
@ -544,6 +803,14 @@ public class SchoolPropertyController {
Integer borewell_count = requestData.get("borewell_count") != null
? Integer.valueOf(requestData.get("borewell_count").toString())
: 0;
int drinkingwater_tap = requestData.get("drinkingwater_tap") != null
? Integer.valueOf(requestData.get("drinkingwater_tap").toString())
: 0;
int handwash_tap= requestData.get("handwash_tap") != null
? Integer.valueOf(requestData.get("handwash_tap").toString())
: 0;
Boolean is_storage = (Boolean) requestData.get("is_storage");
// List<Map<String, Object>> storage = (List<Map<String, Object>>)
// requestData.get("storage");
@ -551,9 +818,13 @@ public class SchoolPropertyController {
int drinking_water_id = Integer.parseInt(requestData.get("drinking_water_id").toString());
Map<String, Object> response = new HashMap<>();
/*
schoolPropertyService.updateDrinkWater(is_purifier, purifier_capacity, is_borewell, borewell_count,
is_storage, school_id, drinking_water_id);
*/
schoolPropertyService.updateDrinkWater(is_purifier, purifier_capacity, is_borewell, borewell_count,
is_storage, school_id, drinking_water_id,drinkingwater_tap,handwash_tap);
schoolPropertyService.deactiveWaterSupply(school_id, drinking_water_id);
schoolPropertyService.deactiveWaterStorage(school_id, drinking_water_id);
for (Map<String, Object> waterSupply : water) {
@ -622,27 +893,29 @@ public class SchoolPropertyController {
}
@PostMapping(value = "/updateToiletDetails")
public String updateToiletDetails(@RequestParam("total_toiletBlocks") int total_toiletBlocks,
public String updateToiletDetails(@RequestParam(value = "total_toiletBlocks", required = false) Integer total_toiletBlocks,
@RequestParam("total_male_urinals") int total_male_urinals,
@RequestParam("total_female_urinals") int total_female_urinals,
@RequestParam("staff_male_toilets") int staff_male_toilets,
@RequestParam("staff_female_toilets") int staff_female_toilets,
@RequestParam("total_wc_male") int total_wc_male, @RequestParam("total_wc_female") int total_wc_female,
@RequestParam("total_diffAbled_toilet") int total_diffAbled_toilet,
@RequestParam("is_napkins") Boolean is_napkins, @RequestParam("school_id") int school_id) {
try {
return schoolPropertyService.updateToiletDetails(total_toiletBlocks, total_male_urinals, total_wc_male,
return schoolPropertyService.updateToiletDetails(total_toiletBlocks, total_male_urinals,total_female_urinals,staff_male_toilets,staff_female_toilets, total_wc_male,
total_wc_female, total_diffAbled_toilet, is_napkins, school_id);
} catch (Exception e) {
e.printStackTrace();
return "Error";
}
}
@PostMapping(value = "/saveAssetMaster")
public ResponseEntity<Map<String, String>> saveAssetMaster(@RequestBody Map<String, Object> payload) {
Map<String, String> response = new HashMap<>();
String status="";
String status = "";
try {
int school_id = Integer.parseInt(payload.get("school_id").toString());
@ -654,12 +927,13 @@ public class SchoolPropertyController {
int sub_asset_id = Integer.parseInt(asset.get("sub_asset_id").toString());
int master_qty = Integer.parseInt(asset.get("master_qty").toString());
status = schoolPropertyService.saveAssetMaster(sub_asset_id, master_qty, school_id, asset_id);
status = schoolPropertyService.saveAssetMaster(sub_asset_id, master_qty, school_id, asset_id);
}
response.put("status", status.equals("Success") ? "OK" : "ERROR");
response.put("message",status.equals("Success") ? "Asset Master Saved successfully" : "Failed to Save Asset Master");
response.put("message",
status.equals("Success") ? "Asset Master Saved successfully" : "Failed to Save Asset Master");
return ResponseEntity.ok(response);
} catch (Exception e) {
@ -674,7 +948,7 @@ public class SchoolPropertyController {
public ResponseEntity<?> getAssetMaster(@RequestParam int school_id, @RequestParam int asset_id) {
List<Map<String, Object>> data = schoolPropertyService.getAssetMaster(school_id, asset_id);
//System.out.println("data=="+data);
// System.out.println("data=="+data);
Map<String, Object> result = new HashMap<>();
result.put("status", "Success");
result.put("data", data);
@ -702,15 +976,43 @@ public class SchoolPropertyController {
Map<String, Object> assetMaster = schoolPropertyService.getAssetMasterById(assetMasterId, asset_id);
int qty = (Integer) assetMaster.get("master_qty");
int unmapped_asset = (Integer) assetMaster.get("unmapped_qty");
int master = qty + master_qty;
int unmapped = master_qty + unmapped_asset;
return schoolPropertyService.updateAssetMaster(assetMasterId, master, asset_id, unmapped);
int mapped_asset = qty - unmapped_asset;
int master = 0;
int unmapped = 0;
if(master_qty>=mapped_asset) {
master = master_qty;
unmapped = master_qty - mapped_asset;
return schoolPropertyService.updateAssetMaster(assetMasterId, master, asset_id, unmapped);
}
else {
return "lesser than";
}
} catch (Exception e) {
e.printStackTrace();
return "Error";
}
}
@GetMapping("/getAnganwadiDetails")
public ResponseEntity<Map<String, Object>> getAnganwadiDetailsBySchId(@RequestParam int school_id) {
try {
List<Map<String, Object>> data = schoolPropertyService.getAnganwadiDetailsBySchId(school_id);
Map<String, Object> response = new HashMap<>();
if (data != null && !data.isEmpty()) {
response.put("status", "OK");
response.put("data", data);
} else {
response.put("status", "Failed");
response.put("data", "No Data Found");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error fetching room details: " + e.getMessage()));
}
}
}

20
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/SchoolReportController.java

@ -43,6 +43,26 @@ public class SchoolReportController {
public ResponseEntity<?> getAEOSchoolData(@RequestParam (required = false) List<String> udise,
@RequestParam (required = false) String zone,
@RequestParam (required = false) String ward){
return schoolReportService.getAEOSchoolData(udise, zone, ward);
}
@GetMapping("/getAEOStudentData")
public ResponseEntity<?> getAEOStudentData(@RequestParam (required = false) List<String> udise){
System.out.println("list="+udise);
return schoolReportService.getAEOStudentData(udise);
}
@GetMapping("/getAEOStudentsCount")
public ResponseEntity<?> getAEOStudentsCount(){
return schoolReportService.getAEOStudentsCount();
}
@GetMapping("/getRegisteredStud")
public ResponseEntity<?> getRegisteredStud(@RequestParam String udise){
return schoolReportService.getRegisteredStud(udise);
}
}

127
src/main/java/in/gov/chennaicorporation/gccoffice/school/Controller/StudentInfoController.java

@ -0,0 +1,127 @@
package in.gov.chennaicorporation.gccoffice.school.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.PostMapping;
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.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.school.Service.StudentInfoService;
@RestController
@RequestMapping("/gcc/api/gccschool/studentInfo")
public class StudentInfoController {
@Autowired
private StudentInfoService studentInfoService;
@Autowired
public StudentInfoController(StudentInfoService studentInfoService) {
this.studentInfoService = studentInfoService;
}
@GetMapping("/getStandards")
public ResponseEntity<?> getStandards(@RequestParam String udise){
return studentInfoService.getStandards(udise);
}
@GetMapping("/getSections")
public ResponseEntity<?> getSections(){
return studentInfoService.getSections();
}
@PostMapping("/saveStudent")
public ResponseEntity<?> saveStudent(@RequestParam String udise,
@RequestParam String student_name,
@RequestParam String emis_no,
@RequestParam String gender,
@RequestParam String std,
@RequestParam String dob,
@RequestParam String age,
@RequestParam String parent_type,
@RequestParam String section,
@RequestParam String medium,
@RequestParam(value = "father_name", required = false) String father_name,
@RequestParam(value = "mother_name", required = false) String mother_name,
@RequestParam(value = "guardian_name", required = false) String guardian_name,
@RequestParam(value = "father_mobile", required = false) String father_mobile,
@RequestParam(value = "mother_mobile", required = false) String mother_mobile,
@RequestParam(value = "guardian_mobile", required = false) String guardian_mobile,
@RequestParam(value = "father_aadhar", required = false) String father_aadhar,
@RequestParam(value = "mother_aadhar", required = false) String mother_aadhar,
@RequestParam(value = "guardian_aadhar", required = false) String guardian_aadhar,
@RequestParam(value = "student_aadhar", required = false) String student_aadhar,
@RequestParam(value = "father_aadhar_file", required = false) MultipartFile father_aadhar_file,
@RequestParam(value = "mother_aadhar_file", required = false) MultipartFile mother_aadhar_file,
@RequestParam(value = "guardian_aadhar_file", required = false) MultipartFile guardian_aadhar_file,
@RequestParam(value = "student_aadhar_file", required = false) MultipartFile student_aadhar_file) {
//return studentInfoService.saveStudent(udise, student_name, emis_no, gender, std, dob, age, parent_type, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file);
return studentInfoService.checkStudent(udise, student_name, emis_no, gender, std, dob, age, parent_type,section,medium, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file);
}
@GetMapping("/getStudentsClass")
public ResponseEntity<?> getStudentsClass(@RequestParam String std,
@RequestParam String udise){
return studentInfoService.getStudentsClass(udise, std);
}
@GetMapping("/getStudentsDetails")
public ResponseEntity<?> getStudentsDetails(@RequestParam String studentId){
return studentInfoService.getStudentsDetails(studentId);
}
@GetMapping("/getMedium")
public ResponseEntity<?> getMedium(){
return studentInfoService.getMedium();
}
@PostMapping("/deleteStudent")
public ResponseEntity<?> deleteStudent(@RequestParam String student_id,
@RequestParam String user_id,
@RequestParam String action_type) {
return studentInfoService.deleteProcess(student_id, user_id, action_type);
}
@PostMapping("/updateStudent")
public ResponseEntity<?> updateStudent(@RequestParam String student_id,
@RequestParam String user_id,
@RequestParam String action_type,
@RequestParam String udise,
@RequestParam String student_name,
@RequestParam String emis_no,
@RequestParam String gender,
@RequestParam String mediums,
@RequestParam String std,
@RequestParam String section,
@RequestParam String dob,
@RequestParam String age,
@RequestParam String parent_type,
@RequestParam(value = "father_name", required = false) String father_name,
@RequestParam(value = "mother_name", required = false) String mother_name,
@RequestParam(value = "guardian_name", required = false) String guardian_name,
@RequestParam(value = "father_mobile", required = false) String father_mobile,
@RequestParam(value = "mother_mobile", required = false) String mother_mobile,
@RequestParam(value = "guardian_mobile", required = false) String guardian_mobile,
@RequestParam(value = "father_aadhar", required = false) String father_aadhar,
@RequestParam(value = "mother_aadhar", required = false) String mother_aadhar,
@RequestParam(value = "guardian_aadhar", required = false) String guardian_aadhar,
@RequestParam(value = "student_aadhar", required = false) String student_aadhar,
@RequestParam(value = "father_aadhar_file", required = false) MultipartFile father_aadhar_file,
@RequestParam(value = "mother_aadhar_file", required = false) MultipartFile mother_aadhar_file,
@RequestParam(value = "guardian_aadhar_file", required = false) MultipartFile guardian_aadhar_file,
@RequestParam(value = "student_aadhar_file", required = false) MultipartFile student_aadhar_file,
@RequestParam (value = "raw_father_aadhar", required = false) String raw_father_aadhar,
@RequestParam (value = "raw_mother_aadhar", required = false) String raw_mother_aadhar,
@RequestParam (value = "raw_guardian_aadhar", required = false) String raw_guardian_aadhar,
@RequestParam (value = "raw_student_aadhar", required = false) String raw_student_aadhar) {
return studentInfoService.updateProcess(student_id, user_id, action_type, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file, raw_father_aadhar, raw_mother_aadhar, raw_guardian_aadhar, raw_student_aadhar);
}
@GetMapping("/checkStudent")
public ResponseEntity<?> checkStudent(@RequestParam String udise, @RequestParam String schoolId){
return studentInfoService.checkStudent(udise, schoolId);
}
}

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/.DS_Store

262
src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/BuildingAssetService.java

@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service;
@ -23,9 +24,13 @@ import org.springframework.web.bind.annotation.RequestParam;
public class BuildingAssetService {
private JdbcTemplate jdbcTemplate;
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
public void setDataSourcemysql(@Qualifier("mysqlSchoolDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.namedParameterJdbcTemplate= new NamedParameterJdbcTemplate(dataSource);
}
@Transactional
@ -113,7 +118,7 @@ public class BuildingAssetService {
+ "WHERE b.school_id = ? and b.is_delete=0 and b.is_active=1 ORDER BY b.buildng_id";
return jdbcTemplate.queryForList(sql, school_id);
}
/*
@Transactional
public void saveRoomDetails(int room_type, String room_num, int building_id, int floors_id, int school_id) {
String sql = "INSERT INTO room_details (room_type, room_num, building_id, floors_id, school_id) VALUES (?, ?, ?, ?, ?)";
@ -124,7 +129,48 @@ public class BuildingAssetService {
}
}
*/
@Transactional
public String roomDetails(int room_type, String room_num, int building_id, int floors_id,
String anganwadiUniqueNumber, Boolean anganwadi_check, int school_id) {
String response = "";
if(anganwadiUniqueNumber!=null) {
int is_avbl = checkAnganwadi(school_id, anganwadiUniqueNumber);
if(is_avbl==0) {
saveRoomDetails(room_type, room_num, building_id, floors_id,anganwadiUniqueNumber, anganwadi_check, school_id);
response = "Saved sucessfully";
} else if(is_avbl==1) {
response = "Duplicate";
} else {
response = "Error";
}
} else {
saveRoomDetails(room_type, room_num, building_id, floors_id,anganwadiUniqueNumber, anganwadi_check, school_id);
response = "Saved sucessfully";
}
return response;
}
private int checkAnganwadi(int school_id, String anganwadiUniqueNumber) {
String sql = "SELECT CASE WHEN EXISTS (SELECT 1 FROM room_details WHERE school_id = ? and anganwadi_unique_number = ?) THEN 1 ELSE 0 END AS result";
try {
return jdbcTemplate.queryForObject(sql, Integer.class, school_id, anganwadiUniqueNumber);
} catch (Exception e) {
e.printStackTrace();
return 5;
}
}
public void saveRoomDetails(int room_type, String room_num, int building_id, int floors_id, String anganwadiUniqueNumber, Boolean anganwadi_check, int school_id) {
String sql = "INSERT INTO room_details (room_type, room_num, building_id, floors_id,anganwadi_unique_number, anganwadi_check, school_id) VALUES (?,?, ?, ?, ?, ?, ?)";
try {
jdbcTemplate.update(sql, room_type, room_num, building_id, floors_id,anganwadiUniqueNumber, anganwadi_check, school_id);
} catch (DataAccessException e) {
e.printStackTrace();
}
}
public Map<String, Object> getSimpleBuildingById(int buildingId) {
String sql = "SELECT b.*, rm.content as roofmaterial ,bm.content as buildingmaterial FROM buildings b join building_material_master bm on\r\n"
+ " bm.execution_order=b.building_material inner join roof_material_master rm on rm.execution_order=b.roof_material WHERE buildng_id = ?";
@ -208,33 +254,7 @@ public class BuildingAssetService {
List<Map<String, Object>> electrical_asset= getElectricalAssetMasterByFloorId(floor_id);
List<Map<String, Object>> furniture_asset= getFurnitureAssetMasterByFloorId(floor_id);
/*
for(Map<String, Object> ele_data : electrical_asset) {
int school_id = (Integer) ele_data.get("school_id");
int sub_asset_id = (Integer) ele_data.get("sub_asset_id");
String assetType="electricalasset";
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
int map = 0;
int unMap = unMapped+mapped;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
editElectricalAsset(floor_id, building_id);
for(Map<String, Object> fur_data : furniture_asset) {
int school_id = (Integer) fur_data.get("school_id");
int sub_asset_id = (Integer) fur_data.get("sub_asset_id");
String assetType="furnitureasset";
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
int map = 0;
int unMap = unMapped+mapped;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
*/
for(Map<String, Object> ele_data : electrical_asset) {
int school_id = (Integer) ele_data.get("school_id");
int sub_asset_id = (Integer) ele_data.get("sub_asset_id");
@ -262,9 +282,10 @@ public class BuildingAssetService {
int unMap = unMapped+asset_qty;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
editFurnitureAsset(floor_id, building_id);
editRooms(floor_id, building_id);
editRoom(floor_id, building_id);
editFloor(floor_id, building_id);
@ -319,7 +340,7 @@ public class BuildingAssetService {
}
private void editRooms(int floor_id, int building_id) {
private void editRoom(int floor_id, int building_id) {
String sql = "UPDATE room_details SET is_active = false, is_delete = true WHERE floors_id = ? And building_id=?";
try {
jdbcTemplate.update(sql, floor_id, building_id);
@ -341,9 +362,9 @@ public class BuildingAssetService {
@Transactional
public void unmapAssets(int room_id, boolean is_delete) {
String sql = "UPDATE it_mapping SET is_delete = ?, is_active=0 WHERE room_id = ?";
String sql1 = "UPDATE furniture_mapping SET is_delete = ?, is_active=0 WHERE room_id = ?";
String sql2 = "UPDATE electrical_mapping SET is_delete = ?, is_active=0 WHERE room_id = ?";
String sql = "UPDATE it_mapping SET is_delete = ?,is_active=0 WHERE room_id = ?";
String sql1 = "UPDATE furniture_mapping SET is_delete = ?,is_active=0 WHERE room_id = ?";
String sql2 = "UPDATE electrical_mapping SET is_delete = ?,is_active=0 WHERE room_id = ?";
try {
jdbcTemplate.update(sql, is_delete, room_id);
jdbcTemplate.update(sql1, is_delete, room_id);
@ -357,7 +378,7 @@ public class BuildingAssetService {
@Transactional
public void deleteRoom(int room_id, boolean is_delete) {
String sql = "UPDATE room_details SET is_delete = ?, is_active=0 WHERE room_id = ? ";
String sql = "UPDATE room_details SET is_delete = ?,is_active=0 WHERE room_id = ? ";
try {
jdbcTemplate.update(sql, is_delete, room_id);
} catch (DataAccessException e) {
@ -377,16 +398,17 @@ public class BuildingAssetService {
List<Map<String, Object>> electrical_asset= getElectricalAssetMasterByBuildingId(building_id);
List<Map<String, Object>> furniture_asset= getFurnitureAssetMasterByBuildingId(building_id);
/*
for(Map<String, Object> ele_data : electrical_asset) {
int school_id = (Integer) ele_data.get("school_id");
int sub_asset_id = (Integer) ele_data.get("sub_asset_id");
int asset_qty = (Integer) ele_data.get("asset_qty");
String assetType="electricalasset";
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
int map = 0;
int unMap = unMapped+mapped;
int map = mapped-asset_qty;
int unMap = unMapped+asset_qty;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
@ -395,42 +417,16 @@ public class BuildingAssetService {
for(Map<String, Object> fur_data : furniture_asset) {
int school_id = (Integer) fur_data.get("school_id");
int sub_asset_id = (Integer) fur_data.get("sub_asset_id");
int asset_qty = (Integer) fur_data.get("asset_qty");
String assetType="furnitureasset";
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
int map = 0;
int unMap = unMapped+mapped;
int map = mapped-asset_qty;
int unMap = unMapped+asset_qty;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
*/
for(Map<String, Object> ele_data : electrical_asset) {
int school_id = (Integer) ele_data.get("school_id");
int sub_asset_id = (Integer) ele_data.get("sub_asset_id");
int asset_qty = (Integer) ele_data.get("asset_qty");
String assetType="electricalasset";
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
int map = mapped-asset_qty;
int unMap = unMapped+asset_qty;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
deleteElectricalAsset(building_id, is_delete);
for(Map<String, Object> fur_data : furniture_asset) {
int school_id = (Integer) fur_data.get("school_id");
int sub_asset_id = (Integer) fur_data.get("sub_asset_id");
int asset_qty = (Integer) fur_data.get("asset_qty");
String assetType="furnitureasset";
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
int map = mapped-asset_qty;
int unMap = unMapped+asset_qty;
updateAssetmaster(map, unMap, school_id, sub_asset_id, assetType);
}
deleteFurnitureAsset(building_id, is_delete);
deleteRoomById(building_id, is_delete);
@ -544,23 +540,57 @@ public class BuildingAssetService {
@Transactional
public Map<String, Object> getRoomDetailsById(int roomId) {
String sql = "SELECT rd.room_id, " + " rd.room_num AS room_name, " + " bd.building_name, "
+ " fl.floor_name AS floor, " + // ✅ FIXED HERE
" rm.room_type, " + " rd.school_id, " + " rm.room_master_id, "
+ " fl.floors_id " + "FROM room_details rd "
String sql = "SELECT rd.room_id,rd.room_num AS room_name,bd.building_name, "
+ "fl.floor_name AS floor, rm.room_type, rd.school_id, rm.room_master_id,rd.anganwadi_unique_number, "
+ "fl.floors_id " + "FROM room_details rd "
+ "JOIN buildings bd ON bd.buildng_id = rd.building_id "
+ "JOIN floor_list fl ON fl.floors_id = rd.floors_id " + // ✅ REMOVED floor_master JOIN
+ "JOIN floor_list fl ON fl.floors_id = rd.floors_id " +
"JOIN room_master rm ON rd.room_type = rm.room_master_id "
+ "WHERE rd.room_id = ? AND rd.is_active = 1 AND rd.is_delete = 0";
return jdbcTemplate.queryForMap(sql, roomId);
}
public String editRoomsById(int room_type, String room_num, int building_id, int floors_id, int school_id,
String anganwadiUniqueNumber, Boolean anganwadi_check,int room_id) {
String response = "";
if(anganwadiUniqueNumber!=null) {
int is_avbl = checkAnganwadiEdit(school_id, anganwadiUniqueNumber,room_id);
if(is_avbl==0) {
editRoom(room_type, room_num, building_id, floors_id, school_id,anganwadiUniqueNumber,anganwadi_check,room_id);
response = "Rooms Edited Sucessfully";
} else if(is_avbl==1) {
response = "Duplicate";
} else {
response = "Error";
}
} else {
editRoom(room_type, room_num, building_id, floors_id, school_id,anganwadiUniqueNumber, anganwadi_check,room_id);
response = "Rooms Edited Sucessfully";
}
return response;
}
private int checkAnganwadiEdit(int school_id, String anganwadiUniqueNumber,int room_id) {
String sql = "SELECT CASE WHEN EXISTS (SELECT 1 FROM room_details WHERE school_id = ? and anganwadi_unique_number = ? and room_id !=? ) THEN 1 ELSE 0 END AS result";
try {
return jdbcTemplate.queryForObject(sql, Integer.class, school_id, anganwadiUniqueNumber,room_id);
} catch (Exception e) {
e.printStackTrace();
return 5;
}
}
@Transactional
public void editRoom(int room_type, String room_num, int building_id, int floors_id, int school_id, int room_id) {
String sql = "UPDATE room_details SET room_type = ?, room_num = ?, building_id = ?, floors_id = ?, school_id = ? WHERE room_id = ? ";
public void editRoom(int room_type, String room_num, int building_id, int floors_id, int school_id,String anganwadiUniqueNumber,Boolean anganwadi_check, int room_id) {
String sql = "UPDATE room_details SET room_type = ?, room_num = ?, building_id = ?, floors_id = ?, school_id = ?, anganwadi_unique_number=?,anganwadi_check=? WHERE room_id = ? ";
try {
jdbcTemplate.update(sql, room_type, room_num, building_id, floors_id, school_id, room_id);
jdbcTemplate.update(sql, room_type, room_num, building_id, floors_id, school_id,anganwadiUniqueNumber, anganwadi_check, room_id);
} catch (DataAccessException e) {
e.printStackTrace();
}
@ -634,8 +664,8 @@ public class BuildingAssetService {
@Transactional
public List<Map<String, Object>> getSchoolAssetForManagement(int school_id) {
String sql = "SELECT md.* FROM school_list m INNER JOIN it_master_details md ON m.udise COLLATE utf8mb4_general_ci = md.udise\r\n"
+ "WHERE m.id = ?";
String sql = "SELECT md.* FROM school_list m INNER JOIN it_master_details md ON m.udise COLLATE utf8mb4_general_ci = md.udise "
+ "WHERE m.id = ? and md.is_online = '0'";
try {
return jdbcTemplate.queryForList(sql, school_id);
} catch (Exception e) {
@ -735,26 +765,51 @@ public class BuildingAssetService {
}
}
//intial
// checking for view
public List<Map<String, Object>> getStudentStrengthBySchoolId(@RequestParam int schoolId) {
String sql = "SELECT total_boys, total_girls, others, total_students FROM student_strength WHERE school_id = ?";
String sql = "SELECT total_boys, total_girls, others, total_students,special_child " +
"FROM student_strength " +
"WHERE school_id = ? " +
"ORDER BY student_id DESC LIMIT 1";
return jdbcTemplate.queryForList(sql, schoolId);
return jdbcTemplate.queryForList(sql, schoolId);
}
//initial
/*public List<Map<String, Object>> getotherdetailsBySchoolId(@RequestParam int schoolId) {
String sql = "select*from school_buildup_area where school_id=?" ;
return jdbcTemplate.queryForList(sql, schoolId);
}*/
public List<Map<String, Object>> getotherdetailsBySchoolId(@RequestParam int schoolId) {
String sql = "select*from school_buildup_area where school_id=?";
//String sql = "select*from school_buildup_area where school_id=? ORDER BY buildup_id DESC LIMIT 1" ;
String sql = "SELECT buildup_id, land_area, buildup_area, " +
"CAST(is_compound AS SIGNED) AS is_compound, " +
"is_nameboard AS is_nameboard, " +
"is_pasystem AS is_pasystem, " +
"is_bell AS is_bell, " +
"is_generator AS is_generator, " +
"school_id " +
"FROM school_buildup_area WHERE school_id = ? ORDER BY buildup_id DESC LIMIT 1";
return jdbcTemplate.queryForList(sql, schoolId);
}
public List<Map<String, Object>> getStaffStrengthBySchoolId(@RequestParam int schoolId) {
//initial
/*public List<Map<String, Object>> getStaffStrengthBySchoolId(@RequestParam int schoolId) {
String sql = "SELECT * FROM staff_strength_1 WHERE school_id = ?";
return jdbcTemplate.queryForList(sql, schoolId);
}
public List<Map<String, Object>> getStaffStrengthBySchoolId(@RequestParam int schoolId) {
String sql = "SELECT * FROM staff_strength_1 WHERE school_id = ? ORDER BY staff_id DESC LIMIT 1";
return jdbcTemplate.queryForList(sql, schoolId);
}
*/
@Transactional
public Map<String, Object> getIt_Details(int it_map_id) {
Map<String, Object> result = new HashMap<>();
@ -893,6 +948,7 @@ public class BuildingAssetService {
@Transactional
public int mapAssetMaster(int asset_qty, String assetType, int sub_asset_id, int school_id) {
Map<String, Object> assetMaster = getAssetMasterBySchlId(sub_asset_id, school_id, assetType);
int mapped = assetMaster.get("mapped_qty") != null ? (Integer) assetMaster.get("mapped_qty") : 0;
int unMapped = assetMaster.get("unmapped_qty") != null ? (Integer) assetMaster.get("unmapped_qty") : 0;
if(unMapped>=asset_qty) {
@ -923,23 +979,7 @@ public class BuildingAssetService {
}
/*
@Transactional
public Map<String, Object> getAssetMasterBySchlId(int sub_asset_id, int school_id, String assetType) {
String sql="";
if (assetType.equalsIgnoreCase("furnitureasset")) {
sql = "SELECT * from furniture_master where school_id = ? and sub_asset_id = ?";
} else if (assetType.equalsIgnoreCase("electricalasset")) {
sql = "SELECT * from electrical_master where school_id = ? and sub_asset_id = ?";
}
try {
return jdbcTemplate.queryForMap(sql, school_id, sub_asset_id);
} catch (Exception e) {
e.printStackTrace();
return Map.of();
}
}
*/
@Transactional
public Map<String, Object> getAssetMasterBySchlId(int sub_asset_id, int school_id, String assetType) {
String sql="";
@ -963,7 +1003,7 @@ public class BuildingAssetService {
@Transactional
public List<Map<String, Object>> getElectricalAssetMasterByRoomId(int room_id) {
try {
String sql = "select sub_asset_id, school_id from electrical_mapping where room_id=? AND is_active = 1 AND is_delete = 0";
String sql = "select sub_asset_id, school_id, asset_qty from electrical_mapping where room_id=? and is_active = 1 and is_delete = 0";
return jdbcTemplate.queryForList(sql, room_id);
} catch (Exception e) {
@ -975,7 +1015,7 @@ public class BuildingAssetService {
@Transactional
public List<Map<String, Object>> getFurnitureAssetMasterByRoomId(int room_id) {
try {
String sql = "select sub_asset_id, school_id from furniture_mapping where room_id=? AND is_active = 1 AND is_delete = 0";
String sql = "select sub_asset_id, school_id, asset_qty from furniture_mapping where room_id=? and is_active = 1 and is_delete = 0";
return jdbcTemplate.queryForList(sql, room_id);
} catch (Exception e) {
@ -987,7 +1027,7 @@ public class BuildingAssetService {
@Transactional
private List<Map<String, Object>> getElectricalAssetMasterByFloorId(int floor_id) {
try {
String sql = "select sub_asset_id, school_id from electrical_mapping where floor_id=? AND is_active = 1 and is_delete = 0";
String sql = "select sub_asset_id, school_id, asset_qty from electrical_mapping where floor_id=? and is_active = 1 and is_delete = 0";
return jdbcTemplate.queryForList(sql, floor_id);
} catch (Exception e) {
@ -998,7 +1038,7 @@ public class BuildingAssetService {
@Transactional
private List<Map<String, Object>> getFurnitureAssetMasterByFloorId(int floor_id) {
try {
String sql = "select sub_asset_id, school_id from furniture_mapping where floor_id=? AND is_active = 1 and is_delete = 0";
String sql = "select sub_asset_id, school_id, asset_qty from furniture_mapping where floor_id=? and is_active = 1 and is_delete = 0";
return jdbcTemplate.queryForList(sql, floor_id);
} catch (Exception e) {
@ -1010,7 +1050,7 @@ public class BuildingAssetService {
@Transactional
private List<Map<String, Object>> getElectricalAssetMasterByBuildingId(int building_id) {
try {
String sql = "select sub_asset_id, school_id from electrical_mapping where building_id=? and is_active = 1 and is_delete = 0";
String sql = "select sub_asset_id, school_id, asset_qty from electrical_mapping where building_id=? and is_active = 1 and is_delete = 0";
return jdbcTemplate.queryForList(sql, building_id);
} catch (Exception e) {
@ -1022,7 +1062,7 @@ public class BuildingAssetService {
@Transactional
private List<Map<String, Object>> getFurnitureAssetMasterByBuildingId(int building_id) {
try {
String sql = "select sub_asset_id, school_id from furniture_mapping where building_id=? and is_active = 1 and is_delete = 0";
String sql = "select sub_asset_id, school_id, asset_qty from furniture_mapping where building_id=? and is_active = 1 and is_delete = 0";
return jdbcTemplate.queryForList(sql, building_id);
} catch (Exception e) {
@ -1084,7 +1124,19 @@ public class BuildingAssetService {
}
}
public List<Map<String, Object>> getStaffStrengthBySchoolId(@RequestParam int schoolId) {
String sql = "SELECT * FROM staff_strength_1 WHERE school_id = ? ORDER BY staff_id DESC LIMIT 1";
return jdbcTemplate.queryForList(sql, schoolId);
}
public List<Map<String, Object>> getSpecialCategoryBySchoolId(int schoolId) {
String sql = "SELECT scd.*,scm.special_category as sc_names FROM special_category_details scd\r\n"
+ "INNER JOIN special_category_master scm ON scm.special_category_id=scd.special_category_id\r\n"
+ "where scd.school_id=? AND scd.is_active=1 AND scd.is_delete=0";
return jdbcTemplate.queryForList(sql, schoolId);
}
}

6
src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/DropdownsService.java

@ -185,4 +185,10 @@ public class DropdownsService {
return jdbcTemplate.queryForList(sql, String.class, school_id);
}
@Transactional
public List<Map<String, Object>> getSpecialCategory(){
String sql = "SELECT * FROM special_category_master WHERE is_active=1 AND is_delete=0 ORDER BY execution_order";
return jdbcTemplate.queryForList(sql);
}
}

782
src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/SchoolPropertyService.java
File diff suppressed because it is too large
View File

298
src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/SchoolReportService.java

@ -1,6 +1,7 @@
package in.gov.chennaicorporation.gccoffice.school.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -14,15 +15,21 @@ import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Service;
@Service
public class SchoolReportService {
private JdbcTemplate jdbcTemplate;
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
public void setDataSourcemysql(@Qualifier("mysqlSchoolDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
}
@Transactional
@ -47,7 +54,7 @@ public class SchoolReportService {
public ResponseEntity<?> getAEOZone(String udise) {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT DISTINCT zone AS zone FROM school_list WHERE udise In(" + udise + ")";
String sql = "SELECT DISTINCT zone FROM school_list WHERE udise In(" + udise + ") ORDER BY zone ASC";
try {
List<String> data = jdbcTemplate.queryForList(sql, String.class);
result.put("message", "Success");
@ -65,7 +72,7 @@ public class SchoolReportService {
public ResponseEntity<?> getAEOWard(String udise, String zone) {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT DISTINCT division AS Ward FROM school_list WHERE udise In(" + udise + ") and zone = ?";
String sql = "SELECT DISTINCT division AS Ward FROM school_list WHERE udise In(" + udise + ") and zone = ? ORDER BY Ward ASC";
try {
List<String> data = jdbcTemplate.queryForList(sql, String.class, zone);
result.put("message", "Success");
@ -82,38 +89,45 @@ public class SchoolReportService {
@Transactional
public ResponseEntity<?> getAEOSchoolData(List<String> udise, String zone, String ward) {
Map<String, Object> response = new HashMap<>();
List<Map<String,Object>> data = new ArrayList<Map<String,Object>>();
if(udise==null || udise.isEmpty()) {
udise=getUDISE();
}
for(String udises:udise) {
List<String> school = getschoolId(udises, zone, ward);
if(!school.isEmpty() && school!=null) {
for(String sch:school) {
//System.out.println("School_ID = "+sch);
Map<String, Object> result = new HashMap<>();
Map<String, Object> report = getSchoolReport(sch);
result.putAll(report);
String num = (String) report.get("udise");
Map<String, Object> report1 = getSchoolReport1(sch);
result.putAll(report1);
int pending=0;
for (Map.Entry<String, Object> entry : report1.entrySet()) {
if(entry.getValue().toString().equalsIgnoreCase("Pending")) {
if(!school.isEmpty() && school!=null) {
for(String sch:school) {
//System.out.println("School_ID = "+sch);
++pending;
}
}
result.put("overall_status", pending==0 ? "Completed" : "Pending");
Map<String, Object> result = new HashMap<>();
Map<String, Object> report = getSchoolReport(sch);
result.putAll(report);
String num = (String) report.get("udise");
Map<String, Object> report1 = getSchoolReport1(sch);
result.putAll(report1);
int pending=0;
for (Map.Entry<String, Object> entry : report1.entrySet()) {
if(entry.getValue().toString().equalsIgnoreCase("Pending")) {
++pending;
}
}
result.put("overall_status", pending==0 ? "Completed" : "Pending");
Map<String, Object> report2 = getAEO(num);
result.putAll(report2);
data.add(result);
Map<String, Object> report2 = getAEO(num);
result.putAll(report2);
data.add(result);
}
response.put("message", "Success");
response.put("data", data);
}
response.put("message", "Success");
response.put("data", data);
}
}
// System.out.println(data.get(0));
// System.out.println(data.get(1));
System.out.println(response.get("message"));
// System.out.println(response.get("data"));
return ResponseEntity.ok(response);
}
@ -267,6 +281,7 @@ public class SchoolReportService {
private List<String> getschoolId(String udise, String zone, String ward) {
String sql = "";
if (zone != null && !zone.isEmpty() && ward != null && !ward.isEmpty()) {
//System.out.println("check1");
sql = "SELECT id FROM school_list WHERE udise In(" + udise + ") and zone = ? and division = ?";
} else if (zone != null && !zone.isEmpty() && (ward == null || ward.isEmpty())) {
sql = "SELECT id FROM school_list WHERE udise In(" + udise + ") and zone = ?";
@ -287,4 +302,239 @@ public class SchoolReportService {
return List.of();
}
}
@Transactional
public ResponseEntity<?> getAEOStudentData(List<String> udise) {
Map<String, Object> response = new HashMap<>();
List<Map<String,Object>> data = new ArrayList<Map<String,Object>>();
if(udise.isEmpty()) {
udise = getUDISE();
System.out.println("udise="+udise);
}
for(String udises:udise) {
List<Map<String,Object>> school = getschoolsId(udises);
if(!school.isEmpty() && school!=null) {
for(Map<String,Object> sch:school) {
Map<String, Object> result = new HashMap<>();
int id = (Integer)sch.get("id");
Map<String, Object> report = getTotalStudents(id);
result.putAll(report);
String num = (String) sch.get("udise");
String sch_name=(String)sch.get("school_name");
String hm_name=(String)sch.get("hm_name");
String hm_mob_num=(String)sch.get("hm_phone_number");
String zone=(String)sch.get("zone");
String division=(String)sch.get("division");
Map<String, Object> report1 = getStudentsReg(num);
result.putAll(report1);
long totalStud = (long) report.get("total_students");
long regStud = (long) report1.get("students_registered");
long pending = totalStud - regStud;
result.put("pending", pending);
result.put("udise", num);
result.put("school_name",sch_name );
result.put("hm_name",hm_name );
result.put("hm_mobile", hm_mob_num);
result.put("zone", zone);
result.put("division",division );
Map<String, Object> report2 = getAEO(num);
result.putAll(report2);
data.add(result);
}
response.put("Message", "Success");
response.put("data", data);
System.out.println("data="+data);
} else {
response.put("Message", "No Data");
response.put("data", "No Data Found");
}
}
return ResponseEntity.ok(response);
}
private Map<String, Object> getStudentsReg(String udises) {
String sql = "SELECT count(*) as students_registered FROM student_info WHERE udise = ? AND is_active = 1 AND is_delete = 0";
try {
return jdbcTemplate.queryForMap(sql, udises);
} catch (Exception e) {
e.printStackTrace();
return Map.of();
}
}
private Map<String, Object> getTotalStudents(int sch) {
String sql = "SELECT COALESCE((SELECT total_students FROM student_strength WHERE school_id = ?), 0) AS total_students";
try {
return jdbcTemplate.queryForMap(sql, sch);
} catch (Exception e) {
e.printStackTrace();
return Map.of();
}
}
private List<Map<String,Object>> getschoolsId(String udises) {
String sql = "SELECT id, udise,school_name,hm_name,hm_phone_number,zone,division FROM school_list WHERE udise In(" + udises + ")";
try {
return jdbcTemplate.queryForList(sql);
} catch (DataAccessException e) {
e.printStackTrace();
return List.of();
}
}
////////////////////////////////////////////////
@Transactional
public ResponseEntity<?> getAEOStudentsCount() {
Map<String, Object> response = new HashMap<>();
List<Map<String,Object>> data = new ArrayList<Map<String,Object>>();
List<Map<String,Object>> aeos = getAeoDetails();
for(Map<String,Object> aeo : aeos) {
Map<String, Object> result = new HashMap<>();
String aoeNum = (String) aeo.get("aeo_num");
result.put("aoe", aoeNum);
String udises = (String) aeo.get("udise");
List<Integer> schoolId = getSchoolId(udises);
int school_count = schoolId.size();
result.put("school_count", school_count);
int total_stud = getTotalStudentsCount(schoolId);
result.put("total_students", total_stud);
int students_registered = getRegisteredStudents(udises);
result.put("student_registered", students_registered);
int pending = total_stud - students_registered;
result.put("pending", pending);
data.add(result);
}
response.put("Message", "Success");
response.put("data", data);
return ResponseEntity.ok(response);
}
private int getRegisteredStudents(String udises) {
String[] udiseArray = udises.split(",");
String placeholders = String.join(",", Collections.nCopies(udiseArray.length, "?"));
String sql = "SELECT COUNT(student_id) FROM student_info WHERE udise IN (" + placeholders
+ ") AND is_active = 1 AND is_delete = 0";
try {
Integer count = jdbcTemplate.queryForObject(sql, Integer.class, (Object[]) udiseArray);
return count != null ? count : 0;
} catch (DataAccessException e) {
e.printStackTrace();
return 0;
}
}
private int getTotalStudentsCount(List<Integer> schoolId) {
String sql = "SELECT SUM(total_students) FROM student_strength WHERE school_id IN (:schoolId)";
try {
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("schoolId", schoolId);
Integer total = namedParameterJdbcTemplate.queryForObject(sql, parameters, Integer.class);
return total != null ? total : 0;
} catch (DataAccessException e) {
e.printStackTrace();
return 0;
}
}
private List<Integer> getSchoolId(String udises) {
String sql = "SELECT id FROM school_list WHERE FIND_IN_SET(udise, :udises) > 0";
try {
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("udises", udises);
return namedParameterJdbcTemplate.queryForList(sql, parameters, Integer.class);
} catch (DataAccessException e) {
e.printStackTrace();
return List.of();
}
}
private List<Map<String, Object>> getAeoDetails() {
String sql = "SELECT aeo_num, udise FROM aeo_details";
try {
return jdbcTemplate.queryForList(sql);
} catch (DataAccessException e) {
e.printStackTrace();
return List.of();
}
}
@Transactional
public ResponseEntity<?> getRegisteredStud(String udise) {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT * "
+ " FROM student_info "
+ " WHERE udise = ? "
+ " AND is_active = 1 "
+ " AND is_delete = 0 "
+ " ORDER BY "
+ " CASE "
+ " WHEN std = 'PreKG' THEN 1 "
+ " WHEN std = 'LKG' THEN 2 "
+ " WHEN std = 'UKG' THEN 3 "
+ " WHEN std LIKE 'Class1' THEN 4 "
+ " WHEN std LIKE 'Class2' THEN 5 "
+ " WHEN std LIKE 'Class3' THEN 6 "
+ " WHEN std LIKE 'Class4' THEN 7 "
+ " WHEN std LIKE 'Class5' THEN 8 "
+ " WHEN std LIKE 'Class6' THEN 9 "
+ " WHEN std LIKE 'Class7' THEN 10 "
+ " WHEN std LIKE 'Class8' THEN 11 "
+ " WHEN std LIKE 'Class9' THEN 12\r\n"
+ " WHEN std LIKE 'Class10' THEN 13\r\n"
+ " WHEN std LIKE 'Class11' THEN 14\r\n"
+ " WHEN std LIKE 'Class12' THEN 15\r\n"
+ " ELSE 100 \r\n"
+ " END ";
try {
List<Map<String, Object>> data = jdbcTemplate.queryForList(sql, udise);
result.put("Message", "Success");
result.put("Data", data);
return ResponseEntity.ok(result);
} catch (Exception e) {
e.printStackTrace();
result.put("Message", "Error");
result.put("Error", "Failed to fetch AEO List: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
}
}
}

857
src/main/java/in/gov/chennaicorporation/gccoffice/school/Service/StudentInfoService.java

@ -0,0 +1,857 @@
package in.gov.chennaicorporation.gccoffice.school.Service;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class StudentInfoService {
private JdbcTemplate jdbcTemplate;
private String fileBaseUrl;
@Autowired
public void setDataSourcemysql(@Qualifier("mysqlSchoolDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.fileBaseUrl=environment.getProperty("fileBaseUrl");
}
@Autowired
private Environment environment;
@Transactional
public ResponseEntity<?> getStandards(String udise) {
Map<String, Object> result = new HashMap<>();
String standard = getStandardsCount(udise);
List<String> standards = Arrays.asList(standard.split(","));
List<Map<String, Object>> updateSTD = new ArrayList<>();
for (String std:standards) {
Map<String, Object> data = new HashMap<>();
String clas = std;
String count = getStudentCount(udise, clas);
data.put("Designation", clas);
data.put("Student_Count", count);
updateSTD.add(data);
}
if(!updateSTD.isEmpty()) {
result.put("Message", "Success");
result.put("Data", updateSTD);
return ResponseEntity.ok(result);
} else {
result.put("Message", "Error");
result.put("Error", "Failed to fetch class List");
return ResponseEntity.ok(result);
}
}
@Transactional
public ResponseEntity<?> getSections() {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT id,section FROM class_sections_master WHERE is_active=1 AND is_delete=0 ORDER BY id";
try {
List<Map<String, Object>> data = jdbcTemplate.queryForList(sql);
result.put("Message", "Success");
result.put("Data", data);
return ResponseEntity.ok(result);
} catch (Exception e) {
e.printStackTrace();
result.put("Message", "Error");
result.put("Error", "Failed to fetch medium List: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
}
}
@Transactional
private String getStudentCount(String udise, String clas) {
String sql = "SELECT count(student_id) FROM student_info where udise = ? AND std = ? AND is_active = 1 AND is_delete = 0 ";
try {
String data = jdbcTemplate.queryForObject(sql, new Object[]{udise, clas}, String.class);
return data;
}catch (Exception e) {
e.printStackTrace();
return "";
}
}
@Transactional
public String getStandardsCount(String udise) {
String sql = "SELECT CONCAT_WS(',', "
+ " IF(prekg = 1, 'PreKg', NULL), "
+ " IF(lkg = 1, 'LKG', NULL), "
+ " IF(ukg = 1, 'UKG', NULL), "
+ " IF(class1 = 1, 'Class1', NULL), "
+ " IF(class2 = 1, 'Class2', NULL), "
+ " IF(class3 = 1, 'Class3', NULL), "
+ " IF(class4 = 1, 'Class4', NULL), "
+ " IF(class5 = 1, 'Class5', NULL), "
+ " IF(class6 = 1, 'Class6', NULL), "
+ " IF(class7 = 1, 'Class7', NULL), "
+ " IF(class8 = 1, 'Class8', NULL), "
+ " IF(class9 = 1, 'Class9', NULL), "
+ " IF(class10 = 1, 'Class10', NULL), "
+ " IF(class11 = 1, 'Class11', NULL), "
+ " IF(class12 = 1, 'Class12', NULL) "
+ " ) AS active_classes "
+ " FROM school_class_master "
+ " WHERE udise = ? ";
try {
String data = jdbcTemplate.queryForObject(sql, String.class, udise);
return data;
} catch (Exception e) {
e.printStackTrace();
//return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
return null;
}
}
// @Transactional
// public ResponseEntity<?> getStandards(String udise) {
// Map<String, Object> result = new HashMap<>();
// String sql = "SELECT Designation, Student_Count FROM ( "
// + "SELECT 'PreKG' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'PreKG' "
// + " WHERE sem.UDISE = ? "
// + " AND (PreKg_Boys > 0 OR PreKg_Girls > 0 OR PreKg_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'LKG' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'LKG' "
// + " WHERE sem.UDISE = ? "
// + " AND (LKG_Boys > 0 OR LKG_Girls > 0 OR LKG_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'UKG' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'UKG' "
// + " WHERE sem.UDISE = ? "
// + " AND (UKG_Boys > 0 OR UKG_Girls > 0 OR UKG_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class1' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class1' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class1_Boys > 0 OR Class1_Girls > 0 OR Class1_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class2' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class2' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class2_Boys > 0 OR Class2_Girls > 0 OR Class2_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class3' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class3' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class3_Boys > 0 OR Class3_Girls > 0 OR Class3_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class4' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class4' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class4_Boys > 0 OR Class4_Girls > 0 OR Class4_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class5' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class5' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class5_Boys > 0 OR Class5_Girls > 0 OR Class5_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class6' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class6' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class6_Boys > 0 OR Class6_Girls > 0 OR Class6_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class7' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class7' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class7_Boys > 0 OR Class7_Girls > 0 OR Class7_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class8' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class8' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class8_Boys > 0 OR Class8_Girls > 0 OR Class8_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class9' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class9' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class9_Boys > 0 OR Class9_Girls > 0 OR Class9_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class10' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class10' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class10_Boys > 0 OR Class10_Girls > 0 OR Class10_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class11' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class11' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class11_Boys > 0 OR Class11_Girls > 0 OR Class11_Transgen > 0) AND si.is_active = 1 AND si.is_delete = 0 "
// + " UNION ALL "
// + " SELECT 'Class12' AS Designation, "
// + " COUNT(si.student_id) AS Student_Count "
// + " FROM student_enrollment_master sem "
// + " LEFT JOIN student_info si "
// + " ON sem.UDISE = si.udise AND si.std = 'Class12' "
// + " WHERE sem.UDISE = ? "
// + " AND (Class12_Boys > 0 OR Class12_Girls > 0 OR Class12_Transgen > 0)AND si.is_active = 1 AND si.is_delete = 0 "
// + " ) AS result WHERE Student_Count > 0";
//
// try {
// List<Map<String, Object>> data = jdbcTemplate.queryForList(sql, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise);
// result.put("Message", "Success");
// result.put("Data", data);
// return ResponseEntity.ok(result);
// } catch (Exception e) {
// e.printStackTrace();
// result.put("Message", "Error");
// result.put("Error", "Failed to fetch class List: " + e.getMessage());
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
// }
//
// }
// @Transactional
// public ResponseEntity<?> getStandards(String udise) {
// Map<String, Object> result = new HashMap<>();
// String sql = "SELECT 'PreKG' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (PreKg_Boys > 0 OR PreKg_Girls > 0 OR PreKg_Transgen > 0) "
// + " UNION "
// + " SELECT 'LKG' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (LKG_Boys > 0 OR LKG_Girls > 0 OR LKG_Transgen > 0) "
// + " UNION "
// + " SELECT 'UKG' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (UKG_Boys > 0 OR UKG_Girls > 0 OR UKG_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class1' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class1_Boys > 0 OR Class1_Girls > 0 OR Class1_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class2' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class2_Boys > 0 OR Class2_Girls > 0 OR Class2_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class3' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class3_Boys > 0 OR Class3_Girls > 0 OR Class3_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class4' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class4_Boys > 0 OR Class4_Girls > 0 OR Class4_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class5' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class5_Boys > 0 OR Class5_Girls > 0 OR Class5_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class6' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class6_Boys > 0 OR Class6_Girls > 0 OR Class6_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class7' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class7_Boys > 0 OR Class7_Girls > 0 OR Class7_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class8' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class8_Boys > 0 OR Class8_Girls > 0 OR Class8_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class9' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class9_Boys > 0 OR Class9_Girls > 0 OR Class9_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class10' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class10_Boys > 0 OR Class10_Girls > 0 OR Class10_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class11' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class11_Boys > 0 OR Class11_Girls > 0 OR Class11_Transgen > 0) "
// + " UNION "
// + " SELECT 'Class12' AS Designation "
// + " FROM student_enrollment_master "
// + " WHERE UDISE = ? "
// + " AND (Class12_Boys > 0 OR Class12_Girls > 0 OR Class12_Transgen > 0)";
//
// try {
// List<Map<String, Object>> data = jdbcTemplate.queryForList(sql, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise, udise);
// result.put("Message", "Success");
// result.put("Data", data);
// return ResponseEntity.ok(result);
// } catch (Exception e) {
// e.printStackTrace();
// result.put("Message", "Error");
// result.put("Error", "Failed to fetch class List: " + e.getMessage());
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
// }
//
// }
@Transactional
public ResponseEntity<?> checkStudent(String udise, String student_name, String emis_no, String gender, String std,
String dob, String age, String parent_type,String section,String medium, String father_name, String mother_name, String guardian_name,
String father_mobile, String mother_mobile, String guardian_mobile, String father_aadhar,
String mother_aadhar, String guardian_aadhar, String student_aadhar, MultipartFile father_aadhar_file,
MultipartFile mother_aadhar_file, MultipartFile guardian_aadhar_file, MultipartFile student_aadhar_file) {
Map<String, Object> result = new HashMap<>();
int is_avbl = checkEmis(emis_no);
if(is_avbl==0) {
String data = saveStudent(udise, student_name, emis_no, gender, std, dob, age, parent_type,section,medium, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file);
if (data.equalsIgnoreCase("sucess")) {
result.put("Message", "Saved Sucessfully");
result.put("Data", "Success");
} else {
result.put("Message", "Error");
result.put("Error", "Failed to save");
}
} else if(is_avbl==1){
result.put("Message", "Duplicate");
result.put("Error", "EMIS No already registered");
}else {
result.put("Message", "Error");
result.put("Error", "Failed to save");
}
return ResponseEntity.ok(result);
}
private int checkEmis(String emis_no) {
String sql = "SELECT CASE WHEN EXISTS (SELECT 1 FROM student_info WHERE emis_no = ? and is_active=1 and is_delete=0) THEN 1 ELSE 0 END AS result";
try {
return jdbcTemplate.queryForObject(sql, Integer.class, emis_no);
} catch (Exception e) {
e.printStackTrace();
return 5;
}
}
@Transactional
public String saveStudent(String udise, String student_name, String emis_no, String gender, String std,
String dob, String age, String parent_type,String section,String medium, String father_name, String mother_name, String guardian_name, String father_mobile, String mother_mobile, String guardian_mobile,
String father_aadhar, String mother_aadhar, String guardian_aadhar, String student_aadhar, MultipartFile father_aadhar_file,
MultipartFile mother_aadhar_file, MultipartFile guardian_aadhar_file, MultipartFile student_aadhar_file) {
String sql = "INSERT INTO student_info (udise, student_name, emis_no, gender, std, dob, age, parent_type,section,mediums, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file) VALUES (?, ?, ?, ?, ?, ?, ?, ? ,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)";
try {
String fatherUrl = null;
String motherUrl = null;
String guardianUrl = null;
String studentUrl = null;
if(student_aadhar.isEmpty()) {
student_aadhar=null;
}
String sec=section.toUpperCase();
if(father_aadhar_file!=null && !father_aadhar_file.isEmpty()) {
fatherUrl = saveFile(father_aadhar_file);
}
if(mother_aadhar_file!=null && !mother_aadhar_file.isEmpty()) {
motherUrl = saveFile(mother_aadhar_file);
}
if(guardian_aadhar_file!=null && !guardian_aadhar_file.isEmpty()) {
guardianUrl = saveFile(guardian_aadhar_file);
}
if(student_aadhar_file!=null && !student_aadhar_file.isEmpty()) {
studentUrl = saveFile(student_aadhar_file);
}
// System.out.println("----- Student Info -----");
// System.out.println("UDISE: " + udise);
// System.out.println("Student Name: " + student_name);
// System.out.println("EMIS No: " + emis_no);
// System.out.println("Gender: " + gender);
// System.out.println("Class: " + std);
// System.out.println("DOB: " + dob);
// System.out.println("Age: " + age);
// System.out.println("Parent Type: " + parent_type);
//
// System.out.println("----- Parent Details -----");
// System.out.println("Father Name: " + father_name);
// System.out.println("Mother Name: " + mother_name);
// System.out.println("Guardian Name: " + guardian_name);
//
// System.out.println("Father Mobile: " + father_mobile);
// System.out.println("Mother Mobile: " + mother_mobile);
// System.out.println("Guardian Mobile: " + guardian_mobile);
//
// System.out.println("Father Aadhar: " + father_aadhar);
// System.out.println("Mother Aadhar: " + mother_aadhar);
// System.out.println("Guardian Aadhar: " + guardian_aadhar);
// System.out.println("Student Aadhar: " + student_aadhar);
//
// System.out.println("----- Uploaded Files -----");
// System.out.println("Father Aadhar File: " + (father_aadhar_file != null ? father_aadhar_file.getOriginalFilename() : "null"));
// System.out.println("Mother Aadhar File: " + (mother_aadhar_file != null ? mother_aadhar_file.getOriginalFilename() : "null"));
// System.out.println("Guardian Aadhar File: " + (guardian_aadhar_file != null ? guardian_aadhar_file.getOriginalFilename() : "null"));
// System.out.println("Student Aadhar File: " + (student_aadhar_file != null ? student_aadhar_file.getOriginalFilename() : "null"));
jdbcTemplate.update(sql, udise, student_name, emis_no, gender, std, dob, age, parent_type,sec,medium, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, fatherUrl, motherUrl, guardianUrl, studentUrl);
return "sucess";
} catch (IOException e) {
e.printStackTrace();
return "error";
}
}
// private String saveFile(MultipartFile file) throws IOException {
//
// String uploadDirectory = environment.getProperty("file.upload.directory");
//
// String folderName = environment.getProperty("education.foldername");
//
// String fileName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) + "_" + file.getOriginalFilename();
//
// String folderPath = uploadDirectory + "/" + folderName;
//
// Path dirPath = Paths.get(folderPath);
// if (!Files.exists(dirPath)) {
// Files.createDirectories(dirPath);
// }
//
// Path filePath = dirPath.resolve(fileName);
//
// Files.write(filePath, file.getBytes());
//
// return filePath.toAbsolutePath().toString();
// }
private String saveFile(MultipartFile file) throws IOException {
String uploadDirectory = environment.getProperty("file.upload.directory");
String folderName = environment.getProperty("education.foldername");
String fileName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) + "_" + file.getOriginalFilename();
String FilePath = "/"+ folderName +"/"+fileName;
// Create the directory path
Path dirPath = Paths.get(uploadDirectory, folderName);
if (!Files.exists(dirPath)) {
Files.createDirectories(dirPath);
}
// Create the full file path
Path filePath = dirPath.resolve(fileName);
// Save the file
Files.write(filePath, file.getBytes());
return FilePath;
// Return the full file path as a string
//return filePath.toString().replace("\\", "/");
}
@Transactional
public ResponseEntity<?> getStudentsClass(String udise, String std) {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT student_id, student_name, emis_no FROM student_info WHERE udise = ? AND std = ? AND is_active=1 AND is_delete=0";
try {
List<Map<String, Object>> data = jdbcTemplate.queryForList(sql, udise, std);
result.put("Message", "Success");
result.put("Data", data);
return ResponseEntity.ok(result);
} catch (Exception e) {
e.printStackTrace();
result.put("Message", "Error");
result.put("Error", "Failed to fetch students in class List: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
}
}
@Transactional
public ResponseEntity<?> getStudentsDetails(String studentId) {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT *, " +
"CONCAT('" + fileBaseUrl + "/gcc/files', father_aadhar_file) AS view_father_aadhar_file, " +
"CONCAT('" + fileBaseUrl + "/gcc/files', mother_aadhar_file) AS view_mother_aadhar_file, " +
"CONCAT('" + fileBaseUrl + "/gcc/files', guardian_aadhar_file) AS view_guardian_aadhar_file, " +
"CONCAT('" + fileBaseUrl + "/gcc/files', student_aadhar_file) AS view_student_aadhar_file " +
" FROM student_info WHERE student_id = ?";
try {
List<Map<String, Object>> data = jdbcTemplate.queryForList(sql, studentId);
result.put("Message", "Success");
result.put("Data", data);
return ResponseEntity.ok(result);
} catch (Exception e) {
e.printStackTrace();
result.put("Message", "Error");
result.put("Error", "Failed to fetch student detail: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
}
}
@Transactional
public ResponseEntity<?> getMedium() {
Map<String, Object> result = new HashMap<>();
String sql = "SELECT * FROM medium_master ORDER BY execution_order ASC";
try {
List<Map<String, Object>> data = jdbcTemplate.queryForList(sql);
result.put("Message", "Success");
result.put("Data", data);
return ResponseEntity.ok(result);
} catch (Exception e) {
e.printStackTrace();
result.put("Message", "Error");
result.put("Error", "Failed to fetch medium List: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
}
}
private String logEntry(String student_id, String user_id, String action_type) {
String sql="INSERT INTO student_info_log (student_id, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file, user_id, action_type) "
+ " SELECT student_id, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file, ?, ? FROM student_info WHERE student_id = ?";
try {
jdbcTemplate.update(sql, user_id, action_type, student_id);
return "sucess";
} catch (DataAccessException e) {
e.printStackTrace();
return "failure";
}
}
@Transactional
public ResponseEntity<?> deleteProcess(String student_id, String user_id, String action_type) {
Map<String, Object> result = new HashMap<>();
String data = logEntry(student_id, user_id, action_type);
String data1 = "";
if(data.equalsIgnoreCase("sucess")) {
data1 = deleteStudent(student_id);
} else {
result.put("Message", "Error");
result.put("Data", "Failed");
return ResponseEntity.ok(result);
}
if(data1.equalsIgnoreCase("sucess")) {
result.put("Message", "Success");
result.put("Data", "Deleted sucessfully");
}else {
result.put("Message", "Error");
result.put("Data", "Failed to Delete");
}
return ResponseEntity.ok(result);
}
private String deleteStudent(String student_id) {
String sql="UPDATE student_info SET is_delete = 1, is_active = 0 WHERE student_id = ? ";
try {
jdbcTemplate.update(sql, student_id);
return "sucess";
} catch (DataAccessException e) {
e.printStackTrace();
return "failure";
}
}
@Transactional
public ResponseEntity<?> updateProcess(String student_id, String user_id, String action_type, String udise,
String student_name, String emis_no, String gender, String mediums, String std, String section, String dob,
String age, String parent_type, String father_name, String mother_name, String guardian_name,
String father_mobile, String mother_mobile, String guardian_mobile, String father_aadhar,
String mother_aadhar, String guardian_aadhar, String student_aadhar, MultipartFile father_aadhar_file,
MultipartFile mother_aadhar_file, MultipartFile guardian_aadhar_file, MultipartFile student_aadhar_file, String raw_father_aadhar, String raw_mother_aadhar, String raw_guardian_aadhar, String raw_student_aadhar) {
Map<String, Object> result = new HashMap<>();
String data = logEntry(student_id, user_id, action_type);
String data1 = "";
if(data.equalsIgnoreCase("sucess")) {
data1 = updateStudent(student_id, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, father_aadhar_file, mother_aadhar_file, guardian_aadhar_file, student_aadhar_file, raw_father_aadhar, raw_mother_aadhar, raw_guardian_aadhar, raw_student_aadhar);
}
else {
result.put("Message", "Error");
result.put("Data", "Failed");
return ResponseEntity.ok(result);
}
if(data1.equalsIgnoreCase("sucess")) {
result.put("Message", "Success");
result.put("Data", "Updated successfully");
}else {
result.put("Message", "Error");
result.put("Data", "Failed to update");
}
return ResponseEntity.ok(result);
}
private String updateStudent(String student_id, String udise, String student_name, String emis_no, String gender,
String mediums, String std, String section, String dob, String age, String parent_type, String father_name,
String mother_name, String guardian_name, String father_mobile, String mother_mobile,
String guardian_mobile, String father_aadhar, String mother_aadhar, String guardian_aadhar,
String student_aadhar, MultipartFile father_aadhar_file, MultipartFile mother_aadhar_file,
MultipartFile guardian_aadhar_file, MultipartFile student_aadhar_file, String raw_father_aadhar, String raw_mother_aadhar, String raw_guardian_aadhar, String raw_student_aadhar) {
String sql = "";
String fatherUrl = null;
String motherUrl = null;
String guardianUrl = null;
String studentUrl = null;
try {
//// for parent
if("Parent".equalsIgnoreCase(parent_type)) {
if(raw_father_aadhar!=null && !raw_father_aadhar.isEmpty() ) {
fatherUrl = raw_father_aadhar;
if(father_aadhar_file!=null && !father_aadhar_file.isEmpty()) {
fatherUrl = saveFile(father_aadhar_file);
}
}
else {
if(father_aadhar_file!=null && !father_aadhar_file.isEmpty()) {
fatherUrl = saveFile(father_aadhar_file);
}
else {
fatherUrl = null;
}
}
if(raw_mother_aadhar!=null && !raw_mother_aadhar.isEmpty() ) {
motherUrl = raw_mother_aadhar;
if(mother_aadhar_file!=null && !mother_aadhar_file.isEmpty()) {
motherUrl = saveFile(mother_aadhar_file);
}
}
else {
if(mother_aadhar_file!=null && !mother_aadhar_file.isEmpty()) {
motherUrl = saveFile(mother_aadhar_file);
}
else {
motherUrl =null;
}
}
}
else {
if (father_aadhar_file != null && !father_aadhar_file.isEmpty()) {
fatherUrl = saveFile(father_aadhar_file);
} else {
//fatherUrl = (raw_father_aadhar != null) ? raw_father_aadhar : null;
fatherUrl = (raw_father_aadhar != null && !raw_father_aadhar.isEmpty()) ? raw_father_aadhar : null;
}
if (mother_aadhar_file != null && !mother_aadhar_file.isEmpty()) {
motherUrl = saveFile(mother_aadhar_file);
} else {
//motherUrl = (raw_mother_aadhar != null) ? raw_mother_aadhar : null;
motherUrl = (raw_mother_aadhar != null && !raw_mother_aadhar.isEmpty()) ? raw_mother_aadhar : null;
}
}
////
guardianUrl = raw_guardian_aadhar;
if(guardian_aadhar_file!=null && !guardian_aadhar_file.isEmpty()) {
guardianUrl = saveFile(guardian_aadhar_file);
}
///
studentUrl = raw_student_aadhar;
if(student_aadhar_file!=null && !student_aadhar_file.isEmpty()) {
studentUrl = saveFile(student_aadhar_file);
}
//father_mobile mother_mobile
if (father_mobile != null && father_mobile.trim().isEmpty()) {
father_mobile = null;
}
if (mother_mobile != null && mother_mobile.trim().isEmpty()) {
mother_mobile = null;
}
// father_aadhar mother_aadhar student_aadhar
if (father_aadhar != null && father_aadhar.trim().isEmpty()) {
father_aadhar = null;
}
if (mother_aadhar != null && mother_aadhar.trim().isEmpty()) {
mother_aadhar = null;
}
if (student_aadhar != null && student_aadhar.trim().isEmpty()) {
student_aadhar = null;
}
////////
if(parent_type.equalsIgnoreCase("Parent")) {
sql="UPDATE student_info SET udise = ?, student_name = ?, emis_no = ?, gender = ?, mediums = ?, std = ?, section = ?, dob = ?, age = ?, parent_type = ?, father_name = ?, mother_name = ?, father_mobile = ?, mother_mobile = ?, father_aadhar = ?, mother_aadhar = ?, student_aadhar = ?, father_aadhar_file = ?, mother_aadhar_file = ?, student_aadhar_file = ? WHERE student_id = ? ";
jdbcTemplate.update(sql, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, mother_name, father_mobile, mother_mobile, father_aadhar, mother_aadhar, student_aadhar, fatherUrl, motherUrl, studentUrl, student_id);
} else if(parent_type.equalsIgnoreCase("SingleParent_Father")) {
sql="UPDATE student_info SET udise = ?, student_name = ?, emis_no = ?, gender = ?, mediums = ?, std = ?, section = ?, dob = ?, age = ?, parent_type = ?, father_name = ?, father_mobile = ?, father_aadhar = ?, student_aadhar = ?, father_aadhar_file = ?, student_aadhar_file = ? WHERE student_id = ? ";
jdbcTemplate.update(sql, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, father_mobile, father_aadhar, student_aadhar, fatherUrl, studentUrl, student_id);
} else if(parent_type.equalsIgnoreCase("SingleParent_Mother")) {
sql="UPDATE student_info SET udise = ?, student_name = ?, emis_no = ?, gender = ?, mediums = ?, std = ?, section = ?, dob = ?, age = ?, parent_type = ?, mother_name = ?, mother_mobile = ?, mother_aadhar = ?, student_aadhar = ?, mother_aadhar_file = ?, student_aadhar_file = ? WHERE student_id = ? ";
jdbcTemplate.update(sql, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, mother_name, mother_mobile, mother_aadhar, student_aadhar, motherUrl, studentUrl, student_id);
} else if(parent_type.equalsIgnoreCase("Guardian")) {
sql="UPDATE student_info SET udise = ?, student_name = ?, emis_no = ?, gender = ?, mediums = ?, std = ?, section = ?, dob = ?, age = ?, parent_type = ?, father_name = ?, mother_name = ?, guardian_name = ?, father_mobile = ?, mother_mobile = ?, guardian_mobile = ?, father_aadhar = ?, mother_aadhar = ?, guardian_aadhar = ?, student_aadhar = ?, father_aadhar_file = ?, mother_aadhar_file = ?, guardian_aadhar_file = ?, student_aadhar_file = ? WHERE student_id = ? ";
jdbcTemplate.update(sql, udise, student_name, emis_no, gender, mediums, std, section, dob, age, parent_type, father_name, mother_name, guardian_name, father_mobile, mother_mobile, guardian_mobile, father_aadhar, mother_aadhar, guardian_aadhar, student_aadhar, fatherUrl, motherUrl, guardianUrl, studentUrl, student_id);
}
return "sucess";
}catch (Exception e) {
e.printStackTrace();
return "failure";
}
}
@Transactional
public ResponseEntity<?> checkStudent(String udise, String schoolId) {
Map<String, Object> result = new HashMap<>();
try {
String stu_strength = studentStrength(schoolId);
String aadhar_strength = aadharStrength(udise);
if (!stu_strength.equalsIgnoreCase("error") && !aadhar_strength.equalsIgnoreCase("error")) {
int allowable_strength = Integer.parseInt(stu_strength) - Integer.parseInt(aadhar_strength);
result.put("Student_Strength", Integer.parseInt(stu_strength));
result.put("Aadhar_strength", Integer.parseInt(aadhar_strength));
result.put("Allowable_strength", allowable_strength);
result.put("Message", "Sucessfully student count fetched");
result.put("Status", "Sucess");
} else if (stu_strength.equalsIgnoreCase("error") || aadhar_strength.equalsIgnoreCase("error")) {
result.put("Status", "Error");
result.put("Message", "Error in fetching students count");
}
} catch (Exception e) {
e.printStackTrace();
result.put("Status", "Error");
result.put("Message", "Error in fetching students count");
}
return ResponseEntity.ok(result);
}
private String aadharStrength(String udise) {
String sql = "SELECT count(*) FROM student_info WHERE udise = ? AND is_active = 1 AND is_delete = 0";
String strength = "0";
try {
String result = jdbcTemplate.queryForObject(sql, String.class, udise);
if (result != null && !result.isEmpty()) {
strength = result;
}
}
catch (Exception e) {
System.out.println("Error fetching student strength: " + e.getMessage());
strength = "error";
}
return strength;
}
private String studentStrength(String schoolId) {
String sql = "SELECT total_students FROM student_strength WHERE school_id = ?";
String strength = "0";
try {
String result = jdbcTemplate.queryForObject(sql, String.class, schoolId);
if (result != null && !result.isEmpty()) {
strength = result;
}
}
catch (Exception e) {
System.out.println("Error fetching student strength: " + e.getMessage());
strength = "error";
}
return strength;
}
}

480
src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java

@ -0,0 +1,480 @@
package in.gov.chennaicorporation.gccoffice.vendor.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpMethod;
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 org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
import in.gov.chennaicorporation.gccoffice.vendor.service.StreetVendorService;
import in.gov.chennaicorporation.gccoffice.vendor.service.createventService;
@RestController("streetvendorApiController")
@RequestMapping("/gcc/api/streetvendor")
public class ApiController {
private final RestTemplate restTemplate;
private final AppConfig appConfig;
@Autowired
private StreetVendorService streetVendorService;
@Autowired
public createventService createventservice;
@Autowired
public ApiController(RestTemplate restTemplate, AppConfig appConfig) {
this.restTemplate = restTemplate;
this.appConfig = appConfig;
}
@Autowired
private Environment environment;
@GetMapping("/vendorCommiteeList")
public String getVendorCommiteeDetails(){
String apiUrl = appConfig.mobileservice + "/gccofficialapp/api/streetvendor/vendingCommiteeList";
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class);
return responseEntity.getBody();
}
// @GetMapping("/vendorCommiteeListbyID")
// public String getVendorCommiteeDetailsByID(@RequestParam("id") Long id) {
// String apiUrl = appConfig.mobileservice + "/gccofficialapp/api/streetvendor/vendingCommiteeListbyId?id=" + id;
// ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class);
// return responseEntity.getBody();
// }
@GetMapping("/vendorCommiteeListbyID")
public ResponseEntity<List<Map<String, Object>>> getVendorCommiteeDetailsByID(@RequestParam("id") Long id) {
String apiUrl = appConfig.mobileservice + "/gccofficialapp/api/streetvendor/vendingCommiteeListbyId?id=" + id;
ResponseEntity<List> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.GET, null, List.class);
//System.out.println("responseEntity...."+responseEntity);
return ResponseEntity.ok(responseEntity.getBody());
}
@GetMapping("/vendingCommiteeList")
public ResponseEntity<List<Map<String, Object>>> getVendingCommiteeList(@RequestParam("date") String date) {
String apiUrl = appConfig.mobileservice + "/gccofficialapp/api/streetvendor/vendingCommiteeList?date=" + date;
ResponseEntity<List> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.GET, null, List.class);
List<String> saved_request_no=createventservice.removeSavedVendorDetails();
//System.out.println("saved_request_no="+saved_request_no);
// Filter out matching vendor_req_id entries
List<Map<String, Object>> originalList = responseEntity.getBody();
List<Map<String,Object>> filteredList = originalList.stream().filter(item -> !saved_request_no.contains(String.valueOf(item.get("vendor_req_id"))))
.collect(Collectors.toList());
return ResponseEntity.ok(filteredList);
}
@GetMapping("/vendorDetailsByReqId")
public ResponseEntity<List<Map<String, Object>>> getVendorDetailsByReqId(@RequestParam("requestId") String requestId) {
String apiUrl = appConfig.mobileservice + "/gccofficialapp/api/streetvendor/vendorDetailsByReqId?requestId=" + requestId;
ResponseEntity<List> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.GET, null, List.class);
return ResponseEntity.ok(responseEntity.getBody());
}
@PostMapping("/savedetailsforvendor")
public ResponseEntity<Map<String, Object>> savedetailsforvendor(@RequestBody Map<String, Object> payload)
{
return createventservice.saveVendorDetails(payload);
}
@GetMapping("/vendingCommiteeDetails")
public List<Map<String, Object>> getvendingCommiteeDetails(@RequestParam("event_req_id") String event_req_id) {
return createventservice.getCommiteeDetails(event_req_id);
}
@GetMapping("/vendingDetailsWeb")
public List<Map<String, Object>> getvendingDetailsWeb(@RequestParam String cby) {
return streetVendorService.getCommiteeDetailsWeb(cby);
}
@GetMapping("/webVendorDetailsByReqId")
public List<Map<String, Object>> getwebVendorDetailsByReqId(@RequestParam("requestId") String requestId) {
return streetVendorService.getwebVendorDetailsByReqId(requestId);
}
// sanjay
// @GetMapping("/wards-by-zone")
//
// public List<Map<String, Object>> getWardsByZone(@RequestParam("zoneId") int zoneId) {
// return streetVendorService.fetchWardsByZone(zoneId);
// }
// @PostMapping("/saveDetails")
// public ResponseEntity<Map<String, Object>> saveVenderDetails(
//
// @RequestParam String latitude,
// @RequestParam String longitude,
// @RequestParam String zone,
// @RequestParam String ward,
// @RequestParam String landmark,
// @RequestParam String vending_district,
// @RequestParam int vending_pincode,
// @RequestParam int vending_category,
// @RequestParam String vending_space,
// @RequestParam boolean pm_svanidhi_loan,
// @RequestParam boolean bank_acc_status,
// @RequestParam (required = false, name = "bank_passbook" )MultipartFile bank_passbook,
// @RequestParam MultipartFile street_vendor_photo,
// @RequestParam String name,
// @RequestParam String f_h_name,
// @RequestParam String mobile_number,
// @RequestParam String dob,
// @RequestParam String gender,
// @RequestParam int social_category,
// @RequestParam boolean diff_abled,
// @RequestParam int education_status,
// @RequestParam int marital_status,
// @RequestParam int no_of_fam_mem,
// @RequestParam boolean are_any_fam_mem_invol_str,
//// @RequestParam String vending_address,
//
// @RequestParam String door_no,
// @RequestParam String streetname,
// @RequestParam String areaname,
// @RequestParam String present_district,
// @RequestParam int present_pincode,
// @RequestParam MultipartFile ration_card_photo,
// @RequestParam MultipartFile aadhar_front_photo,
// @RequestParam MultipartFile aadhar_back_photo,
// @RequestParam String aadharNo) {
//
// String presentAddress = door_no + ", " + streetname + ", " + areaname;
//
// System.out.println("bank_passbook...."+bank_passbook);
// System.out.println("ration_card_photo...."+ration_card_photo);
// System.out.println("street_vendor_photo...."+street_vendor_photo);
// System.out.println("aadhar_front_photo...."+aadhar_front_photo);
// System.out.println("aadhar_back_photo...."+aadhar_back_photo);
//
// String bankPassbookPath = "";
//
// // Only upload passbook if status is true
// if (bank_acc_status) {
// if (bank_passbook != null && !bank_passbook.isEmpty()) {
// bankPassbookPath = streetVendorService.fileUpload (bank_passbook, "bank_passbook");
// } else {
// return ResponseEntity.badRequest().body(Map.of(
// "status", false,
// "description", "Bank passbook is required when account status is Yes"
// ));
// }
// }
// String rationCardPath = streetVendorService.fileUpload(ration_card_photo, "ration_card");
// String streetVendorPhotoPath = streetVendorService.fileUpload(street_vendor_photo, "vendor_photo");
// String aadharFrontPhotoPath = streetVendorService.fileUpload(aadhar_front_photo, "aadhar_front");
// String aadharBackPhotoPath = streetVendorService.fileUpload(aadhar_back_photo, "aadhar_back");
//
// String saveStatus = streetVendorService.saveStreetVendorDetails(
// latitude, longitude,zone, ward, landmark, vending_district, vending_pincode, vending_category, vending_space,
// pm_svanidhi_loan, bank_acc_status, bankPassbookPath,
// streetVendorPhotoPath, name, f_h_name, mobile_number,dob,
// gender, social_category, diff_abled, education_status, marital_status,
// no_of_fam_mem, are_any_fam_mem_invol_str,presentAddress, present_district, present_pincode,
// rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo);
//
// if (saveStatus == null || saveStatus.equals("error")) {
// return ResponseEntity.ok(Map.of(
// "status", false,
// "message", "failed",
// "description", "Failed to save the details"
// ));
// }
//
// return ResponseEntity.ok(Map.of(
// "status", true,
// "message", "success",
// "description", "Details saved successfully",
// "vendor_req_id", saveStatus
// ));
// }
@PostMapping("/saveDetails")
public ResponseEntity<Map<String, Object>> saveVenderDetails(
@RequestParam (required = false)String latitude,
@RequestParam (required = false)String longitude,
@RequestParam (required = false)String zone,
@RequestParam (required = false)String ward,
@RequestParam (required = false)String landmark,
@RequestParam (required = false)String vending_district,
@RequestParam (required = false)Integer vending_pincode,
@RequestParam Integer vending_category,
@RequestParam (required = false)String vending_space,
@RequestParam (required = false) Boolean pm_svanidhi_loan,
@RequestParam (required = false) Boolean bank_acc_status,
@RequestParam (required = false, name = "bank_passbook" )MultipartFile bank_passbook,
@RequestParam (required = false) MultipartFile street_vendor_photo,
@RequestParam String name,
@RequestParam (required = false)String f_h_name,
@RequestParam String mobile_number,
@RequestParam (required = false)String dob,
@RequestParam (required = false)String gender,
@RequestParam (required = false)Integer social_category,
@RequestParam (required = false)Boolean diff_abled,
@RequestParam (required = false)Integer education_status,
@RequestParam (required = false)Integer marital_status,
@RequestParam (required = false)Integer no_of_fam_mem,
@RequestParam (required = false)Boolean are_any_fam_mem_invol_str,
@RequestParam (required = false)String door_no,
@RequestParam (required = false)String streetname,
@RequestParam (required = false)String areaname,
@RequestParam (required = false)String present_district,
@RequestParam (required = false)Integer present_pincode,
@RequestParam (required = false)MultipartFile ration_card_photo,
@RequestParam (required = false)MultipartFile aadhar_front_photo,
@RequestParam (required = false)MultipartFile aadhar_back_photo,
@RequestParam (required = false)String aadharNo,
@RequestParam String userId) {
//String presentAddress = door_no + ", " + streetname + ", " + areaname;
String doorNoVal = (door_no != null && !door_no.trim().isEmpty()) ? door_no : "";
String streetNameVal = (streetname != null && !streetname.trim().isEmpty()) ? streetname : "";
String areaNameVal = (areaname != null && !areaname.trim().isEmpty()) ? areaname : "";
String presentAddress = String.join(", ", doorNoVal, streetNameVal, areaNameVal);
String bankPassbookPath = null;
// Only upload passbook if status is true
if (Boolean.TRUE.equals(bank_acc_status)) {
if (bank_passbook != null && !bank_passbook.isEmpty()) {
bankPassbookPath = streetVendorService.fileUpload (bank_passbook, "street_vendor_bank");
} else {
return ResponseEntity.badRequest().body(Map.of(
"status", false,
"description", "Bank passbook is required when account status is Yes"
));
}
}
String rationCardPath=null;
String streetVendorPhotoPath=null;
String aadharFrontPhotoPath=null;
String aadharBackPhotoPath=null;
if(ration_card_photo != null && !ration_card_photo.isEmpty())
{
rationCardPath = streetVendorService.fileUpload(ration_card_photo, "street_vendor_ration");
}
if (street_vendor_photo != null && !street_vendor_photo.isEmpty())
{
streetVendorPhotoPath = streetVendorService.fileUpload(street_vendor_photo, "street_vendor_photo");
}
if (aadhar_front_photo != null && !aadhar_front_photo.isEmpty())
{
aadharFrontPhotoPath = streetVendorService.fileUpload(aadhar_front_photo, "aadhar_front");
}
if (aadhar_back_photo != null && !aadhar_back_photo.isEmpty())
{
aadharBackPhotoPath = streetVendorService.fileUpload(aadhar_back_photo, "aadhar_back");
}
String saveStatus = streetVendorService.saveStreetVendorDetails(
latitude, longitude,zone, ward, landmark, vending_district, vending_pincode, vending_category, vending_space,
pm_svanidhi_loan, bank_acc_status, bankPassbookPath,
streetVendorPhotoPath, name, f_h_name, mobile_number,dob,
gender, social_category, diff_abled, education_status, marital_status,
no_of_fam_mem, are_any_fam_mem_invol_str,presentAddress, present_district, present_pincode,
rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,userId);
if (saveStatus == null || saveStatus.equals("error")) {
return ResponseEntity.ok(Map.of(
"status", false,
"message", "failed",
"description", "Failed to save the details"
));
}
return ResponseEntity.ok(Map.of(
"status", true,
"message", "success",
"description", "Details saved successfully",
"vendor_req_id", saveStatus
));
}
// check mobile number registered
@GetMapping("/check-mobile")
public ResponseEntity<Boolean> checkMobileNumber(@RequestParam String mobilenumber) {
boolean exists = streetVendorService.isMobileRegistered(mobilenumber);
return ResponseEntity.ok(exists);
}
@PostMapping("/updateDetails")
public ResponseEntity<Map<String, Object>> updateVenderDetails(
@RequestParam (required = false)String latitude,
@RequestParam (required = false)String longitude,
@RequestParam (required = false)String zone,
@RequestParam (required = false)String ward,
@RequestParam (required = false)String landmark,
@RequestParam (required = false)String vending_district,
@RequestParam (required = false)Integer vending_pincode,
@RequestParam Integer vending_category,
@RequestParam (required = false)String vending_space,
@RequestParam (required = false) Boolean pm_svanidhi_loan,
@RequestParam (required = false) Boolean bank_acc_status,
@RequestParam (required = false, name = "bank_passbook" )MultipartFile bank_passbook,
@RequestParam (required = false) MultipartFile street_vendor_photo,
@RequestParam String name,
@RequestParam (required = false)String f_h_name,
@RequestParam String mobile_number,
@RequestParam (required = false)String dob,
@RequestParam (required = false)String gender,
@RequestParam (required = false)Integer social_category,
@RequestParam (required = false)Boolean diff_abled,
@RequestParam (required = false)Integer education_status,
@RequestParam (required = false)Integer marital_status,
@RequestParam (required = false)Integer no_of_fam_mem,
@RequestParam (required = false)Boolean are_any_fam_mem_invol_str,
@RequestParam (required = false)String door_no,
@RequestParam (required = false)String streetname,
@RequestParam (required = false)String areaname,
@RequestParam (required = false)String present_district,
@RequestParam (required = false)Integer present_pincode,
@RequestParam (required = false)MultipartFile ration_card_photo,
@RequestParam (required = false)MultipartFile aadhar_front_photo,
@RequestParam (required = false)MultipartFile aadhar_back_photo,
@RequestParam (required = false)String aadharNo,
@RequestParam (required = false)String raw_bank_passbook,
@RequestParam (required = false)String raw_street_vendor_photo,
@RequestParam (required = false)String raw_aadhar_front_photo,
@RequestParam (required = false)String raw_aadhar_back_photo,
@RequestParam (required = false)String raw_ration_card_photo,
@RequestParam String userId,
@RequestParam String vendor_req_id){
String data = streetVendorService.logEntry(userId, vendor_req_id);
if(data.equalsIgnoreCase("success")) {
String bankPassbookPath = null;
String rationCardPath=null;
String streetVendorPhotoPath=null;
String aadharFrontPhotoPath=null;
String aadharBackPhotoPath=null;
System.out.println("raw_bank_passbook="+raw_bank_passbook);
System.out.println("raw_street_vendor_photo="+raw_street_vendor_photo);
System.out.println("raw_aadhar_front_photo="+raw_aadhar_front_photo);
System.out.println("raw_aadhar_back_photo="+raw_aadhar_back_photo);
System.out.println("raw_ration_card_photo="+raw_ration_card_photo);
bankPassbookPath=raw_bank_passbook;
if(bank_passbook!=null && !bank_passbook.isEmpty()) {
bankPassbookPath = streetVendorService.fileUpload (bank_passbook, "street_vendor_bank");
}
rationCardPath=raw_ration_card_photo;
if(ration_card_photo!=null && !ration_card_photo.isEmpty()) {
rationCardPath = streetVendorService.fileUpload (ration_card_photo, "street_vendor_ration");
}
streetVendorPhotoPath=raw_street_vendor_photo;
if(street_vendor_photo!=null && !street_vendor_photo.isEmpty()) {
streetVendorPhotoPath = streetVendorService.fileUpload (street_vendor_photo, "street_vendor_photo");
}
aadharFrontPhotoPath=raw_aadhar_front_photo;
if(aadhar_front_photo!=null && !aadhar_front_photo.isEmpty()) {
aadharFrontPhotoPath = streetVendorService.fileUpload (aadhar_front_photo, "aadhar_front");
}
aadharBackPhotoPath=raw_aadhar_back_photo;
if(aadhar_back_photo!=null && !aadhar_back_photo.isEmpty()) {
aadharBackPhotoPath = streetVendorService.fileUpload (aadhar_back_photo, "aadhar_back");
}
String doorNoVal = (door_no != null && !door_no.trim().isEmpty()) ? door_no : "";
String streetNameVal = (streetname != null && !streetname.trim().isEmpty()) ? streetname : "";
String areaNameVal = (areaname != null && !areaname.trim().isEmpty()) ? areaname : "";
String presentAddress = String.join(", ", doorNoVal, streetNameVal, areaNameVal);
String sts=streetVendorService.updateStreetVendorDetailsWeb(
latitude, longitude,zone, ward, landmark, vending_district, vending_pincode, vending_category, vending_space,
pm_svanidhi_loan, bank_acc_status, bankPassbookPath,
streetVendorPhotoPath, name, f_h_name, mobile_number,dob,
gender, social_category, diff_abled, education_status, marital_status,
no_of_fam_mem, are_any_fam_mem_invol_str,presentAddress, present_district, present_pincode,
rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,userId,vendor_req_id);
if(sts.equals("Error")) {
return ResponseEntity.ok(Map.of(
"status", false,
"message", "failed",
"description", "Failed to update the details"
));
}
return ResponseEntity.ok(Map.of(
"status", true,
"message", "success",
"description", "Details Updated successfully"
));
}
else {
return ResponseEntity.ok(Map.of(
"status", false,
"message", "failed",
"description", "Issues in log entry,So failed to update"
));
}
}
}

126
src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/CreateEventAPIController.java

@ -0,0 +1,126 @@
package in.gov.chennaicorporation.gccoffice.vendor.controller;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
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.RestController;
import org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.vendor.service.createventService;
@RequestMapping("/gcc/api/vending")
@RestController
public class CreateEventAPIController {
@Autowired
private createventService createventservices;
@Autowired
private Environment environment;
@PostMapping("/save")
public ResponseEntity<String> saveEventWithFile(
@RequestParam("eventName") String eventName,
@RequestParam("eventDate") String eventDateStr,
@RequestParam("file") MultipartFile file) {
try {
if (eventName == null || eventDateStr == null || file.isEmpty()) {
throw new IllegalArgumentException("Event Name, Date, and File must not be empty.");
}
// Debug logs
System.out.println("Event Name: " + eventName);
System.out.println("Event Date: " + eventDateStr);
System.out.println("Original File Name: " + file.getOriginalFilename());
String originalfilename = file.getOriginalFilename();
boolean existfileurl = createventservices.isFileExists(originalfilename);
String fileUrl = saveFile(file);
// Save to DB
LocalDate eventDate = LocalDate.parse(eventDateStr);
createventservices.insertEvent(eventName, eventDate, fileUrl);
return ResponseEntity.ok("Event saved successfully.");
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body("Validation Error: " + e.getMessage());
} catch (Exception e) {
return ResponseEntity.status(500).body("Internal Server Error: " + e.getMessage());
}
}
//save file and get path
private String saveFile(MultipartFile file) throws IOException {
String uploadDirectory = environment.getProperty("file.upload.directory");
String folderName = environment.getProperty("vending.foldername");
String fileName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) + "_" + file.getOriginalFilename();
String folderPath = uploadDirectory + "/" + folderName + "/";
Path dirPath = Paths.get(folderPath);
if (!Files.exists(dirPath)) {
Files.createDirectories(dirPath);
}
Path filePath = dirPath.resolve(fileName);
Files.write(filePath, file.getBytes());
return filePath.toAbsolutePath().toString();
}
@GetMapping("/dropdown-Event")
public ResponseEntity<List<Map<String, Object>>> ViewDropdownEvent() {
try {
List<Map<String, Object>> result = createventservices.ViewDropdownEvent();
return ResponseEntity.ok(result);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("error", "Unable to fetch event list");
error.put("details", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Collections.singletonList(error));
}
}
@GetMapping("/committedropdown")
public ResponseEntity<List<Map<String, Object>>> ViewCommitteeDropdownEvent() {
try {
List<Map<String, Object>> result = createventservices.ViewCommitteeDropdownEvent();
System.out.println("result="+result);
return ResponseEntity.ok(result);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("error", "Unable to fetch event list");
error.put("details", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Collections.singletonList(error));
}
}
}

147
src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java

@ -0,0 +1,147 @@
package in.gov.chennaicorporation.gccoffice.vendor.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.client.RestTemplate;
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
import in.gov.chennaicorporation.gccoffice.vendor.service.StreetVendorService;
@RequestMapping("/gcc/vendor")
@Controller("vendorMainController")
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;
}
@Autowired
private StreetVendorService streetVendorService;
@GetMapping("/addevent")
public String viewAddEvent(Model model)
{
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
String UserRole = LoginUserInfo.getUserRole();
model.addAttribute("UserRole", UserRole);
return "modules/vendors/addevent";
}
@GetMapping("/requestlist")
public String viewRequestList(Model model)
{
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
String UserRole = LoginUserInfo.getUserRole();
model.addAttribute("UserRole", UserRole);
return "modules/vendors/RequestList";
}
@GetMapping("/eventlist")
public String viewEventList(Model model)
{
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
String UserRole = LoginUserInfo.getUserRole();
model.addAttribute("UserRole", UserRole);
return "modules/vendors/EventList";
}
@GetMapping("/streetvendorform")
public String streetvendorform(Model model)
{
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
String UserRole = LoginUserInfo.getUserRole();
model.addAttribute("UserRole", UserRole);
List<Map<String, Object>>communities=streetVendorService.fetchCommunities();
//System.out.println("communities===="+communities);
model.addAttribute("communities", communities);
List<Map<String, Object>>maritalStatuses=streetVendorService.fetchMaritalStatus();
//System.out.println("maritalStatuses===="+maritalStatuses);
model.addAttribute("maritalStatuses", maritalStatuses);
List<Map<String, Object>>educationList=streetVendorService.fetchEducationStatus();
//System.out.println("educationList===="+educationList);
model.addAttribute("educationList", educationList);
List<Map<String, Object>>vendingCategories=streetVendorService.fetchvendingCategory();
//System.out.println("vendingCategory===="+vendingCategories);
model.addAttribute("vendingCategories", vendingCategories);
//List<Map<String, Object>>zones=streetVendorService.fetchZones();
//System.out.println("zones===="+zones);
//model.addAttribute("zones", zones);
return "modules/vendors/streetVendorRequestForm";
}
@GetMapping("/streetvendorlist")
public String viewVendorRequestList(Model model)
{
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
String UserRole = LoginUserInfo.getUserRole();
model.addAttribute("UserRole", UserRole);
List<Map<String, Object>>communities=streetVendorService.fetchCommunities();
model.addAttribute("communities", communities);
List<Map<String, Object>>maritalStatuses=streetVendorService.fetchMaritalStatus();
model.addAttribute("maritalStatuses", maritalStatuses);
List<Map<String, Object>>educationList=streetVendorService.fetchEducationStatus();
model.addAttribute("educationList", educationList);
List<Map<String, Object>>vendingCategories=streetVendorService.fetchvendingCategory();
model.addAttribute("vendingCategories", vendingCategories);
return "modules/vendors/streetVendorRequestList";
}
}

37
src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/DateTimeUtil.java

@ -0,0 +1,37 @@
package in.gov.chennaicorporation.gccoffice.vendor.service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.springframework.stereotype.Component;
@Component("vendorDateTimeUtil") // For vendo
public final class DateTimeUtil {
public static String getCurrentDateTime() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ddMMyyyyHHmmss");
LocalDateTime now = LocalDateTime.now();
return now.format(formatter);
}
public static String getCurrentYear() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy");
LocalDateTime now = LocalDateTime.now();
return now.format(formatter);
}
public static String getCurrentMonth() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM");
LocalDateTime now = LocalDateTime.now();
return now.format(formatter);
}
public static String getCurrentDay() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd");
LocalDateTime now = LocalDateTime.now();
return now.format(formatter);
}
public static String getCurrentDateTimeMysql() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
return now.format(formatter);
}
}

484
src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java

@ -0,0 +1,484 @@
package in.gov.chennaicorporation.gccoffice.vendor.service;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;
import java.sql.PreparedStatement;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.dao.DataAccessException;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class StreetVendorService {
@Autowired
@Qualifier("vendorDateTimeUtil")
private DateTimeUtil dateTimeUtil;
private final Environment environment;
private String fileBaseUrl;
private JdbcTemplate jdbcTemplate;
@Autowired
public void setDataSource(@Qualifier("mysqlGccStreetVendorDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static final int STRING_LENGTH = 15;
private static final Random RANDOM = new SecureRandom();
public StreetVendorService(Environment environment) {
this.environment = environment;
this.fileBaseUrl = environment.getProperty("fileBaseUrl");
}
public List<Map<String, Object>> fetchCommunities() {
String query = "SELECT id,category_name " +
"FROM social_category_master " +
"WHERE is_active=1 AND is_delete=0 ";
return jdbcTemplate.queryForList(query);
}
public List<Map<String, Object>> fetchMaritalStatus() {
String query = "SELECT id,marital_status " +
"FROM marital_status_master " +
"WHERE is_active=1 AND is_delete=0 ";
return jdbcTemplate.queryForList(query);
}
public List<Map<String, Object>> fetchEducationStatus() {
String query = "SELECT id,education " +
"FROM education_master " +
"WHERE is_active=1 AND is_delete=0 ";
return jdbcTemplate.queryForList(query);
}
public List<Map<String, Object>> fetchvendingCategory() {
String query = "SELECT id,vending_category_name " +
"FROM vending_category_master " +
"WHERE is_active=1 AND is_delete=0 ";
return jdbcTemplate.queryForList(query);
}
// public List<Map<String, Object>> fetchZones() {
// String query = "SELECT id,zone_name " +
// "FROM zone_master " +
// "WHERE is_active=1 AND is_delete=0 ";
//
//
// return jdbcTemplate.queryForList(query);
// }
// public List<Map<String, Object>> fetchWardsByZone(int zoneId) {
// String sql = "SELECT id, ward_name FROM ward_master WHERE zone_id = ? ";
// return jdbcTemplate.queryForList(sql, zoneId);
// }
// public String saveStreetVendorDetails(String latitude,String longitude,String zone, String ward, String landmark, String vending_district,
// int vending_pincode, int vending_category, String vending_space, boolean pm_svanidhi_loan,
// boolean bank_acc_status, String bankPassbookPath, String streetVendorPhotoPath, String name,
// String f_h_name, String mobile_number, String dob, String gender, int social_category, boolean diff_abled,
// int education_status, int marital_status, int no_of_fam_mem, boolean are_any_fam_mem_invol_str,
// String presentAddress, String present_district, int present_pincode, String rationCardPath,
// String aadharFrontPhotoPath, String aadharBackPhotoPath,String aadharNo) {
//
//
//
// String sql = "INSERT INTO vendor_details ("
// + "latitude,longitude,zone, ward, vending_address,vending_district, vending_pincode, vending_category, vending_space, pm_svanidhi_loan, "
// + "bank_acc_status, bank_passbook, street_vendor_photo, name, f_h_name, mob_no, "
// + "dob,gender,social_category, diff_abled, education_status, marital_status,no_of_fam_mem, "
// + "are_any_fam_mem_invol_str_ven,present_address, present_district, present_pincode, ration_card_photo, aadhar_front_photo, "
// + "aadhar_back_photo,aadhar_no"
// + ") VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)";
//
// KeyHolder keyHolder = new GeneratedKeyHolder();
//
// try {
// int result = jdbcTemplate.update(connection -> {
// PreparedStatement ps = connection.prepareStatement(sql, new String[] { "id" });
// ps.setString(1, latitude);
// ps.setString(2, longitude);
// ps.setString(3, zone);
// ps.setString(4, ward);
// ps.setString(5, landmark);
// ps.setString(6, vending_district);
// ps.setInt(7, vending_pincode);
// ps.setInt(8, vending_category);
// ps.setString(9, vending_space);
// ps.setBoolean(10, pm_svanidhi_loan);
// ps.setBoolean(11, bank_acc_status);
// ps.setString(12, bankPassbookPath);
// ps.setString(13, streetVendorPhotoPath);
// ps.setString(14, name);
// ps.setString(15, f_h_name);
// ps.setString(16, mobile_number);
// ps.setString(17, dob);
// ps.setString(18, gender);
// ps.setInt(19, social_category);
// ps.setBoolean(20, diff_abled);
// ps.setInt(21, education_status);
// ps.setInt(22, marital_status);
// ps.setInt(23, no_of_fam_mem);
// ps.setBoolean(24, are_any_fam_mem_invol_str);
// ps.setString(25, presentAddress);
// ps.setString(26, present_district);
// ps.setInt(27, present_pincode);
// ps.setString(28, rationCardPath);
// ps.setString(29, aadharFrontPhotoPath);
// ps.setString(30, aadharBackPhotoPath);
// ps.setString(31, aadharNo);
// return ps;
// }, keyHolder);
// //return keyHolder.getKey().intValue();
// if (result > 0) {
// int generatedId = keyHolder.getKey().intValue();
// String prefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
// String refId = prefix + generatedId;
//
// String updateSql = " UPDATE vendor_details SET vendor_req_id = ? WHERE id = ? ";
// jdbcTemplate.update(updateSql,refId, generatedId);
// return refId;
// }
// //return "error";
// } catch (Exception e) {
// e.printStackTrace();
// }
// return "error";
// }
public String saveStreetVendorDetails(String latitude,String longitude,String zone, String ward, String landmark, String vending_district,
Integer vending_pincode, Integer vending_category, String vending_space, Boolean pm_svanidhi_loan,
Boolean bank_acc_status, String bankPassbookPath, String streetVendorPhotoPath, String name,
String f_h_name, String mobile_number, String dob, String gender, Integer social_category, Boolean diff_abled,
Integer education_status, Integer marital_status, Integer no_of_fam_mem, Boolean are_any_fam_mem_invol_str,
String presentAddress, String present_district, Integer present_pincode, String rationCardPath,
String aadharFrontPhotoPath, String aadharBackPhotoPath,String aadharNo,String userId) {
int isWeb=1;
String latitudeVal = (latitude != null && !latitude.trim().isEmpty()) ? latitude : null;
String longitudeVal = (longitude != null && !longitude.trim().isEmpty()) ? longitude : null;
String zoneVal = (zone != null && !zone.trim().isEmpty()) ? zone : null;
String wardVal = (ward != null && !ward.trim().isEmpty()) ? ward : null;
String dobVal = (dob != null && !dob.trim().isEmpty()) ? dob : null;
String vendingAddressVal = (landmark != null && !landmark.trim().isEmpty()) ? landmark : null;
String sql = "INSERT INTO vendor_details ("
+ "latitude,longitude,zone, ward, vending_address,vending_district, vending_pincode, vending_category, vending_space, pm_svanidhi_loan, "
+ "bank_acc_status, bank_passbook, street_vendor_photo, name, f_h_name, mob_no, "
+ "dob,gender,social_category, diff_abled, education_status, marital_status,no_of_fam_mem, "
+ "are_any_fam_mem_invol_str_ven,present_address, present_district, present_pincode, ration_card_photo, aadhar_front_photo, "
+ "aadhar_back_photo,aadhar_no,is_web,cby"
+ ") VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int result = jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sql, new String[] { "id" });
ps.setString(1, latitudeVal);
ps.setString(2, longitudeVal);
ps.setString(3, zoneVal);
ps.setString(4, wardVal);
ps.setString(5, vendingAddressVal);
ps.setString(6, vending_district);
if (vending_pincode != null) ps.setInt(7, vending_pincode);
else ps.setNull(7, java.sql.Types.INTEGER);
if (vending_category != null) ps.setInt(8, vending_category);
else ps.setNull(8, java.sql.Types.INTEGER);
ps.setString(9, vending_space);
if (pm_svanidhi_loan != null) ps.setBoolean(10, pm_svanidhi_loan);
else ps.setNull(10, java.sql.Types.BOOLEAN);
if (bank_acc_status != null) ps.setBoolean(11, bank_acc_status);
else ps.setNull(11, java.sql.Types.BOOLEAN);
ps.setString(12, bankPassbookPath);
ps.setString(13, streetVendorPhotoPath);
ps.setString(14, name);
ps.setString(15, f_h_name);
ps.setString(16, mobile_number);
ps.setString(17, dobVal);
ps.setString(18, gender);
if (social_category != null) ps.setInt(19, social_category);
else ps.setNull(19, java.sql.Types.INTEGER);
if (diff_abled != null) ps.setBoolean(20, diff_abled);
else ps.setNull(20, java.sql.Types.BOOLEAN);
if (education_status != null) ps.setInt(21, education_status);
else ps.setNull(21, java.sql.Types.INTEGER);
if (marital_status != null) ps.setInt(22, marital_status);
else ps.setNull(22, java.sql.Types.INTEGER);
if (no_of_fam_mem != null) ps.setInt(23, no_of_fam_mem);
else ps.setNull(23, java.sql.Types.INTEGER);
if (are_any_fam_mem_invol_str != null) ps.setBoolean(24, are_any_fam_mem_invol_str);
else ps.setNull(24, java.sql.Types.BOOLEAN);
ps.setString(25, presentAddress);
ps.setString(26, present_district);
if (present_pincode != null) ps.setInt(27, present_pincode);
else ps.setNull(27, java.sql.Types.INTEGER);
ps.setString(28, rationCardPath);
ps.setString(29, aadharFrontPhotoPath);
ps.setString(30, aadharBackPhotoPath);
ps.setString(31, aadharNo);
ps.setInt(32, isWeb);
ps.setString(33, userId);
return ps;
}, keyHolder);
//return keyHolder.getKey().intValue();
if (result > 0) {
int generatedId = keyHolder.getKey().intValue();
String prefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String refId = prefix + generatedId;
String updateSql = " UPDATE vendor_details SET vendor_req_id = ? WHERE id = ? ";
jdbcTemplate.update(updateSql,refId, generatedId);
return refId;
}
//return "error";
} catch (Exception e) {
e.printStackTrace();
}
return "error";
}
public String fileUpload(MultipartFile file, String name) {
// Set the file path where you want to save it
String uploadDirectory = environment.getProperty("file.upload.directory.mobile");
String serviceFolderName = environment.getProperty("street_vendor_foldername");
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
uploadDirectory = uploadDirectory + serviceFolderName + "/" + year + "/" + month;
try {
// Create directory if it doesn't exist
Path directoryPath = Paths.get(uploadDirectory);
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
// Datetime string
String datetimetxt = DateTimeUtil.getCurrentDateTime();
// File name
String fileName = name + "_" + datetimetxt + "_" + file.getOriginalFilename();
fileName = fileName.replaceAll("\\s+", ""); // Remove space on filename
String filePath = uploadDirectory + "/" + fileName;
String filepath_txt = "/" + serviceFolderName + "/" + year + "/" + month + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
// Get the bytes of the file
byte[] bytes = file.getBytes();
/*
* // Compress the image BufferedImage image = ImageIO.read(new
* ByteArrayInputStream(bytes)); byte[] compressedBytes = compressImage(image,
* 0.5f); // Compress with 50% quality
*
* // Write the bytes to the file
* Files.write(path, compressedBytes);
*/
Files.write(path, bytes);
System.out.println(filePath);
return filepath_txt;
} catch (IOException e) {
e.printStackTrace();
return "Failed to save file " + file.getOriginalFilename();
}
}
private byte[] compressImage(BufferedImage image, float quality) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(byteArrayOutputStream);
ImageWriter writer = ImageIO.getImageWritersByFormatName("jpg").next();
writer.setOutput(imageOutputStream);
ImageWriteParam param = writer.getDefaultWriteParam();
if (param.canWriteCompressed()) {
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionQuality(quality);
}
writer.write(null, new javax.imageio.IIOImage(image, null, null), param);
writer.dispose();
imageOutputStream.close();
return byteArrayOutputStream.toByteArray();
}
public static String generateRandomString() {
StringBuilder result = new StringBuilder(STRING_LENGTH);
for (int i = 0; i < STRING_LENGTH; i++) {
result.append(CHARACTERS.charAt(RANDOM.nextInt(CHARACTERS.length())));
}
return result.toString();
}
public boolean isMobileRegistered(String mobilenumber) {
String sql = "SELECT COUNT(*) FROM vendor_details WHERE mob_no = ?";
Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mobilenumber}, Integer.class);
return count != null && count > 0;
}
public List<Map<String, Object>> getCommiteeDetailsWeb(String cby) {
String sql = "SELECT * "
+ "FROM vendor_details "
+ "WHERE is_web=1 AND cby=?";
return jdbcTemplate.queryForList(sql, cby);
}
public List<Map<String, Object>> getwebVendorDetailsByReqId(String requestId) {
String sql="SELECT vd.*,em.education as education_name,mm.marital_status as marital_name,scm.category_name as category_name,vcm.vending_category_name as vending_category_name, "+
"CONCAT(vd.present_address,',',vd.present_district) as residental_address, CONCAT(vd.vending_address,',',vending_district) as business_address, "+
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.bank_passbook) AS view_bank_passbook, " +
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.ration_card_photo) AS view_ration_card_photo, " +
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.street_vendor_photo) AS view_street_vendor_photo, " +
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.aadhar_front_photo) AS view_aadhar_front_photo, " +
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.aadhar_back_photo) AS view_aadhar_back_photo " +
"FROM vendor_details vd "
+ "LEFT JOIN social_category_master scm on vd.social_category = scm.id "
+ "LEFT JOIN vending_category_master vcm ON vd.vending_category=vcm.id "
+ "LEFT JOIN education_master em on vd.education_status = em.id "
+ "LEFT JOIN marital_status_master mm on vd.marital_status = mm.id "
+ "WHERE vd.vendor_req_id = ?";
return jdbcTemplate.queryForList(sql,requestId);
}
public String updateStreetVendorDetailsWeb(String latitude, String longitude, String zone, String ward,
String landmark, String vending_district, Integer vending_pincode, Integer vending_category,
String vending_space, Boolean pm_svanidhi_loan, Boolean bank_acc_status, String bankPassbookPath,
String streetVendorPhotoPath, String name, String f_h_name, String mobile_number, String dob, String gender,
Integer social_category, Boolean diff_abled, Integer education_status, Integer marital_status,
Integer no_of_fam_mem, Boolean are_any_fam_mem_invol_str, String presentAddress, String present_district,
Integer present_pincode, String rationCardPath, String aadharFrontPhotoPath, String aadharBackPhotoPath,
String aadharNo, String userId, String vendor_req_id) {
String latitudeVal = (latitude != null && !latitude.trim().isEmpty()) ? latitude : null;
String longitudeVal = (longitude != null && !longitude.trim().isEmpty()) ? longitude : null;
String zoneVal = (zone != null && !zone.trim().isEmpty()) ? zone : null;
String wardVal = (ward != null && !ward.trim().isEmpty()) ? ward : null;
String dobVal = (dob != null && !dob.trim().isEmpty()) ? dob : null;
String vendingAddressVal = (landmark != null && !landmark.trim().isEmpty()) ? landmark : null;
String sql="UPDATE vendor_details SET "
+ "latitude =?,longitude=?,zone=?, ward=?, vending_address=?,vending_district=?, vending_pincode=?, vending_category=?, vending_space=?, pm_svanidhi_loan=?, "
+ "bank_acc_status=?, bank_passbook=?, street_vendor_photo=?, name=?, f_h_name=?, mob_no=?, "
+ "dob=?,gender=?,social_category=?, diff_abled=?, education_status=?, marital_status=?,no_of_fam_mem=?, "
+ "are_any_fam_mem_invol_str_ven=?,present_address=?, present_district=?, present_pincode=?, ration_card_photo=?, aadhar_front_photo=?, "
+ "aadhar_back_photo=?,aadhar_no=?,updated_date=NOW() "
+ " WHERE vendor_req_id = ? AND is_web=1 AND editable=1";
try {
int rows=jdbcTemplate.update(sql, latitudeVal, longitudeVal, zoneVal, wardVal, vendingAddressVal, vending_district,
vending_pincode, vending_category, vending_space, pm_svanidhi_loan, bank_acc_status, bankPassbookPath,
streetVendorPhotoPath, name, f_h_name, mobile_number, dobVal, gender, social_category, diff_abled,
education_status, marital_status, no_of_fam_mem, are_any_fam_mem_invol_str, presentAddress,
present_district, present_pincode, rationCardPath, aadharFrontPhotoPath, aadharBackPhotoPath, aadharNo,
vendor_req_id);
if (rows==1) {
return "Success";
}
else {
return "Error";
}
}
catch (Exception e) {
e.printStackTrace();
}
return "error";
}
public String logEntry(String userId, String vendor_req_id) {
String sql="INSERT INTO vendor_details_web_log (name,f_h_name,gender,dob,social_category,diff_abled,mob_no,aadhar_no,present_address,present_district,present_pincode,vending_address,vending_district,vending_pincode,vending_category,vending_space,bank_acc_status,bank_passbook,ration_card_photo,street_vendor_photo,aadhar_front_photo,aadhar_back_photo,zone,ward,pm_svanidhi_loan,vendor_req_id,education_status,marital_status,no_of_fam_mem,are_any_fam_mem_invol_str_ven,latitude,longitude,cby) "
+ " SELECT name,f_h_name,gender,dob,social_category,diff_abled,mob_no,aadhar_no,present_address,present_district,present_pincode,vending_address,vending_district,vending_pincode,vending_category,vending_space,bank_acc_status,bank_passbook,ration_card_photo,street_vendor_photo,aadhar_front_photo,aadhar_back_photo,zone,ward,pm_svanidhi_loan,vendor_req_id,education_status,marital_status,no_of_fam_mem,are_any_fam_mem_invol_str_ven,latitude,longitude,? FROM vendor_details WHERE vendor_req_id=?";
try {
jdbcTemplate.update(sql, userId,vendor_req_id);
return "success";
} catch (DataAccessException e) {
e.printStackTrace();
return "failure";
}
}
}

167
src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java

@ -0,0 +1,167 @@
package in.gov.chennaicorporation.gccoffice.vendor.service;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.time.LocalDate;
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.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@Service
public class createventService {
private JdbcTemplate jdbcTemplate;
@Autowired
public void setDataSource(@Qualifier("mysqlVendingCommitteDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public boolean isFileExists(String originalFilename) {
String sql = "SELECT COUNT(*) FROM vendingcommitte.create_event " +
"WHERE file_url LIKE ?";
String filenamePattern = "%" + originalFilename; // Match filename at the end of the path
Integer count = jdbcTemplate.queryForObject(sql, Integer.class, filenamePattern);
return count != null && count > 0;
}
public void insertEvent(String eventName, LocalDate eventDate, String fileUrl) {
String sql = "INSERT INTO vendingcommitte.create_event (event_name, event_date, file_url) VALUES (?, ?, ?)";
jdbcTemplate.update(sql, eventName, eventDate, fileUrl);
}
//SELECT * FROM vendingcommitte.create_event
public List<Map<String, Object>> ViewDropdownEvent() {
String sql = "SELECT * FROM create_event";
return jdbcTemplate.queryForList(sql);
}
public List<Map<String, Object>> ViewCommitteeDropdownEvent() {
String sql = "SELECT distinct rl.event_req_id as event_req_id,ce.event_name as event_name,ce.event_date as event_date "
+ "FROM vendor_request_list rl "
+ "JOIN create_event ce ON ce.req_id=rl.event_req_id";
return jdbcTemplate.queryForList(sql);
}
public ResponseEntity<Map<String, Object>> saveVendorDetails(Map<String, Object> payload) {
Map<String, Object> response = new HashMap<>();
String vendor_req_id = (String) payload.get("vendor_req_id");
String name = (String) payload.get("name");
String mob_no= (String) payload.get("mob_no");
String business_address= (String) payload.get("business_address");
String vending_pincode= (String) payload.get("vending_pincode");
String status = (String) payload.get("status");
final String remarks = (payload.get("remarks") == null || ((String) payload.get("remarks")).trim().isEmpty())
? "-"
: (String) payload.get("remarks");
int event_req_id = Integer.parseInt((String) payload.get("event_req_id"));
//System.out.println("values="+vendor_req_id+name+mob_no+business_address+vending_pincode+status+remarks+event_req_id);
String sql = "INSERT INTO vendor_request_list (request_no,person_name, mobile_no, address, status, remarks, pincode,event_req_id) " +
"VALUES (?, ?, ?, ?, ?, ?,?,?)";
try {
int rows = jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1, vendor_req_id);
ps.setString(2, name);
ps.setString(3, mob_no);
ps.setString(4, business_address);
ps.setString(5, status);
ps.setString(6, remarks);
ps.setString(7, vending_pincode);
ps.setInt(8, event_req_id);
return ps;
});
if(rows > 0) {
String result=sendWhatsappMsg(mob_no,status,vendor_req_id);
if("200".equalsIgnoreCase(result)) {
response.put("status", "success");
response.put("message", "Data submitted successfully!");
}
else {
response.put("status", "success");
response.put("message", "Data Submitted But Whatsapp Message not Sent");
}
}
else {
response.put("status", "Error");
response.put("message", "Error in saving Vendor Details");
}
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace(); // Log the exception
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of("status", "Error", "message", "Error fetching to save vendor details: " + e.getMessage()));
}
}
private String sendWhatsappMsg(String mob_no, String status,String vendor_req_id) {
String urlString="";
if("Approved".equals(status)) {
urlString="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+mob_no+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=You+are+recognized+as+a+roadside+vendor.+Registration+number%3A+"+vendor_req_id+".&isTemplate=true&footer=GCC+-+IT+Cell";
}
else {
urlString="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+mob_no+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+application+is+rejected+because+your+roadside+vendor+details+are+incorrect.+%0A%0ARegistration+Number%3A+"+vendor_req_id+".";
}
String res=hitURL(urlString);
return res;
}
private String hitURL(String urlString) {
String response = "";
try {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
response = String.valueOf(responseCode);
System.out.println("Response Code for URL: " + urlString + " is " + responseCode);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("response="+response);
return response;
}
public List<Map<String, Object>> getCommiteeDetails(String event_req_id) {
String sql = "SELECT * "
+ "FROM vendor_request_list "
+ "WHERE event_req_id=? ";
return jdbcTemplate.queryForList(sql,event_req_id);
}
public List<String> removeSavedVendorDetails() {
String sql="SELECT request_no FROM vendor_request_list";
return jdbcTemplate.queryForList(sql,String.class);
}
}

46
src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java

@ -366,6 +366,52 @@ public class VehicleService {
+ "&media_url="+fileURL
+ "&isTemplate=true&footer=GCC+-+IT+Cell";
break;
case "11":
System.out.println("TempID is 11 (Still Catch Pit -> 1566758 - silt_catch_pit_cleaning )");
urlString="https://media.smsgupshup.com/GatewayAPI/rest?"
+ "userid="+username
+ "&password="+password
+ "&send_to="+sendTo
+ "&v=1.1&format=json"
+ "&msg_type=IMAGE"
+ "&method=SENDMEDIAMESSAGE"
+ "&caption=%2AGCC+Silt+catch+Pit+Cleaning%2A%0A%0AToday%27s+%28"+msgDate+"%29+Zone+wise+Silt+Catch+Pit+cleaning+details+shared+above+for+your+reference%0A%0AFor+more+details%2C+please+click+the+link+below."
+ "&media_url="+fileURL
+ "&isTemplate=true&footer=GCC+-+IT+Cell";
break;
case "12":
System.out.println("TempID is 12 (1590940 - tree_planting_gcc - IMAGE - STATIC)");
urlString="https://media.smsgupshup.com/GatewayAPI/rest?"
+ "userid="+username
+ "&password="+password
+ "&send_to="+sendTo
+ "&v=1.1&format=json"
+ "&msg_type=IMAGE"
+ "&method=SENDMEDIAMESSAGE"
+ "&caption=%2AGCC+Tree+Planting%2A%0A%0AToday%27s+%28"+msgDate+"%29+Zone+wise+tree+planting+details+shared+above+for+your+reference%0A%0AFor+more+details%2C+please+click+the+link+below."
+ "&media_url="+fileURL
+ "&isTemplate=true&footer=GCC+-+IT+Cell";
break;
case "13":
System.out.println("TempID is 13 (1590940 - Chennai Schools (userd of Com Temp ) - IMAGE - STATIC)");
urlString="https://media.smsgupshup.com/GatewayAPI/rest?"
+ "userid="+username
+ "&password="+password
+ "&send_to="+sendTo
+ "&v=1.1&format=json"
+ "&msg_type=IMAGE"
+ "&method=SENDMEDIAMESSAGE"
//+ "&caption=%2AGCC+The+Chennai+School%2A%0A%0AToday%27s+%28"+msgDate+"%29+Zone+wise+Students+Aadhar+linked+details+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below."
+ "&caption=%2AGCC+The+Chennai+School%2A%0A%0AToday%27s+%28"+msgDate+"%29+Zone+wise+Students+Aadhar+linked+details+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below."
+ "&media_url="+fileURL
+ "&isTemplate=true&footer=GCC+-+IT+Cell";
break;
default:
System.out.println("TempID ("+tempid+") is unknown");
}

9
src/main/java/in/gov/chennaicorporation/gccoffice/works/service/ERPEstimateService.java

@ -255,21 +255,22 @@ public class ERPEstimateService {
//////////////////////
String accessData = getUserAccess(loginId);
String where="";
String where="ew.`nonerp`=0 ";
// Split the string using "_"
String[] parts = accessData.split("_");
if(!parts[0].equals("all")) {
where =" ew.`ward` IN ("+parts[0]+") ";
where = where + " AND ew.`ward` IN ("+parts[0]+") ";
}
if(!parts[1].equals("all")) {
if(!where.equals(""))
{
where = where + "AND `dm`.`dept_name` IN ("+getDepartmentName(parts[1])+")";
where = where + " AND `dm`.`dept_name` IN ("+getDepartmentName(parts[1])+")";
}
else {
where = where + "`dm`.`dept_name` IN ("+getDepartmentName(parts[1])+")";
where = where + " AND`dm`.`dept_name` IN ("+getDepartmentName(parts[1])+")";
}
}

8
src/main/java/in/gov/chennaicorporation/gccoffice/works/service/EstimateService.java

@ -304,21 +304,21 @@ public class EstimateService {
public List<Map<String, Object>> getAllERPWorks(String loginId) {
String accessData = getUserAccess(loginId);
String where="";
String where="ew.`nonerp`=0 ";
// Split the string using "_"
String[] parts = accessData.split("_");
if(!parts[0].equals("all")) {
where =" ew.`ward` IN ("+parts[0]+") ";
where =" AND ew.`ward` IN ("+parts[0]+") ";
}
if(!parts[1].equals("all")) {
if(!where.equals(""))
{
where = where + "AND ew.`department` IN ("+parts[1]+")";
where = where + " AND ew.`department` IN ("+parts[1]+")";
}
else {
where = where + "ew.`department` IN ("+parts[1]+")";
where = where + " AND ew.`department` IN ("+parts[1]+")";
}
}

BIN
src/main/resources/.DS_Store

6
src/main/resources/application.properties

@ -52,6 +52,8 @@ server.servlet.session.tracking-modes=COOKIE
file.upload.directory=${user.dir}/gccoffice_uploads/
file.upload.directory.mobile=${user.dir}/gcc_mobile_service_uploads/
server.address=0.0.0.0
server.servlet.session.timeout=-1
@ -111,3 +113,7 @@ minutes_files = gcc_minutes_files_uploads
#/////////// For Vtrack (jtrack) -> WhatsApp Msg ////////////
vtrack_foldername = gcc_vtrack_uploads
education.foldername = school_aadhar_uploads
street_vendor_foldername=street_vendor_files

BIN
src/main/resources/static/.DS_Store

BIN
src/main/resources/static/assets/node_modules/.DS_Store

BIN
src/main/resources/static/assets/node_modules/ammap3/.DS_Store

BIN
src/main/resources/static/assets/node_modules/ammap3/ammap/.DS_Store

BIN
src/main/resources/templates/.DS_Store

BIN
src/main/resources/templates/fragments/.DS_Store

BIN
src/main/resources/templates/fragments/modules/.DS_Store

1
src/main/resources/templates/fragments/modules/com_petition/petition_view_script.html

@ -69,6 +69,7 @@
$("#petitioner_pincode_value").html(petitionDetails[0].petitioner_pincode);
$("#complaint_with_maping_value").html(petitionDetails[0].complaint_nature);
$("#remarks_with_value").html(petitionDetails[0].remarks);
var petition_status = petitionDetails[0].status

BIN
src/main/resources/templates/modules/.DS_Store

692
src/main/resources/templates/modules/callcenter/assignagents.html

@ -1,692 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}">
<style>
</style>
</head>
<body>
<div class="wrapper">
<!-- Header -->
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<div class="page-wrap">
<!-- Left Menu -->
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<div class="main-content">
<div class="container-fluid">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-8">
<div class="page-header-title">
<i class="fas fa-user-graduate bg-blue"></i>
<div class="d-inline">
<h5>Assign Agents</h5>
<span>1913 Assign agents for Campaign</span>
</div>
</div>
</div>
<div class="col-lg-4">
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item">1913 Campaign</li>
<li class="breadcrumb-item active" aria-current="page">Assign Agents</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<!-- Card for Agent Assignment -->
<div class="card">
<div class="card-header">
<h3>Agent Assign</h3>
</div>
<div class="card-body">
<!-- Dropdown for Category -->
<div class="row">
<div class="form-group col-md-6 col-sm-12">
<label for="category">Category</label>
<select id="category" class="form-control">
</select>
</div>
<!-- Dropdown for Campaigns -->
<div class="form-group col-md-6 col-sm-12">
<label for="campaign">Campaign</label>
<select id="campaign" class="form-control" disabled>
</select>
</div>
<div class="form-group col-12 d-flex justify-content-center align-items-center">
<!-- Centered button between the dropdowns -->
<button id="searchBtn" class="btn btn-primary">Search</button>
<button id="resetBtn" class="btn btn-secondary ml-3">Reset</button>
</div>
</div>
</div>
</div>
<!-- Card for Campaign Details -->
<div class="card mt-3" id="campaignDetailsCard" style="display:none;">
<div class="card-header">
<h3>Campaign Details</h3>
</div>
<div class="card-body">
<table class="table table-bordered">
<tbody>
<tr>
<th >Name</th>
<td class="fw-semibold" id="campaignName" style="padding: 0.45rem 0.45rem;"></td>
</tr>
<tr>
<th>From Date</th>
<td class="fw-semibold" id="campaignStartdate" style="padding: 0.45rem 0.45rem;"></td>
</tr>
<tr>
<th>To Date</th>
<td class="fw-semibold" id="campaignEnddate" style="padding: 0.45rem 0.45rem;"></td>
</tr>
<tr>
<th>Agents Assigned</th>
<td class="fw-semibold" id="campaignAgents" style="padding: 0.45rem 0.45rem;"></td>
</tr>
<tr>
<th>Calls Assigned (per person)</th>
<td class="fw-semibold" id="campaignCalls" style="padding: 0.45rem 0.45rem;"></td>
</tr>
<tr>
<th>Description</th>
<td class="fw-semibold" id="campaignDesc" style="padding: 0.45rem 0.45rem;"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row" id="editagentCard" style="display:none;">
<div class="col-md-12">
<div class="card">
<div class="card-block">
<div class="page-header-title" >
<h5 style="margin: 0;font-weight: bold;">Selected Agent List</h5><hr>
</div>
<table id="editagentsDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" >
<thead class="thead-dark">
<tr role="row">
<th class="text-center no-sort" width="1%">S.No</th>
<th class="text-center">Agent Id</th>
<th class="text-center">Name of Agents</th>
<th class="text-center">Select/Not Selected</th>
</tr>
</thead>
<tbody id="editagentList" style="text-align:center;">
<!-- Rows will be dynamically inserted here -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row" id="agentCard" style="display:none;">
<div class="col-md-12">
<div class="card">
<div class="card-block">
<div class="page-header-title" >
<h5 style="margin: 0;font-weight: bold;">Overall Agent List</h5><hr>
</div>
<div class=" d-flex justify-content-end mb-2">
<button class="btn btn-primary" id="selectedCount"><i class="ik ik-user-plus f-16 mr-2"></i>0</button>
<!-- <button class="btn btn-warning ml-2" id="editAgentsBtn"><i class="ik ik-edit f-16 mr-2"></i>Edit</button> -->
</div>
<table id="agentsDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" >
<thead class="thead-dark">
<tr role="row">
<th class="text-center no-sort" width="1%">S.No</th>
<th class="text-center">Agent Id</th>
<th class="text-center">Name of Agents</th>
<th class="text-center"><input type="checkbox" id="selectAllAgents"> Select All</th>
</tr>
</thead>
<tbody id="agentList" style="text-align:center;">
<!-- Rows will be dynamically inserted here -->
</tbody>
</table>
<!-- Center the Submit button -->
<div class="text-center">
<button type="submit" class="btn btn-primary" id="submitBtn">Submit</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<!-- Include jQuery and Bootstrap JavaScript -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script th:replace="~{fragments/modules/base/script :: script}"></script>
<!-- sweet alert -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script type="text/javascript">
// Fetch category dropdown on page load
fetchCategoryDropdown();
// Handle category change event to fetch campaigns
$(document).on('change', '#category', function() {
let selectedCategoryId = $(this).val();
if (selectedCategoryId != '0') {
fetchCampaignDropdown(selectedCategoryId);
} else {
$('#campaign').empty().prop('disabled', true);
}
});
$("#searchBtn").click(function () {
let selectedCampaignId = $('#campaign').val();
if(selectedCampaignId == null || selectedCampaignId=='0'){
Swal.fire({
title: 'Info!',
text: 'Please Select Category and Campaign!',
icon: 'info',
timer: 2000,
//timerProgressBar: true,
showConfirmButton: false
})
hideCampaignAndAgentDetails();
}
else if (selectedCampaignId != '0') {
fetchCampaignDetails(selectedCampaignId);
checkCampaignInAssigned(selectedCampaignId);
// Disable the category and campaign dropdowns after search
$('#category').prop('disabled', true);
$('#campaign').prop('disabled', true);
}
else {
hideCampaignAndAgentDetails();
}
});
//Approve button click event
$("#submitBtn").click(function () {
handleSubmit();
});
$("#resetBtn").click(function () {
location.reload(); // Reloads the current page
});
// Initial binding for checkbox events
bindCheckboxEvents();
// Function to fetch category dropdown
function fetchCategoryDropdown() {
$.ajax({
url: '/gcc/api/callcenter/admin/getcategory',
type: 'GET',
dataType: 'json'
})
.done(function (data) {
let categoryDropdown = $('#category');
categoryDropdown.empty();
categoryDropdown.append($('<option selected value="0"></option>').text('Select a category'));
$.each(data, function (index, category) {
categoryDropdown.append($('<option></option>').attr('value', category.category_id).text(category.category_name));
});
})
.fail(function (xhr, status, error) {
console.error('Error fetching category:', error);
});
}
// Function to fetch campaigns based on selected category
function fetchCampaignDropdown(categoryId) {
$('#campaign').prop('disabled', false);
$.ajax({
url: '/gcc/api/callcenter/admin/getcampaignbycategory?id=' + categoryId,
type: 'GET',
dataType: 'json'
})
.done(function (data) {
let campaignDropdown = $('#campaign');
campaignDropdown.empty();
campaignDropdown.append($('<option selected value="0"></option>').text('Select a campaign'));
$.each(data, function (index, campaign) {
campaignDropdown.append($('<option></option>').attr('value', campaign.campaign_id).text(campaign.campaign_name));
});
})
.fail(function (xhr, status, error) {
console.error('Error fetching campaign:', error);
});
}
// Function to fetch campaign details
function fetchCampaignDetails(campaignId) {
$.ajax({
url: '/gcc/api/callcenter/admin/getcampaignbyid?id=' + campaignId,
method: 'GET',
dataType: 'json',
success: function (response) {
if (response.length === 0) {
console.error("No campaign details found.");
return;
}
document.getElementById("campaignName").innerHTML = response[0].campaign_name;
document.getElementById("campaignStartdate").innerHTML = response[0].start_date;
document.getElementById("campaignEnddate").innerHTML = response[0].end_date;
document.getElementById("campaignAgents").innerHTML = response[0].no_of_agents;
document.getElementById("campaignCalls").innerHTML = response[0].calls_per_agent;
document.getElementById("campaignDesc").innerHTML = response[0].description;
// Show the campaign details card
document.getElementById('campaignDetailsCard').style.display = 'block';
},
error: function () {
console.error("An error occurred while fetching campaign details.");
}
});
}
// Function to check if campaign is already assigned and fetch agents
function checkCampaignInAssigned(selectedCampaignId) {
$.ajax({
url: '/gcc/api/callcenter/admin/getassignedcampaign?id=' + selectedCampaignId,
type: 'GET',
dataType: 'json',
success: function(response) {
//console.log('checkCampaignInAssigned response:', response);
fetchAgentsForCampaign(selectedCampaignId); // Always fetch agents
if (response.length > 0) {
populateEditAgentList(response);
document.getElementById('editagentCard').style.display = 'block';
initializeEditAgentsDataTable();
}
else{
document.getElementById('editagentCard').style.display = 'none';
}
},
error: function(xhr, status, error) {
console.error('Error fetching assigned agents:', error);
}
});
}
// Function to populate the edit agent list
function populateEditAgentList(agents) {
let editagentList = $('#editagentList');
editagentList.empty();
$.each(agents, function(index, agent) {
let row = `
<tr data-assigned-id="${agent.assigned_id}">
<td>${index + 1}</td>
<td>${agent.agent_id}</td>
<td>${agent.agent_name}</td>
<td>
<button class="btn btn-warning" onclick="editagent(${agent.assigned_id})">Remove</button>
</td>
</tr>
`;
// Log the row HTML to debug
// console.log('Appending row:', row);
editagentList.append(row);
});
}
function editagent(assignedId) {
$.ajax({
url: '/gcc/api/callcenter/admin/deleteassignedbyid?id=' + assignedId,
type: 'GET',
dataType: 'json',
success: function(response) {
$('tr[data-assigned-id="' + assignedId + '"]').remove();
Swal.fire({
title: 'Success!',
text: 'Agents have been removed!',
icon: 'success',
timer: 2000,
//timerProgressBar: true,
showConfirmButton: false
})
},
error: function(xhr, status, error) {
console.error('Error removing agents:', error);
reject(error); // Reject the promise in case of an error
}
});
}
// Function to fetch agents for the selected campaign
function fetchAgentsForCampaign(campaignId) {
$.ajax({
url: '/gcc/api/callcenter/admin/getagentsfortask?id=' +campaignId,
type: 'GET',
dataType: 'json',
success: function(response) {
let agentList = $('#agentList');
agentList.empty();
if (response.length > 0) {
$.each(response, function(index, agent) {
let row = `
<tr>
<td>${index + 1}</td>
<td>${agent.agent_id}</td>
<td>${agent.agent_name}</td>
<td><input type="checkbox" class="agentCheckbox" value="${agent.agent_id}"></td>
</tr>
`;
agentList.append(row);
});
document.getElementById('agentCard').style.display = 'block';
initializeAgentsDataTable();
} else {
agentList.append('<tr><td colspan="4">No agents available</td></tr>');
}
bindCheckboxEvents(); // Rebind checkbox events after adding new checkboxes
},
error: function(xhr, status, error) {
console.error('Error fetching agents:', error);
}
});
}
// Function to hide campaign and agent details
function hideCampaignAndAgentDetails() {
document.getElementById('campaignDetailsCard').style.display = 'none';
document.getElementById('agentCard').style.display = 'none';
document.getElementById('editagentCard').style.display = 'none';
}
// Function to bind checkbox events and handle "Select All" functionality
function bindCheckboxEvents() {
$('#selectAllAgents').on('click', function() {
let campaignAgentsCount = parseInt($('#campaignAgents').text(), 10);
let totalCheckboxes = $('.agentCheckbox').length;
if ($(this).is(':checked')) {
if (campaignAgentsCount > totalCheckboxes) {
Swal.fire({
title: 'Sorry!',
text: 'You cannot select more checkboxes than available.',
icon: 'error',
timer: 2000
}).then(() => {
$('#selectAllAgents').prop('checked', false);
});
} else {
let checkboxes = $('.agentCheckbox');
checkboxes.prop('checked', false);
for (let i = 0; i < campaignAgentsCount; i++) {
if (checkboxes[i]) {
$(checkboxes[i]).prop('checked', true);
}
}
}
} else {
$('.agentCheckbox').prop('checked', false);
}
updateSelectedCount();
});
$(document).on('change', '.agentCheckbox', function () {
if ($('.agentCheckbox:checked').length === $('.agentCheckbox').length) {
$('#selectAllAgents').prop('checked', true);
} else {
$('#selectAllAgents').prop('checked', false);
}
updateSelectedCount();
});
}
// Function to update the selected count
function updateSelectedCount() {
let selectedCount = $('.agentCheckbox:checked').length;
$('#selectedCount').html('<i class="ik ik-user-plus f-16 mr-2"></i>' + selectedCount);
}
// Function to handle form submission and assign agents
function handleSubmit() {
let selectedCategoryId = $('#category').val();
let selectedCampaignId = $('#campaign').val();
let campaignAgentsCount = parseInt($('#campaignAgents').text(), 10); // Get the required agent count
let assignedAgentCount = $('#editagentList tr').length; // Count already assigned agents
// Ensure category and campaign are selected
if (selectedCategoryId == 0 || selectedCampaignId == 0) {
Swal.fire({
title: 'Info!',
text: 'Please select a category and campaign before proceeding.',
icon: 'info',
timer: 2000,
timerProgressBar: true
});
return;
}
let selectedAgentsCount = $(".agentCheckbox:checked").length; // Count of selected checkboxes
// Total agent count (new selections + already assigned)
let totalSelectedCount = selectedAgentsCount + assignedAgentCount;
// Validation: Check if total selected count matches the campaignAgentsCount
if (totalSelectedCount < campaignAgentsCount) {
Swal.fire({
title: 'Error!',
text: `You need to select ${campaignAgentsCount - totalSelectedCount} more agents to meet the required count.`,
icon: 'error',
timer: 3000,
timerProgressBar: true
});
return;
} else if (totalSelectedCount > campaignAgentsCount) {
Swal.fire({
title: 'Error!',
text: `You have selected more agents than allowed. Please reduce the number of selected agents.`,
icon: 'error',
timer: 3000,
timerProgressBar: true
});
return;
}
let requestData = [];
$(".agentCheckbox:checked").each(function () {
requestData.push({
categoryId: parseInt(selectedCategoryId),
campaignId: parseInt(selectedCampaignId),
agentId: parseInt($(this).val())
});
});
if (requestData.length === 0) {
Swal.fire({
title: 'Info!',
text: 'Please select at least one agent to assign.',
icon: 'info',
timer: 3000,
timerProgressBar: true
});
return;
}
// AJAX request to submit the data
$.ajax({
url: "/gcc/api/callcenter/admin/addagentsfortask",
type: "POST",
contentType: "application/json",
data: JSON.stringify(requestData),
success: function (response) {
Swal.fire({
title: 'Success!',
text: 'Agents have been successfully assigned!',
icon: 'success',
timer: 2000,
timerProgressBar: true,
showConfirmButton: false
}).then(() => {
location.reload(); // Reload after success
});
},
error: function (xhr, status, error) {
Swal.fire({
title: 'Error!',
text: 'There was an error while assigning agents.',
icon: 'error',
timer: 3000,
timerProgressBar: true
});
}
});
}
//Initialize the first table: agentsDatatable
function initializeAgentsDataTable() {
if (!$.fn.DataTable.isDataTable('#agentsDatatable')) {
$('#agentsDatatable').DataTable({
dom: 'Bftip',
columnDefs: [{ targets: 'no-sort', orderable: false }],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
],
scrollY: '30vh',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning' },
{ extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
],
fixedHeader: true,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false
});
} else {
$('#agentsDatatable').DataTable().clear().draw();
}
}
// Initialize the second table: editagentsDatatable
function initializeEditAgentsDataTable() {
if (!$.fn.DataTable.isDataTable('#editagentsDatatable')) {
$('#editagentsDatatable').DataTable({
dom: 'Bftip',
columnDefs: [{ targets: 'no-sort', orderable: false }],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
],
scrollY: '30vh',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning' },
{ extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
],
fixedHeader: true,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false
});
} else {
$('#editagentsDatatable').DataTable().clear().draw();
}
}
</script>
</body>
</html>

71
src/main/resources/templates/modules/callcenter/campaignreport.html

@ -20,10 +20,6 @@
}
/* #questionDatatable {
table-layout: fixed !important;
width: 100% !important;
@ -178,6 +174,18 @@
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -365,15 +373,12 @@
],
scrollY: '30vh',
scrollX: true, // Enable horizontal scrolling
fixedColumns: {
left: 1,
right: 1
},
buttons: buttons,
fixedHeader: false,
autoWidth: false,
responsive: true,
searching: true,
autoWidth: true,
responsive: false,
searching: true,
select: false,
processing: false,
});
@ -393,10 +398,7 @@
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX: true,
buttons: [
{
extend: 'pageLength',
@ -429,8 +431,8 @@
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching:true,
select: false,
processing: false
@ -517,6 +519,7 @@
// Fetch and Populate Table Data Function
const fetchTableData = async (startDate = "", endDate = "") => {
$('#pageLoader').show();
try {
const params = new URLSearchParams();
if (startDate) params.append("startDate", startDate);
@ -558,6 +561,8 @@
} catch (error) {
console.error("Error fetching table data:", error);
}finally {
$('#pageLoader').hide(); // Hide loader in both success or error
}
};
@ -575,10 +580,26 @@
window.location.href = `/gcc/api/campaignreport/download-excel?categoryId=${categoryId}&campaignId=${campaignId}`;
});
let today = new Date();
// Get the first day of the current month (this should give 2024-11-01 for November)
let firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
// Manually format the date as yyyy-mm-dd without relying on toISOString
let formattedFirstDay = firstDayOfMonth.getFullYear() + '-' +
(firstDayOfMonth.getMonth() + 1).toString().padStart(2, '0') + '-' +
firstDayOfMonth.getDate().toString().padStart(2, '0');
let formattedToday = today.getFullYear() + '-' +
(today.getMonth() + 1).toString().padStart(2, '0') + '-' +
today.getDate().toString().padStart(2, '0');
// Set the date input values
$('#startDate').val(formattedFirstDay);
$('#endDate').val(formattedToday);
// Example: Fetch Data initially without filters
fetchTableData();
fetchTableData(formattedFirstDay,formattedToday);
// Function to Download Campaign Excel
@ -634,7 +655,7 @@
// Initial Load
//fetchData(); // Load overall data initially
fetchTableData();
//fetchTableData();
});
@ -686,6 +707,9 @@
});
$('#agentperformance').modal('show');
// Set default active tab
$('#performance-tab').tab('show');
$.ajax({
url: '/gcc/api/campaignreport/getReportCampaignid?campaign_id='+CampaignId,
type: 'GET',
@ -697,10 +721,7 @@
// Populate form fields with response data
$('#campaign_id').val(campaign.campaign_id);
$('#category_id').val(campaign.category_id);
/* $('#start_date').val(campaign.start_date);
$('#end_date').val(campaign.end_date);
$('#description_modal').val(campaign.description);
$('#category').val(campaign.category_name); */
$('#start_date').text(campaign.start_date || 'N/A');
$('#end_date').text(campaign.end_date || 'N/A');
@ -714,8 +735,6 @@
<b>Created Date:</b> ${campaign.created_date}`
);
/* <b>Category:</b> ${campaign.category_name} | */
// Open modal
$('#agentperformance').modal('show');
} else {
@ -931,7 +950,7 @@
scrollY: '30vh',
scrollX: true, // Enable horizontal scrolling
buttons: buttons,
fixedHeader: false,
fixedHeader: true,
autoWidth: false,
responsive: false,
searching: true,

BIN
src/main/resources/templates/modules/callcenterqaqc/.DS_Store

156
src/main/resources/templates/modules/callcenterqaqc/agentqaqccalls.html

@ -315,7 +315,7 @@
</tr>
</thead>
<tbody>
<tr th:each="call, iterStat : ${qaqcSubmitDetails}">
<!-- <tr th:each="call, iterStat : ${qaqcSubmitDetails}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${call['complaint_number']}"
class="text-center complaint-select"></td>
@ -333,7 +333,7 @@
</td>
<td th:text="${call['call_status']}" class="text-center"></td>
<td th:text="${call['remarks']}" class="text-center"></td>
</tr>
</tr> -->
</tbody>
</table>
</div>
@ -352,6 +352,17 @@
</div>
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -411,6 +422,7 @@
// Toggle functionality for Primary and Secondary buttons
$('#primaryButton').click(function () {
//location.reload();
$('#primaryTable').show();
$('#secondaryTable').hide();
@ -420,12 +432,114 @@
});
$('#secondaryButton').click(function () {
//location.reload();
$('#primaryTable').hide();
$('#secondaryTable').show();
$(this).addClass('btn-success').removeClass('btn-secondary');
$('#primaryButton').addClass('btn-secondary').removeClass('btn-success');
$('#SecondaryDatatable').DataTable().columns.adjust().draw();
//$('#SecondaryDatatable').DataTable().columns.adjust().draw();
let userId = document.getElementById('userIdSpan').textContent;
// Destroy previous instance if exists
if ($.fn.DataTable.isDataTable('#SecondaryDatatable')) {
$('#SecondaryDatatable').DataTable().clear().destroy();
}
$('#pageLoader').show();
// AJAX call to get data
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/qaqccalls/getqcsubmittedcalls', // Replace with your controller URL
type: 'GET',
data: { userId: userId },
success: function (response) {
$('#pageLoader').hide();
// Initialize DataTable with new data
$('#SecondaryDatatable').DataTable({
data: response, // This should be an array of objects
columns: [
{ data: null, render: function (data, type, row, meta) { return meta.row + 1; }, className: "text-center" },
{ data: 'complaint_number', className: "text-center" },
{ data: 'complaint_date', className: "text-center" },
{ data: 'complaint_person_name', className: "text-center" },
{ data: 'complaint_mobilenumber', className: "text-center" },
{ data: 'complaint_type', className: "text-center" },
{
data: 'complaint_number',
className: "text-center",
render: function (data, type, row) {
return `<button type="button" class="btn btn-info" data-complaint-number="${data}">View</button>`;
}
},
{
data: 'call_status',
className: "text-center"
},
{
data: 'remarks',
className: "text-center"
}
],
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
scrollX:true,
buttons: [
{
extend: 'pageLength',
className: 'btn btn-warning'
},
{
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-secondary',
id: 'copyBtn'
},
{
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-secondary',
id: 'excelBtn'
},
{
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-secondary',
id: 'csvBtn'
},
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
id: 'pdfBtn'
}
],
fixedHeader: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
});
},
error: function () {
$('#pageLoader').hide();
Swal.fire("Error", "Failed to get Finished complaints.", "error");
}
});
});
@ -439,10 +553,7 @@
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -475,8 +586,8 @@
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
@ -492,10 +603,7 @@
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -528,8 +636,8 @@
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
@ -594,6 +702,8 @@
function submitComplaint(button) {
// Access the userId from the hidden span
var userId = document.getElementById('userIdSpan').textContent;
@ -641,7 +751,7 @@
return;
}
$('#pageLoader').show();
//console.log("outside ajax");
// AJAX Request
$.ajax({
@ -656,6 +766,7 @@
userId:userId
},
success: function (response) {
$('#pageLoader').hide();
if (response === "Success") {
//console.log("Success");
@ -718,6 +829,7 @@
}
},
error: function (xhr, status, error) {
$('#pageLoader').hide();
$('.submitid').prop('disabled', false).text('Submit');
Swal.fire("Error", `An error occurred: ${xhr.responseText || error}`, "error");
}
@ -1009,6 +1121,18 @@ return detailsHtml;
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const today = new Date();
today.setDate(today.getDate() + 1); // Add 1 day to get tomorrow
const tomorrow = today.toISOString().split('T')[0];
document.querySelectorAll('.date-picker').forEach(function (input) {
input.setAttribute('min', tomorrow);
});
});
</script>
<script>
//Swal.fire("Success", "Complaint updated successfully!", "success");

148
src/main/resources/templates/modules/callcenterqaqc/agentqaqcfollowupcalls.html

@ -329,7 +329,7 @@
</tr>
</thead>
<tbody>
<tr th:each="call, iterStat : ${fcSubmitDetails}">
<!-- <tr th:each="call, iterStat : ${fcSubmitDetails}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${call['complaint_number']}"
class="text-center complaint-select"></td>
@ -347,7 +347,7 @@
</td>
<td th:text="${call['call_status']}" class="text-center"></td>
<td th:text="${call['remarks']}" class="text-center"></td>
</tr>
</tr> -->
</tbody>
</table>
</div>
@ -364,6 +364,17 @@
</div>
</div>
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -438,8 +449,106 @@ $(document).ready(function() {
$('#secondaryTable').show();
$(this).addClass('btn-success').removeClass('btn-secondary');
$('#primaryButton').addClass('btn-secondary').removeClass('btn-success');
$('#SecondaryDatatable').DataTable().columns.adjust().draw();
$('#primaryButton').addClass('btn-secondary').removeClass('btn-success');
//$('#SecondaryDatatable').DataTable().columns.adjust().draw();
let userId = document.getElementById('userIdSpan').textContent;
// Destroy previous instance if exists
if ($.fn.DataTable.isDataTable('#SecondaryDatatable')) {
$('#SecondaryDatatable').DataTable().clear().destroy();
}
$('#pageLoader').show();
// AJAX call to get data
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/followupcalls/getoffsubmittedcalls', // Replace with your controller URL
type: 'GET',
data: { userId: userId },
success: function (response) {
$('#pageLoader').hide();
// Initialize DataTable with new data
$('#SecondaryDatatable').DataTable({
data: response, // This should be an array of objects
columns: [
{ data: null, render: function (data, type, row, meta) { return meta.row + 1; }, className: "text-center" },
{ data: 'complaint_number', className: "text-center" },
{ data: 'complaint_date', className: "text-center" },
{ data: 'complaint_person_name', className: "text-center" },
{ data: 'complaint_mobilenumber', className: "text-center" },
{ data: 'complaint_type', className: "text-center" },
{
data: 'complaint_number',
className: "text-center",
render: function (data, type, row) {
return `<button type="button" class="btn btn-info" data-complaint-number="${data}">View</button>`;
}
},
{
data: 'call_status',
className: "text-center"
},
{
data: 'remarks',
className: "text-center"
}
],
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
scrollX:true,
buttons: [
{
extend: 'pageLength',
className: 'btn btn-warning'
},
{
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-secondary',
id: 'copyBtn'
},
{
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-secondary',
id: 'excelBtn'
},
{
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-secondary',
id: 'csvBtn'
},
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
id: 'pdfBtn'
}
],
fixedHeader: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
});
},
error: function () {
$('#pageLoader').hide();
Swal.fire("Error", "Failed to get Finished complaints.", "error");
}
});
});
@ -454,10 +563,7 @@ $(document).ready(function() {
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -490,8 +596,8 @@ $(document).ready(function() {
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true, // Enable default search functionality
select: false,
processing: false
@ -508,10 +614,7 @@ $(document).ready(function() {
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -544,8 +647,8 @@ $(document).ready(function() {
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
@ -640,6 +743,7 @@ function submitComplaint(button) {
return;
}
$('#pageLoader').show();
// AJAX Request
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/followupcalls/update',
@ -653,6 +757,7 @@ function submitComplaint(button) {
userId:userId
},
success: function (response) {
$('#pageLoader').hide();
if (response === "Success") {
Swal.fire({
icon: 'success',
@ -692,6 +797,7 @@ function submitComplaint(button) {
}
},
error: function (xhr, status, error) {
$('#pageLoader').hide();
$('.submitid').prop('disabled', false).text('Submit');
Swal.fire("Error", `An error occurred: ${xhr.responseText || error}`, "error");
}
@ -893,7 +999,17 @@ return detailsHtml;
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const today = new Date();
today.setDate(today.getDate() + 1); // Add 1 day to get tomorrow
const tomorrow = today.toISOString().split('T')[0];
document.querySelectorAll('.date-picker').forEach(function (input) {
input.setAttribute('min', tomorrow);
});
});
</script>
</body>
</html>

149
src/main/resources/templates/modules/callcenterqaqc/agentqaqcinprogresscalls.html

@ -327,7 +327,7 @@
</tr>
</thead>
<tbody>
<tr th:each="call, iterStat : ${inSubmitDetails}">
<!-- <tr th:each="call, iterStat : ${inSubmitDetails}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${call['complaint_number']}"
class="text-center complaint-select"></td>
@ -345,7 +345,7 @@
</td>
<td th:text="${call['call_status']}" class="text-center"></td>
<td th:text="${call['remarks']}" class="text-center"></td>
</tr>
</tr> -->
</tbody>
</table>
</div>
@ -364,6 +364,17 @@
</div>
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -433,7 +444,106 @@
$(this).addClass('btn-success').removeClass('btn-secondary');
$('#primaryButton').addClass('btn-secondary').removeClass('btn-success');
$('#SecondaryDatatable').DataTable().columns.adjust().draw();
//$('#SecondaryDatatable').DataTable().columns.adjust().draw();
let userId = document.getElementById('userIdSpan').textContent;
// Destroy previous instance if exists
if ($.fn.DataTable.isDataTable('#SecondaryDatatable')) {
$('#SecondaryDatatable').DataTable().clear().destroy();
}
$('#pageLoader').show();
// AJAX call to get data
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/inprogresscalls/getinprogresssubmittedcalls', // Replace with your controller URL
type: 'GET',
data: { userId: userId },
success: function (response) {
$('#pageLoader').hide();
// Initialize DataTable with new data
$('#SecondaryDatatable').DataTable({
data: response, // This should be an array of objects
columns: [
{ data: null, render: function (data, type, row, meta) { return meta.row + 1; }, className: "text-center" },
{ data: 'complaint_number', className: "text-center" },
{ data: 'complaint_date', className: "text-center" },
{ data: 'complaint_person_name', className: "text-center" },
{ data: 'complaint_mobilenumber', className: "text-center" },
{ data: 'complaint_type', className: "text-center" },
{
data: 'complaint_number',
className: "text-center",
render: function (data, type, row) {
return `<button type="button" class="btn btn-info" data-complaint-number="${data}">View</button>`;
}
},
{
data: 'call_status',
className: "text-center"
},
{
data: 'remarks',
className: "text-center"
}
],
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
scrollX:true,
buttons: [
{
extend: 'pageLength',
className: 'btn btn-warning'
},
{
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-secondary',
id: 'copyBtn'
},
{
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-secondary',
id: 'excelBtn'
},
{
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-secondary',
id: 'csvBtn'
},
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
id: 'pdfBtn'
}
],
fixedHeader: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
});
},
error: function () {
$('#pageLoader').hide();
Swal.fire("Error", "Failed to get Finished complaints.", "error");
}
});
});
@ -447,10 +557,7 @@
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -483,8 +590,8 @@
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: true
@ -500,10 +607,7 @@
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -536,8 +640,8 @@
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
@ -644,6 +748,7 @@
return;
}
$('#pageLoader').show();
// AJAX Request
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/inprogresscalls/update',
@ -657,6 +762,7 @@
userId:userId
},
success: function (response) {
$('#pageLoader').hide();
if (response === "Success") {
//console.log("inside ajax success");
Swal.fire({
@ -697,6 +803,7 @@
}
},
error: function (xhr, status, error) {
$('#pageLoader').hide();
$('.submitid').prop('disabled', false).text('Submit');
Swal.fire("Error", `An error occurred: ${xhr.responseText || error}`, "error");
}
@ -898,6 +1005,18 @@ return detailsHtml;
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const today = new Date();
today.setDate(today.getDate() + 1); // Add 1 day to get tomorrow
const tomorrow = today.toISOString().split('T')[0];
document.querySelectorAll('.date-picker').forEach(function (input) {
input.setAttribute('min', tomorrow);
});
});
</script>
</body>
</html>

151
src/main/resources/templates/modules/callcenterqaqc/agentqaqcpublicfollowupcalls.html

@ -331,7 +331,7 @@
</tr>
</thead>
<tbody>
<tr th:each="call, iterStat : ${fcSubmitDetails}">
<!-- <tr th:each="call, iterStat : ${fcSubmitDetails}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${call['complaint_number']}"
class="text-center complaint-select"></td>
@ -349,7 +349,7 @@
</td>
<td th:text="${call['call_status']}" class="text-center"></td>
<td th:text="${call['remarks']}" class="text-center"></td>
</tr>
</tr> -->
</tbody>
</table>
</div>
@ -366,6 +366,17 @@
</div>
</div>
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -440,8 +451,106 @@ $(document).ready(function() {
$('#secondaryTable').show();
$(this).addClass('btn-success').removeClass('btn-secondary');
$('#primaryButton').addClass('btn-secondary').removeClass('btn-success');
$('#SecondaryDatatable').DataTable().columns.adjust().draw();
$('#primaryButton').addClass('btn-secondary').removeClass('btn-success');
//$('#SecondaryDatatable').DataTable().columns.adjust().draw();
let userId = document.getElementById('userIdSpan').textContent;
// Destroy previous instance if exists
if ($.fn.DataTable.isDataTable('#SecondaryDatatable')) {
$('#SecondaryDatatable').DataTable().clear().destroy();
}
$('#pageLoader').show();
// AJAX call to get data
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/publicfollowupcalls/getpubsubmittedcalls',
type: 'GET',
data: { userId: userId },
success: function (response) {
$('#pageLoader').hide();
$('#SecondaryDatatable').DataTable({
data: response,
columns: [
{ data: null, render: function (data, type, row, meta) { return meta.row + 1; }, className: "text-center" },
{ data: 'complaint_number', className: "text-center" },
{ data: 'complaint_date', className: "text-center" },
{ data: 'complaint_person_name', className: "text-center" },
{ data: 'complaint_mobilenumber', className: "text-center" },
{ data: 'complaint_type', className: "text-center" },
{
data: 'complaint_number',
className: "text-center",
render: function (data, type, row) {
return `<button type="button" class="btn btn-info" data-complaint-number="${data}">View</button>`;
}
},
{
data: 'call_status',
className: "text-center"
},
{
data: 'remarks',
className: "text-center"
}
],
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
scrollX:true,
buttons: [
{
extend: 'pageLength',
className: 'btn btn-warning'
},
{
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-secondary',
id: 'copyBtn'
},
{
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-secondary',
id: 'excelBtn'
},
{
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-secondary',
id: 'csvBtn'
},
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
id: 'pdfBtn'
}
],
fixedHeader: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
});
},
error: function () {
$('#pageLoader').hide();
Swal.fire("Error", "Failed to get Finished complaints.", "error");
}
});
});
@ -456,10 +565,7 @@ $(document).ready(function() {
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -492,8 +598,8 @@ $(document).ready(function() {
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true, // Enable default search functionality
select: false,
processing: false
@ -510,10 +616,7 @@ $(document).ready(function() {
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX:true,
buttons: [
{
extend: 'pageLength',
@ -546,8 +649,8 @@ $(document).ready(function() {
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
@ -651,6 +754,8 @@ function submitComplaint(button) {
return;
}
$('#pageLoader').show();
// AJAX Request
$.ajax({
url: '/gcc/api/callcenterqaqc/agent/publicfollowupcalls/update',
@ -664,6 +769,7 @@ function submitComplaint(button) {
userId:userId
},
success: function (response) {
$('#pageLoader').hide();
if (response === "Success") {
//Validate cellnumber
@ -719,6 +825,7 @@ function submitComplaint(button) {
}
},
error: function (xhr, status, error) {
$('#pageLoader').hide();
$('.submitid').prop('disabled', false).text('Submit');
Swal.fire("Error", `An error occurred: ${xhr.responseText || error}`, "error");
}
@ -963,6 +1070,18 @@ function sendWhatsAppMessageReopened(name,complaintNumber,cellnumber,complaintTy
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const today = new Date();
today.setDate(today.getDate() + 1); // Add 1 day to get tomorrow
const tomorrow = today.toISOString().split('T')[0];
document.querySelectorAll('.date-picker').forEach(function (input) {
input.setAttribute('min', tomorrow);
});
});
</script>
</body>

477
src/main/resources/templates/modules/callcenterqaqc/pgrcomplaints.html

@ -129,6 +129,15 @@
border-radius: 4px;
}
/* Media query for mobile devices */
@media (max-width: 576px) {
#pac-input {
top: 55px;
z-index: 5;
}
}
#search-container {
position: absolute;
top: 10px;
@ -210,14 +219,14 @@
/* Initially hidden */
}
.row {
.row {
display: flex;
flex-wrap: wrap;
margin-bottom: 15px;
gap: 15px;
}
.col-md-6 {
.col-md-6 {
flex: 0 0 48%;
max-width: 48%;
display: flex;
@ -311,6 +320,10 @@ to {
}
}
.input-error {
border: 1px solid red !important;
}
/*for snack bar*/
</style>
<body>
@ -357,8 +370,11 @@ to {
<div class="row inside mt-4">
<div class="col-md-12">
<div class="col-md-12"><span th:text="${userId}" style="display:none;" id="userIdSpan"></span>
<div class="card" style="margin-top: 0px;">
<div class="card-header"><span th:text="${userId}" style="display:none;" id="userIdSpan"></span>
<h3 class="mb-0" style="font-weight: bold;font-size: large;"><span th:text="${agent[0]['agent_name']}" style="font-weight: bold;font-size: large;"></span>'s Complaints Registration</h3>
</div>
<div class="card-body">
@ -371,25 +387,30 @@ to {
<div class="form-row">
<div class="col-md-4">
<label for="mobile">Mobile Number:<span class="required">*</span></label>
<div class="input-group">
<input type="text" id="mobileNo" name="mobileNo"
class="form-control mb-1"
placeholder="Enter Mobile Number" maxlength="10"
minlength="10" required>
</div>
required>
</div>
</div>
<div class="form-row">
<div class="col-md-4">
<div class="col-md-4 mb-2">
<label for="name">Name:<span class="required">*</span></label>
<input type="text" class="form-control" id="name"
placeholder="Enter your name" required>
placeholder="Enter your name" required >
</div>
<div class="col-md-4">
<label for="gender" class="ml-4">Gender/பாலினம்:<span
<div class="col-md-4 mb-2">
<label for="email">Email:</label> <input type="email"
class="form-control" id="email"
placeholder="Enter your email">
</div>
<div class="col-md-4 mb-2">
<label for="gender" >Gender/பாலினம்:<span
class="required">*</span></label>
<div class="radio-group mt-2 ml-4">
<div class="radio-group mt-2 ">
<div class="radio-item">
<input type="radio" id="male" name="gender" value="male"
> <label for="male">Male</label>
@ -405,11 +426,6 @@ to {
</div>
</div>
<div class="col-md-4">
<label for="email">Email:</label> <input type="email"
class="form-control" id="email"
placeholder="Enter your email">
</div>
</div>
<button id="nextStep1" class="btn btn-primary float-right"
onclick="nextStep('nextStep1')"
@ -429,16 +445,16 @@ to {
<div class="col-md-12">
<!-- <div id="map"></div> -->
<div id="mapContainer" style="position: relative; height: 500px;">
<div id="mapContainer" style="position: relative; height: 500px;" class="mb-4 mt-2">
<input id="pac-input" class="controls" type="text" placeholder="Search location">
<div id="googleMap" style="height: 100%; width: 100%;"></div>
<div id="googleMap" style="height: 100%; width: 100%;border:2px solid black;"></div>
</div>
<div id="search-container">
<!-- <input type="text" id="search-box" placeholder="Search for a location..."> -->
<div id="suggestions"></div>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-6 mb-2">
<!-- <label for="street">Street:</label>
<input type="text" class="form-control" id="street"> -->
<label for="streetName">Street:</label>
@ -447,25 +463,25 @@ to {
<input type="text" class="form-control" id="streetName"> -->
</div>
<div class="col-md-6">
<div class="col-md-6 mb-2">
<!-- <label for="longitude_field">Longtitude</label>
<input type="text" class="form-control" id="longitude_field" name="longtitude"> -->
<label for="longitude_field">Longtitude</label>
<input type="text" class="form-control" id="longitude_field" readonly>
</div>
<div class="col-md-6">
<div class="col-md-6 mb-2">
<!-- <label for="latitude_field">Latitide</label>
<input type="text" class="form-control" id="latitude_field"> -->
<label for="latitude_field">Latitude</label>
<input type="text" class="form-control" id="latitude_field" readonly>
</div>
<div class="col-md-6">
<div class="col-md-6 mb-2">
<!-- <label for="street_id">Street Id</label>
<input type="text" class="form-control" id="street_id"> -->
<label for="streetId">Street Id</label>
<input type="text" class="form-control" id="streetId" readonly>
</div>
<div class="col-md-6">
<div class="col-md-6 mb-2">
<!-- <label for="landmark">Landmark</label>
<input type="text" class="form-control" id="landmark"> -->
<label for="landmark">Landmark</label>
@ -495,7 +511,7 @@ to {
<h5 class="card-title">3. Complaint Type:&nbsp;<span>(Please Select Complaint Type from Below...)</span></h5>
<!-- Icons -->
<div class="complaint-icons">
<!-- <div class="complaint-icons">
<div class="complaint-icon" data-type="specific"
data-id="112">
<img src="/gcc/assets/images/road.png" alt="Pothole">
@ -542,20 +558,20 @@ to {
<img src="/gcc/assets/images/dog.png" alt="dog">
<p>Street Dog</p>
</div>
<!--<div class="complaint-icon" data-type="specific" data-id="">
<div class="complaint-icon" data-type="specific" data-id="">
<img src="images/bad-weather.png" alt="weather">
<p>Tree Fallen</p>
</div>-->
</div>
<!-- <div class="complaint-icon" data-type="others">
<div class="complaint-icon" data-type="others">
<img src="/gcc/assets/images/menu.png" alt="Others">
<p>Others</p>
</div> -->
</div>
</div>
</div> -->
<!-- Specific Complaint Fields -->
<div class="complaint-fields active" id="specific-fields">
<!-- <div class="complaint-fields active" id="specific-fields">
<div class="form-row">
<div class="col-md-6">
<label for="complaint-title">Complaint Title:</label> <input
@ -585,7 +601,40 @@ to {
</div>
</div>
</div>
</div> -->
<!-- Specific Complaint Fields -->
<div class="complaint-fields active" id="specific-fields">
<div class="form-row">
<div class="col-md-6">
<label for="specificComplaintType">Complaint Type:</label>
<select class="form-control" id="specificComplaintType">
<option value="">-- Select Complaint Type --</option>
</select>
</div>
<div class="col-md-6">
<label for="specificComplaintSubType">Complaint Sub-Type:</label>
<select class="form-control" id="specificComplaintSubType" disabled>
<option value="">-- Select Complaint Sub-Type --</option>
</select>
</div>
</div>
<div class="form-row">
<div class="col-md-6">
<label for="specificComplaintDetails">Details of Complaint:</label>
<textarea class="form-control" id="specificComplaintDetails" rows="3"
placeholder="Enter complaint details" maxlength="400"></textarea>
</div>
<div class="col-md-6">
<label for="specificComplaintImage">Upload Photo:
<p style="color: orange;">Note: Upload Photo Less Than 1MB.</p>
</label>
<input type="file" class="form-control" id="specificComplaintImage" name="Comp_Image"
accept="image/*">
</div>
</div>
</div>
<!-- Others Complaint Fields -->
<div class="complaint-fields" id="others-fields">
@ -710,6 +759,17 @@ to {
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -740,6 +800,85 @@ to {
setTimeout(function () {snackbar.className = snackbar.className.replace("show", "");}, 3000);
}
$(document).ready(function () {
// Trigger on change
$('#mobileNo').on('change', validateMobileNumber);
$('#name').on('change', validateName);
// Optional: Allow only numeric input
$('#mobileNo').on('input', function () {
this.value = this.value.replace(/[^0-9]/g, '');
$(this).removeClass('input-error');
});
$('#name').on('input', function () {
this.value = this.value.replace(/[^a-zA-Z.\s]/g, ''); // allow letters, dot, and space
$(this).removeClass('input-error');
});
});
function validateName(){
const $inputname = $('#name');
const namefield = $('#name').val().trim();
$inputname.removeClass('input-error');
if (!/^[A-Za-z\s.]+$/.test(namefield)) {
showSnackbar("Name should contain only alphabets.");
$inputname.addClass('input-error');
return false;
}
return true;
}
function validateMobileNumber() {
const $input = $('#mobileNo');
const mobileStr = $('#mobileNo').val().trim();
console.log("mobileNo1=" + mobileStr);
// Reset previous error style
$input.removeClass('input-error');
if (mobileStr === '') {
showSnackbar("Mobile number is required.");
$input.addClass('input-error');
return false;
}
if (!/^\d{10}$/.test(mobileStr)) {
showSnackbar("Please enter a valid 10-digit mobile number.");
$input.addClass('input-error');
return false;
}
if (/^0{10}$/.test(mobileStr)) {
showSnackbar("Mobile number cannot be all zeros.");
$input.addClass('input-error');
return false;
}
if (mobileStr.startsWith('0')) {
showSnackbar("Mobile number cannot start with zero.");
$input.addClass('input-error');
return false;
}
if (/^(\d)\1{9}$/.test(mobileStr)) {
showSnackbar("Mobile number cannot have all digits the same.");
$input.addClass('input-error');
return false;
}
// All validations passed – remove error styling
$input.removeClass('input-error');
return true;
}
//for snackbar script
let currentStep = 1;
@ -806,6 +945,22 @@ to {
return false;
}
if (/^0{10}$/.test(mobileNo)) {
showSnackbar("Mobile number cannot be all zeros.");
return false;
}
if (mobileNo.startsWith('0')) {
showSnackbar("Mobile number cannot start with zero.");
return false;
}
if (/^(\d)\1{9}$/.test(mobileNo)) {
showSnackbar("Mobile number cannot have all digits the same.");
return false;
}
// Validate name
if (!name) {
isValid = false;
@ -813,6 +968,11 @@ to {
return false;
}
if (!/^[A-Za-z\s.]+$/.test(name)) {
showSnackbar("Name should contain only alphabets.");
return false;
}
// Validate gender
if (!gender) {
showSnackbar("Please select your gender.");
@ -820,7 +980,7 @@ to {
}
// Check email
if (email === '') {
email = 'N/A'; // Set N/A if empty
email = ''; // Set N/A if empty
$('#email').val(email); // Update the input field with N/A
} else if (!/^\S+@\S+\.\S+$/.test(email)) {
isValid = false;
@ -838,7 +998,7 @@ to {
// Validate street
if (!streets) {
isValid = false;
showSnackbar("Please enter the street.");
showSnackbar("Please Select a street.");
return false;
}
@ -880,7 +1040,7 @@ to {
const email = $('#email').val();
// Check if 'specific-fields' is active and use its values
if ($('#specific-fields').hasClass('active')) {
/* if ($('#specific-fields').hasClass('active')) {
const complaintTitle = $('#complaint-title').val();
const complaintid = $('#complaint-id').val();
const complaintDetails = $('#othercomplaint-details').val(); // Specific complaint details
@ -897,7 +1057,17 @@ to {
$('#summaryComplaintTitle').text(complaintTitle + ' - ' + complaintSubType);
$('#summaryComplaintType').text('Other Complaint');
$('#summaryDescription').text(complaintDetails);
}
} */
const complaintTitle = $('#specificComplaintType option:selected').text(); // groupname
const complaintType = $('#specificComplaintSubType option:selected').text(); // complaintname
const complaintDetails = $('#specificComplaintDetails').val(); // Others complaint details
$('#summaryComplaintTitle').text(complaintTitle); // group
$('#summaryComplaintType').text(complaintType); // sub-type
$('#summaryDescription').text(complaintDetails);
//const streetid = $('#street_id').val();
@ -930,8 +1100,8 @@ to {
// If there's a separate image input for the specific form, handle it similarly:
// Check if specific fields section is active
if ($('#specific-fields').hasClass('active')) {
const specificFileInput = $('#complaint-image')[0]; // Example ID for specific form
// if ($('#specific-fields').hasClass('active')) {
const specificFileInput = $('#specificComplaintImage')[0]; // Example ID for specific form
if (specificFileInput.files && specificFileInput.files[0]) {
const reader = new FileReader();
reader.onload = function (e) {
@ -941,9 +1111,9 @@ to {
} else {
$('#summaryImage').hide(); // Hide the image if no file is selected
}
}
// }
// Check if "Others" section is active
else if ($('#others-fields').hasClass('active')) {
if ($('#others-fields').hasClass('active')) {
const fileInput = $('#uploadothers')[0]; // Assuming this is for the "Others" section
if (fileInput.files && fileInput.files[0]) {
const reader = new FileReader();
@ -966,13 +1136,11 @@ to {
$(document).ready(function () {
showStep(currentStep);
});
$(document).ready(function () {
showStep(currentStep);
});
@ -981,7 +1149,7 @@ to {
//for step3 onclick function
$(document).ready(function () {
// On icon click
$('.complaint-icon').click(function () {
/* $('.complaint-icon').click(function () {
const type = $(this).data('type'); // Get the type (specific or others)
const title = $(this).find('p').text().trim(); // Get the icon name (complaint title)
const complaintId = $(this).data('id'); // Get the complaint ID
@ -1000,13 +1168,16 @@ to {
$('#complaint-title').val(''); // Clear the complaint title for 'Others'
$('#complaint-id').val(''); // Clear the complaint ID for 'Others'
}
});
}); */
});
//for complaint group and complainttype wise options dropdown api
$(document).ready(function () {
/* $(document).ready(function () {
const $type = $('#type');
const $subType = $('#sub-type');
@ -1066,7 +1237,7 @@ to {
$subType.prop('disabled', true);
}
});
});
}); */
//api for saving
//for sweet alert
@ -1211,8 +1382,15 @@ to {
document.getElementById("streetId").value = "";
document.getElementById("landmark").value = "";
fetch(streetURL)
.then(res => res.json())
// Timeout mechanism: 1 seconds
const timeout = new Promise((_, reject) =>
setTimeout(() => reject(new Error("Request timed out")), 1000)
);
// Actual fetch
const fetchRequest = fetch(streetURL).then(res => res.json());
Promise.race([fetchRequest, timeout])
.then(data => {
const features = data.features;
if (!features || features.length === 0) {
@ -1224,7 +1402,7 @@ to {
return;
}
streetsList = features.map(f => f.properties); // ✅ Save for use in dropdown
streetsList = features.map(f => f.properties); //Save for use in dropdown
streetsList.forEach((props, index) => {
const option = document.createElement("option");
option.value = index;
@ -1387,8 +1565,8 @@ to {
var complainantAddr = $('#summaryStreet').text().trim();
var mobileNo = $('#summaryMobile').text().trim();
var email = $('#summaryEmail').text().trim();
var complaintType = $('#summaryComplaintType').text().trim();
var complaintTitle = $('#summaryComplaintTitle').text().trim();
var complaintType = $('#specificComplaintSubType').val();
var complaintTitle = $('#specificComplaintSubType option:selected').text();
var complaintDetails = $('#summaryDescription').text().trim();
var streetId = $('#summaryStreetId').text().trim();
var landmark = $('#summaryLandmark').text().trim();
@ -1396,8 +1574,9 @@ to {
var longtitude = $('#summaryLongitude').text().trim(); // Note the misspelling
var gender = $('#summaryGender').text().trim();
var imageSrc = $('#summaryImage').attr('src');
var userId = document.getElementById('userIdSpan').textContent;
/* console.log({
console.log({
ComplainantName: complainantName,
ComplainantAddr: complainantAddr,
MobileNo: mobileNo,
@ -1410,8 +1589,9 @@ to {
latitude: latitude,
longtitude: longtitude,
Landmark: landmark,
gender: gender
}); */
gender: gender,
userId:userId
});
// AJAX call to your backend controller
$.ajax({
@ -1430,7 +1610,8 @@ to {
latitude: latitude,
longtitude: longtitude,
Landmark: landmark,
gender: gender
gender: gender,
userId:userId
},
success: function (response) {
$('#submitButton').prop('disabled', false).text('Submit');
@ -1440,44 +1621,51 @@ to {
if (typeof response === "string") {
try {
response = JSON.parse(response);
} catch (error) {
console.error("Failed to parse response:", error);
}
}
let complaintNumber = response["complaintNumber"];
if (!complaintNumber || complaintNumber === "null" || complaintNumber === null) {
complaintNumber = "N/A";
}
try {
response = JSON.parse(response);
}
catch (error) {
console.error("Failed to parse response:", error);
Swal.fire("Error", "Unexpected response from server.", "error");
return;
}
}
if (response.complaintNumber) {
let complaintNumber = response.complaintNumber;
Swal.fire({
title: 'Success!',
text: `Your complaint has been submitted successfully. Your Complaint Number is ${complaintNumber}. It will be sent to your mobile number.`,
icon: 'success',
allowOutsideClick: false, // Disable clicking outside the modal to close it
allowEscapeKey: false, // Disable escape key to close the modal
allowEnterKey: false, // Disable enter key to close the modal
showConfirmButton: true, // Ensure the confirm button is visible
confirmButtonText: 'OK'
}).then(result => {
if (result.isConfirmed) {
location.reload();
}
});
} else {
Swal.fire("Error", "Complaint number not received. Please try again.", "error");
}
Swal.fire({
title: 'Success!',
text: `Your complaint has been submitted successfully. Your Complaint Number is ${complaintNumber}. It will be sent to your mobile number.`,
icon: 'success',
allowOutsideClick: false, // Disable clicking outside the modal to close it
allowEscapeKey: false, // Disable escape key to close the modal
allowEnterKey: false, // Disable enter key to close the modal
showConfirmButton: true, // Ensure the confirm button is visible
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
location.reload();
}
});
},
error: function (xhr, status, error) {
// Improved error handling
$('#submitButton').prop('disabled', false).text('Submit');
console.log('Error:', xhr.responseText, status, error);
//alert('Error: ' + xhr.status + ' ' + xhr.statusText);
Swal.fire({
title: 'Error!',
text: 'Submission failed. Please try again.',
icon: 'error'
});
error: function (xhr) {
$('#submitButton').prop('disabled', false).text('Submit');
let message = "Submission failed. Please try again.";
try {
const res = JSON.parse(xhr.responseText);
if (res.error) {
message = res.error;
}
} catch (e) {
console.error("Error parsing error response:", e);
}
Swal.fire("Error", message, "error");
}
});
});
@ -1829,52 +2017,56 @@ to {
$('#nextStep3').off('click').on('click', function (e) {
e.preventDefault();
//const complaint_Title = $('#complaint-title').val().trim();
const complaint_Type = $('#complaint-id').val();
let complaintId = '';
let complaintTitle = '';
const selectedGroupId1 = $(specificComplaintType).val();
const selectedSubGroupId1=$(specificComplaintSubType).val();
if (!selectedGroupId1) {
Swal.fire({
icon: 'warning',
title: 'Complaint Type Required',
text: 'Please select a complaint type before continuing.',
confirmButtonText: 'OK'
});
return;
}
if (!complaint_Type) {
if (!selectedSubGroupId1) {
Swal.fire({
icon: 'warning',
title: 'Missing Information',
text: 'Please Select Complaint Type.',
title: 'Complaint Sub Type Required',
text: 'Please select a complaint sub type before continuing.',
confirmButtonText: 'OK'
});
return; // Stop further execution
return;
}
const shareMobile = $('input[name="shareMobile"]:checked').val();
//const shareMobile = $('input[name="shareMobile"]:checked').val();
const mobileNo = $('#mobileNo').val().trim();
const streetName = $('#streetName option:selected').text().trim().toLowerCase();
if (shareMobile === 'no' || mobileNo === '') {
/* if (shareMobile === 'no' || mobileNo === '') {
nextStep(); // Skip duplicate check if mobile not shared
return;
}
} */
let complaintId = '';
let complaintTitle = '';
if ($('#specific-fields').hasClass('active')) {
complaintId = $('#complaint-id').val().trim();
complaintTitle = complaintTypeMap[complaintId] || "Selected complaint";
} else if ($('#others-fields').hasClass('active')) {
console.log("other fields...");
complaintId = $('#sub-type option:selected').val().trim(); // ✅ send ID
console.log("complaintId... "+complaintId);
//complaintId = $('#sub-type').val().trim(); // ✅ send ID
complaintTitle = $('#sub-type option:selected').text().trim(); // readable for alert
}
complaintId = selectedSubGroupId1;
console.log("Checking for duplicate:", { complaintId, complaintTitle, streetName });
const backendUrl = `/gcc/api/callcenterqaqc/pgrcomplaint/checktypeforduplicate?mobileNo=${mobileNo}&complaintId=${complaintId}&streetName=${encodeURIComponent(streetName)}`;
$('#pageLoader').show();
$.get(backendUrl, function (response) {
$('#pageLoader').hide();
const subTypeText = $('#specificComplaintSubType option:selected').text();
if (response.duplicate) {
Swal.fire({
icon: 'warning',
title: 'Duplicate Complaint Found',
text: `A similar complaint like "${complaintTitle}" already exists for this street within the last 7 days.`,
text: `A similar complaint like "${subTypeText}" already exists for this street within the last 7 days.`,
confirmButtonText: 'OK',
allowOutsideClick: false
}).then(() => {
@ -1884,6 +2076,7 @@ to {
nextStep();
}
}).fail(function () {
$('#pageLoader').hide();
Swal.fire({
icon: 'error',
title: 'Error',
@ -1894,6 +2087,58 @@ to {
});
let complaintGroups = [];
$(document).ready(function () {
loadComplaintTypes();
$('#specificComplaintType').on('change', function () {
const selectedGroupId = $(this).val();
const $subTypeDropdown = $('#specificComplaintSubType');
// Clear previous options
$subTypeDropdown.empty().append('<option value="">-- Select Complaint Sub-Type --</option>');
// Find the group based on groupid
const selectedGroup = complaintGroups.find(g => g.groupid === selectedGroupId);
if (selectedGroup && selectedGroup.group && selectedGroup.group.length > 0) {
selectedGroup.group.forEach(sub => {
$subTypeDropdown.append(
`<option value="${sub.id}">${sub.complaintname}</option>`
);
});
$subTypeDropdown.prop('disabled', false);
} else {
$subTypeDropdown.prop('disabled', true);
}
});
});
function loadComplaintTypes() {
$.ajax({
url: "/gcc/api/callcenterqaqc/pgrcomplaint/getComplaintCategories",
dataType: "json",
type: "GET",
success: function (res) {
complaintGroups = res?.ComplaintCategoryListResult || [];
const $typeDropdown = $('#specificComplaintType');
$typeDropdown.empty().append('<option value="">-- Select Complaint Type --</option>');
complaintGroups.forEach(group => {
$typeDropdown.append(
`<option value="${group.groupid}">${group.groupname}</option>`
);
});
},
error: function (xhr, status, error) {
console.error("Error loading complaint categories:", status, error);
}
});
}
/* html: `Your complaint has been submitted successfully. Your Complaint Number is <strong>${complaintNumber}</strong>. It will be sent to your mobile number.`, */
</script>
</body>

29
src/main/resources/templates/modules/callcenterqaqc/qaqcadminsettings.html

@ -209,7 +209,7 @@
</table>
<!-- Center the Submit button -->
<div class="text-center">
<div class="text-center mt-2">
<button type="button" class="btn btn-primary" id="submitBtn">Click to Assign</button>
</div>
</div>
@ -223,6 +223,17 @@
</div>
</div>
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only">Loading...</span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
@ -339,10 +350,8 @@
[ '200 rows','500 rows', 'Show all']
],
scrollY: '80vh',
fixedColumns: {
left: 1,
right: 1
},
scrollX: true,
buttons: [
{
extend: 'pageLength',
@ -375,8 +384,8 @@
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
autoWidth: false,
responsive: false,
searching: true,
select: false,
processing: false
@ -488,6 +497,7 @@
return; // Stop further execution
}
$('#pageLoader').show();
// Send the selected agents and their calling types to the API
$.ajax({
type: "POST",
@ -495,6 +505,7 @@
data: JSON.stringify(selectedAgents),
contentType: "application/json",
success: function (response) {
$('#pageLoader').hide();
// Success: Show success message with Swal
Swal.fire({
icon: 'success',
@ -506,6 +517,7 @@
});
},
error: function (error) {
$('#pageLoader').hide();
// Error: Show error message with Swal
Swal.fire({
icon: 'error',
@ -542,6 +554,7 @@
// Prepare the data to send
const data = { productivity_count: productivityCount };
$('#pageLoader').show();
// Send the data to the API using AJAX
$.ajax({
type: "POST",
@ -549,6 +562,7 @@
data: JSON.stringify(data),
contentType: "application/json",
success: function (response) {
$('#pageLoader').hide();
// Show a success message using Swal
Swal.fire({
icon: 'success',
@ -561,6 +575,7 @@
});
},
error: function (error) {
$('#pageLoader').hide();
// Show an error message using Swal
Swal.fire({
icon: 'error',

68
src/main/resources/templates/modules/callcenterqaqc/qaqcgrievancedashboard.html

@ -37,61 +37,61 @@
}
#closedCard {
transition: transform 0.2s ease; /* Smooth scaling transition */
cursor: pointer; /* Default cursor change */
transition: transform 0.2s ease;
cursor: pointer;
}
#closedCard:hover {
transform: scale(1.05); /* Slightly scale up on hover */
cursor: pointer; /* Change cursor to hand symbol */
transform: scale(1.05);
cursor: pointer;
}
#inProgressCard {
transition: transform 0.2s ease; /* Smooth scaling transition */
cursor: pointer; /* Default cursor change */
/* #inProgressCard {
transition: transform 0.2s ease;
cursor: pointer;
}
#inProgressCard:hover {
transform: scale(1.05); /* Slightly scale up on hover */
cursor: pointer; /* Change cursor to hand symbol */
}
transform: scale(1.05);
cursor: pointer;
} */
#redressedCard {
transition: transform 0.2s ease; /* Smooth scaling transition */
cursor: pointer; /* Default cursor change */
transition: transform 0.2s ease;
cursor: pointer;
}
#redressedCard:hover {
transform: scale(1.05); /* Slightly scale up on hover */
cursor: pointer; /* Change cursor to hand symbol */
transform: scale(1.05);
cursor: pointer;
}
#reopenedCard {
transition: transform 0.2s ease; /* Smooth scaling transition */
cursor: pointer; /* Default cursor change */
/* #reopenedCard {
transition: transform 0.2s ease;
cursor: pointer;
}
#reopenedCard:hover {
transform: scale(1.05); /* Slightly scale up on hover */
cursor: pointer; /* Change cursor to hand symbol */
}
transform: scale(1.05);
cursor: pointer;
} */
#withdrawCard{
transition: transform 0.2s ease; /* Smooth scaling transition */
cursor: pointer; /* Default cursor change */
/* #withdrawCard{
transition: transform 0.2s ease;
cursor: pointer;
}
#withdrawCard:hover {
transform: scale(1.05); /* Slightly scale up on hover */
cursor: pointer; /* Change cursor to hand symbol */
}
transform: scale(1.05);
cursor: pointer;
} */
#closedCard {
transition: transform 0.2s ease; /* Smooth scaling transition */
cursor: pointer; /* Default cursor change */
transition: transform 0.2s ease;
cursor: pointer;
}
#closedCard:hover {
transform: scale(1.05); /* Slightly scale up on hover */
cursor: pointer; /* Change cursor to hand symbol */
transform: scale(1.05);
cursor: pointer;
}
</style>
@ -784,7 +784,7 @@ function loadDashboardData(startDate, endDate) {
document.getElementById('closedCard').addEventListener('click', function () {
handleCardClick(sessionStorage.getItem('closedcount'), 'Closed', '/gcc/callcenterqaqc/admin/qaqcassigntaskagents');
});
/*
document.getElementById('reopenedCard').addEventListener('click', function () {
handleCardClick(sessionStorage.getItem('reopenedcount'), 'Reopened', '/gcc/callcenterqaqc/admin/qaqcassigntaskagents');
});
@ -792,15 +792,15 @@ function loadDashboardData(startDate, endDate) {
document.getElementById('inProgressCard').addEventListener('click', function () {
handleCardClick(sessionStorage.getItem('inProgressCount'), 'In Progress', '/gcc/callcenterqaqc/admin/qaqcassigntaskagents');
});
*/
document.getElementById('redressedCard').addEventListener('click', function () {
handleCardClick(sessionStorage.getItem('redressedCount'), 'Redressed', '/gcc/callcenterqaqc/admin/qaqcassigntaskagents');
});
/*
document.getElementById('withdrawCard').addEventListener('click', function () {
handleCardClick(sessionStorage.getItem('withdrawCount'), 'withdraw', '/gcc/callcenterqaqc/admin/qaqcassigntaskagents');
});
*/
// Update UI with fetched data
document.getElementById('totalComplaints').textContent = data["Total Complaints"] || "0";
document.getElementById('inProgressCount').textContent = data["In Progress"] || "0";

57
src/main/resources/templates/modules/callcenterqaqc/socialmediacomplaints.html

@ -124,6 +124,17 @@
<input type="date" id="endDate" class="form-control">
</div>
<div class="col-sm-2 mb-2">
<label for="regiondropdown" style="font-size: medium;">Region:</label>
<select id="regiondropdown" class="form-control">
<option value="">Select</option>
<option value="North Region">North Region</option>
<option value="Central Region">Central Region</option>
<option value="South Region">South Region</option>
</select>
</div>
<div class="col-sm-2 mb-2">
<label for="stsdropdown" style="font-size: medium;">Status:</label>
<select id="stsdropdown" class="form-control">
@ -283,6 +294,8 @@
const complaintGroupDropdown = document.getElementById('dropdown4');
const complaintModeDropdown = document.getElementById('dropdown3');
const complaintZoneDropdown = document.getElementById('dropdown2');
const regionDropdown = document.getElementById('regiondropdown');
let allZones = [];
// Load Complaint Groups
fetch('/gcc/api/callcenterqaqc/getComplaintGroup')
@ -327,21 +340,40 @@
});
// Load all zones
// Load all zones and store them globally
fetch('/gcc/api/callcenterqaqc/getZones')
.then(response => response.json())
.then(data => {
// Clear existing options
.then(response => response.json())
.then(data => {
allZones = data; // Store zones globally
updateZoneDropdown(); // Populate zones initially
})
.catch(error => console.error('Error fetching complaint zones:', error));
// Event Listener for Region Dropdown Change
regionDropdown.addEventListener('change', updateZoneDropdown);
// Function to update Zone Dropdown based on Region selection
function updateZoneDropdown() {
const selectedRegion = regionDropdown.value;
complaintZoneDropdown.innerHTML = `<option value="">Select</option>`;
// Add options from the API response
data.forEach(complaintZone => {
complaintZoneDropdown.innerHTML += `<option value="${complaintZone}">${complaintZone}</option>`;
let filteredZones = [];
if (selectedRegion === "North Region") {
filteredZones = allZones.filter(zone => zone >= "N01" && zone <= "N05");
} else if (selectedRegion === "Central Region") {
filteredZones = allZones.filter(zone => zone >= "N06" && zone <= "N10");
} else if (selectedRegion === "South Region") {
filteredZones = allZones.filter(zone => zone >= "N11" && zone <= "N15");
} else {
// Show all if no region is selected
filteredZones = allZones;
}
filteredZones.forEach(zone => {
complaintZoneDropdown.innerHTML += `<option value="${zone}">${zone}</option>`;
});
})
.catch(error => {
console.error('Error fetching complaint groups:', error);
});
}
const today = new Date();
const year = today.getFullYear();
@ -485,12 +517,14 @@
let group= document.getElementById('dropdown4').value;
let type= document.getElementById('dropdown1').value;
let zone= document.getElementById('dropdown2').value;
let region=document.getElementById('regiondropdown').value;
console.log("startdate: ",startDate);
console.log("enddate: ",endDate);
console.log("status: ",status);
console.log("group: ",group);
console.log("type: ",type);
console.log("region: ",region);
console.log("zone: ",zone);
if (!startDate && !endDate) {
@ -510,6 +544,7 @@
status: status,
group: group,
type: type,
region:region,
zone: zone
});
$('#pageLoader').show();

292
src/main/resources/templates/modules/cdwaste/approval.html

@ -1,6 +1,58 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<style>
/* Main container */
.container {
display: flex;
flex-direction: column;
gap: 15px;
width: 100%;
}
/* Row container to align 2 fields per row */
.labelitems {
display: flex;
justify-content: space-between; /* Evenly distributes fields */
gap: 15px;
}
/* Individual field wrapper */
.field-container {
display: flex;
align-items: center;
flex: 1; /* Ensures equal spacing */
}
/* Label styling */
.field-label {
width: 120px;
font-weight: bold;
font-size:14px;
}
/* Input box styling */
.field-input {
width: 200px; /* Adjusted width */
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
font-size: 14px;
}
.modal-body {
max-height: 70vh;
overflow-y: auto;
overflow-x: hidden;
padding-right: 15px;
}
</style>
<body>
<div class="wrapper">
<!-- Header -->
@ -39,9 +91,9 @@
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<div class="card-header" >
<h5 style="font-weight:bold;">Approved List</h5>
</div>
<div class="card-block">
@ -49,43 +101,38 @@
<table id="worksDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th> <!-- Auto-increment index -->
<th>Name</th>
<th>Mobile No</th>
<th>Address</th>
<th>Vehicle Number</th>
<th>Vehicle Type</th>
<th>Accepted Date</th>
<th>Accepted By</th>
<th>Register ID</th>
<th class="text-center">S.No</th> <!-- Auto-increment index -->
<th class="text-center">Name</th>
<th class="text-center">Mobile No</th>
<th class="text-center">Address</th>
<th class="text-center">Vehicle Number</th>
<th class="text-center">Vehicle Type</th>
<!-- <th class="text-center">Accepted Date</th> -->
<th class="text-center">Accepted By</th>
<th class="text-center">Register ID</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr th:each="approval, i : ${approvalDetails}">
<td th:text="${i.count}">0</td> <!-- Index counter -->
<td th:text="${approval.name}">Name</td>
<td th:text="${approval.mobile_no}">Mobile No</td>
<td th:text="${approval.address}">Address</td>
<td th:text="${approval.vehicle_num}">Vehicle Number</td>
<td th:text="${approval.vehicletype}">Vehicle Type</td>
<td th:text="${approval.accepteddate}">Accepted Date</td>
<td th:text="${approval.acceptedby}">Accepted By</td>
<td th:text="${approval.register_id}">Register ID</td>
<td class="text-center" th:text="${i.count}">0</td> <!-- Index counter -->
<td class="text-center" th:text="${approval.name}">Name</td>
<td class="text-center" th:text="${approval.mobile_no}">Mobile No</td>
<td class="text-center" th:text="${approval.address}">Address</td>
<td class="text-center" th:text="${approval.vehicle_num}">Vehicle Number</td>
<td class="text-center" th:text="${approval.vehicletype}">Vehicle Type</td>
<!-- <td class="text-center" th:text="${approval.accept}">Accepted Date</td> -->
<td class="text-center" th:text="${approval.acceptedby}">Accepted By</td>
<td class="text-center" th:text="${approval.register_id}">Register ID</td>
<td class="text-center">
<button class="btn btn-info"
th:attr="onclick='showModal(' + ${approval['register_id']} + ')'"
th:text="'View Details'">
</button>
</td>
</tr>
</tbody>
<tfoot class="thead-dark">
<tr>
<th>S.No</th>
<th>Name</th>
<th>Mobile No</th>
<th>Address</th>
<th>Vehicle Number</th>
<th>Vehicle Type</th>
<th>Accepted Date</th>
<th>Accepted By</th>
<th>Register ID</th>
</tr>
</tfoot>
</table>
</div>
</div>
@ -93,6 +140,55 @@
</div>
</div>
</div>
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="detailModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="detailModalLabel">Register id: <span id="modal_register_id"></span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="cduserinfoHTML">
</div>
<hr>
<div class="row labelitems">
<div class="col-md-12">
<p><strong>Adhaar Photo/Document:</strong></p>
<div id="modal_adhaar_container"></div>
</div>
<div class="col-md-12">
<p><strong>User Photo:</strong></p>
<div id="modal_user_photo_container"></div>
</div>
<div class="col-md-12">
<p><strong>RC Book Document:</strong></p>
<div id="modal_vehicle_doc_container"></div>
</div>
<div class="col-md-12">
<p><strong>Lease Vehicle Document:</strong></p>
<div id="modal_leasevehicle_doc_container"></div>
</div>
</div>
<!-- Rejection Section -->
<!--<div id="rejectionSection" style="display: none; margin-top: 20px;">
<p><strong>Reason for Rejection <span class="text-danger">*</span></strong></p>
<textarea id="rejectionReason" rows="4" class="form-control"></textarea>
<button type="button" class="btn btn-danger mt-2" onclick="confirmRejection()">Confirm</button>
</div> -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
@ -164,11 +260,141 @@
});
//function to show the view details
function showModal(registerId) {
$.ajax({
url: '/gcc/api/registration/pendingbyid?registerId=' + registerId,
method: 'GET',
dataType: 'json',
success: function(data) {
console.log(data);
// Check if data is not empty
if (data.length > 0) {
// Access the first item in the array
const userData = data[0]; // Get the first object from the array
const formattedAcceptedDate = userData.accepteddate ? userData.accepteddate.split('T')[0] : '';
let userinfo = `
<div style="display: flex; flex-direction: column; gap: 15px;">
<div class="container">
<!-- First Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Name:</label>
<input type="text" id="modal_name" value="${userData.name}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Mobile No:</label>
<input type="text" id="modal_mobile_no" value="${userData.mobile_no}" readonly class="field-input">
</div>
</div>
<!-- Second Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Address:</label>
<input type="text" id="modal_address" value="${userData.address}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Vehicle No:</label>
<input type="text" id="modal_vehicle_num" value="${userData.vehicle_num}" readonly class="field-input">
</div>
</div>
<!-- Third Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Vehicle Type:</label>
<input type="text" id="modal_vehicletype" value="${userData.vehicletype}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Ref Num:</label>
<input type="text" id="modal_ref_num" value="${userData.reference_num}" readonly class="field-input">
</div>
</div>
<!-- Fourth Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Accepted Date:</label>
<input type="date" id="modal_accepteddate" value="${formattedAcceptedDate}" readonly class="field-input">
</div>
</div>
</div>
</div>`;
$("#cduserinfoHTML").html(userinfo);
$("#modal_register_id").html(userData.register_id);
console.log(userData.adhaarurl);
// Display the files (Adhaar, User Photo, Vehicle Document)
if (userData.adhaarurl!=null) {
displayFile('modal_adhaar_container', userData.adhaarurl);
}
if (userData.user_photourl) {
displayFile('modal_user_photo_container', userData.user_photourl);
}
if (userData.rcbookurl) {
displayFile('modal_vehicle_doc_container', userData.rcbookurl);
}
if (userData.leasedocurl) {
displayFile('modal_leasevehicle_doc_container', userData.leasedocurl);
}
// Hide rejection section initially
/* document.getElementById('rejectionSection').style.display = 'none';
document.getElementById('rejectionReason').value = ''; // Clear previous input */
// Show the modal
$('#detailModal').modal({
backdrop: 'static',
keyboard: false
});
} else {
// Handle case where no data is returned
alert('No data found for this registration ID.');
}
},
error: function(err) {
console.error(err);
alert('Failed to fetch data');
}
});
}
//display file function
function displayFile(containerId, filePath) {
const container = document.getElementById(containerId);
// Ensure the container exists before proceeding
if (!container) {
console.error(`Element with ID '${containerId}' not found.`);
return;
}
// Ensure filePath is valid before attempting to display
if (!filePath) {
container.innerHTML = '<p class="text-danger">No document available</p>';
return;
}
const fileExtension = filePath.split('.').pop().toLowerCase();
console.log('Full Path:', filePath);
if (fileExtension === 'pdf') {
container.innerHTML = `<embed src="${filePath}" type="application/pdf" width="100%" height="500px" />`;
} else {
container.innerHTML = `<img src="${filePath}" alt="Document" class="img-fluid img-thumbnail" />`;
}
}
</script>
</body>

163
src/main/resources/templates/modules/cdwaste/pending.html

@ -1,6 +1,57 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<style>
/* Main container */
.container {
display: flex;
flex-direction: column;
gap: 15px;
width: 100%;
}
/* Row container to align 2 fields per row */
.labelitems {
display: flex;
justify-content: space-between; /* Evenly distributes fields */
gap: 15px;
}
/* Individual field wrapper */
.field-container {
display: flex;
align-items: center;
flex: 1; /* Ensures equal spacing */
}
/* Label styling */
.field-label {
width: 120px;
font-weight: bold;
font-size:14px;
}
/* Input box styling */
.field-input {
width: 200px; /* Adjusted width */
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
font-size: 14px;
}
.modal-body {
max-height: 70vh;
overflow-y: auto; /* Enables vertical scrolling */
overflow-x: hidden; /* Hides horizontal scrolling */
padding-right: 15px; /* Prevents content cutoff */
}
</style>
<body>
<div class="wrapper">
<!-- Header -->
@ -41,22 +92,20 @@
<div class="card">
<div class="card-header">
<h5 style="font-weight:bold;"> Pending List</h5>
</div>
<div class="card-block">
<!-- Show the table structure -->
<table id="worksDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.NO</th> <!-- Auto-incrementing index -->
<th>Name</th>
<th>Mobile No</th>
<th>Address</th>
<th>Actions</th>
<th class="text-center">S.NO</th> <!-- Auto-incrementing index -->
<th class="text-center">Name</th>
<th class="text-center">Mobile No</th>
<th class="text-center">Address</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
@ -64,10 +113,10 @@
<!-- Iterate over userDetails to display pending registrations -->
<tr th:each="pendinglist, status : ${userDetails}">
<td th:text="${status.index + 1}">1</td> <!-- Auto-incrementing index -->
<td th:text="${pendinglist['name']}">Name</td>
<td th:text="${pendinglist['mobile_no']}">Mobile No</td>
<td th:text="${pendinglist['address']}">Address</td>
<td class="text-center" th:text="${status.index + 1}">1</td> <!-- Auto-incrementing index -->
<td class="text-center" th:text="${pendinglist['name']}">Name</td>
<td class="text-center" th:text="${pendinglist['mobile_no']}">Mobile No</td>
<td class="text-center" th:text="${pendinglist['address']}">Address</td>
<td class="text-center">
<button class="btn btn-info"
th:attr="onclick='showModal(' + ${pendinglist['register_id']} + ')'"
@ -76,15 +125,7 @@
</td>
</tr>
</tbody>
<tfoot class="thead-dark">
<tr>
<th>S.NO</th>
<th>Name</th>
<th>Mobile No</th>
<th>Address</th>
<th>Actions</th>
</tr>
</tfoot>
</table>
</div>
@ -99,7 +140,7 @@
<!-- Modal -->
<!-- Modal -->
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="detailModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="detailModalLabel">Register id: <span id="modal_register_id"></span></h5>
@ -110,26 +151,30 @@
<div class="modal-body">
<div id="cduserinfoHTML">
</div>
<div class="row">
<hr>
<div class="row labelitems" >
<div class="col-md-12">
<p><strong>Adhaar Photo/Document:</strong></p>
<div id="modal_adhaar_container"></div>
</div>
<div class="col-md-12">
<p><strong>User Photo:</strong></p>
<div id="modal_user_photo_container"></div>
</div>
<div class="col-md-12">
<p><strong>RC Book Document:</strong></p>
<div id="modal_vehicle_doc_container"></div>
</div>
<div class="col-md-12">
<p><strong>Lease Vehicle Document:</strong></p>
<div id="modal_leasevehicle_doc_container"></div>
</div>
</div>
<!-- Rejection Section -->
<div id="rejectionSection" style="display: none; margin-top: 20px;">
<p><strong>Reason for Rejection <span class="text-danger">*</span></strong></p>
@ -138,8 +183,8 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" onclick="acceptAction()">Accept</button>
<button type="button" class="btn btn-warning" onclick="showRejectionSection()">Reject</button>
<button type="button" class="btn btn-success" onclick="acceptAction()" id="acceptbutton">Accept</button>
<button type="button" class="btn btn-warning" onclick="showRejectionSection()" id="rejectbutton">Reject</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
@ -237,14 +282,50 @@
// Access the first item in the array
const userData = data[0]; // Get the first object from the array
let userinfo = ``;
let userinfo = `
<div style="display: flex; flex-direction: column; gap: 15px;">
<div class="container">
<!-- First Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Name:</label>
<input type="text" id="modal_name" value="${userData.name}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Mobile No:</label>
<input type="text" id="modal_mobile_no" value="${userData.mobile_no}" readonly class="field-input">
</div>
</div>
<!-- Second Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Address:</label>
<input type="text" id="modal_address" value="${userData.address}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Vehicle No:</label>
<input type="text" id="modal_vehicle_num" value="${userData.vehicle_num}" readonly class="field-input">
</div>
</div>
<!-- Third Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Vehicle Type:</label>
<input type="text" id="modal_vehicletype" value="${userData.vehicletype}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Ref Num:</label>
<input type="text" id="modal_ref_num" value="${userData.reference_num}" readonly class="field-input">
</div>
</div>
</div>
</div>`;
userinfo = `<p><strong>Name:</strong> <span id="modal_name">${userData.name}</span></p>
<p><strong>Mobile No:</strong> <span id="modal_mobile_no">${userData.mobile_no}</span></p>
<p><strong>Address:</strong> <span id="modal_address">${userData.address}</span></p>
<p><strong>Vehicle No:</strong> <span id="modal_vehicle_num">${userData.vehicle_num}</span></p> <!-- Added Vehicle No -->
<p><strong>Vehicle Type:</strong> <span id="modal_vehicletype">${userData.vehicletype}</span></p>
<p ><strong>Ref Num:</strong> <span id="modal_ref_num">${userData.reference_num}</span></p>`;
$("#cduserinfoHTML").html(userinfo);
@ -269,7 +350,6 @@
// Hide rejection section initially
document.getElementById('rejectionSection').style.display = 'none';
document.getElementById('rejectionReason').value = ''; // Clear previous input
// Show the modal
$('#detailModal').modal({
backdrop: 'static',
@ -295,6 +375,8 @@
const refNum = document.getElementById('modal_ref_num').innerText;
$('#acceptbutton').prop('disabled', true);
$.ajax({
url: '/gcc/api/registration/acceptbyid',
method: 'POST',
@ -302,6 +384,7 @@
registerId: registerId
},
success: function(response) {
$('#acceptbutton').prop('disabled', false);
console.log(response);
// URL for accepted registration message
@ -325,6 +408,7 @@
});
},
error: function(error) {
$('#acceptbutton').prop('disabled', false);
console.error(error);
Swal.fire({
title: 'Error!',
@ -347,7 +431,6 @@
const registerId = document.getElementById('modal_register_id').innerText; // Get register_id from the modal
const rejectionReason = document.getElementById('rejectionReason').value; // Get the rejection reason
const mobileNo = document.getElementById('modal_mobile_no').innerText; // Get mobile number from the modal
const refNum = document.getElementById('modal_ref_num').innerText;
if (!rejectionReason) {
@ -360,6 +443,10 @@
return; // Stop if no reason is provided
}
$('#rejectbutton').prop('disabled', true);
$.ajax({
url: '/gcc/api/registration/rejectbyid', // API endpoint for rejection
method: 'POST',
@ -368,11 +455,12 @@
reason: rejectionReason // Pass the rejection reason
},
success: function(response) {
$('#rejectbutton').prop('disabled', false);
// URL for rejected registration
const rejectMessageUrl = `https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=${mobileNo}&v=1.1&format=json&msg_type=IMAGE&method=SENDMEDIAMESSAGE&caption=Welcome+to+Greater+Chennai+Corporation%2C%0A%0AYour+Registered+ID+is+%2A${registerId}%2A+.%0AYour+C%26D+waste+registration+has+been+Rejected.+%0A%0AKindly+click+on+the+button+below+for+viewing+the+status%F0%9F%91%87&media_url=https%3A%2F%2Fres.cloudinary.com%2Fdpub5muar%2Fimage%2Fupload%2Fv1729598221%2Fci7ybspyanctl9lackby.jpg&isTemplate=true&buttonUrlParam=userdetail%3Fregister_id%3D${refNum}`;
//const acceptMessageUrl = `https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=${mobileNo}&v=1.1&format=json&msg_type=IMAGE&method=SENDMEDIAMESSAGE&caption=Welcome+to+Greater+Chennai+Corporation%2C+%0A%0AYour+Registered+ID+is+%2A${registerId}%2A+.%0AYour+C%26D+waste+registration+has+been+approved+successfully.+%0A%0AFor+downloading+your+ID+card%2C+kindly+click+on+the+button+below+%F0%9F%91%87&media_url=https%3A%2F%2Fgccservices.in%2Fgcc%2Ffiles%2Fc_d%2F1_approved.jpg&isTemplate=true&buttonUrlParam=userdetail%3Fregister_id%3D${registerId}`;
sendWhatsAppMessage(mobileNo, rejectMessageUrl); // Call the WhatsApp function to send rejection message
Swal.fire({
title: 'Success!',
@ -388,6 +476,7 @@
});
},
error: function(error) {
$('#rejectbutton').prop('disabled', false);
console.error(error);
Swal.fire({
title: 'Error!',
@ -444,3 +533,5 @@
</script>
</body>
</html>

303
src/main/resources/templates/modules/cdwaste/rejected.html

@ -1,6 +1,62 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<style>
/* Main container */
.container {
display: flex;
flex-direction: column;
gap: 15px;
width: 100%;
}
/* Row container to align 2 fields per row */
.labelitems {
display: flex;
justify-content: space-between; /* Evenly distributes fields */
gap: 15px;
}
/* Individual field wrapper */
.field-container {
display: flex;
align-items: center;
flex: 1; /* Ensures equal spacing */
}
/* Label styling */
.field-label {
width: 120px;
font-weight: bold;
font-size:14px;
}
/* Input box styling */
.field-input {
width: 200px; /* Adjusted width */
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
font-size: 14px;
}
.modal-body {
max-height: 70vh;
overflow-y: auto;
overflow-x: hidden;
padding-right: 15px;
}
</style>
<body>
<div class="wrapper">
<!-- Header -->
@ -40,53 +96,51 @@
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h5 style="font-weight:bold;"> Rejected List</h5>
</div>
<div class="card-block">
<div>
<table id="worksDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th> <!-- Auto-increment index -->
<th>Name</th>
<th>Mobile No</th>
<th>Address</th>
<th>Vehicle Number</th>
<th>Vehicle Type</th>
<th>Rejected Date</th>
<th>Rejected By</th>
<th>Reason</th>
<th>Register ID</th>
<th class="text-center">S.No</th> <!-- Auto-increment index -->
<th class="text-center">Name</th>
<th class="text-center">Mobile No</th>
<th class="text-center">Address</th>
<th class="text-center">Vehicle Number</th>
<th class="text-center">Vehicle Type</th>
<!-- <th class="text-center">Rejected Date</th> -->
<th class="text-center">Rejected By</th>
<th class="text-center">Reason</th>
<th class="text-center">Register ID</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr th:each="rejected, i : ${rejectedDetails}">
<td th:text="${i.count}">0</td> <!-- Index counter -->
<td th:text="${rejected.name}">Name</td>
<td th:text="${rejected.mobile_no}">Mobile No</td>
<td th:text="${rejected.address}">Address</td>
<td th:text="${rejected.vehicle_num}">Vehicle Number</td>
<td th:text="${rejected.vehicletype}">Vehicle Type</td>
<td th:text="${rejected.accepteddate}">Rejected Date</td>
<td th:text="${rejected.acceptedby}">Rejected By</td>
<td th:text="${rejected.reason}">Reason</td>
<td th:text="${rejected.register_id}">Register ID</td>
<td class="text-center" th:text="${i.count}">0</td> <!-- Index counter -->
<td class="text-center" th:text="${rejected.name}">Name</td>
<td class="text-center" th:text="${rejected.mobile_no}">Mobile No</td>
<td class="text-center" th:text="${rejected.address}">Address</td>
<td class="text-center" th:text="${rejected.vehicle_num}">Vehicle Number</td>
<td class="text-center" th:text="${rejected.vehicletype}">Vehicle Type</td>
<!-- <td class="text-center" th:text="${rejected.reject}">Rejected Date</td> -->
<!-- <td class="text-center"
th:text="${rejected.reject != null} ? ${rejected.reject.split('-')[2]} + '/' + ${rejected.reject.split('-')[1]} + '/' + ${rejected.reject.split('-')[0]} : ''">
</td> -->
<td class="text-center" th:text="${rejected.acceptedby}">Rejected By</td>
<td class="text-center" th:text="${rejected.reason}">Reason</td>
<td class="text-center" th:text="${rejected.register_id}">Register ID</td>
<td class="text-center">
<button class="btn btn-info"
th:attr="onclick='showModal(' + ${rejected['register_id']} + ')'"
th:text="'View Details'">
</button>
</td>
</tr>
</tbody>
<tfoot class="thead-dark">
<tr>
<th>S.No</th>
<th>Name</th>
<th>Mobile No</th>
<th>Address</th>
<th>Vehicle Number</th>
<th>Vehicle Type</th>
<th>Rejected Date</th>
<th>Rejected By</th>
<th>Reason</th>
<th>Register ID</th>
</tr>
</tfoot>
</table>
</div>
</div>
@ -94,6 +148,56 @@
</div>
</div>
</div>
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="detailModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="detailModalLabel">Register id: <span id="modal_register_id"></span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="cduserinfoHTML">
</div>
<hr>
<div class="row labelitems">
<div class="col-md-12">
<p><strong>Adhaar Photo/Document:</strong></p>
<div id="modal_adhaar_container"></div>
</div>
<div class="col-md-12">
<p><strong>User Photo:</strong></p>
<div id="modal_user_photo_container"></div>
</div>
<div class="col-md-12">
<p><strong>RC Book Document:</strong></p>
<div id="modal_vehicle_doc_container"></div>
</div>
<div class="col-md-12">
<p><strong>Lease Vehicle Document:</strong></p>
<div id="modal_leasevehicle_doc_container"></div>
</div>
</div>
<!-- Rejection Section -->
<!--<div id="rejectionSection" style="display: none; margin-top: 20px;">
<p><strong>Reason for Rejection <span class="text-danger">*</span></strong></p>
<textarea id="rejectionReason" rows="4" class="form-control"></textarea>
<button type="button" class="btn btn-danger mt-2" onclick="confirmRejection()">Confirm</button>
</div> -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
@ -166,10 +270,139 @@
});
//function to show the view details
function showModal(registerId) {
$.ajax({
url: '/gcc/api/registration/pendingbyid?registerId=' + registerId,
method: 'GET',
dataType: 'json',
success: function(data) {
console.log(data);
// Check if data is not empty
if (data.length > 0) {
// Access the first item in the array
const userData = data[0]; // Get the first object from the array
const formattedRejectedDate = userData.accepteddate ? userData.accepteddate.split('T')[0] : '';
let userinfo = `
<div style="display: flex; flex-direction: column; gap: 15px;">
<div class="container">
<!-- First Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Name:</label>
<input type="text" id="modal_name" value="${userData.name}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Mobile No:</label>
<input type="text" id="modal_mobile_no" value="${userData.mobile_no}" readonly class="field-input">
</div>
</div>
<!-- Second Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Address:</label>
<input type="text" id="modal_address" value="${userData.address}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Vehicle No:</label>
<input type="text" id="modal_vehicle_num" value="${userData.vehicle_num}" readonly class="field-input">
</div>
</div>
<!-- Third Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Vehicle Type:</label>
<input type="text" id="modal_vehicletype" value="${userData.vehicletype}" readonly class="field-input">
</div>
<div class="field-container">
<label class="field-label">Ref Num:</label>
<input type="text" id="modal_ref_num" value="${userData.reference_num}" readonly class="field-input">
</div>
</div>
<!-- Fourth Row -->
<div class="row">
<div class="field-container">
<label class="field-label">Rejected Date:</label>
<input type="date" id="modal_accepteddate" value="${formattedRejectedDate}" readonly class="field-input">
</div>
</div>
</div>
</div>`;
$("#cduserinfoHTML").html(userinfo);
$("#modal_register_id").html(userData.register_id);
console.log(userData.adhaarurl);
// Display the files (Adhaar, User Photo, Vehicle Document)
if (userData.adhaarurl!=null) {
displayFile('modal_adhaar_container', userData.adhaarurl);
}
if (userData.user_photourl) {
displayFile('modal_user_photo_container', userData.user_photourl);
}
if (userData.rcbookurl) {
displayFile('modal_vehicle_doc_container', userData.rcbookurl);
}
if (userData.leasedocurl) {
displayFile('modal_leasevehicle_doc_container', userData.leasedocurl);
}
// Hide rejection section initially
/* document.getElementById('rejectionSection').style.display = 'none';
document.getElementById('rejectionReason').value = ''; // Clear previous input */
// Show the modal
$('#detailModal').modal({
backdrop: 'static',
keyboard: false
});
} else {
// Handle case where no data is returned
alert('No data found for this registration ID.');
}
},
error: function(err) {
console.error(err);
alert('Failed to fetch data');
}
});
}
//display file function
function displayFile(containerId, filePath) {
const container = document.getElementById(containerId);
// Ensure the container exists before proceeding
if (!container) {
console.error(`Element with ID '${containerId}' not found.`);
return;
}
// Ensure filePath is valid before attempting to display
if (!filePath) {
container.innerHTML = '<p class="text-danger">No document available</p>';
return;
}
const fileExtension = filePath.split('.').pop().toLowerCase();
console.log('Full Path:', filePath);
if (fileExtension === 'pdf') {
container.innerHTML = `<embed src="${filePath}" type="application/pdf" width="100%" height="500px" />`;
} else {
container.innerHTML = `<img src="${filePath}" alt="Document" class="img-fluid img-thumbnail" />`;
}
}
</script>
</body>

4
src/main/resources/templates/modules/com_petition/petition_list.html

@ -64,6 +64,7 @@
<th class="text-center">Date</th>
<th class="text-center">Status</th>
<th class="text-center">Petition Type</th>
<th class="text-center">Remarks</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</thead>
@ -83,6 +84,8 @@
<th class="text-center">Date</th>
<th class="text-center">Status</th>
<th class="text-center">Department</th>
<th class="text-center">Nature Of Complaint</th>
<th class="text-center">Remarks</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</tfoot> -->
@ -264,6 +267,7 @@
convertdate(row['cdate']),
row['status'],
row['petition_type_name'],
row['remarks'],
actionHTML
]).draw(false);
});

8
src/main/resources/templates/modules/com_petition/petition_view_modal_page.html

@ -46,6 +46,14 @@
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;" id="complaint_with_maping_value"></td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;">குறிப்பு / Remarks:<br>
<p class="fw-semibold mb-0" style="font-weight:normal;" id="remarks_value"></p>
</th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;" id="remarks_with_value"></td>
</tr>
</tbody>
</table>
</div>

6
src/main/resources/templates/modules/m_petition/petition_list.html

@ -107,7 +107,7 @@
<th class="text-center">Type of Complaint</th>
<th class="text-center">Date</th>
<th class="text-center">Status</th>
<th class="text-center">Department</th>
<th class="text-center">Petition Type</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</thead>
@ -125,7 +125,7 @@
<th class="text-center">Type of Complaint</th>
<th class="text-center">Date</th>
<th class="text-center">Status</th>
<th class="text-center">Department</th>
<th class="text-center">Petition Type</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</tfoot>
@ -310,7 +310,7 @@
row['petitioner_complaint_txt'],
convertdate(row['cdate']),
row['status'],
row['created_by'],
row['petition_type_name'],
actionHTML
]).draw(false);
});

BIN
src/main/resources/templates/modules/pensioner/.DS_Store

BIN
src/main/resources/templates/modules/pensioner/department/.DS_Store

40
src/main/resources/templates/modules/pensioner/department/dashboard.html

@ -347,11 +347,11 @@ margin-top: 10px;
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script>
<script src="node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="node_modules/amcharts3/amcharts/serial.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/pie.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script>
<script src="node_modules/amcharts3/amcharts/pie.js"></script>
<script src="node_modules/amcharts3/amcharts/themes/light.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
@ -371,7 +371,7 @@ margin-top: 10px;
// First API call to fetch employee details
$.ajax({
url: `/fetchEmpDetails?Empcode=${Empcode}`,
url: `/gcc/api/pensionerdashboard/fetchEmpDetails?Empcode=${Empcode}`,
type: 'GET',
success: function (response) {
if (!response || response.length === 0) {
@ -551,7 +551,7 @@ margin-top: 10px;
function fetchDetailsByTempId(tempId) {
return new Promise((resolve, reject) => {
$.ajax({
url: `/fetchTempDetails?tempId=${tempId}`,
url: `/gcc/api/pensionerdashboard/fetchTempDetails?tempId=${tempId}`,
type: 'GET',
success: function (response) {
let historyContainer = $(`#history-${tempId}`);
@ -617,7 +617,7 @@ margin-top: 10px;
console.log(deptId);
$.ajax({
url: `/deparmentdashboard?deptId=${encodeURIComponent(deptId)}`,
url: `/gcc/api/pensionerdashboard/departmentdashboard?deptId=${encodeURIComponent(deptId)}`,
type: 'GET',
contentType: 'application/json',
success: function (data) {
@ -658,7 +658,7 @@ margin-top: 10px;
});
} else {
$.ajax({
url: `/dashboardsearch?startdate=${startDate}&enddate=${endDate}&deptId=${encodeURIComponent(deptId)}`,
url: `/gcc/api/pensionerdashboard/dashboardsearch?startdate=${startDate}&enddate=${endDate}&deptId=${encodeURIComponent(deptId)}`,
type: 'GET',
success: function (data) {
const statsDiv = document.getElementById('stats');
@ -679,25 +679,7 @@ margin-top: 10px;
}
});
// Function to validate and set min-date for endDate
/* function validateEndDate() {
const startDate = document.getElementById('startDate').value;
const endDateInput = document.getElementById('endDate');
if (startDate) {
const startDateObj = new Date(startDate);
const minEndDateISO = startDateObj.toISOString().split('T')[0];
endDateInput.setAttribute('min', minEndDateISO);
// Clear endDate if it's less than startDate
if (endDateInput.value && new Date(endDateInput.value) < startDateObj) {
endDateInput.value = '';
}
}
}
document.getElementById('startDate').addEventListener('change', validateEndDate);
*/
function renderCharts(startDate = null, endDate = null) {
const deptId = $('#deptId').text().trim();
@ -726,7 +708,7 @@ margin-top: 10px;
};
$.ajax({
url: `/categoryCounts`,
url: `/gcc/api/pensionerdashboard/categoryCounts`,
type: 'GET',
data: { deptId, startDate, endDate },
dataType: 'json',
@ -794,7 +776,7 @@ $.ajax({
function fetchempno(FileId, FileNumber) {
$.ajax({
url: `/getEmpNoByFileName?file_id=${FileId}`,
url: `/gcc/api/pensionerdashboard/getEmpNoByFileName?file_id=${FileId}`,
type: 'GET',
success: function (response) {
renderEmpNoModal(FileNumber, response);
@ -846,7 +828,7 @@ $.ajax({
// Render bar chart
$.ajax({
url: `/stageWiseCounts`,
url: `/gcc/api/pensionerdashboard/stageWiseCounts`,
type: 'GET',
data: { deptId, startDate, endDate },
dataType: 'json',

BIN
src/main/resources/templates/modules/pensioner/department/newentry/.DS_Store

72
src/main/resources/templates/modules/pensioner/department/newentry/gis.html

@ -439,6 +439,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Add change event listener to the radio buttons
$('input[name="staffType"]').off('change').on('change', function () {
const selectedType = $('input[name="staffType"]:checked').val();
console.log(selectedType);
$('#staffTypeContainer').hide();
@ -493,10 +494,12 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
});
$('#submitButton').off('click').on('click', function () {
/* $('#submitButton').off('click').on('click', function () {
const gisPattern = /^GIS\d+$/;
const employeeNo = $('#employeeno').val().trim();
console.log("=====");
// Validate Employee No
if (!gisPattern.test(employeeNo)) {
Swal.fire({
@ -513,7 +516,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Log and call save function
console.log("Save button clicked. Triggering saveEntryDetails function.");
saveEntryDetailsnew();
});
}); */
});
@ -522,7 +525,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Handle Search button click
$('#searchButton').on('click', function () {
const empCode = $('#empCode').val().trim(); // Trim input to avoid accidental spaces
$('input[name="staffType"]').prop('checked', false);
console.log("empCode...",empCode);
if (!empCode) {
@ -639,14 +642,18 @@ document.addEventListener("DOMContentLoaded", function () {
$('#classes').val(employeeDetails.GROUP_TYPE);
$('#retrirementdate').val(employeeDetails.RETIREMENT_DATE);
$('#servicedeath').val('');
$('#deceased').val('');
$('#remarks').val('');
$('#gisentry').val('');
$('#EmployeeCode').text(empCode);
$('#employeeCard').show();
// Attach event handler for saving details
$('#submitButton').off('click').on('click', function () {
console.log("Save button clicked. Triggering saveEntryDetails function.");
saveEntryDetailsnew();
});
} else {
console.warn("No employee data found in the external API response.");
Swal.fire({
@ -718,11 +725,34 @@ document.addEventListener("DOMContentLoaded", function () {
loadEntryTypes();
});
$('#submitButton').off('click').on('click', function () {
console.log("Save button clicked. Triggering saveEntryDetails function.");
saveEntryDetailsnew();
});
function saveEntryDetailsnew() {
const selectedstaffType = $('input[name="staffType"]:checked').val();
console.log("selectedstaffType====="+selectedstaffType);
const selectedstaffType1 = $('input[name="staffType"]:checked').val();
console.log("selectedstaffType====="+selectedstaffType1);
if(selectedstaffType1 ==='temporary'){
const gisPattern1 = /^GIS\d+$/;
const employeeNo1 = $('#employeeno').val().trim();
console.log("==New===");
// Validate Employee No
if (!gisPattern1.test(employeeNo1)) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Employee No must start with "GIS" and be followed by one or more numbers.',
confirmButtonText: 'OK'
});
console.log('New Validation failed: Employee No is invalid.');
$('#submitButton').prop('disabled', false).text('Mark as Forwarded to Pension'); // Re-enable button
return; // Stop execution if validation fails
}
}
let selgisamount = $('input[name="gisamount"]:checked').val();
let selgismamountval = null;
@ -741,9 +771,23 @@ document.addEventListener("DOMContentLoaded", function () {
}
let employeeName = $('#employeename').val().trim();
if (!/^[A-Za-z.\s]+$/.test(employeeName)) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Employee Name must contain only alphabets.',
confirmButtonText: 'OK'
});
return;
}
let entryDetails = {
empNo: $('#employeeno').val(),
empName: $('#employeename').val(),
empName: employeeName,
deptName: $('#department').val(),
designation: $('#designation').val(),
serviceDeath: $('#servicedeath').val(),
@ -812,7 +856,7 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
if (selectedstaffType !== 'temporary'){
if (selectedstaffType1 !== 'temporary'){
if (!entryDetails.gisentry || entryDetails.gisentry.trim() === '') {
Swal.fire({
@ -866,7 +910,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Step 1: Check if the employee exists in the database
$('#submitButton').prop('disabled', true).text('Checking...');
$.ajax({
$.ajax({
url: '/gcc/api/department/newentry/exists',
type: 'GET',
data: { empCode: employeeNo },
@ -1003,7 +1047,7 @@ document.addEventListener("DOMContentLoaded", function () {
$(this).val(value.replace(/[^A-Za-z\s]/g, '')); // Allow only letters and spaces
});
$('#submitButton').on('click', function () {
/* $('#submitButton').on('click', function () {
const employeeName = $('#employeename').val().trim();
@ -1016,7 +1060,7 @@ document.addEventListener("DOMContentLoaded", function () {
});
return;
}
});
}); */
});

2
src/main/resources/templates/modules/pensioner/department/received/provisionalretirement.html

@ -617,7 +617,7 @@ margin-top: 10px;
$(document).ready(function () {
$(document).on('click', '#submitbutton', function () {
$(document).off('click', '#submitbutton').on('click', '#submitbutton', function () {
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
// Trigger the save function and pass the value

BIN
src/main/resources/templates/modules/pensioner/pensioner/.DS_Store

26
src/main/resources/templates/modules/pensioner/pensioner/dashboard.html

@ -351,11 +351,11 @@ table.dataTable td {
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script>
<script src="node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="node_modules/amcharts3/amcharts/serial.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/pie.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script>
<script src="node_modules/amcharts3/amcharts/pie.js"></script>
<script src="node_modules/amcharts3/amcharts/themes/light.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
@ -366,7 +366,7 @@ table.dataTable td {
//fetch details
if (Empcode) {
$.ajax({
url: `/fetchPensionEmpDetails?Empcode=${Empcode}`, // Backend API route
url: `/gcc/api/pensionerdashboard/fetchPensionEmpDetails?Empcode=${Empcode}`, // Backend API route
type: 'GET',
success: function (response) {
console.log(response);
@ -515,7 +515,7 @@ table.dataTable td {
function fetchDetailsByTempId(tempId) {
return new Promise((resolve, reject) => {
$.ajax({
url: `/fetchTempDetails?tempId=${tempId}`,
url: `/gcc/api/pensionerdashboard/fetchTempDetails?tempId=${tempId}`,
type: 'GET',
success: function (response) {
let historyContainer = $(`#history-${tempId}`);
@ -576,9 +576,9 @@ table.dataTable td {
$.ajax({
url: "/getDepartments",
url: "/gcc/api/pensionerdashboard/getDepartments",
type: "GET",
dataType: "json",
success: function (data) {
var dropdown = $("#deptId");
dropdown.empty();
@ -596,7 +596,7 @@ table.dataTable td {
function loadDashboardData() {
$.ajax({
url: `/dashboard`,
url: `/gcc/api/pensionerdashboard/dashboard`,
type: 'GET',
contentType: 'application/json',
success: function (data) {
@ -640,7 +640,7 @@ table.dataTable td {
} else {
$.ajax({
url: `/dashboardsearch?startdate=${startDate}&enddate=${endDate}&deptId=${encodeURIComponent(deptId)}`,
url: `/gcc/api/pensionerdashboard/dashboardsearch?startdate=${startDate}&enddate=${endDate}&deptId=${encodeURIComponent(deptId)}`,
type: 'GET',
dataType: 'json',
@ -712,7 +712,7 @@ table.dataTable td {
"Contributory Pension Scheme": "#5D6D7E" // Muted Gray-Blue
};
$.ajax({
url: `/categoryCounts`,
url: `/gcc/api/pensionerdashboard/categoryCounts`,
type: 'GET',
data: dataParams,
dataType: 'json',
@ -775,7 +775,7 @@ table.dataTable td {
});
function fetchempno(FileId,FileNumber){
$.ajax({
url: `/getEmpNoByFileName?file_id=${FileId}`,
url: `/gcc/api/pensionerdashboard/getEmpNoByFileName?file_id=${FileId}`,
type: 'GET',
success: function (response) {
// Render the modal with emp_no data
@ -829,7 +829,7 @@ table.dataTable td {
// Bar Chart - Pendency Stages Wise
$.ajax({
url: `/stageWiseCounts`,
url: `/gcc/api/pensionerdashboard/stageWiseCounts`,
type: 'GET',
data: dataParams,

BIN
src/main/resources/templates/modules/school/.DS_Store

42
src/main/resources/templates/modules/school/addelectricalasset.html

@ -79,6 +79,20 @@
border: none;
line-height: 1;
}
.custom-card-wrapper {
padding: 0;
margin-top: -58px;
margin-left: -233px;
}
@media (max-width: 768px) {
.custom-card-wrapper {
margin-left: 0;
margin-top: 0;
padding: 10px;
}
}
@ -96,7 +110,8 @@
<div class="container">
<!-- Card 2: Other Details -->
<div class="col-md-12">
<div style="padding: 0px;margin-top:-58px;margin-left: -233px;">
<div class="custom-card-wrapper">
<!-- <div style="padding: 0px;margin-top:-58px;margin-left: -233px;">-->
<div class="card-header d-flex justify-content-between align-items-center">
<b>List of Electrical Assets</b>
<button type="button" class="btn btn-primary add-ebtn"> <i class="ik ik-plus"></i>Add Assets</button>
@ -194,7 +209,7 @@
<span id="Eeditid" style="display: none;"></span>
<div class="row">
<div class="form-group col-6">
<label for="Emaster_qty">Master Quantity &nbsp;(&nbsp;Already in master&nbsp;<span id="AEmaster_qty" style="font-style: italic;font-weight: bold;"></span>&nbsp;)<span class="text-danger">*</span></label>
<label for="Emaster_qty">Master Quantity &nbsp;<!-- (&nbsp;Already in master&nbsp;<span id="AEmaster_qty" style="font-style: italic;font-weight: bold;"></span>&nbsp;) --><span class="text-danger">*</span></label>
<input type="text" class="form-control" id="Emaster_qty" name="Emaster_qty">
</div>
@ -231,6 +246,9 @@
console.log("hi electrical assets...");
$(document).ready(function () {
$('#Emaster_qty').on('input', function() {
this.value = this.value.replace(/[^0-9]/g, '');
});
let ElectricalAsseturlParams = new URLSearchParams(window.location.search);
let EAssetschoolId = ElectricalAsseturlParams.get("schoolId");
@ -303,7 +321,7 @@
inputRow += `
<div class="col-md-4">
<input type="number" class="form-control" name="assetQuantity_${assetId}" placeholder="Enter Quantity" min="0">
<input type="number" class="form-control asset-quantity-input" name="assetQuantity_${assetId}" placeholder="Enter Quantity" min="0">
</div>
`;
@ -318,10 +336,16 @@
$container.append(inputRow);
}
});
// Add an event listener to all input fields with the class 'asset-quantity-input'
$(document).on('input', '.asset-quantity-input', function() {
// Replace any character that is NOT a digit with an empty string
this.value = this.value.replace(/[^0-9]/g, '');
});
});
function handleEAssetEdit(){
console.log("Button clicked");
@ -621,7 +645,7 @@
});
} else {
Swal.fire('Error', response.message, 'error');
Swal.fire('Error ', response.message, 'error');
}
},
error: function() {
@ -682,7 +706,15 @@
location.reload();
});
} else {
}
else if (response === "lesser than") {
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Entered Quantity is lesser than Mapped Quantity!'
});
}
else {
Swal.fire({
icon: 'error',
title: 'Error',

30
src/main/resources/templates/modules/school/addfurnitureasset.html

@ -77,6 +77,20 @@
border: none;
line-height: 1;
}
.custom-card-wrapper {
padding: 0;
margin-top: -58px;
margin-left: -233px;
}
@media (max-width: 768px) {
.custom-card-wrapper {
margin-left: 0;
margin-top: 0;
padding: 10px;
}
}
@ -92,7 +106,8 @@
<div class="container">
<!-- Card 2: Other Details -->
<div class="col-md-12">
<div style="padding: 0px;margin-top:-58px;margin-left: -233px;">
<div class="custom-card-wrapper">
<!-- <div style="padding: 0px;margin-top:-58px;margin-left: -233px;">-->
<div class="card-header d-flex justify-content-between align-items-center">
<b>List of Furniture Assets</b>
<button type="button" class="btn btn-primary add-fbtn"> <i class="ik ik-plus"></i>Add Assets</button>
@ -190,7 +205,7 @@
<span id="Feditid" style="display: none;"></span>
<div class="row">
<div class="form-group col-6">
<label for="Fmaster_qty">Master Quantity&nbsp;(&nbsp;Already in master&nbsp;<span id="AFmaster_qty" style="font-style: italic;font-weight: bold;"></span>&nbsp;)<span class="text-danger">*</span></label>
<label for="Fmaster_qty">Master Quantity&nbsp;<!-- (&nbsp;Already in master&nbsp;<span id="AFmaster_qty" style="font-style: italic;font-weight: bold;"></span>&nbsp;) --><span class="text-danger">*</span></label>
<input type="text" class="form-control" id="Fmaster_qty" name="Fmaster_qty">
</div>
@ -230,6 +245,9 @@
console.log("hi..furniture asset");
$(document).ready(function () {
$('#Fmaster_qty').on('input', function() {
this.value = this.value.replace(/[^0-9]/g, '');
});
let FurnitureAsseturlParams = new URLSearchParams(window.location.search);
let FAssetschoolId = FurnitureAsseturlParams.get("schoolId");
@ -302,7 +320,8 @@
inputRow += `
<div class="col-md-4">
<input type="number" class="form-control" name="assetQuantity_${assetId}" placeholder="Enter Quantity" min="0">
<input type="number" class="form-control asset-quantity-input" name="assetQuantity_${assetId}" placeholder="Enter Quantity" min="0">
</div>
`;
@ -317,6 +336,11 @@
$container.append(inputRow);
}
});
// Add an event listener to all input fields with the class 'asset-quantity-input'
$(document).on('input', '.asset-quantity-input', function() {
// Replace any character that is NOT a digit with an empty string
this.value = this.value.replace(/[^0-9]/g, '');
});
});

168
src/main/resources/templates/modules/school/assetmanagement.html

@ -5,6 +5,22 @@
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<style>
.custom-card-wrapper {
padding: 0;
margin-top: -58px;
margin-left: -233px;
}
@media (max-width: 768px) {
.custom-card-wrapper {
margin-left: 0;
margin-top: 0;
padding: 10px;
}
}
</style>
<body>
@ -17,7 +33,8 @@
<div class="container">
<!-- Card 2: Other Details -->
<div class="col-md-12">
<div style="padding: 0px;margin-top:-58px;margin-left: -233px;">
<div class="custom-card-wrapper">
<!-- <div style="padding: 0px;margin-top:-58px;margin-left: -233px;"> -->
<div class="card-header d-flex justify-content-between align-items-center">
<b>List of IT Assets</b>
<button type="button" class="btn btn-primary add-btn"> <i class="ik ik-plus"></i>Add Assets</button>
@ -219,10 +236,10 @@
if (!window.assetManagementEventsBound) {
$(document).on('click', '.edit-btn1', handleManageEdit);
//$(document).on('click', '.add-btn', handleAddAsset);
$(document).on('click', '.add-btn', function () {
handleAddAsset(AssetManageschoolId);
});
// $(document).on('click', '.add-btn', handleAddAsset);
$(document).on('click', '.add-btn', function () {
handleAddAsset(AssetManageschoolId);
});
//$(document).on('click', '#savingAsset', handleSavingAsset);
@ -351,91 +368,62 @@
// Load sub asset types on modal open or page load
// Load sub asset types on modal open or page load
$.ajax({
url: '/gcc/api/gccschool/dropdown/getSubAssetType',
type: 'GET',
data: { assetid: 1 }, // or dynamic ID later
success: function (res) {
console.log("Sub Asset API Response:", res);
if (res.status === "OK" && Array.isArray(res.data)) {
$('#assetName').empty().append('<option value="">-- Select Sub Asset Type --</option>');
res.data.forEach(function (item) {
$('#assetName').append(
$('<option>', {
value: item.code,
text: item.asset_name
})
);
});
} else {
$('#assetName').empty().append('<option value="">No Sub Asset Types Found</option>');
}
},
error: function (xhr, status, error) {
console.error("Failed to load sub asset types:", error);
$('#assetName').empty().append('<option value="">Error Loading</option>');
}
});
/*
function handleAddAsset() {
// Get DataTable instance
let Atable = $('#AssetManageDatatable').DataTable();
// Get data from the first row
let firstRowData = Atable.row(0).data();
if (firstRowData && firstRowData.udise) {
let udise = firstRowData.udise;
console.log("UDISE from first row:", udise);
$('#school_udise').text(udise);
$('#assetCode').val('');
$('#assetName').val('');
$('#assetSource').val('');
$('#serialNumber').val('');
$('#vendorDetail').val('');
$('#invoiceNumber').val('');
$('#AddAssetModal2').modal('show');
// You can now use `udise` however you want here
} else {
console.log("No data or UDISE not found in the first row.");
}
}
*/
function handleAddAsset(schid) {
$('#AddAssetModal2').modal('show');
$.ajax({
type: 'GET',
url: '/gcc/api/gccschool/schoolproperty/getSchoolDetails',
data: {schoolId: schid},
success: function (data) {
console.log(data);
$('#school_udise').text(data.udise);
},
error: function (xhr) {
console.log("Failed to get udise for school: " + xhr.responseJSON?.message);
}
});
$('#assetCode').val('');
$('#assetName').val('');
$('#assetSource').val('');
$('#serialNumber').val('');
$('#vendorDetail').val('');
$('#invoiceNumber').val('');
}
$.ajax({
url: '/gcc/api/gccschool/dropdown/getSubAssetType',
type: 'GET',
data: { assetid: 1 }, // or dynamic ID later
success: function (res) {
console.log("Sub Asset API Response:", res);
if (res.status === "OK" && Array.isArray(res.data)) {
$('#assetName').empty().append('<option value="">-- Select Sub Asset Type --</option>');
res.data.forEach(function (item) {
$('#assetName').append(
$('<option>', {
value: item.code,
text: item.asset_name
})
);
});
} else {
$('#assetName').empty().append('<option value="">No Sub Asset Types Found</option>');
}
},
error: function (xhr, status, error) {
console.error("Failed to load sub asset types:", error);
$('#assetName').empty().append('<option value="">Error Loading</option>');
}
});
function handleAddAsset(schid) {
$('#AddAssetModal2').modal('show');
$.ajax({
type: 'GET',
url: '/gcc/api/gccschool/schoolproperty/getSchoolDetails',
data: {schoolId: schid},
success: function (data) {
console.log(data);
$('#school_udise').text(data.udise);
},
error: function (xhr) {
console.log("Failed to get udise for school: " + xhr.responseJSON?.message);
}
});
$('#assetCode').val('');
$('#assetName').val('');
$('#assetSource').val('');
$('#serialNumber').val('');
$('#vendorDetail').val('');
$('#invoiceNumber').val('');
}
function handleSavingAsset(assetManageschoolId){
let school_udise = $('#school_udise').text().trim();

68
src/main/resources/templates/modules/school/building.html

@ -64,6 +64,40 @@
overflow-y: auto;
min-height: 40vh;
}
/* .responsive-section {
margin-left: -256px;
} */
/* Wider negative margin if needed */
/* .responsive-section-wide {
margin-left: -281px;
} */
/* Mobile responsiveness */
@media (max-width: 768px) {
.responsive-section,
.responsive-section-wide {
margin-left: 0 !important;
padding: 0 10px;
}
.btn.mb-2 {
width: 100%;
margin-top: 10px;
}
.d-flex.justify-content-between {
flex-direction: column;
align-items: flex-start;
}
.table {
display: block;
width: 100%;
overflow-x: auto;
white-space: nowrap;
}
}
</style>
<body>
@ -71,13 +105,13 @@
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<div class="page-wrap">
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<div class="main-content" style=" margin-top: 6px;
">
<div class="main-content" style="margin-top: 6px;padding-left: 0px;">
<div class="container">
<div class="col-md-12">
<div class="d-flex justify-content-between align-items-center">
<h4 style="margin-left: -256px;">Buildings</h4>
<div class="d-flex justify-content-between align-items-center responsive-section">
<!-- <h4 style="margin-left: -256px;">Buildings</h4> -->
<h4 >Buildings</h4>
<button type="button" class="btn btn-primary"
style="background-color: #0D587B; border: none; border-radius: 6px; padding: 6px 16px;"
data-bs-toggle="modal" data-bs-target="#assetModal">
@ -85,13 +119,12 @@
</button>
</div>
<hr
style="border: 1px solid #ccc; margin-top: 10px; margin-bottom: 20px; margin-left: -256px;">
<hr class="responsive-section"
style="border: 1px solid #ccc; margin-top: 10px;">
</div>
<div class="row mt-4" style=" margin-left: -281px;
">
<div class="row mt-4 responsive-section-wide">
<div class="col-md-12">
<div class="card">
<div class="card-block">
@ -671,9 +704,11 @@
dom: 'Bftip',
autoWidth: false,
fixedColumns: {left: 0, right: 0},
//fixedColumns: {left: 0, right: 0},
scrollY: '60vh',
scrollCollapse: true,
scrollX:true,
fixedHeader:false,
//scrollCollapse: true,
buttons: [buttons],
responsive: false,
searching: true,
@ -1075,7 +1110,7 @@ $(document).on('click', '#flooredit', function () {
exe_order: totalFloors
}, function (res) {
if (res === 'Sucess') {
Swal.fire({
/* Swal.fire({
title: 'Success!',
text: 'Floor added successfully.',
icon: 'success',
@ -1083,9 +1118,9 @@ $(document).on('click', '#flooredit', function () {
allowEscapeKey: false, // Disable escape key to close the modal
allowEnterKey: false, // Disable enter key to close the modal
showConfirmButton: true
});
});*/
populatefloorDropdowns(buildingId); // reload dropdown
} else {
} /*else {
Swal.fire({
title: 'Error!',
text: 'Failed to add floor.',
@ -1095,7 +1130,7 @@ $(document).on('click', '#flooredit', function () {
allowEnterKey: false, // Disable enter key to close the modal
showConfirmButton: true
});
}
}*/
});
} else {
Swal.fire({
@ -1323,7 +1358,8 @@ $(document).on('click', '#flooredit', function () {
floor_id: floorId
},
success: function (response) {
Swal.fire({
populatefloorDropdowns(buildingId);
/* Swal.fire({
icon: 'success',
title: 'Success',
text: response.message || "Floor updated successfully"
@ -1332,7 +1368,7 @@ $(document).on('click', '#flooredit', function () {
//reloadbuildingSection(); // OR refreshDataTable();
//location.reload();
handleEdit(buildingId);
});
});*/
// Optionally refresh dropdown or UI
},
error: function () {

1
src/main/resources/templates/modules/school/dashboard.html

@ -268,6 +268,7 @@
const table = $('#schoolTable').DataTable({
createdRow: function (row, data, dataIndex) {
$(row).attr("onclick", `redirectToDetails(${schoolList[dataIndex].id})`);
$(row).css("cursor", "pointer");
}
});

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save