From d351f465291f6a64c0704cf591980bd8970d9d98 Mon Sep 17 00:00:00 2001 From: Hariprasath S <113695067+Hariprasath4022@users.noreply.github.com> Date: Thu, 27 Nov 2025 15:10:20 +0530 Subject: [PATCH] sofa bed collection updated --- .../configuration/DataSourceConfig.java | 9 +- .../controller/MainController.java | 12 +- .../controller/PetLicenseApiController.java | 93 ++- .../SofaBedCollectionApiController.java | 29 + .../service/SofaBedCollectionService.java | 507 +++++++++++ .../templates/modules/pet/petlicense.html | 236 ++++-- .../modules/sofa_bed/collectiondetails.html | 784 ++++++++++++++++++ .../modules/sofa_bed/pendingdetails.html | 440 ++++++++++ 8 files changed, 1991 insertions(+), 119 deletions(-) create mode 100644 src/main/resources/templates/modules/sofa_bed/collectiondetails.html create mode 100644 src/main/resources/templates/modules/sofa_bed/pendingdetails.html diff --git a/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java b/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java index 86ab374..18485cb 100644 --- a/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java +++ b/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java @@ -21,12 +21,12 @@ import javax.sql.DataSource; public class DataSourceConfig { - private static String host = "localhost:3306"; - private static String dbpassword = "root"; +// private static String host = "localhost:3306"; +// private static String dbpassword = "root"; -// private static String host = "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; -// private static String dbpassword = "gcc-facial-password"; + private static String host = "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; + private static String dbpassword = "gcc-facial-password"; public static class MyDataSourceConfig { @@ -42,6 +42,7 @@ public class DataSourceConfig { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setUrl("jdbc:mysql://"+host+"/commissioner_review"); + //dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service"); dataSource.setUsername("root"); dataSource.setPassword(dbpassword); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); diff --git a/src/main/java/com/gcc/commissionerreview/controller/MainController.java b/src/main/java/com/gcc/commissionerreview/controller/MainController.java index a51b225..07e1c15 100644 --- a/src/main/java/com/gcc/commissionerreview/controller/MainController.java +++ b/src/main/java/com/gcc/commissionerreview/controller/MainController.java @@ -149,10 +149,20 @@ public class MainController { return "modules/sofa_bed/zonewise1"; } - @GetMapping("/petlicense") + @GetMapping("/petmisreport") public String petReport(Model model) { return "modules/pet/petlicense"; } + @GetMapping("/sofacollectiondetails") + public String sofaBedZoneReport(Model model) { + return "modules/sofa_bed/collectiondetails"; + } + + @GetMapping("/viewpendingdetails") + public String viewpendingdetails(Model model) { + return "modules/sofa_bed/pendingdetails"; + } + } diff --git a/src/main/java/com/gcc/commissionerreview/controller/PetLicenseApiController.java b/src/main/java/com/gcc/commissionerreview/controller/PetLicenseApiController.java index 7e22159..a8ffaa2 100644 --- a/src/main/java/com/gcc/commissionerreview/controller/PetLicenseApiController.java +++ b/src/main/java/com/gcc/commissionerreview/controller/PetLicenseApiController.java @@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; public class PetLicenseApiController { - @GetMapping("/getzonewisedata") + @GetMapping("/getzonewisedata") public ResponseEntity getZonewiseData() { try { // Step 1: Login and get session token @@ -40,46 +40,91 @@ public class PetLicenseApiController { String dashboardUrl = "https://petservice.gccservices.in/api/v1/dashboard/license-dashboard"; String dashboardResponse = getDashboardData(dashboardUrl, sessionToken); - - String dashboardUrl2 = "https://petservice.gccservices.in/api/v1/dashboard/vaccination-dashboard"; - String dashboardResponse2 = getDashboardData(dashboardUrl2, sessionToken); - - String dashboardUrl3 = "https://petservice.gccservices.in/api/v1/dashboard/microchip-dashboard"; - String dashboardResponse3 = getDashboardData(dashboardUrl3, sessionToken); + // hari + +// String dashboardUrl2 = "https://petservice.gccservices.in/api/v1/dashboard/vaccination-dashboard"; +// String dashboardResponse2 = getDashboardData(dashboardUrl2, sessionToken); +// +// String dashboardUrl3 = "https://petservice.gccservices.in/api/v1/dashboard/microchip-dashboard"; +// String dashboardResponse3 = getDashboardData(dashboardUrl3, sessionToken); + + // sanjay + // vaccination data for pet and community + + String dashboardUrlPet = "https://petservice.gccservices.in/api/v1/dashboard/vaccination-dashboard/pet"; + String dashboardResponsePet = getDashboardData(dashboardUrlPet, sessionToken); + + + String dashboardUrlCommunity = "https://petservice.gccservices.in/api/v1/dashboard/vaccination-dashboard/community"; + String dashboardResponseCommunity = getDashboardData(dashboardUrlCommunity, sessionToken); + + + // microchip data for pet and community + +// String dashboardUrlPet1 = "https://petservice.gccservices.in/api/v1/dashboard/microchip-dashboard/pet"; +// String dashboardResponsePet1 = getDashboardData(dashboardUrlPet1, sessionToken); +// +// +// String dashboardUrlCommunity1 = "https://petservice.gccservices.in/api/v1/dashboard/microchip-dashboard/community"; +// String dashboardResponseCommunity1 = getDashboardData(dashboardUrlCommunity1, sessionToken); +// -// System.out.println("dashboardResponse="+dashboardResponse); -// System.out.println("dashboardResponse2="+dashboardResponse2); -// System.out.println("dashboardResponse3="+dashboardResponse3); ObjectMapper mapper = new ObjectMapper(); ObjectNode wrapper = mapper.createObjectNode(); ArrayNode errors = mapper.createArrayNode(); wrapper.put("status", true); - JsonNode root = mapper.readTree(dashboardResponse); - JsonNode root2 = mapper.readTree(dashboardResponse2); - JsonNode root3 = mapper.readTree(dashboardResponse3); - + JsonNode root = mapper.readTree(dashboardResponse); + + JsonNode rootPet = mapper.readTree(dashboardResponsePet); + JsonNode rootCommunity = mapper.readTree(dashboardResponseCommunity); + + +// JsonNode rootPet1 = mapper.readTree(dashboardResponsePet1); +// JsonNode rootCommunity1 = mapper.readTree(dashboardResponseCommunity1); + // Check if "success" is true if (root.has("success") && root.get("success").asBoolean()) { wrapper.set("licensedata", root); } else { errors.add("License dashboard returned success=false"); } - - if (root2.has("success") && root2.get("success").asBoolean()) { - wrapper.set("vaccinationdata", root2); - } else { - errors.add("Vaccination dashboard returned success=false"); - } + // vaccination - if (root3.has("success") && root3.get("success").asBoolean()) { - wrapper.set("microchipdata", root3); + if (rootPet.has("success") && rootPet.get("success").asBoolean()) { + wrapper.set("vaccinationpetdata", rootPet); + } else { - errors.add("Microchip dashboard returned success=false"); + errors.add("Vaccination pet dashboard returned success=false"); } - + + if (rootCommunity.has("success") && rootCommunity.get("success").asBoolean()) { + wrapper.set("vaccinationcommunitydata", rootCommunity); + + } else { + errors.add("Vaccination community dashboard returned success=false"); + } + + + // microchip + +// if (rootPet1.has("success") && rootPet1.get("success").asBoolean()) { +// wrapper.set("microchippetdata", rootPet1); +// } else { +// errors.add("Microchip pet dashboard returned success=false"); +// } +// +// if (rootCommunity1.has("success") && rootCommunity1.get("success").asBoolean()) { +// wrapper.set("microchipcommunitydata", rootCommunity1); +// } else { +// errors.add("Microchip community dashboard returned success=false"); +// } + + + + // --- If any failed, mark status false but still return data --- if (!errors.isEmpty()) { wrapper.put("status", false); diff --git a/src/main/java/com/gcc/commissionerreview/controller/SofaBedCollectionApiController.java b/src/main/java/com/gcc/commissionerreview/controller/SofaBedCollectionApiController.java index 82ea94b..869095b 100644 --- a/src/main/java/com/gcc/commissionerreview/controller/SofaBedCollectionApiController.java +++ b/src/main/java/com/gcc/commissionerreview/controller/SofaBedCollectionApiController.java @@ -39,4 +39,33 @@ public class SofaBedCollectionApiController { { return sofaBedCollectionService.getWardStatusDetails(ward,status); } + + //////////////////////////// + + @GetMapping("/getZoneDetails") + public List> getZoneDetails() + { + return sofaBedCollectionService.getZoneDetails(); + } + + @GetMapping("/getWardDetails") + public List> getWardDetails(@RequestParam String zone) + { + return sofaBedCollectionService.getWardDetails(zone); + } + + @GetMapping("/getWardStatusDetails") + public List> getWardStatusDetails(@RequestParam String ward,@RequestParam String status) + { + return sofaBedCollectionService.getWardStatusDetailsReport(ward,status); + } + + /////////////////////////////// + + @GetMapping("/getPendingDetails") + public List> getPendingDetails() + { + return sofaBedCollectionService.getPendingDetails(); + } + } diff --git a/src/main/java/com/gcc/commissionerreview/service/SofaBedCollectionService.java b/src/main/java/com/gcc/commissionerreview/service/SofaBedCollectionService.java index 9b66dff..298e791 100644 --- a/src/main/java/com/gcc/commissionerreview/service/SofaBedCollectionService.java +++ b/src/main/java/com/gcc/commissionerreview/service/SofaBedCollectionService.java @@ -1,5 +1,7 @@ package com.gcc.commissionerreview.service; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; @@ -412,5 +414,510 @@ public class SofaBedCollectionService { return Collections.singletonList(response); } + + ////////////////////////////////////////////////////// + + public List> getZoneDetails() { + + String sql=""" + + SELECT + COALESCE(zone, 'Total') AS Zone, + + COUNT(*) AS Total_Requests_Received, + + SUM( CASE WHEN status = '2' AND STR_TO_DATE(close_date, '%Y-%m-%d') <= DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY) THEN 1 ELSE 0 END ) AS Overall_Complaints_Attended, + + (COUNT(*) - SUM(CASE WHEN status IN ('2','4','5') THEN 1 ELSE 0 END)) AS Overall_Pending_Complaints, + + SUM(CASE WHEN status = '4' THEN 1 ELSE 0 END) AS Cancelled_By_User, + + SUM(CASE WHEN status = '5' THEN 1 ELSE 0 END) AS Cancelled_By_Officer, + + SUM( + CASE + WHEN DATE(cdate) <= (DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY)) + AND (close_date IS NULL + OR STR_TO_DATE(close_date, '%Y-%m-%d') > (DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY))) + AND status NOT IN ('4','5') + THEN 1 ELSE 0 + END + ) AS Overall_Balance_Before_Current_Week, + + SUM( + CASE + WHEN DATE(cdate) = CURDATE() + AND status NOT IN ('3','4','5') + THEN 1 ELSE 0 + END + ) AS Today_Complaint_Received, + + SUM( + CASE + WHEN status = '2' + AND STR_TO_DATE(close_date, '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY) + AND STR_TO_DATE(close_date, '%Y-%m-%d') <= DATE_ADD(DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY), INTERVAL 6 DAY) + THEN 1 ELSE 0 + END + ) AS This_Week_Attended, + + ( + (COUNT(*) - SUM(CASE WHEN status IN ('2','4','5') THEN 1 ELSE 0 END)) + - + SUM( + CASE + WHEN status = '3' + AND STR_TO_DATE(close_date, '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY) + AND STR_TO_DATE(close_date, '%Y-%m-%d') <= DATE_ADD(DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY), INTERVAL 6 DAY) + THEN 1 ELSE 0 + END + ) + ) AS Balance_To_Be_Attended + + FROM user_request_table + WHERE is_active = 1 AND is_delete = 0 + GROUP BY zone WITH ROLLUP + ORDER BY + CASE WHEN zone IS NULL THEN 2 ELSE 1 END, + zone + + """; + + LocalDate today = LocalDate.now(); + int weekday = today.getDayOfWeek().getValue(); + LocalDate ocaDate = today.minusDays(weekday).minusDays(1); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); + String formattedOcaDate = ocaDate.format(formatter); + String formattedCurrentDate = today.format(formatter); + + List> reportList = jdbcDomesticWasteTemplate.queryForList(sql); + + Map response = new LinkedHashMap<>(); + response.put("status", "Success"); + response.put("message", "Zonewise Report Details"); + response.put("data", reportList); + response.put("oca_date", formattedOcaDate); + response.put("current_date", formattedCurrentDate); + + return Collections.singletonList(response); + } + + public List> getWardDetails(String zone) { + + String sql=""" + + SELECT + COALESCE(division, 'Total') AS Division, + + COUNT(*) AS Total_Requests_Received, + + SUM( CASE WHEN status = '2' AND STR_TO_DATE(close_date, '%Y-%m-%d') <= DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY) THEN 1 ELSE 0 END ) AS Overall_Complaints_Attended, + + (COUNT(*) - SUM(CASE WHEN status IN ('2','4','5') THEN 1 ELSE 0 END)) AS Overall_Pending_Complaints, + + SUM(CASE WHEN status = '4' THEN 1 ELSE 0 END) AS Cancelled_By_User, + + SUM(CASE WHEN status = '5' THEN 1 ELSE 0 END) AS Cancelled_By_Officer, + + SUM( + CASE + WHEN DATE(cdate) <= (DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY)) + AND (close_date IS NULL + OR STR_TO_DATE(close_date, '%Y-%m-%d') > (DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY))) + AND status NOT IN ('4','5') + THEN 1 ELSE 0 + END + ) AS Overall_Balance_Before_Current_Week, + + SUM( + CASE + WHEN DATE(cdate) = CURDATE() + AND status NOT IN ('3','4','5') + THEN 1 ELSE 0 + END + ) AS Today_Complaint_Received, + + SUM( + CASE + WHEN status = '2' + AND STR_TO_DATE(close_date, '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY) + AND STR_TO_DATE(close_date, '%Y-%m-%d') <= DATE_ADD(DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY), INTERVAL 6 DAY) + THEN 1 ELSE 0 + END + ) AS This_Week_Attended, + + ( + (COUNT(*) - SUM(CASE WHEN status IN ('2','4','5') THEN 1 ELSE 0 END)) + - + SUM( + CASE + WHEN status = '3' + AND STR_TO_DATE(close_date, '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY) + AND STR_TO_DATE(close_date, '%Y-%m-%d') <= DATE_ADD(DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY), INTERVAL 6 DAY) + THEN 1 ELSE 0 + END + ) + ) AS Balance_To_Be_Attended + + FROM user_request_table + WHERE is_active = 1 AND is_delete = 0 AND zone=? + GROUP BY division WITH ROLLUP + ORDER BY + CASE WHEN division IS NULL THEN 2 ELSE 1 END, + division + + """; + + LocalDate today = LocalDate.now(); + int weekday = today.getDayOfWeek().getValue(); + LocalDate ocaDate = today.minusDays(weekday).minusDays(1); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); + String formattedOcaDate = ocaDate.format(formatter); + String formattedCurrentDate = today.format(formatter); + + List> reportList = jdbcDomesticWasteTemplate.queryForList(sql, zone); + + Map response = new LinkedHashMap<>(); + response.put("status", "Success"); + response.put("message", "Ward-wise Details"); + response.put("data", reportList); + response.put("oca_date", formattedOcaDate); + response.put("current_date", formattedCurrentDate); + + return Collections.singletonList(response); + } + + public List> getWardStatusDetailsReport(String ward, String status) { + + String fileBaseUrl = "https://gccservices.in"; + + // โœ… Base SQL (common part) + StringBuilder sql = new StringBuilder(""" + SELECT + u.id, + u.request_id, + u.user_name, + u.mobile, + u.address, + u.latitude, + u.longitude, + u.zone, + u.division, + u.street_name, + u.quantity AS main_quantity, + u.remarks, + CAST(u.is_app AS CHAR) AS is_app, + u.is_active, + u.is_delete, + u.street_id, + CONCAT(?, u.image_url) AS image_url, + DATE_FORMAT(u.cdate, '%d-%m-%Y') AS cdate, + sm.status_master AS status, + DATE_FORMAT(u.close_date, '%d-%m-%Y') AS close_date, + CONCAT(?, u.officer_upload_url) AS officer_upload_url, + itm.iteam_id, + im.item_name, + itm.quantity + FROM user_request_table u + LEFT JOIN items itm ON u.id = itm.req_table_id + LEFT JOIN item_master im ON itm.iteam_id = im.id AND im.is_active = 1 + LEFT JOIN status_master sm ON sm.id = u.status AND sm.is_active = 1 AND sm.is_delete = 0 + WHERE + u.is_active = 1 + AND u.is_delete = 0 + AND u.division = ? + """); + + // โœ… Dynamic WHERE condition based on status + switch (status) { + + + case "1": + sql.append( + """ + AND u.status = '2' AND STR_TO_DATE(u.close_date, '%Y-%m-%d') <= DATE_SUB(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) + 1 DAY), INTERVAL 1 DAY) + """); + break; + + case "2": + + sql.append( + " AND u.status NOT IN ('2','4','5') "); + break; + + case "3": + + sql.append( + " AND DATE(u.cdate) = CURDATE() AND u.status NOT IN ('3','4','5') "); + + break; + + case "4": + + sql.append( + " AND u.status = '2' " + + " AND STR_TO_DATE(u.close_date, '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY) " + + " AND STR_TO_DATE(u.close_date, '%Y-%m-%d') <= DATE_ADD(DATE_SUB(CURDATE(), INTERVAL ((WEEKDAY(CURDATE()) + 2) % 7) DAY), INTERVAL 6 DAY) "); + break; + + + case "5": + + sql.append( + " AND u.status NOT IN ('2','4','5') "); + break; + + default: + // Return empty result if status invalid + return List.of(Map.of( + "status", "Failed", + "message", "Invalid status type", + "data", List.of())); + } + + sql.append(" ORDER BY u.cdate DESC "); + + List> reportList = jdbcDomesticWasteTemplate.queryForList( + sql.toString(), + fileBaseUrl + "/gccofficialapp/files", + fileBaseUrl + "/gccofficialapp/files", + ward); + + Map> groupedMap = new LinkedHashMap<>(); + + for (Map row : reportList) { + Integer id = (Integer) row.get("id"); + + Map item = null; + if (row.get("item_name") != null) { + item = new LinkedHashMap<>(); + item.put("item_name", row.get("item_name")); + item.put("quantity", row.get("quantity")); + } + + if (groupedMap.containsKey(id)) { + if (item != null) { + ((List>) groupedMap.get(id).get("items")).add(item); + } + } else { + Map newEntry = new LinkedHashMap<>(); + newEntry.put("id", id); + newEntry.put("request_id", row.get("request_id")); + newEntry.put("user_name", row.get("user_name")); + newEntry.put("mobile", row.get("mobile")); + newEntry.put("address", row.get("address")); + newEntry.put("latitude", row.get("latitude")); + newEntry.put("longitude", row.get("longitude")); + newEntry.put("zone", row.get("zone")); + newEntry.put("division", row.get("division")); + newEntry.put("street_name", row.get("street_name")); + newEntry.put("main_quantity", row.get("main_quantity")); + newEntry.put("remarks", row.get("remarks")); + newEntry.put("image_url", row.get("image_url")); + newEntry.put("cdate", row.get("cdate")); + newEntry.put("is_active", row.get("is_active")); + newEntry.put("is_delete", row.get("is_delete")); + newEntry.put("street_id", row.get("street_id")); + newEntry.put("status", row.get("status")); + newEntry.put("is_app", row.get("is_app")); + newEntry.put("close_date", row.get("close_date")); + newEntry.put("officer_upload_url", row.get("officer_upload_url")); + + List> items = new ArrayList<>(); + if (item != null) + items.add(item); + newEntry.put("items", items); + + groupedMap.put(id, newEntry); + } + } + + Map response = new LinkedHashMap<>(); + response.put("status", "Success"); + response.put("message", "Ward-wise Report for Status " + status); + response.put("data", groupedMap.values()); + + return Collections.singletonList(response); + } + + public List> getPendingDetails() { + + String fileBaseUrl = "https://gccservices.in"; + + String sql="SELECT " + + " u.id, " + + " u.request_id, " + + " u.user_name, " + + " u.mobile, " + + " u.address, " + + " u.latitude, " + + " u.longitude, " + + " u.zone, " + + " u.division, " + + " u.street_name, " + + " u.quantity AS main_quantity, " + + " u.remarks, " + + " CAST(u.is_app AS CHAR) AS is_app, " + + " u.is_active, " + + " u.is_delete, " + + " u.street_id, " + + " CONCAT(?, u.image_url) AS image_url, " + + " DATE_FORMAT(u.cdate, '%d-%m-%Y') AS cdate, " + + " sm.status_master AS status, " + + " DATE_FORMAT(u.close_date, '%d-%m-%Y') AS close_date, " + + " CONCAT(?, u.officer_upload_url) AS officer_upload_url, " + + " itm.iteam_id, " + + " im.item_name, " + + " itm.quantity, " + + "CASE WHEN is_app = 1 THEN 'NAMMA CHENNAI APP' " + + " WHEN is_app = 2 THEN 'WHATSAPP' " + + " WHEN is_app = 3 THEN '1913' " + + " ELSE 'OTHER SOURCE' " + + " END AS Source " + + " FROM user_request_table u " + + " LEFT JOIN items itm ON u.id = itm.req_table_id " + + " LEFT JOIN item_master im ON itm.iteam_id = im.id AND im.is_active = 1 " + + " LEFT JOIN status_master sm ON sm.id = u.status AND sm.is_active = 1 AND sm.is_delete = 0 " + + " WHERE " + + " u.is_active = 1 " + + " AND u.is_delete = 0 AND u.status NOT IN ('2','4','5') ORDER BY u.zone,u.division,u.cdate DESC"; + + + List> reportList = jdbcDomesticWasteTemplate.queryForList( + sql.toString(), + fileBaseUrl + "/gccofficialapp/files", + fileBaseUrl + "/gccofficialapp/files" + ); + + Map> groupedMap = new LinkedHashMap<>(); + + for (Map row : reportList) { + Integer id = (Integer) row.get("id"); + + Map item = null; + if (row.get("item_name") != null) { + item = new LinkedHashMap<>(); + item.put("item_name", row.get("item_name")); + item.put("quantity", row.get("quantity")); + } + + if (groupedMap.containsKey(id)) { + if (item != null) { + ((List>) groupedMap.get(id).get("items")).add(item); + } + } else { + Map newEntry = new LinkedHashMap<>(); + newEntry.put("id", id); + newEntry.put("request_id", row.get("request_id")); + newEntry.put("user_name", row.get("user_name")); + newEntry.put("mobile", row.get("mobile")); + newEntry.put("address", row.get("address")); + newEntry.put("latitude", row.get("latitude")); + newEntry.put("longitude", row.get("longitude")); + newEntry.put("zone", row.get("zone")); + newEntry.put("division", row.get("division")); + newEntry.put("street_name", row.get("street_name")); + newEntry.put("main_quantity", row.get("main_quantity")); + newEntry.put("remarks", row.get("remarks")); + newEntry.put("image_url", row.get("image_url")); + newEntry.put("cdate", row.get("cdate")); + newEntry.put("is_active", row.get("is_active")); + newEntry.put("is_delete", row.get("is_delete")); + newEntry.put("street_id", row.get("street_id")); + newEntry.put("status", row.get("status")); + newEntry.put("is_app", row.get("is_app")); + newEntry.put("Source", row.get("Source")); + newEntry.put("close_date", row.get("close_date")); + newEntry.put("officer_upload_url", row.get("officer_upload_url")); + + List> items = new ArrayList<>(); + if (item != null) + items.add(item); + newEntry.put("items", items); + + groupedMap.put(id, newEntry); + } + } + + Map response = new LinkedHashMap<>(); + response.put("status", "Success"); + response.put("message", "Pending Detail Report for Sofa Bed Collection"); + response.put("data", groupedMap.values()); + + String sqldata1="SELECT " + + " COUNT(*) AS count, " + + " CASE " + + " WHEN is_app = 1 THEN 'NAMMA CHENNAI APP' " + + " WHEN is_app = 2 THEN 'WHATSAPP' " + + " ELSE '1913' " + + " END AS SOURCE " + + "FROM user_request_table " + + "WHERE is_active = 1 " + + " AND is_delete = 0 " + + " AND status NOT IN (4,5) " + + "GROUP BY SOURCE " + + " " + + "UNION ALL " + + " " + + "SELECT " + + " COUNT(*) AS count, " + + " 'Total' AS SOURCE " + + "FROM user_request_table " + + "WHERE is_active = 1 " + + " AND is_delete = 0 " + + " AND status NOT IN (4,5) " + + " " + + "ORDER BY " + + " CASE " + + " WHEN SOURCE = 'NAMMA CHENNAI APP' THEN 1 " + + " WHEN SOURCE = 'WHATSAPP' THEN 2 " + + " WHEN SOURCE = '1913' THEN 3 " + + " WHEN SOURCE = 'Total' THEN 4 " + + " END"; + + List> sourcedata = jdbcDomesticWasteTemplate.queryForList(sqldata1); + response.put("source_data", sourcedata); + + String sqldata2="SELECT " + + " COUNT(*) AS total_count, " + + " CASE " + + " WHEN sm.id IN (1, 3) THEN 'Pending' " + + " WHEN sm.id = 2 THEN 'Completed' " + + " ELSE 'Others' " + + " END AS status_category " + + "FROM user_request_table urt " + + "LEFT JOIN status_master sm ON urt.status = sm.id " + + "WHERE urt.is_active = 1 " + + " AND urt.is_delete = 0 " + + " AND urt.status NOT IN (4, 5) " + + "GROUP BY status_category " + + " " + + "UNION ALL " + + " " + + "SELECT " + + " COUNT(*) AS total_count, " + + " 'Total' AS status_category " + + "FROM user_request_table urt " + + "LEFT JOIN status_master sm ON urt.status = sm.id " + + "WHERE urt.is_active = 1 " + + " AND urt.is_delete = 0 " + + " AND urt.status NOT IN (4, 5) " + + " " + + "ORDER BY " + + " CASE " + + " WHEN status_category = 'Pending' THEN 1 " + + " WHEN status_category = 'Completed' THEN 2 " + + " WHEN status_category = 'Others' THEN 3 " + + " WHEN status_category = 'Total' THEN 4 " + + " END"; + + List> statusdata = jdbcDomesticWasteTemplate.queryForList(sqldata2); + response.put("status_data", statusdata); + + + return Collections.singletonList(response); + } + + } diff --git a/src/main/resources/templates/modules/pet/petlicense.html b/src/main/resources/templates/modules/pet/petlicense.html index b2a1efc..c7e36b3 100644 --- a/src/main/resources/templates/modules/pet/petlicense.html +++ b/src/main/resources/templates/modules/pet/petlicense.html @@ -2,7 +2,7 @@ Pet License Zonewise Report Summary - + @@ -17,7 +17,7 @@ vertical-align: middle; border: 1px solid #000; } - + table.dataTable th{ background-color: #003366 !important; color: white; @@ -45,8 +45,8 @@ text-align: center; white-space: nowrap; } - - + + @@ -55,50 +55,49 @@

Pet License - MIS Report

- - + +
-

Microchip Details:

- - - - - - -
Total requirement:  Completed:  Pending:  
- + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + - +
ZonesLicenseVaccination
License Total RequestCompletedPendingVaccination Total RequestCompletedPending
ZonesLicenseVaccination
Total license RequestCompletedPendingVaccination PetVaccination Community
Total RequestCompletedPendingTotal RequestCompletedPending
@@ -134,7 +133,7 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/sofa_bed/pendingdetails.html b/src/main/resources/templates/modules/sofa_bed/pendingdetails.html new file mode 100644 index 0000000..d735427 --- /dev/null +++ b/src/main/resources/templates/modules/sofa_bed/pendingdetails.html @@ -0,0 +1,440 @@ + + + + Pending Details of Sofa Bed collection + + + + + + + + + + + + +
+

Pending Details of Sofa,Bed,furniture and Cloths

+
+ + +
+
+ +
+
+ + + + + + + + +
Received FromTotal
+
+
+ + +
+
+ + + + + + + + + +
StatusTotal
+
+
+
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
S.NoZoneDivisionRequest IdRegistered DateUser NameMobileAddressStreet NameImageRemarksItemsSource
+
+ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file