Updated code
This commit is contained in:
@@ -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