Updated code

This commit is contained in:
rajesh
2024-09-23 18:33:45 +05:30
parent 6f2bb714e1
commit afbdd70f6b
3 changed files with 7 additions and 4 deletions

View File

@@ -243,11 +243,11 @@ public class FlowFormDao {
.map(FlowEdgesEntity::getSourceId)
.toList();
List<FormEntity> previousForms = formRepository.findByIdIn(previousFormIds);
List<ApplicationFormEntity> applicationFormEntities=applicationFormRepository.findByFormIdInAndApplicationId(previousFormIds,applicationEntity.getId());
previousForms.sort(Comparator.comparing(FormEntity::getCreatedDate).reversed());
applicationFormEntities.sort(Comparator.comparing(ApplicationFormEntity::getCreatedDate).reversed());
return previousForms.isEmpty() ? null : previousForms.get(0).getId();
return applicationFormEntities.isEmpty() ? null : applicationFormEntities.get(0).getForm().getId();
}
public NextOrPreviousFormResponse getnextOrPreviousForm(ApplicationEntity applicationEntity, Long formId,
FormActionEnum action) {

View File

@@ -221,7 +221,9 @@ public class FormDao {
.validateCustom(value, fieldValidatorBean.getCustom(), fieldId); // Add the custom validation here
if (fieldValidatorBean.getCustom() != null && fieldValidatorBean.getCustom().equals(GepafinConstant.IS_PIVA)) {
String error = validateVatNumber(value, fieldValidatorBean.getCustom(), fieldId);
validator.addError(error);
if(error != null) {
validator.addError(error);
}
}
});
validator.validate();

View File

@@ -17,4 +17,5 @@ public interface ApplicationFormRepository extends JpaRepository<ApplicationForm
public List<ApplicationFormEntity> findByApplicationIdOrderByCreatedDateAsc(Long applicationId);
public List<ApplicationFormEntity> findByFormIdInAndApplicationId(List<Long> formIds,Long applicationId);
}