Resolved conflicts

This commit is contained in:
nisha
2025-01-09 15:29:14 +05:30
93 changed files with 2958 additions and 510 deletions

View File

@@ -24,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -94,6 +96,12 @@ public class ApplicationEvaluationDao {
@Autowired
private CompanyService companyService;
@Autowired
private NotificationDao notificationDao;
@Autowired
private UserRepository userRepository;
@Autowired
private Validator validator;
@@ -558,7 +566,16 @@ public class ApplicationEvaluationDao {
response.setAssignedAt(assignedApplications.getAssignedAt());
}
response.setEvaluationEndDate(entity.getEndDate());
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(application.getId());
if(assignedApplicationsOptional.isPresent()){
response.setAssignedUserId(assignedApplicationsOptional.get().getUserId());
UserEntity assignedUser = userService.validateUser(assignedApplicationsOptional.get().getUserId());
String assignedUserFirstName = assignedUser.getFirstName() != null ? assignedUser.getFirstName() : "";
String assignedUserLastName = assignedUser.getLastName() != null ? assignedUser.getLastName() : "";
String userName = String.join(" ", assignedUserFirstName, assignedUserLastName).trim();
response.setAssignedUserName(userName);
}
LocalDateTime callEndDate = application.getCall().getEndDate();
response.setCallEndDate(callEndDate);
if (application.getCompanyId() != null) {
@@ -599,8 +616,15 @@ public class ApplicationEvaluationDao {
application.setAmountAccepted(req.getAmountAccepted());
actionType = VersionActionTypeEnum.UPDATE;
} else {
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
ApplicationEntity application = applicationService.validateApplication(assignedApplicationsEntity.getApplication().getId());
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();
// Fetch all amendment request entities associated with the evaluation ID
@@ -1776,8 +1800,14 @@ public class ApplicationEvaluationDao {
String statusType = application.getStatus();
if (application.getStatus().equals(ApplicationStatusTypeEnum.APPROVED.getValue()) || application.getStatus().equals(ApplicationStatusTypeEnum.REJECTED.getValue())) {
existingEntity.setStatus(ApplicationEvaluationStatusTypeEnum.CLOSE.getValue());
existingEntity.setClosingDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.CLOSE.getValue());
}
if (existingEntity.getStartDate() != null && existingEntity.getClosingDate() != null) {
long activeDays = ChronoUnit.DAYS.between(existingEntity.getStartDate(), existingEntity.getClosingDate());
activeDays -= existingEntity.getSuspendedDays() != null ? existingEntity.getSuspendedDays() : 0;
existingEntity.setActiveDays(activeDays);
}
entity = applicationEvaluationRepository.save(existingEntity);
assignedApplicationsRepository.save(assignedApplicationsEntity);
@@ -1804,12 +1834,16 @@ public class ApplicationEvaluationDao {
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,