fixed evaluation criteria issue
This commit is contained in:
@@ -137,6 +137,9 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmailNotificationDao emailNotificationDao;
|
private EmailNotificationDao emailNotificationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormDao formDao;
|
||||||
|
|
||||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||||
FormEntity formEntity = formService.validateForm(formId);
|
FormEntity formEntity = formService.validateForm(formId);
|
||||||
@@ -209,8 +212,10 @@ public class ApplicationDao {
|
|||||||
ApplicationFormEntity applicationFormEntity,
|
ApplicationFormEntity applicationFormEntity,
|
||||||
List<ApplicationFormFieldResponseBean> applicationFormFieldResponseBeans) {
|
List<ApplicationFormFieldResponseBean> applicationFormFieldResponseBeans) {
|
||||||
|
|
||||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(
|
||||||
applicationFormEntity.getForm().getContent(), ContentResponseBean.class);
|
// applicationFormEntity.getForm().getContent(), ContentResponseBean.class);
|
||||||
|
|
||||||
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(applicationFormEntity.getForm()).getContent();
|
||||||
|
|
||||||
for (ApplicationFormFieldEntity applicationFormFieldEntity : applicationFormFieldEntities) {
|
for (ApplicationFormFieldEntity applicationFormFieldEntity : applicationFormFieldEntities) {
|
||||||
|
|
||||||
@@ -430,7 +435,8 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
private List<Long> validateFileUploadDocuments(ApplicationFormFieldRequestBean applicationFormFieldRequestBean, FormEntity formEntity) {
|
private List<Long> validateFileUploadDocuments(ApplicationFormFieldRequestBean applicationFormFieldRequestBean, FormEntity formEntity) {
|
||||||
List<Long> documentIds=null;
|
List<Long> documentIds=null;
|
||||||
List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(formEntity.getContent(),ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(formEntity.getContent(),ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans=formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
||||||
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload"))) {
|
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload"))) {
|
||||||
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
||||||
@@ -580,7 +586,8 @@ public class ApplicationDao {
|
|||||||
formApplicationResponse.setId(formEntity.getId());
|
formApplicationResponse.setId(formEntity.getId());
|
||||||
formApplicationResponse.setLabel(formEntity.getLabel());
|
formApplicationResponse.setLabel(formEntity.getLabel());
|
||||||
formApplicationResponse.setCallId(formEntity.getCall().getId());
|
formApplicationResponse.setCallId(formEntity.getCall().getId());
|
||||||
formApplicationResponse.setContent(Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class));
|
// formApplicationResponse.setContent(Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class)
|
||||||
|
formApplicationResponse.setContent(formDao.convertFormEntityToFormResponseBean(formEntity).getContent());
|
||||||
return formApplicationResponse;
|
return formApplicationResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,7 +656,8 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
public void validateFormFields(ApplicationRequestBean request, FormEntity formEntity) {
|
public void validateFormFields(ApplicationRequestBean request, FormEntity formEntity) {
|
||||||
|
|
||||||
List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(formEntity.getContent(),ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(formEntity.getContent(),ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans=formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
|
|
||||||
List<ApplicationFormFieldRequestBean> requestFields = request.getFormFields();
|
List<ApplicationFormFieldRequestBean> requestFields = request.getFormFields();
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormDao formDao;
|
||||||
|
|
||||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||||
|
|
||||||
@@ -168,41 +171,42 @@ public class ApplicationEvaluationDao {
|
|||||||
private List<CriteriaMappedField> getMappedFieldsForCriteria(Long evaluationCriteriaId, Long applicationId) {
|
private List<CriteriaMappedField> getMappedFieldsForCriteria(Long evaluationCriteriaId, Long applicationId) {
|
||||||
List<CriteriaFormFieldEntity> criteriaFormFields = criteriaFormFieldRepository.findByEvaluationCriteriaIdAndIsDeletedFalse(evaluationCriteriaId);
|
List<CriteriaFormFieldEntity> criteriaFormFields = criteriaFormFieldRepository.findByEvaluationCriteriaIdAndIsDeletedFalse(evaluationCriteriaId);
|
||||||
List<CriteriaMappedField> mappedFields = new ArrayList<>();
|
List<CriteriaMappedField> mappedFields = new ArrayList<>();
|
||||||
Set<String> uniqueFieldIds = new HashSet<>();
|
|
||||||
|
|
||||||
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(applicationId);
|
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(applicationId);
|
||||||
|
|
||||||
for (ApplicationFormEntity applicationForm : applicationForms) {
|
for (ApplicationFormEntity applicationForm : applicationForms) {
|
||||||
|
Set<String> uniqueFieldIds = new HashSet<>();
|
||||||
|
|
||||||
for (CriteriaFormFieldEntity formField : criteriaFormFields) {
|
for (CriteriaFormFieldEntity formField : criteriaFormFields) {
|
||||||
String formFieldId = formField.getFormFieldId();
|
String formFieldId = formField.getFormFieldId();
|
||||||
|
|
||||||
|
FormEntity formEntity = applicationForm.getForm();
|
||||||
|
if (formEntity == null || !formEntity.getId().equals(formField.getFormId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!uniqueFieldIds.contains(formFieldId)) {
|
if (!uniqueFieldIds.contains(formFieldId)) {
|
||||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||||
mappedField.setId(formFieldId);
|
mappedField.setId(formFieldId);
|
||||||
|
|
||||||
FormEntity formEntity = getFormEntity(formField.getFormId());
|
List<ContentResponseBean> contentBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
if (formEntity != null) {
|
contentBeans.stream()
|
||||||
List<ContentResponseBean> contentBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
.filter(contentBean -> contentBean.getId().equals(formFieldId))
|
||||||
contentBeans.stream()
|
.findFirst()
|
||||||
.filter(contentBean -> contentBean.getId().equals(formFieldId))
|
.ifPresent(contentBean -> {
|
||||||
.findFirst()
|
mappedField.setFieldLabel(getLabelForField(contentBean));
|
||||||
.ifPresent(contentBean -> {
|
switch (contentBean.getName()) {
|
||||||
mappedField.setFieldLabel(getLabelForField(contentBean));
|
case "fileupload":
|
||||||
switch (contentBean.getName()) {
|
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
||||||
case "fileupload":
|
break;
|
||||||
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
case "checkboxes":
|
||||||
break;
|
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||||
|
break;
|
||||||
case "checkboxes":
|
case "paragraph":
|
||||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
handleParagraphField(applicationId, formField, contentBean, mappedField);
|
||||||
break;
|
break;
|
||||||
case "paragraph":
|
default:
|
||||||
handleParagraphField(applicationId, formField, contentBean, mappedField);
|
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||||
break;
|
}
|
||||||
default:
|
});
|
||||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
mappedFields.add(mappedField);
|
mappedFields.add(mappedField);
|
||||||
uniqueFieldIds.add(formFieldId);
|
uniqueFieldIds.add(formFieldId);
|
||||||
@@ -314,7 +318,8 @@ public class ApplicationEvaluationDao {
|
|||||||
applicationFormEntities.forEach(applicationForm -> {
|
applicationFormEntities.forEach(applicationForm -> {
|
||||||
FormEntity formEntity = applicationForm.getForm();
|
FormEntity formEntity = applicationForm.getForm();
|
||||||
if (formEntity != null) {
|
if (formEntity != null) {
|
||||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.forEach(contentResponseBean -> {
|
contentResponseBeans.forEach(contentResponseBean -> {
|
||||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||||
String label = null;
|
String label = null;
|
||||||
@@ -682,7 +687,8 @@ public class ApplicationEvaluationDao {
|
|||||||
ApplicationFormEntity applicationForm, Long applicationId) {
|
ApplicationFormEntity applicationForm, Long applicationId) {
|
||||||
mappedField.setId(formFieldId);
|
mappedField.setId(formFieldId);
|
||||||
formRepository.findById(criteriaFormField.getFormId()).ifPresent(formEntity -> {
|
formRepository.findById(criteriaFormField.getFormId()).ifPresent(formEntity -> {
|
||||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.stream().filter(bean -> bean.getId().equals(formFieldId)).findFirst().ifPresent(contentResponseBean -> {
|
contentResponseBeans.stream().filter(bean -> bean.getId().equals(formFieldId)).findFirst().ifPresent(contentResponseBean -> {
|
||||||
String label = getLabel(contentResponseBean);
|
String label = getLabel(contentResponseBean);
|
||||||
mappedField.setFieldLabel(label);
|
mappedField.setFieldLabel(label);
|
||||||
@@ -828,7 +834,8 @@ public class ApplicationEvaluationDao {
|
|||||||
applicationFormEntities.forEach(applicationForm -> {
|
applicationFormEntities.forEach(applicationForm -> {
|
||||||
FormEntity formEntity = applicationForm.getForm();
|
FormEntity formEntity = applicationForm.getForm();
|
||||||
if (formEntity != null) {
|
if (formEntity != null) {
|
||||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.forEach(contentResponseBean -> {
|
contentResponseBeans.forEach(contentResponseBean -> {
|
||||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||||
String label = null;
|
String label = null;
|
||||||
@@ -960,7 +967,8 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
FormEntity formEntity = formRepository.findById(criteriaFormField.getFormId()).orElse(null);
|
FormEntity formEntity = formRepository.findById(criteriaFormField.getFormId()).orElse(null);
|
||||||
if (formEntity != null) {
|
if (formEntity != null) {
|
||||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.stream()
|
contentResponseBeans.stream()
|
||||||
.filter(bean -> bean.getId().equals(criteriaFormField.getFormFieldId()))
|
.filter(bean -> bean.getId().equals(criteriaFormField.getFormFieldId()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
@@ -1125,7 +1133,8 @@ public class ApplicationEvaluationDao {
|
|||||||
FormEntity formEntity = applicationForm.getForm();
|
FormEntity formEntity = applicationForm.getForm();
|
||||||
|
|
||||||
if (formEntity != null) {
|
if (formEntity != null) {
|
||||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
|
|
||||||
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
||||||
if ("fileupload".equals(contentResponseBean.getName())) {
|
if ("fileupload".equals(contentResponseBean.getName())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user