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