Updated response of communication API

This commit is contained in:
rajesh
2025-10-14 19:41:00 +05:30
parent 43a940f569
commit c469b08e18
6 changed files with 42 additions and 28 deletions

View File

@@ -2623,7 +2623,7 @@ public class ApplicationEvaluationDao {
application.setStatus(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED.getValue()); application.setStatus(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED.getValue());
log.info("Application status updated to {} for applicationId: {}", ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED, application.getId()); log.info("Application status updated to {} for applicationId: {}", ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED, application.getId());
emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application, hub, existingEntity,applicationRequest.getEmailJson()); emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application, hub, existingEntity);
application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now())); application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
application.setEmailJson(Utils.convertMapIntoJsonString(applicationRequest.getEmailJson())); application.setEmailJson(Utils.convertMapIntoJsonString(applicationRequest.getEmailJson()));
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request); emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);

View File

@@ -1144,10 +1144,9 @@ public class AppointmentDao {
richiestaCliente.setNota(requestNota); richiestaCliente.setNota(requestNota);
richiestaCliente.setDurataMesiFinanziamento(createAppointmentRequest.getDurataMesiFinanziamento()); richiestaCliente.setDurataMesiFinanziamento(createAppointmentRequest.getDurataMesiFinanziamento());
richiestaCliente.setImportoBreveTermine(createAppointmentRequest.getImportoBreveTermine()); richiestaCliente.setImportoBreveTermine(createAppointmentRequest.getImportoBreveTermine());
richiestaCliente.setDataAppuntamento(createAppointmentRequest.getDataAppuntamento());
richiestaClienteList.add(richiestaCliente); richiestaClienteList.add(richiestaCliente);
} }
input.setDataAppuntamento(createAppointmentRequest.getDataAppuntamento());
input.setRichiestaCliente(richiestaClienteList); input.setRichiestaCliente(richiestaClienteList);
appointmentCreationRequest.setInput(input); appointmentCreationRequest.setInput(input);
return appointmentCreationRequest; return appointmentCreationRequest;

View File

@@ -120,11 +120,17 @@ public class CommunicationDao {
public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) { public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) {
ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId); ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId);
List<CommunicationResponseBean> commentsList = communicationRepository.findCommentListDetailsByAmendmentId(amendmentId); List<CommunicationEntity> commentsList = communicationRepository.findByApplicationAmendmentRequestIdAndIsDeletedFalse(amendmentId);
if (commentsList == null) { if (commentsList == null) {
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)); throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND));
} }
return new ApplicationAmendmentResponse(amendmentData, commentsList); List<CommunicationResponseBean> communicationResponseBeans=new ArrayList<>();
for(CommunicationEntity communicationEntity:commentsList){
List<DocumentResponseBean> communicationDocumentBeans=getDocumentResponseBean(communicationEntity);
CommunicationResponseBean communicationResponseBean=convertToCommunicationResponseBean(communicationEntity,communicationDocumentBeans);
communicationResponseBeans.add(communicationResponseBean);
}
return new ApplicationAmendmentResponse(amendmentData, communicationResponseBeans);
} }
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) { public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {

View File

@@ -429,28 +429,36 @@ public class EmailNotificationDao {
throw new IllegalArgumentException("Failed to parse email configuration JSON", e); throw new IllegalArgumentException("Failed to parse email configuration JSON", e);
} }
} }
public void sendMailForApplicationTechnicalEvaluationRejected(ApplicationEntity applicationEntity,HubEntity hub,ApplicationEvaluationEntity applicationEvaluationEntity,Map<String, Object> emailJson) {
HubEntity hubEntity = hubService.valdateHub(applicationEntity.getHubId()); public void sendMailForApplicationTechnicalEvaluationRejected(ApplicationEntity applicationEntity,HubEntity hub,ApplicationEvaluationEntity applicationEvaluationEntity) {
SystemEmailTemplateResponse systemEmailTemplateResponse=new SystemEmailTemplateResponse();
systemEmailTemplateResponse.setSubject((String) emailJson.get("subject"));
systemEmailTemplateResponse.setHtmlContent((String) emailJson.get("message"));
Map<String, String> subjectPlaceholders = new HashMap<>();
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
subjectPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
Map<String, String> bodyPlaceholders = prepareEmailPlaceholdersForTechnicalEvaluationRejected(applicationEntity,hub,applicationEvaluationEntity); Map<String, String> bodyPlaceholders = prepareEmailPlaceholdersForTechnicalEvaluationRejected(applicationEntity,hub,applicationEvaluationEntity);
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE, bodyPlaceholders, null,
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders); null);
SystemEmailTemplateResponse systemEmailTemplateResponse1=new SystemEmailTemplateResponse();
systemEmailTemplateResponse1.setSubject(subject);
systemEmailTemplateResponse1.setHtmlContent(body);
systemEmailTemplateResponse1.setEmailScenario(EmailScenarioTypeEnum.APPLICATION_TECHNICAL_EVALUATION_REJECTED);
EmailContentResponse emailContentResponse=new EmailContentResponse(subject,body,systemEmailTemplateResponse1);
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
sendEmails(applicationEntity, userEntity, null,null,emailContentResponse.getSystemEmailTemplateResponse(),emailContentResponse.getSubject(),emailContentResponse.getBody());
} }
// public void sendMailForApplicationTechnicalEvaluationRejected(ApplicationEntity applicationEntity,HubEntity hub,ApplicationEvaluationEntity applicationEvaluationEntity,Map<String, Object> emailJson) {
//
// HubEntity hubEntity = hubService.valdateHub(applicationEntity.getHubId());
// SystemEmailTemplateResponse systemEmailTemplateResponse=new SystemEmailTemplateResponse();
// systemEmailTemplateResponse.setSubject((String) emailJson.get("subject"));
// systemEmailTemplateResponse.setHtmlContent((String) emailJson.get("message"));
// Map<String, String> subjectPlaceholders = new HashMap<>();
// CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
// subjectPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
// subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// Map<String, String> bodyPlaceholders = prepareEmailPlaceholdersForTechnicalEvaluationRejected(applicationEntity,hub,applicationEvaluationEntity);
// String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
// String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
// SystemEmailTemplateResponse systemEmailTemplateResponse1=new SystemEmailTemplateResponse();
// systemEmailTemplateResponse1.setSubject(subject);
// systemEmailTemplateResponse1.setHtmlContent(body);
// systemEmailTemplateResponse1.setEmailScenario(EmailScenarioTypeEnum.APPLICATION_TECHNICAL_EVALUATION_REJECTED);
// EmailContentResponse emailContentResponse=new EmailContentResponse(subject,body,systemEmailTemplateResponse1);
// UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
// sendEmails(applicationEntity, userEntity, null,null,emailContentResponse.getSystemEmailTemplateResponse(),emailContentResponse.getSubject(),emailContentResponse.getBody());
//
// }
public Map<String, String> prepareEmailPlaceholdersForTechnicalEvaluationRejected(ApplicationEntity applicationEntity,HubEntity hub,ApplicationEvaluationEntity applicationEvaluationEntity) { public Map<String, String> prepareEmailPlaceholdersForTechnicalEvaluationRejected(ApplicationEntity applicationEntity,HubEntity hub,ApplicationEvaluationEntity applicationEvaluationEntity) {
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName()); bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());

View File

@@ -15,6 +15,7 @@ public class AppointmentCreationRequest {
private Long id; private Long id;
private String ndg; private String ndg;
private List<RichiestaCliente> richiestaCliente; private List<RichiestaCliente> richiestaCliente;
private LocalDateTime dataAppuntamento;
} }
@Data @Data

View File

@@ -11,10 +11,10 @@ import java.util.Optional;
public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> { public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> {
@Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" + // @Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" +
".updatedDate, " + "c.applicationAmendmentRequest.id, c.senderUserId, c.receiverUserId, c.id " + ") " + "FROM CommunicationEntity c " + "WHERE c" + // ".updatedDate, " + "c.applicationAmendmentRequest.id, c.senderUserId, c.receiverUserId, c.id " + ") " + "FROM CommunicationEntity c " + "WHERE c" +
".applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false") // ".applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false")
List<CommunicationResponseBean> findCommentListDetailsByAmendmentId(@Param("amendmentId") Long amendmentId); List<CommunicationEntity> findByApplicationAmendmentRequestIdAndIsDeletedFalse(Long amendmentId);
Optional<CommunicationEntity> findByIdAndIsDeletedFalse(Long commentId); Optional<CommunicationEntity> findByIdAndIsDeletedFalse(Long commentId);