diff --git a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java
index f6d9ac42..80f30960 100644
--- a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java
+++ b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java
@@ -112,6 +112,7 @@ public class GepafinConstant {
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.success";
+ public static final String GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG = "application.evaluation.version.get.success";
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found";
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.not.found";
public static final String FORM_ID_DOES_NOT_MACTHES = "Form.not.matches.to.call.initial.form";
@@ -408,5 +409,45 @@ public class GepafinConstant {
public static final String REQUIRED_REQUESTED_AMOUNT_MSG = "validation.required.requested.amount";
public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount";
+ public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
+
+ public static final String DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA= "\n" +
+ "
\n" +
+ "
\n" +
+ "
RICHIESTA INTEGRAZIONE DOCUMENTALE
\n" +
+ "
Buongiorno,
\n" +
+ "
In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Bando \n" +
+ " “{{call_name}}“ di cui al Protocollo n. {{protocol_number}} del\n" +
+ " {{protocol_date}} e {{protocol_time}}, alla luce dell'attività istruttoria svolta,\n" +
+ " segnaliamo quanto segue:\n" +
+ "
\n" +
+ " {{note}}\n" +
+ "
Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all'interno dello sportello\n" +
+ " online {{platform_link}} entro e non oltre {{response_days}} giorni dal ricevimento della presente comunicazione,\n" +
+ " precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.\n" +
+ "
\n" +
+ "
La documentazione trasmessa e le informazioni fornite saranno processate dall'istruttore assegnatario della pratica.\n" +
+ "
Si comunica che, in riferimento alla domanda a valere sul bando “{{call_name}}” di cui al\n" +
+ " Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}},\n" +
+ " la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.
\n" +
+ "
Le motivazioni sono le seguenti: {{form_text}}
\n" +
+ "
Vi ricordiamo che i Beneficiari che hanno presentato richieste valutate non ammissibili entro 10 giorni dalla data di ricevimento della presente potranno finoltrare richiesta di chiarimenti e/o osservazioni alla scrivente Società ai sensi e per gli effetti dell’art.10 bis della L.241/1990 e s.m.i.
\n" +
+ "
Distinti Saluti,
\n" +
+ "
{{email_signature}}
\n" +
+ "
\n" +
+ " \n" +
+ "";
}
diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java
index 3579b90c..75ce444c 100644
--- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java
+++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java
@@ -139,6 +139,10 @@ public class ApplicationEvaluationDao {
@Autowired
private EvaluationFormRepository evaluationFormRepository;
+ @Autowired
+ private ObjectMapper objectMapper;
+
+
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
@@ -1942,13 +1946,27 @@ public class ApplicationEvaluationDao {
return convertToResponse(savedEntity);
}
- public ApplicationEvaluationResponseBean createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long evaluationFormId, Long assignedApplicationId){
+ public ApplicationEvaluationFormResponse createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long evaluationFormId, Long assignedApplicationId){
+
+ UserEntity user = validator.validateUser(request);
+ AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
+ ApplicationEntity application = applicationService.validateApplication(assignedApplicationsEntity.getApplication().getId());
+
+ // Convert FormRequestBean to ApplicationEvaluationRequest
+ ApplicationEvaluationRequest req = convertToApplicationEvaluationRequest(applicationEvaluationFormRequestBean);
+
+ // Call the existing method to create or update evaluation
+ ApplicationEvaluationResponse evaluationResponse = createOrUpdateApplicationEvaluation(user, req, assignedApplicationId);
+
+ ApplicationEvaluationEntity entity = applicationEvaluationService.validateApplicationEvaluation(evaluationResponse.getId());
+
+ //Handling Application Evaluation form
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
- validateFormFields(applicationRequestBean,evaluationFormEntity);
- ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
- ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,applicationEvaluationEntity);
- createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
- return getEvaluationById(applicationEvaluationEntity.getId(),evaluationFormEntity.getId());
+ validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
+// ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
+ ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
+ createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
+ return processEvaluationForm(entity);
}
private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) {
@@ -1975,7 +1993,7 @@ public class ApplicationEvaluationDao {
return saveApplicationEvaluationFormEntity(applicationEvaluationFormEntity);
}
- public void validateFormFields(ApplicationRequestBean request, EvaluationFormEntity evaluationFormEntity) {
+ public void validateFormFields(ApplicationEvaluationFormRequestBean request, EvaluationFormEntity evaluationFormEntity) {
List contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
@@ -2070,17 +2088,6 @@ public class ApplicationEvaluationDao {
return documentIds;
}
- public ApplicationEvaluationResponseBean getEvaluationById(Long evaluationId, Long evaluationFormId){
- ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(evaluationId);
-
- ApplicationEvaluationFormEntity applicationEvaluationFormEntity = applicationEvaluationFormRepository.findByEvaluationIdAndEvaluationFormId(applicationEvaluationEntity.getId(),evaluationFormId);
- List applicationEvaluationFormFieldEntities = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
- List evaluationFormFieldResponseBeans = createEvaluationFormFieldResponse(applicationEvaluationFormFieldEntities, applicationEvaluationFormEntity);
- ApplicationEvaluationResponseBean applicationEvaluationResponseBean = convertApplicationEvaluationEntityToApplicationEvaluationResponseBean(applicationEvaluationEntity);
- applicationEvaluationResponseBean.setFormFields(evaluationFormFieldResponseBeans);
-
- return applicationEvaluationResponseBean;
- }
private List createEvaluationFormFieldResponse(
List evaluationFormFieldEntities,
@@ -2137,15 +2144,39 @@ public class ApplicationEvaluationDao {
return applicationEvaluationFormFieldReponseBean;
}
- private ApplicationEvaluationResponseBean convertApplicationEvaluationEntityToApplicationEvaluationResponseBean(ApplicationEvaluationEntity entity){
- ApplicationEvaluationResponseBean response = new ApplicationEvaluationResponseBean();
- response.setId(entity.getId());
- response.setApplicationId(entity.getApplicationId());
- response.setEvaluationId(entity.getId());
- response.setNote(entity.getNote());
- response.setEvaluationVersion(EvaluationVersionEnum.valueOf(entity.getEvaluationVersion()));
- response.setCreatedDate(entity.getCreatedDate());
- response.setUpdatedDate(entity.getUpdatedDate());
+ private ApplicationEvaluationFormResponse convertToApplicationEvaluationResponseBean(ApplicationEvaluationResponse applicationEvaluationResponse){
+ ApplicationEvaluationFormResponse response = new ApplicationEvaluationFormResponse();
+ response.setId(applicationEvaluationResponse.getId());
+ response.setApplicationId(applicationEvaluationResponse.getApplicationId());
+ response.setNote(applicationEvaluationResponse.getNote());
+ response.setEvaluationVersion(applicationEvaluationResponse.getEvaluationVersion());
+ response.setCreatedDate(applicationEvaluationResponse.getCreatedDate());
+ response.setUpdatedDate(applicationEvaluationResponse.getUpdatedDate());
+ response.setApplicationStatus(applicationEvaluationResponse.getApplicationStatus());
+ response.setAssignedApplicationId(applicationEvaluationResponse.getAssignedApplicationId());
+ response.setMinScore(applicationEvaluationResponse.getMinScore());
+ response.setStatus(applicationEvaluationResponse.getStatus());
+ response.setFiles(applicationEvaluationResponse.getFiles());
+ response.setEvaluationDocument(applicationEvaluationResponse.getEvaluationDocument());
+ response.setAmendmentDetails(applicationEvaluationResponse.getAmendmentDetails());
+ response.setBeneficiary(applicationEvaluationResponse.getBeneficiary());
+ response.setAssignedUserId(applicationEvaluationResponse.getAssignedUserId());
+ response.setAssignedUserName(applicationEvaluationResponse.getAssignedUserName());
+ response.setProtocolNumber(applicationEvaluationResponse.getProtocolNumber());
+ response.setCallName(applicationEvaluationResponse.getCallName());
+ response.setMotivation(applicationEvaluationResponse.getMotivation());
+ response.setSubmissionDate(applicationEvaluationResponse.getSubmissionDate());
+ response.setEvaluationEndDate(applicationEvaluationResponse.getEvaluationEndDate());
+ response.setCallEndDate(applicationEvaluationResponse.getCallEndDate());
+ response.setCompanyName(applicationEvaluationResponse.getCompanyName());
+ response.setAssignedAt(applicationEvaluationResponse.getAssignedAt());
+ response.setNdg(applicationEvaluationResponse.getNdg());
+ response.setAppointmentId(applicationEvaluationResponse.getAppointmentId());
+ response.setAmountRequested(applicationEvaluationResponse.getAmountRequested());
+ response.setAmountAccepted(applicationEvaluationResponse.getAmountAccepted());
+ response.setDateAccepted(applicationEvaluationResponse.getDateAccepted());
+ response.setDateRejected(applicationEvaluationResponse.getDateRejected());
+
return response;
}
@@ -2161,17 +2192,13 @@ public class ApplicationEvaluationDao {
}
private ApplicationEvaluationFormResponse processEvaluationForm(ApplicationEvaluationEntity evaluationEntity){
- ApplicationEvaluationFormResponse response = new ApplicationEvaluationFormResponse();
- response.setApplicationId(evaluationEntity.getApplicationId());
- response.setNote(evaluationEntity.getNote());
- response.setStatus(evaluationEntity.getStatus());
- response.setEvaluationVersion(EvaluationVersionEnum.valueOf(evaluationEntity.getEvaluationVersion()));
- response.setAssignedApplicationId(evaluationEntity.getAssignedApplicationsEntity().getId());
+ Object convertedResponse = convertToResponse(evaluationEntity);
+
+ ApplicationEvaluationFormResponse response = objectMapper.convertValue(convertedResponse, ApplicationEvaluationFormResponse.class);
EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByCallIdAndIsDeletedFalse(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getId());
if (evaluationFormEntity != null) {
- response.setEvaluationFormId(evaluationFormEntity.getId());
response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity));
}
@@ -2201,5 +2228,38 @@ public class ApplicationEvaluationDao {
return evaluationFormResponseBean;
}
+ public ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId){
+
+ log.info("Fetching application evaluation version with ID: {}", applicationId);
+
+ ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
+ return buildApplicationEvaluationVersionResponse(applicationEntity);
+
+ }
+ private ApplicationEvaluationVersionResponse buildApplicationEvaluationVersionResponse(ApplicationEntity applicationEntity) {
+ ApplicationEvaluationVersionResponse response = new ApplicationEvaluationVersionResponse();
+ response.setApplicationId(applicationEntity.getId());
+ response.setCallId(applicationEntity.getCall().getId());
+ response.setCompanyId(applicationEntity.getCompanyId());
+ response.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationEntity.getEvaluationVersion()));
+ response.setEvaluationId(applicationEntity.getApplicationEvaluationId());
+ return response;
+ }
+
+ public static ApplicationEvaluationRequest convertToApplicationEvaluationRequest(ApplicationEvaluationFormRequestBean formRequestBean) {
+ ApplicationEvaluationRequest request = new ApplicationEvaluationRequest();
+ request.setFiles(formRequestBean.getFiles());
+ request.setEvaluationDocument(formRequestBean.getEvaluationDocument());
+ request.setAmendmentDetails(formRequestBean.getAmendmentDetails());
+ request.setNote(formRequestBean.getNote());
+ request.setApplicationStatus(formRequestBean.getApplicationStatus());
+ request.setMotivation(formRequestBean.getMotivation());
+ request.setAmountAccepted(formRequestBean.getAmountAccepted());
+
+ request.setCriteria(null);
+ request.setChecklist(null);
+
+ return request;
+ }
}
diff --git a/src/main/java/net/gepafin/tendermanagement/dao/CompanyDao.java b/src/main/java/net/gepafin/tendermanagement/dao/CompanyDao.java
index b014b779..3a527d9f 100644
--- a/src/main/java/net/gepafin/tendermanagement/dao/CompanyDao.java
+++ b/src/main/java/net/gepafin/tendermanagement/dao/CompanyDao.java
@@ -230,8 +230,8 @@ public class CompanyDao {
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson);
}
- setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, userWithCompanyEntity.getPec());
- setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, userWithCompanyEntity.getEmail());
+ setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, companyRequest.getPec());
+ setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, companyRequest.getEmail());
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());
setIfUpdated(userWithCompanyEntity::getContactEmail, userWithCompanyEntity::setContactEmail, companyRequest.getContactEmail());
setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant());
diff --git a/src/main/java/net/gepafin/tendermanagement/dao/DashboardDao.java b/src/main/java/net/gepafin/tendermanagement/dao/DashboardDao.java
index 5b705fd9..3da577dc 100644
--- a/src/main/java/net/gepafin/tendermanagement/dao/DashboardDao.java
+++ b/src/main/java/net/gepafin/tendermanagement/dao/DashboardDao.java
@@ -1,5 +1,7 @@
package net.gepafin.tendermanagement.dao;
+import jakarta.servlet.http.HttpServletRequest;
+import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.CompanyEntity;
import net.gepafin.tendermanagement.entities.UserEntity;
@@ -10,6 +12,9 @@ import net.gepafin.tendermanagement.model.response.*;
import net.gepafin.tendermanagement.repositories.*;
import net.gepafin.tendermanagement.service.CompanyService;
import net.gepafin.tendermanagement.util.Validator;
+import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
+import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
+import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -278,14 +283,16 @@ public class DashboardDao {
AmendmentWidgetResponseBean amendmentWidgetResponseBean = initializeAmendmentResponseBean();
Long hubId = userEntity.getHub().getId();
- List applicationIds = getApplicationIdsForUserOrHub(userEntity,hubId);
+ List applicationIds = getApplicationIdsForUserOrHub(userEntity,hubId,null);
setAmendmentCounts(applicationIds,amendmentWidgetResponseBean, hubId);
calculateExpiringRequestsIn48Hours(applicationIds,amendmentWidgetResponseBean, hubId);
calculateAverageResponseDays(applicationIds,amendmentWidgetResponseBean,hubId);
return amendmentWidgetResponseBean;
}
- public List getApplicationIdsForUserOrHub(UserEntity userEntity, Long hubId) {
- if (validator.checkIsPreInstructor()) {
+ public List getApplicationIdsForUserOrHub(UserEntity userEntity, Long hubId , Long userId) {
+ if (userId != null) {
+ return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userId);
+ } else if (validator.checkIsPreInstructor()) {
return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userEntity.getId());
} else {
return applicationRepository.findApplicationIdsByHubId(hubId);
@@ -423,23 +430,34 @@ public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(
.build())
.build();
}
- public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(UserEntity userEntity) {
+ public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request, Long userId) {
+ UserEntity userEntity = validator.validateUser(request);
+ if (validator.checkIsPreInstructor() && userId == null) {
+ throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
+ }
+ if (userId != null) {
+ validator.validatePreInstructor(request, userId);
+ if (validator.checkIsInstructorManager() && !userEntity.getId().equals(userId)) {
+ throw new ForbiddenAccessException(Status.FORBIDDEN,
+ Translator.toLocale(GepafinConstant.PERMISSION_DENIED));
+ }
+ }
PreInstructorWidgetResponseBean preInstructorWidgetResponseBean = initializeDashboardPreInstructorResponseBean();
Long hubId = userEntity.getHub().getId();
- List applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId);
+ List applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId,userId);
setPreInstructorWidgets(applicationIds, preInstructorWidgetResponseBean,hubId);
calculateAverageEvaluationTime(applicationIds, preInstructorWidgetResponseBean, hubId);
return preInstructorWidgetResponseBean;
}
private void setPreInstructorWidgets(List applicationIds, PreInstructorWidgetResponseBean responseBean,Long hubId) {
-
- Long totalAssignedApplications = assignedApplicationsRepository.countAssignedApplicationsByApplicationIds(applicationIds);
+ List assignedApplicationStatus = Arrays.asList(AssignedApplicationEnum.AWAITING.getValue(), AssignedApplicationEnum.OPEN.getValue());
+ Long totalAssignedApplications = assignedApplicationsRepository.countAssignedApplicationsByApplicationIds(applicationIds,assignedApplicationStatus);
if (totalAssignedApplications != null) {
responseBean.getAssignedApplication().setTotalAssignedApplication(totalAssignedApplications);
}
LocalDateTime yesterday = LocalDateTime.now().minusDays(1);
- Long newApplicationsAddedYesterday = assignedApplicationsRepository.countApplicationsAddedYesterdayForHub(applicationIds, hubId, yesterday);
+ Long newApplicationsAddedYesterday = assignedApplicationsRepository.countApplicationsAddedYesterdayForHub(applicationIds, hubId, yesterday,assignedApplicationStatus);
if (newApplicationsAddedYesterday != null && totalAssignedApplications != null && totalAssignedApplications > 0) {
BigDecimal percentageAdded = BigDecimal.valueOf(newApplicationsAddedYesterday)
.divide(BigDecimal.valueOf(totalAssignedApplications), 4, RoundingMode.HALF_UP)
@@ -449,17 +467,17 @@ public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(
List statuses = Arrays.asList(ApplicationStatusTypeEnum.APPROVED.getValue(), ApplicationStatusTypeEnum.REJECTED.getValue());
LocalDateTime sevenDaysAgo = LocalDateTime.now().minusDays(7);
- Long evaluatedApplication = applicationRepository.countEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
+ Long evaluatedApplication = assignedApplicationsRepository.countEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
if (evaluatedApplication != null) {
responseBean.getEvaluatedApplication().setEvaluatedApplication(evaluatedApplication);
- BigDecimal dailyAverage = applicationRepository.countDailyAverageEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
+ BigDecimal dailyAverage = assignedApplicationsRepository.countDailyAverageEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
if (dailyAverage != null) {
responseBean.getEvaluatedApplication().setDailyAverage(dailyAverage.setScale(2, RoundingMode.HALF_UP)); // Rounded to 2 decimal places
}
}
-
- Long rescueInstructorsInProgress = assignedApplicationsRepository.countApplicationsByIdsAndStatus(applicationIds, AssignedApplicationEnum.SOCCORSO.getValue());
+ List amendmentStatus =Arrays.asList( ApplicationAmendmentRequestEnum.AWAITING.getValue(), ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue());
+ Long rescueInstructorsInProgress = applicationAmendmentRequestRepository.countAmendmentsByApplicationIds(applicationIds,amendmentStatus);
if (rescueInstructorsInProgress != null) {
responseBean.getAmendmentInProgress().setTotalAmendmentInProgress(rescueInstructorsInProgress);
}
diff --git a/src/main/java/net/gepafin/tendermanagement/dao/EmailNotificationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/EmailNotificationDao.java
index 3988b35a..8133e5f7 100644
--- a/src/main/java/net/gepafin/tendermanagement/dao/EmailNotificationDao.java
+++ b/src/main/java/net/gepafin/tendermanagement/dao/EmailNotificationDao.java
@@ -94,7 +94,19 @@ public class EmailNotificationDao {
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// bodyPlaceholders.put("{{legal_mail}}", legalMail);
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
- String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
+ String body;
+ if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST)) {
+ bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
+ bodyPlaceholders.put("{{platform_link}}",hubEntity.getDomainName());
+ body = Utils.replacePlaceholders(GepafinConstant.DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA, bodyPlaceholders);
+ }
+ else if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE)) {
+ bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
+ body = Utils.replacePlaceholders(GepafinConstant.APPLICATION_REJECTED_SVILUPPUMBRIA, bodyPlaceholders);
+ }
+ else {
+ body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
+ }
return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
}
diff --git a/src/main/java/net/gepafin/tendermanagement/dao/FormDao.java b/src/main/java/net/gepafin/tendermanagement/dao/FormDao.java
index 1c7ed019..4311076f 100644
--- a/src/main/java/net/gepafin/tendermanagement/dao/FormDao.java
+++ b/src/main/java/net/gepafin/tendermanagement/dao/FormDao.java
@@ -1,9 +1,12 @@
package net.gepafin.tendermanagement.dao;
import jakarta.servlet.http.HttpServletRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.*;
+import net.gepafin.tendermanagement.enums.CallStatusEnum;
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
@@ -35,6 +38,8 @@ import java.util.stream.Collectors;
@Component
public class FormDao {
+ private final Logger log = LoggerFactory.getLogger(FormDao.class);
+
@Autowired
private FormRepository formRepository;
@@ -118,6 +123,10 @@ public class FormDao {
//cloned entity for old call data.
CallEntity oldCallData = Utils.getClonedEntityForData(callEntity);
+ if(callEntity.getStatus().equals(CallStatusEnum.PUBLISH.getValue())) {
+ throw new CustomValidationException(Status.VALIDATION_ERROR,
+ Translator.toLocale(GepafinConstant.PUBLISHED_CALL_NOT_UPDATE));
+ }
List flowDataEntities = flowDataRepository.findByCallId(callEntity.getId());
List flowEdgesEntities = flowEdgesRepository.findByCallId(callEntity.getId());
if (Boolean.FALSE.equals(flowDataEntities.isEmpty() || flowDataEntities == null) || Boolean.FALSE.equals(flowEdgesEntities.isEmpty() || flowEdgesEntities == null)) {
@@ -198,8 +207,9 @@ public class FormDao {
String formFieldId,Long evaluationCriteriaId) {
EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId);
if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) {
- throw new CustomValidationException(Status.VALIDATION_ERROR,
- Translator.toLocale(GepafinConstant.EVALUATIONCRITERIA_INVALID));
+ log.info("This evaluation criterion does not belong to the current call. Expected Call ID = {}, Found Call ID = {}",
+ callEntity.getId(), evaluationCriteria.getCall().getId());
+ return;
}
CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity();
criteriaFormField.setCallId(callEntity.getId());
@@ -466,7 +476,9 @@ public class FormDao {
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
String fieldValue = getFieldValue(contentResponseBean);
- validator.isRequired(value, fieldValidatorBean.getIsRequired(), fieldValue);
+
+ validator.isRequired(value, fieldValidatorBean.getIsRequired(), fieldValue)
+ .validateCustomTableValidation(value,fieldValidatorBean.getCustom(),fieldValue,contentResponseBean);
});
if (Boolean.TRUE.equals(isSendValidationError)) {
validator.validate();
diff --git a/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java b/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java
index 8be69097..8247c321 100644
--- a/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java
+++ b/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java
@@ -152,6 +152,31 @@ public class PdfDao {
// Create value cell with rounded corners
PdfPTable valueTable = new PdfPTable(1);
valueTable.setWidthPercentage(100);
+
+
+ Object finalValue = value;
+ List