Done ticket GEPAFINBE-180

This commit is contained in:
rajesh
2025-03-06 20:00:34 +05:30
parent 8080940f5f
commit 6156cb29e9
4 changed files with 28 additions and 11 deletions

View File

@@ -485,6 +485,8 @@ public class GepafinConstant {
public static final String USAGE="usage";
public static final String LIMIT="limit";
public static final String DATA="data";
public static final String FILE_SELECT = "fileselect";
}

View File

@@ -181,6 +181,7 @@ public class ApplicationAmendmentRequestDao {
for (ApplicationFormEntity form : forms) {
String content = form.getForm().getContent();
List<Map<String, Object>> result = filterByName(content, "fileupload");
result.addAll(filterByName(content, GepafinConstant.FILE_SELECT));
List<AmendmentFormFieldResponse> amendmentFormFieldResponses= getIdAndLabelFromResult(result);
amendmentFormFieldResponses.removeIf(amendmentFormFieldResponse -> {
FieldRequest matchingRequest = fieldRequestMap.get(amendmentFormFieldResponse.getFieldId());
@@ -538,7 +539,10 @@ public class ApplicationAmendmentRequestDao {
return forms.stream()
.flatMap(form -> {
String content = form.getForm().getContent();
return getIdAndLabelFromResult(filterByName(content, "fileupload")).stream();
List<Map<String, Object>> filteredResults = new ArrayList<>();
filteredResults.addAll(filterByName(content, "fileupload"));
filteredResults.addAll(filterByName(content, GepafinConstant.FILE_SELECT));
return getIdAndLabelFromResult(filteredResults).stream();
})
.collect(Collectors.toMap(AmendmentFormFieldResponse::getFieldId, AmendmentFormFieldResponse::getLabel));
}

View File

@@ -378,6 +378,9 @@ public class ApplicationEvaluationDao {
case "fileupload":
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
break;
case "fileselect":
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
break;
case "checkboxes":
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
break;
@@ -516,7 +519,7 @@ public class ApplicationEvaluationDao {
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
contentResponseBeans.forEach(contentResponseBean -> {
// Check if this is a file upload field that matches the current field response
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
if (("fileupload".equals(contentResponseBean.getName()) || GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) && contentResponseBean.getId().equals(fieldResponse.getId())) {
String label = null;
// Set the label if available
if (contentResponseBean.getSettings() != null) {
@@ -1252,7 +1255,9 @@ public class ApplicationEvaluationDao {
case "fileupload":
populateFileDetailsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId);
break;
case "fileselect":
populateFileDetailsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId);
break;
case "checkboxes":
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentResponseBean);
break;
@@ -1402,7 +1407,7 @@ public class ApplicationEvaluationDao {
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
contentResponseBeans.forEach(contentResponseBean -> {
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
if (("fileupload".equals(contentResponseBean.getName()) || GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) && contentResponseBean.getId().equals(fieldResponse.getId())) {
String label = null;
if (contentResponseBean.getSettings() != null) {
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
@@ -1564,9 +1569,10 @@ public class ApplicationEvaluationDao {
mappedField.setFieldName(contentResponseBean.getName());
boolean isCheckbox = "checkboxes".equals(contentResponseBean.getName());
boolean isFileUpload = "fileupload".equals(contentResponseBean.getName());
boolean isFileSelect = GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName());
boolean isParagraph = "paragraph".equals(contentResponseBean.getName());
boolean isTable = "table".equals(contentResponseBean.getName());
if (isFileUpload) {
if (isFileUpload || isFileSelect ) {
handleFileUpload(applicationId, criteriaFormField, mappedField);
} else if (isCheckbox) {
handleCheckbox(applicationId, criteriaFormField, contentResponseBean, mappedField);
@@ -1773,7 +1779,7 @@ public class ApplicationEvaluationDao {
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
if ("fileupload".equals(contentResponseBean.getName())) {
if ("fileupload".equals(contentResponseBean.getName()) || GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) {
String fieldId = contentResponseBean.getId();
Long applicationFormId = applicationForm.getId();
@@ -2103,7 +2109,8 @@ public class ApplicationEvaluationDao {
List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
for (ContentResponseBean contentResponseBean:contentResponseBeans){
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload"))) {
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload")) ||
Boolean.TRUE.equals(contentResponseBean.getName().equals(GepafinConstant.FILE_SELECT))){
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
Object fieldValueObject = applicationFormFieldRequestBean.getFieldValue();
if (fieldValueObject instanceof String) {
@@ -2128,7 +2135,8 @@ public class ApplicationEvaluationDao {
for (ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity : evaluationFormFieldEntities) {
Optional<ContentResponseBean> fileUploadContent = contentResponseBeans.stream()
.filter(contentResponseBean -> "fileupload".equals(contentResponseBean.getName()) &&
.filter(contentResponseBean -> ("fileupload".equals(contentResponseBean.getName()) ||
GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) &&
contentResponseBean.getId().equals(applicationEvaluationFormFieldEntity.getFieldId()))
.findFirst();

View File

@@ -184,8 +184,11 @@ public class EmailNotificationDao {
// Extract data from forms
for (ApplicationFormEntity form : forms) {
String content = form.getForm().getContent();
List<Map<String, Object>> result = filterByName(content, "fileupload");
allFormFields.addAll(getIdAndLabelFromResult(result));
List<Map<String, Object>> fileUploadResult = filterByName(content, "fileupload");
allFormFields.addAll(getIdAndLabelFromResult(fileUploadResult));
List<Map<String, Object>> fileSelectResult = filterByName(content,GepafinConstant.FILE_SELECT);
allFormFields.addAll(getIdAndLabelFromResult(fileSelectResult));
}
// Process allFormFields and generate bullet points