Updated code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user