From 6ef30c7b8aef163caf9d169d31fd54487d1fe6db Mon Sep 17 00:00:00 2001 From: Dizho A Date: Wed, 23 Sep 2026 15:22:59 +0530 Subject: [PATCH] Update the Resuce Mobile Service at Shelter --- .../configuration/DataSourceConfig.java | 4 +- .../ShelterRescueApiController.java | 9 +++++ .../Service/ShelterResucueService.java | 38 +++++++++++++++---- src/main/resources/application.properties | 2 +- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java b/src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java index d57b8e10..044ea6de 100644 --- a/src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java +++ b/src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java @@ -20,8 +20,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableTransactionManagement 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 dbpassword = "gccroot"; // AWS diff --git a/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Controller/ShelterRescueApiController.java b/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Controller/ShelterRescueApiController.java index d5b26517..2ce63a05 100644 --- a/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Controller/ShelterRescueApiController.java +++ b/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Controller/ShelterRescueApiController.java @@ -90,6 +90,15 @@ public class ShelterRescueApiController { response.put("data", data); return ResponseEntity.ok(response); } + + @GetMapping("/resuce_designation_category") + public ResponseEntity getResuceDesignationCategory() { + List> data = shelterResucueService.getResuceDesignationCategory(); + Map response = new HashMap<>(); + response.put("status", true); + response.put("data", data); + return ResponseEntity.ok(response); + } @PostMapping("/save") diff --git a/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Service/ShelterResucueService.java b/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Service/ShelterResucueService.java index 15823e01..6a92eb42 100644 --- a/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Service/ShelterResucueService.java +++ b/src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Service/ShelterResucueService.java @@ -250,7 +250,11 @@ public class ShelterResucueService { public List> getQuestionsCategory() { String sql = "SELECT * FROM question_category_resuce_master where isactive=1 and isdelete=0 order by orderby"; return jdbcShelterRescueTemplate.queryForList(sql); - + } + + public List> getResuceDesignationCategory() { + String sql = "SELECT id, english_name FROM resuce_designation_master where isactive=1 and isdelete=0 order by orderby"; + return jdbcShelterRescueTemplate.queryForList(sql); } public List> getDistricts(String sid) { @@ -351,6 +355,13 @@ public class ShelterResucueService { String latitude = params.get("latitude"); String longitude = params.get("longitude"); String shelterId = params.get("shelter_id"); + + String resuceDesignation = params.get("resuce_designation"); + String hospitalName = params.get("hospital_name"); + + System.out.println(" resuceDesignation: " + resuceDesignation); + System.out.println(" hospitalName: " + hospitalName); + //String address = params.get("address"); ) // System.out.println(" surveyId: " + surveyId); // System.out.println(" cid: " + cid); @@ -417,9 +428,14 @@ public class ShelterResucueService { // first (like in child_survey) if (cid != null && cid.equals("1") && (zone != null || resolvedLat != null || resolvedLng != null)) { try { - String logindetailsSql = "INSERT INTO surveyor_location_resuce_details " + - "(loginId, zone, ward, latitude, longitude, shelter_id, is_active, is_delete, cdate) " + - "VALUES (?, ?, ?, ?, ?, ?, 1, 0, NOW())"; +// String logindetailsSql = "INSERT INTO surveyor_location_resuce_details " + +// "(loginId, zone, ward, latitude, longitude, shelter_id, is_active, is_delete, cdate) " + +// "VALUES (?, ?, ?, ?, ?, ?, 1, 0, NOW())"; + + String logindetailsSql = "INSERT INTO surveyor_location_resuce_details " + + "(loginId, zone, ward, latitude, longitude, shelter_id, " + + "resuce_designation, hospital_name, is_active, is_delete, cdate) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1, 0, NOW())"; org.springframework.jdbc.support.KeyHolder keyHolder = new org.springframework.jdbc.support.GeneratedKeyHolder(); @@ -440,6 +456,9 @@ public class ShelterResucueService { ps.setString(4, finalLat); ps.setString(5, finalLng); ps.setString(6, shelterId); + + ps.setString(7, resuceDesignation); + ps.setString(8, hospitalName); return ps; }, keyHolder); @@ -552,10 +571,14 @@ public class ShelterResucueService { String insertparticipateSql = "INSERT INTO shelter_resuce_participate_response (qid, answer, others_answer, survey_id, cid, cby, parent_answer_id, cdate, isactive, isdelete) " + "VALUES (?, ?, ?, ?, ?, ?, ?, NOW(), 1, 0)"; + + String insertSql = "INSERT INTO shelter_resuce_response (qid, answer, others_answer, survey_id, cid, cby, parent_answer_id, cdate, isactive, isdelete) " + "VALUES (?, ?, ?, ?, ?, ?, ?, NOW(), 1, 0)"; + + String qSql = "SELECT qid, question_type, field_name, q_english FROM shelter_resuce_questions_master " + "WHERE cid = ? AND (isactive = 1 AND isdelete = 0 OR (cid = '1' AND field_name IN ('q2', 'q78', 'q11', 'q8', 'q9', 'q10', 'q77')))"; @@ -749,8 +772,8 @@ public class ShelterResucueService { if (isNotWilling) { jdbcShelterRescueTemplate.update(insertparticipateSql, qid, answer, othersAnswer, surveyId, - cid, cby, - parentAnswerId); + cid, cby,parentAnswerId); + // System.out.println("--- DB SAVE (Participate) --- QID: " + qid + " | // FieldName: " + fieldName + " | Answer: " + answer + " | OthersAnswer: " + // othersAnswer); @@ -758,6 +781,7 @@ public class ShelterResucueService { if (!hasNotWillingResponse) { jdbcShelterRescueTemplate.update(insertSql, qid, answer, othersAnswer, surveyId, cid, cby, parentAnswerId); + // System.out.println("--- DB SAVE (Response) --- QID: " + qid + " | FieldName: // " + fieldName + " | Answer: " + answer + " | OthersAnswer: " + othersAnswer); } @@ -1179,7 +1203,7 @@ public class ShelterResucueService { } else if ("gender".equals(cleanKey)) { qid = 9; } - else if ("shelter_assigned".equals(cleanKey)) { + else if ("remark".equals(cleanKey)) { qid = 10; } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 959be862..ddde7c02 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -# spring.profiles.active=local +#spring.profiles.active=local spring.profiles.active=production spring.application.name=Mobile Service