Merge pull request #348 from Kitzanos/feature/GEPAFINBE-236-prod
Cherry-pick (Update to TECHNICAL_EVALUATION flow)
This commit is contained in:
@@ -35,6 +35,7 @@ import org.springframework.data.domain.PageRequest;
|
|||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -578,54 +579,57 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
|
|
||||||
private Map<String, ApplicationFormFieldEntity> getApplicationFormFieldEntityMap(
|
private Map<String, ApplicationFormFieldEntity> getApplicationFormFieldEntityMap(
|
||||||
ApplicationAmendmentRequestEntity entity, List<AmendmentFormField> amendmentFormFields) {
|
ApplicationAmendmentRequestEntity entity, List<AmendmentFormField> amendmentFormFields) {
|
||||||
List<String> fieldIds = amendmentFormFields.stream()
|
if(amendmentFormFields!=null) {
|
||||||
.map(AmendmentFormField::getFieldId)
|
List<String> fieldIds = amendmentFormFields.stream()
|
||||||
.toList();
|
.map(AmendmentFormField::getFieldId)
|
||||||
return getApplicationFormFieldList(entity, fieldIds).stream()
|
.toList();
|
||||||
.collect(Collectors.toMap(ApplicationFormFieldEntity::getFieldId, Function.identity()));
|
return getApplicationFormFieldList(entity, fieldIds).stream()
|
||||||
|
.collect(Collectors.toMap(ApplicationFormFieldEntity::getFieldId, Function.identity()));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processFormFields(List<AmendmentFormField> amendmentFormFields, Map<String, String> fieldIdToLabelMap,
|
private void processFormFields(List<AmendmentFormField> amendmentFormFields, Map<String, String> fieldIdToLabelMap,
|
||||||
Map<String, ApplicationFormFieldEntity> formFieldEntityMap, ApplicationAmendmentRequestResponse response) {
|
Map<String, ApplicationFormFieldEntity> formFieldEntityMap, ApplicationAmendmentRequestResponse response) {
|
||||||
List<AmendmentFormFieldResponse> formFields = new ArrayList<>();
|
List<AmendmentFormFieldResponse> formFields = new ArrayList<>();
|
||||||
List<ApplicationFormFieldResponseBean> fileDetails = new ArrayList<>();
|
List<ApplicationFormFieldResponseBean> fileDetails = new ArrayList<>();
|
||||||
|
if (amendmentFormFields != null){
|
||||||
|
for (AmendmentFormField amendmentFormField : amendmentFormFields) {
|
||||||
|
// Create form field response
|
||||||
|
createFormField(formFields, fieldIdToLabelMap, amendmentFormField);
|
||||||
|
|
||||||
for (AmendmentFormField amendmentFormField : amendmentFormFields) {
|
// Create document responses
|
||||||
// Create form field response
|
List<Long> documentIds = extractIds(amendmentFormField.getFieldValue());
|
||||||
createFormField(formFields, fieldIdToLabelMap, amendmentFormField);
|
List<DocumentResponseBean> documentResponseBeans = documentIds.stream()
|
||||||
|
.map(id -> {
|
||||||
|
DocumentEntity documentEntity = documentService.validateDocument(id);
|
||||||
|
DocumentResponseBean responseBean = new DocumentResponseBean();
|
||||||
|
responseBean.setId(documentEntity.getId());
|
||||||
|
responseBean.setName(documentEntity.getFileName());
|
||||||
|
responseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType()));
|
||||||
|
responseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource()));
|
||||||
|
responseBean.setSourceId(documentEntity.getSourceId());
|
||||||
|
responseBean.setFilePath(documentEntity.getFilePath());
|
||||||
|
responseBean.setCreatedDate(documentEntity.getCreatedDate());
|
||||||
|
responseBean.setUpdatedDate(documentEntity.getUpdatedDate());
|
||||||
|
responseBean.setDocumentAttachmentId(documentEntity.getDocumentAttachmentId());
|
||||||
|
return responseBean;
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
// Create document responses
|
// Map to application form field response bean
|
||||||
List<Long> documentIds = extractIds(amendmentFormField.getFieldValue());
|
ApplicationFormFieldEntity formFieldEntity = formFieldEntityMap.get(amendmentFormField.getFieldId());
|
||||||
List<DocumentResponseBean> documentResponseBeans = documentIds.stream()
|
ApplicationFormFieldResponseBean responseBean = new ApplicationFormFieldResponseBean();
|
||||||
.map(id -> {
|
responseBean.setApplicationFormId(formFieldEntity.getApplicationForm().getId());
|
||||||
DocumentEntity documentEntity = documentService.validateDocument(id);
|
responseBean.setId(formFieldEntity.getId());
|
||||||
DocumentResponseBean responseBean = new DocumentResponseBean();
|
responseBean.setFieldId(amendmentFormField.getFieldId());
|
||||||
responseBean.setId(documentEntity.getId());
|
responseBean.setCreatedDate(formFieldEntity.getCreatedDate());
|
||||||
responseBean.setName(documentEntity.getFileName());
|
responseBean.setUpdatedDate(formFieldEntity.getUpdatedDate());
|
||||||
responseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType()));
|
responseBean.setFieldValue(documentResponseBeans);
|
||||||
responseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource()));
|
|
||||||
responseBean.setSourceId(documentEntity.getSourceId());
|
|
||||||
responseBean.setFilePath(documentEntity.getFilePath());
|
|
||||||
responseBean.setCreatedDate(documentEntity.getCreatedDate());
|
|
||||||
responseBean.setUpdatedDate(documentEntity.getUpdatedDate());
|
|
||||||
responseBean.setDocumentAttachmentId(documentEntity.getDocumentAttachmentId());
|
|
||||||
return responseBean;
|
|
||||||
})
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
// Map to application form field response bean
|
|
||||||
ApplicationFormFieldEntity formFieldEntity = formFieldEntityMap.get(amendmentFormField.getFieldId());
|
|
||||||
ApplicationFormFieldResponseBean responseBean = new ApplicationFormFieldResponseBean();
|
|
||||||
responseBean.setApplicationFormId(formFieldEntity.getApplicationForm().getId());
|
|
||||||
responseBean.setId(formFieldEntity.getId());
|
|
||||||
responseBean.setFieldId(amendmentFormField.getFieldId());
|
|
||||||
responseBean.setCreatedDate(formFieldEntity.getCreatedDate());
|
|
||||||
responseBean.setUpdatedDate(formFieldEntity.getUpdatedDate());
|
|
||||||
responseBean.setFieldValue(documentResponseBeans);
|
|
||||||
|
|
||||||
fileDetails.add(responseBean);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
fileDetails.add(responseBean);
|
||||||
|
}
|
||||||
|
}
|
||||||
response.setFormFields(formFields);
|
response.setFormFields(formFields);
|
||||||
response.setApplicationFormFields(fileDetails);
|
response.setApplicationFormFields(fileDetails);
|
||||||
}
|
}
|
||||||
@@ -731,13 +735,19 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
|
|
||||||
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
|
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
|
||||||
setIfUpdated(existingApplicationAmendment::getNote, existingApplicationAmendment::setNote, updateRequest.getNote());
|
setIfUpdated(existingApplicationAmendment::getNote, existingApplicationAmendment::setNote, updateRequest.getNote());
|
||||||
|
Map<String, AmendmentFormField> amendmentFormFieldMap;
|
||||||
|
Map<String, ApplicationFormFieldEntity> applicationFormFieldMap=null;
|
||||||
|
if(existingApplicationAmendment.getFormFields()!=null && Boolean.FALSE.equals(existingApplicationAmendment.getFormFields().isEmpty())) {
|
||||||
|
amendmentFormFieldMap = Utils
|
||||||
|
.convertJsonStringToList(existingApplicationAmendment.getFormFields(), AmendmentFormField.class)
|
||||||
|
.stream().collect(Collectors.toMap(AmendmentFormField::getFieldId, Function.identity()));
|
||||||
|
applicationFormFieldMap = getApplicationFormFieldList(existingApplicationAmendment, amendmentFormFieldMap.keySet().stream().toList()).stream().collect(Collectors.toMap(ApplicationFormFieldEntity::getFieldId, Function.identity()));
|
||||||
|
|
||||||
Map<String, AmendmentFormField> amendmentFormFieldMap = Utils
|
} else {
|
||||||
.convertJsonStringToList(existingApplicationAmendment.getFormFields(), AmendmentFormField.class)
|
amendmentFormFieldMap = null;
|
||||||
.stream().collect(Collectors.toMap(AmendmentFormField::getFieldId, Function.identity()));
|
}
|
||||||
Map<String, ApplicationFormFieldEntity> applicationFormFieldMap = getApplicationFormFieldList(existingApplicationAmendment, amendmentFormFieldMap.keySet().stream().toList()).stream().collect(Collectors.toMap(ApplicationFormFieldEntity::getFieldId, Function.identity()));
|
|
||||||
|
|
||||||
if(updateRequest.getApplicationFormFields() != null) {
|
if(updateRequest.getApplicationFormFields() != null && amendmentFormFieldMap!=null) {
|
||||||
updateRequest.getApplicationFormFields().stream().forEach(applicationFormFieldRequest->{
|
updateRequest.getApplicationFormFields().stream().forEach(applicationFormFieldRequest->{
|
||||||
AmendmentFormField amendmentFormField = getAmendmentFormField(amendmentFormFieldMap,applicationFormFieldRequest.getFieldId());
|
AmendmentFormField amendmentFormField = getAmendmentFormField(amendmentFormFieldMap,applicationFormFieldRequest.getFieldId());
|
||||||
// ApplicationFormFieldEntity applicationFormFieldEntity = getApplicationFormField(applicationFormFieldMap, applicationFormFieldRequest.getFieldId());
|
// ApplicationFormFieldEntity applicationFormFieldEntity = getApplicationFormField(applicationFormFieldMap, applicationFormFieldRequest.getFieldId());
|
||||||
@@ -1774,5 +1784,87 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
|
|
||||||
return totalDays;
|
return totalDays;
|
||||||
}
|
}
|
||||||
|
public ApplicationAmendmentRequestResponse createSpecialApplicationAmendmentRequest(Long applicationEvaluationId, ApplicationAmendmentSpecialRequest applicationAmendmentRequest) {
|
||||||
|
log.info("Submiting application data for amendment Process with details: {}", applicationEvaluationId);
|
||||||
|
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||||
|
ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils.getClonedEntityForData(applicationEvaluationEntity);
|
||||||
|
ApplicationEntity applicationEntity=applicationDao.validateApplication(applicationEvaluationEntity.getApplicationId());
|
||||||
|
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
|
||||||
|
|
||||||
|
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.ADMISSIBLE.getValue()))) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.INVALID_APPLICATION_STATUS));
|
||||||
|
}
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity();
|
||||||
|
applicationAmendmentRequestEntity.setResponseDays(20l);
|
||||||
|
applicationAmendmentRequestEntity.setEndDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()).plusDays(20));
|
||||||
|
applicationAmendmentRequestEntity.setIsEmail(Boolean.TRUE);
|
||||||
|
applicationAmendmentRequestEntity.setIsNotification(Boolean.FALSE);
|
||||||
|
applicationAmendmentRequestEntity.setStartDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
|
applicationAmendmentRequestEntity.setStatus(ApplicationAmendmentRequestEnum.AWAITING.getValue());
|
||||||
|
// if ( applicationEvaluationEntity.getStartDate() != null && applicationEvaluationEntity.getInitialDays() != null ) {
|
||||||
|
// Long initialDays = applicationEvaluationEntity.getInitialDays();
|
||||||
|
// LocalDateTime startDate = applicationEvaluationEntity.getStartDate();
|
||||||
|
// LocalDateTime nowInUTC = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||||
|
// // Calculate remaining days
|
||||||
|
// Long remainingDays = initialDays - DAYS.between(startDate, nowInUTC);
|
||||||
|
// // Set remaining days in the entity
|
||||||
|
// applicationEvaluationEntity.setRemainingDays(remainingDays);
|
||||||
|
// //Set stop date time in the entity becuase amendment has started
|
||||||
|
// applicationEvaluationEntity.setStopDateTime(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
|
// }
|
||||||
|
applicationAmendmentRequestEntity.setApplicationEvaluationEntity(applicationEvaluationEntity);
|
||||||
|
applicationEvaluationEntity.setStatus(ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
|
||||||
|
applicationEvaluationRepository.save(applicationEvaluationEntity);
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity).newData(applicationEvaluationEntity).build());
|
||||||
|
|
||||||
|
Long applicationId = applicationEvaluationEntity.getApplicationId();
|
||||||
|
Long assignedApplicationId = applicationEvaluationEntity.getAssignedApplicationsEntity().getId();
|
||||||
|
// add here the changing status of assigned application
|
||||||
|
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
||||||
|
AssignedApplicationsEntity oldAssignedApplication = Utils.getClonedEntityForData(assignedApplicationsEntity);
|
||||||
|
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.SOCCORSO.getValue());
|
||||||
|
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAssignedApplication).newData(assignedApplicationsEntity).build());
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal amountAccepted = applicationEntity.getAmountAccepted();
|
||||||
|
if (applicationAmendmentRequest.getAmount() != null && (amountAccepted==null || applicationAmendmentRequest.getAmount().compareTo(amountAccepted) == 0)) {
|
||||||
|
applicationEntity.setAmountAccepted(applicationAmendmentRequest.getAmount());
|
||||||
|
}
|
||||||
|
if(Boolean.FALSE.equals(applicationAmendmentRequest.getPec().equals(applicationEntity.getPecEmail()))){
|
||||||
|
applicationEntity.setPecEmail(applicationAmendmentRequest.getPec());
|
||||||
|
}
|
||||||
|
applicationEvaluationDao.processTechnicalEvaluation(applicationEntity.getId(),applicationEntity,ApplicationStatusForEvaluation.AWAITING_TECHNICAL_EVALUATION,applicationEvaluationEntity);
|
||||||
|
applicationRepository.save(applicationEntity);
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEntity).newData(applicationEntity).build());
|
||||||
|
|
||||||
|
applicationAmendmentRequestEntity.setType(ApplicationAmendmentRequestTypeEnum.SPECIAL.getValue());
|
||||||
|
applicationAmendmentRequestEntity.setApplicationId(applicationId);
|
||||||
|
UserEntity userEntity = userService.validateUser(applicationEvaluationEntity.getUserId());
|
||||||
|
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
|
||||||
|
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(
|
||||||
|
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
|
||||||
|
userEntity.getHub().getId(),false);
|
||||||
|
protocolDao.saveProtocolEntity(protocolEntity);
|
||||||
|
applicationAmendmentRequestEntity.setProtocol(protocolEntity);
|
||||||
|
applicationAmendmentRequestEntity.setAmendmentDocumentType(applicationAmendmentRequest.getAmendmentDocumentType().getValue());
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity, null, VersionActionTypeEnum.INSERT);
|
||||||
|
log.info("Amendment request saved with ID={}", applicationAmendment.getId());
|
||||||
|
|
||||||
|
emailNotificationDao.sendMailforSpecialAmendment(applicationAmendmentRequestEntity,applicationEntity);
|
||||||
|
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||||
|
List<EmailSendResponse> responses = List.of(emailSendResponse);
|
||||||
|
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity,false);
|
||||||
|
|
||||||
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
|
||||||
|
saveEmailSendResponse(emailSendResponse, applicationAmendmentRequestEntity);
|
||||||
|
applicationAmendmentRequestResponse.setEmailSendResponse(responses);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
applicationAmendmentRequestResponse.setEmailSendResponse(Collections.emptyList());
|
||||||
|
}
|
||||||
|
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
|
||||||
|
return applicationAmendmentRequestResponse;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1934,7 +1934,7 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION)){
|
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION)){
|
||||||
log.info("Processing technical evaluation for applicationId: {}", application.getId());
|
log.info("Processing technical evaluation for applicationId: {}", application.getId());
|
||||||
processTechnicalEvaluation(application.getId(), application, newStatus);
|
application.setStatus(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if((newStatus.equals(ApplicationStatusForEvaluation.APPROVED) || newStatus.equals(ApplicationStatusForEvaluation.REJECTED))) {
|
if((newStatus.equals(ApplicationStatusForEvaluation.APPROVED) || newStatus.equals(ApplicationStatusForEvaluation.REJECTED))) {
|
||||||
@@ -2566,24 +2566,20 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private void processTechnicalEvaluation(Long applicationId, ApplicationEntity applicationEntity, ApplicationStatusForEvaluation status){
|
public void processTechnicalEvaluation(Long applicationId, ApplicationEntity applicationEntity, ApplicationStatusForEvaluation status, ApplicationEvaluationEntity evaluationEntity){
|
||||||
log.info("Starting technical evaluation processing for applicationId: {}", applicationId);
|
log.info("Starting process for checking scores for applicationId: {}", applicationId);
|
||||||
Optional<ApplicationEvaluationEntity> evaluationEntityOpt = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationId);
|
|
||||||
if (evaluationEntityOpt.isPresent()){
|
|
||||||
ApplicationEvaluationEntity evaluationEntity = evaluationEntityOpt.get();
|
|
||||||
String criteriaJson = evaluationEntity.getCriteria();
|
String criteriaJson = evaluationEntity.getCriteria();
|
||||||
if (criteriaJson != null){
|
if (criteriaJson != null){
|
||||||
BigDecimal totalScore = calculateTotalScore(evaluationEntity.getCriteria());
|
BigDecimal totalScore = calculateTotalScore(evaluationEntity.getCriteria());
|
||||||
if (totalScore.compareTo(new BigDecimal("40")) > 0) {
|
if (totalScore.compareTo(new BigDecimal("40")) > 0) {
|
||||||
applicationEntity.setStatus(status.getValue());
|
applicationEntity.setStatus(status.getValue());
|
||||||
log.info("Status updated to TECHNICAL_EVALUATION for applicationId: {}", applicationId);
|
log.info("Status updated to AWAITING_TECHNICAL_EVALUATION for applicationId: {}", applicationId);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
log.warn("Insufficient score ({}) for applicationId: {}. Throwing validation exception.", totalScore, applicationId);
|
log.warn("Insufficient score ({}) for applicationId: {}. Throwing validation exception.", totalScore, applicationId);
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.INSUFFICIENT_SCORE_MESSAGE));
|
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.INSUFFICIENT_SCORE_MESSAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal calculateTotalScore(String criteriaJson){
|
public BigDecimal calculateTotalScore(String criteriaJson){
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import com.amazonaws.services.s3.AmazonS3Client;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.*;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
import net.gepafin.tendermanagement.enums.RecipientTypeEnum;
|
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.AttachmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.EmailConfig;
|
import net.gepafin.tendermanagement.model.request.EmailConfig;
|
||||||
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse;
|
import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse;
|
||||||
@@ -17,6 +19,7 @@ import net.gepafin.tendermanagement.service.impl.EmailService;
|
|||||||
import net.gepafin.tendermanagement.service.impl.EmailServiceFactory;
|
import net.gepafin.tendermanagement.service.impl.EmailServiceFactory;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
import net.gepafin.tendermanagement.service.impl.SystemEmailService;
|
import net.gepafin.tendermanagement.service.impl.SystemEmailService;
|
||||||
|
import net.gepafin.tendermanagement.util.S3DocxProcessor;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -25,8 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao.filterByName;
|
import static net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao.filterByName;
|
||||||
|
|
||||||
@@ -80,7 +85,16 @@ public class EmailNotificationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
private void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType, Map<String, String> bodyPlaceholders,
|
@Autowired
|
||||||
|
private AmazonS3Client s3Client;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocumentRepository documentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
|
||||||
|
|
||||||
|
public void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType, Map<String, String> bodyPlaceholders,
|
||||||
List<String> additionalRecipients, Long amendmentId) {
|
List<String> additionalRecipients, Long amendmentId) {
|
||||||
|
|
||||||
HubEntity hubEntity = hubService.valdateHub(applicationEntity.getHubId());
|
HubEntity hubEntity = hubService.valdateHub(applicationEntity.getHubId());
|
||||||
@@ -117,6 +131,34 @@ public class EmailNotificationDao {
|
|||||||
|
|
||||||
Optional<ApplicationEvaluationEntity> applicationEvaluationEntity = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationEntity.getId());
|
Optional<ApplicationEvaluationEntity> applicationEvaluationEntity = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationEntity.getId());
|
||||||
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
|
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendmentRequest=applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
|
||||||
|
List<AttachmentRequest> attachmentRequests =new ArrayList<>();
|
||||||
|
if(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED)) {
|
||||||
|
S3DocxProcessor processor = new S3DocxProcessor(s3Client);
|
||||||
|
List<String> urls=new ArrayList<>();
|
||||||
|
Map<String, String> replacements = Map.of(
|
||||||
|
"{call_name}", applicationEntity.getCall().getName(),
|
||||||
|
"{amount_accepted}", String.valueOf(applicationEntity.getAmountAccepted()),
|
||||||
|
"{pec}", "bandi.gepafin@legalmail.it"
|
||||||
|
);
|
||||||
|
List<DocumentEntity> documentEntities=documentRepository.findBySourceInAndIsDeletedFalse(List.of(applicationAmendmentRequest.getAmendmentDocumentType(),"MODELLO_AUTOCERTIFICAZIONE","MODELLO_PRIVACY"));
|
||||||
|
urls = documentEntities.stream()
|
||||||
|
.map(DocumentEntity::getFilePath) // or getUrl()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Map<String, AttachmentRequest> processedFiles = null;
|
||||||
|
try {
|
||||||
|
processedFiles = processor.processFiles(urls, replacements);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, AttachmentRequest> entry : processedFiles.entrySet()) {
|
||||||
|
AttachmentRequest attachmentRequest = new AttachmentRequest();
|
||||||
|
attachmentRequest.setName(entry.getKey()); // e.g. "path/file1.docx"
|
||||||
|
attachmentRequest.setFile(entry.getValue().getFile()); // updated file content
|
||||||
|
attachmentRequests.add(attachmentRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UserWithCompanyEntity userWithCompany=companyService.getUserWithCompany(userEntity.getId(),company.getId());
|
UserWithCompanyEntity userWithCompany=companyService.getUserWithCompany(userEntity.getId(),company.getId());
|
||||||
String companyEmail = userWithCompany.getEmail();
|
String companyEmail = userWithCompany.getEmail();
|
||||||
@@ -130,17 +172,20 @@ public class EmailNotificationDao {
|
|||||||
}
|
}
|
||||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY,company.getId() ,
|
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY,company.getId() ,
|
||||||
String.valueOf(recipientEmails), userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
String.valueOf(recipientEmails), userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(applicationEntity.getHubId(), subject, body, recipientEmails, emailLogRequest);
|
sendMail(applicationEntity.getHubId(), subject, body, recipientEmails, emailLogRequest);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY, company.getId(),
|
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY, company.getId(),
|
||||||
companyEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
companyEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(applicationEntity.getHubId(), subject, body, List.of(companyEmail), emailLogRequest);
|
sendMail(applicationEntity.getHubId(), subject, body, List.of(companyEmail), emailLogRequest);
|
||||||
}
|
}
|
||||||
if (contactEmail != null && !contactEmail.isEmpty() && !contactEmail.equals(companyEmail)) {
|
if (contactEmail != null && !contactEmail.isEmpty() && !contactEmail.equals(companyEmail)) {
|
||||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY, company.getId(),
|
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY, company.getId(),
|
||||||
contactEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
contactEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(applicationEntity.getHubId(), subject, body, List.of(contactEmail), emailLogRequest);
|
sendMail(applicationEntity.getHubId(), subject, body, List.of(contactEmail), emailLogRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,6 +199,7 @@ public class EmailNotificationDao {
|
|||||||
}
|
}
|
||||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.BENEFICIARY,userEntity.getBeneficiary().getId() ,
|
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.BENEFICIARY,userEntity.getBeneficiary().getId() ,
|
||||||
beneficiaryEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
beneficiaryEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(applicationEntity.getHubId(), subject, body, List.of(beneficiaryEmail), emailLogRequest);
|
sendMail(applicationEntity.getHubId(), subject, body, List.of(beneficiaryEmail), emailLogRequest);
|
||||||
}
|
}
|
||||||
if(userEntity.getHub().getEmail() != null){
|
if(userEntity.getHub().getEmail() != null){
|
||||||
@@ -164,6 +210,7 @@ public class EmailNotificationDao {
|
|||||||
if (!hubEmail.isEmpty()) {
|
if (!hubEmail.isEmpty()) {
|
||||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.PROPERTIES,null,
|
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.PROPERTIES,null,
|
||||||
hubEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
hubEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(applicationEntity.getHubId(), subject, body, List.of(hubEmail), emailLogRequest);
|
sendMail(applicationEntity.getHubId(), subject, body, List.of(hubEmail), emailLogRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,6 +220,7 @@ public class EmailNotificationDao {
|
|||||||
rinaldoEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
rinaldoEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
|
||||||
//SMTP
|
//SMTP
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(null, subject, body, List.of(rinaldoEmail), emailLogRequest);
|
sendMail(null, subject, body, List.of(rinaldoEmail), emailLogRequest);
|
||||||
}
|
}
|
||||||
if (applicationEvaluationEntity.isPresent()) {
|
if (applicationEvaluationEntity.isPresent()) {
|
||||||
@@ -182,6 +230,7 @@ public class EmailNotificationDao {
|
|||||||
if (preInstructorEmail != null && !preInstructorEmail.isEmpty()) {
|
if (preInstructorEmail != null && !preInstructorEmail.isEmpty()) {
|
||||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.INSTRUCTOR, instructorUser.getId(),
|
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.INSTRUCTOR, instructorUser.getId(),
|
||||||
preInstructorEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
preInstructorEmail, userEntity.getId(), applicationEntity.getId(), amendmentId, applicationEntity.getCall().getId());
|
||||||
|
emailLogRequest.setAttachments(attachmentRequests);
|
||||||
sendMail(applicationEntity.getHubId(), subject, body, List.of(preInstructorEmail), emailLogRequest);
|
sendMail(applicationEntity.getHubId(), subject, body, List.of(preInstructorEmail), emailLogRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,4 +439,10 @@ public class EmailNotificationDao {
|
|||||||
|
|
||||||
return bodyPlaceholders;
|
return bodyPlaceholders;
|
||||||
}
|
}
|
||||||
|
public void sendMailforSpecialAmendment(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity,ApplicationEntity applicationEntity) {
|
||||||
|
|
||||||
|
Map<String, String> bodyPlaceholders = prepareEmailPlaceholders(applicationEntity, applicationAmendmentRequestEntity);
|
||||||
|
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED, bodyPlaceholders, null,
|
||||||
|
applicationAmendmentRequestEntity.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ public class EvaluationFormDao {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public EvaluationFormResponseBean getEvaluationFormByCallId(CallEntity callEntity) {
|
public EvaluationFormResponseBean getEvaluationFormByCallId(CallEntity callEntity) {
|
||||||
if (callEntity == null) {
|
if (callEntity == null) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
||||||
|
|||||||
@@ -68,4 +68,10 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
|
|||||||
@Column(name = "EXTENSION_DATE")
|
@Column(name = "EXTENSION_DATE")
|
||||||
private LocalDateTime extensionDate;
|
private LocalDateTime extensionDate;
|
||||||
|
|
||||||
|
@Column(name = "TYPE")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(name = "AMENDMENT_DOCUMENT_TYPE")
|
||||||
|
private String amendmentDocumentType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
|
|||||||
PASSWORD_RESET("PASSWORD_RESET"),
|
PASSWORD_RESET("PASSWORD_RESET"),
|
||||||
INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION"),
|
INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION"),
|
||||||
APPLICATION_SUBMISSION_FAILURE_NOTIFICATION("APPLICATION_SUBMISSION_FAILURE_NOTIFICATION"),
|
APPLICATION_SUBMISSION_FAILURE_NOTIFICATION("APPLICATION_SUBMISSION_FAILURE_NOTIFICATION"),
|
||||||
INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE");
|
INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE"),
|
||||||
|
SPECIAL_APPLICATION_AMENDMENT_REQUESTED("SPECIAL_APPLICATION_AMENDMENT_REQUESTED");
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
SystemEmailTemplatesEntityTypeEnum(String value) {
|
SystemEmailTemplatesEntityTypeEnum(String value) {
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
public enum AmendmentDocumentTypeEnum {
|
||||||
|
|
||||||
|
NESSUNA_GARANZIA("NESSUNA_GARANZIA"),
|
||||||
|
|
||||||
|
GARANZIA_MCC("GARANZIA_MCC"),
|
||||||
|
|
||||||
|
MCC_START_UP("MCC_START_UP"),
|
||||||
|
|
||||||
|
ALTRE_GARANZIE("ALTRE_GARANZIE");
|
||||||
|
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
AmendmentDocumentTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
public enum ApplicationAmendmentRequestTypeEnum {
|
||||||
|
|
||||||
|
REGULAR ("REGULAR"),
|
||||||
|
|
||||||
|
SPECIAL("SPECIAL");
|
||||||
|
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
ApplicationAmendmentRequestTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ public enum ApplicationStatusForEvaluation {
|
|||||||
REJECTED("REJECTED"),
|
REJECTED("REJECTED"),
|
||||||
ADMISSIBLE("ADMISSIBLE"),
|
ADMISSIBLE("ADMISSIBLE"),
|
||||||
TECHNICAL_EVALUATION("TECHNICAL_EVALUATION"),
|
TECHNICAL_EVALUATION("TECHNICAL_EVALUATION"),
|
||||||
|
AWAITING_TECHNICAL_EVALUATION("AWAITING_TECHNICAL_EVALUATION"),
|
||||||
TECHNICAL_EVALUATION_REJECTED("TECHNICAL_EVALUATION_REJECTED");
|
TECHNICAL_EVALUATION_REJECTED("TECHNICAL_EVALUATION_REJECTED");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ public enum ApplicationStatusTypeEnum {
|
|||||||
NDG("NDG"),
|
NDG("NDG"),
|
||||||
ADMISSIBLE("ADMISSIBLE"),
|
ADMISSIBLE("ADMISSIBLE"),
|
||||||
TECHNICAL_EVALUATION("TECHNICAL_EVALUATION"),
|
TECHNICAL_EVALUATION("TECHNICAL_EVALUATION"),
|
||||||
TECHNICAL_EVALUATION_REJECTED("TECHNICAL_EVALUATION_REJECTED");
|
TECHNICAL_EVALUATION_REJECTED("TECHNICAL_EVALUATION_REJECTED"),
|
||||||
|
AWAITING_TECHNICAL_EVALUATION("AWAITING_TECHNICAL_EVALUATION") ;
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public enum EmailScenarioTypeEnum {
|
|||||||
PASSWORD_RESET_REQUEST("PASSWORD_RESET_REQUEST"),
|
PASSWORD_RESET_REQUEST("PASSWORD_RESET_REQUEST"),
|
||||||
APPLICATION_REJECTED("APPLICATION_REJECTED"),
|
APPLICATION_REJECTED("APPLICATION_REJECTED"),
|
||||||
APPLICATION_SUBMISSION_FAILURE("APPLICATION_SUBMISSION_FAILURE"),
|
APPLICATION_SUBMISSION_FAILURE("APPLICATION_SUBMISSION_FAILURE"),
|
||||||
APPLICATION_TECHNICAL_EVALUATION_REJECTED("APPLICATION_TECHNICAL_EVALUATION_REJECTED");
|
APPLICATION_TECHNICAL_EVALUATION_REJECTED("APPLICATION_TECHNICAL_EVALUATION_REJECTED"),
|
||||||
|
SPECIAL_APPLICATION_AMENDMENT_REQUESTED("SPECIAL_APPLICATION_AMENDMENT_REQUESTED");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ public enum UserActionContextEnum {
|
|||||||
UPDATE_CALL_END_DATE_AND_TIME("UPDATE_CALL_END_DATE_AND_TIME"),
|
UPDATE_CALL_END_DATE_AND_TIME("UPDATE_CALL_END_DATE_AND_TIME"),
|
||||||
UPDATE_EXPIRED_CALL("UPDATE_EXPIRED_CALL"),
|
UPDATE_EXPIRED_CALL("UPDATE_EXPIRED_CALL"),
|
||||||
RESEND_EMAIL("RESEND_EMAIL"),
|
RESEND_EMAIL("RESEND_EMAIL"),
|
||||||
SEND_REMINDER_EMAIL("SEND_REMINDER_EMAIL");
|
SEND_REMINDER_EMAIL("SEND_REMINDER_EMAIL"),
|
||||||
|
CREATE_SPECIAL_AMENDMENT("CREATE_SPECIAL_AMENDMENT");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.AmendmentDocumentTypeEnum;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationAmendmentSpecialRequest {
|
||||||
|
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
private AmendmentDocumentTypeEnum amendmentDocumentType;
|
||||||
|
|
||||||
|
private String pec;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AttachmentRequest {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String file;
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import net.gepafin.tendermanagement.enums.EmailEntityTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.RecipientTypeEnum;
|
import net.gepafin.tendermanagement.enums.RecipientTypeEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class EmailLogRequest {
|
public class EmailLogRequest {
|
||||||
|
|
||||||
@@ -39,4 +41,6 @@ public class EmailLogRequest {
|
|||||||
|
|
||||||
private Long userActionId;
|
private Long userActionId;
|
||||||
|
|
||||||
|
private List<AttachmentRequest> attachments;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ public class PecEmailRequest {
|
|||||||
private String body;
|
private String body;
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
|
private List<AttachmentRequest> attachments;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,7 @@ public interface DocumentRepository extends JpaRepository<DocumentEntity, Long>
|
|||||||
List<DocumentEntity> findAllByIdInAndIsDeletedFalse(Set<Long> documentIds);
|
List<DocumentEntity> findAllByIdInAndIsDeletedFalse(Set<Long> documentIds);
|
||||||
|
|
||||||
List<DocumentEntity> findBySourceIdInAndSourceAndIsDeletedFalse(Set<Long> sourceId, String type);
|
List<DocumentEntity> findBySourceIdInAndSourceAndIsDeletedFalse(Set<Long> sourceId, String type);
|
||||||
|
|
||||||
|
List<DocumentEntity> findBySourceInAndIsDeletedFalse(List<String> type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentPaginationRequestBean;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -28,4 +25,6 @@ public interface ApplicationAmendmentRequestService {
|
|||||||
|
|
||||||
EmailReminderResponse sendReminderEmail(HttpServletRequest request, Long amendmentId);
|
EmailReminderResponse sendReminderEmail(HttpServletRequest request, Long amendmentId);
|
||||||
PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean);
|
PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean);
|
||||||
|
public ApplicationAmendmentRequestResponse createSpecialApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentSpecialRequest applicationAmendmentRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
|||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentPaginationRequestBean;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||||
@@ -169,4 +166,10 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
|||||||
|
|
||||||
return applicationAmendmentRequestDao.getApplicationAmendmentByPaginationByView(userId,amendmentPaginationRequestBean);
|
return applicationAmendmentRequestDao.getApplicationAmendmentByPaginationByView(userId,amendmentPaginationRequestBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ApplicationAmendmentRequestResponse createSpecialApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId, ApplicationAmendmentSpecialRequest applicationAmendmentRequest) {
|
||||||
|
return applicationAmendmentRequestDao.createSpecialApplicationAmendmentRequest(applicationEvaluationId, applicationAmendmentRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -63,6 +64,7 @@ public class PecEmailService implements EmailService {
|
|||||||
emailRequest.setBody(body);
|
emailRequest.setBody(body);
|
||||||
emailRequest.setUsername(emailConfig.getUsername());
|
emailRequest.setUsername(emailConfig.getUsername());
|
||||||
emailRequest.setPassword(emailConfig.getPassword());
|
emailRequest.setPassword(emailConfig.getPassword());
|
||||||
|
emailRequest.setAttachments(emailLogRequest.getAttachments());
|
||||||
emailRequest.setRecipient(recipientEmails);
|
emailRequest.setRecipient(recipientEmails);
|
||||||
String url=emailConfig.getUrl()+ GepafinConstant.PEC_SERVICE_SEND_MAIL;
|
String url=emailConfig.getUrl()+ GepafinConstant.PEC_SERVICE_SEND_MAIL;
|
||||||
String authToken = emailConfig.getAuthToken();
|
String authToken = emailConfig.getAuthToken();
|
||||||
@@ -88,7 +90,7 @@ public class PecEmailService implements EmailService {
|
|||||||
emailLogRequest.setErrorMessage(errorMsg);
|
emailLogRequest.setErrorMessage(errorMsg);
|
||||||
sendNotificationOnFailure(emailLogRequest.getUserId(),emailLogRequest.getEmailType());
|
sendNotificationOnFailure(emailLogRequest.getUserId(),emailLogRequest.getEmailType());
|
||||||
|
|
||||||
if (EmailScenarioTypeEnum.APPLICATION_SUBMITTED.equals(emailLogRequest.getEmailType())) {
|
if (EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED.equals(emailLogRequest.getEmailType())) {
|
||||||
applicationDao.sendApplicationSubmissionFailureEmail(emailLogRequest);
|
applicationDao.sendApplicationSubmissionFailureEmail(emailLogRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +100,7 @@ public class PecEmailService implements EmailService {
|
|||||||
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
||||||
emailLogRequest.setErrorMessage(e.getMessage());
|
emailLogRequest.setErrorMessage(e.getMessage());
|
||||||
sendNotificationOnFailure(emailLogRequest.getUserId(),emailLogRequest.getEmailType());
|
sendNotificationOnFailure(emailLogRequest.getUserId(),emailLogRequest.getEmailType());
|
||||||
if (EmailScenarioTypeEnum.APPLICATION_SUBMITTED.equals(emailLogRequest.getEmailType())) {
|
if (EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED.equals(emailLogRequest.getEmailType())) {
|
||||||
applicationDao.sendApplicationSubmissionFailureEmail(emailLogRequest);
|
applicationDao.sendApplicationSubmissionFailureEmail(emailLogRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package net.gepafin.tendermanagement.util;
|
||||||
|
|
||||||
|
import com.amazonaws.services.s3.AmazonS3;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3URI;
|
||||||
|
import com.amazonaws.services.s3.model.S3Object;
|
||||||
|
import net.gepafin.tendermanagement.model.request.AttachmentRequest;
|
||||||
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class S3DocxProcessor {
|
||||||
|
|
||||||
|
private final AmazonS3 s3Client;
|
||||||
|
|
||||||
|
public static final Logger log = LoggerFactory.getLogger(S3DocxProcessor.class);
|
||||||
|
|
||||||
|
|
||||||
|
public S3DocxProcessor(AmazonS3 s3Client) {
|
||||||
|
this.s3Client = s3Client;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches DOCX files from S3, replaces placeholders, and returns updated files
|
||||||
|
* as AttachmentRequest objects (ready for PEC API).
|
||||||
|
*
|
||||||
|
* @param s3Urls List of S3 file URLs
|
||||||
|
* @param replacements Map of placeholder -> value
|
||||||
|
* @return Map of original file name -> AttachmentRequest
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public Map<String, AttachmentRequest> processFiles(List<String> s3Urls,
|
||||||
|
Map<String, String> replacements) throws IOException {
|
||||||
|
Map<String, AttachmentRequest> processedFiles = new HashMap<>();
|
||||||
|
|
||||||
|
for (String s3Url : s3Urls) {
|
||||||
|
// Extract bucket & key from URL
|
||||||
|
AmazonS3URI s3Uri = new AmazonS3URI(s3Url);
|
||||||
|
String bucket = s3Uri.getBucket();
|
||||||
|
String key = s3Uri.getKey();
|
||||||
|
try (S3Object s3Object = s3Client.getObject(bucket, key);
|
||||||
|
InputStream originalStream = new BufferedInputStream(s3Object.getObjectContent())) {
|
||||||
|
byte[] updatedBytes=null;
|
||||||
|
if (isDocxFile(originalStream)) {
|
||||||
|
log.warn("Skipping non-DOCX file from S3: bucket={}, key={}", bucket, key);
|
||||||
|
updatedBytes = replacePlaceholders(originalStream, replacements);
|
||||||
|
}else {
|
||||||
|
// non-DOCX → just copy raw stream
|
||||||
|
updatedBytes = originalStream.readAllBytes();
|
||||||
|
log.info("Skipped placeholder replacement, copied file as-is: {}", key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to base64
|
||||||
|
String base64 = Base64.getEncoder().encodeToString(updatedBytes);
|
||||||
|
String fileString = "data:application/octet-stream;base64," + base64;
|
||||||
|
|
||||||
|
// create attachment request
|
||||||
|
AttachmentRequest attachment = new AttachmentRequest();
|
||||||
|
attachment.setName(extractFileName(key));
|
||||||
|
attachment.setFile(fileString);
|
||||||
|
|
||||||
|
processedFiles.put(key, attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return processedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private byte[] replacePlaceholders(InputStream docInputStream,
|
||||||
|
Map<String, String> replacements) throws IOException {
|
||||||
|
try (XWPFDocument document = new XWPFDocument(docInputStream);
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
|
// replace in body paragraphs
|
||||||
|
replaceInParagraphs(document.getParagraphs(), replacements);
|
||||||
|
|
||||||
|
// replace inside tables
|
||||||
|
for (XWPFTable table : document.getTables()) {
|
||||||
|
for (XWPFTableRow row : table.getRows()) {
|
||||||
|
for (XWPFTableCell cell : row.getTableCells()) {
|
||||||
|
replaceInParagraphs(cell.getParagraphs(), replacements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.write(out);
|
||||||
|
return out.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void replaceInParagraphs(List<XWPFParagraph> paragraphs, Map<String, String> replacements) {
|
||||||
|
for (XWPFParagraph paragraph : paragraphs) {
|
||||||
|
String paragraphText = paragraph.getText();
|
||||||
|
|
||||||
|
if (paragraphText != null && !paragraphText.isEmpty()) {
|
||||||
|
// Apply all replacements
|
||||||
|
for (Map.Entry<String, String> entry : replacements.entrySet()) {
|
||||||
|
paragraphText = paragraphText.replace(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove old runs
|
||||||
|
int runCount = paragraph.getRuns().size();
|
||||||
|
for (int i = runCount - 1; i >= 0; i--) {
|
||||||
|
paragraph.removeRun(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add one new run with replaced text
|
||||||
|
XWPFRun newRun = paragraph.createRun();
|
||||||
|
newRun.setText(paragraphText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String extractFileName(String key) {
|
||||||
|
int lastSlash = key.lastIndexOf('/');
|
||||||
|
if (lastSlash >= 0 && lastSlash < key.length() - 1) {
|
||||||
|
return key.substring(lastSlash + 1);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDocxFile(InputStream inputStream) throws IOException {
|
||||||
|
inputStream.mark(4);
|
||||||
|
byte[] header = new byte[2];
|
||||||
|
int read = inputStream.read(header, 0, 2);
|
||||||
|
inputStream.reset();
|
||||||
|
|
||||||
|
// DOCX = ZIP = should start with PK (0x50 0x4B)
|
||||||
|
return read == 2 && header[0] == 0x50 && header[1] == 0x4B;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -161,19 +161,22 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> convertJsonStringToList(String jsonString, Class<T> clazz) {
|
public static <T> List<T> convertJsonStringToList(String jsonString, Class<T> clazz) {
|
||||||
try {
|
if(jsonString!=null) {
|
||||||
TypeReference<List<T>> typeRef = new TypeReference<List<T>>() {
|
try {
|
||||||
@Override
|
TypeReference<List<T>> typeRef = new TypeReference<List<T>>() {
|
||||||
public Type getType() {
|
@Override
|
||||||
return TypeFactory.defaultInstance().constructCollectionType(List.class, clazz);
|
public Type getType() {
|
||||||
}
|
return TypeFactory.defaultInstance().constructCollectionType(List.class, clazz);
|
||||||
};
|
}
|
||||||
return mapper.readValue(jsonString, typeRef);
|
};
|
||||||
} catch (Exception e) {
|
return mapper.readValue(jsonString, typeRef);
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
// Handle the exception appropriately (e.g., throw a custom exception)
|
e.printStackTrace();
|
||||||
return null;
|
// Handle the exception appropriately (e.g., throw a custom exception)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String convertMapIntoJsonString(Map<String, Object> map) {
|
public static String convertMapIntoJsonString(Map<String, Object> map) {
|
||||||
|
|||||||
@@ -199,5 +199,18 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@PostMapping(value = "/user/{userId}/pagination", produces = { "application/json" })
|
@PostMapping(value = "/user/{userId}/pagination", produces = { "application/json" })
|
||||||
ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
||||||
@RequestBody ApplicationAmendmentPaginationRequestBean userActionPaginationRequest);
|
@RequestBody ApplicationAmendmentPaginationRequestBean userActionPaginationRequest);
|
||||||
|
@Operation(summary = "Api to create special Amendment",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PostMapping(value = "/special", produces = "application/json")
|
||||||
|
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createSpecialApplicationAmendmentRequest(HttpServletRequest request,
|
||||||
|
@Parameter(description = "Application Evaluation Id", required = true) @RequestParam Long applicationEvaluationId,
|
||||||
|
@Valid @RequestBody ApplicationAmendmentSpecialRequest applicationAmendmentRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,4 +200,15 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createSpecialApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId, ApplicationAmendmentSpecialRequest applicationAmendmentRequest) {
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT)
|
||||||
|
.actionContext(UserActionContextEnum.CREATE_SPECIAL_AMENDMENT).build());
|
||||||
|
|
||||||
|
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.createSpecialApplicationAmendmentRequest(request,applicationEvaluationId,applicationAmendmentRequest);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.CREATE_APPLICATION_DATA_FOR_AMENDMENT_MSG)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3015,4 +3015,16 @@
|
|||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="29-09-2025_RK_155236" author="Rajesh Khore">
|
||||||
|
<addColumn tableName="application_amendment_request">
|
||||||
|
<column name="type" defaultValue="REGULAR" type="VARCHAR(255)"></column>
|
||||||
|
<column name="amendment_document_type" type="VARCHAR(255)"></column>
|
||||||
|
</addColumn>
|
||||||
|
<sqlFile dbms="postgresql" path="db/dump/insert_system_email_template_for_special_amendment_28-09-2025.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="30-09-2025_RK_13352" author="Rajesh Khore">
|
||||||
|
<sqlFile dbms="postgresql" path="db/dump/insert_document_for_special_amendment.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
INSERT INTO gepafin_schema."document"
|
||||||
|
(file_name, file_path, source_id, "type", created_date, updated_date, is_deleted, "source", document_attachment_id, uploaded_by)
|
||||||
|
VALUES('nessuna_garanzia.docx', 'https://mementoresources.s3.amazonaws.com/gepafin/staging/template/nessuna_garanzia.docx', NULL, 'DOCUMENT', '2024-10-12 16:09:08.262', '2024-10-12 16:09:08.262', false, 'NESSUNA_GARANZIA', NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO gepafin_schema."document"
|
||||||
|
(file_name, file_path, source_id, "type", created_date, updated_date, is_deleted, "source", document_attachment_id, uploaded_by)
|
||||||
|
VALUES('garanzia_MCC.docx', 'https://mementoresources.s3.amazonaws.com/gepafin/staging/template/garanzia_MCC.docx', NULL, 'DOCUMENT', '2024-10-12 16:09:08.262', '2024-10-12 16:09:08.262', false, 'GARANZIA_MCC', NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO gepafin_schema."document"
|
||||||
|
(file_name, file_path, source_id, "type", created_date, updated_date, is_deleted, "source", document_attachment_id, uploaded_by)
|
||||||
|
VALUES('garanzia_MCC_per_START_UP.docx', 'https://mementoresources.s3.amazonaws.com/gepafin/staging/template/garanzia_MCC_per_START_UP.docx', NULL, 'DOCUMENT', '2024-10-12 16:09:08.262', '2024-10-12 16:09:08.262', false, 'MCC_START_UP', NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO gepafin_schema."document"
|
||||||
|
(file_name, file_path, source_id, "type", created_date, updated_date, is_deleted, "source", document_attachment_id, uploaded_by)
|
||||||
|
VALUES('altre_garanzie__fideiussione.docx', 'https://mementoresources.s3.amazonaws.com/gepafin/staging/template/altre_garanzie__fideiussione.docx', NULL, 'DOCUMENT', '2024-10-12 16:09:08.262', '2024-10-12 16:09:08.262', false, 'ALTRE_GARANZIE', NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO gepafin_schema."document"
|
||||||
|
(file_name, file_path, source_id, "type", created_date, updated_date, is_deleted, "source", document_attachment_id, uploaded_by)
|
||||||
|
VALUES('Modello_privacy_-_agg.to_05092024.pdf', 'https://mementoresources.s3.amazonaws.com/gepafin/staging/template/Modello_privacy_-_agg.to_05092024.pdf', NULL, 'DOCUMENT', '2024-10-12 16:09:08.262', '2024-10-12 16:09:08.262', false, 'MODELLO_PRIVACY', NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO gepafin_schema."document"
|
||||||
|
(file_name, file_path, source_id, "type", created_date, updated_date, is_deleted, "source", document_attachment_id, uploaded_by)
|
||||||
|
VALUES('Modello_SP1_Autocertificazione.docx', 'https://mementoresources.s3.amazonaws.com/gepafin/staging/template/Modello_SP1_Autocertificazione.docx', NULL, 'DOCUMENT', '2024-10-12 16:09:08.262', '2024-10-12 16:09:08.262', false, 'MODELLO_AUTOCERTIFICAZIONE', NULL, NULL);
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
INSERT INTO gepafin_schema.system_email_template
|
||||||
|
( template_name, "type", html_content, subject, "json", "system", is_deleted, created_date, updated_date, email_scenario, hub_id)
|
||||||
|
VALUES( 'Special Amendment Creation Email', 'SPECIAL_APPLICATION_AMENDMENT_REQUESTED', '<html>
|
||||||
|
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
|
||||||
|
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||||
|
<p>Buongiorno, vi invitiamo a prendere visione del documento allegato con cui vi informiamo dell avvenuta delibera a valere sull Avviso in oggetto. </p>
|
||||||
|
<p>Distinti Saluti,</p>
|
||||||
|
<p><strong>{{email_signature}}</strong></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>', 'Comunicazione esito valutazione tecnica ed economico-finanziaria– Avviso {{call_name}} ', NULL, true, false, '2025-09-29 20:00:00.000', '2025-09-29 20:00:00.000', 'SPECIAL_APPLICATION_AMENDMENT_REQUESTED', NULL);
|
||||||
Reference in New Issue
Block a user