Done ticket GEPAFINBE-6139
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package net.gepafin.tendermanagement.constants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class GepafinConstant {
|
||||
|
||||
public static final String USER_CREATED_SUCCESS_MSG = "user.created.success";
|
||||
@@ -615,6 +618,11 @@ public class GepafinConstant {
|
||||
" </div>\n" +
|
||||
" </body>\n" +
|
||||
"</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";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -149,6 +150,9 @@ public class ApplicationAmendmentRequestDao {
|
||||
@Autowired
|
||||
private EmailDao emailDao;
|
||||
|
||||
@Autowired
|
||||
private DocumentDao documentDao;
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||
@@ -302,10 +306,10 @@ public class ApplicationAmendmentRequestDao {
|
||||
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);
|
||||
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest, applicationEvaluationId);
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest, applicationEvaluationId,files, userId);
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity,false);
|
||||
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
|
||||
if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) {
|
||||
@@ -323,7 +327,7 @@ public class ApplicationAmendmentRequestDao {
|
||||
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.setNote(applicationAmendmentRequest.getNote());
|
||||
applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays());
|
||||
@@ -383,7 +387,15 @@ public class ApplicationAmendmentRequestDao {
|
||||
applicationAmendmentRequestEntity.setProtocol(protocolEntity);
|
||||
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity, null, VersionActionTypeEnum.INSERT);
|
||||
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();
|
||||
if (Boolean.FALSE.equals(evaluationStatusType.equals((ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue())))){
|
||||
// applicationEvaluationEntity.setStatus(ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
|
||||
@@ -468,45 +480,65 @@ public class ApplicationAmendmentRequestDao {
|
||||
// List<AmendmentDetailsResponseBean> amendmentDetailsList =
|
||||
// Utils.convertJsonStringToList(applicationAmendmentRequestEntity.getAmendmentDocument(),
|
||||
// AmendmentDetailsResponseBean.class);
|
||||
AmendmentDetailsResponseBean amendmentDetails = Utils.convertStringToObject(applicationAmendmentRequestEntity.getAmendmentDocument() ,AmendmentDetailsResponseBean.class);
|
||||
if(amendmentDetails!=null) {
|
||||
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
|
||||
if (amendmentDetails.getAmendmentDocuments() != null) {
|
||||
// Extract the comma-separated document IDs as a string
|
||||
String documentIdsString = amendmentDetails.getAmendmentDocuments();
|
||||
AmendmentDetailsResponseBean amendmentDetails = Utils.convertStringToObject(applicationAmendmentRequestEntity.getAmendmentDocument(), AmendmentDetailsResponseBean.class);
|
||||
if (amendmentDetails != null) {
|
||||
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
|
||||
if (amendmentDetails.getAmendmentDocuments() != null) {
|
||||
// Extract the comma-separated document IDs as a string
|
||||
String documentIdsString = amendmentDetails.getAmendmentDocuments();
|
||||
|
||||
if (documentIdsString != null && !documentIdsString.trim().isEmpty()) {
|
||||
// Split the comma-separated values and process them
|
||||
List<String> documentIds = Arrays.stream(documentIdsString.split(","))
|
||||
.map(String::trim)
|
||||
.filter(id -> !id.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
if (documentIdsString != null && !documentIdsString.trim().isEmpty()) {
|
||||
// Split the comma-separated values and process them
|
||||
List<String> documentIds = Arrays.stream(documentIdsString.split(","))
|
||||
.map(String::trim)
|
||||
.filter(id -> !id.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
documentResponseBeans.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.setAmendmentNotes(amendmentDetails.getAmendmentNotes());
|
||||
response.setValid(amendmentDetails.getValid());
|
||||
}
|
||||
documentResponseBeans.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.setAmendmentNotes(amendmentDetails.getAmendmentNotes());
|
||||
response.setValid(amendmentDetails.getValid());
|
||||
}
|
||||
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);
|
||||
|
||||
return response;
|
||||
@@ -599,23 +631,7 @@ public class ApplicationAmendmentRequestDao {
|
||||
createFormField(formFields, fieldIdToLabelMap, amendmentFormField);
|
||||
|
||||
// Create document responses
|
||||
List<Long> documentIds = extractIds(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();
|
||||
List<DocumentResponseBean> documentResponseBeans = getDocumentResponseBean(amendmentFormField.getFieldValue());
|
||||
|
||||
// Map to application form field response bean
|
||||
ApplicationFormFieldEntity formFieldEntity = formFieldEntityMap.get(amendmentFormField.getFieldId());
|
||||
@@ -634,6 +650,27 @@ public class ApplicationAmendmentRequestDao {
|
||||
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) {
|
||||
if (userEntity.getBeneficiary() == null) {
|
||||
return "";
|
||||
@@ -1868,5 +1905,10 @@ public class ApplicationAmendmentRequestDao {
|
||||
log.info("Application submitted successfully for amendment", 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<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import com.amazonaws.services.dynamodbv2.xspec.L;
|
||||
import com.amazonaws.services.dynamodbv2.xspec.S;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -131,6 +132,9 @@ public class ApplicationDao {
|
||||
@Autowired
|
||||
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||
|
||||
@Autowired
|
||||
private CommunicationRepository communicationRepository;
|
||||
|
||||
// @Value("${default_System_Receiver_Email}")
|
||||
// private String defaultSystemReceiverEmail;
|
||||
|
||||
@@ -1372,7 +1376,7 @@ public class ApplicationDao {
|
||||
ApplicationSignedDocumentEntity oldApplicationSignedDocument = Utils.getClonedEntityForData(applicationSignedDocumentEntity);
|
||||
String oldS3Path = applicationSignedDocumentEntity.getFilePath();
|
||||
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);
|
||||
|
||||
UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(applicationSignedDocumentEntity.getFileName(), oldS3Path, newS3Path);
|
||||
@@ -1407,7 +1411,7 @@ public class ApplicationDao {
|
||||
}
|
||||
private String generateS3PathForDelegation(Long callId, Long applicationId) {
|
||||
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) {
|
||||
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));
|
||||
@@ -1529,11 +1533,12 @@ public class ApplicationDao {
|
||||
ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||
List<DocumentEntity> amendmentDocuments = fetchAmendmentDocuments(applicationId);
|
||||
List<DocumentEntity> evaluationDocuments = fetchEvaluationDocuments(applicationId);
|
||||
List<DocumentEntity> communicationnDocuments = fetchCommunicationDocuments(applicationId);
|
||||
if (documents.isEmpty() && signedDocument == null && amendmentDocuments.isEmpty() && evaluationDocuments.isEmpty()) {
|
||||
log.warn("No documents found for applicationId: {}", applicationId);
|
||||
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) {
|
||||
@@ -1582,6 +1587,28 @@ public class ApplicationDao {
|
||||
}
|
||||
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) {
|
||||
|
||||
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(amendmentRequestId).orElse(null);
|
||||
@@ -1603,12 +1630,12 @@ public class ApplicationDao {
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
Long callId = applicationEntity.getCall().getId();
|
||||
// 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) {
|
||||
String fileName = Utils.extractFileName(document.getFilePath());
|
||||
addDocumentToZip(zos, appS3Folder, document.getFilePath(), fileName);
|
||||
@@ -1616,7 +1643,7 @@ public class ApplicationDao {
|
||||
// Add Signed Document
|
||||
if (signedDocument != null) {
|
||||
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();
|
||||
addDocumentToZip(zos, signedDocS3Folder, signedDocument.getFilePath(), signedFolder + fileName);
|
||||
}
|
||||
@@ -1624,17 +1651,24 @@ public class ApplicationDao {
|
||||
for (DocumentEntity amendmentDocument : amendmentDocuments) {
|
||||
String protocolNumber = fetchProtocolNumberForAmendment(amendmentDocument.getSourceId());
|
||||
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());
|
||||
addDocumentToZip(zos, amendmentS3Folder, amendmentDocument.getFilePath(), amendmentFolder + fileName);
|
||||
}
|
||||
// Add Evaluation Documents
|
||||
for (DocumentEntity evaluationDocument : evaluationDocuments) {
|
||||
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());
|
||||
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();
|
||||
return zipOutputStream.toByteArray();
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -1942,17 +1942,17 @@ public class ApplicationEvaluationDao {
|
||||
log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId());
|
||||
}
|
||||
|
||||
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED)) {
|
||||
application.setStatus(newStatus.getValue());
|
||||
log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId());
|
||||
emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application,hub,existingEntity);
|
||||
application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||
responses = List.of(emailSendResponse);
|
||||
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
|
||||
}
|
||||
}
|
||||
// if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION_REJECTED)) {
|
||||
// application.setStatus(newStatus.getValue());
|
||||
// log.info("Application status updated to {} for applicationId: {}", newStatus, application.getId());
|
||||
// emailNotificationDao.sendMailForApplicationTechnicalEvaluationRejected(application,hub,existingEntity);
|
||||
// application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
// emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||
// responses = List.of(emailSendResponse);
|
||||
// if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||
// saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
|
||||
// }
|
||||
// }
|
||||
application = applicationRepository.save(application);
|
||||
|
||||
ApplicationEvaluationEntity oldApplicationEvaluation = Utils.getClonedEntityForData(existingEntity);
|
||||
@@ -2605,6 +2605,43 @@ public class ApplicationEvaluationDao {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1144,6 +1144,7 @@ public class AppointmentDao {
|
||||
richiestaCliente.setNota(requestNota);
|
||||
richiestaCliente.setDurataMesiFinanziamento(createAppointmentRequest.getDurataMesiFinanziamento());
|
||||
richiestaCliente.setImportoBreveTermine(createAppointmentRequest.getImportoBreveTermine());
|
||||
richiestaCliente.setDataAppuntamento(createAppointmentRequest.getDataAppuntamento());
|
||||
richiestaClienteList.add(richiestaCliente);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public class CallDao {
|
||||
|
||||
for (DocumentEntity document : documents) {
|
||||
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())) {
|
||||
String fileName = Utils.extractFileName(document.getFilePath());
|
||||
ZipEntry zipEntry = new ZipEntry(fileName);
|
||||
|
||||
@@ -5,13 +5,19 @@ import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
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.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.CommunicationRepository;
|
||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||
import net.gepafin.tendermanagement.service.DocumentService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
@@ -22,9 +28,12 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class CommunicationDao {
|
||||
@@ -45,17 +54,48 @@ public class CommunicationDao {
|
||||
@Autowired
|
||||
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...");
|
||||
CommunicationEntity communicationEntity = convertToCommunicationCommentEntity(communicationReq, amendmentId);
|
||||
communicationEntity = communicationRepository.save(communicationEntity);
|
||||
List<DocumentResponseBean> communicationDocumentBeans = new ArrayList<>();
|
||||
|
||||
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. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(communicationEntity).build());
|
||||
|
||||
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) {
|
||||
@@ -90,6 +130,7 @@ public class CommunicationDao {
|
||||
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
||||
|
||||
log.info("Updating communication comment...");
|
||||
|
||||
CommunicationEntity existingComment = communicationRepository.findById(commentId)
|
||||
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
||||
//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. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCommentData).newData(existingComment).build());
|
||||
|
||||
return convertToCommunicationResponseBean(existingComment);
|
||||
List<DocumentResponseBean> communicationDocumentBeans=getDocumentResponseBean(existingComment);
|
||||
return convertToCommunicationResponseBean(existingComment,communicationDocumentBeans);
|
||||
}
|
||||
|
||||
private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationEntity entity) {
|
||||
private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationEntity entity,List<DocumentResponseBean> communicationResponseBean) {
|
||||
|
||||
CommunicationResponseBean response = new CommunicationResponseBean();
|
||||
response.setComment(entity.getCommunicationComment());
|
||||
@@ -122,10 +163,11 @@ public class CommunicationDao {
|
||||
response.setSenderUserId(entity.getSenderUserId());
|
||||
response.setReceiverUserId(entity.getReceiverUserId());
|
||||
response.setId(entity.getId());
|
||||
response.setDocuments(communicationResponseBean);
|
||||
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);
|
||||
|
||||
@@ -136,12 +178,24 @@ public class CommunicationDao {
|
||||
communicationEntity.setIsDeleted(false);
|
||||
communicationEntity.setCommentedDate(LocalDateTime.now());
|
||||
if(validator.checkIsPreInstructor()){
|
||||
communicationEntity.setIntiatorType(CommunicationInitiatorTypeEnum.INSTRUCTOR.getValue());
|
||||
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
|
||||
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
|
||||
} 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.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class CompanyDocumentDao {
|
||||
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class DelegationDao {
|
||||
|
||||
public ByteArrayOutputStream generateDocument(Map<String, String> placeholders, String templateName) {
|
||||
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);
|
||||
XWPFDocument doc = loadTemplate(templateStream);
|
||||
replacePlaceholders(doc, placeholders);
|
||||
|
||||
@@ -89,6 +89,9 @@ public class DocumentDao {
|
||||
@Autowired
|
||||
private ApplicationEvaluationDao applicationEvaluationDao;
|
||||
|
||||
@Autowired
|
||||
private CommunicationRepository communicationRepository;
|
||||
|
||||
// @Value("${aws.s3.url.folder}")
|
||||
// private String s3Folder;
|
||||
|
||||
@@ -164,6 +167,7 @@ public class DocumentDao {
|
||||
Long applicationId = 0L;
|
||||
Long amendmentId = 0L;
|
||||
Long evaluationId = 0L;
|
||||
Long communicationId = 0L;
|
||||
Long callId = sourceId;
|
||||
if (type == DocumentSourceTypeEnum.APPLICATION) {
|
||||
applicationId = sourceId;
|
||||
@@ -181,9 +185,17 @@ public class DocumentDao {
|
||||
applicationId = applicationEntity.getId();
|
||||
callId = applicationEntity.getCall().getId();
|
||||
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 {
|
||||
String s3Path = generateS3Path(type, callId, applicationId, amendmentId);
|
||||
String s3Path = generateS3Path(type, callId, applicationId, amendmentId,communicationId);
|
||||
log.info("Generated S3 path {}", s3Path);
|
||||
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||
} 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 {
|
||||
return s3ConfigBean.generateDocumentPath(typeOfDocument, callId, applicationId, amendmentId);
|
||||
return s3ConfigBean.generateDocumentPath(typeOfDocument, callId, applicationId, amendmentId,communicationId);
|
||||
} catch (IllegalArgumentException e) {
|
||||
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 amendmentId = null;
|
||||
Long evaluationId = null;
|
||||
Long communicationId=null;
|
||||
|
||||
if (DocumentSourceTypeEnum.CALL.getValue().equalsIgnoreCase(documentEntity.getSource())) {
|
||||
callId = documentEntity.getSourceId();
|
||||
@@ -305,7 +318,7 @@ public class DocumentDao {
|
||||
callId = applicationEntity.getCall().getId();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -349,6 +362,7 @@ public class DocumentDao {
|
||||
Long applicationId=null;
|
||||
Long amendmentId=null;
|
||||
Long evaluationId=null;
|
||||
Long communicationId=null;
|
||||
if (type.equals(DocumentSourceTypeEnum.APPLICATION)) {
|
||||
callId = applicationRepository.findCallIdById(id);
|
||||
applicationId = id;
|
||||
@@ -366,6 +380,14 @@ public class DocumentDao {
|
||||
applicationId = applicationEntity.getId();
|
||||
callId = applicationEntity.getCall().getId();
|
||||
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 {
|
||||
@@ -373,7 +395,7 @@ public class DocumentDao {
|
||||
applicationId = 0L;
|
||||
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);
|
||||
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||
} catch (Exception e) {
|
||||
@@ -386,12 +408,12 @@ public class DocumentDao {
|
||||
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 {
|
||||
|
||||
DocumentEntity oldDocumentEntity = Utils.getClonedEntityForData(documentEntity);
|
||||
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);
|
||||
UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(documentEntity.getFileName(), oldS3Path, newS3Path);
|
||||
documentEntity.setFileName(response.getFileName());
|
||||
|
||||
@@ -94,6 +94,9 @@ public class EmailNotificationDao {
|
||||
@Autowired
|
||||
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
|
||||
|
||||
@Autowired
|
||||
private ApplicationDao applicationDao;
|
||||
|
||||
public void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType, Map<String, String> bodyPlaceholders,
|
||||
List<String> additionalRecipients, Long amendmentId) {
|
||||
|
||||
@@ -131,21 +134,35 @@ public class EmailNotificationDao {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> applicationEvaluationEntity = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationEntity.getId());
|
||||
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<>();
|
||||
S3DocxProcessor processor = new S3DocxProcessor(s3Client);
|
||||
List<String> urls=new ArrayList<>();
|
||||
Map<String, String> replacements=new HashMap<>();
|
||||
List<DocumentEntity> documentEntities=new ArrayList<>();
|
||||
if(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED)) {
|
||||
S3DocxProcessor processor = new S3DocxProcessor(s3Client);
|
||||
List<String> urls=new ArrayList<>();
|
||||
Map<String, String> replacements = Map.of(
|
||||
replacements = Map.of(
|
||||
"{call_name}", applicationEntity.getCall().getName(),
|
||||
"{amount_accepted}", String.valueOf(applicationEntity.getAmountAccepted()),
|
||||
"{pec}", "bandi.gepafin@legalmail.it"
|
||||
);
|
||||
List<DocumentEntity> documentEntities=documentRepository.findBySourceInAndIsDeletedFalse(List.of(applicationAmendmentRequest.getAmendmentDocumentType(),"MODELLO_AUTOCERTIFICAZIONE","MODELLO_PRIVACY"));
|
||||
urls = documentEntities.stream()
|
||||
.map(DocumentEntity::getFilePath) // or getUrl()
|
||||
.collect(Collectors.toList());
|
||||
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()
|
||||
.map(DocumentEntity::getFilePath) // or getUrl()
|
||||
.collect(Collectors.toList());
|
||||
if(Boolean.FALSE.equals(urls.isEmpty())) {
|
||||
Map<String, AttachmentRequest> processedFiles = null;
|
||||
try {
|
||||
processedFiles = processor.processFiles(urls, replacements);
|
||||
@@ -159,7 +176,6 @@ public class EmailNotificationDao {
|
||||
attachmentRequests.add(attachmentRequest);
|
||||
}
|
||||
}
|
||||
|
||||
UserWithCompanyEntity userWithCompany=companyService.getUserWithCompany(userEntity.getId(),company.getId());
|
||||
String companyEmail = userWithCompany.getEmail();
|
||||
String contactEmail = userWithCompany.getContactEmail();
|
||||
@@ -404,7 +420,7 @@ public class EmailNotificationDao {
|
||||
return emailConfig;
|
||||
}
|
||||
|
||||
private EmailConfig parseEmailConfig(String configJson) {
|
||||
private static EmailConfig parseEmailConfig(String configJson) {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
@@ -413,11 +429,27 @@ public class EmailNotificationDao {
|
||||
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);
|
||||
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE, bodyPlaceholders, null,
|
||||
null);
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
SystemEmailTemplateResponse systemEmailTemplateResponse1=new SystemEmailTemplateResponse();
|
||||
systemEmailTemplateResponse1.setSubject(subject);
|
||||
systemEmailTemplateResponse1.setHtmlContent(body);
|
||||
systemEmailTemplateResponse1.setEmailScenario(EmailScenarioTypeEnum.APPLICATION_TECHNICAL_EVALUATION_REJECTED);
|
||||
EmailContentResponse emailContentResponse=new EmailContentResponse(subject,body,systemEmailTemplateResponse1);
|
||||
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
|
||||
sendEmails(applicationEntity, userEntity, null,null,emailContentResponse.getSystemEmailTemplateResponse(),emailContentResponse.getSubject(),emailContentResponse.getBody());
|
||||
|
||||
}
|
||||
public Map<String, String> prepareEmailPlaceholdersForTechnicalEvaluationRejected(ApplicationEntity applicationEntity,HubEntity hub,ApplicationEvaluationEntity applicationEvaluationEntity) {
|
||||
Map<String, String> bodyPlaceholders = new HashMap<>();
|
||||
|
||||
@@ -15,26 +15,27 @@ public class S3PathConfig {
|
||||
@Autowired
|
||||
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);
|
||||
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);
|
||||
return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId,amendmentId);
|
||||
return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId,amendmentId,communicationId);
|
||||
}
|
||||
public String generateDocumentPathForDelegationAndSignedDocument(DocOtherSourceTypeEnum type) {
|
||||
|
||||
S3ConfigEntity config = getDocumentPathForOther(type);
|
||||
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
|
||||
.replace("{call_id}", callId != null && callId != 0L ? "call_" + callId : "")
|
||||
.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) {
|
||||
|
||||
@@ -74,4 +74,7 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
|
||||
@Column(name = "AMENDMENT_DOCUMENT_TYPE")
|
||||
private String amendmentDocumentType;
|
||||
|
||||
@Column(name = "AMENDMENT_INITIAL_DOCUMENT")
|
||||
private String amendmentInitialDocument;
|
||||
|
||||
}
|
||||
|
||||
@@ -79,4 +79,7 @@ public class ApplicationEntity extends BaseEntity {
|
||||
@Column(name="VAT_NUMBER")
|
||||
private String vatNumber;
|
||||
|
||||
@Column(name = "EMAIL_JSON")
|
||||
private String emailJson;
|
||||
|
||||
}
|
||||
@@ -35,4 +35,9 @@ public class CommunicationEntity extends BaseEntity {
|
||||
@JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false)
|
||||
private ApplicationAmendmentRequestEntity applicationAmendmentRequest;
|
||||
|
||||
@Column(name = "INITIATOR_TYPE")
|
||||
private String intiatorType;
|
||||
|
||||
@Column(name = "DOCUMENTS")
|
||||
private String documents;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ public enum DocumentSourceTypeEnum {
|
||||
|
||||
APPLICATION("APPLICATION"),
|
||||
EVALUATION("EVALUATION"),
|
||||
AMENDMENT("AMENDMENT");
|
||||
AMENDMENT("AMENDMENT"),
|
||||
COMMUNICATION("COMMUNICATION");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -223,7 +223,8 @@ public enum UserActionContextEnum {
|
||||
UPDATE_EXPIRED_CALL("UPDATE_EXPIRED_CALL"),
|
||||
RESEND_EMAIL("RESEND_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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -32,6 +33,7 @@ public class AppointmentCreationRequest {
|
||||
private String codProdotto;
|
||||
private String codOperazione;
|
||||
private Nota nota;
|
||||
private LocalDateTime dataAppuntamento;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -2,11 +2,14 @@ package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CreateAppointmentRequest {
|
||||
private Double importoBreveTermine;
|
||||
private Integer durataMesiFinanziamento;
|
||||
private Nota nota;
|
||||
private LocalDateTime dataAppuntamento;
|
||||
|
||||
@Data
|
||||
public static class Nota {
|
||||
|
||||
@@ -33,4 +33,5 @@ public class ApplicationAmendmentRequestResponse {
|
||||
private ApplicationAmendmentRequestEnum status;
|
||||
private String emailTemplate;
|
||||
private List<EmailSendResponse> emailSendResponse;
|
||||
private List<DocumentResponseBean> amendmentInitialDocuments;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.model.response;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CommunicationResponseBean {
|
||||
@@ -24,6 +25,8 @@ public class CommunicationResponseBean {
|
||||
|
||||
private Long amendmentId;
|
||||
|
||||
private List<DocumentResponseBean> documents;
|
||||
|
||||
public CommunicationResponseBean(LocalDateTime commentedDate, String comment, String title, LocalDateTime createdDate, LocalDateTime updatedDate, Long amendmentId, Long id) {
|
||||
|
||||
this.commentedDate = commentedDate;
|
||||
|
||||
@@ -17,4 +17,6 @@ public interface CommunicationRepository extends JpaRepository<CommunicationEnti
|
||||
List<CommunicationResponseBean> findCommentListDetailsByAmendmentId(@Param("amendmentId") Long amendmentId);
|
||||
|
||||
Optional<CommunicationEntity> findByIdAndIsDeletedFalse(Long commentId);
|
||||
|
||||
List<CommunicationEntity> findByApplicationAmendmentRequestIdInAndIsDeletedFalse(List<Long> amendmentId);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,13 @@ import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApplicationAmendmentRequestService {
|
||||
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);
|
||||
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
||||
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);
|
||||
|
||||
@@ -3,10 +3,7 @@ package net.gepafin.tendermanagement.service;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
|
||||
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.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -30,4 +27,5 @@ public interface ApplicationEvaluationService {
|
||||
|
||||
ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId);
|
||||
|
||||
ApplicationEvaluationResponse updateApplicationToTechnicalEvaluationRejected(HttpServletRequest request, ApplicationTechnicalEvaluationRejectedRequest applicationRequest, Long assignedApplicationsId);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,12 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepo
|
||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||
import net.gepafin.tendermanagement.service.UserService;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@@ -50,10 +53,15 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
||||
|
||||
@Override
|
||||
@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);
|
||||
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
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
|
||||
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.ApplicationEvaluationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean;
|
||||
@@ -106,6 +107,10 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
||||
return applicationEvaluationDao.getApplicationEvaluationVersion(request,applicationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationEvaluationResponse updateApplicationToTechnicalEvaluationRejected(HttpServletRequest request, ApplicationTechnicalEvaluationRejectedRequest applicationRequest, Long assignedApplicationsId) {
|
||||
return applicationEvaluationDao.updateApplicationToTechnicalEvaluationRejected(applicationRequest,assignedApplicationsId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
@@ -29,14 +31,14 @@ public class CommunicationServiceImpl implements CommunicationService {
|
||||
|
||||
@Override
|
||||
@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);
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) {
|
||||
validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId());
|
||||
} else {
|
||||
validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
|
||||
}
|
||||
return communicationDao.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId);
|
||||
return communicationDao.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId,files);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.gepafin.tendermanagement.dao.DocumentDao;
|
||||
import net.gepafin.tendermanagement.dao.S3PathConfig;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.CommunicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
@@ -25,6 +26,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -73,6 +75,9 @@ public class S3ReUploadMigrationService {
|
||||
@Autowired
|
||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||
|
||||
@Autowired
|
||||
private CommunicationRepository communicationRepository;
|
||||
|
||||
@Autowired
|
||||
private DocumentDao documentDao;
|
||||
|
||||
@@ -108,6 +113,7 @@ public class S3ReUploadMigrationService {
|
||||
Long applicationId = null;
|
||||
Long amendmentId = null;
|
||||
Long evaluationId = null;
|
||||
Long communicationId=null;
|
||||
if (DocumentSourceTypeEnum.CALL.getValue().equalsIgnoreCase(document.getSource())) {
|
||||
callId = document.getSourceId();
|
||||
} else if (DocumentSourceTypeEnum.APPLICATION.getValue().equalsIgnoreCase(document.getSource())) {
|
||||
@@ -125,10 +131,16 @@ public class S3ReUploadMigrationService {
|
||||
ApplicationEntity applicationEntity = applicationEvaluationRepository.findApplicationByEvaluationId(evaluationId);
|
||||
applicationId = applicationEntity.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++;
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -219,10 +231,10 @@ public class S3ReUploadMigrationService {
|
||||
Long callId;
|
||||
|
||||
if (sourceType.equals(DocumentSourceTypeEnum.CALL)) {
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L,0L);
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L,0L,0L);
|
||||
} else {
|
||||
callId = applicationRepository.findCallIdById(document.getSourceId());
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId(),0L);
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId(),0L,0L);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
|
||||
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) {
|
||||
|
||||
@@ -1095,6 +1095,22 @@ public class Utils {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,10 +45,16 @@ public interface ApplicationAmendmentRequestApi {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PostMapping(value = "", produces = "application/json")
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(HttpServletRequest request,
|
||||
@Parameter(description = "Application Evaluation Id", required = true) @RequestParam Long applicationEvaluationId,
|
||||
@Valid @RequestBody ApplicationAmendmentRequest applicationAmendmentRequest);
|
||||
@PostMapping(value = "", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(
|
||||
HttpServletRequest request,
|
||||
@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",
|
||||
responses = {
|
||||
|
||||
@@ -8,10 +8,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
|
||||
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.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
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);
|
||||
|
||||
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,12 +16,10 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
public interface CommunicationApi {
|
||||
@@ -32,10 +30,11 @@ public interface CommunicationApi {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PostMapping(value = "/{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')")
|
||||
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId);
|
||||
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, @Parameter(description = "List of files to upload", required = false)
|
||||
@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"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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 lombok.extern.log4j.Log4j2;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
@@ -19,6 +21,8 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -26,6 +30,9 @@ import java.util.List;
|
||||
@Log4j2
|
||||
public class ApplicationAmendmentRequestController implements ApplicationAmendmentRequestApi {
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper mapper;
|
||||
|
||||
@Autowired
|
||||
ApplicationAmendmentRequestService applicationAmendmentRequestService;
|
||||
|
||||
@@ -45,13 +52,18 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
||||
}
|
||||
|
||||
@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. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT)
|
||||
.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)
|
||||
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.CREATE_APPLICATION_DATA_FOR_AMENDMENT_MSG)));
|
||||
}
|
||||
|
||||
@@ -118,4 +118,15 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
.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)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/communication}")
|
||||
@@ -31,13 +34,13 @@ public class CommunicationController implements CommunicationApi {
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
||||
Long amendmentId) {
|
||||
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, List<MultipartFile> files, CommunicationRequestBean communicationRequestBean,
|
||||
Long amendmentId) {
|
||||
|
||||
/** 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());
|
||||
|
||||
CommunicationResponseBean communicationResponseBean = communicationService.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId);
|
||||
CommunicationResponseBean communicationResponseBean = communicationService.addCommentToAmendmentRequest(request,communicationRequestBean, amendmentId,files);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||
}
|
||||
|
||||
@@ -3035,4 +3035,38 @@
|
||||
<sqlFile dbms="postgresql" path="db/dump/insert_document_for_special_amendment.sql"/>
|
||||
</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>
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -413,4 +413,7 @@ email.pec.cannot.null=Email pec is required.
|
||||
user.request.completed=User request completed successfully.
|
||||
end.date.greater.than.now=End date must be greater than the current date and time.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -404,4 +404,5 @@ email.pec.cannot.null=L'indirizzo email pec
|
||||
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.
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user