Merge pull request #184 from Kitzanos/feature/GEPAFINBE-152
GEPAFINBE-152 (Evaluation expiration issue)
This commit is contained in:
@@ -208,6 +208,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);
|
||||
|
||||
@@ -59,7 +59,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);
|
||||
|
||||
@@ -72,7 +72,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);
|
||||
|
||||
|
||||
@@ -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 " +
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user