Resolved conflicts

This commit is contained in:
rajesh
2025-02-06 15:26:47 +05:30
31 changed files with 523 additions and 148 deletions

View File

@@ -112,6 +112,7 @@ public class GepafinConstant {
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success"; 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 DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.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_NOT_FOUND_MSG = "application.not.found";
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.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"; 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 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 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= "<html>\n" +
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
" <p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>\n" +
" <p>Buongiorno,</p>\n" +
" <p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Bando \n" +
" “<strong>{{call_name}}</strong>“ di cui al <strong>Protocollo n. {{protocol_number}} del\n" +
" {{protocol_date}} e {{protocol_time}}</strong>, alla luce dell'attività istruttoria svolta,\n" +
" segnaliamo quanto segue:\n" +
" </p>\n" +
" {{note}}\n" +
" <p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all'interno dello sportello\n" +
" online <a href=\"{{platform_link}}\">{{platform_link}}</a> entro e <strong>non oltre {{response_days}} giorni</strong> 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" +
" </p>\n" +
" <p>La documentazione trasmessa e le informazioni fornite saranno processate dall'istruttore assegnatario della pratica.\n" +
" </p>\n" +
" <p>Distinti Saluti,</p>\n" +
" <p><strong>{{email_signature}}</strong></p>\n" +
" </div>\n" +
" </body>\n" +
"</html>";
public static final String APPLICATION_REJECTED_SVILUPPUMBRIA = "<html>\n" +
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
" <p>Buongiorno,</p>\n" +
" <p>Si comunica che, in riferimento alla domanda a valere sul bando “<strong>{{call_name}}</strong>” di cui al\n" +
" <strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,\n" +
" la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.</p>\n" +
" <p>Le motivazioni sono le seguenti: <strong>{{form_text}}</strong></p>\n" +
" <p>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 dellart.10 bis della L.241/1990 e s.m.i.</p>\n" +
" <p>Distinti Saluti,</p>\n" +
" <p><strong>{{email_signature}}</strong></p>\n" +
" </div>\n" +
" </body>\n" +
"</html>";
} }

View File

@@ -139,6 +139,10 @@ public class ApplicationEvaluationDao {
@Autowired @Autowired
private EvaluationFormRepository evaluationFormRepository; private EvaluationFormRepository evaluationFormRepository;
@Autowired
private ObjectMapper objectMapper;
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) { private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity(); ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
@@ -1942,13 +1946,27 @@ public class ApplicationEvaluationDao {
return convertToResponse(savedEntity); 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); EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
validateFormFields(applicationRequestBean,evaluationFormEntity); validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId); // ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,applicationEvaluationEntity); ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity); createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
return getEvaluationById(applicationEvaluationEntity.getId(),evaluationFormEntity.getId()); return processEvaluationForm(entity);
} }
private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) { private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) {
@@ -1975,7 +1993,7 @@ public class ApplicationEvaluationDao {
return saveApplicationEvaluationFormEntity(applicationEvaluationFormEntity); return saveApplicationEvaluationFormEntity(applicationEvaluationFormEntity);
} }
public void validateFormFields(ApplicationRequestBean request, EvaluationFormEntity evaluationFormEntity) { public void validateFormFields(ApplicationEvaluationFormRequestBean request, EvaluationFormEntity evaluationFormEntity) {
List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent(); List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
@@ -2070,17 +2088,6 @@ public class ApplicationEvaluationDao {
return documentIds; return documentIds;
} }
public ApplicationEvaluationResponseBean getEvaluationById(Long evaluationId, Long evaluationFormId){
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(evaluationId);
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = applicationEvaluationFormRepository.findByEvaluationIdAndEvaluationFormId(applicationEvaluationEntity.getId(),evaluationFormId);
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
List<ApplicationEvaluationFormFieldReponseBean> evaluationFormFieldResponseBeans = createEvaluationFormFieldResponse(applicationEvaluationFormFieldEntities, applicationEvaluationFormEntity);
ApplicationEvaluationResponseBean applicationEvaluationResponseBean = convertApplicationEvaluationEntityToApplicationEvaluationResponseBean(applicationEvaluationEntity);
applicationEvaluationResponseBean.setFormFields(evaluationFormFieldResponseBeans);
return applicationEvaluationResponseBean;
}
private List<ApplicationEvaluationFormFieldReponseBean> createEvaluationFormFieldResponse( private List<ApplicationEvaluationFormFieldReponseBean> createEvaluationFormFieldResponse(
List<ApplicationEvaluationFormFieldEntity> evaluationFormFieldEntities, List<ApplicationEvaluationFormFieldEntity> evaluationFormFieldEntities,
@@ -2137,15 +2144,39 @@ public class ApplicationEvaluationDao {
return applicationEvaluationFormFieldReponseBean; return applicationEvaluationFormFieldReponseBean;
} }
private ApplicationEvaluationResponseBean convertApplicationEvaluationEntityToApplicationEvaluationResponseBean(ApplicationEvaluationEntity entity){ private ApplicationEvaluationFormResponse convertToApplicationEvaluationResponseBean(ApplicationEvaluationResponse applicationEvaluationResponse){
ApplicationEvaluationResponseBean response = new ApplicationEvaluationResponseBean(); ApplicationEvaluationFormResponse response = new ApplicationEvaluationFormResponse();
response.setId(entity.getId()); response.setId(applicationEvaluationResponse.getId());
response.setApplicationId(entity.getApplicationId()); response.setApplicationId(applicationEvaluationResponse.getApplicationId());
response.setEvaluationId(entity.getId()); response.setNote(applicationEvaluationResponse.getNote());
response.setNote(entity.getNote()); response.setEvaluationVersion(applicationEvaluationResponse.getEvaluationVersion());
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(entity.getEvaluationVersion())); response.setCreatedDate(applicationEvaluationResponse.getCreatedDate());
response.setCreatedDate(entity.getCreatedDate()); response.setUpdatedDate(applicationEvaluationResponse.getUpdatedDate());
response.setUpdatedDate(entity.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; return response;
} }
@@ -2161,17 +2192,13 @@ public class ApplicationEvaluationDao {
} }
private ApplicationEvaluationFormResponse processEvaluationForm(ApplicationEvaluationEntity evaluationEntity){ 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()); EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByCallIdAndIsDeletedFalse(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getId());
if (evaluationFormEntity != null) { if (evaluationFormEntity != null) {
response.setEvaluationFormId(evaluationFormEntity.getId());
response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity)); response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity));
} }
@@ -2201,5 +2228,38 @@ public class ApplicationEvaluationDao {
return evaluationFormResponseBean; 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;
}
} }

View File

@@ -230,8 +230,8 @@ public class CompanyDao {
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null; String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson); setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson);
} }
setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, userWithCompanyEntity.getPec()); setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, companyRequest.getPec());
setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, userWithCompanyEntity.getEmail()); setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, companyRequest.getEmail());
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName()); setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());
setIfUpdated(userWithCompanyEntity::getContactEmail, userWithCompanyEntity::setContactEmail, companyRequest.getContactEmail()); setIfUpdated(userWithCompanyEntity::getContactEmail, userWithCompanyEntity::setContactEmail, companyRequest.getContactEmail());
setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant()); setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant());

View File

@@ -1,5 +1,7 @@
package net.gepafin.tendermanagement.dao; 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.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.CompanyEntity; import net.gepafin.tendermanagement.entities.CompanyEntity;
import net.gepafin.tendermanagement.entities.UserEntity; 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.repositories.*;
import net.gepafin.tendermanagement.service.CompanyService; import net.gepafin.tendermanagement.service.CompanyService;
import net.gepafin.tendermanagement.util.Validator; import net.gepafin.tendermanagement.util.Validator;
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -278,14 +283,16 @@ public class DashboardDao {
AmendmentWidgetResponseBean amendmentWidgetResponseBean = initializeAmendmentResponseBean(); AmendmentWidgetResponseBean amendmentWidgetResponseBean = initializeAmendmentResponseBean();
Long hubId = userEntity.getHub().getId(); Long hubId = userEntity.getHub().getId();
List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity,hubId); List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity,hubId,null);
setAmendmentCounts(applicationIds,amendmentWidgetResponseBean, hubId); setAmendmentCounts(applicationIds,amendmentWidgetResponseBean, hubId);
calculateExpiringRequestsIn48Hours(applicationIds,amendmentWidgetResponseBean, hubId); calculateExpiringRequestsIn48Hours(applicationIds,amendmentWidgetResponseBean, hubId);
calculateAverageResponseDays(applicationIds,amendmentWidgetResponseBean,hubId); calculateAverageResponseDays(applicationIds,amendmentWidgetResponseBean,hubId);
return amendmentWidgetResponseBean; return amendmentWidgetResponseBean;
} }
public List<Long> getApplicationIdsForUserOrHub(UserEntity userEntity, Long hubId) { public List<Long> getApplicationIdsForUserOrHub(UserEntity userEntity, Long hubId , Long userId) {
if (validator.checkIsPreInstructor()) { if (userId != null) {
return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userId);
} else if (validator.checkIsPreInstructor()) {
return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userEntity.getId()); return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userEntity.getId());
} else { } else {
return applicationRepository.findApplicationIdsByHubId(hubId); return applicationRepository.findApplicationIdsByHubId(hubId);
@@ -423,23 +430,34 @@ public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(
.build()) .build())
.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(); PreInstructorWidgetResponseBean preInstructorWidgetResponseBean = initializeDashboardPreInstructorResponseBean();
Long hubId = userEntity.getHub().getId(); Long hubId = userEntity.getHub().getId();
List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId); List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId,userId);
setPreInstructorWidgets(applicationIds, preInstructorWidgetResponseBean,hubId); setPreInstructorWidgets(applicationIds, preInstructorWidgetResponseBean,hubId);
calculateAverageEvaluationTime(applicationIds, preInstructorWidgetResponseBean, hubId); calculateAverageEvaluationTime(applicationIds, preInstructorWidgetResponseBean, hubId);
return preInstructorWidgetResponseBean; return preInstructorWidgetResponseBean;
} }
private void setPreInstructorWidgets(List<Long> applicationIds, PreInstructorWidgetResponseBean responseBean,Long hubId) { private void setPreInstructorWidgets(List<Long> applicationIds, PreInstructorWidgetResponseBean responseBean,Long hubId) {
List<String> assignedApplicationStatus = Arrays.asList(AssignedApplicationEnum.AWAITING.getValue(), AssignedApplicationEnum.OPEN.getValue());
Long totalAssignedApplications = assignedApplicationsRepository.countAssignedApplicationsByApplicationIds(applicationIds); Long totalAssignedApplications = assignedApplicationsRepository.countAssignedApplicationsByApplicationIds(applicationIds,assignedApplicationStatus);
if (totalAssignedApplications != null) { if (totalAssignedApplications != null) {
responseBean.getAssignedApplication().setTotalAssignedApplication(totalAssignedApplications); responseBean.getAssignedApplication().setTotalAssignedApplication(totalAssignedApplications);
} }
LocalDateTime yesterday = LocalDateTime.now().minusDays(1); 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) { if (newApplicationsAddedYesterday != null && totalAssignedApplications != null && totalAssignedApplications > 0) {
BigDecimal percentageAdded = BigDecimal.valueOf(newApplicationsAddedYesterday) BigDecimal percentageAdded = BigDecimal.valueOf(newApplicationsAddedYesterday)
.divide(BigDecimal.valueOf(totalAssignedApplications), 4, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(totalAssignedApplications), 4, RoundingMode.HALF_UP)
@@ -449,17 +467,17 @@ public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(
List<String> statuses = Arrays.asList(ApplicationStatusTypeEnum.APPROVED.getValue(), ApplicationStatusTypeEnum.REJECTED.getValue()); List<String> statuses = Arrays.asList(ApplicationStatusTypeEnum.APPROVED.getValue(), ApplicationStatusTypeEnum.REJECTED.getValue());
LocalDateTime sevenDaysAgo = LocalDateTime.now().minusDays(7); LocalDateTime sevenDaysAgo = LocalDateTime.now().minusDays(7);
Long evaluatedApplication = applicationRepository.countEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo); Long evaluatedApplication = assignedApplicationsRepository.countEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
if (evaluatedApplication != null) { if (evaluatedApplication != null) {
responseBean.getEvaluatedApplication().setEvaluatedApplication(evaluatedApplication); responseBean.getEvaluatedApplication().setEvaluatedApplication(evaluatedApplication);
BigDecimal dailyAverage = applicationRepository.countDailyAverageEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo); BigDecimal dailyAverage = assignedApplicationsRepository.countDailyAverageEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
if (dailyAverage != null) { if (dailyAverage != null) {
responseBean.getEvaluatedApplication().setDailyAverage(dailyAverage.setScale(2, RoundingMode.HALF_UP)); // Rounded to 2 decimal places responseBean.getEvaluatedApplication().setDailyAverage(dailyAverage.setScale(2, RoundingMode.HALF_UP)); // Rounded to 2 decimal places
} }
} }
List<String> amendmentStatus =Arrays.asList( ApplicationAmendmentRequestEnum.AWAITING.getValue(), ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue());
Long rescueInstructorsInProgress = assignedApplicationsRepository.countApplicationsByIdsAndStatus(applicationIds, AssignedApplicationEnum.SOCCORSO.getValue()); Long rescueInstructorsInProgress = applicationAmendmentRequestRepository.countAmendmentsByApplicationIds(applicationIds,amendmentStatus);
if (rescueInstructorsInProgress != null) { if (rescueInstructorsInProgress != null) {
responseBean.getAmendmentInProgress().setTotalAmendmentInProgress(rescueInstructorsInProgress); responseBean.getAmendmentInProgress().setTotalAmendmentInProgress(rescueInstructorsInProgress);
} }

View File

@@ -94,7 +94,19 @@ public class EmailNotificationDao {
subjectPlaceholders.put("{{company_name}}", company.getCompanyName()); subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// bodyPlaceholders.put("{{legal_mail}}", legalMail); // bodyPlaceholders.put("{{legal_mail}}", legalMail);
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); 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); return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
} }

View File

@@ -1,9 +1,12 @@
package net.gepafin.tendermanagement.dao; package net.gepafin.tendermanagement.dao;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.gepafin.tendermanagement.config.Translator; import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant; import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.*; import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.enums.CallStatusEnum;
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum; import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
import net.gepafin.tendermanagement.model.request.*; import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.model.response.ContentResponseBean; import net.gepafin.tendermanagement.model.response.ContentResponseBean;
@@ -35,6 +38,8 @@ import java.util.stream.Collectors;
@Component @Component
public class FormDao { public class FormDao {
private final Logger log = LoggerFactory.getLogger(FormDao.class);
@Autowired @Autowired
private FormRepository formRepository; private FormRepository formRepository;
@@ -118,6 +123,10 @@ public class FormDao {
//cloned entity for old call data. //cloned entity for old call data.
CallEntity oldCallData = Utils.getClonedEntityForData(callEntity); 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<FlowDataEntity> flowDataEntities = flowDataRepository.findByCallId(callEntity.getId()); List<FlowDataEntity> flowDataEntities = flowDataRepository.findByCallId(callEntity.getId());
List<FlowEdgesEntity> flowEdgesEntities = flowEdgesRepository.findByCallId(callEntity.getId()); List<FlowEdgesEntity> flowEdgesEntities = flowEdgesRepository.findByCallId(callEntity.getId());
if (Boolean.FALSE.equals(flowDataEntities.isEmpty() || flowDataEntities == null) || Boolean.FALSE.equals(flowEdgesEntities.isEmpty() || flowEdgesEntities == null)) { 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) { String formFieldId,Long evaluationCriteriaId) {
EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId); EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId);
if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) { if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) {
throw new CustomValidationException(Status.VALIDATION_ERROR, log.info("This evaluation criterion does not belong to the current call. Expected Call ID = {}, Found Call ID = {}",
Translator.toLocale(GepafinConstant.EVALUATIONCRITERIA_INVALID)); callEntity.getId(), evaluationCriteria.getCall().getId());
return;
} }
CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity(); CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity();
criteriaFormField.setCallId(callEntity.getId()); criteriaFormField.setCallId(callEntity.getId());
@@ -466,7 +476,9 @@ public class FormDao {
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class); FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
String fieldValue = getFieldValue(contentResponseBean); 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)) { if (Boolean.TRUE.equals(isSendValidationError)) {
validator.validate(); validator.validate();

View File

@@ -152,6 +152,31 @@ public class PdfDao {
// Create value cell with rounded corners // Create value cell with rounded corners
PdfPTable valueTable = new PdfPTable(1); PdfPTable valueTable = new PdfPTable(1);
valueTable.setWidthPercentage(100); valueTable.setWidthPercentage(100);
Object finalValue = value;
List<Object> criteriaObject = (List<Object>) contentResponseBean.getSettings().stream()
.filter(setting -> GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName()))
.findFirst()
.map(setting -> {
try {
// Assuming setting.getValue() contains the JSON string or object
return PdfUtils.extractRows(finalValue);
} catch (Exception e) {
throw new RuntimeException("Error extracting rows from setting value", e);
}
})
.orElse(null);
// Update value if criteriaObject is not null
if (criteriaObject != null) {
value = criteriaObject;
}
// Update value if criteriaObject is not null
if (value instanceof List<?>) { if (value instanceof List<?>) {
// Further check if the list contains Strings // Further check if the list contains Strings
List<?> list = (List<?>) value; List<?> list = (List<?>) value;
@@ -184,7 +209,6 @@ public class PdfDao {
Object object = value; Object object = value;
String stringvalue = Utils.convertToString(object); String stringvalue = Utils.convertToString(object);
List<Map<String, Object>> fieldValueList = Utils.convertJsonStringIntoJsonList(stringvalue); List<Map<String, Object>> fieldValueList = Utils.convertJsonStringIntoJsonList(stringvalue);
document = createPdfTable(fieldValueList, document, contentResponseBean); document = createPdfTable(fieldValueList, document, contentResponseBean);
} }
} }
@@ -231,12 +255,13 @@ public class PdfDao {
document.add(valueTable); document.add(valueTable);
} }
else { else {
String fieldValue1= (String) value; if (value instanceof String) {
if(Utils.isValidDateString(fieldValue1)){ String fieldValue1 = (String) value;
fieldValue1=Utils.formatDateString(String.valueOf(value)); if (Utils.isValidDateString(fieldValue1)) {
fieldValue1 = Utils.formatDateString(String.valueOf(value));
} }
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){ if(contentResponseBean.getName().equals("numberinput") && Boolean.TRUE.equals(Utils.isNumeric(fieldValue))){
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue)); fieldValue1=Utils.convertToItalianFormat(fieldValue);
} }
// PdfPCell valueCell = new PdfPCell(new Phrase(fieldValue1, valueFont)); // PdfPCell valueCell = new PdfPCell(new Phrase(fieldValue1, valueFont));
PdfPCell valueCell = PdfUtils.htmlToPdfPCell(fieldValue1, valueFont); PdfPCell valueCell = PdfUtils.htmlToPdfPCell(fieldValue1, valueFont);
@@ -252,6 +277,7 @@ public class PdfDao {
valueTable.addCell(valueCell); valueTable.addCell(valueCell);
document.add(valueTable); document.add(valueTable);
} }
}
} }
document.add(new Paragraph("\n")); // Add line break after each value document.add(new Paragraph("\n")); // Add line break after each value
@@ -264,11 +290,12 @@ public class PdfDao {
Map<String, Boolean> formulaEnabledMap = new HashMap<>(); Map<String, Boolean> formulaEnabledMap = new HashMap<>();
Map<String, String> formulaTypeMap = new HashMap<>(); Map<String, String> formulaTypeMap = new HashMap<>();
Map<String, String> fieldTypeMap = new HashMap<>(); Map<String, String> fieldTypeMap = new HashMap<>();
Map<String, String> totalMap = new HashMap<>();
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
contentResponseBean.getSettings().stream() contentResponseBean.getSettings().stream()
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns" .filter(setting -> "table_columns".equals(setting.getName()) || "criteria_table_columns".equals(setting.getName())) // Check for "table_columns"
.map(SettingResponseBean::getValue) .map(SettingResponseBean::getValue)
.filter(Objects::nonNull) // Ensure value is not null .filter(Objects::nonNull) // Ensure value is not null
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map .filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
@@ -283,7 +310,7 @@ public class PdfDao {
Boolean isFormulaEnabled = (Boolean) fieldData.get("enableFormula"); Boolean isFormulaEnabled = (Boolean) fieldData.get("enableFormula");
String formulaType = (String) fieldData.get("lastRowFormula"); String formulaType = (String) fieldData.get("lastRowFormula");
String fieldType = (String) fieldData.get("fieldtype"); // Get the field type (e.g., numeric) String fieldType = (String) fieldData.get("fieldtype"); // Get the field type (e.g., numeric)
String total= (String) fieldData.get("lastRowText");
if (fieldName != null && fieldDataValue != null) { if (fieldName != null && fieldDataValue != null) {
stateFieldMap.put(fieldName, fieldDataValue); stateFieldMap.put(fieldName, fieldDataValue);
} }
@@ -297,6 +324,9 @@ public class PdfDao {
if (fieldType != null) { if (fieldType != null) {
fieldTypeMap.put(fieldName, fieldType); // Store the fieldType in the map fieldTypeMap.put(fieldName, fieldType); // Store the fieldType in the map
} }
if(total!=null){
totalMap.put(fieldName,total);
}
}); });
PdfPTable table = new PdfPTable(stateFieldMap.size()); // Number of columns equals the number of map entries PdfPTable table = new PdfPTable(stateFieldMap.size()); // Number of columns equals the number of map entries
@@ -342,12 +372,15 @@ public class PdfDao {
Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present
// String fieldValue= (String) value; // String fieldValue= (String) value;
String fieldValue = value != null ? value.toString() : ""; String fieldValue = value != null ? value.toString() : "";
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){ // if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue)); //// fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
} // }
if (Boolean.TRUE.equals(formulaEnabledMap.get(key)) && Boolean.TRUE.equals(GepafinConstant.NUMERIC.equalsIgnoreCase(fieldTypeMap.get(key)))) { if (Boolean.TRUE.equals(formulaEnabledMap.get(key)) && Boolean.TRUE.equals(GepafinConstant.NUMERIC.equalsIgnoreCase(fieldTypeMap.get(key)))) {
calculateValue(key, fieldValue, formulaTypeMap, columnSums); calculateValue(key, fieldValue, formulaTypeMap, columnSums);
} }
if(Boolean.TRUE.equals(Utils.isNumeric(fieldValue))){
fieldValue=Utils.convertToItalianFormat(fieldValue);
}
PdfPCell dataCell = PdfUtils.htmlToPdfPCell(fieldValue != null ? fieldValue : "", textFont); PdfPCell dataCell = PdfUtils.htmlToPdfPCell(fieldValue != null ? fieldValue : "", textFont);
dataCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell dataCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
@@ -397,14 +430,19 @@ public class PdfDao {
table.addCell(emptyCell); table.addCell(emptyCell);
} }
} else { } else {
PdfPCell emptyCell = new PdfPCell(new Phrase("")); String total=null;
if (totalMap.containsKey(key)) {
total=totalMap.getOrDefault(key, "");
}
PdfPCell emptyCell = new PdfPCell(new Phrase(total,lightGrayFont));
emptyCell.setPaddingTop(8f);
emptyCell.setPaddingLeft(8f);
emptyCell.setBackgroundColor(new BaseColor(239, 243, 248)); emptyCell.setBackgroundColor(new BaseColor(239, 243, 248));
table.addCell(emptyCell); table.addCell(emptyCell);
} }
} }
// Add the last table to the document // Add the last table to the document
document.add(table); document.add(table);
@@ -415,7 +453,7 @@ public class PdfDao {
try { try {
if (Boolean.FALSE.equals(StringUtils.isEmpty(fieldValue))) { if (Boolean.FALSE.equals(StringUtils.isEmpty(fieldValue))) {
// Use Locale.ITALY to parse the number with the Italian format (comma as decimal separator) // Use Locale.ITALY to parse the number with the Italian format (comma as decimal separator)
NumberFormat format = NumberFormat.getInstance(Locale.ITALY); NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
Number number = format.parse(fieldValue); // Parse the fieldValue as a number Number number = format.parse(fieldValue); // Parse the fieldValue as a number
double numericValue = number.doubleValue(); // Convert the parsed number to double double numericValue = number.doubleValue(); // Convert the parsed number to double

View File

@@ -35,6 +35,7 @@ public enum UserActionContextEnum {
/** application action context **/ /** application action context **/
GET_APPLICATION("GET_APPLICATION"), GET_APPLICATION("GET_APPLICATION"),
CREATE_UPDATE_APPLICATION_FORM("CREATE_UPDATE_APPLICATION_FORM"), CREATE_UPDATE_APPLICATION_FORM("CREATE_UPDATE_APPLICATION_FORM"),
GET_APPLICATION_EVALUATION_VERSION("GET_APPLICATION_EVALUATION_VERSION"),
CREATE_APPLICATION("CREATE_APPLICATION"), CREATE_APPLICATION("CREATE_APPLICATION"),
DELETE_APPLICATION("DELETE_APPLICATION"), DELETE_APPLICATION("DELETE_APPLICATION"),
GET_ALL_APPLICATION("GET_ALL_APPLICATION"), GET_ALL_APPLICATION("GET_ALL_APPLICATION"),

View File

@@ -0,0 +1,19 @@
package net.gepafin.tendermanagement.model.request;
import lombok.Data;
import net.gepafin.tendermanagement.enums.ApplicationStatusForEvaluation;
import java.math.BigDecimal;
import java.util.List;
@Data
public class ApplicationEvaluationFormRequestBean {
private List<FieldRequest> files;
private List<EvaluationDocumentRequest> evaluationDocument;
private List<AmendmentDetailsRequest> amendmentDetails;
private String note;
private ApplicationStatusForEvaluation applicationStatus;
private List<ApplicationFormFieldRequestBean> formFields;
private String motivation;
private BigDecimal amountAccepted;
}

View File

@@ -1,18 +1,48 @@
package net.gepafin.tendermanagement.model.response; package net.gepafin.tendermanagement.model.response;
import lombok.Data; import lombok.Data;
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum; import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data @Data
public class ApplicationEvaluationFormResponse { public class ApplicationEvaluationFormResponse {
private Long evaluationFormId;
private Long id;
private Long applicationId; private Long applicationId;
private ApplicationStatusTypeEnum applicationStatus;
private Long assignedApplicationId; private Long assignedApplicationId;
private String note; private String note;
private String status; private ApplicationEvaluationStatusTypeEnum status;
private EvaluationVersionEnum evaluationVersion; private Long minScore;
private ApplicationEvaluationFormResponseBean applicationEvaluationFormResponse; private ApplicationEvaluationFormResponseBean applicationEvaluationFormResponse;
private List<FieldResponse> files;
private List<EvaluationDocumentResponse> evaluationDocument;
private List<AmendmentDocumentResponseBean> amendmentDetails;
private LocalDateTime createdDate;
private LocalDateTime updatedDate;
private String beneficiary;
private Long assignedUserId;
private String assignedUserName;
private Long protocolNumber;
private String callName;
private String motivation;
private LocalDateTime submissionDate;
private LocalDateTime evaluationEndDate;
private LocalDateTime callEndDate;
private String companyName;
private LocalDateTime assignedAt;
private String ndg;
private String appointmentId;
private BigDecimal amountRequested;
private BigDecimal amountAccepted;
private LocalDateTime dateAccepted;
private LocalDateTime dateRejected;
private EvaluationVersionEnum evaluationVersion;
} }

View File

@@ -1,17 +0,0 @@
package net.gepafin.tendermanagement.model.response;
import lombok.Data;
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
import net.gepafin.tendermanagement.model.BaseBean;
import java.util.List;
@Data
public class ApplicationEvaluationResponseBean extends BaseBean {
private Long applicationId;
private Long evaluationId;
private String note;
private EvaluationVersionEnum evaluationVersion;
private List<ApplicationEvaluationFormFieldReponseBean> formFields;
}

View File

@@ -0,0 +1,13 @@
package net.gepafin.tendermanagement.model.response;
import lombok.Data;
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
@Data
public class ApplicationEvaluationVersionResponse {
private Long callId;
private Long companyId;
private Long applicationId;
private Long evaluationId;
private EvaluationVersionEnum evaluationVersion;
}

View File

@@ -148,4 +148,6 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
@Param("endOfDay") LocalDateTime endOfDay @Param("endOfDay") LocalDateTime endOfDay
); );
@Query("SELECT COUNT(a) FROM ApplicationAmendmentRequestEntity a WHERE a.applicationId IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false")
Long countAmendmentsByApplicationIds(@Param("applicationIds") List<Long> applicationIds, @Param("statuses") List<String> statuses);
} }

View File

@@ -94,16 +94,5 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
@Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false") @Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false")
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId); List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.id IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false AND a.updatedDate >= :sevenDaysAgo")
Long countEvaluatedApplicationsInLast7Days(@Param("applicationIds") List<Long> applicationIds,
@Param("statuses") List<String> statuses,
@Param("sevenDaysAgo") LocalDateTime sevenDaysAgo);
@Query("SELECT (COUNT(a) / 7.0) FROM ApplicationEntity a WHERE a.id IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false AND a.updatedDate >= :sevenDaysAgo")
BigDecimal countDailyAverageEvaluatedApplicationsInLast7Days(@Param("applicationIds") List<Long> applicationIds,
@Param("statuses") List<String> statuses,
@Param("sevenDaysAgo") LocalDateTime sevenDaysAgo);
} }

View File

@@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@@ -27,8 +28,8 @@ public interface AssignedApplicationsRepository extends JpaRepository<AssignedAp
@Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.userId = :userId") @Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.userId = :userId")
List<Long> findApplicationIdsByUserIdAndIsDeletedFalse(@Param("userId") Long userId); List<Long> findApplicationIdsByUserIdAndIsDeletedFalse(@Param("userId") Long userId);
@Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.isDeleted = false") @Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false")
Long countAssignedApplicationsByApplicationIds(@Param("applicationIds") List<Long> applicationIds); Long countAssignedApplicationsByApplicationIds(@Param("applicationIds") List<Long> applicationIds, @Param("statuses") List<String> statuses);
@Query(""" @Query("""
SELECT COUNT(aa) SELECT COUNT(aa)
@@ -36,10 +37,12 @@ public interface AssignedApplicationsRepository extends JpaRepository<AssignedAp
JOIN aa.application a JOIN aa.application a
WHERE a.hubId = :hubId WHERE a.hubId = :hubId
AND a.isDeleted = false AND a.isDeleted = false
AND aa.status IN :statuses
AND aa.createdDate >= :yesterday AND aa.createdDate >= :yesterday
AND aa.isDeleted = false
AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds) AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds)
""") """)
Long countApplicationsAddedYesterdayForHub(@Param("applicationIds") List<Long> applicationIds, @Param("hubId") Long hubId, @Param("yesterday") LocalDateTime yesterday); Long countApplicationsAddedYesterdayForHub(@Param("applicationIds") List<Long> applicationIds, @Param("hubId") Long hubId, @Param("yesterday") LocalDateTime yesterday, @Param("statuses") List<String> statuses);
@Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.status = :status AND a.isDeleted = false") @Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.status = :status AND a.isDeleted = false")
Long countApplicationsByIdsAndStatus(@Param("applicationIds") List<Long> applicationIds, @Param("status") String status); Long countApplicationsByIdsAndStatus(@Param("applicationIds") List<Long> applicationIds, @Param("status") String status);
@@ -83,6 +86,28 @@ public interface AssignedApplicationsRepository extends JpaRepository<AssignedAp
@Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa " + @Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa " +
"WHERE aa.application.hubId = :hubId AND aa.isDeleted = false") "WHERE aa.application.hubId = :hubId AND aa.isDeleted = false")
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId); List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
@Query(" SELECT COUNT(aa) FROM AssignedApplicationsEntity aa " +
"JOIN aa.application a " +
"WHERE a.status IN :statuses " +
"AND a.isDeleted = false " +
"AND a.updatedDate >= :sevenDaysAgo " +
"AND aa.status = 'CLOSE'" +
"AND aa.isDeleted = false " +
" AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds) ")
Long countEvaluatedApplicationsInLast7Days(@Param("applicationIds") List<Long> applicationIds,
@Param("statuses") List<String> statuses,
@Param("sevenDaysAgo") LocalDateTime sevenDaysAgo);
@Query("SELECT (COUNT(a) / 7.0) FROM AssignedApplicationsEntity aa " +
"JOIN aa.application a " +
"WHERE a.status IN :statuses " +
"AND a.isDeleted = false " +
"AND a.updatedDate >= :sevenDaysAgo " +
"AND aa.status = 'CLOSE'" +
"AND aa.isDeleted = false " +
"AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds)")
BigDecimal countDailyAverageEvaluatedApplicationsInLast7Days(@Param("applicationIds") List<Long> applicationIds,
@Param("statuses") List<String> statuses,
@Param("sevenDaysAgo") LocalDateTime sevenDaysAgo);
} }

View File

@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.service;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity; import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import net.gepafin.tendermanagement.enums.FormActionEnum; import net.gepafin.tendermanagement.enums.FormActionEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean; import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest; import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
@@ -23,8 +24,10 @@ public interface ApplicationEvaluationService {
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId); ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
ApplicationEvaluationResponseBean createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long evaluationId, Long evaluationFormId); ApplicationEvaluationFormResponse createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long evaluationId, Long evaluationFormId);
ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId); ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId);
ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId);
} }

View File

@@ -15,7 +15,7 @@ public interface DashboardService {
public BeneficiaryWidgetResponseBean getDashboardWidgetForBeneficiary(HttpServletRequest request, Long companyId); public BeneficiaryWidgetResponseBean getDashboardWidgetForBeneficiary(HttpServletRequest request, Long companyId);
public ApplicationWidgetResponseBean getApplicationDetails(HttpServletRequest request); public ApplicationWidgetResponseBean getApplicationDetails(HttpServletRequest request);
public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request); public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request);
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request); public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request,Long userId);
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request); public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request);
} }

View File

@@ -7,13 +7,11 @@ import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity; import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity; import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResponse;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationVersionResponse;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean;
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository; import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
import net.gepafin.tendermanagement.service.ApplicationEvaluationService; import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
import net.gepafin.tendermanagement.service.ApplicationService; import net.gepafin.tendermanagement.service.ApplicationService;
@@ -87,10 +85,11 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
} }
@Override @Override
public ApplicationEvaluationResponseBean createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long assignedApplicationId, Long evaluationFormId) { @Transactional(rollbackFor = Exception.class)
public ApplicationEvaluationFormResponse createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long assignedApplicationId, Long evaluationFormId) {
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId); AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
validator.validatePreInstructor(request, assignedApplicationsEntity.getUserId()); validator.validatePreInstructor(request, assignedApplicationsEntity.getUserId());
return applicationEvaluationDao.createApplicationEvaluation(request,applicationRequestBean,evaluationFormId,assignedApplicationId); return applicationEvaluationDao.createApplicationEvaluation(request,applicationEvaluationFormRequestBean,evaluationFormId,assignedApplicationId);
} }
@Override @Override
@@ -100,4 +99,12 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
return applicationEvaluationDao.getApplicationEvaluationForm(request,applicationId,assignedApplicationId); return applicationEvaluationDao.getApplicationEvaluationForm(request,applicationId,assignedApplicationId);
} }
@Override
public ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId) {
validator.validateUser(request);
return applicationEvaluationDao.getApplicationEvaluationVersion(request,applicationId);
}
} }

View File

@@ -48,9 +48,9 @@ public class DashboardServiceImpl implements DashboardService {
return dashboardDao.getAmendmentDetails(userEntity); return dashboardDao.getAmendmentDetails(userEntity);
} }
@Override @Override
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request) { public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request,Long userId) {
UserEntity userEntity = validator.validateUser(request); validator.validateUser(request);
return dashboardDao.getDashboardWidgetForPreInstructor(userEntity); return dashboardDao.getDashboardWidgetForPreInstructor(request,userId);
} }
@Override @Override
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request) { public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request) {

View File

@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.util.Validator;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
@@ -27,6 +28,7 @@ public class FormServiceImpl implements FormService {
private Validator validator; private Validator validator;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public FormResponseBean createForm(HttpServletRequest request,Long callId, FormRequest formRequest) { public FormResponseBean createForm(HttpServletRequest request,Long callId, FormRequest formRequest) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
CallEntity call = validator.validateUserWithCall(user, callId); CallEntity call = validator.validateUserWithCall(user, callId);
@@ -34,18 +36,21 @@ public class FormServiceImpl implements FormService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public FormResponseBean updateForm(HttpServletRequest request, Long formId, FormRequest formRequest,Boolean forceDeleteFlow) { public FormResponseBean updateForm(HttpServletRequest request, Long formId, FormRequest formRequest,Boolean forceDeleteFlow) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
return formDao.updateForm(user, formId,formRequest,forceDeleteFlow); return formDao.updateForm(user, formId,formRequest,forceDeleteFlow);
} }
@Override @Override
@Transactional(readOnly = true)
public FormResponseBean getFormById(HttpServletRequest request, Long formId) { public FormResponseBean getFormById(HttpServletRequest request, Long formId) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
return formDao.getFormEntityById(user, formId); return formDao.getFormEntityById(user, formId);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void deleteForm(HttpServletRequest request, Long formId) { public void deleteForm(HttpServletRequest request, Long formId) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
formDao.deleteFormById(user, formId); formDao.deleteFormById(user, formId);
@@ -57,6 +62,7 @@ public class FormServiceImpl implements FormService {
} }
@Override @Override
@Transactional(readOnly = true)
public List<FormResponseBean> getFormsByCallId(HttpServletRequest request, Long callId) { public List<FormResponseBean> getFormsByCallId(HttpServletRequest request, Long callId) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
CallEntity call = validator.validateUserWithCall(user, callId); CallEntity call = validator.validateUserWithCall(user, callId);

View File

@@ -145,7 +145,7 @@ public class FieldValidator {
break; break;
case GepafinConstant.NON_EMPTY_TABLES: case GepafinConstant.NON_EMPTY_TABLES:
checkTableValidation(value, fieldId, contentResponseBean, errors); // checkTableValidation(value, fieldId, contentResponseBean, errors);
break; break;
default: default:
@@ -157,11 +157,51 @@ public class FieldValidator {
return this; return this;
} }
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) {
public FieldValidator validateCustomTableValidation(String value, String customRule, String fieldId, ContentResponseBean contentResponseBean) {
if (customRule == null || value == null) {
return this; // No custom rule to validate
}
switch (customRule) {
case GepafinConstant.NON_EMPTY_TABLES:
try {
checkTableValidation(value, fieldId, contentResponseBean, errors);
} catch (Exception e) {
throw new RuntimeException(e);
}
break;
default:
// If the custom rule is unknown, just log or add an error (optional)
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_CUSTOM), fieldId, customRule));
break;
}
return this;
}
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) throws Exception {
Map<String, Boolean> stateFieldMap= new HashMap<>(); Map<String, Boolean> stateFieldMap= new HashMap<>();
String tableType = contentResponseBean.getSettings().stream()
.filter(setting ->GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
.map(SettingResponseBean::getName) // Extract the name
.findFirst() // Get the first matching result
.orElse(null); // Default to null if no match
if (tableType!=null){
try {
Object object = PdfUtils.extractRows(value);;
value= Utils.convertToString(object);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
contentResponseBean.getSettings().stream() contentResponseBean.getSettings().stream()
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns" .filter(setting -> "table_columns".equals(setting.getName()) || GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
.map(SettingResponseBean::getValue) .map(SettingResponseBean::getValue)
.filter(Objects::nonNull) // Ensure value is not null .filter(Objects::nonNull) // Ensure value is not null
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map .filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map

View File

@@ -1,4 +1,6 @@
package net.gepafin.tendermanagement.util; package net.gepafin.tendermanagement.util;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.itextpdf.text.DocumentException; import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element; import com.itextpdf.text.Element;
import com.itextpdf.text.Font; import com.itextpdf.text.Font;
@@ -60,6 +62,24 @@ public class PdfUtils {
return cell; return cell;
} }
public static Object extractRows(Object content) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode;
// Check if input is already a JSON tree (Object) or a String
if (content instanceof String) {
rootNode = objectMapper.readTree((String) content);
} else {
rootNode = objectMapper.valueToTree(content);
}
// Extract "rows" dynamically
JsonNode rowsArray = rootNode.get("rows");
// Convert to a generic List
return objectMapper.convertValue(rowsArray, List.class);
}
} }

View File

@@ -778,4 +778,12 @@ public class Utils {
return Double.NaN; // Return NaN if the expression is invalid return Double.NaN; // Return NaN if the expression is invalid
} }
} }
public static boolean isNumeric(String input) {
if (input == null || input.trim().isEmpty()) {
return false;
}
return input.matches("-?\\d+(\\.\\d+)?");
}
} }

View File

@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import net.gepafin.tendermanagement.enums.FormActionEnum; import net.gepafin.tendermanagement.enums.FormActionEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean; import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest; import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
@@ -68,10 +69,10 @@ public interface ApplicationEvaluationApi {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PutMapping(value = "/assignedApplication/{id}", @PutMapping(value = "/v2/assignedApplication/{id}",
produces = { "application/json" }) produces = { "application/json" })
ResponseEntity<Response<ApplicationEvaluationResponseBean>> createApplicationEvaluation(HttpServletRequest request, ResponseEntity<Response<ApplicationEvaluationFormResponse>> createApplicationEvaluation(HttpServletRequest request,
@Valid @RequestBody ApplicationRequestBean applicationRequestBean, @Valid @RequestBody ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean,
@Parameter(description = "Assigned Application ID", required = true) @PathVariable(value = "id", required = true) Long assignedApplicationId, @Parameter(description = "Assigned Application ID", required = true) @PathVariable(value = "id", required = true) Long assignedApplicationId,
@Parameter(description = "The evaluation form ID", required = true) @RequestParam("evaluationFormId") Long evaluationFormId); @Parameter(description = "The evaluation form ID", required = true) @RequestParam("evaluationFormId") Long evaluationFormId);
@@ -84,10 +85,24 @@ public interface ApplicationEvaluationApi {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "", produces = "application/json") @GetMapping(value = "/v2", produces = "application/json")
ResponseEntity<Response<ApplicationEvaluationFormResponse>> getApplicationEvaluationForm(HttpServletRequest request, ResponseEntity<Response<ApplicationEvaluationFormResponse>> getApplicationEvaluationForm(HttpServletRequest request,
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId, @Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId); @Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
@Operation(summary = "Api to get application evaluation version",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "/application/{id}/version", produces = { "application/json" })
ResponseEntity<Response<ApplicationEvaluationVersionResponse>> getApplicationEvaluationVersion(HttpServletRequest request,
@Parameter(description = "The application id", required = true) @PathVariable("id") Long id);
} }

View File

@@ -20,6 +20,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
public interface DashboardApi { public interface DashboardApi {
@@ -107,7 +108,7 @@ public interface DashboardApi {
@GetMapping(value = "/instructor/amendment", @GetMapping(value = "/instructor/amendment",
produces = { "application/json" }) produces = { "application/json" })
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')") @PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request); ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request, @Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId);
} }

View File

@@ -6,10 +6,7 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.enums.FormActionEnum; import net.gepafin.tendermanagement.enums.FormActionEnum;
import net.gepafin.tendermanagement.enums.UserActionContextEnum; import net.gepafin.tendermanagement.enums.UserActionContextEnum;
import net.gepafin.tendermanagement.enums.UserActionLogsEnum; import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
import net.gepafin.tendermanagement.model.request.UserActionRequest;
import net.gepafin.tendermanagement.model.response.*; import net.gepafin.tendermanagement.model.response.*;
import net.gepafin.tendermanagement.model.util.Response; import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.service.ApplicationEvaluationService; import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
@@ -85,13 +82,13 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
} }
@Override @Override
public ResponseEntity<Response<ApplicationEvaluationResponseBean>> createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long assignedApplicationId, Long evaluationFormId) { public ResponseEntity<Response<ApplicationEvaluationFormResponse>> createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long assignedApplicationId, Long evaluationFormId) {
/** This code is responsible for creating user action logs for the "Create or update application evaluation form" operation. **/ /** This code is responsible for creating user action logs for the "Create or update application evaluation form" operation. **/
loggingUtil.logUserAction( loggingUtil.logUserAction(
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.CREATE_UPDATE_APPLICATION_EVALUATION_FORM).build()); UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.CREATE_UPDATE_APPLICATION_EVALUATION_FORM).build());
ApplicationEvaluationResponseBean applicationEvaluationResponseBean = applicationEvaluationService.createApplicationEvaluation(request, applicationRequestBean, assignedApplicationId, evaluationFormId); ApplicationEvaluationFormResponse applicationEvaluationResponseBean = applicationEvaluationService.createApplicationEvaluation(request, applicationEvaluationFormRequestBean, assignedApplicationId, evaluationFormId);
return ResponseEntity.status(HttpStatus.CREATED) return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(applicationEvaluationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CREATED_SUCCESSFULLY))); .body(new Response<>(applicationEvaluationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CREATED_SUCCESSFULLY)));
@@ -109,4 +106,16 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
} }
@Override
public ResponseEntity<Response<ApplicationEvaluationVersionResponse>> getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId) {
/** This code is responsible for creating user action logs for the "get application evaluation version" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION_VERSION).build());
ApplicationEvaluationVersionResponse applicationEvaluationVersionResponse = applicationEvaluationService.getApplicationEvaluationVersion(request,applicationId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(applicationEvaluationVersionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG)));
}
} }

View File

@@ -75,12 +75,12 @@ public class DashboardApiController implements DashboardApi {
} }
@Override @Override
public ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request) { public ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request,Long userId) {
/** This code is responsible for creating user action logs for the "Get dashboard stats widget for amendment page" operation. **/ /** This code is responsible for creating user action logs for the "Get dashboard stats widget for amendment page" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR).build()); loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR).build());
PreInstructorWidgetResponseBean widgetResponseBean= dashboardService.getDashboardWidgetForPreInstructor(request); PreInstructorWidgetResponseBean widgetResponseBean= dashboardService.getDashboardWidgetForPreInstructor(request,userId);
return ResponseEntity.status(HttpStatus.CREATED) return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY))); .body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
} }

View File

@@ -2375,4 +2375,8 @@
</addColumn> </addColumn>
</changeSet> </changeSet>
<changeSet id="04-02-2025_RK_174000" author="Rajesh Khore">
<sqlFile dbms="postgresql"
path="db/dump/update_system_email_template_application_rejected_04_02_2025.sql"/>
</changeSet>
</databaseChangeLog> </databaseChangeLog>

View File

@@ -0,0 +1,17 @@
UPDATE gepafin_schema.system_email_template
SET html_content = '<html>
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
<p>Buongiorno,</p>
<p>Si comunica che, in riferimento alla domanda a valere sul bando “<strong>{{call_name}}</strong>” di cui al
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,
la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.</p>
<p>Le motivazioni sono le seguenti: <strong>{{form_text}}</strong></p>
<p>Vi ricordiamo che i Beneficiari che hanno presentato richieste valutate non ammissibili entro 10 giorni dalla data di ricevimento della presente potranno formulare ricorso al Gestore tramite modello disponibile nello sportello online
<a href="{{platform_link}}">{{platform_link}}</a>.</p>
<p>Distinti Saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>'
WHERE "type" = 'INADMISSIBILITY_NOTIFICATION';

View File

@@ -152,6 +152,7 @@ application.created.success=Application successfully created.
application.updated.success=Application successfully updated. application.updated.success=Application successfully updated.
application.deleted.success=Application successfully deleted. application.deleted.success=Application successfully deleted.
application.get.success=Application details fetched successfully. application.get.success=Application details fetched successfully.
application.evaluation.version.get.success = Application evaluation version fetched successfully.
application.not.found=Application not found with the given ID. application.not.found=Application not found with the given ID.
application.form.field.not.found=Application form field not found. application.form.field.not.found=Application form field not found.
Form.not.matches.to.call.initial.form=Form id does not matches to initial form id of call. Form.not.matches.to.call.initial.form=Form id does not matches to initial form id of call.

View File

@@ -146,6 +146,7 @@ application.created.success=Applicazione creata con successo.
application.updated.success=Applicazione aggiornata con successo. application.updated.success=Applicazione aggiornata con successo.
application.deleted.success=Applicazione eliminata con successo. application.deleted.success=Applicazione eliminata con successo.
application.get.success=Dettagli dell'applicazione recuperati con successo. application.get.success=Dettagli dell'applicazione recuperati con successo.
application.evaluation.version.get.success = Versione di valutazione dell'applicazione recuperata correttamente.
application.not.found=Applicazione non trovata con l'ID fornito. application.not.found=Applicazione non trovata con l'ID fornito.
application.form.field.not.found=Campo del modulo di domanda non trovato. application.form.field.not.found=Campo del modulo di domanda non trovato.
Form.not.matches.to.call.initial.form=L'ID del modulo non corrisponde all'ID del modulo iniziale della chiamata. Form.not.matches.to.call.initial.form=L'ID del modulo non corrisponde all'ID del modulo iniziale della chiamata.