Updated code for notification

This commit is contained in:
Piyush
2024-12-23 11:24:25 +05:30
parent 91ec063327
commit 288fde0a88
11 changed files with 144 additions and 22 deletions

View File

@@ -92,6 +92,12 @@ public class ApplicationEvaluationDao {
@Autowired
private CompanyService companyService;
@Autowired
private NotificationDao notificationDao;
@Autowired
private UserRepository userRepository;
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
@@ -493,8 +499,14 @@ public class ApplicationEvaluationDao {
setIfUpdated(entity::getMotivation, entity::setMotivation, req.getMotivation());
actionType = VersionActionTypeEnum.UPDATE;
} else {
ApplicationEntity application=entity.getAssignedApplicationsEntity().getApplication();
entity = convertToEntity(user, req, assignedApplicationId);
actionType = VersionActionTypeEnum.INSERT;
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
}
ApplicationStatusForEvaluation status = req.getApplicationStatus();
@@ -1442,12 +1454,17 @@ public class ApplicationEvaluationDao {
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.REJECTED.getValue())))) {
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(application,existingEntity);
}
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_RESULT);
notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT);
return convertToResponse(entity);
}
return null;
}
public ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId) {
public ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId) {
return applicationEvaluationRepository
.findByApplicationIdAndIsDeletedFalse(applicationId)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,