Resolved conflicts of PR GEPAFINBE-6139 (Reviewed Evaluation Process)

This commit is contained in:
rajesh
2025-10-13 21:50:26 +05:30
parent f3d297309c
commit c5cc2988ca
42 changed files with 563 additions and 151 deletions

View File

@@ -1,5 +1,8 @@
package net.gepafin.tendermanagement.constants; package net.gepafin.tendermanagement.constants;
import java.util.Arrays;
import java.util.List;
public class GepafinConstant { public class GepafinConstant {
public static final String USER_CREATED_SUCCESS_MSG = "user.created.success"; public static final String USER_CREATED_SUCCESS_MSG = "user.created.success";
@@ -614,6 +617,11 @@ public class GepafinConstant {
" </div>\n" + " </div>\n" +
" </body>\n" + " </body>\n" +
"</html>"; "</html>";
public static final String UPDATE_APPLICATION_TECHNICAL_EVALUATION_REJECTED_MSG = "application.technical.evaluation.rejected.success";
public static final String SUBJECT = "subject";
public static final List<String> MANUAL_EMAIL_KEYS = Arrays.asList(SUBJECT, MESSAGE);
public static final String INVALID_EMAIL_JSON = "invalid.email.json";
} }

View File

@@ -34,6 +34,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; 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 org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -149,6 +150,9 @@ public class ApplicationAmendmentRequestDao {
@Autowired @Autowired
private EmailDao emailDao; private EmailDao emailDao;
@Autowired
private DocumentDao documentDao;
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);
@@ -302,10 +306,10 @@ public class ApplicationAmendmentRequestDao {
return filteredList; return filteredList;
} }
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(Long applicationEvaluationId, ApplicationAmendmentRequest applicationAmendmentRequest) { public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(Long applicationEvaluationId, List<MultipartFile> files, ApplicationAmendmentRequest applicationAmendmentRequest,Long userId) {
log.info("Submiting application data for amendment Process with details: {}", applicationEvaluationId); log.info("Submiting application data for amendment Process with details: {}", applicationEvaluationId);
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest, applicationEvaluationId); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest, applicationEvaluationId,files, userId);
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity,false); ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity,false);
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse); log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) { if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) {
@@ -323,7 +327,7 @@ public class ApplicationAmendmentRequestDao {
return applicationAmendmentRequestResponse; return applicationAmendmentRequestResponse;
} }
public ApplicationAmendmentRequestEntity createApplicationAmendmentRequestEntity(ApplicationAmendmentRequest applicationAmendmentRequest,Long applicationEvaluationId) { public ApplicationAmendmentRequestEntity createApplicationAmendmentRequestEntity(ApplicationAmendmentRequest applicationAmendmentRequest,Long applicationEvaluationId,List<MultipartFile> files,Long userId) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity(); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity();
applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote()); applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote());
applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays()); applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays());
@@ -389,7 +393,15 @@ public class ApplicationAmendmentRequestDao {
applicationAmendmentRequestEntity.setProtocol(protocolEntity); applicationAmendmentRequestEntity.setProtocol(protocolEntity);
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity, null, VersionActionTypeEnum.INSERT); ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity, null, VersionActionTypeEnum.INSERT);
log.info("Amendment request saved with ID={}", applicationAmendment.getId()); log.info("Amendment request saved with ID={}", applicationAmendment.getId());
List<DocumentResponseBean> documentResponseBeans= uploadInitialDocument(userId,files,applicationAmendment);
List<Long> initialDocumentIds = documentResponseBeans.stream()
.map(DocumentResponseBean::getId)
.collect(Collectors.toList());
String initialDocumentId = initialDocumentIds.stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
applicationAmendment.setAmendmentInitialDocument(initialDocumentId);
applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendment, null, VersionActionTypeEnum.UPDATE);
String evaluationStatusType = applicationEvaluationEntity.getStatus(); String evaluationStatusType = applicationEvaluationEntity.getStatus();
if (Boolean.FALSE.equals(evaluationStatusType.equals((ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue())))){ if (Boolean.FALSE.equals(evaluationStatusType.equals((ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue())))){
// applicationEvaluationEntity.setStatus(ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue()); // applicationEvaluationEntity.setStatus(ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
@@ -473,8 +485,8 @@ public class ApplicationAmendmentRequestDao {
// List<AmendmentDetailsResponseBean> amendmentDetailsList = // List<AmendmentDetailsResponseBean> amendmentDetailsList =
// Utils.convertJsonStringToList(applicationAmendmentRequestEntity.getAmendmentDocument(), // Utils.convertJsonStringToList(applicationAmendmentRequestEntity.getAmendmentDocument(),
// AmendmentDetailsResponseBean.class); // AmendmentDetailsResponseBean.class);
AmendmentDetailsResponseBean amendmentDetails = Utils.convertStringToObject(applicationAmendmentRequestEntity.getAmendmentDocument() ,AmendmentDetailsResponseBean.class); AmendmentDetailsResponseBean amendmentDetails = Utils.convertStringToObject(applicationAmendmentRequestEntity.getAmendmentDocument(), AmendmentDetailsResponseBean.class);
if(amendmentDetails!=null) { if (amendmentDetails != null) {
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>(); List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
if (amendmentDetails.getAmendmentDocuments() != null) { if (amendmentDetails.getAmendmentDocuments() != null) {
// Extract the comma-separated document IDs as a string // Extract the comma-separated document IDs as a string
@@ -506,12 +518,32 @@ public class ApplicationAmendmentRequestDao {
} }
response.setAmendmentDocuments(documentResponseBeans); response.setAmendmentDocuments(documentResponseBeans);
} }
} }
List<DocumentResponseBean> initialDocumentBeans = new ArrayList<>();
String initialDocuments = applicationAmendmentRequestEntity.getAmendmentInitialDocument();
if (initialDocuments != null && !initialDocuments.trim().isEmpty()) {
// Split the comma-separated values and process them
List<String> documentIds = Arrays.stream(initialDocuments.split(","))
.map(String::trim)
.filter(id -> !id.isEmpty())
.collect(Collectors.toList());
initialDocumentBeans.addAll(
documentIds.stream()
.map(id -> {
try {
return createDocumentResponseBean(id); // Convert to Long
} catch (NumberFormatException e) {
// Handle invalid document IDs gracefully
return null;
}
})
.filter(Objects::nonNull) // Skip null responses
.collect(Collectors.toList())
);
}
response.setAmendmentInitialDocuments(initialDocumentBeans);
processFormFields(amendmentFormFields, fieldIdToLabelMap, formFieldEntityMap, response); processFormFields(amendmentFormFields, fieldIdToLabelMap, formFieldEntityMap, response);
return response; return response;
@@ -609,23 +641,7 @@ public class ApplicationAmendmentRequestDao {
createFormField(formFields, fieldIdToLabelMap, amendmentFormField); createFormField(formFields, fieldIdToLabelMap, amendmentFormField);
// Create document responses // Create document responses
List<Long> documentIds = extractIds(amendmentFormField.getFieldValue()); List<DocumentResponseBean> documentResponseBeans = getDocumentResponseBean(amendmentFormField.getFieldValue());
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();
// Map to application form field response bean // Map to application form field response bean
ApplicationFormFieldEntity formFieldEntity = formFieldEntityMap.get(amendmentFormField.getFieldId()); ApplicationFormFieldEntity formFieldEntity = formFieldEntityMap.get(amendmentFormField.getFieldId());
@@ -644,6 +660,27 @@ public class ApplicationAmendmentRequestDao {
response.setApplicationFormFields(fileDetails); response.setApplicationFormFields(fileDetails);
} }
private List<DocumentResponseBean> getDocumentResponseBean(String documentId) {
List<Long> documentIds = extractIds(documentId);
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();
return documentResponseBeans;
}
private String buildBeneficiaryName(UserEntity userEntity) { private String buildBeneficiaryName(UserEntity userEntity) {
if (userEntity.getBeneficiary() == null) { if (userEntity.getBeneficiary() == null) {
return ""; return "";
@@ -1878,5 +1915,10 @@ public class ApplicationAmendmentRequestDao {
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse); log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
return applicationAmendmentRequestResponse; return applicationAmendmentRequestResponse;
} }
public List<DocumentResponseBean> uploadInitialDocument(Long userId,List<MultipartFile> files,ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){
if(files!=null) {
return documentDao.uploadFiles(userId, files, applicationAmendmentRequestEntity.getId(), DocumentSourceTypeEnum.AMENDMENT, DocumentTypeEnum.DOCUMENT);
}
return new ArrayList<>();
}
} }

View File

@@ -1,5 +1,6 @@
package net.gepafin.tendermanagement.dao; package net.gepafin.tendermanagement.dao;
import com.amazonaws.services.dynamodbv2.xspec.L;
import com.amazonaws.services.dynamodbv2.xspec.S; import com.amazonaws.services.dynamodbv2.xspec.S;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@@ -131,6 +132,9 @@ public class ApplicationDao {
@Autowired @Autowired
private AssignedApplicationsRepository assignedApplicationsRepository; private AssignedApplicationsRepository assignedApplicationsRepository;
@Autowired
private CommunicationRepository communicationRepository;
// @Value("${default_System_Receiver_Email}") // @Value("${default_System_Receiver_Email}")
// private String defaultSystemReceiverEmail; // private String defaultSystemReceiverEmail;
@@ -1372,7 +1376,7 @@ public class ApplicationDao {
ApplicationSignedDocumentEntity oldApplicationSignedDocument = Utils.getClonedEntityForData(applicationSignedDocumentEntity); ApplicationSignedDocumentEntity oldApplicationSignedDocument = Utils.getClonedEntityForData(applicationSignedDocumentEntity);
String oldS3Path = applicationSignedDocumentEntity.getFilePath(); String oldS3Path = applicationSignedDocumentEntity.getFilePath();
log.debug("Old S3 path: {} ", oldS3Path); log.debug("Old S3 path: {} ", oldS3Path);
String newS3Path = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.DELETED_USER_SIGNED_DOCUMENT,applicationSignedDocumentEntity.getApplication().getCall().getId(),applicationSignedDocumentEntity.getApplication().getId(),0L); String newS3Path = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.DELETED_USER_SIGNED_DOCUMENT,applicationSignedDocumentEntity.getApplication().getCall().getId(),applicationSignedDocumentEntity.getApplication().getId(),0L,0L);
log.debug("Generated new S3 path for deleted document: {}", newS3Path); log.debug("Generated new S3 path for deleted document: {}", newS3Path);
UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(applicationSignedDocumentEntity.getFileName(), oldS3Path, newS3Path); UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(applicationSignedDocumentEntity.getFileName(), oldS3Path, newS3Path);
@@ -1407,7 +1411,7 @@ public class ApplicationDao {
} }
private String generateS3PathForDelegation(Long callId, Long applicationId) { private String generateS3PathForDelegation(Long callId, Long applicationId) {
try { try {
return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_SIGNED_DOCUMENT, callId, applicationId,0L); return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_SIGNED_DOCUMENT, callId, applicationId,0L,0L);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
log.error("Failed to generate S3 path for delegation | callId: {}, applicationId: {}, error: {}", callId, applicationId, e.getMessage(), e); log.error("Failed to generate S3 path for delegation | callId: {}, applicationId: {}, error: {}", callId, applicationId, e.getMessage(), e);
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG)); throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
@@ -1529,11 +1533,12 @@ public class ApplicationDao {
ApplicationSignedDocumentStatusEnum.ACTIVE.getValue()); ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
List<DocumentEntity> amendmentDocuments = fetchAmendmentDocuments(applicationId); List<DocumentEntity> amendmentDocuments = fetchAmendmentDocuments(applicationId);
List<DocumentEntity> evaluationDocuments = fetchEvaluationDocuments(applicationId); List<DocumentEntity> evaluationDocuments = fetchEvaluationDocuments(applicationId);
List<DocumentEntity> communicationnDocuments = fetchCommunicationDocuments(applicationId);
if (documents.isEmpty() && signedDocument == null && amendmentDocuments.isEmpty() && evaluationDocuments.isEmpty()) { if (documents.isEmpty() && signedDocument == null && amendmentDocuments.isEmpty() && evaluationDocuments.isEmpty()) {
log.warn("No documents found for applicationId: {}", applicationId); log.warn("No documents found for applicationId: {}", applicationId);
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND)); throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND));
} }
return createZipWithDocuments(applicationEntity, documents, signedDocument, amendmentDocuments, evaluationDocuments, applicationId); return createZipWithDocuments(applicationEntity, documents, signedDocument, amendmentDocuments, evaluationDocuments, applicationId,communicationnDocuments);
} }
private void validateAssignedUser(HttpServletRequest request, Long applicationId) { private void validateAssignedUser(HttpServletRequest request, Long applicationId) {
@@ -1582,6 +1587,28 @@ public class ApplicationDao {
} }
return Collections.emptyList(); return Collections.emptyList();
} }
private List<DocumentEntity> fetchCommunicationDocuments(Long applicationId) {
log.info("Fetching communication documents for applicationId: {}", applicationId);
List<ApplicationAmendmentRequestEntity> amendmentRequests = applicationAmendmentRequestRepository.findByApplicationIdAndIsDeletedFalse(applicationId);
List<Long> amendmentRequestIds = amendmentRequests.stream()
.map(ApplicationAmendmentRequestEntity::getId)
.collect(Collectors.toList());
List<CommunicationEntity> communicationEntities=communicationRepository.findByApplicationAmendmentRequestIdInAndIsDeletedFalse(amendmentRequestIds);
List<DocumentEntity> documentEntities=new ArrayList<>();
if (Boolean.FALSE.equals(communicationEntities.isEmpty())) {
for (CommunicationEntity communicationEntity : communicationEntities) {
{
Long communicationId = communicationEntity.getId();
log.debug("Found communication entity with id: {}", communicationId);
List<DocumentEntity> communicationDocuments= documentRepository.findBySourceIdInAndSourceAndIsDeletedFalse(Collections.singleton(communicationId), DocumentSourceTypeEnum.COMMUNICATION.getValue());
documentEntities.addAll(communicationDocuments);
}
}
return documentEntities;
}
return Collections.emptyList();
}
private String fetchProtocolNumberForAmendment(Long amendmentRequestId) { private String fetchProtocolNumberForAmendment(Long amendmentRequestId) {
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(amendmentRequestId).orElse(null); ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(amendmentRequestId).orElse(null);
@@ -1603,12 +1630,12 @@ public class ApplicationDao {
} }
} }
private byte[] createZipWithDocuments(ApplicationEntity applicationEntity, List<DocumentEntity> documents, ApplicationSignedDocumentEntity signedDocument, private byte[] createZipWithDocuments(ApplicationEntity applicationEntity, List<DocumentEntity> documents, ApplicationSignedDocumentEntity signedDocument,
List<DocumentEntity> amendmentDocuments, List<DocumentEntity> evaluationDocuments, Long applicationId) { List<DocumentEntity> amendmentDocuments, List<DocumentEntity> evaluationDocuments, Long applicationId,List<DocumentEntity> communicationDocuments) {
try (ByteArrayOutputStream zipOutputStream = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(zipOutputStream)) { try (ByteArrayOutputStream zipOutputStream = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(zipOutputStream)) {
Long callId = applicationEntity.getCall().getId(); Long callId = applicationEntity.getCall().getId();
// Add Application Documents // Add Application Documents
String appS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION, callId, applicationId, 0L); String appS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION, callId, applicationId, 0L,0L);
for (DocumentEntity document : documents) { for (DocumentEntity document : documents) {
String fileName = Utils.extractFileName(document.getFilePath()); String fileName = Utils.extractFileName(document.getFilePath());
addDocumentToZip(zos, appS3Folder, document.getFilePath(), fileName); addDocumentToZip(zos, appS3Folder, document.getFilePath(), fileName);
@@ -1616,7 +1643,7 @@ public class ApplicationDao {
// Add Signed Document // Add Signed Document
if (signedDocument != null) { if (signedDocument != null) {
String signedFolder = "SIGNED_DOCUMENT/"; String signedFolder = "SIGNED_DOCUMENT/";
String signedDocS3Folder = s3PathConfig.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_SIGNED_DOCUMENT, callId, applicationId, 0L); String signedDocS3Folder = s3PathConfig.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_SIGNED_DOCUMENT, callId, applicationId, 0L,0L);
String fileName = signedDocument.getFileName(); String fileName = signedDocument.getFileName();
addDocumentToZip(zos, signedDocS3Folder, signedDocument.getFilePath(), signedFolder + fileName); addDocumentToZip(zos, signedDocS3Folder, signedDocument.getFilePath(), signedFolder + fileName);
} }
@@ -1624,17 +1651,24 @@ public class ApplicationDao {
for (DocumentEntity amendmentDocument : amendmentDocuments) { for (DocumentEntity amendmentDocument : amendmentDocuments) {
String protocolNumber = fetchProtocolNumberForAmendment(amendmentDocument.getSourceId()); String protocolNumber = fetchProtocolNumberForAmendment(amendmentDocument.getSourceId());
String amendmentFolder = "SOCCORSO_" + protocolNumber + "/"; String amendmentFolder = "SOCCORSO_" + protocolNumber + "/";
String amendmentS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.AMENDMENT, callId, applicationId, amendmentDocument.getSourceId()); String amendmentS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.AMENDMENT, callId, applicationId, amendmentDocument.getSourceId(),0L);
String fileName = Utils.extractFileName(amendmentDocument.getFilePath()); String fileName = Utils.extractFileName(amendmentDocument.getFilePath());
addDocumentToZip(zos, amendmentS3Folder, amendmentDocument.getFilePath(), amendmentFolder + fileName); addDocumentToZip(zos, amendmentS3Folder, amendmentDocument.getFilePath(), amendmentFolder + fileName);
} }
// Add Evaluation Documents // Add Evaluation Documents
for (DocumentEntity evaluationDocument : evaluationDocuments) { for (DocumentEntity evaluationDocument : evaluationDocuments) {
String evaluationFolder = "EVALUATION/"; String evaluationFolder = "EVALUATION/";
String evaluationS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.EVALUATION, callId, applicationId, evaluationDocument.getSourceId()); String evaluationS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.EVALUATION, callId, applicationId, evaluationDocument.getSourceId(),0L);
String fileName = Utils.extractFileName(evaluationDocument.getFilePath()); String fileName = Utils.extractFileName(evaluationDocument.getFilePath());
addDocumentToZip(zos, evaluationS3Folder, evaluationDocument.getFilePath(), evaluationFolder + fileName); addDocumentToZip(zos, evaluationS3Folder, evaluationDocument.getFilePath(), evaluationFolder + fileName);
} }
for (DocumentEntity communicationDocument : communicationDocuments) {
Optional<CommunicationEntity> communicationEntity=communicationRepository.findByIdAndIsDeletedFalse(communicationDocument.getSourceId());
String evaluationFolder = "COMMUNICATION/";
String evaluationS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.COMMUNICATION, callId, applicationId, communicationEntity.get().getApplicationAmendmentRequest().getId(),communicationDocument.getSourceId());
String fileName = Utils.extractFileName(communicationDocument.getFilePath());
addDocumentToZip(zos, evaluationS3Folder, communicationDocument.getFilePath(), evaluationFolder + fileName);
}
zos.finish(); zos.finish();
return zipOutputStream.toByteArray(); return zipOutputStream.toByteArray();
} catch (IOException e) { } catch (IOException e) {

View File

@@ -1942,17 +1942,17 @@ public class ApplicationEvaluationDao {
log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId()); log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId());
} }
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED)) { // if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED)) {
application.setStatus(newStatus.getValue()); // application.setStatus(newStatus.getValue());
log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId()); // log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId());
emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application,hub,existingEntity); // emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application,hub,existingEntity);
application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now())); // application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request); // emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
responses = List.of(emailSendResponse); // responses = List.of(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) { // if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity); // saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
} // }
} // }
application = applicationRepository.save(application); application = applicationRepository.save(application);
ApplicationEvaluationEntity oldApplicationEvaluation = Utils.getClonedEntityForData(existingEntity); ApplicationEvaluationEntity oldApplicationEvaluation = Utils.getClonedEntityForData(existingEntity);
@@ -2605,6 +2605,43 @@ public class ApplicationEvaluationDao {
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
} }
public ApplicationEvaluationResponse updateApplicationToTechnicalEvaluationRejected(ApplicationTechnicalEvaluationRejectedRequest applicationRequest, Long assignedApplicationsId) {
Optional<ApplicationEvaluationEntity> existingEntityOptional =
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationsId);
Utils.validateEmailJson(applicationRequest.getEmailJson());
Optional<AssignedApplicationsEntity> assignedApplications =
assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationsId);
ApplicationEntity application = applicationService.validateApplication(assignedApplications.get().getApplication().getId());
UserEntity user=userService.validateUser(application.getUserId());
HubEntity hub=user.getHub();
EmailSendResponse emailSendResponse = new EmailSendResponse();
if (existingEntityOptional.isPresent()) {
ApplicationEvaluationEntity existingEntity = existingEntityOptional.get();
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(application);
List<EmailSendResponse> responses = new ArrayList<>();
application.setStatus(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED.getValue());
log.info("Application status updated to {} for applicationId: {}", ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED, application.getId());
emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application, hub, existingEntity,applicationRequest.getEmailJson());
application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
application.setEmailJson(Utils.convertMapIntoJsonString(applicationRequest.getEmailJson()));
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
responses = List.of(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
}
application = applicationRepository.save(application);
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEntity).newData(application).build());
ApplicationEvaluationResponse response = convertToResponse(existingEntity);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
response.setEmailSendResponse(responses);
}
return response;
}
return null;
}
} }

View File

@@ -1121,6 +1121,7 @@ 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);
} }

View File

@@ -155,7 +155,7 @@ public class CallDao {
for (DocumentEntity document : documents) { for (DocumentEntity document : documents) {
log.info("Adding document to ZIP: documentId={}, fileName={}", document.getId(), document.getFileName()); log.info("Adding document to ZIP: documentId={}, fileName={}", document.getId(), document.getFileName());
String s3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CALL, callId, 0L,0L); String s3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CALL, callId, 0L,0L,0L);
try (InputStream fileInputStream = amazonS3Service.getFile(s3Folder, document.getFilePath())) { try (InputStream fileInputStream = amazonS3Service.getFile(s3Folder, document.getFilePath())) {
String fileName = Utils.extractFileName(document.getFilePath()); String fileName = Utils.extractFileName(document.getFilePath());
ZipEntry zipEntry = new ZipEntry(fileName); ZipEntry zipEntry = new ZipEntry(fileName);

View File

@@ -5,13 +5,19 @@ import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant; import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity; import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.entities.CommunicationEntity; import net.gepafin.tendermanagement.entities.CommunicationEntity;
import net.gepafin.tendermanagement.entities.DocumentEntity;
import net.gepafin.tendermanagement.enums.CommunicationInitiatorTypeEnum;
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum; import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest; import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
import net.gepafin.tendermanagement.repositories.CommunicationRepository; import net.gepafin.tendermanagement.repositories.CommunicationRepository;
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService; import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
import net.gepafin.tendermanagement.service.DocumentService;
import net.gepafin.tendermanagement.util.LoggingUtil; import net.gepafin.tendermanagement.util.LoggingUtil;
import net.gepafin.tendermanagement.util.Utils; import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.util.Validator; import net.gepafin.tendermanagement.util.Validator;
@@ -22,9 +28,12 @@ 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;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Component @Component
public class CommunicationDao { public class CommunicationDao {
@@ -45,17 +54,48 @@ public class CommunicationDao {
@Autowired @Autowired
private HttpServletRequest request; private HttpServletRequest request;
public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationReq, Long amendmentId) { @Autowired
private DocumentDao documentDao;
@Autowired
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
@Autowired
private DocumentService documentService;
public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationReq, Long amendmentId, List<MultipartFile> files) {
log.info("Adding communication request..."); log.info("Adding communication request...");
CommunicationEntity communicationEntity = convertToCommunicationCommentEntity(communicationReq, amendmentId); List<DocumentResponseBean> communicationDocumentBeans = new ArrayList<>();
communicationEntity = communicationRepository.save(communicationEntity);
CommunicationEntity communicationEntity = convertToCommunicationCommentEntity(communicationReq, amendmentId,communicationDocumentBeans,files);
/** This code is responsible for adding a version history log for the "adding comment to amendment request" operation. **/ /** This code is responsible for adding a version history log for the "adding comment to amendment request" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(communicationEntity).build()); loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(communicationEntity).build());
log.info("Added comment: {}", communicationEntity); log.info("Added comment: {}", communicationEntity);
return convertToCommunicationResponseBean(communicationEntity); communicationDocumentBeans=getDocumentResponseBean(communicationEntity);
return convertToCommunicationResponseBean(communicationEntity,communicationDocumentBeans);
}
private List<DocumentResponseBean> getDocumentResponseBean(CommunicationEntity communicationEntity) {
List<Long> documentIds = applicationAmendmentRequestDao.extractIds(communicationEntity.getDocuments());
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();
return documentResponseBeans;
} }
public String deleteComment(Long amendmentId, Long commentId) { public String deleteComment(Long amendmentId, Long commentId) {
@@ -90,6 +130,7 @@ public class CommunicationDao {
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) { public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
log.info("Updating communication comment..."); log.info("Updating communication comment...");
CommunicationEntity existingComment = communicationRepository.findById(commentId) CommunicationEntity existingComment = communicationRepository.findById(commentId)
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND))); .orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
//cloned for old data for communication //cloned for old data for communication
@@ -106,11 +147,11 @@ public class CommunicationDao {
/** This code is responsible for adding a version history log for the "updating comment to amendment request" operation. **/ /** This code is responsible for adding a version history log for the "updating comment to amendment request" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCommentData).newData(existingComment).build()); loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCommentData).newData(existingComment).build());
List<DocumentResponseBean> communicationDocumentBeans=getDocumentResponseBean(existingComment);
return convertToCommunicationResponseBean(existingComment); return convertToCommunicationResponseBean(existingComment,communicationDocumentBeans);
} }
private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationEntity entity) { private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationEntity entity,List<DocumentResponseBean> communicationResponseBean) {
CommunicationResponseBean response = new CommunicationResponseBean(); CommunicationResponseBean response = new CommunicationResponseBean();
response.setComment(entity.getCommunicationComment()); response.setComment(entity.getCommunicationComment());
@@ -122,10 +163,11 @@ public class CommunicationDao {
response.setSenderUserId(entity.getSenderUserId()); response.setSenderUserId(entity.getSenderUserId());
response.setReceiverUserId(entity.getReceiverUserId()); response.setReceiverUserId(entity.getReceiverUserId());
response.setId(entity.getId()); response.setId(entity.getId());
response.setDocuments(communicationResponseBean);
return response; return response;
} }
private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) { private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId,List<DocumentResponseBean> communicationDocumentBean,List<MultipartFile> files) {
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId); ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId);
@@ -136,12 +178,24 @@ public class CommunicationDao {
communicationEntity.setIsDeleted(false); communicationEntity.setIsDeleted(false);
communicationEntity.setCommentedDate(LocalDateTime.now()); communicationEntity.setCommentedDate(LocalDateTime.now());
if(validator.checkIsPreInstructor()){ if(validator.checkIsPreInstructor()){
communicationEntity.setIntiatorType(CommunicationInitiatorTypeEnum.INSTRUCTOR.getValue());
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId()); communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
} else if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) { } else if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
communicationEntity.setIntiatorType(CommunicationInitiatorTypeEnum.BENEFICIARY.getValue());
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId()); communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
} }
communicationEntity = communicationRepository.save(communicationEntity);
communicationDocumentBean=documentDao.uploadFiles(communicationEntity.getSenderUserId(),files,communicationEntity.getId(), DocumentSourceTypeEnum.COMMUNICATION, DocumentTypeEnum.DOCUMENT);
List<Long> communicationDocumentIds = communicationDocumentBean.stream()
.map(DocumentResponseBean::getId)
.collect(Collectors.toList());
String communicationDocumentId = communicationDocumentIds.stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
communicationEntity.setDocuments(communicationDocumentId);
communicationEntity = communicationRepository.save(communicationEntity);
return communicationEntity; return communicationEntity;
} }
} }

View File

@@ -282,7 +282,7 @@ public class CompanyDocumentDao {
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId()); validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
String companyDocumentPath = companyDocumentEntity.getFilePath(); String companyDocumentPath = companyDocumentEntity.getFilePath();
String documentPath = s3ConfigBean.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION,applicationEntity.getCall().getId(),applicationId,0L); String documentPath = s3ConfigBean.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION,applicationEntity.getCall().getId(),applicationId,0L,0L);
log.info("Original Paths - oldPath: {}, newPath: {}", companyDocumentPath, documentPath); log.info("Original Paths - oldPath: {}, newPath: {}", companyDocumentPath, documentPath);

View File

@@ -92,7 +92,7 @@ public class DelegationDao {
public ByteArrayOutputStream generateDocument(Map<String, String> placeholders, String templateName) { public ByteArrayOutputStream generateDocument(Map<String, String> placeholders, String templateName) {
try { try {
String s3Folder = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.TEMPLATE, 0L, 0L,0L); String s3Folder = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.TEMPLATE, 0L, 0L,0L,0L);
InputStream templateStream = amazonS3Service.getFile(s3Folder ,templateName); InputStream templateStream = amazonS3Service.getFile(s3Folder ,templateName);
XWPFDocument doc = loadTemplate(templateStream); XWPFDocument doc = loadTemplate(templateStream);
replacePlaceholders(doc, placeholders); replacePlaceholders(doc, placeholders);

View File

@@ -89,6 +89,9 @@ public class DocumentDao {
@Autowired @Autowired
private ApplicationEvaluationDao applicationEvaluationDao; private ApplicationEvaluationDao applicationEvaluationDao;
@Autowired
private CommunicationRepository communicationRepository;
// @Value("${aws.s3.url.folder}") // @Value("${aws.s3.url.folder}")
// private String s3Folder; // private String s3Folder;
@@ -164,6 +167,7 @@ public class DocumentDao {
Long applicationId = 0L; Long applicationId = 0L;
Long amendmentId = 0L; Long amendmentId = 0L;
Long evaluationId = 0L; Long evaluationId = 0L;
Long communicationId = 0L;
Long callId = sourceId; Long callId = sourceId;
if (type == DocumentSourceTypeEnum.APPLICATION) { if (type == DocumentSourceTypeEnum.APPLICATION) {
applicationId = sourceId; applicationId = sourceId;
@@ -181,9 +185,17 @@ public class DocumentDao {
applicationId = applicationEntity.getId(); applicationId = applicationEntity.getId();
callId = applicationEntity.getCall().getId(); callId = applicationEntity.getCall().getId();
log.info("Processing document of type EVALUATION .Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId); log.info("Processing document of type EVALUATION .Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId);
}else if (type == DocumentSourceTypeEnum.COMMUNICATION) {
communicationId = sourceId;
Optional<CommunicationEntity> communicationEntity=communicationRepository.findByIdAndIsDeletedFalse(communicationId);
Optional<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntity=applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(communicationEntity.get().getApplicationAmendmentRequest().getId());
amendmentId=applicationAmendmentRequestEntity.get().getId();
applicationId=applicationAmendmentRequestEntity.get().getApplicationId();
callId = applicationAmendmentRequestEntity.get().getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getCall().getId();
log.info("Processing document of type COMMUNICATION .Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId);
} }
try { try {
String s3Path = generateS3Path(type, callId, applicationId, amendmentId); String s3Path = generateS3Path(type, callId, applicationId, amendmentId,communicationId);
log.info("Generated S3 path {}", s3Path); log.info("Generated S3 path {}", s3Path);
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file); return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
} catch (Exception e) { } catch (Exception e) {
@@ -194,9 +206,9 @@ public class DocumentDao {
} }
public String generateS3Path(DocumentSourceTypeEnum typeOfDocument, Long callId, Long applicationId, Long amendmentId) { public String generateS3Path(DocumentSourceTypeEnum typeOfDocument, Long callId, Long applicationId, Long amendmentId,Long communicationId) {
try { try {
return s3ConfigBean.generateDocumentPath(typeOfDocument, callId, applicationId, amendmentId); return s3ConfigBean.generateDocumentPath(typeOfDocument, callId, applicationId, amendmentId,communicationId);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG)); throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
} }
@@ -228,6 +240,7 @@ public class DocumentDao {
Long applicationId = null; Long applicationId = null;
Long amendmentId = null; Long amendmentId = null;
Long evaluationId = null; Long evaluationId = null;
Long communicationId=null;
if (DocumentSourceTypeEnum.CALL.getValue().equalsIgnoreCase(documentEntity.getSource())) { if (DocumentSourceTypeEnum.CALL.getValue().equalsIgnoreCase(documentEntity.getSource())) {
callId = documentEntity.getSourceId(); callId = documentEntity.getSourceId();
@@ -305,7 +318,7 @@ public class DocumentDao {
callId = applicationEntity.getCall().getId(); callId = applicationEntity.getCall().getId();
log.info("Processing document of type EVALUATION. Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId); log.info("Processing document of type EVALUATION. Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId);
} }
deleteFileFromS3(documentEntity, callId, applicationId,amendmentId); deleteFileFromS3(documentEntity, callId, applicationId,amendmentId,communicationId);
log.info("Successfully deleted file from S3 for documentId={}", documentId); log.info("Successfully deleted file from S3 for documentId={}", documentId);
} }
@@ -349,6 +362,7 @@ public class DocumentDao {
Long applicationId=null; Long applicationId=null;
Long amendmentId=null; Long amendmentId=null;
Long evaluationId=null; Long evaluationId=null;
Long communicationId=null;
if (type.equals(DocumentSourceTypeEnum.APPLICATION)) { if (type.equals(DocumentSourceTypeEnum.APPLICATION)) {
callId = applicationRepository.findCallIdById(id); callId = applicationRepository.findCallIdById(id);
applicationId = id; applicationId = id;
@@ -366,6 +380,14 @@ public class DocumentDao {
applicationId = applicationEntity.getId(); applicationId = applicationEntity.getId();
callId = applicationEntity.getCall().getId(); callId = applicationEntity.getCall().getId();
log.info("Processing document of type EVALUATION . Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId); log.info("Processing document of type EVALUATION . Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId);
}else if (type == DocumentSourceTypeEnum.COMMUNICATION) {
communicationId = id;
Optional<CommunicationEntity> communicationEntity=communicationRepository.findByIdAndIsDeletedFalse(communicationId);
Optional<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntity=applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(communicationEntity.get().getApplicationAmendmentRequest().getId());
amendmentId=applicationAmendmentRequestEntity.get().getId();
applicationId=applicationAmendmentRequestEntity.get().getApplicationId();
callId = applicationAmendmentRequestEntity.get().getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getCall().getId();
log.info("Processing document of type EVALUATION .Resolved evaluationId={}, applicationId={}, callId={}", evaluationId, applicationId, callId);
} }
else { else {
@@ -373,7 +395,7 @@ public class DocumentDao {
applicationId = 0L; applicationId = 0L;
log.info("Processing document of type CALL . Resolved callId={}", callId); log.info("Processing document of type CALL . Resolved callId={}", callId);
} }
String s3Path = generateS3Path(type, callId, applicationId,amendmentId); String s3Path = generateS3Path(type, callId, applicationId,amendmentId,communicationId);
log.info("Generated S3 path {}", s3Path); log.info("Generated S3 path {}", s3Path);
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file); return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
} catch (Exception e) { } catch (Exception e) {
@@ -386,12 +408,12 @@ public class DocumentDao {
return callDao.convertToDocumentResponseBean(documentEntity); return callDao.convertToDocumentResponseBean(documentEntity);
} }
public void deleteFileFromS3(DocumentEntity documentEntity, Long callId, Long applicationId,Long amendmentId) { public void deleteFileFromS3(DocumentEntity documentEntity, Long callId, Long applicationId,Long amendmentId,Long communicationId) {
try { try {
DocumentEntity oldDocumentEntity = Utils.getClonedEntityForData(documentEntity); DocumentEntity oldDocumentEntity = Utils.getClonedEntityForData(documentEntity);
String oldS3Path = documentEntity.getFilePath(); String oldS3Path = documentEntity.getFilePath();
String newS3Path = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.valueOf("DELETED_" + documentEntity.getSource().toUpperCase()), callId, applicationId,amendmentId); String newS3Path = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.valueOf("DELETED_" + documentEntity.getSource().toUpperCase()), callId, applicationId,amendmentId,communicationId);
log.info("Moving file to deleted path: oldS3Path={}, newS3Path={}", oldS3Path, newS3Path); log.info("Moving file to deleted path: oldS3Path={}, newS3Path={}", oldS3Path, newS3Path);
UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(documentEntity.getFileName(), oldS3Path, newS3Path); UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(documentEntity.getFileName(), oldS3Path, newS3Path);
documentEntity.setFileName(response.getFileName()); documentEntity.setFileName(response.getFileName());

View File

@@ -94,6 +94,9 @@ public class EmailNotificationDao {
@Autowired @Autowired
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao; private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
@Autowired
private ApplicationDao applicationDao;
public void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType, Map<String, String> bodyPlaceholders, public void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType, Map<String, String> bodyPlaceholders,
List<String> additionalRecipients, Long amendmentId) { List<String> additionalRecipients, Long amendmentId) {
@@ -131,21 +134,35 @@ 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); ApplicationAmendmentRequestEntity applicationAmendmentRequest =null;
if(amendmentId!=null) {
applicationAmendmentRequest = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
}
List<AttachmentRequest> attachmentRequests =new ArrayList<>(); List<AttachmentRequest> attachmentRequests =new ArrayList<>();
if(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED)) {
S3DocxProcessor processor = new S3DocxProcessor(s3Client); S3DocxProcessor processor = new S3DocxProcessor(s3Client);
List<String> urls=new ArrayList<>(); List<String> urls=new ArrayList<>();
Map<String, String> replacements = Map.of( Map<String, String> replacements=new HashMap<>();
List<DocumentEntity> documentEntities=new ArrayList<>();
if(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED)) {
replacements = Map.of(
"{call_name}", applicationEntity.getCall().getName(), "{call_name}", applicationEntity.getCall().getName(),
"{amount_accepted}", String.valueOf(applicationEntity.getAmountAccepted()), "{amount_accepted}", String.valueOf(applicationEntity.getAmountAccepted()),
"{pec}", "bandi.gepafin@legalmail.it" "{pec}", "bandi.gepafin@legalmail.it"
); );
List<DocumentEntity> documentEntities=documentRepository.findBySourceInAndIsDeletedFalse(List.of(applicationAmendmentRequest.getAmendmentDocumentType(),"MODELLO_AUTOCERTIFICAZIONE","MODELLO_PRIVACY")); documentEntities=documentRepository.findBySourceInAndIsDeletedFalse(List.of(applicationAmendmentRequest.getAmendmentDocumentType(),"MODELLO_AUTOCERTIFICAZIONE","MODELLO_PRIVACY"));
}
if(Boolean.TRUE.equals(userEntity.getHub().getUniqueUuid().equals(defaultHubUuid)) && Boolean.TRUE.equals(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.APPLICATION_AMENDMENT_REQUESTED))) {
List<Long> documentIds=applicationDao.validateDocumentIds(applicationAmendmentRequest.getAmendmentInitialDocument());
Set<Long> setOfDocumentIds = (documentIds == null)
? Collections.emptySet()
: new HashSet<>(documentIds);
documentEntities=documentRepository.findAllByIdInAndIsDeletedFalse(setOfDocumentIds);
}
urls = documentEntities.stream() urls = documentEntities.stream()
.map(DocumentEntity::getFilePath) // or getUrl() .map(DocumentEntity::getFilePath) // or getUrl()
.collect(Collectors.toList()); .collect(Collectors.toList());
if(Boolean.FALSE.equals(urls.isEmpty())) {
Map<String, AttachmentRequest> processedFiles = null; Map<String, AttachmentRequest> processedFiles = null;
try { try {
processedFiles = processor.processFiles(urls, replacements); processedFiles = processor.processFiles(urls, replacements);
@@ -159,7 +176,6 @@ public class EmailNotificationDao {
attachmentRequests.add(attachmentRequest); 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();
String contactEmail = userWithCompany.getContactEmail(); String contactEmail = userWithCompany.getContactEmail();
@@ -404,7 +420,7 @@ public class EmailNotificationDao {
return emailConfig; return emailConfig;
} }
private EmailConfig parseEmailConfig(String configJson) { private static EmailConfig parseEmailConfig(String configJson) {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
try { try {
@@ -413,11 +429,27 @@ 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) { 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); Map<String, String> bodyPlaceholders = prepareEmailPlaceholdersForTechnicalEvaluationRejected(applicationEntity,hub,applicationEvaluationEntity);
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE, bodyPlaceholders, null, String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
null); 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<>();

View File

@@ -15,26 +15,27 @@ public class S3PathConfig {
@Autowired @Autowired
S3ConfigRepository s3ConfigRepository; S3ConfigRepository s3ConfigRepository;
public String generateDocumentPath(DocumentSourceTypeEnum type, Long callId, Long applicationId,Long amendmentId) { public String generateDocumentPath(DocumentSourceTypeEnum type, Long callId, Long applicationId,Long amendmentId,Long communicationId) {
S3ConfigEntity config = getDocumentPath(type); S3ConfigEntity config = getDocumentPath(type);
return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId,amendmentId); return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId,amendmentId,communicationId);
} }
public String generateDocumentPathForOther(DocOtherSourceTypeEnum type, Long callId, Long applicationId,Long amendmentId) { public String generateDocumentPathForOther(DocOtherSourceTypeEnum type, Long callId, Long applicationId,Long amendmentId,Long communicationId) {
S3ConfigEntity config = getDocumentPathForOther(type); S3ConfigEntity config = getDocumentPathForOther(type);
return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId,amendmentId); return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId,amendmentId,communicationId);
} }
public String generateDocumentPathForDelegationAndSignedDocument(DocOtherSourceTypeEnum type) { public String generateDocumentPathForDelegationAndSignedDocument(DocOtherSourceTypeEnum type) {
S3ConfigEntity config = getDocumentPathForOther(type); S3ConfigEntity config = getDocumentPathForOther(type);
return config.getParentFolder() + "/" + config.getPath(); return config.getParentFolder() + "/" + config.getPath();
} }
private String buildS3Path(String pathTemplate, Long callId, Long applicationId, Long amendmentId) { private String buildS3Path(String pathTemplate, Long callId, Long applicationId, Long amendmentId,Long communicationId) {
return pathTemplate return pathTemplate
.replace("{call_id}", callId != null && callId != 0L ? "call_" + callId : "") .replace("{call_id}", callId != null && callId != 0L ? "call_" + callId : "")
.replace("{application_id}", applicationId != null && applicationId != 0L ? "application_" + applicationId : "") .replace("{application_id}", applicationId != null && applicationId != 0L ? "application_" + applicationId : "")
.replace("{amendment_id}", amendmentId != null && amendmentId != 0L ? "amendment_" + amendmentId : ""); .replace("{amendment_id}", amendmentId != null && amendmentId != 0L ? "amendment_" + amendmentId : "")
.replace("{communication_id}", communicationId != null && communicationId != 0L ? "communication_" + communicationId : "");
} }
private S3ConfigEntity getDocumentPath(DocumentSourceTypeEnum type) { private S3ConfigEntity getDocumentPath(DocumentSourceTypeEnum type) {

View File

@@ -74,4 +74,7 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
@Column(name = "AMENDMENT_DOCUMENT_TYPE") @Column(name = "AMENDMENT_DOCUMENT_TYPE")
private String amendmentDocumentType; private String amendmentDocumentType;
@Column(name = "AMENDMENT_INITIAL_DOCUMENT")
private String amendmentInitialDocument;
} }

View File

@@ -81,4 +81,7 @@ public class ApplicationEntity extends BaseEntity {
@Column(name = "PREVIOUS_STATUS") @Column(name = "PREVIOUS_STATUS")
private String previousStatus; private String previousStatus;
@Column(name = "EMAIL_JSON")
private String emailJson;
} }

View File

@@ -35,4 +35,9 @@ public class CommunicationEntity extends BaseEntity {
@JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false) @JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false)
private ApplicationAmendmentRequestEntity applicationAmendmentRequest; private ApplicationAmendmentRequestEntity applicationAmendmentRequest;
@Column(name = "INITIATOR_TYPE")
private String intiatorType;
@Column(name = "DOCUMENTS")
private String documents;
} }

View File

@@ -0,0 +1,18 @@
package net.gepafin.tendermanagement.enums;
public enum CommunicationInitiatorTypeEnum {
INSTRUCTOR("INSTRUCTOR"),
BENEFICIARY("BENEFICIARY");
private String value;
CommunicationInitiatorTypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@@ -5,7 +5,8 @@ public enum DocumentSourceTypeEnum {
APPLICATION("APPLICATION"), APPLICATION("APPLICATION"),
EVALUATION("EVALUATION"), EVALUATION("EVALUATION"),
AMENDMENT("AMENDMENT"); AMENDMENT("AMENDMENT"),
COMMUNICATION("COMMUNICATION");
private String value; private String value;

View File

@@ -223,7 +223,8 @@ public enum UserActionContextEnum {
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"); CREATE_SPECIAL_AMENDMENT("CREATE_SPECIAL_AMENDMENT"),
UPDATE_APPLICATION_TO_TECHNICAL_EVALUATION_REJECTED("UPDATE_APPLICATION_TO_TECHNICAL_EVALUATION_REJECTED");
private final String value; private final String value;

View File

@@ -0,0 +1,13 @@
package net.gepafin.tendermanagement.model.request;
import lombok.Data;
import java.util.Map;
@Data
public class ApplicationTechnicalEvaluationRejectedRequest {
private Map<String, Object> emailJson;
}

View File

@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.model.request;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@Data @Data
@@ -32,6 +33,7 @@ public class AppointmentCreationRequest {
private String codProdotto; private String codProdotto;
private String codOperazione; private String codOperazione;
private Nota nota; private Nota nota;
private LocalDateTime dataAppuntamento;
} }
@Data @Data

View File

@@ -2,11 +2,14 @@ package net.gepafin.tendermanagement.model.request;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
@Data @Data
public class CreateAppointmentRequest { public class CreateAppointmentRequest {
private Double importoBreveTermine; private Double importoBreveTermine;
private Integer durataMesiFinanziamento; private Integer durataMesiFinanziamento;
private Nota nota; private Nota nota;
private LocalDateTime dataAppuntamento;
@Data @Data
public static class Nota { public static class Nota {

View File

@@ -33,4 +33,5 @@ public class ApplicationAmendmentRequestResponse {
private ApplicationAmendmentRequestEnum status; private ApplicationAmendmentRequestEnum status;
private String emailTemplate; private String emailTemplate;
private List<EmailSendResponse> emailSendResponse; private List<EmailSendResponse> emailSendResponse;
private List<DocumentResponseBean> amendmentInitialDocuments;
} }

View File

@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.model.response;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Data @Data
public class CommunicationResponseBean { public class CommunicationResponseBean {
@@ -24,6 +25,8 @@ public class CommunicationResponseBean {
private Long amendmentId; private Long amendmentId;
private List<DocumentResponseBean> documents;
public CommunicationResponseBean(LocalDateTime commentedDate, String comment, String title, LocalDateTime createdDate, LocalDateTime updatedDate, Long amendmentId, Long id) { public CommunicationResponseBean(LocalDateTime commentedDate, String comment, String title, LocalDateTime createdDate, LocalDateTime updatedDate, Long amendmentId, Long id) {
this.commentedDate = commentedDate; this.commentedDate = commentedDate;

View File

@@ -17,4 +17,6 @@ public interface CommunicationRepository extends JpaRepository<CommunicationEnti
List<CommunicationResponseBean> findCommentListDetailsByAmendmentId(@Param("amendmentId") Long amendmentId); List<CommunicationResponseBean> findCommentListDetailsByAmendmentId(@Param("amendmentId") Long amendmentId);
Optional<CommunicationEntity> findByIdAndIsDeletedFalse(Long commentId); Optional<CommunicationEntity> findByIdAndIsDeletedFalse(Long commentId);
List<CommunicationEntity> findByApplicationAmendmentRequestIdInAndIsDeletedFalse(List<Long> amendmentId);
} }

View File

@@ -6,12 +6,13 @@ import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum; import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.model.request.*; import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.model.response.*; import net.gepafin.tendermanagement.model.response.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
public interface ApplicationAmendmentRequestService { public interface ApplicationAmendmentRequestService {
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId); public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId);
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest); public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , List<MultipartFile> files, ApplicationAmendmentRequest applicationAmendmentRequest);
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id); void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id); ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId); List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);

View File

@@ -3,10 +3,7 @@ package net.gepafin.tendermanagement.service;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity; import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import net.gepafin.tendermanagement.enums.FormActionEnum; import net.gepafin.tendermanagement.enums.FormActionEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean; import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
import net.gepafin.tendermanagement.model.response.*; import net.gepafin.tendermanagement.model.response.*;
import java.util.List; import java.util.List;
@@ -30,4 +27,5 @@ public interface ApplicationEvaluationService {
ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId); ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId);
ApplicationEvaluationResponse updateApplicationToTechnicalEvaluationRejected(HttpServletRequest request, ApplicationTechnicalEvaluationRejectedRequest applicationRequest, Long assignedApplicationsId);
} }

View File

@@ -4,9 +4,12 @@ import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface CommunicationService { public interface CommunicationService {
CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request ,CommunicationRequestBean communicationRequestBean, Long amendmentId); CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request , CommunicationRequestBean communicationRequestBean, Long amendmentId, List<MultipartFile> files);
String deleteComment(HttpServletRequest request,Long amendmentId, Long commentId); String deleteComment(HttpServletRequest request,Long amendmentId, Long commentId);

View File

@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepo
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository; import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService; import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
import net.gepafin.tendermanagement.service.UserService; import net.gepafin.tendermanagement.service.UserService;
import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.util.Validator; import net.gepafin.tendermanagement.util.Validator;
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException; import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException; import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
@@ -21,8 +22,10 @@ import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
@Service @Service
@@ -50,10 +53,15 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest) { public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , List<MultipartFile> files, ApplicationAmendmentRequest applicationAmendmentRequest) {
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(applicationEvaluationId); Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(applicationEvaluationId);
entityOptional.ifPresent(applicationEvaluationEntity -> validator.validatePreInstructor(request, applicationEvaluationEntity.getUserId())); entityOptional.ifPresent(applicationEvaluationEntity -> validator.validatePreInstructor(request, applicationEvaluationEntity.getUserId()));
return applicationAmendmentRequestDao.createApplicationAmendmentRequest(applicationEvaluationId,applicationAmendmentRequest); Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
Long userId = validator.getUserId(userInfo);
if(files!=null) {
files.forEach(Utils::validateFileType);
}
return applicationAmendmentRequestDao.createApplicationAmendmentRequest(applicationEvaluationId,files,applicationAmendmentRequest,userId);
} }
@Override @Override

View File

@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.ApplicationTechnicalEvaluationRejectedRequest;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResponse;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean;
@@ -106,6 +107,10 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
return applicationEvaluationDao.getApplicationEvaluationVersion(request,applicationId); return applicationEvaluationDao.getApplicationEvaluationVersion(request,applicationId);
} }
@Override
public ApplicationEvaluationResponse updateApplicationToTechnicalEvaluationRejected(HttpServletRequest request, ApplicationTechnicalEvaluationRejectedRequest applicationRequest, Long assignedApplicationsId) {
return applicationEvaluationDao.updateApplicationToTechnicalEvaluationRejected(applicationRequest,assignedApplicationsId);
}
} }

View File

@@ -12,7 +12,9 @@ import net.gepafin.tendermanagement.util.Validator;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@Service @Service
@@ -29,14 +31,14 @@ public class CommunicationServiceImpl implements CommunicationService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request ,CommunicationRequestBean communicationRequestBean, Long amendmentId) { public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request , CommunicationRequestBean communicationRequestBean, Long amendmentId, List<MultipartFile> files) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) { if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) {
validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId()); validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId());
} else { } else {
validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
} }
return communicationDao.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId); return communicationDao.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId,files);
} }
@Override @Override

View File

@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import net.gepafin.tendermanagement.dao.DocumentDao; import net.gepafin.tendermanagement.dao.DocumentDao;
import net.gepafin.tendermanagement.dao.S3PathConfig; import net.gepafin.tendermanagement.dao.S3PathConfig;
import net.gepafin.tendermanagement.entities.ApplicationEntity; import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.CommunicationEntity;
import net.gepafin.tendermanagement.entities.DocumentEntity; import net.gepafin.tendermanagement.entities.DocumentEntity;
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum; import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
import net.gepafin.tendermanagement.repositories.*; import net.gepafin.tendermanagement.repositories.*;
@@ -25,6 +26,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Optional;
@Slf4j @Slf4j
@Service @Service
@@ -73,6 +75,9 @@ public class S3ReUploadMigrationService {
@Autowired @Autowired
private ApplicationEvaluationRepository applicationEvaluationRepository; private ApplicationEvaluationRepository applicationEvaluationRepository;
@Autowired
private CommunicationRepository communicationRepository;
@Autowired @Autowired
private DocumentDao documentDao; private DocumentDao documentDao;
@@ -108,6 +113,7 @@ public class S3ReUploadMigrationService {
Long applicationId = null; Long applicationId = null;
Long amendmentId = null; Long amendmentId = null;
Long evaluationId = null; Long evaluationId = null;
Long communicationId=null;
if (DocumentSourceTypeEnum.CALL.getValue().equalsIgnoreCase(document.getSource())) { if (DocumentSourceTypeEnum.CALL.getValue().equalsIgnoreCase(document.getSource())) {
callId = document.getSourceId(); callId = document.getSourceId();
} else if (DocumentSourceTypeEnum.APPLICATION.getValue().equalsIgnoreCase(document.getSource())) { } else if (DocumentSourceTypeEnum.APPLICATION.getValue().equalsIgnoreCase(document.getSource())) {
@@ -125,10 +131,16 @@ public class S3ReUploadMigrationService {
ApplicationEntity applicationEntity = applicationEvaluationRepository.findApplicationByEvaluationId(evaluationId); ApplicationEntity applicationEntity = applicationEvaluationRepository.findApplicationByEvaluationId(evaluationId);
applicationId = applicationEntity.getId(); applicationId = applicationEntity.getId();
callId = applicationEntity.getCall().getId(); callId = applicationEntity.getCall().getId();
}else if(DocumentSourceTypeEnum.COMMUNICATION.getValue().equalsIgnoreCase(document.getSource())){
communicationId = document.getSourceId();
Optional<CommunicationEntity> communicationEntity=communicationRepository.findByIdAndIsDeletedFalse(communicationId);
ApplicationEntity applicationEntity =communicationEntity.get().getApplicationAmendmentRequest().getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication();
applicationId = applicationEntity.getId();
callId = applicationEntity.getCall().getId();
} }
documentDao.deleteFileFromS3(document,callId,applicationId,amendmentId); documentDao.deleteFileFromS3(document,callId,applicationId,amendmentId,communicationId);
processDocuments++; processDocuments++;
} catch (Exception e) { } catch (Exception e) {
@@ -219,10 +231,10 @@ public class S3ReUploadMigrationService {
Long callId; Long callId;
if (sourceType.equals(DocumentSourceTypeEnum.CALL)) { if (sourceType.equals(DocumentSourceTypeEnum.CALL)) {
return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L,0L); return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L,0L,0L);
} else { } else {
callId = applicationRepository.findCallIdById(document.getSourceId()); callId = applicationRepository.findCallIdById(document.getSourceId());
return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId(),0L); return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId(),0L,0L);
} }
} }

View File

@@ -139,7 +139,7 @@ public class UserSignedAndDelegationServiceImpl {
private String generateNewS3PathForDelegationDoc() { private String generateNewS3PathForDelegationDoc() {
return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_DELEGATION, 0L, 0L,0L); return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_DELEGATION, 0L, 0L,0L,0L);
} }
private String generateNewS3PathForUserSignedDoc(ApplicationSignedDocumentEntity document) { private String generateNewS3PathForUserSignedDoc(ApplicationSignedDocumentEntity document) {

View File

@@ -1095,6 +1095,22 @@ public class Utils {
return "Invalid amount format"; return "Invalid amount format";
} }
} }
public static void validateEmailJson(Map<String, Object> emailJson) {
for (Map.Entry<String, Object> entry : emailJson.entrySet()) {
if (isEmpty(entry.getKey())) {
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_EMAIL_JSON));
}
}
validateJsonKeys(emailJson, GepafinConstant.MANUAL_EMAIL_KEYS);
}
private static void validateJsonKeys(Map<String, Object> actionJson, List<String> validkeys) {
for (String key : validkeys) {
if (!actionJson.containsKey(key)) {
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_EMAIL_JSON));
}
}
}
} }

View File

@@ -18,6 +18,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@@ -44,10 +45,16 @@ public interface ApplicationAmendmentRequestApi {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PostMapping(value = "", produces = "application/json") @PostMapping(value = "", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(HttpServletRequest request, ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(
@Parameter(description = "Application Evaluation Id", required = true) @RequestParam Long applicationEvaluationId, HttpServletRequest request,
@Valid @RequestBody ApplicationAmendmentRequest applicationAmendmentRequest); @Parameter(description = "Application Evaluation Id", required = true)
@RequestParam Long applicationEvaluationId,
@Parameter(description = "List of files to upload", required = false)
@RequestPart(required = false) List<MultipartFile> files,
@Parameter(description = "Amendment details as JSON", required = true)
@RequestPart("applicationAmendmentRequest") ApplicationAmendmentRequest applicationAmendmentRequest);
@Operation(summary = "Api to delete application amendment request", @Operation(summary = "Api to delete application amendment request",
responses = { responses = {

View File

@@ -8,10 +8,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import net.gepafin.tendermanagement.enums.FormActionEnum; import net.gepafin.tendermanagement.enums.FormActionEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean; import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
import net.gepafin.tendermanagement.model.response.*; import net.gepafin.tendermanagement.model.response.*;
import net.gepafin.tendermanagement.model.util.Response; import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants; import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
@@ -104,5 +101,18 @@ public interface ApplicationEvaluationApi {
@Parameter(description = "The application id", required = true) @PathVariable("id") Long id); @Parameter(description = "The application id", required = true) @PathVariable("id") Long id);
@Operation(summary = "API to update Application to TECHNICAL EVALUATION REJECTED",
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 = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
})
@PutMapping(value = "/{assignedApplicationsId}/technicalEvaluationRejected", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationToTechnicalEvaluationRejected(
HttpServletRequest request,
@Parameter(description = "Assigned Application ID", required = true) @PathVariable("assignedApplicationsId") Long assignedApplicationsId,
@Parameter(description = "Application Request Body", required = true) @Valid @RequestBody ApplicationTechnicalEvaluationRejectedRequest applicationRequest);
} }

View File

@@ -16,12 +16,10 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import java.util.List;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Validated @Validated
public interface CommunicationApi { public interface CommunicationApi {
@@ -32,10 +30,11 @@ public interface CommunicationApi {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PostMapping(value = "/{amendmentId}", produces = { "application/json" }) @PostMapping(value = "/{amendmentId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER') || hasRole('ROLE_CONFIDI')") @PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER') || hasRole('ROLE_CONFIDI')")
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, @Parameter(description = "List of files to upload", required = false)
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId); @RequestPart(required = false) List<MultipartFile> files,
@Parameter(description = "communication request body" ,required=true) @RequestPart CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId);
@Operation(summary = "API to Get Amendment Request Comment", responses = { @ApiResponse(responseCode = "200", description = "OK"), @Operation(summary = "API to Get Amendment Request Comment", responses = { @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value = @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =

View File

@@ -1,5 +1,7 @@
package net.gepafin.tendermanagement.web.rest.api.impl; package net.gepafin.tendermanagement.web.rest.api.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import net.gepafin.tendermanagement.config.Translator; import net.gepafin.tendermanagement.config.Translator;
@@ -19,6 +21,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@RestController @RestController
@@ -26,6 +30,9 @@ import java.util.List;
@Log4j2 @Log4j2
public class ApplicationAmendmentRequestController implements ApplicationAmendmentRequestApi { public class ApplicationAmendmentRequestController implements ApplicationAmendmentRequestApi {
@Autowired
private ObjectMapper mapper;
@Autowired @Autowired
ApplicationAmendmentRequestService applicationAmendmentRequestService; ApplicationAmendmentRequestService applicationAmendmentRequestService;
@@ -45,13 +52,18 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
} }
@Override @Override
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId, ApplicationAmendmentRequest applicationAmendmentRequest) { public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId, List<MultipartFile> files, ApplicationAmendmentRequest applicationAmendmentRequest) {
// ApplicationAmendmentRequest data=null;
// try {
// data = mapper.readValue(applicationAmendmentRequest,ApplicationAmendmentRequest.class);
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
/** This code is responsible for creating user action logs for the "Create Application Amendment" operation. **/ /** This code is responsible for creating user action logs for the "Create Application Amendment" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT) loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT)
.actionContext(UserActionContextEnum.CREATE_AMENDMENT).build()); .actionContext(UserActionContextEnum.CREATE_AMENDMENT).build());
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.createApplicationAmendmentRequest(request,applicationEvaluationId,applicationAmendmentRequest); ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.createApplicationAmendmentRequest(request,applicationEvaluationId,files,applicationAmendmentRequest);
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.CREATE_APPLICATION_DATA_FOR_AMENDMENT_MSG))); .body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.CREATE_APPLICATION_DATA_FOR_AMENDMENT_MSG)));
} }

View File

@@ -118,4 +118,15 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
.body(new Response<>(applicationEvaluationVersionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG))); .body(new Response<>(applicationEvaluationVersionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG)));
} }
@Override
public ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationToTechnicalEvaluationRejected(HttpServletRequest request, Long assignedApplicationsId, ApplicationTechnicalEvaluationRejectedRequest applicationRequest) {
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.UPDATE_APPLICATION_TO_TECHNICAL_EVALUATION_REJECTED).build());
ApplicationEvaluationResponse applicationEvaluationVersionResponse = applicationEvaluationService.updateApplicationToTechnicalEvaluationRejected(request,applicationRequest,assignedApplicationsId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.UPDATE_APPLICATION_TECHNICAL_EVALUATION_REJECTED_MSG)));
}
} }

View File

@@ -19,6 +19,9 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@RestController @RestController
@RequestMapping("${openapi.gepafin.base-path:/v1/communication}") @RequestMapping("${openapi.gepafin.base-path:/v1/communication}")
@@ -31,13 +34,13 @@ public class CommunicationController implements CommunicationApi {
private LoggingUtil loggingUtil; private LoggingUtil loggingUtil;
@Override @Override
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean, public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, List<MultipartFile> files, CommunicationRequestBean communicationRequestBean,
Long amendmentId) { Long amendmentId) {
/** This code is responsible for creating user action logs for the "Adding comment to amendment request" operation. **/ /** This code is responsible for creating user action logs for the "Adding comment to amendment request" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT).actionContext(UserActionContextEnum.ADD_COMMENT_TO_AMENDMENT_REQUEST).build()); loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT).actionContext(UserActionContextEnum.ADD_COMMENT_TO_AMENDMENT_REQUEST).build());
CommunicationResponseBean communicationResponseBean = communicationService.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId); CommunicationResponseBean communicationResponseBean = communicationService.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId,files);
return ResponseEntity.status(HttpStatus.CREATED) return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS))); .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
} }

View File

@@ -3027,6 +3027,41 @@
<sqlFile dbms="postgresql" path="db/dump/insert_document_for_special_amendment.sql"/> <sqlFile dbms="postgresql" path="db/dump/insert_document_for_special_amendment.sql"/>
</changeSet> </changeSet>
<changeSet id="08-10-2025_RK_184352" author="Rajesh Khore">
<addColumn tableName="application_amendment_request">
<column name="amendment_initial_document" type="VARCHAR(255)"></column>
</addColumn>
<addColumn tableName="application">
<column name="email_json" type="TEXT"></column>
</addColumn>
</changeSet>
<changeSet id="08-10-2025_RK_194824" author="Rajesh Khore">
<addColumn tableName="communication">
<column name="initiator_type" type="VARCHAR(255)"/>
<column name="documents" type="VARCHAR(255)"/>
</addColumn>
</changeSet>
<changeSet id="09-10-2025_RK_205135" author="Rajesh Khore">
<insert tableName="s3_path_configuration">
<column name="type" value="COMMUNICATION"/>
<column name="path" value="call/{call_id}/application/{application_id}/amendment/{amendment_id}/communication/{communication_id}"/>
<column name="bucket_name" value="mementoresources"/>
<column name="created_date" value="2025-10-09 03:00:00"/>
<column name="updated_date" value="2025-10-09 03:00:00"/>
<column name="parent_folder" value="gepafin/local"/>
</insert>
</changeSet>
<changeSet id="13-10-2025_RK_175232" author="Rajesh Khore">
<update tableName="hub">
<column name="email_service_config" value="JkFbBfuVvq7VWwp5LcWIi+hAa1RJ1ekI0jq3w7gLTXETZiTaN8zC4OBWD53x8FtbfFTh3L/5805CIYTH1BQGa3X9q16q9SDzMy7DKHdmJzOnLKhn74C5akoXKaeXUCGnzp0cSk2c01FV6lwefC29IhixeIvxG7puRVyjUIZK/W8/Kah9uWkDjFtxi8IL6L0QVHn1M/CUm0L/sMRYo7u7WunY+kbjlu/vXw9goy5tjlE="/>
<where>UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs'</where>
</update>
</changeSet>
<changeSet id="06-10-2025_RK_142435" author="Rajesh Khore"> <changeSet id="06-10-2025_RK_142435" author="Rajesh Khore">
<addColumn tableName="application"> <addColumn tableName="application">
<column name="previous_status" type="VARCHAR(255)"></column> <column name="previous_status" type="VARCHAR(255)"></column>

View File

@@ -413,4 +413,7 @@ email.pec.cannot.null=Email pec is required.
user.request.completed=User request completed successfully. user.request.completed=User request completed successfully.
end.date.greater.than.now=End date must be greater than the current date and time. end.date.greater.than.now=End date must be greater than the current date and time.
pec.email.required=PEC email is required. pec.email.required=PEC email is required.
application.technical.evaluation.rejected.success=Application changes to status application technical evaluation rejected successfully.
invalid.email.json=Invalid email json.

View File

@@ -404,4 +404,5 @@ email.pec.cannot.null=L'indirizzo email pec
user.request.completed=Richiesta utente completata con successo. user.request.completed=Richiesta utente completata con successo.
end.date.greater.than.now=La data di fine deve essere successiva alla data e all'ora correnti. end.date.greater.than.now=La data di fine deve essere successiva alla data e all'ora correnti.
pec.email.required=Obbligatorio l'indirizzo e-mail PEC. pec.email.required=Obbligatorio l'indirizzo e-mail PEC.
application.technical.evaluation.rejected.success=Lo stato dell'applicazione cambia: valutazione tecnica dell'applicazione rifiutata con successo.
invalid.email.json=Codice email json non valido.