|
|
|
@ -36,7 +36,6 @@ import jakarta.servlet.http.HttpSession; |
|
|
|
@RequestMapping("/crs/api") |
|
|
|
public class ApiController { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private JdbcTemplate jdbcTemplate; |
|
|
|
|
|
|
|
@ -46,10 +45,8 @@ public class ApiController { |
|
|
|
@Autowired |
|
|
|
private BirthAndDeathDetailsService birthAndDeathDetailsService; |
|
|
|
|
|
|
|
|
|
|
|
private final RestTemplate restTemplate = new RestTemplate(); |
|
|
|
|
|
|
|
|
|
|
|
/* ///////////////// otp configuration ///////////////////// */ |
|
|
|
|
|
|
|
@GetMapping(value = "/sendOTP") |
|
|
|
@ -70,20 +67,26 @@ public class ApiController { |
|
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm"); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
System.out.println(dtf.format(now)); |
|
|
|
//String generatedToken = "Welcome to GCC! Your OTP for C%26D waste collectors Registration process is "+otp; |
|
|
|
// String generatedToken = "Welcome to GCC! Your OTP for C%26D waste collectors |
|
|
|
// Registration process is "+otp; |
|
|
|
|
|
|
|
//String generatedToken = "Welcome to GCC "+otp+" is your OTP for gcc QR System"; |
|
|
|
// String generatedToken = "Welcome to GCC "+otp+" is your OTP for gcc QR |
|
|
|
// System"; |
|
|
|
|
|
|
|
String generatedToken = "Welcome to GCC! Your OTP for Birth and Death Certificate login is " + otp; |
|
|
|
//String generatedToken = "Welcome to GCC! Your OTP for C and D waste collectors Registration process is " + otp; |
|
|
|
// String generatedToken = "Welcome to GCC! Your OTP for C and D waste |
|
|
|
// collectors Registration process is " + otp; |
|
|
|
// String key="qxg4mklD"; |
|
|
|
String key = "pfTEYN6H"; |
|
|
|
String urlString= appConfig.getGetOtpUrl()+"from=GCCCRP&key="+key+"&sender=GCCCRP&to="+MobileNo+"&body="+generatedToken+"&entityid=1401572690000011081&templateid=1407174687453240990"; |
|
|
|
|
|
|
|
|
|
|
|
//String urlString = "https://tmegov.onex-aura.com/api/sms?from=GCCCRP&key=pfTEYN6H&sender=GCCCRP&to=9360777472&body=Welcome%20to%20GCC!%20Your%20OTP%20for%20C%26D%20waste%20collectors%20Registration%20process%20is%20"+otp+"&entityid=1401572690000011081&templateid=1407172959127552127"; |
|
|
|
//String urlString= appConfig.getGetOtpUrl()+"from=GCCCRP&key="+key+"&sender=GCCCRP&to="+MobileNo+"&body="+generatedToken+"&entityid=1401572690000011081&templateid=1407168250479102852"; |
|
|
|
// String urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+MobileNo+"&text="+generatedToken+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407168250479102852"; |
|
|
|
String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP&key=" + key + "&sender=GCCCRP&to=" + MobileNo |
|
|
|
+ "&body=" + generatedToken + "&entityid=1401572690000011081&templateid=1407174687453240990"; |
|
|
|
|
|
|
|
// String urlString = |
|
|
|
// "https://tmegov.onex-aura.com/api/sms?from=GCCCRP&key=pfTEYN6H&sender=GCCCRP&to=9360777472&body=Welcome%20to%20GCC!%20Your%20OTP%20for%20C%26D%20waste%20collectors%20Registration%20process%20is%20"+otp+"&entityid=1401572690000011081&templateid=1407172959127552127"; |
|
|
|
// String urlString= |
|
|
|
// appConfig.getGetOtpUrl()+"from=GCCCRP&key="+key+"&sender=GCCCRP&to="+MobileNo+"&body="+generatedToken+"&entityid=1401572690000011081&templateid=1407168250479102852"; |
|
|
|
// String |
|
|
|
// urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+MobileNo+"&text="+generatedToken+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407168250479102852"; |
|
|
|
System.out.print("\n urlString---: " + urlString); |
|
|
|
String bodyMessage = ""; |
|
|
|
try { |
|
|
|
@ -104,7 +107,8 @@ public class ApiController { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/////////////////////verify otp method with session handling///////////////////// |
|
|
|
///////////////////// verify otp method with session |
|
|
|
///////////////////// handling///////////////////// |
|
|
|
|
|
|
|
@GetMapping(value = "/verifyOTP") |
|
|
|
public Map<String, String> verifyOtp(HttpServletRequest request, @RequestParam String otp, |
|
|
|
@ -127,7 +131,8 @@ public class ApiController { |
|
|
|
session.setAttribute("verifiedotp", "success"); |
|
|
|
response.put("userName", (String) userDetails.get("user_name")); |
|
|
|
} |
|
|
|
System.out.println("userId---:" + userDetails.get("user_id")+"\nuserName:"+userDetails.get("user_name")); |
|
|
|
System.out.println( |
|
|
|
"userId---:" + userDetails.get("user_id") + "\nuserName:" + userDetails.get("user_name")); |
|
|
|
} |
|
|
|
response.put("status", "Success"); |
|
|
|
|
|
|
|
@ -151,10 +156,6 @@ public class ApiController { |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////// birth details getting method/////////////////// |
|
|
|
// now using in live |
|
|
|
// @GetMapping("/birth-details") |
|
|
|
@ -174,11 +175,11 @@ public class ApiController { |
|
|
|
// } |
|
|
|
|
|
|
|
// try { |
|
|
|
// Map<String, Object> result = birthAndDeathDetailsService.fetchBirthCertificate(dob, sex, regno, childname, fathername, mothername); |
|
|
|
// Map<String, Object> result = |
|
|
|
// birthAndDeathDetailsService.fetchBirthCertificate(dob, sex, regno, childname, |
|
|
|
// fathername, mothername); |
|
|
|
// return ResponseEntity.ok(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// } catch (Exception e) { |
|
|
|
|
|
|
|
// e.printStackTrace(); |
|
|
|
@ -189,7 +190,6 @@ public class ApiController { |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// from external api restapiservices |
|
|
|
|
|
|
|
@PostMapping("/birth-details") |
|
|
|
@ -212,8 +212,7 @@ public ResponseEntity<?> fetchBirthCertificateSecurely(@RequestBody Map<String, |
|
|
|
|
|
|
|
try { |
|
|
|
Map<String, Object> result = birthAndDeathDetailsService.fetchLocalBirthCertificate( |
|
|
|
dob, fathername, mothername, childname, sex |
|
|
|
); |
|
|
|
dob, fathername, mothername, childname, sex); |
|
|
|
return ResponseEntity.ok(result); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
@ -241,10 +240,6 @@ public ResponseEntity<?> fetchBirthCertificateSecurely(@RequestBody Map<String, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// from external api restapiservices death certificate |
|
|
|
|
|
|
|
@PostMapping("/death-details") |
|
|
|
@ -265,10 +260,11 @@ public ResponseEntity<?> fetchDeathCertificateSecurely(@RequestBody Map<String, |
|
|
|
// System.out.println("fathername " + fathername); |
|
|
|
// System.out.println("mothername " + mothername); |
|
|
|
|
|
|
|
System.out.println("sex: " + sex); |
|
|
|
|
|
|
|
try { |
|
|
|
Map<String, Object> result = birthAndDeathDetailsService.fetchLocalDeathCertificate( |
|
|
|
dod, fathername, mothername, personname, sex |
|
|
|
); |
|
|
|
dod, fathername, mothername, personname, sex); |
|
|
|
return ResponseEntity.ok(result); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
@ -296,14 +292,6 @@ String message = e.getMessage() != null ? e.getMessage().toLowerCase() : ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////// death details getting method/////////////////// |
|
|
|
|
|
|
|
@GetMapping("/death-details") |
|
|
|
@ -323,7 +311,8 @@ String message = e.getMessage() != null ? e.getMessage().toLowerCase() : ""; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
Map<String, Object> result = birthAndDeathDetailsService.fetchDeathCertificate(dod, sex, regno, personname, fathername, mothername); |
|
|
|
Map<String, Object> result = birthAndDeathDetailsService.fetchDeathCertificate(dod, sex, regno, personname, |
|
|
|
fathername, mothername); |
|
|
|
return ResponseEntity.ok(result); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
@ -334,19 +323,17 @@ String message = e.getMessage() != null ? e.getMessage().toLowerCase() : ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////// save new user method///////////////// |
|
|
|
|
|
|
|
@PostMapping("/saveNewUser") |
|
|
|
public ResponseEntity<?> saveNewUser (@RequestParam String user_name, @RequestParam(required = false) String user_address, @RequestParam String user_mobile) { |
|
|
|
public ResponseEntity<?> saveNewUser(@RequestParam String user_name, |
|
|
|
@RequestParam(required = false) String user_address, @RequestParam String user_mobile) { |
|
|
|
// Convert name to uppercase before saving |
|
|
|
String upperCaseName = user_name.toUpperCase(); |
|
|
|
|
|
|
|
return birthAndDeathDetailsService.saveNewUser(upperCaseName, user_address, user_mobile); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///////////////// check existing or not method//////////// |
|
|
|
|
|
|
|
@PostMapping("/checkUser") |
|
|
|
@ -362,11 +349,11 @@ String message = e.getMessage() != null ? e.getMessage().toLowerCase() : ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/////////////////////// save certificate logs method/////////////////// |
|
|
|
|
|
|
|
@PostMapping("/saveCertificateLogs") |
|
|
|
public ResponseEntity<?> saveCertificateLogs(HttpServletRequest request, @RequestParam String regNo, @RequestParam String eventDate, |
|
|
|
public ResponseEntity<?> saveCertificateLogs(HttpServletRequest request, @RequestParam String regNo, |
|
|
|
@RequestParam String eventDate, |
|
|
|
@RequestParam String Url, @RequestParam String service) { |
|
|
|
HttpSession session = request.getSession(); |
|
|
|
int userid = 0; |
|
|
|
@ -379,6 +366,4 @@ String message = e.getMessage() != null ? e.getMessage().toLowerCase() : ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |