Updated code for notification
This commit is contained in:
@@ -105,6 +105,12 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AssignedApplicationsDao assignedApplicationsDao;
|
private AssignedApplicationsDao assignedApplicationsDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
||||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||||
@@ -294,6 +300,10 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.SOCCORSO.getValue());
|
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.SOCCORSO.getValue());
|
||||||
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||||
|
|
||||||
|
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(applicationEntity, NotificationTypeEnum.AMENDMENT_CREATION);
|
||||||
|
|
||||||
|
notificationDao.sendNotificationToInstructor(placeHolders,applicationAmendmentRequestEntity.getApplicationEvaluationEntity(),NotificationTypeEnum.AMENDMENT_CREATION);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "Update Assigned Application" operation. **/
|
/** This code is responsible for adding a version history log for the "Update Assigned Application" operation. **/
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAssignedApplication).newData(assignedApplicationsEntity).build());
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAssignedApplication).newData(assignedApplicationsEntity).build());
|
||||||
}
|
}
|
||||||
@@ -829,7 +839,6 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
|
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
|
||||||
//cloned entity for old data and versioning
|
//cloned entity for old data and versioning
|
||||||
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
|
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
|
||||||
|
|
||||||
List<ApplicationAmendmentRequestEntity> amendmentRequestList = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(
|
List<ApplicationAmendmentRequestEntity> amendmentRequestList = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(
|
||||||
existingApplicationAmendment.getApplicationEvaluationEntity().getId()
|
existingApplicationAmendment.getApplicationEvaluationEntity().getId()
|
||||||
);
|
);
|
||||||
@@ -875,6 +884,11 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
AssignedApplicationsEntity oldAssignedApplicationData = Utils.getClonedEntityForData(assignedApplicationsEntity);
|
AssignedApplicationsEntity oldAssignedApplicationData = Utils.getClonedEntityForData(assignedApplicationsEntity);
|
||||||
assignedApplicationsEntity = assignedApplicationsRepository.save(existingApplicationAmendment.getApplicationEvaluationEntity().getAssignedApplicationsEntity());
|
assignedApplicationsEntity = assignedApplicationsRepository.save(existingApplicationAmendment.getApplicationEvaluationEntity().getAssignedApplicationsEntity());
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.AMENDMENT_CLOSED);
|
||||||
|
|
||||||
|
notificationDao.sendNotificationToInstructor(placeHolders,existingApplicationAmendment.getApplicationEvaluationEntity(),NotificationTypeEnum.AMENDMENT_CLOSED);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "Update Application Evaluation" operation. **/
|
/** This code is responsible for adding a version history log for the "Update Application Evaluation" operation. **/
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity)
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity)
|
||||||
.newData(existingApplicationEvaluationEntity).build());
|
.newData(existingApplicationEvaluationEntity).build());
|
||||||
@@ -894,6 +908,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
|
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
|
||||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBea
|
|||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.repositories.*;
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
@@ -162,6 +163,15 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationService applicationEvaluationService;
|
private ApplicationEvaluationService applicationEvaluationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RoleRepository roleRepository;
|
||||||
|
|
||||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||||
FormEntity formEntity = formService.validateForm(formId);
|
FormEntity formEntity = formService.validateForm(formId);
|
||||||
// callService.validatePublishedCall(formEntity.getCall().getId());
|
// callService.validatePublishedCall(formEntity.getCall().getId());
|
||||||
@@ -818,6 +828,8 @@ public class ApplicationDao {
|
|||||||
applicationEntity.setStatus(ApplicationStatusTypeEnum.SUBMIT.getValue());
|
applicationEntity.setStatus(ApplicationStatusTypeEnum.SUBMIT.getValue());
|
||||||
applicationEntity.setSubmissionDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
applicationEntity.setSubmissionDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
applicationEntity = applicationRepository.save(applicationEntity);
|
applicationEntity = applicationRepository.save(applicationEntity);
|
||||||
|
Map<String ,String> placeHolders=notificationDao.sendNotificationToBeneficiary(applicationEntity,NotificationTypeEnum.APPLICATION_SUBMISSION);
|
||||||
|
notificationDao.sendNotificationToSuperUser(applicationEntity,placeHolders,NotificationTypeEnum.APPLICATION_SUBMISSION);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for "Update application status" operation. **/
|
/** This code is responsible for adding a version history log for "Update application status" operation. **/
|
||||||
loggingUtil.addVersionHistory(
|
loggingUtil.addVersionHistory(
|
||||||
|
|||||||
@@ -93,6 +93,12 @@ public class ApplicationEvaluationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||||
|
|
||||||
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||||
@@ -493,8 +499,14 @@ public class ApplicationEvaluationDao {
|
|||||||
setIfUpdated(entity::getMotivation, entity::setMotivation, req.getMotivation());
|
setIfUpdated(entity::getMotivation, entity::setMotivation, req.getMotivation());
|
||||||
actionType = VersionActionTypeEnum.UPDATE;
|
actionType = VersionActionTypeEnum.UPDATE;
|
||||||
} else {
|
} else {
|
||||||
|
ApplicationEntity application=entity.getAssignedApplicationsEntity().getApplication();
|
||||||
entity = convertToEntity(user, req, assignedApplicationId);
|
entity = convertToEntity(user, req, assignedApplicationId);
|
||||||
actionType = VersionActionTypeEnum.INSERT;
|
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();
|
ApplicationStatusForEvaluation status = req.getApplicationStatus();
|
||||||
|
|
||||||
@@ -1442,6 +1454,11 @@ public class ApplicationEvaluationDao {
|
|||||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.REJECTED.getValue())))) {
|
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.REJECTED.getValue())))) {
|
||||||
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(application,existingEntity);
|
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 convertToResponse(entity);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -16,14 +16,18 @@ import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
|||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
||||||
import net.gepafin.tendermanagement.entities.HubEntity;
|
import net.gepafin.tendermanagement.entities.HubEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.AppointmentCreationRequest;
|
import net.gepafin.tendermanagement.model.request.AppointmentCreationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.AppointmentNdgRequest;
|
import net.gepafin.tendermanagement.model.request.AppointmentNdgRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.AppointmentVisuraListRequest;
|
import net.gepafin.tendermanagement.model.request.AppointmentVisuraListRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.AppointmentVisuraRequest;
|
import net.gepafin.tendermanagement.model.request.AppointmentVisuraRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.CreateAppointmentRequest;
|
import net.gepafin.tendermanagement.model.request.CreateAppointmentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||||
import net.gepafin.tendermanagement.model.request.UploadDocToExternalSystemRequest;
|
import net.gepafin.tendermanagement.model.request.UploadDocToExternalSystemRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.AppointmentCreationResponse;
|
import net.gepafin.tendermanagement.model.response.AppointmentCreationResponse;
|
||||||
@@ -34,6 +38,7 @@ import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
|||||||
import net.gepafin.tendermanagement.repositories.CompanyRepository;
|
import net.gepafin.tendermanagement.repositories.CompanyRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.DocumentRepository;
|
import net.gepafin.tendermanagement.repositories.DocumentRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.HubRepository;
|
import net.gepafin.tendermanagement.repositories.HubRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
import net.gepafin.tendermanagement.service.CompanyService;
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.service.feignClient.AppointmentApiService;
|
import net.gepafin.tendermanagement.service.feignClient.AppointmentApiService;
|
||||||
@@ -58,6 +63,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -130,6 +136,12 @@ public class AppointmentDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TokenProvider tokenProvider;
|
private TokenProvider tokenProvider;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
private final Map<Long, ExecutorService> executorMap = new ConcurrentHashMap<>();
|
private final Map<Long, ExecutorService> executorMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final ConcurrentHashMap<Long, ExecutorService> threadForDocumentMap = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<Long, ExecutorService> threadForDocumentMap = new ConcurrentHashMap<>();
|
||||||
@@ -312,6 +324,8 @@ public class AppointmentDao {
|
|||||||
company.setNdg(ndg);
|
company.setNdg(ndg);
|
||||||
companyRepository.save(company);
|
companyRepository.save(company);
|
||||||
applicationRepository.save(application);
|
applicationRepository.save(application);
|
||||||
|
Map<String ,String> placeHolders=notificationDao.sendNotificationToBeneficiary(application,NotificationTypeEnum.NDG_GENERATION);
|
||||||
|
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.NDG_GENERATION);
|
||||||
|
|
||||||
// /** This code is responsible for adding a version history log for the "update application ndg code, status, and Id visura" operation. **/
|
// /** This code is responsible for adding a version history log for the "update application ndg code, status, and Id visura" operation. **/
|
||||||
// loggingUtil.addVersionHistory(
|
// loggingUtil.addVersionHistory(
|
||||||
|
|||||||
@@ -2,18 +2,25 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.NotificationEntity;
|
import net.gepafin.tendermanagement.entities.NotificationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.NotificationTypeEntity;
|
import net.gepafin.tendermanagement.entities.NotificationTypeEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||||
import net.gepafin.tendermanagement.repositories.NotificationRepository;
|
import net.gepafin.tendermanagement.repositories.NotificationRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.NotificationTypeRepository;
|
import net.gepafin.tendermanagement.repositories.NotificationTypeRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -33,6 +40,9 @@ public class NotificationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserWithCompanyRepository userWithCompanyRepository;
|
private UserWithCompanyRepository userWithCompanyRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
public NotificationReq sendNotification(NotificationReq notificationReq) {
|
public NotificationReq sendNotification(NotificationReq notificationReq) {
|
||||||
|
|
||||||
// Ensure userId is properly set in notificationReq if not already
|
// Ensure userId is properly set in notificationReq if not already
|
||||||
@@ -113,4 +123,28 @@ public class NotificationDao {
|
|||||||
notificationReq.setUserId(userId);
|
notificationReq.setUserId(userId);
|
||||||
return notificationReq;
|
return notificationReq;
|
||||||
}
|
}
|
||||||
|
public Map<String, String> sendNotificationToBeneficiary(ApplicationEntity application, NotificationTypeEnum notificationTypeEnum) {
|
||||||
|
Map<String, String> placeHolders = new HashMap<>();
|
||||||
|
placeHolders.put("{{call_name}}", application.getCall().getName());
|
||||||
|
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
|
||||||
|
NotificationReq notificationReq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, application.getUserId());
|
||||||
|
sendNotification(notificationReq);
|
||||||
|
return placeHolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendNotificationToInstructor(Map<String, String> placeHolders, ApplicationEvaluationEntity applicationEvaluationEntity, NotificationTypeEnum notificationTypeEnum) {
|
||||||
|
Long instructorId=applicationEvaluationEntity.getUserId();
|
||||||
|
if(instructorId != null){
|
||||||
|
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders,instructorId);
|
||||||
|
sendNotification(notificationreq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void sendNotificationToSuperUser(ApplicationEntity application,Map<String,String> placeHolders,NotificationTypeEnum notificationTypeEnum) {
|
||||||
|
List<UserEntity> user=userRepository.findByRoleEntity_RoleTypeAndHubId(RoleStatusEnum.ROLE_SUPER_ADMIN.getValue(), application.getHubId());
|
||||||
|
UserEntity userEntity1=user.get(0);
|
||||||
|
if(userEntity1 != null) {
|
||||||
|
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders,userEntity1.getId());
|
||||||
|
sendNotification(notificationreq);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ public enum NotificationTypeEnum {
|
|||||||
CALL_CREATED("CALL_CREATED"),
|
CALL_CREATED("CALL_CREATED"),
|
||||||
APPLICATION_SUBMISSION("APPLICATION_SUBMISSION"),
|
APPLICATION_SUBMISSION("APPLICATION_SUBMISSION"),
|
||||||
AMENDMENT_CREATION("AMENDMENT_CREATION"),
|
AMENDMENT_CREATION("AMENDMENT_CREATION"),
|
||||||
EVALUATION_RESULT("EVALUATION_RESULT");
|
EVALUATION_RESULT("EVALUATION_RESULT"),
|
||||||
|
AMENDMENT_EXPIRED("AMENDMENT_EXPIRED"),
|
||||||
|
AMENDMENT_CLOSED("AMENDMENT_CLOSED"),
|
||||||
|
NDG_GENERATION("NDG_GENERATION"),
|
||||||
|
EVALUATION_CREATION("EVALUATION_CREATION"),
|
||||||
|
EVALUATION_EXPIRED("EVALUATION_EXPIRED");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
|||||||
@@ -25,4 +25,7 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
|||||||
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||||
|
|
||||||
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||||
|
|
||||||
|
List<UserEntity> findByRoleEntity_RoleTypeAndHubId(String roleType, Long hubId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,16 @@ package net.gepafin.tendermanagement.scheduler;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.dao.NotificationDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -49,6 +55,9 @@ public class ApplicationAmendmentScheduler {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ApplicationAmendmentScheduler.class);
|
private static final Logger log = LoggerFactory.getLogger(ApplicationAmendmentScheduler.class);
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
@@ -80,8 +89,10 @@ public class ApplicationAmendmentScheduler {
|
|||||||
try {
|
try {
|
||||||
ApplicationAmendmentRequestEntity oldAmendmentRequestEntity = Utils.getClonedEntityForData(request);
|
ApplicationAmendmentRequestEntity oldAmendmentRequestEntity = Utils.getClonedEntityForData(request);
|
||||||
request.setStatus(ApplicationAmendmentRequestEnum.CLOSE.getValue());
|
request.setStatus(ApplicationAmendmentRequestEnum.CLOSE.getValue());
|
||||||
|
ApplicationEntity application=oldAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication();
|
||||||
request = applicationAmendmentRepository.save(request);
|
request = applicationAmendmentRepository.save(request);
|
||||||
|
Map<String ,String> placeHolders=notificationDao.sendNotificationToBeneficiary(application,NotificationTypeEnum.AMENDMENT_EXPIRED);
|
||||||
|
notificationDao.sendNotificationToInstructor(placeHolders,oldAmendmentRequestEntity.getApplicationEvaluationEntity(),NotificationTypeEnum.AMENDMENT_EXPIRED);
|
||||||
/** This code is responsible for adding a version history log for the "Update Application Amendment" operation. **/
|
/** This code is responsible for adding a version history log for the "Update Application Amendment" operation. **/
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAmendmentRequestEntity).newData(request).build());
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAmendmentRequestEntity).newData(request).build());
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package net.gepafin.tendermanagement.scheduler;
|
package net.gepafin.tendermanagement.scheduler;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.dao.NotificationDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
@@ -22,6 +25,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ApplicationEvaluationScheduler {
|
public class ApplicationEvaluationScheduler {
|
||||||
@@ -35,6 +39,9 @@ public class ApplicationEvaluationScheduler {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest httpServletRequest;
|
private HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ApplicationEvaluationScheduler.class);
|
private static final Logger log = LoggerFactory.getLogger(ApplicationEvaluationScheduler.class);
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 2 * * ?") // Runs daily at midnight
|
@Scheduled(cron = "0 0 2 * * ?") // Runs daily at midnight
|
||||||
@@ -76,10 +83,15 @@ public class ApplicationEvaluationScheduler {
|
|||||||
|
|
||||||
ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils
|
ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils
|
||||||
.getClonedEntityForData(evaluation);
|
.getClonedEntityForData(evaluation);
|
||||||
|
ApplicationEntity application=evaluation.getAssignedApplicationsEntity().getApplication();
|
||||||
evaluation.setStatus(ApplicationEvaluationStatusTypeEnum.EXPIRED.getValue());
|
evaluation.setStatus(ApplicationEvaluationStatusTypeEnum.EXPIRED.getValue());
|
||||||
evaluation = applicationEvaluationRepository.save(evaluation);
|
evaluation = applicationEvaluationRepository.save(evaluation);
|
||||||
|
|
||||||
|
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
|
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
|
notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
|
|
||||||
|
|
||||||
// Logging version history for the update operation
|
// Logging version history for the update operation
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest)
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest)
|
||||||
.actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity)
|
.actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity)
|
||||||
|
|||||||
@@ -2003,6 +2003,7 @@
|
|||||||
<column name="notification_type" type="TEXT"/>
|
<column name="notification_type" type="TEXT"/>
|
||||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"/>
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"/>
|
||||||
<column name="user_id" type="INTEGER"/>
|
<column name="user_id" type="INTEGER"/>
|
||||||
|
<column name="redirect_link" type="TEXT"/>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
</createTable>
|
</createTable>
|
||||||
@@ -2015,9 +2016,13 @@
|
|||||||
primaryKeyName="pk_notification_type"/>
|
primaryKeyName="pk_notification_type"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="notification_name" type="TEXT"/>
|
<column name="notification_name" type="TEXT"/>
|
||||||
|
<column name="title" type="TEXT"/>
|
||||||
<column name="json_template" type="TEXT"/>
|
<column name="json_template" type="TEXT"/>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
@@ -2026,15 +2031,4 @@
|
|||||||
path="db/dump/insert_json_template_for_notification_13_12_2024.sql"/>
|
path="db/dump/insert_json_template_for_notification_13_12_2024.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="13-12-2024_5" author="Piyush Kag">
|
|
||||||
<addColumn tableName="notification">
|
|
||||||
<column name="redirect_link" type="TEXT"/>
|
|
||||||
</addColumn>
|
|
||||||
<addColumn tableName="notification_type">
|
|
||||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
|
||||||
<constraints nullable="false"/>
|
|
||||||
</column>
|
|
||||||
</addColumn>
|
|
||||||
</changeSet>
|
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
INSERT INTO notification_type (notification_name, json_template) VALUES
|
INSERT INTO notification_type (notification_name,title, json_template,created_date,updated_date,is_deleted) VALUES
|
||||||
('CALL_CREATED', 'Un nuovo bando intitolato {{call_name}} è stato pubblicato. Controllalo e invia le tue candidature prima della scadenza.'),
|
('CALL_CREATED', 'Un Nuovo Bando È Stato Pubblicato','Un nuovo bando intitolato {{call_name}} è stato pubblicato. Controllalo e invia le candidature prima della scadenza.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
('APPLICATION_SUBMISSION', 'La tua richiesta per {{call_name}} ai sensi del protocollo n. {{protocol_number}} è stata presentata con successo. È ora in fase di valutazione.'),
|
('APPLICATION_SUBMISSION','Candidatura Inviata con Successo per la Valutazione', 'La richiesta per {{call_name}} ai sensi del protocollo n. {{protocol_number}} è stata presentata con successo. È ora in fase di valutazione.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
('AMENDMENT_CREATION', 'È stato creato un emendamento per la tua domanda in {{call_name}} ai sensi del protocollo n. {{protocol_number}}. Esamina le modifiche e procedi di conseguenza.'),
|
('AMENDMENT_CREATION','È Stato Creato un Emendamento per la Richiesta', 'È stato creato un emendamento per la richiesta in {{call_name}} ai sensi del protocollo n. {{protocol_number}}. Esamina le modifiche e procedi di conseguenza.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
('EVALUATION_RESULT', 'Il risultato della valutazione per la tua domanda ai sensi del protocollo n. {{protocol_number}} è ora disponibile. Fai clic qui per visualizzare il tuo feedback.');
|
('EVALUATION_RESULT','Il Risultato della Valutazione per la Richiesta È Disponibile','Il risultato della valutazione per la richiesta ai sensi del protocollo n. {{protocol_number}} è ora disponibile.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
|
('AMENDMENT_EXPIRED','L Emendamento per la Richiesta È Scaduto', 'L’emendamento per la richiesta in {{call_name}} ai sensi del protocollo n. {{protocol_number}} è scaduto.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
|
('AMENDMENT_CLOSED','L Emendamento È Stato Chiuso ed È Ora Inattivo','L’emendamento per {{call_name}} ai sensi del protocollo n. {{protocol_number}} è stato chiuso ed è ora inattivo.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
|
('NDG_GENERATION','È Stato Generato un Nuovo NDG per la Richiesta','È stato generato un nuovo NDG per {{call_name}} ai sensi del protocollo n. {{protocol_number}}.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
|
('EVALUATION_CREATION','La Richiesta È Stata Assegnata per la Valutazione','La richiesta in {{call_name}} ai sensi del protocollo n. {{protocol_number}} è stata assegnata alla fase di valutazione.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false'),
|
||||||
|
('EVALUATION_EXPIRED','La Valutazione per la Richiesta È Scaduta','La valutazione per la richiesta in {{call_name}} ai sensi del protocollo n. {{protocol_number}} è scaduta.','2024-12-19T10:16:26.472Z','2024-12-19T10:16:26.472Z','false');
|
||||||
Reference in New Issue
Block a user