Updated code

This commit is contained in:
nisha
2024-12-13 15:47:11 +05:30
parent bf95453e67
commit d6a2521a57
6 changed files with 15 additions and 12 deletions

View File

@@ -375,7 +375,7 @@ public class ApplicationAmendmentRequestDao {
AmendmentDocumentResponse amendmentDocumentResponse = new AmendmentDocumentResponse();
amendmentDocumentResponse.setFieldId(amendmentFieldRequest.getFieldId());
amendmentDocumentResponse.setNameValue(amendmentFieldRequest.getNameValue());
amendmentDocumentResponse.setIsValid(amendmentFieldRequest.getIsValid());
amendmentDocumentResponse.setValid(amendmentFieldRequest.getValid());
DocumentEntity documentEntity = documentService.validateDocument(Long.valueOf(amendmentFieldRequest.getFileValue()));
DocumentResponseBean responseBean = applicationEvaluationDao.createDocumentResponseBean(documentEntity);
@@ -660,7 +660,7 @@ public class ApplicationAmendmentRequestDao {
if (!existingDocumentIds.isEmpty()) {
existingDocumentIds.forEach(this::softDeleteDocument);
amendmentFormField.setFieldValue(null);
amendmentFormField.setIsValid(applicationFormFieldRequest.getIsValid());
amendmentFormField.setValid(applicationFormFieldRequest.getValid());
// setIsUploadedBy(amendmentFormField);
}
return;
@@ -675,7 +675,7 @@ public class ApplicationAmendmentRequestDao {
if (!newFieldValue.equals(amendmentFormField.getFieldValue())) {
amendmentFormField.setFieldValue(newFieldValue);
amendmentFormField.setIsValid(applicationFormFieldRequest.getIsValid());
amendmentFormField.setValid(applicationFormFieldRequest.getValid());
// setIsUploadedBy(amendmentFormField);
}
}

View File

@@ -176,7 +176,7 @@ public class ApplicationEvaluationDao {
FieldResponse fieldResponse=new FieldResponse();
fieldResponse.setId(amendmentFormField.getFieldId());
fieldResponse.setLabel(amendmentFormField.getLabel());
fieldResponse.setValid(amendmentFormField.getIsValid());
fieldResponse.setValid(amendmentFormField.getValid());
List<Long> fileIds=applicationAmendmentRequestDao.extractIds(amendmentFormField.getFieldValue());
List<DocumentResponseBean> documentResponseBeans = fileIds.stream()
.map(fileId -> createDocumentResponseBean(documentService.validateDocument(fileId))) // Create DocumentResponseBean for each fileId
@@ -619,8 +619,11 @@ public class ApplicationEvaluationDao {
// Map amendment details for quick lookup by amendment ID
Map<Long, List<AmendmentFormFieldRequest>> amendmentDetailsMap = amendmentFormFields.stream()
.filter(details -> applicationAmendmentRequestEntity.getId().equals(details.getAmendmentId()))
.collect(Collectors.toMap(AmendmentDetailsRequest::getAmendmentId, AmendmentDetailsRequest::getFormFieldDocuments));
.filter(details -> details.getFormFieldDocuments() != null) // Null check for getFormFieldDocuments
.collect(Collectors.toMap(
AmendmentDetailsRequest::getAmendmentId,
AmendmentDetailsRequest::getFormFieldDocuments
));
// Get corresponding amendment documents for the current entity
List<AmendmentFormFieldRequest> amendmentDocuments = amendmentDetailsMap.get(applicationAmendmentRequestEntity.getId());
if (amendmentDocuments != null) {
@@ -629,7 +632,7 @@ public class ApplicationEvaluationDao {
for (AmendmentFormFieldRequest newField : amendmentDocuments) {
if (existingField.getFieldId().equals(newField.getFieldId())) {
// Update fields if there are changes
Utils.setIfUpdated(existingField::getIsValid, existingField::setIsValid, newField.getIsValid());
Utils.setIfUpdated(existingField::getValid, existingField::setValid, newField.getValid());
Utils.setIfUpdated(existingField::getFieldValue, existingField::setFieldValue, newField.getFieldValue());
updatedFormFields.add(existingField);
@@ -666,7 +669,7 @@ public class ApplicationEvaluationDao {
for (AmendmentFieldRequest newField : amendmentDocuments) {
if (existingField.getFieldId().equals(newField.getFieldId())) {
// Update fields if there are changes
Utils.setIfUpdated(existingField::getIsValid, existingField::setIsValid, newField.getIsValid());
Utils.setIfUpdated(existingField::getValid, existingField::setValid, newField.getValid());
Utils.setIfUpdated(existingField::getFileValue, existingField::setFileValue, newField.getFileValue());
Utils.setIfUpdated(existingField::getNameValue, existingField::setNameValue, newField.getNameValue());

View File

@@ -8,6 +8,6 @@ public class AmendmentFieldRequest {
private String fieldId;
private String nameValue;
private String fileValue;
private Boolean isValid = false;
private Boolean valid = false;
}

View File

@@ -13,7 +13,7 @@ public class AmendmentFormField {
private String fieldValue;
private Boolean isValid;
private Boolean valid;

View File

@@ -9,5 +9,5 @@ public class AmendmentFormFieldRequest {
private Object fieldValue;
private Boolean isValid;
private Boolean valid;
}

View File

@@ -8,5 +8,5 @@ public class AmendmentDocumentResponse {
private String fieldId;
private String nameValue;
private DocumentResponseBean fileValue;
private Boolean isValid = false;
private Boolean valid = false;
}