Resolved conflicts
This commit is contained in:
@@ -21,14 +21,12 @@ import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
||||
import net.gepafin.tendermanagement.service.UserService;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.util.FieldValidator;
|
||||
import net.gepafin.tendermanagement.util.MailUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -92,9 +90,6 @@ public class ApplicationDao {
|
||||
@Autowired
|
||||
private SystemEmailTemplatesService systemEmailTemplatesService;
|
||||
|
||||
@Autowired
|
||||
private MailUtil mailUtil;
|
||||
|
||||
@Value("${default_System_Receiver_Email}")
|
||||
private String defaultSystemReceiverEmail;
|
||||
|
||||
@@ -119,6 +114,9 @@ public class ApplicationDao {
|
||||
// @Value("${aws.s3.url.folder.signed.document}")
|
||||
// private String signedDocumentS3Folder;
|
||||
|
||||
@Value("${default.hub.uuid}")
|
||||
private String defaultHubUuid;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@@ -133,6 +131,10 @@ public class ApplicationDao {
|
||||
|
||||
@Autowired
|
||||
private EmailNotificationDao emailNotificationDao;
|
||||
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private EmailLogDao emailLogDao;
|
||||
@@ -208,8 +210,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) {
|
||||
|
||||
@@ -293,11 +297,11 @@ public class ApplicationDao {
|
||||
// return applicationResponses;
|
||||
// }
|
||||
|
||||
public List<ApplicationResponse> getAllApplications(UserEntity userEntity, Long callId, Long companyId,String status) {
|
||||
public List<ApplicationResponse> getAllApplications(UserEntity userEntity, Long callId, Long companyId,List<ApplicationStatusTypeEnum> statusList) {
|
||||
|
||||
log.info("Fetching applications for RoleType: {}", userEntity.getRoleEntity().getRoleType());
|
||||
|
||||
Specification<ApplicationEntity> spec = search(userEntity, callId, companyId,status);
|
||||
Specification<ApplicationEntity> spec = search(userEntity, callId, companyId,statusList);
|
||||
|
||||
List<ApplicationEntity> applicationEntities = applicationRepository.findAll(spec);
|
||||
|
||||
@@ -307,7 +311,7 @@ public class ApplicationDao {
|
||||
}
|
||||
|
||||
|
||||
private Specification<ApplicationEntity> search(UserEntity userEntity, Long callId, Long companyId,String status) {
|
||||
private Specification<ApplicationEntity> search(UserEntity userEntity, Long callId, Long companyId,List<ApplicationStatusTypeEnum> statusList) {
|
||||
return (root, query, builder) -> {
|
||||
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||
Predicate predicate = builder.isFalse(root.get("isDeleted"));
|
||||
@@ -320,8 +324,11 @@ public class ApplicationDao {
|
||||
if (companyId != null) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("company").get("id"), companyId));
|
||||
}
|
||||
if (status != null) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("status"), status));
|
||||
if (statusList != null && !statusList.isEmpty()) {
|
||||
List<String> statusNames = statusList.stream()
|
||||
.map(Enum::name)
|
||||
.collect(Collectors.toList());
|
||||
predicate = builder.and(predicate, root.get("status").in(statusNames));
|
||||
}
|
||||
predicate = builder.and(predicate, builder.equal(root.get("hubId"), userEntity.getHub().getId()));
|
||||
return predicate;
|
||||
@@ -426,7 +433,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())) {
|
||||
@@ -511,10 +519,63 @@ public class ApplicationDao {
|
||||
}
|
||||
else {
|
||||
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(applicationEntity.getId());
|
||||
for (ApplicationFormEntity applicationFormEntity : applicationFormEntities) {
|
||||
FormEntity form = formService.validateForm(applicationFormEntity.getForm().getId());
|
||||
formEntities.add(form);
|
||||
addFormApplication(form, applicationEntity, formApplicationResponses);
|
||||
List<ApplicationFormEntity> sequencedApplicationFormEntity = new ArrayList<>();
|
||||
Long formIdMiddle = null;
|
||||
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findBySourceIdAndCallId(
|
||||
applicationEntity.getCall().getInitialForm(), applicationEntity.getCall().getId());
|
||||
|
||||
if (!flowEdgesList.isEmpty()) {
|
||||
if (flowEdgesList.size() == 1) {
|
||||
formIdMiddle = flowEdgesList.get(0).getTargetId();
|
||||
} else {
|
||||
List<Long> nextFormIds = flowEdgesList.stream()
|
||||
.map(FlowEdgesEntity::getTargetId)
|
||||
.toList();
|
||||
|
||||
FlowDataEntity flowDataEntity = flowDataRepository.findByFormIdAndCallId(
|
||||
applicationEntity.getCall().getInitialForm(), applicationEntity.getCall().getId());
|
||||
|
||||
ApplicationFormFieldEntity applicationFormFieldEntity = applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormFormIdAndApplicationFormApplicationId(
|
||||
flowDataEntity.getChoosenField(), applicationEntity.getCall().getInitialForm(), applicationEntity.getId())
|
||||
.orElse(null);
|
||||
|
||||
if (applicationFormFieldEntity != null) {
|
||||
formIdMiddle = flowDataRepository.findByChoosenValueAndFormIdIn(
|
||||
applicationFormFieldEntity.getFieldValue(), nextFormIds)
|
||||
.map(FlowDataEntity::getFormId)
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Long> applicationFormIds = new ArrayList<>();
|
||||
applicationFormIds.add(applicationEntity.getCall().getInitialForm());
|
||||
if (formIdMiddle != null && formIdMiddle > 0) {
|
||||
applicationFormIds.add(formIdMiddle);
|
||||
}
|
||||
applicationFormIds.add(applicationEntity.getCall().getFinalForm());
|
||||
if (applicationFormEntities.size() == 3) {
|
||||
for (Long applicationFormId : applicationFormIds) {
|
||||
for (ApplicationFormEntity applicationFormEntity : applicationFormEntities) {
|
||||
if (applicationFormEntity.getForm().getId().equals(applicationFormId)) {
|
||||
sequencedApplicationFormEntity.add(applicationFormEntity);
|
||||
FormEntity form = formService.validateForm(applicationFormId);
|
||||
formEntities.add(form);
|
||||
addFormApplication(form, applicationEntity, formApplicationResponses);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
ApplicationFormEntity applicationFormEntity1=applicationFormRepository.findByApplicationIdAndFormId(applicationEntity.getId(),applicationEntity.getCall().getInitialForm());
|
||||
sequencedApplicationFormEntity.add(applicationFormEntity1);
|
||||
FormEntity form1 = formService.validateForm(applicationFormEntity1.getForm().getId());
|
||||
formEntities.add(form1);
|
||||
addFormApplication(form1, applicationEntity, formApplicationResponses);
|
||||
ApplicationFormEntity applicationFormEntity2=applicationFormRepository.findByApplicationIdAndFormId(applicationEntity.getId(),applicationEntity.getCall().getFinalForm());
|
||||
sequencedApplicationFormEntity.add(applicationFormEntity2);
|
||||
FormEntity form2= formService.validateForm(applicationFormEntity2.getForm().getId());
|
||||
formEntities.add(form2);
|
||||
addFormApplication(form2, applicationEntity, formApplicationResponses);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,7 +637,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;
|
||||
}
|
||||
|
||||
@@ -645,7 +707,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();
|
||||
|
||||
@@ -736,7 +799,7 @@ public class ApplicationDao {
|
||||
EmailLogRequest emailLogRequest=emailLogDao.createEmailLogRequest(SystemEmailTemplatesEntityTypeEnum.APPLICATION_SUBMISSION_TO_USER_AND_COMPANY.getValue(),RecipientTypeEnum.BENEFICIARY,userEntity.getId(),subject,body, StatusTypeEnum.SUCCESS.getValue(), null,applicationEntity.getId(),EmailTrackingEntityTypeEnum.APPLICATION,userEntity);
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email),emailLogRequest);
|
||||
List<String> recipientEmails = new ArrayList<>();
|
||||
recipientEmails.add(email);
|
||||
// recipientEmails.add(email);
|
||||
String companyEmail = company.getEmail();
|
||||
String contactEmail = company.getContactEmail();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user