|
|
|
@ -57,121 +57,26 @@ public class ComplaintController { |
|
|
|
public List<Map<String, Object>> getComplaintDetailsById(@RequestParam String complaintid) { |
|
|
|
return complaintService.fetchComplaintDetailsById(complaintid); |
|
|
|
} |
|
|
|
// save api |
|
|
|
|
|
|
|
/*@PostMapping("/register") |
|
|
|
public ResponseEntity<String> registerComplaint( |
|
|
|
|
|
|
|
@RequestParam("ComplainantName") String complainantName, |
|
|
|
|
|
|
|
@RequestParam("ComplainantAddr") String complainantAddr, |
|
|
|
|
|
|
|
@RequestParam("MobileNo") String mobileNo, |
|
|
|
|
|
|
|
@RequestParam("Email") String email, |
|
|
|
|
|
|
|
@RequestParam("ComplaintType") String complaintType, |
|
|
|
|
|
|
|
@RequestParam("ComplaintTitle") String complaintTitle, |
|
|
|
|
|
|
|
@RequestParam("ComplaintDetails") String complaintDetails, |
|
|
|
|
|
|
|
@RequestParam("StreetId") String streetId, |
|
|
|
|
|
|
|
@RequestParam("Comp_Image") String compImage, |
|
|
|
|
|
|
|
@RequestParam("latitude") String latitude, |
|
|
|
|
|
|
|
@RequestParam("longtitude") String longtitude, |
|
|
|
|
|
|
|
@RequestParam("Landmark") String landmark, |
|
|
|
|
|
|
|
@RequestParam("gender") String gender) { |
|
|
|
|
|
|
|
String externalUrl = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice"; // // // |
|
|
|
// Build the URI with parameters |
|
|
|
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl(externalUrl) |
|
|
|
.queryParam("serviceId", "RegComplaint").queryParam("ComplainantName", complainantName) |
|
|
|
.queryParam("ComplainantAddr", complainantAddr).queryParam("MobileNo", mobileNo) |
|
|
|
.queryParam("Email", email).queryParam("ComplaintType", complaintType) |
|
|
|
.queryParam("ComplaintTitle", complaintTitle).queryParam("ComplaintDetails", complaintDetails) |
|
|
|
.queryParam("StreetId", streetId).queryParam("Comp_Image", compImage).queryParam("latitude", latitude) |
|
|
|
.queryParam("longtitude", longtitude).queryParam("Landmark", landmark).queryParam("gender", gender); // // |
|
|
|
// the |
|
|
|
// external API |
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(uriBuilder.toUriString(), null, String.class); // |
|
|
|
// // Return the response from the external API |
|
|
|
return ResponseEntity.status(response.getStatusCode()).body(response.getBody()); |
|
|
|
}*/ |
|
|
|
|
|
|
|
/* |
|
|
|
* @PostMapping("/register") public ResponseEntity<String> |
|
|
|
* registerComplaint(@RequestParam("ComplainantName") String complainantName, |
|
|
|
* |
|
|
|
* @RequestParam("ComplainantAddr") String |
|
|
|
* complainantAddr, @RequestParam("MobileNo") String mobileNo, |
|
|
|
* |
|
|
|
* @RequestParam("Email") String email, @RequestParam("ComplaintType") String |
|
|
|
* complaintType, |
|
|
|
* |
|
|
|
* @RequestParam("ComplaintTitle") String complaintTitle, |
|
|
|
* |
|
|
|
* @RequestParam("ComplaintDetails") String |
|
|
|
* complaintDetails, @RequestParam("StreetId") String streetId, |
|
|
|
* |
|
|
|
* @RequestParam("Comp_Image") MultipartFile |
|
|
|
* compImage, @RequestParam("latitude") String latitude, |
|
|
|
* |
|
|
|
* @RequestParam("longtitude") String longtitude, @RequestParam("Landmark") |
|
|
|
* String landmark, |
|
|
|
* |
|
|
|
* @RequestParam("gender") String gender) { |
|
|
|
* |
|
|
|
* String externalUrl = |
|
|
|
* "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice"; |
|
|
|
* |
|
|
|
* // Convert the image to a Base64 string String base64Image = ""; if |
|
|
|
* (!compImage.isEmpty()) { try { byte[] imageBytes = compImage.getBytes(); |
|
|
|
* base64Image = Base64.getEncoder().encodeToString(imageBytes); } catch |
|
|
|
* (IOException e) { return |
|
|
|
* ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR). |
|
|
|
* body("Error encoding image."); } } |
|
|
|
* |
|
|
|
* // Build the URI with parameters UriComponentsBuilder uriBuilder = |
|
|
|
* UriComponentsBuilder.fromHttpUrl(externalUrl) .queryParam("serviceId", |
|
|
|
* "RegComplaint").queryParam("ComplainantName", complainantName) |
|
|
|
* .queryParam("ComplainantAddr", complainantAddr).queryParam("MobileNo", |
|
|
|
* mobileNo) .queryParam("Email", email).queryParam("ComplaintType", |
|
|
|
* complaintType) .queryParam("ComplaintTitle", |
|
|
|
* complaintTitle).queryParam("ComplaintDetails", complaintDetails) |
|
|
|
* .queryParam("StreetId", streetId).queryParam("Comp_Image", base64Image) // |
|
|
|
* Use base64 image here .queryParam("latitude", |
|
|
|
* latitude).queryParam("longtitude", longtitude).queryParam("Landmark", |
|
|
|
* landmark) .queryParam("gender", gender); |
|
|
|
* |
|
|
|
* // Make a POST request to the external API ResponseEntity<String> response = |
|
|
|
* restTemplate.postForEntity(uriBuilder.toUriString(), null, String.class); |
|
|
|
* |
|
|
|
* // Return the response from the external API return |
|
|
|
* ResponseEntity.status(response.getStatusCode()).body(response.getBody()); |
|
|
|
* |
|
|
|
* } |
|
|
|
*/ |
|
|
|
/*@PostMapping("/register") |
|
|
|
@GetMapping("/api/getComplaintDetailsByMobile") |
|
|
|
public List<Map<String, Object>> getComplaintDetailsByMobile(@RequestParam String mobileNo) { |
|
|
|
return complaintService.fetchComplaintDetailsByMobile(mobileNo); |
|
|
|
} |
|
|
|
@PostMapping("/register") |
|
|
|
public ResponseEntity<String> registerComplaint( |
|
|
|
@RequestParam("ComplainantName") String complainantName, |
|
|
|
@RequestParam("ComplainantAddr") String complainantAddr, |
|
|
|
@RequestParam("MobileNo") String mobileNo, |
|
|
|
@RequestParam("Email") String email, |
|
|
|
@RequestParam("ComplaintType") String complaintType, |
|
|
|
@RequestParam("ComplaintTitle") String complaintTitle, |
|
|
|
@RequestParam("ComplaintDetails") String complaintDetails, |
|
|
|
@RequestParam("StreetId") String streetId, |
|
|
|
@RequestParam("Comp_Image") String compImage, |
|
|
|
@RequestParam("latitude") String latitude, |
|
|
|
@RequestParam("longtitude") String longtitude, |
|
|
|
@RequestParam("Landmark") String landmark, |
|
|
|
@RequestParam("gender") String gender) { |
|
|
|
@RequestParam(value = "ComplainantName", required = false) String complainantName, |
|
|
|
@RequestParam(value = "ComplainantAddr", required = false) String complainantAddr, |
|
|
|
@RequestParam(value = "MobileNo", required = false) String mobileNo, |
|
|
|
@RequestParam(value = "Email", required = false) String email, |
|
|
|
@RequestParam(value = "ComplaintType", required = false) String complaintType, |
|
|
|
@RequestParam(value = "ComplaintTitle", required = false) String complaintTitle, |
|
|
|
@RequestParam(value = "ComplaintDetails", required = false) String complaintDetails, |
|
|
|
@RequestParam(value = "StreetId", required = false) String streetId, |
|
|
|
@RequestParam(value = "Comp_Image", required = false) String compImage, |
|
|
|
@RequestParam(value = "latitude", required = false) String latitude, |
|
|
|
@RequestParam(value = "longtitude", required = false) String longtitude, |
|
|
|
@RequestParam(value = "Landmark", required = false) String landmark, |
|
|
|
@RequestParam(value = "gender", required = false) String gender) { |
|
|
|
|
|
|
|
String externalUrl = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice"; |
|
|
|
|
|
|
|
@ -185,21 +90,21 @@ public class ComplaintController { |
|
|
|
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
|
|
|
conn.setDoOutput(true); |
|
|
|
|
|
|
|
// Create the parameters string |
|
|
|
// Create the parameters string, handling null values |
|
|
|
String params = "serviceId=RegComplaint" + |
|
|
|
"&ComplainantName=" + URLEncoder.encode(complainantName, "UTF-8") + |
|
|
|
"&ComplainantAddr=" + URLEncoder.encode(complainantAddr, "UTF-8") + |
|
|
|
"&MobileNo=" + URLEncoder.encode(mobileNo, "UTF-8") + |
|
|
|
"&Email=" + URLEncoder.encode(email, "UTF-8") + |
|
|
|
"&ComplaintType=" + URLEncoder.encode(complaintType, "UTF-8") + |
|
|
|
"&ComplaintTitle=" + URLEncoder.encode(complaintTitle, "UTF-8") + |
|
|
|
"&ComplaintDetails=" + URLEncoder.encode(complaintDetails, "UTF-8") + |
|
|
|
"&StreetId=" + URLEncoder.encode(streetId, "UTF-8") + |
|
|
|
"&Comp_Image=" + URLEncoder.encode(compImage, "UTF-8") + |
|
|
|
"&latitude=" + URLEncoder.encode(latitude, "UTF-8") + |
|
|
|
"&longtitude=" + URLEncoder.encode(longtitude, "UTF-8") + |
|
|
|
"&Landmark=" + URLEncoder.encode(landmark, "UTF-8") + |
|
|
|
"&gender=" + URLEncoder.encode(gender, "UTF-8"); |
|
|
|
"&ComplainantName=" + URLEncoder.encode(complainantName != null ? complainantName : "", "UTF-8") + |
|
|
|
"&ComplainantAddr=" + URLEncoder.encode(complainantAddr != null ? complainantAddr : "", "UTF-8") + |
|
|
|
"&MobileNo=" + URLEncoder.encode(mobileNo != null ? mobileNo : "", "UTF-8") + |
|
|
|
"&Email=" + URLEncoder.encode(email != null ? email : "", "UTF-8") + |
|
|
|
"&ComplaintType=" + URLEncoder.encode(complaintType != null ? complaintType : "", "UTF-8") + |
|
|
|
"&ComplaintTitle=" + URLEncoder.encode(complaintTitle != null ? complaintTitle : "", "UTF-8") + |
|
|
|
"&ComplaintDetails=" + URLEncoder.encode(complaintDetails != null ? complaintDetails : "", "UTF-8") + |
|
|
|
"&StreetId=" + URLEncoder.encode(streetId != null ? streetId : "", "UTF-8") + |
|
|
|
"&Comp_Image=" + URLEncoder.encode(compImage != null ? compImage : "", "UTF-8") + |
|
|
|
"&latitude=" + URLEncoder.encode(latitude != null ? latitude : "", "UTF-8") + |
|
|
|
"&longtitude=" + URLEncoder.encode(longtitude != null ? longtitude : "", "UTF-8") + |
|
|
|
"&Landmark=" + URLEncoder.encode(landmark != null ? landmark : "", "UTF-8") + |
|
|
|
"&gender=" + URLEncoder.encode(gender != null ? gender : "", "UTF-8"); |
|
|
|
|
|
|
|
// Write parameters to request body |
|
|
|
try (OutputStream os = conn.getOutputStream()) { |
|
|
|
@ -232,22 +137,14 @@ public class ComplaintController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
@PostMapping("/register") |
|
|
|
public ResponseEntity<String> registerComplaint( |
|
|
|
@RequestParam(value = "ComplainantName", required = false) String complainantName, |
|
|
|
@RequestParam(value = "ComplainantAddr", required = false) String complainantAddr, |
|
|
|
@RequestParam(value = "MobileNo", required = false) String mobileNo, |
|
|
|
@RequestParam(value = "Email", required = false) String email, |
|
|
|
@RequestParam(value = "ComplaintType", required = false) String complaintType, |
|
|
|
@RequestParam(value = "ComplaintTitle", required = false) String complaintTitle, |
|
|
|
@RequestParam(value = "ComplaintDetails", required = false) String complaintDetails, |
|
|
|
@RequestParam(value = "StreetId", required = false) String streetId, |
|
|
|
@RequestParam(value = "Comp_Image", required = false) String compImage, |
|
|
|
@RequestParam(value = "latitude", required = false) String latitude, |
|
|
|
@RequestParam(value = "longtitude", required = false) String longtitude, |
|
|
|
@RequestParam(value = "Landmark", required = false) String landmark, |
|
|
|
@RequestParam(value = "gender", required = false) String gender) { |
|
|
|
|
|
|
|
@PostMapping("/updateComplaint") |
|
|
|
public ResponseEntity<String> updateComplaint( |
|
|
|
@RequestParam("ComplaintId") String complaintId, |
|
|
|
@RequestParam(value = "Message", required = false) String message, |
|
|
|
@RequestParam(value = "UserType", required = false) String userType, |
|
|
|
@RequestParam(value = "Status", required = false) String status, |
|
|
|
@RequestParam(value = "Comp_Image", required = false) String compImage) { |
|
|
|
|
|
|
|
String externalUrl = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice"; |
|
|
|
|
|
|
|
@ -262,20 +159,13 @@ public class ComplaintController { |
|
|
|
conn.setDoOutput(true); |
|
|
|
|
|
|
|
// Create the parameters string, handling null values |
|
|
|
String params = "serviceId=RegComplaint" + |
|
|
|
"&ComplainantName=" + URLEncoder.encode(complainantName != null ? complainantName : "", "UTF-8") + |
|
|
|
"&ComplainantAddr=" + URLEncoder.encode(complainantAddr != null ? complainantAddr : "", "UTF-8") + |
|
|
|
"&MobileNo=" + URLEncoder.encode(mobileNo != null ? mobileNo : "", "UTF-8") + |
|
|
|
"&Email=" + URLEncoder.encode(email != null ? email : "", "UTF-8") + |
|
|
|
"&ComplaintType=" + URLEncoder.encode(complaintType != null ? complaintType : "", "UTF-8") + |
|
|
|
"&ComplaintTitle=" + URLEncoder.encode(complaintTitle != null ? complaintTitle : "", "UTF-8") + |
|
|
|
"&ComplaintDetails=" + URLEncoder.encode(complaintDetails != null ? complaintDetails : "", "UTF-8") + |
|
|
|
"&StreetId=" + URLEncoder.encode(streetId != null ? streetId : "", "UTF-8") + |
|
|
|
String params = "serviceId=UpdateComplaint"+ |
|
|
|
"&ComplaintId=" + URLEncoder.encode(complaintId != null ? complaintId : "", "UTF-8") + |
|
|
|
"&Message=" + URLEncoder.encode(message != null ? message : "", "UTF-8") + |
|
|
|
"&UserType=" + URLEncoder.encode(userType != null ? userType : "", "UTF-8") + |
|
|
|
"&Status=" + URLEncoder.encode(status != null ? status : "", "UTF-8") + |
|
|
|
"&Comp_Image=" + URLEncoder.encode(compImage != null ? compImage : "", "UTF-8") + |
|
|
|
"&latitude=" + URLEncoder.encode(latitude != null ? latitude : "", "UTF-8") + |
|
|
|
"&longtitude=" + URLEncoder.encode(longtitude != null ? longtitude : "", "UTF-8") + |
|
|
|
"&Landmark=" + URLEncoder.encode(landmark != null ? landmark : "", "UTF-8") + |
|
|
|
"&gender=" + URLEncoder.encode(gender != null ? gender : "", "UTF-8"); |
|
|
|
"&Token=718333469976265947044293"; |
|
|
|
|
|
|
|
// Write parameters to request body |
|
|
|
try (OutputStream os = conn.getOutputStream()) { |
|
|
|
@ -308,4 +198,8 @@ public class ComplaintController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |