Commit 2e26815c authored by Deep Dey's avatar Deep Dey

feat: add api to perform admission form submit

parent b17f3ac3
...@@ -72,6 +72,40 @@ public class AdmissionFormController { ...@@ -72,6 +72,40 @@ public class AdmissionFormController {
HttpStatus.OK); HttpStatus.OK);
} }
@PostMapping(
value = "/admission-form/admin-submit",
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "SUCCESS"),
@ApiResponse(code = 400, message = "FAILED"),
@ApiResponse(code = 500, message = "Exception Occurred")
})
@ApiOperation(value = "")
public Object addNewAdmissionByAdmin(
HttpServletRequest request,
@ModelAttribute AdmissionFormData admissionFormData,
@RequestPart(value = "candidateImage", required = false) MultipartFile candidateImage,
@RequestPart(value = "fatherImage", required = false) MultipartFile fatherImage,
@RequestPart(value = "motherImage", required = false) MultipartFile motherImage
) throws Exception {
if (!admissionFormDAOController
.addNewAdmissionData(admissionFormData)) {
throw new Exception("Form Submission Failed");
}
return new ResponseEntity<>(
new GeneralResponse(
true,
AppConstants.RESPONSE_SUCCESS_STATUS_CODE,
"Form Submitted Successfully",
null
),
HttpStatus.OK);
}
@GetMapping( @GetMapping(
value = "/admission-form/set-interview", value = "/admission-form/set-interview",
produces = MediaType.APPLICATION_JSON_VALUE produces = MediaType.APPLICATION_JSON_VALUE
......
...@@ -41,19 +41,27 @@ public class AdmissionFormDAOController { ...@@ -41,19 +41,27 @@ public class AdmissionFormDAOController {
} }
} }
if (formData.getCandidateImage() == null || formData.getCandidateImage().isEmpty()) {
formData.setCandidateImageName("candidate.png");
} else {
formData.setCandidateImageName( formData.setCandidateImageName(
fileStorageService.storeFile( fileStorageService.storeFile(
formData.getCandidateImage(), formData.getCandidateImage(),
settings.getImageStoragePath() settings.getImageStoragePath()
) )
); );
}
if (formData.getFatherImage() == null || formData.getFatherImage().isEmpty()) {
formData.setFatherImageName("father.png");
} else {
formData.setFatherImageName( formData.setFatherImageName(
fileStorageService.storeFile( fileStorageService.storeFile(
formData.getFatherImage(), formData.getFatherImage(),
settings.getImageStoragePath() settings.getImageStoragePath()
) )
); );
}
if (formData.getMotherImage() != null && !formData.getMotherImage().isEmpty()) { if (formData.getMotherImage() != null && !formData.getMotherImage().isEmpty()) {
formData.setMotherImageName( formData.setMotherImageName(
......
...@@ -17,62 +17,62 @@ public class AdmissionFormData { ...@@ -17,62 +17,62 @@ public class AdmissionFormData {
private Long id; private Long id;
@NotEmpty(message = "School cannot be empty") @NotEmpty(message = "School cannot be empty")
private String school; private String school = "";
@NotEmpty(message = "Category cannot be empty") @NotEmpty(message = "Category cannot be empty")
private String category; private String category = "";
private String staffDepartment; private String staffDepartment;
private String staffCategory; private String staffCategory;
private String exStudentInfo; private String exStudentInfo;
@NotEmpty(message = "Name cannot be empty") @NotEmpty(message = "Name cannot be empty")
private String fullName; private String fullName = "";
@NotEmpty(message = "Admission Class cannot be empty") @NotEmpty(message = "Admission Class cannot be empty")
private String admissionClass; private String admissionClass = "";
@NotEmpty(message = "Date of Birth cannot be empty") @NotEmpty(message = "Date of Birth cannot be empty")
private String dateOfBirth; private String dateOfBirth = "";
@NotEmpty(message = "Nationality cannot be empty") @NotEmpty(message = "Nationality cannot be empty")
private String nationality; private String nationality = "";
@NotEmpty(message = "Religion cannot be empty") @NotEmpty(message = "Religion cannot be empty")
private String religion; private String religion = "";
private String denomination; private String denomination;
private String church; private String church;
@NotEmpty(message = "Mother Tongue cannot be empty") @NotEmpty(message = "Mother Tongue cannot be empty")
private String motherTongue; private String motherTongue = "";
@NotEmpty(message = "Community cannot be empty") @NotEmpty(message = "Community cannot be empty")
private String community; private String community = "";
@NotEmpty(message= "Home address cannot be empty") @NotEmpty(message= "Home address cannot be empty")
private String homeAddress; private String homeAddress = "";
@NotEmpty(message= "Correspondence address cannot be empty") @NotEmpty(message= "Correspondence address cannot be empty")
private String correspondenceAddress; private String correspondenceAddress = "";
private String otherChildren; private String otherChildren;
@NotEmpty(message = "Marital Status cannot be empty") @NotEmpty(message = "Marital Status cannot be empty")
private String maritalStatus; private String maritalStatus = "";
@NotEmpty(message = "Father Name cannot be empty") @NotEmpty(message = "Father Name cannot be empty")
private String fatherName; private String fatherName = "";
@NotEmpty(message = "Father Mobile cannot be empty") @NotEmpty(message = "Father Mobile cannot be empty")
private String fatherMobile; private String fatherMobile = "";
@NotEmpty(message = "Father Email cannot be empty") @NotEmpty(message = "Father Email cannot be empty")
private String fatherEmail; private String fatherEmail = "";
@NotEmpty(message = "Father Nationality cannot be empty") @NotEmpty(message = "Father Nationality cannot be empty")
private String fatherNationality; private String fatherNationality = "";
@NotEmpty(message = "Father Religion cannot be empty") @NotEmpty(message = "Father Religion cannot be empty")
private String fatherReligion; private String fatherReligion = "";
private String fatherDenomination; private String fatherDenomination = "";
private String fatherChurch; private String fatherChurch = "";
@NotEmpty(message = "Father Mother Tongue cannot be empty") @NotEmpty(message = "Father Mother Tongue cannot be empty")
private String fatherMotherTongue; private String fatherMotherTongue = "";
@NotEmpty(message = "Father Community cannot be empty") @NotEmpty(message = "Father Community cannot be empty")
private String fatherCommunity; private String fatherCommunity = "";
@NotEmpty(message = "Father School Info cannot be empty") @NotEmpty(message = "Father School Info cannot be empty")
private String fatherSchoolInfo; private String fatherSchoolInfo = "";
private String fatherCollegeInfo; private String fatherCollegeInfo;
private String fatherUniversityInfo; private String fatherUniversityInfo;
private String fatherProfessionalQualification; private String fatherProfessionalQualification;
@NotEmpty(message = "Father Occupation cannot be empty") @NotEmpty(message = "Father Occupation cannot be empty")
private String fatherOccupation; private String fatherOccupation = "";
@NotEmpty(message = "Father Monthly Income cannot be empty") @NotEmpty(message = "Father Monthly Income cannot be empty")
private String fatherMonthlyIncome; private String fatherMonthlyIncome = "";
private String fatherWorkplaceInfo; private String fatherWorkplaceInfo;
private String motherName; private String motherName;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment