|
|
|
@ -30,25 +30,21 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class BirthAndDeathDetailsService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private final RestTemplate restTemplate; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private JdbcTemplate jdbcTemplate; |
|
|
|
|
|
|
|
public BirthAndDeathDetailsService(RestTemplateBuilder builder) { |
|
|
|
|
|
|
|
public BirthAndDeathDetailsService(RestTemplateBuilder builder) { |
|
|
|
this.restTemplate = builder.build(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//using for live |
|
|
|
|
|
|
|
public Map<String, Object> fetchBirthCertificate(String dob, String sex, String regno, String childName, String fatherName, String motherName) throws Exception { |
|
|
|
|
|
|
|
// using for live |
|
|
|
|
|
|
|
public Map<String, Object> fetchBirthCertificate(String dob, String sex, String regno, String childName, |
|
|
|
String fatherName, String motherName) throws Exception { |
|
|
|
Map<String, String> params = new LinkedHashMap(); // keep order |
|
|
|
params.put("regno", regno != null ? regno : ""); |
|
|
|
params.put("sex", sex); |
|
|
|
@ -61,10 +57,11 @@ public class BirthAndDeathDetailsService { |
|
|
|
String serviceInput = mapper.writeValueAsString(params); |
|
|
|
|
|
|
|
// Final raw URL — NOT encoded |
|
|
|
String BirthCertificateapiUrl = "https://chennaicorporation.gov.in/gcc/Api/BirthCertificate_json.jsp?serviceinput=" + serviceInput; |
|
|
|
String BirthCertificateapiUrl = "https://chennaicorporation.gov.in/gcc/Api/BirthCertificate_json.jsp?serviceinput=" |
|
|
|
+ serviceInput; |
|
|
|
|
|
|
|
//System.out.println("⏩ Raw JSON: " + serviceInput); |
|
|
|
//System.out.println("🌐 FINAL RAW URL: " + BirthCertificateapiUrl); |
|
|
|
// System.out.println("⏩ Raw JSON: " + serviceInput); |
|
|
|
// System.out.println("🌐 FINAL RAW URL: " + BirthCertificateapiUrl); |
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.set("User-Agent", "Mozilla/5.0"); |
|
|
|
@ -72,128 +69,125 @@ public class BirthAndDeathDetailsService { |
|
|
|
HttpEntity<String> entity = new HttpEntity<>(headers); |
|
|
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
|
ResponseEntity<String> response = restTemplate.exchange(BirthCertificateapiUrl, HttpMethod.GET, entity, String.class); |
|
|
|
|
|
|
|
ResponseEntity<String> response = restTemplate.exchange(BirthCertificateapiUrl, HttpMethod.GET, entity, |
|
|
|
String.class); |
|
|
|
|
|
|
|
String rawJson = response.getBody(); |
|
|
|
String cleanJson = sanitizeJsonResponse(rawJson); |
|
|
|
|
|
|
|
|
|
|
|
//System.out.println("✅ API Raw Response: " + cleanJson); |
|
|
|
// System.out.println("✅ API Raw Response: " + cleanJson); |
|
|
|
|
|
|
|
return mapper.readValue(cleanJson, new TypeReference<Map<String, Object>>() {}); |
|
|
|
return mapper.readValue(cleanJson, new TypeReference<Map<String, Object>>() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// to created our external api from restservices |
|
|
|
|
|
|
|
public Map<String, Object> fetchLocalBirthCertificate( |
|
|
|
String dob, String fatherName, String motherName, String childName, String sex) throws Exception { |
|
|
|
// to created our external api from restservices |
|
|
|
|
|
|
|
String apiUrl = "https://gccservices.chennaicorporation.gov.in/gccrestservices/api/birth-certificate/by-detailsnewforWeb"; |
|
|
|
public Map<String, Object> fetchLocalBirthCertificate( |
|
|
|
String dob, String fatherName, String motherName, String childName, String sex) throws Exception { |
|
|
|
|
|
|
|
MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); |
|
|
|
params.add("incident_date", dob); // yyyy-MM-dd |
|
|
|
params.add("gender", sex); |
|
|
|
String apiUrl = "https://gccservices.chennaicorporation.gov.in/gccrestservices/api/birth-certificate/by-detailsnewforWeb"; |
|
|
|
|
|
|
|
// 🔹 Pass optional values if provided (converted to UPPERCASE, DB expects this) |
|
|
|
if (fatherName != null && !fatherName.trim().isEmpty()) { |
|
|
|
params.add("father_name", fatherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (motherName != null && !motherName.trim().isEmpty()) { |
|
|
|
params.add("mother_name", motherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (childName != null && !childName.trim().isEmpty()) { |
|
|
|
params.add("child_name", childName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
// String apiUrl = |
|
|
|
// "http://localhost:8077/gccrestservices/api/birth-certificate/by-detailsnewforWeb"; |
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
|
|
|
MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); |
|
|
|
params.add("incident_date", dob); // yyyy-MM-dd |
|
|
|
params.add("gender", sex); |
|
|
|
|
|
|
|
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(params, headers); |
|
|
|
// 🔹 Pass optional values if provided (converted to UPPERCASE, DB expects this) |
|
|
|
if (fatherName != null && !fatherName.trim().isEmpty()) { |
|
|
|
params.add("father_name", fatherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (motherName != null && !motherName.trim().isEmpty()) { |
|
|
|
params.add("mother_name", motherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (childName != null && !childName.trim().isEmpty()) { |
|
|
|
params.add("child_name", childName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
|
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); |
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
|
|
|
|
|
|
|
String rawJson = response.getBody(); |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
Map<String, Object> result = mapper.readValue(rawJson, new TypeReference<Map<String, Object>>() {}); |
|
|
|
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(params, headers); |
|
|
|
|
|
|
|
// ✅ Only keep records that actually have a PDF link |
|
|
|
if (result.containsKey("certificate_details")) { |
|
|
|
List<Map<String, Object>> details = (List<Map<String, Object>>) result.get("certificate_details"); |
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); |
|
|
|
|
|
|
|
List<Map<String, Object>> filtered = details.stream() |
|
|
|
.filter(row -> row.get("pdf_url") != null && !row.get("pdf_url").toString().trim().isEmpty()) |
|
|
|
.toList(); |
|
|
|
String rawJson = response.getBody(); |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
Map<String, Object> result = mapper.readValue(rawJson, new TypeReference<Map<String, Object>>() { |
|
|
|
}); |
|
|
|
|
|
|
|
result.put("certificate_details", filtered); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
// ✅ Only keep records that actually have a PDF link |
|
|
|
if (result.containsKey("certificate_details")) { |
|
|
|
List<Map<String, Object>> details = (List<Map<String, Object>>) result.get("certificate_details"); |
|
|
|
|
|
|
|
List<Map<String, Object>> filtered = details.stream() |
|
|
|
.filter(row -> row.get("pdf_url") != null && !row.get("pdf_url").toString().trim().isEmpty()) |
|
|
|
.toList(); |
|
|
|
|
|
|
|
result.put("certificate_details", filtered); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
// to created our external api from restservices |
|
|
|
|
|
|
|
public Map<String, Object> fetchLocalDeathCertificate( |
|
|
|
String dod, String fatherName, String motherName, String personName, String sex) throws Exception { |
|
|
|
|
|
|
|
String apiUrl = "https://gccservices.chennaicorporation.gov.in/gccrestservices/api/death-certificate/by-detailsnewforWeb"; |
|
|
|
|
|
|
|
// to created our external api from restservices |
|
|
|
|
|
|
|
public Map<String, Object> fetchLocalDeathCertificate( |
|
|
|
String dod, String fatherName, String motherName, String personName, String sex) throws Exception { |
|
|
|
// String apiUrl = |
|
|
|
// "http://localhost:8077/gccrestservices/api/death-certificate/by-detailsnewforWeb"; |
|
|
|
|
|
|
|
String apiUrl = "https://gccservices.chennaicorporation.gov.in/gccrestservices/api/death-certificate/by-detailsnewforWeb"; |
|
|
|
MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); |
|
|
|
params.add("incident_date", dod); // yyyy-MM-dd |
|
|
|
params.add("gender", sex); |
|
|
|
|
|
|
|
MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); |
|
|
|
params.add("incident_date", dod); // yyyy-MM-dd |
|
|
|
params.add("gender", sex); |
|
|
|
// 🔹 Pass optional values if provided (converted to UPPERCASE, DB expects this) |
|
|
|
if (fatherName != null && !fatherName.trim().isEmpty()) { |
|
|
|
params.add("father_name", fatherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (motherName != null && !motherName.trim().isEmpty()) { |
|
|
|
params.add("mother_name", motherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (personName != null && !personName.trim().isEmpty()) { |
|
|
|
params.add("person_name", personName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
|
|
|
|
// 🔹 Pass optional values if provided (converted to UPPERCASE, DB expects this) |
|
|
|
if (fatherName != null && !fatherName.trim().isEmpty()) { |
|
|
|
params.add("father_name", fatherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (motherName != null && !motherName.trim().isEmpty()) { |
|
|
|
params.add("mother_name", motherName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
if (personName != null && !personName.trim().isEmpty()) { |
|
|
|
params.add("person_name", personName.trim().toUpperCase()); |
|
|
|
} |
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
|
|
|
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(params, headers); |
|
|
|
|
|
|
|
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(params, headers); |
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); |
|
|
|
|
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); |
|
|
|
String rawJson = response.getBody(); |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
Map<String, Object> result = mapper.readValue(rawJson, new TypeReference<Map<String, Object>>() { |
|
|
|
}); |
|
|
|
// ✅ Only keep records that actually have a PDF link |
|
|
|
if (result.containsKey("certificate_details")) { |
|
|
|
List<Map<String, Object>> details = (List<Map<String, Object>>) result.get("certificate_details"); |
|
|
|
|
|
|
|
String rawJson = response.getBody(); |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
Map<String, Object> result = mapper.readValue(rawJson, new TypeReference<Map<String, Object>>() {}); |
|
|
|
//✅ Only keep records that actually have a PDF link |
|
|
|
if (result.containsKey("certificate_details")) { |
|
|
|
List<Map<String, Object>> details = (List<Map<String, Object>>) result.get("certificate_details"); |
|
|
|
List<Map<String, Object>> filtered = details.stream() |
|
|
|
.filter(row -> row.get("pdf_url") != null && !row.get("pdf_url").toString().trim().isEmpty()) |
|
|
|
.toList(); |
|
|
|
|
|
|
|
List<Map<String, Object>> filtered = details.stream() |
|
|
|
.filter(row -> row.get("pdf_url") != null && !row.get("pdf_url").toString().trim().isEmpty()) |
|
|
|
.toList(); |
|
|
|
result.put("certificate_details", filtered); |
|
|
|
} |
|
|
|
|
|
|
|
result.put("certificate_details", filtered); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// using in live |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//using in live |
|
|
|
|
|
|
|
public Map<String, Object> fetchDeathCertificate(String dod, String sex, String regno, String personName, String fatherName, String motherName) throws Exception { |
|
|
|
public Map<String, Object> fetchDeathCertificate(String dod, String sex, String regno, String personName, |
|
|
|
String fatherName, String motherName) throws Exception { |
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
Map<String, String> params = new LinkedHashMap(); // keep order |
|
|
|
Map<String, String> params = new LinkedHashMap(); // keep order |
|
|
|
params.put("regno", regno != null ? regno : ""); |
|
|
|
params.put("sex", sex); |
|
|
|
params.put("dod", dod); |
|
|
|
@ -205,10 +199,11 @@ public class BirthAndDeathDetailsService { |
|
|
|
String serviceInput = mapper.writeValueAsString(params); |
|
|
|
|
|
|
|
// Final raw URL — NOT encoded |
|
|
|
String DeathCertificateapiUrl = "https://chennaicorporation.gov.in/gcc/Api/DeathCertificate_json.jsp?serviceinput=" + serviceInput; |
|
|
|
String DeathCertificateapiUrl = "https://chennaicorporation.gov.in/gcc/Api/DeathCertificate_json.jsp?serviceinput=" |
|
|
|
+ serviceInput; |
|
|
|
|
|
|
|
//System.out.println("⏩ Raw JSON: " + serviceInput); |
|
|
|
//System.out.println("🌐 FINAL RAW URL: " + DeathCertificateapiUrl); |
|
|
|
// System.out.println("⏩ Raw JSON: " + serviceInput); |
|
|
|
// System.out.println("🌐 FINAL RAW URL: " + DeathCertificateapiUrl); |
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.set("User-Agent", "Mozilla/5.0"); |
|
|
|
@ -216,86 +211,76 @@ public class BirthAndDeathDetailsService { |
|
|
|
HttpEntity<String> entity = new HttpEntity<>(headers); |
|
|
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
|
ResponseEntity<String> response = restTemplate.exchange(DeathCertificateapiUrl, HttpMethod.GET, entity, String.class); |
|
|
|
ResponseEntity<String> response = restTemplate.exchange(DeathCertificateapiUrl, HttpMethod.GET, entity, |
|
|
|
String.class); |
|
|
|
|
|
|
|
//System.out.println("✅ API Raw Response: " + response.getBody()); |
|
|
|
// System.out.println("✅ API Raw Response: " + response.getBody()); |
|
|
|
String rawJson = response.getBody(); |
|
|
|
String cleanJson = sanitizeJsonResponse(rawJson); |
|
|
|
|
|
|
|
return mapper.readValue(cleanJson, new TypeReference<Map<String, Object>>() {}); |
|
|
|
return mapper.readValue(cleanJson, new TypeReference<Map<String, Object>>() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private String sanitizeJsonResponse(String rawJson) { |
|
|
|
if (rawJson == null) |
|
|
|
return ""; |
|
|
|
|
|
|
|
// Remove quote before parenthesis (fixes: "NAME" : "ABC "(LATE)") |
|
|
|
String fixed = rawJson.replaceAll("\"\\s*\\(([^)]*)\\)\"", " ($1)\""); |
|
|
|
|
|
|
|
// Remove parenthesis and content outside of quotes (fixes: ... "ABC" (LATE) ... |
|
|
|
// → ... "ABC" ...) |
|
|
|
fixed = fixed.replaceAll("\"\\s*\\([^)]*\\)", "\""); |
|
|
|
|
|
|
|
return fixed |
|
|
|
.replace("\\", "\\\\") // Escape backslashes |
|
|
|
.replaceAll("[\\p{Cntrl}&&[^\r\n\t]]", "") // Remove non-printable control characters |
|
|
|
.replaceAll("\t", "") // Remove tab characters |
|
|
|
.replaceAll("\\s*:\\s*\n\\s*\"", ":\"") // Fix broken key-value splits |
|
|
|
.replaceAll("\r", "") // Remove carriage return |
|
|
|
.replaceAll("\n", "") // Remove newlines |
|
|
|
.replaceAll(",\\s*\\[", "[") // Remove comma before array start |
|
|
|
.replaceAll("\\[\\s*,", "[") // Remove comma after array start |
|
|
|
.replaceAll(",\\s*\\]", "]") // Remove trailing comma in array |
|
|
|
.replaceAll("\"\"\"", "\"\"") // fix triple quotes |
|
|
|
.replaceAll("\"{3,}", "\"") // collapse 3+ quotes to 1 |
|
|
|
.replaceAll(":(\\s*)\"{2,}\"", ":\"\""); // handle `:"""` to `:""` |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
public ResponseEntity<?> saveNewUser(String user_name, String user_address, String user_mobile) { |
|
|
|
Map<String, Object> result = new HashMap(); |
|
|
|
String sql = "INSERT INTO users (user_name, user_address, user_mobile) VALUES (?, ?, ?)"; |
|
|
|
try { |
|
|
|
jdbcTemplate.update(sql, user_name, user_address, user_mobile); |
|
|
|
result.put("message", "New User Saved Sucessfully"); |
|
|
|
result.put("data", "Success"); |
|
|
|
return ResponseEntity.ok(result); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
result.put("message", "Error"); |
|
|
|
result.put("Error", "Failed to save new user: " + e.getMessage()); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public boolean isUserRegistered(String mobile) { |
|
|
|
String sql = "SELECT COUNT(*) FROM users WHERE user_mobile = ?"; |
|
|
|
Integer count = jdbcTemplate.queryForObject(sql, new Object[] { mobile }, Integer.class); |
|
|
|
return count != null && count > 0; |
|
|
|
} |
|
|
|
|
|
|
|
public ResponseEntity<?> saveCertificateLogs(String regNo, String eventDate, String url, String service, |
|
|
|
int userid) { |
|
|
|
String sql = "Insert into certificate_logs (regno, event_date, english_url, service, user_id) VALUES (?, ?, ?, ?, ?)"; |
|
|
|
Integer count = jdbcTemplate.update(sql, regNo, eventDate, url, service, userid); |
|
|
|
return count != null && count > 0 ? ResponseEntity.ok(count) : ResponseEntity.notFound().build(); |
|
|
|
} |
|
|
|
|
|
|
|
private String sanitizeJsonResponse(String rawJson) { |
|
|
|
if (rawJson == null) return ""; |
|
|
|
|
|
|
|
// Remove quote before parenthesis (fixes: "NAME" : "ABC "(LATE)") |
|
|
|
String fixed = rawJson.replaceAll("\"\\s*\\(([^)]*)\\)\"", " ($1)\""); |
|
|
|
|
|
|
|
// Remove parenthesis and content outside of quotes (fixes: ... "ABC" (LATE) ... → ... "ABC" ...) |
|
|
|
fixed = fixed.replaceAll("\"\\s*\\([^)]*\\)", "\""); |
|
|
|
|
|
|
|
return fixed |
|
|
|
.replace("\\", "\\\\") // Escape backslashes |
|
|
|
.replaceAll("[\\p{Cntrl}&&[^\r\n\t]]", "") // Remove non-printable control characters |
|
|
|
.replaceAll("\t", "") // Remove tab characters |
|
|
|
.replaceAll("\\s*:\\s*\n\\s*\"", ":\"") // Fix broken key-value splits |
|
|
|
.replaceAll("\r", "") // Remove carriage return |
|
|
|
.replaceAll("\n", "") // Remove newlines |
|
|
|
.replaceAll(",\\s*\\[", "[") // Remove comma before array start |
|
|
|
.replaceAll("\\[\\s*,", "[") // Remove comma after array start |
|
|
|
.replaceAll(",\\s*\\]", "]") // Remove trailing comma in array |
|
|
|
.replaceAll("\"\"\"", "\"\"") // fix triple quotes |
|
|
|
.replaceAll("\"{3,}", "\"") // collapse 3+ quotes to 1 |
|
|
|
.replaceAll(":(\\s*)\"{2,}\"", ":\"\""); // handle `:"""` to `:""` |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
public ResponseEntity<?> saveNewUser(String user_name, String user_address, String user_mobile) { |
|
|
|
Map<String, Object> result = new HashMap(); |
|
|
|
String sql = "INSERT INTO users (user_name, user_address, user_mobile) VALUES (?, ?, ?)"; |
|
|
|
try { |
|
|
|
jdbcTemplate.update(sql, user_name, user_address, user_mobile); |
|
|
|
result.put("message", "New User Saved Sucessfully"); |
|
|
|
result.put("data", "Success"); |
|
|
|
return ResponseEntity.ok(result); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
result.put("message", "Error"); |
|
|
|
result.put("Error", "Failed to save new user: " + e.getMessage()); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isUserRegistered(String mobile) { |
|
|
|
String sql = "SELECT COUNT(*) FROM users WHERE user_mobile = ?"; |
|
|
|
Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mobile}, Integer.class); |
|
|
|
return count != null && count > 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ResponseEntity<?> saveCertificateLogs(String regNo, String eventDate, String url, String service, int userid) { |
|
|
|
String sql = "Insert into certificate_logs (regno, event_date, english_url, service, user_id) VALUES (?, ?, ?, ?, ?)"; |
|
|
|
Integer count = jdbcTemplate.update(sql, regNo, eventDate, url, service, userid); |
|
|
|
return count != null && count > 0 ? ResponseEntity.ok(count) : ResponseEntity.notFound().build(); |
|
|
|
} |
|
|
|
|
|
|
|
public Map<String,Object> getUserDetails(String mobNo) { |
|
|
|
String sql = "Select * from users where user_mobile = ?"; |
|
|
|
return jdbcTemplate.queryForMap(sql, mobNo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getUserDetails(String mobNo) { |
|
|
|
String sql = "Select * from users where user_mobile = ?"; |
|
|
|
return jdbcTemplate.queryForMap(sql, mobNo); |
|
|
|
} |
|
|
|
|
|
|
|
} |