diff --git a/src/main/java/com/gcc/flagpoles/configuration/DataSourceConfig.java b/src/main/java/com/gcc/flagpoles/configuration/DataSourceConfig.java
index beb559d..b76562b 100644
--- a/src/main/java/com/gcc/flagpoles/configuration/DataSourceConfig.java
+++ b/src/main/java/com/gcc/flagpoles/configuration/DataSourceConfig.java
@@ -22,7 +22,7 @@ public class DataSourceConfig {
private static final String host = "localhost";
private static final String dbpassword = "root";
- // For AWS
+ // // For AWS
// private static String host =
// "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
// private static String dbpassword = "gcc-facial-password";
diff --git a/src/main/java/com/gcc/flagpoles/constants/AppConstants.java b/src/main/java/com/gcc/flagpoles/constants/AppConstants.java
index 73ec15c..c1f06e9 100644
--- a/src/main/java/com/gcc/flagpoles/constants/AppConstants.java
+++ b/src/main/java/com/gcc/flagpoles/constants/AppConstants.java
@@ -1,15 +1,12 @@
package com.gcc.flagpoles.constants;
public final class AppConstants {
- // for Production
-// public static String key_id="rzp_live_66FhxMUNAb9McO";
-// public static String key_secret="aoIzMGQE3xOxin92rYaK75jV";
+ // for Production from coworking space booking key_id key_secret
+ // public static String key_id = "rzp_live_ySI5Ns54Y7qOcJ";
+ // public static String key_secret = "Nwf1TjhUtaskof8vePkRR8Sb";
+ // uncomment for testing payment
+ public static String key_id = "rzp_test_tDkHFEqWXmuEi8";
+ public static String key_secret = "cBQUjMcKZ4J6vmOKSyNZ92py";
- //uncomment for testing payment
- public static String key_id="rzp_test_TADBzz8BXbBpos";
- public static String key_secret="3es3YZ3DFVYdibbGLBtL8nBB";
-
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/gcc/flagpoles/controller/ApiController.java b/src/main/java/com/gcc/flagpoles/controller/ApiController.java
index 67b9fe8..99f2c6c 100644
--- a/src/main/java/com/gcc/flagpoles/controller/ApiController.java
+++ b/src/main/java/com/gcc/flagpoles/controller/ApiController.java
@@ -14,6 +14,7 @@ import java.util.Random;
import com.gcc.flagpoles.configuration.AppConfig;
//import org.json.JSONObject;
import com.gcc.flagpoles.constants.AppConstants;
+import com.gcc.flagpoles.service.FileUploadService;
import com.gcc.flagpoles.service.PaymentService;
import com.razorpay.Order;
import com.razorpay.RazorpayClient;
@@ -22,6 +23,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;
@@ -67,6 +69,9 @@ public class ApiController {
@Autowired
private PaymentService paymentService;
+ @Autowired
+ private FileUploadService fileUploadService;
+
// @Autowired
// private PaymentService paymentService ;
@@ -90,7 +95,7 @@ public class ApiController {
Random rand = new Random();
int otp = rand.nextInt(90000) + 10000;
- //int otp = 22222;
+ // int otp = 22222;
System.out.print("\n otp---:" + otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
@@ -180,7 +185,7 @@ public class ApiController {
Random rand = new Random();
int otp = rand.nextInt(90000) + 10000;
- //int otp = 22222;
+ // int otp = 22222;
System.out.print("\n otp---:" + otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
@@ -262,10 +267,18 @@ public class ApiController {
}
}
- @PostMapping("/saveRequest")
- public ResponseEntity> saveRequest(@RequestParam MultiValueMap params) {
+ @PostMapping(value = "/saveRequest", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ public ResponseEntity> saveRequest(
+ @RequestParam MultiValueMap params,
+ @RequestParam(required = false) MultipartFile aadhaarFile,
+ @RequestParam(required = false) MultipartFile pattaFile,
+ @RequestParam(required = false) MultipartFile affidavitFile,
+ @RequestParam(required = false) MultipartFile ecFile,
+ @RequestParam(required = false) MultipartFile fmbSketchFile) {
+
try {
- // ✅ 1. Extract Applicant Info
+ /* ================= Applicant ================= */
+
Map applicant = new HashMap<>();
applicant.put("name", params.getFirst("name"));
applicant.put("mobileNumber", params.getFirst("mobileNumber"));
@@ -278,26 +291,103 @@ public class ApiController {
"message", "Applicant details are incomplete."));
}
- // ✅ 2. Extract Event Info (with cost-related fields)
+ String aadhaarNo = params.getFirst("aadhaarNo");
+
+ if (aadhaarNo == null || !aadhaarNo.matches("\\d{12}")) {
+ return ResponseEntity.badRequest().body(Map.of(
+ "status", "error",
+ "message", "Valid Aadhaar number is mandatory."));
+ }
+
+ /* ================= Application ================= */
+
+ String applicationType = params.getFirst("applicationType"); // 1 TEMP, 2 PERMANENT
+ String applicationOption = params.getFirst("applicationOption"); // 1 Pole, 2 Statue
+
+ if (applicationType == null) {
+ return ResponseEntity.badRequest().body(Map.of(
+ "status", "error",
+ "message", "Application Type is required."));
+ }
+
+ // Validation for Permanent Application fields
+ if ("2".equals(applicationType)) {
+ if (params.getFirst("surveyNo") == null || params.getFirst("surveyNo").trim().isEmpty()) {
+ return ResponseEntity.badRequest()
+ .body(Map.of("status", "error", "message", "Survey Number is required."));
+ }
+ if (params.getFirst("placeOfErection") == null || params.getFirst("placeOfErection").trim().isEmpty()) {
+ return ResponseEntity.badRequest()
+ .body(Map.of("status", "error", "message", "Place of Erection is required."));
+ }
+ }
+
+ /* ================= FILE UPLOAD (PERMANENT ONLY) ================= */
+
+ String aadhaarPath = null;
+ String pattaPath = null;
+ String affidavitPath = null;
+ String ecPath = null;
+ String fmbPath = null;
+
+ if ("2".equals(applicationType)) {
+
+ if (aadhaarFile != null && !aadhaarFile.isEmpty())
+ aadhaarPath = fileUploadService.fileUpload(aadhaarFile, "aadhaar");
+
+ if (pattaFile != null && !pattaFile.isEmpty())
+ pattaPath = fileUploadService.fileUpload(pattaFile, "patta");
+
+ if (affidavitFile != null && !affidavitFile.isEmpty())
+ affidavitPath = fileUploadService.fileUpload(affidavitFile, "affidavit");
+
+ if (ecFile != null && !ecFile.isEmpty())
+ ecPath = fileUploadService.fileUpload(ecFile, "ec");
+
+ if (fmbSketchFile != null && !fmbSketchFile.isEmpty())
+ fmbPath = fileUploadService.fileUpload(fmbSketchFile, "fmb");
+ }
+
+ // Inject paths for service layer
+ params.set("aadhaarImagePath", aadhaarPath);
+ params.set("pattaImagePath", pattaPath);
+ params.set("affidavitImagePath", affidavitPath);
+ params.set("ecImagePath", ecPath);
+ params.set("fmbSketchPath", fmbPath);
+
+ /* ================= Event ================= */
+
Map event = new HashMap<>();
event.put("type", params.getFirst("eventType"));
event.put("date", params.getFirst("eventDate"));
event.put("description", params.getFirst("description"));
event.put("totalPoles", params.getFirst("totalPoles"));
- // event.put("deposit", params.getFirst("deposit"));
event.put("totalCost", params.getFirst("totalCost"));
- if (event.get("type") == null || event.get("date") == null || event.get("description") == null) {
- return ResponseEntity.badRequest().body(Map.of(
- "status", "error",
- "message", "Event details are incomplete."));
+ if (!"2".equals(applicationType)) {
+ if (event.get("type") == null || event.get("date") == null || event.get("description") == null) {
+ return ResponseEntity.badRequest().body(Map.of(
+ "status", "error",
+ "message", "Event details are incomplete."));
+ }
+ }
+
+ /* ================= Statue Count ================= */
+
+ if ("2".equals(applicationType) && "2".equals(applicationOption)) {
+ event.put("totalStatue", "1");
+ event.put("totalPoles", "0");
+ } else {
+ event.put("totalStatue", "0");
}
- // ✅ 3. Build List of Streets
+ /* ================= Streets ================= */
+
List
Event Date:
+ Application Type:
+
+
@@ -181,6 +185,22 @@
style="background: #FB6340; font-size:18px;">Download
+
+
+
+
+
+
+
diff --git a/src/main/resources/templates/modules/flagpolesregistration/acknowledgement.html b/src/main/resources/templates/modules/flagpolesregistration/acknowledgement.html
index a6ee75f..deb92d8 100644
--- a/src/main/resources/templates/modules/flagpolesregistration/acknowledgement.html
+++ b/src/main/resources/templates/modules/flagpolesregistration/acknowledgement.html
@@ -91,6 +91,9 @@
});
}
+ function goBack() {
+ window.location.href = '/flagpolesregistration'; // Update the URL as per your project's structure
+ }
function exportLicToPDF(details, requestId, format = 'a4', orientation = 'portrait') {
diff --git a/src/main/resources/templates/modules/flagpolesregistration/index.html b/src/main/resources/templates/modules/flagpolesregistration/index.html
index 4b39270..af156e7 100644
--- a/src/main/resources/templates/modules/flagpolesregistration/index.html
+++ b/src/main/resources/templates/modules/flagpolesregistration/index.html
@@ -1,123 +1,127 @@
+
-
-
-GCC - FlagPoles
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ GCC - FlagPoles
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-