Fixed issue for evaluation expiration

This commit is contained in:
nisha
2025-01-29 13:00:18 +05:30
parent 71eb5f41de
commit f64b37b9f5
4 changed files with 18 additions and 4 deletions

View File

@@ -192,6 +192,20 @@ public class NotificationDao {
}
}
public void sendNotificationToInstructorManager(Map<String, String> placeHolders, ApplicationEvaluationEntity applicationEvaluationEntity, NotificationTypeEnum notificationTypeEnum) {
List<UserEntity> userEntities=userRepository.findByRoleEntity_RoleTypeAndHubId(RoleStatusEnum.ROLE_INSTRUCTOR_MANAGER.getValue(),applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication().getHubId());
for (UserEntity user:userEntities) {
Long instructorId=user.getId();
ApplicationEntity application = applicationService.validateApplication(applicationEvaluationEntity.getApplicationId());
if (instructorId != null) {
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, instructorId, application.getUserWithCompany(),
null);
sendNotification(notificationreq);
}
}
}
public List<Long> getAllCompanyIdsForUser(Long userId) {
return userWithCompanyRepository.findActiveCompanyIdsByUserId(userId);

View File

@@ -57,7 +57,7 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
"WHERE a.isDeleted = false " +
"AND a.status <> 'CLOSE' " +
"AND a.status NOT IN('CLOSE','EXPIRED') " +
"AND a.endDate < :currentTime")
List<ApplicationAmendmentRequestEntity> findAmendmentsDueForExpiration(LocalDateTime currentTime);
@@ -70,7 +70,7 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
"AND NOT EXISTS ( " +
" SELECT 1 FROM ApplicationAmendmentRequestEntity activeAmendment" +
" WHERE activeAmendment.applicationEvaluationEntity.id = a.applicationEvaluationEntity.id " +
" AND activeAmendment.status <> 'CLOSE' " +
" AND activeAmendment.status NOT IN('CLOSE','EXPIRED') " +
" AND activeAmendment.isDeleted = false) ")
Set<ApplicationEvaluationEntity> findEvaluationsWithoutActiveAmendmentsByIds(@Param("applicationEvaluationIds") Set<Long> applicationEvaluationIds);

View File

@@ -32,7 +32,7 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
"WHERE aar.id = :evaluationId AND aar.isDeleted = false)")
ApplicationEntity findApplicationByEvaluationId(Long evaluationId);
@Query("SELECT a FROM ApplicationEvaluationEntity a WHERE a.isDeleted = false AND a.endDate < :currentDate")
@Query("SELECT a FROM ApplicationEvaluationEntity a WHERE a.isDeleted = false AND a.status = 'OPEN' AND a.endDate < :currentDate")
List<ApplicationEvaluationEntity> findAllByIsDeletedFalseAndEndDateBefore(@Param("currentDate") LocalDateTime currentDate);
@Query("SELECT a FROM ApplicationEvaluationEntity a " +

View File

@@ -90,7 +90,7 @@ public class ApplicationEvaluationScheduler {
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToInstructorManager(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
// Logging version history for the update operation
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest)