Browse Source

Update the Resuce Mobile Service at Shelter

master
Dizho A 3 weeks ago
parent
commit
6ef30c7b8a
  1. 4
      src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java
  2. 9
      src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Controller/ShelterRescueApiController.java
  3. 38
      src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Service/ShelterResucueService.java
  4. 2
      src/main/resources/application.properties

4
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

9
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<Map<String, Object>> data = shelterResucueService.getResuceDesignationCategory();
Map<String, Object> response = new HashMap<>();
response.put("status", true);
response.put("data", data);
return ResponseEntity.ok(response);
}
@PostMapping("/save")

38
src/main/java/in/gov/chennaicorporation/mobileservice/gccShelter/Service/ShelterResucueService.java

@ -250,7 +250,11 @@ public class ShelterResucueService {
public List<Map<String, Object>> getQuestionsCategory() {
String sql = "SELECT * FROM question_category_resuce_master where isactive=1 and isdelete=0 order by orderby";
return jdbcShelterRescueTemplate.queryForList(sql);
}
public List<Map<String, Object>> 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<Map<String, Object>> 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;
}
}

2
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

Loading…
Cancel
Save