Done ticket GEPAFINBE-6147 & contract document issue
This commit is contained in:
@@ -633,6 +633,7 @@ public class GepafinConstant {
|
|||||||
public static final String SUBJECT_AND_BODY_REQUIRED="subject.body.required";
|
public static final String SUBJECT_AND_BODY_REQUIRED="subject.body.required";
|
||||||
public static final String MAIL_SENT_SUCCESSFULLY="mail.send.successfully";
|
public static final String MAIL_SENT_SUCCESSFULLY="mail.send.successfully";
|
||||||
public static final String EMAIL_LOG_FETCHED="email.log.fetched";
|
public static final String EMAIL_LOG_FETCHED="email.log.fetched";
|
||||||
|
public static final String APPLICATION_AMENDMENT_APPROPIATE_STATUS="amendment.appropiate.status";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1130,8 +1130,12 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
public ApplicationAmendmentRequestResponse closeAmendmentRequest(Long id, CloseAmendmentRequest closeAmendmentRequest) {
|
public ApplicationAmendmentRequestResponse closeAmendmentRequest(Long id, CloseAmendmentRequest closeAmendmentRequest) {
|
||||||
|
|
||||||
log.info("Closing application amendement with ID: {}", id);
|
log.info("Closing application amendement with ID: {}", id);
|
||||||
ApplicationAmendmentRequestEntity existingApplicationAmendment = validatApplicationAmendmentRequestByListStatus(id,List.of(ApplicationAmendmentRequestEnum.AWAITING.getValue(),ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue()));
|
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
|
||||||
//cloned entity for old data and versioning
|
//cloned entity for old data and versioning
|
||||||
|
if(Boolean.TRUE.equals(existingApplicationAmendment.getStatus().equals(ApplicationAmendmentRequestEnum.CLOSE.getValue()))
|
||||||
|
|| Boolean.TRUE.equals(existingApplicationAmendment.getStatus().equals(ApplicationAmendmentRequestEnum.EXPIRED.getValue()))) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_APPROPIATE_STATUS));
|
||||||
|
}
|
||||||
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
|
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
|
||||||
List<ApplicationAmendmentRequestEntity> amendmentRequestList = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(
|
List<ApplicationAmendmentRequestEntity> amendmentRequestList = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(
|
||||||
existingApplicationAmendment.getApplicationEvaluationEntity().getId()
|
existingApplicationAmendment.getApplicationEvaluationEntity().getId()
|
||||||
@@ -1215,7 +1219,11 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
|
|
||||||
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
|
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
|
||||||
log.info("Extending response days for Application Amendment ID: {}, Additional Days: {}", id, newResponseDays);
|
log.info("Extending response days for Application Amendment ID: {}, Additional Days: {}", id, newResponseDays);
|
||||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validatApplicationAmendmentRequestByStatus(id,ApplicationAmendmentRequestEnum.EXPIRED.getValue());
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
||||||
|
if(Boolean.TRUE.equals(applicationAmendmentRequestEntity.getStatus().equals(ApplicationAmendmentRequestEnum.CLOSE.getValue()))
|
||||||
|
|| Boolean.TRUE.equals(applicationAmendmentRequestEntity.getStatus().equals(ApplicationAmendmentRequestEnum.AWAITING.getValue()))) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_APPROPIATE_STATUS));
|
||||||
|
}
|
||||||
log.info("Extending response days for Application Amendment ID: {}, Additional Days: {}", id, newResponseDays);
|
log.info("Extending response days for Application Amendment ID: {}, Additional Days: {}", id, newResponseDays);
|
||||||
|
|
||||||
if (newResponseDays != null && newResponseDays > 0) {
|
if (newResponseDays != null && newResponseDays > 0) {
|
||||||
@@ -1777,14 +1785,14 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
amendment.setEmailSendResponse(mergedResponses);
|
amendment.setEmailSendResponse(mergedResponses);
|
||||||
applicationAmendmentRequestRepository.save(amendment);
|
applicationAmendmentRequestRepository.save(amendment);
|
||||||
}
|
}
|
||||||
public ApplicationAmendmentRequestEntity validatApplicationAmendmentRequestByListStatus(Long id,List<String> status) {
|
// public ApplicationAmendmentRequestEntity validatApplicationAmendmentRequestByListStatus(Long id,List<String> status) {
|
||||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalseAndStatusIn(id, status);
|
// ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id, status);
|
||||||
if (applicationAmendmentRequestEntity == null) {
|
// if (applicationAmendmentRequestEntity == null) {
|
||||||
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
// throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
|
// Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
|
||||||
}
|
// }
|
||||||
return applicationAmendmentRequestEntity;
|
// return applicationAmendmentRequestEntity;
|
||||||
}
|
// }
|
||||||
public long calculateSuspendedDays(List<ApplicationAmendmentRequestEntity> amendments) {
|
public long calculateSuspendedDays(List<ApplicationAmendmentRequestEntity> amendments) {
|
||||||
List<Pair<LocalDateTime, LocalDateTime>> periods = amendments.stream()
|
List<Pair<LocalDateTime, LocalDateTime>> periods = amendments.stream()
|
||||||
.filter(amendmentRequest -> amendmentRequest.getStartDate() != null)
|
.filter(amendmentRequest -> amendmentRequest.getStartDate() != null)
|
||||||
|
|||||||
@@ -1688,7 +1688,7 @@ public class ApplicationDao {
|
|||||||
for (DocumentEntity contractDocument : contractDocuments) {
|
for (DocumentEntity contractDocument : contractDocuments) {
|
||||||
ApplicationContractEntity applicationContractEntity=applicationContractRepository.findByIdAndIsDeletedFalse(contractDocument.getSourceId());
|
ApplicationContractEntity applicationContractEntity=applicationContractRepository.findByIdAndIsDeletedFalse(contractDocument.getSourceId());
|
||||||
String contractFolder = "CONTRACT/";
|
String contractFolder = "CONTRACT/";
|
||||||
String contractS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CONTRACT, callId, applicationId, 0L,contractDocument.getSourceId(),applicationContractEntity.getApplicationId());
|
String contractS3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CONTRACT, callId, applicationId, 0L,0L,applicationContractEntity.getId());
|
||||||
String fileName = Utils.extractFileName(contractDocument.getFilePath());
|
String fileName = Utils.extractFileName(contractDocument.getFilePath());
|
||||||
addDocumentToZip(zos, contractS3Folder, contractDocument.getFilePath(), contractFolder + fileName);
|
addDocumentToZip(zos, contractS3Folder, contractDocument.getFilePath(), contractFolder + fileName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
|
|||||||
|
|
||||||
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
|
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
|
||||||
"WHERE a.isDeleted = false " +
|
"WHERE a.isDeleted = false " +
|
||||||
"AND a.status NOT IN('CLOSE','EXPIRED') " +
|
"AND a.status NOT IN('CLOSE','EXPIRED','RESPONSE_RECEIVED') " +
|
||||||
"AND a.endDate < :currentTime")
|
"AND a.endDate < :currentTime")
|
||||||
List<ApplicationAmendmentRequestEntity> findAmendmentsDueForExpiration(LocalDateTime currentTime);
|
List<ApplicationAmendmentRequestEntity> findAmendmentsDueForExpiration(LocalDateTime currentTime);
|
||||||
|
|
||||||
|
|||||||
@@ -425,3 +425,6 @@ application.contract.already.exist=Application contract already exist for this a
|
|||||||
application.not.approved=Application is not approved.
|
application.not.approved=Application is not approved.
|
||||||
subject.body.required=Subject and body is required to create contract.
|
subject.body.required=Subject and body is required to create contract.
|
||||||
mail.send.successfully=Mail sent succesfully.
|
mail.send.successfully=Mail sent succesfully.
|
||||||
|
email.log.fetched=Email log fetched successfully.
|
||||||
|
amendment.appropiate.status=Application amendment is not in appropiate status for this operation.
|
||||||
|
|
||||||
|
|||||||
@@ -416,3 +416,5 @@ application.contract.already.exist=Il contratto di applicazione esiste gi
|
|||||||
application.not.approved=La domanda non è stata approvata.
|
application.not.approved=La domanda non è stata approvata.
|
||||||
subject.body.required=Per creare un contratto sono necessari oggetto e corpo.
|
subject.body.required=Per creare un contratto sono necessari oggetto e corpo.
|
||||||
mail.send.successfully=Email inviata con successo.
|
mail.send.successfully=Email inviata con successo.
|
||||||
|
email.log.fetched=Registro email recuperato correttamente.
|
||||||
|
amendment.appropiate.status=L'emendamento dell'applicazione non è in stato appropriato per questa operazione.
|
||||||
|
|||||||
Reference in New Issue
Block a user