Resolved Conflicts
This commit is contained in:
@@ -143,6 +143,9 @@ public class ApplicationEvaluationDao {
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Autowired
|
||||
private EmailDao emailDao;
|
||||
|
||||
|
||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
|
||||
@@ -311,7 +314,6 @@ public class ApplicationEvaluationDao {
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setNumberOfCheck(entity.getAssignedApplicationsEntity().getApplication().getCall().getNumberOfCheck());
|
||||
response.setAppointmentTemplateId(entity.getAssignedApplicationsEntity().getApplication().getCall().getAppointmentTemplateId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -704,7 +706,11 @@ public class ApplicationEvaluationDao {
|
||||
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplication).newData(application).build());
|
||||
|
||||
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
|
||||
// Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
|
||||
|
||||
Map<String, String> placeHolders = new HashMap<>();
|
||||
placeHolders.put("{{call_name}}", application.getCall().getName());
|
||||
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
|
||||
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
|
||||
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
|
||||
|
||||
@@ -1136,10 +1142,14 @@ public class ApplicationEvaluationDao {
|
||||
} else {
|
||||
entityOptional = applicationEvaluationRepository.findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
||||
}
|
||||
return entityOptional.map(this::convertToResponse)
|
||||
.orElseGet(() -> {
|
||||
return getEvaluationResponseByApplicationid(user, applicationId, assignedApplicationId);
|
||||
});
|
||||
|
||||
if (entityOptional.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
ApplicationEvaluationEntity entity = entityOptional.get();
|
||||
ApplicationEvaluationResponse applicationEvaluationResponse = convertToResponse(entity);
|
||||
applicationEvaluationResponse.setEmailSendResponse(entity.getEmailSendResponse());
|
||||
return applicationEvaluationResponse;
|
||||
}
|
||||
private List<EvaluationDocumentRequest> prepareEvaluationDocumentBeanList(ApplicationEvaluationEntity entity) {
|
||||
List<EvaluationDocumentRequest> docRequest = new ArrayList<>();
|
||||
@@ -1683,7 +1693,7 @@ public class ApplicationEvaluationDao {
|
||||
});
|
||||
}
|
||||
|
||||
private String getLabelFromSettings(ContentResponseBean contentResponseBean) {
|
||||
public String getLabelFromSettings(ContentResponseBean contentResponseBean) {
|
||||
String label = contentResponseBean.getLabel();
|
||||
if (contentResponseBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||
@@ -1897,7 +1907,7 @@ public class ApplicationEvaluationDao {
|
||||
assignedApplicationsEntity.getId());
|
||||
ApplicationEvaluationEntity entity;
|
||||
|
||||
|
||||
EmailSendResponse emailSendResponse = new EmailSendResponse();
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
ApplicationEvaluationEntity existingEntity = existingEntityOptional.get();
|
||||
// UserEntity userEntity = userService.validateUser(application.getUserId());
|
||||
@@ -1905,10 +1915,16 @@ public class ApplicationEvaluationDao {
|
||||
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(application);
|
||||
|
||||
|
||||
List<EmailSendResponse> responses = new ArrayList<>();
|
||||
if(newStatus.equals(ApplicationStatusForEvaluation.ADMISSIBLE) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.APPOINTMENT.getValue()))){
|
||||
application.setStatus(newStatus.getValue());
|
||||
log.info("Status updated to ADMISSIBLE for applicationId: " + application.getId());
|
||||
emailNotificationDao.sendAdmissibilityNotificationEmailForAdmissibleApplication(application);
|
||||
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||
responses = List.of(emailSendResponse);
|
||||
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
|
||||
}
|
||||
}
|
||||
|
||||
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.ADMISSIBLE.getValue()))){
|
||||
@@ -1960,27 +1976,48 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
|
||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.APPROVED.getValue())))) {
|
||||
application.setDateAccepted(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
application.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
application.setDateAccepted(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
application.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
application = applicationRepository.save(application);
|
||||
// emailNotificationDao.sendAdmissibilityNotificationEmailForApprovedApplication(application);
|
||||
notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
|
||||
}
|
||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.REJECTED.getValue())))) {
|
||||
application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
application.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
application = applicationRepository.save(application);
|
||||
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(application,existingEntity);
|
||||
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||
responses = List.of(emailSendResponse);
|
||||
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
|
||||
}
|
||||
notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
|
||||
}
|
||||
|
||||
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
|
||||
Map<String, String> placeHolders = new HashMap<>();
|
||||
placeHolders.put("{{call_name}}", application.getCall().getName());
|
||||
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
|
||||
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_RESULT);
|
||||
notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT);
|
||||
|
||||
return convertToResponse(entity);
|
||||
ApplicationEvaluationResponse response = convertToResponse(entity);
|
||||
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||
response.setEmailSendResponse(responses);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void saveEmailSendResponseToEvaluation(EmailSendResponse newResponse, ApplicationEvaluationEntity evaluationEntity) {
|
||||
List<EmailSendResponse> mergedResponses = Utils.mergeEmailSendResponses(
|
||||
evaluationEntity.getEmailSendResponse(), newResponse
|
||||
);
|
||||
evaluationEntity.setEmailSendResponse(mergedResponses);
|
||||
applicationEvaluationRepository.save(evaluationEntity);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId) {
|
||||
log.info("Validating ApplicationEvaluation for applicationId: {}", applicationId);
|
||||
return applicationEvaluationRepository
|
||||
@@ -2040,6 +2077,7 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
ApplicationEvaluationEntity entity = applicationEvaluationService.validateApplicationEvaluation(evaluationResponse.getId());
|
||||
|
||||
|
||||
//Handling Application Evaluation form
|
||||
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
||||
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
||||
@@ -2048,7 +2086,9 @@ public class ApplicationEvaluationDao {
|
||||
validateFormFieldCustom(applicationEvaluationFormRequestBean.getFormFields(),entity,evaluationFormEntity);
|
||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
||||
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
||||
return processEvaluationForm(entity);
|
||||
ApplicationEvaluationFormResponse response = processEvaluationForm(entity);
|
||||
response.setEmailSendResponse(evaluationResponse.getEmailSendResponse());
|
||||
return response;
|
||||
}
|
||||
|
||||
private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) {
|
||||
@@ -2300,6 +2340,7 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
response.setCompanyVatNumber(company.getVatNumber());
|
||||
response.setCompanyCodiceAteco(company.getCodiceAteco());
|
||||
response.setEmailSendResponse(evaluationEntity.getEmailSendResponse());
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user