Merge pull request #248 from Kitzanos/develop

Sync Master with develop (21/03/3025)
Company Doc Management
Confidi Users
This commit is contained in:
Rinaldo
2025-03-21 08:23:57 +01:00
committed by GitHub
61 changed files with 1139 additions and 202 deletions

View File

@@ -0,0 +1,18 @@
package net.gepafin.tendermanagement.config;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.sql.Time;
import java.time.LocalTime;
@Converter(autoApply = true)
public class LocalTimeAttributeConverter implements AttributeConverter<LocalTime, Time> {
@Override
public Time convertToDatabaseColumn(LocalTime localTime) {
return (localTime == null ? null : Time.valueOf(localTime));
}
@Override
public LocalTime convertToEntityAttribute(Time sqlTime) {
return (sqlTime == null ? null : sqlTime.toLocalTime());
}
}

View File

@@ -1,8 +1,12 @@
package net.gepafin.tendermanagement.config; package net.gepafin.tendermanagement.config;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import java.util.Locale;
@Configuration @Configuration
public class MessageSourceConfig { public class MessageSourceConfig {
@@ -14,4 +18,12 @@ public class MessageSourceConfig {
messageSource.setUseCodeAsDefaultMessage(true); messageSource.setUseCodeAsDefaultMessage(true);
return messageSource; return messageSource;
} }
@Bean
public LocaleResolver localeResolver() {
// Force the locale resolver to always use Italian
SessionLocaleResolver localeResolver = new SessionLocaleResolver();
localeResolver.setDefaultLocale(Locale.ITALIAN);
return localeResolver;
}
} }

View File

@@ -485,8 +485,20 @@ public class GepafinConstant {
public static final String USAGE="usage"; public static final String USAGE="usage";
public static final String LIMIT="limit"; public static final String LIMIT="limit";
public static final String DATA="data"; public static final String DATA="data";
public static final String FILE_SELECT = "fileselect"; public static final String FILE_SELECT = "fileselect";
public static final String INVALID_LIMIT = "error.invalid.limit";
public static final String PREFERRED_CALL_ID="preferredCallId";
public static final String REGION_ID="regionId";
public static final String DELEGATION_TEMPLATE_CONFIDI="DELEGATION_TEMPLATE_CONFIDI";
public static final String EMAIL_SUPPORT = "email_support";
public static final String PHONE_SUPPORT = "phone_support";
public static final String PDF_TRUE="PDF_TRUE";
public static final String PDF_FALSE="PDF_FALSE";
public static final String PASSWORD_EXPIRED = "PasswordExpired";
public static final String PASSWORD_EXPIRED_LOGIN_TO_ODESSA = "password.expired.for.login.to.odessa";
} }

View File

@@ -682,7 +682,7 @@ public class ApplicationAmendmentRequestDao {
log.info("Updating application amendement with ID: {}", id); log.info("Updating application amendement with ID: {}", id);
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id); ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
Boolean isBeneficiary=false; Boolean isBeneficiary=false;
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) { if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi()) ) {
validator.validatePreInstructor(request, existingApplicationAmendment.getApplicationEvaluationEntity().getUserId()); validator.validatePreInstructor(request, existingApplicationAmendment.getApplicationEvaluationEntity().getUserId());
isBeneficiary=false; isBeneficiary=false;
} else { } else {
@@ -1372,10 +1372,10 @@ public class ApplicationAmendmentRequestDao {
.toList(); .toList();
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues)); predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
} }
if(Boolean.TRUE.equals(validator.checkIsBeneficiary())) { if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("application").get("userId").in(userId)); predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("application").get("userId").in(userId));
} }
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) { else {
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("userId").in(userId)); predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("userId").in(userId));
} }

View File

@@ -389,7 +389,7 @@ public class ApplicationDao {
return (root, query, builder) -> { return (root, query, builder) -> {
Boolean isBeneficiary = validator.checkIsBeneficiary(); Boolean isBeneficiary = validator.checkIsBeneficiary();
Predicate predicate = builder.isFalse(root.get("isDeleted")); Predicate predicate = builder.isFalse(root.get("isDeleted"));
if (isBeneficiary) { if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
predicate = builder.and(predicate, builder.equal(root.get("userId"), userEntity.getId())); predicate = builder.and(predicate, builder.equal(root.get("userId"), userEntity.getId()));
} }
if (callId != null) { if (callId != null) {
@@ -742,7 +742,7 @@ public class ApplicationDao {
List<FormApplicationResponse> formApplicationResponses = new ArrayList<>(); List<FormApplicationResponse> formApplicationResponses = new ArrayList<>();
List<FormEntity> formEntities = new ArrayList<>(); List<FormEntity> formEntities = new ArrayList<>();
UserEntity userEntity = validator.validateUser(request); UserEntity userEntity = validator.validateUser(request);
boolean isBeneficiary = isBeneficiary(userEntity); boolean isBeneficiary = Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi());
ApplicationEntity applicationEntity = isBeneficiary ApplicationEntity applicationEntity = isBeneficiary
? applicationRepository.findByIdAndUserIdAndIsDeletedFalse(applicationId, userEntity.getId()) ? applicationRepository.findByIdAndUserIdAndIsDeletedFalse(applicationId, userEntity.getId())
.orElseThrow(() -> new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_FOUND_MSG))) .orElseThrow(() -> new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_FOUND_MSG)))
@@ -1530,8 +1530,8 @@ public class ApplicationDao {
} }
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
Boolean isBeneficiary = validator.checkIsBeneficiary(); // Boolean isBeneficiary = validator.checkIsBeneficiary();
if (isBeneficiary) { if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userEntity.getId())); predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userEntity.getId()));
} }
if (year != null && year > 0) { if (year != null && year > 0) {

View File

@@ -186,8 +186,12 @@ public class ApplicationEvaluationDao {
List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository
.findByCallIdAndLookupDataTypeAndIsDeletedFalse(call.getId(), LookUpDataEntity.LookUpDataTypeEnum.CHECKLIST.getValue()); .findByCallIdAndLookupDataTypeAndIsDeletedFalse(call.getId(), LookUpDataEntity.LookUpDataTypeEnum.CHECKLIST.getValue());
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(entity.getApplicationId()); List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(entity.getApplicationId());
CompanyEntity company=companyService.validateCompany(entity.getAssignedApplicationsEntity().getApplication().getCompanyId());
setAmendmentDetails(entity,response); setAmendmentDetails(entity,response);
response.setCompanyVatNumber(company.getVatNumber());
response.setCompanyCodiceAteco(company.getCodiceAteco());
setCriteriaResponses(entity, response, evaluationCriterias); setCriteriaResponses(entity, response, evaluationCriterias);
setChecklistResponses(entity, response, checklistEntities); setChecklistResponses(entity, response, checklistEntities);
setFieldResponses(entity, response, applicationFormEntities); setFieldResponses(entity, response, applicationFormEntities);
@@ -261,6 +265,7 @@ public class ApplicationEvaluationDao {
for (EvaluationDocumentRequest doc : docRequest) { for (EvaluationDocumentRequest doc : docRequest) {
EvaluationDocumentResponse evaluationDocResponse = new EvaluationDocumentResponse(); EvaluationDocumentResponse evaluationDocResponse = new EvaluationDocumentResponse();
if (doc.getFileValue() != null) { if (doc.getFileValue() != null) {
if( Boolean.FALSE.equals(doc.getFileValue().isEmpty())) {
Long fileId = Long.valueOf(doc.getFileValue().toString()); Long fileId = Long.valueOf(doc.getFileValue().toString());
documentRepository.findByIdAndNotDeleted(fileId).ifPresent(documentEntity -> { documentRepository.findByIdAndNotDeleted(fileId).ifPresent(documentEntity -> {
DocumentResponseBean documentResponseBean = new DocumentResponseBean(); DocumentResponseBean documentResponseBean = new DocumentResponseBean();
@@ -274,14 +279,18 @@ public class ApplicationEvaluationDao {
documentResponseBean.setUpdatedDate(documentEntity.getUpdatedDate()); documentResponseBean.setUpdatedDate(documentEntity.getUpdatedDate());
documentResponseBean.setDocumentAttachmentId(documentEntity.getDocumentAttachmentId()); documentResponseBean.setDocumentAttachmentId(documentEntity.getDocumentAttachmentId());
evaluationDocResponse.setFileValue(List.of(documentResponseBean)); evaluationDocResponse.setFileValue(List.of(documentResponseBean));
});
}
else {
evaluationDocResponse.setFileValue(null);
}
evaluationDocResponse.setNameValue(doc.getNameValue()); evaluationDocResponse.setNameValue(doc.getNameValue());
evaluationDocResponse.setValid(doc.getValid()); evaluationDocResponse.setValid(doc.getValid());
evaluationDocResponse.setFieldId(doc.getFieldId()); evaluationDocResponse.setFieldId(doc.getFieldId());
});
}
if (evaluationDocResponse.getFileValue() == null) {
continue;
} }
// if (evaluationDocResponse.getFileValue() == null) {
// continue;
// }
evaluationDocResponses.add(evaluationDocResponse); evaluationDocResponses.add(evaluationDocResponse);
} }
response.setEvaluationDocument(evaluationDocResponses); response.setEvaluationDocument(evaluationDocResponses);
@@ -1150,6 +1159,7 @@ public class ApplicationEvaluationDao {
call = callRepository.findCallEntityByApplicationId(applicationId); call = callRepository.findCallEntityByApplicationId(applicationId);
assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null); assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
} }
CompanyEntity company=companyService.validateCompany(application.getCompanyId());
List<EvaluationCriteriaEntity> evaluationCriterias = evaluationCriteriaRepository List<EvaluationCriteriaEntity> evaluationCriterias = evaluationCriteriaRepository
.findByCallIdAndLookupDataTypeAndIsDeletedFalse(call.getId(), LookUpDataEntity.LookUpDataTypeEnum.EVALUATION_CRITERIA.getValue()); .findByCallIdAndLookupDataTypeAndIsDeletedFalse(call.getId(), LookUpDataEntity.LookUpDataTypeEnum.EVALUATION_CRITERIA.getValue());
List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository
@@ -1168,6 +1178,8 @@ public class ApplicationEvaluationDao {
response.setCallEndDate(callEndDate); response.setCallEndDate(callEndDate);
response.setNumberOfCheck(call.getNumberOfCheck()); response.setNumberOfCheck(call.getNumberOfCheck());
response.setAppointmentTemplateId(call.getAppointmentTemplateId()); response.setAppointmentTemplateId(call.getAppointmentTemplateId());
response.setCompanyVatNumber(company.getVatNumber());
response.setCompanyCodiceAteco(company.getCodiceAteco());
setCriteriaResponses(entity, application.getId(), response, evaluationCriterias); setCriteriaResponses(entity, application.getId(), response, evaluationCriterias);
setChecklistResponses(entity, application.getId(), response, checklistEntities); setChecklistResponses(entity, application.getId(), response, checklistEntities);
setFileResponses(entity, application.getId(), response, applicationFormEntities); setFileResponses(entity, application.getId(), response, applicationFormEntities);
@@ -1963,8 +1975,10 @@ public class ApplicationEvaluationDao {
for (EvaluationDocumentRequest doc : docRequest) { for (EvaluationDocumentRequest doc : docRequest) {
if (doc.getFileValue() != null) { if (doc.getFileValue() != null) {
if(Boolean.FALSE.equals(doc.getFileValue().isEmpty())) {
Long fileId = Long.valueOf(doc.getFileValue()); Long fileId = Long.valueOf(doc.getFileValue());
documentService.validateDocument(fileId); documentService.validateDocument(fileId);
}
existingDocs.add(doc); existingDocs.add(doc);
} }
} }
@@ -2234,6 +2248,7 @@ public class ApplicationEvaluationDao {
private ApplicationEvaluationFormResponse processEvaluationForm(ApplicationEvaluationEntity evaluationEntity){ private ApplicationEvaluationFormResponse processEvaluationForm(ApplicationEvaluationEntity evaluationEntity){
Object convertedResponse = convertToResponse(evaluationEntity); Object convertedResponse = convertToResponse(evaluationEntity);
CompanyEntity company=companyService.validateCompany(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCompanyId());
ApplicationEvaluationFormResponse response = objectMapper.convertValue(convertedResponse, ApplicationEvaluationFormResponse.class); 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());
@@ -2242,7 +2257,8 @@ public class ApplicationEvaluationDao {
if (evaluationFormEntity != null) { if (evaluationFormEntity != null) {
response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity)); response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity));
} }
response.setCompanyVatNumber(company.getVatNumber());
response.setCompanyCodiceAteco(company.getCodiceAteco());
return response; return response;
} }

View File

@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.config.jwt.TokenProvider;
import net.gepafin.tendermanagement.constants.AppointmentApiConstant; import net.gepafin.tendermanagement.constants.AppointmentApiConstant;
import net.gepafin.tendermanagement.constants.GepafinConstant; import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.ApplicationEntity; import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import net.gepafin.tendermanagement.entities.CompanyEntity; import net.gepafin.tendermanagement.entities.CompanyEntity;
import net.gepafin.tendermanagement.entities.DocumentEntity; import net.gepafin.tendermanagement.entities.DocumentEntity;
import net.gepafin.tendermanagement.entities.HubEntity; import net.gepafin.tendermanagement.entities.HubEntity;
@@ -39,6 +40,7 @@ import net.gepafin.tendermanagement.repositories.UserRepository;
import net.gepafin.tendermanagement.service.ApplicationService; import net.gepafin.tendermanagement.service.ApplicationService;
import net.gepafin.tendermanagement.service.CompanyService; import net.gepafin.tendermanagement.service.CompanyService;
import net.gepafin.tendermanagement.service.feignClient.AppointmentApiService; import net.gepafin.tendermanagement.service.feignClient.AppointmentApiService;
import net.gepafin.tendermanagement.service.impl.ApplicationEvaluationServiceImpl;
import net.gepafin.tendermanagement.util.LoggingUtil; import net.gepafin.tendermanagement.util.LoggingUtil;
import net.gepafin.tendermanagement.util.Utils; import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException; import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
@@ -60,6 +62,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -138,6 +141,9 @@ public class AppointmentDao {
@Autowired @Autowired
private UserRepository userRepository; private UserRepository userRepository;
@Autowired
private ApplicationEvaluationServiceImpl applicationEvaluationService;
private final Map<Long, ExecutorService> executorMap = new ConcurrentHashMap<>(); private final Map<Long, ExecutorService> executorMap = new ConcurrentHashMap<>();
private final ConcurrentHashMap<Long, ExecutorService> threadForDocumentMap = new ConcurrentHashMap<>(); private final ConcurrentHashMap<Long, ExecutorService> threadForDocumentMap = new ConcurrentHashMap<>();
@@ -162,10 +168,85 @@ public class AppointmentDao {
applicationRepository.save(application); applicationRepository.save(application);
// Start async processing // Start async processing
HubEntity hub = hubRepository.findByHubId(application.getHubId());
loginToOdessa(hub, application);
startAsyncNdgProcessing(applicationId); startAsyncNdgProcessing(applicationId);
throw new CustomValidationException(Status.SUCCESS, Translator.toLocale(GepafinConstant.NDG_GENERATION_IS_IN_PROGRESS)); throw new CustomValidationException(Status.SUCCESS, Translator.toLocale(GepafinConstant.NDG_GENERATION_IS_IN_PROGRESS));
} }
private HubEntity loginToOdessa(HubEntity hub, ApplicationEntity application) {
try {
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
log.info("Got the auth for login to odessa {}", authJwtToken);
hub.setAuthToken(authJwtToken);
hubRepository.save(hub);
Map<String, Object> body = Collections.emptyMap();
ResponseEntity<Object> responseLogin = appointmentApiService.loginWithOdessa(authJwtToken, source, context, user, password, body);
if (responseLogin.getStatusCode() == HttpStatus.OK) {
log.info("Login successful to odessa. Parsing response.");
String loginResponseJson = Utils.convertObjectToJson(responseLogin.getBody());
AppointmentLoginResponse parsedResponse = parseLoginResponse(loginResponseJson);
// Validate and save token
if (parsedResponse.getTokenId() != null) {
hub.setAppointmentAuthTokenId(parsedResponse.getTokenId());
hub.setAreaCode(parsedResponse.getAreaCode());
hubRepository.save(hub);
log.info("Saved new authToken and areaCode for Hub.");
return hub;
} else {
throw new RuntimeException("Login response is missing a valid tokenId for login to odessa system, please try again.");
}
}
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN));
}
catch (FeignException.Forbidden forbiddenException) {
logForbiddenError();
// Extract raw response body
String responseBody = forbiddenException.contentUTF8(); // Extract raw JSON response
// Parse JSON to check for "PasswordExpired"
try {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode = objectMapper.readTree(responseBody);
JsonNode errorsNode = rootNode.path("errors");
if (errorsNode.isArray()) {
for (JsonNode error : errorsNode) {
// Check the main errorCode
if (GepafinConstant.PASSWORD_EXPIRED.equals(error.path("errorCode").asText())) {
application.setNdgStatus(GepafinConstant.NDG_FAILED);
applicationRepository.save(application);
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
}
// Check inside "subErrors"
JsonNode subErrorsNode = error.path("subErrors");
if (subErrorsNode.isArray()) {
for (JsonNode subError : subErrorsNode) {
if (GepafinConstant.PASSWORD_EXPIRED.equals(subError.path("errorCode").asText())) {
application.setNdgStatus(GepafinConstant.NDG_FAILED);
applicationRepository.save(application);
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
}
}
}
}
}
} catch (IOException e) {
log.error("Error parsing JSON response: {}", e.getMessage());
}
// Regenerate the token and retry
loginToOdessa(hub, application);
}
catch (Exception e) {
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
throw new RuntimeException("Authentication failed on Odessa. try again", e);
}
return null;
}
private void startAsyncNdgProcessing(Long applicationId) { private void startAsyncNdgProcessing(Long applicationId) {
// Check if a thread is already running for this application // Check if a thread is already running for this application
@@ -259,18 +340,11 @@ public class AppointmentDao {
application.setStatus(ApplicationStatusTypeEnum.NDG.getValue()); application.setStatus(ApplicationStatusTypeEnum.NDG.getValue());
applicationRepository.save(application); applicationRepository.save(application);
companyRepository.save(company); companyRepository.save(company);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(application.getApplicationEvaluationId());
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION);
notificationDao.sendNotificationToInstructor(placeHolders, applicationEvaluationEntity, NotificationTypeEnum.NDG_GENERATION);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.NDG_GENERATION);
log.info("NDG saved successfully for applicationId: {}", application.getId()); log.info("NDG saved successfully for applicationId: {}", application.getId());
// /** This code is responsible for adding a version history log for the "update application ndg code, status, and Id visura"
// operation. **/
// loggingUtil.addVersionHistory(
// VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationData)
// .newData(application).build());
//
// /** This code is responsible for adding a version history log for the "update company ndg code" operation. **/
// loggingUtil.addVersionHistory(
// VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCompanyData)
// .newData(company).build());
break; break;
} }
@@ -309,10 +383,6 @@ public class AppointmentDao {
private void saveNdgAndIdVisura(ApplicationEntity application, CompanyEntity company, String ndg, String idVisura) { private void saveNdgAndIdVisura(ApplicationEntity application, CompanyEntity company, String ndg, String idVisura) {
//cloned for old application and company data
// ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(application);
// CompanyEntity oldCompanyData = Utils.getClonedEntityForData(company);
application.setNdg(ndg); application.setNdg(ndg);
application.setIdVisura(idVisura); application.setIdVisura(idVisura);
application.setNdgStatus(GepafinConstant.NDG_GENERATED); application.setNdgStatus(GepafinConstant.NDG_GENERATED);
@@ -320,17 +390,10 @@ public class AppointmentDao {
company.setNdg(ndg); company.setNdg(ndg);
companyRepository.save(company); companyRepository.save(company);
applicationRepository.save(application); applicationRepository.save(application);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(application.getApplicationEvaluationId());
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION); Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION);
notificationDao.sendNotificationToInstructor(placeHolders, applicationEvaluationEntity, NotificationTypeEnum.NDG_GENERATION);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.NDG_GENERATION); notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.NDG_GENERATION);
// /** This code is responsible for adding a version history log for the "update application ndg code, status, and Id visura" operation. **/
// loggingUtil.addVersionHistory(
// VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationData).newData(application).build());
//
// /** This code is responsible for adding a version history log for the "update company ndg code" operation. **/
// loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCompanyData).newData
// (company).build());
log.info("NDG saved for applicationId: {}, {}", application.getId(), application.getNdg()); log.info("NDG saved for applicationId: {}, {}", application.getId(), application.getNdg());
} }
@@ -358,18 +421,12 @@ public class AppointmentDao {
private HubEntity authenticateAndSaveToken(HubEntity hub) { private HubEntity authenticateAndSaveToken(HubEntity hub) {
// HubEntity oldHubData = Utils.getClonedEntityForData(hub);
try { try {
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call //code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa(); String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
log.info("Got the auth for login to odessa {}", authJwtToken); log.info("Got the auth for login to odessa {}", authJwtToken);
hub.setAuthToken(authJwtToken); hub.setAuthToken(authJwtToken);
hubRepository.save(hub); hubRepository.save(hub);
// /** This code is responsible for adding a version history log for the "Updating auth token for login api in hub" operation. **/
// loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldHubData).newData
// (hub).build());
// Prepare the request body (adjust if necessary for login API) // Prepare the request body (adjust if necessary for login API)
Map<String, Object> body = Collections.emptyMap(); Map<String, Object> body = Collections.emptyMap();
// Perform login API call // Perform login API call
@@ -387,13 +444,6 @@ public class AppointmentDao {
hub.setAreaCode(parsedResponse.getAreaCode()); hub.setAreaCode(parsedResponse.getAreaCode());
hubRepository.save(hub); hubRepository.save(hub);
// /** This code is responsible for adding a version history log for the "inserting token and areaCode from login odessa response for
// appointment flow api's"
// * operation. **/
// loggingUtil.addVersionHistory(
// VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldHubData).newData(hub)
// .build());
log.info("Saved new authToken and areaCode for Hub."); log.info("Saved new authToken and areaCode for Hub.");
return hub; return hub;
} else { } else {
@@ -404,6 +454,38 @@ public class AppointmentDao {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN)); throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN));
} catch (FeignException.Forbidden forbiddenException) { } catch (FeignException.Forbidden forbiddenException) {
logForbiddenError(); logForbiddenError();
// Extract raw response body
String responseBody = forbiddenException.contentUTF8(); // Extract raw JSON response
// Parse JSON to check for "PasswordExpired"
try {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode = objectMapper.readTree(responseBody);
JsonNode errorsNode = rootNode.path("errors");
if (errorsNode.isArray()) {
for (JsonNode error : errorsNode) {
// Check the main errorCode
if (GepafinConstant.PASSWORD_EXPIRED.equals(error.path("errorCode").asText())) {
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
}
// Check inside "subErrors"
JsonNode subErrorsNode = error.path("subErrors");
if (subErrorsNode.isArray()) {
for (JsonNode subError : subErrorsNode) {
if (GepafinConstant.PASSWORD_EXPIRED.equals(subError.path("errorCode").asText())) {
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
}
}
}
}
}
} catch (IOException e) {
log.error("Error parsing JSON response: {}", e.getMessage());
}
// Regenerate the token and retry // Regenerate the token and retry
regenerateTokenAndSave(hub); regenerateTokenAndSave(hub);
} catch (Exception e) { } catch (Exception e) {
@@ -435,14 +517,8 @@ public class AppointmentDao {
} }
private String regenerateTokenAndSave(HubEntity hub) { private String regenerateTokenAndSave(HubEntity hub) {
try {
hub = authenticateAndSaveToken(hub); hub = authenticateAndSaveToken(hub);
return "Bearer " + hub.getAppointmentAuthTokenId(); return "Bearer " + hub.getAppointmentAuthTokenId();
} catch (Exception e) {
log.error("Failed to regenerate token from Odessa: {}", e.getMessage());
throw new RuntimeException("Token regeneration failed from Odessa.", e);
}
} }
private AppointmentLoginResponse createVisura(CompanyEntity company, String authorizationToken, HubEntity hub) { private AppointmentLoginResponse createVisura(CompanyEntity company, String authorizationToken, HubEntity hub) {
@@ -625,6 +701,7 @@ public class AppointmentDao {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.NDG_NOT_FOUND_FOR_APPLICATION)); throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.NDG_NOT_FOUND_FOR_APPLICATION));
} }
hub = authenticateAndSaveToken(hub);
// Generate authorization token and fetch template data // Generate authorization token and fetch template data
String authorizationToken = getBearerToken(hub); String authorizationToken = getBearerToken(hub);
Long appointmentTemplateId = application.getCall().getAppointmentTemplateId(); Long appointmentTemplateId = application.getCall().getAppointmentTemplateId();
@@ -787,6 +864,10 @@ public class AppointmentDao {
Claims claims = tokenProvider.getClaimsFromToken(tokenProvider.extractTokenFromRequest(request)); Claims claims = tokenProvider.getClaimsFromToken(tokenProvider.extractTokenFromRequest(request));
Long hubId = Utils.extractHubIdFromPayload(claims.getSubject()); Long hubId = Utils.extractHubIdFromPayload(claims.getSubject());
// Authenticate the hub before proceeding
HubEntity hub = hubRepository.findByHubId(hubId);
authenticateAndSaveToken(hub);
if (systemDoc.getDocumentAttachmentId() != null) { if (systemDoc.getDocumentAttachmentId() != null) {
// If the documentAttachmentId is already set, return the response // If the documentAttachmentId is already set, return the response
log.info("Document already uploaded with documentAttachmentId: {}", systemDoc.getDocumentAttachmentId()); log.info("Document already uploaded with documentAttachmentId: {}", systemDoc.getDocumentAttachmentId());
@@ -825,8 +906,6 @@ public class AppointmentDao {
} }
}); });
return null; return null;
// Return an immediate response indicating the process is in progress
// throw new CustomValidationException(Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_UPLOADING_IN_PROGRESS));
} }
private void uploadDocumentToExternalSystemSync(Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest) { private void uploadDocumentToExternalSystemSync(Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest) {

View File

@@ -4,17 +4,22 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Expression;
import jakarta.persistence.criteria.Predicate; import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root; import jakarta.persistence.criteria.Root;
import jakarta.persistence.criteria.*;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.entities.*; import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.enums.*; import net.gepafin.tendermanagement.enums.*;
@@ -780,30 +785,45 @@ public class CallDao {
return createCallResponseBean; return createCallResponseBean;
} }
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,UserEntity user, Long companyId,Boolean onlyPreferredCall) { public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,UserEntity user, Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
String type = user.getRoleEntity().getRoleType(); String type = user.getRoleEntity().getRoleType();
List<String> callStatusList = CallStatusEnum.getStatusValues(); List<String> callStatusList = CallStatusEnum.getStatusValues();
if (Boolean.FALSE.equals(ROLE_SUPER_ADMIN.getValue().equals(type))) { if (Boolean.FALSE.equals(ROLE_SUPER_ADMIN.getValue().equals(type))) {
callStatusList = List.of(CallStatusEnum.PUBLISH.getValue()); callStatusList = List.of(CallStatusEnum.PUBLISH.getValue());
} }
List<CallEntity> calls; // List<CallEntity> calls = List.of();
if (Boolean.TRUE.equals(onlyPreferredCall) && companyId == null) { if (Boolean.TRUE.equals(onlyPreferredCall) && companyId == null) {
throw new CustomValidationException(Status.VALIDATION_ERROR, throw new CustomValidationException(Status.VALIDATION_ERROR,
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL)); Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL));
} }
Specification<CallEntity> spec = buildCallSpecification(request, user, companyId, onlyPreferredCall, onlyConfidiCall, callStatusList);
if (Boolean.TRUE.equals(onlyPreferredCall)) { List<CallEntity> calls = callRepository.findAll(spec);
validator.validateUserWithCompany(request, companyId);
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId); LocalDateTime now = LocalDateTime.now();
List<BeneficiaryPreferredCallEntity> preferredCalls = beneficiaryPreferredCallRepository for (CallEntity call : calls) {
.findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), userWithCompanyEntity.getId()); CallEntity oldCallEntity = Utils.getClonedEntityForData(call);
List<Long> preferredCallIds = preferredCalls.stream() if (CallStatusEnum.PUBLISH.getValue().equals(call.getStatus()) &&
.map(BeneficiaryPreferredCallEntity::getCallId) call.getEndDate() != null && call.getEndTime() != null) {
.collect(Collectors.toList()); LocalDateTime callEndDateTime = LocalDateTime.of(LocalDate.from(call.getEndDate()), call.getEndTime());
calls = callRepository.findByIdInAndStatusIn(preferredCallIds, callStatusList); if (callEndDateTime.isBefore(now)) {
} else { call.setStatus(CallStatusEnum.EXPIRED.getValue());
calls = callRepository.findByStatusInAndHubId(callStatusList, user.getHub().getId()); callRepository.save(call);
} }
if (Boolean.FALSE.equals(oldCallEntity.getStatus().equals(call.getStatus()))) {
loggingUtil.logUserAction(UserActionRequest.builder()
.request(request)
.actionType(UserActionLogsEnum.UPDATE)
.actionContext(UserActionContextEnum.UPDATE_EXPIRED_CALL)
.build());
/** This code is responsible for adding a version history log for the "update call status to EXPIRED" operation **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCallEntity).newData(call).build());
}
}
}
List<Long> callIds = calls.stream().map(CallEntity::getId).collect(Collectors.toList()); List<Long> callIds = calls.stream().map(CallEntity::getId).collect(Collectors.toList());
Map<String, BeneficiaryPreferredCallEntity> preferredCallsMap = Map<String, BeneficiaryPreferredCallEntity> preferredCallsMap =
getBeneficiaryPreferredCallsForUser(request,user, callIds, companyId); getBeneficiaryPreferredCallsForUser(request,user, callIds, companyId);
@@ -824,7 +844,7 @@ public class CallDao {
public Map<String, BeneficiaryPreferredCallEntity> getBeneficiaryPreferredCallsForUser(HttpServletRequest request, UserEntity user, List<Long> callIds, Long companyId) { public Map<String, BeneficiaryPreferredCallEntity> getBeneficiaryPreferredCallsForUser(HttpServletRequest request, UserEntity user, List<Long> callIds, Long companyId) {
List<BeneficiaryPreferredCallEntity> beneficiaryPreferredCalls; List<BeneficiaryPreferredCallEntity> beneficiaryPreferredCalls;
if (companyId != null && Boolean.TRUE.equals(validator.checkIsBeneficiary())) { if (companyId != null && (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi()))) {
validator.validateUserWithCompany(request, companyId); validator.validateUserWithCompany(request, companyId);
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId); UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId);
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
@@ -980,7 +1000,7 @@ public class CallDao {
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL) Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL)
); );
} }
Specification<CallEntity> spec = search(user, callPageableRequestBean); Specification<CallEntity> spec = search(request,user, callPageableRequestBean);
Page<CallEntity> entityPage; Page<CallEntity> entityPage;
if (Boolean.TRUE.equals(onlyPreferredCall)) { if (Boolean.TRUE.equals(onlyPreferredCall)) {
validator.validateUserWithCompany(request, companyId); validator.validateUserWithCompany(request, companyId);
@@ -993,7 +1013,10 @@ public class CallDao {
// Add preferredCallIds filtering to the specification // Add preferredCallIds filtering to the specification
spec = spec.and((root, query, criteriaBuilder) -> spec = spec.and((root, query, criteriaBuilder) ->
root.get(GepafinConstant.ID).in(preferredCallIds) criteriaBuilder.and(
root.get(GepafinConstant.ID).in(preferredCallIds),
criteriaBuilder.isTrue(root.get("confidi"))
)
); );
} }
entityPage = callRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit)); entityPage = callRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
@@ -1027,10 +1050,10 @@ public class CallDao {
return pageableResponseBean; return pageableResponseBean;
} }
public Specification<CallEntity> search(UserEntity userEntity, CallPageableRequestBean callPageableRequestBean) { public Specification<CallEntity> search(HttpServletRequest request,UserEntity userEntity, CallPageableRequestBean callPageableRequestBean) {
return (root, query, criteriaBuilder) -> { return (root, query, criteriaBuilder) -> {
List<Predicate> predicates = getPredicates(callPageableRequestBean, criteriaBuilder, root, userEntity); List<Predicate> predicates = getPredicates(request,callPageableRequestBean, criteriaBuilder, root, userEntity);
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true); SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
if (callPageableRequestBean.getGlobalFilters() != null if (callPageableRequestBean.getGlobalFilters() != null
@@ -1053,15 +1076,19 @@ public class CallDao {
} }
private List<Predicate> getPredicates(CallPageableRequestBean callPageableRequestBean, private List<Predicate> getPredicates(HttpServletRequest request,CallPageableRequestBean callPageableRequestBean,
CriteriaBuilder criteriaBuilder, Root<CallEntity> root, UserEntity userEntity) { CriteriaBuilder criteriaBuilder, Root<CallEntity> root, UserEntity userEntity) {
expirePublishedCalls(request);
Integer year = null; Integer year = null;
String search = null; String search = null;
Map<String, FilterCriteria> filters = new HashMap<>();
if (callPageableRequestBean.getGlobalFilters() != null) { if (callPageableRequestBean.getGlobalFilters() != null) {
year = callPageableRequestBean.getGlobalFilters().getYear(); year = callPageableRequestBean.getGlobalFilters().getYear();
search = callPageableRequestBean.getGlobalFilters().getSearch(); search = callPageableRequestBean.getGlobalFilters().getSearch();
} }
if (callPageableRequestBean.getFilters() != null) {
filters = callPageableRequestBean.getFilters();
}
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
if (year != null && year > 0) { if (year != null && year > 0) {
int filterYear = callPageableRequestBean.getGlobalFilters().getYear(); int filterYear = callPageableRequestBean.getGlobalFilters().getYear();
@@ -1104,14 +1131,209 @@ public class CallDao {
.toList(); .toList();
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues)); predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
} }
applyFilters(root, criteriaBuilder, predicates, filters);
Boolean isConfidi = callPageableRequestBean.getConfidi();
if (validator.checkIsConfidi()) {
if (isConfidi == null || isConfidi.equals(Boolean.FALSE)) {
// Ensure no records are returned
return List.of(criteriaBuilder.disjunction());
}
if (isConfidi.equals(Boolean.TRUE)) {
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
}
} else if (Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
predicates.add(criteriaBuilder.isFalse(root.get("confidi")));
} else if( Boolean.FALSE.equals(validator.checkIsConfidi()) && isConfidi!=null){
if (isConfidi.equals(Boolean.TRUE)) {
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
}
if (isConfidi.equals(Boolean.FALSE)) {
predicates.add(criteriaBuilder.isFalse(root.get("confidi")));
}
}
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB).get(GepafinConstant.ID), userEntity.getHub().getId())); predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB).get(GepafinConstant.ID), userEntity.getHub().getId()));
return predicates; return predicates;
} }
public void expirePublishedCalls(HttpServletRequest request) {
List<CallEntity> expiredCalls = callRepository.findAll((root, query, criteriaBuilder) -> {
Predicate isPublished = criteriaBuilder.equal(root.get(GepafinConstant.STATUS), CallStatusEnum.PUBLISH.name());
// Concatenate date and time as a single string
Expression<String> dateTimeString = criteriaBuilder.concat(
root.get(GepafinConstant.END_DATE),
criteriaBuilder.literal(" ") // Space between date and time
);
Expression<String> fullDateTimeString = criteriaBuilder.concat(dateTimeString, root.get(GepafinConstant.END_TIME));
// Convert the concatenated string into TIMESTAMP
Expression<LocalDateTime> endDateTime = criteriaBuilder.function(
"to_timestamp",
LocalDateTime.class,
fullDateTimeString,
criteriaBuilder.literal("YYYY-MM-DD HH24:MI:SS")
);
Predicate isExpired = criteriaBuilder.lessThan(endDateTime, LocalDateTime.now());
return criteriaBuilder.and(isPublished, isExpired);
});
if (!expiredCalls.isEmpty()) {
for (CallEntity call : expiredCalls) {
CallEntity oldCallEntity = Utils.getClonedEntityForData(call); // Clone before modification
call.setStatus(CallStatusEnum.EXPIRED.getValue());
if (!oldCallEntity.getStatus().equals(call.getStatus())) {
// Log user action
loggingUtil.logUserAction(UserActionRequest.builder()
.request(request)
.actionType(UserActionLogsEnum.UPDATE)
.actionContext(UserActionContextEnum.UPDATE_EXPIRED_CALL)
.build());
// Add version history log
loggingUtil.addVersionHistory(VersionHistoryRequest.builder()
.request(request)
.actionType(VersionActionTypeEnum.UPDATE)
.oldData(oldCallEntity)
.newData(call)
.build());
}
}
callRepository.saveAll(expiredCalls); // Save all modified calls at once
}
}
private void applyFilters(Root<?> root, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Map<String, FilterCriteria> filters) {
if (Boolean.FALSE.equals(filters.isEmpty())) {
for (Map.Entry<String, FilterCriteria> entry : filters.entrySet()) {
String fieldName = entry.getKey();
FilterCriteria filterCriteria = entry.getValue();
Object value = filterCriteria.getValue();
MatchModeEnum matchMode = filterCriteria.getMatchMode();
if (value != null && matchMode != null) {
Path<?> fieldPath = getFieldPath(root, fieldName);
if (fieldPath != null) {
applyStringFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
applyNumberFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
applyDateFilter(fieldPath, criteriaBuilder, predicates, value, matchMode,root);
}
}
}
}
}
private void applyStringFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode) {
if (value instanceof String) {
String valueStr = (String) value;
if (fieldPath.getJavaType().equals(String.class)) {
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
switch (mode) {
case CONTAINS ->
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(fieldPath.as(String.class)), "%" + valueStr.toLowerCase() + "%"));
case EQUALS -> predicates.add(criteriaBuilder.equal(fieldPath, valueStr));
case STARTSWITH ->
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(fieldPath.as(String.class)), valueStr.toLowerCase() + "%"));
case ENDSWITH ->
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(fieldPath.as(String.class)), "%" + valueStr.toLowerCase()));
}
}
}
}
private void applyNumberFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode) {
if (Number.class.isAssignableFrom(fieldPath.getJavaType())) {
Number numberValue = null;
if (value instanceof Number) {
numberValue = (Number) value;
}
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
switch (mode) {
case EQUALS -> predicates.add(criteriaBuilder.equal(fieldPath, numberValue));
}
}
}
private void applyDateFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode, Root<?> root) {
if (fieldPath.getJavaType().equals(LocalDateTime.class)) {
// Convert input string: Replace 'T' with space
String formattedValue = value.toString().replace("T", " ");
// Handle timezones and UTC (`Z` or `+HH:mm`)
if (formattedValue.contains("Z") || formattedValue.matches(".*[+-]\\d{2}:\\d{2}$")) {
OffsetDateTime offsetDateTime = OffsetDateTime.parse(value.toString(), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
formattedValue = offsetDateTime.toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
}
// Check if more than 3 decimal places exist
if (formattedValue.contains(".")) {
int dotIndex = formattedValue.indexOf(".");
if (formattedValue.length() > dotIndex + 4) {
formattedValue = formattedValue.substring(0, dotIndex + 4); // Keep only 3 decimals
}
} else {
formattedValue += ".000"; // Ensure 3 decimals
}
// Define correct date-time format
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
// Parse the formatted value into LocalDateTime
LocalDateTime dateTimeValue = LocalDateTime.parse(formattedValue, formatter);
// Extract only the date portion
LocalDate dateValue = dateTimeValue.toLocalDate();
// Convert database field to LocalDate for date-only comparison
Expression<LocalDate> dateField = criteriaBuilder.function("DATE", LocalDate.class, fieldPath);
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
switch (mode) {
case DATEIS -> predicates.add(criteriaBuilder.equal(dateField, dateValue));
case DATEISNOT -> predicates.add(criteriaBuilder.notEqual(dateField, dateValue));
case BEFORE -> predicates.add(criteriaBuilder.lessThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(dateTimeValue)));
case AFTER -> predicates.add(criteriaBuilder.greaterThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(dateTimeValue)));
}
}
}
private Path<?> getFieldPath(Root<?> root, String fieldName) {
try {
return switch (fieldName) {
case GepafinConstant.REGION_ID -> {
// Ensure join is only created if not already present
Join<?, RegionEntity> regionJoin = root.getJoins().stream()
.filter(j -> j.getAttribute().getName().equals("region"))
.findFirst()
.map(j -> (Join<?, RegionEntity>) j)
.orElseGet(() -> root.join("region", JoinType.LEFT));
yield regionJoin.get("id");
}
default -> root.get(fieldName);
};
} catch (IllegalArgumentException e) {
return null;
}
}
public CallResponse createCallStep2EvaluationV2(CallEntity callEntity, CreateCallRequestStep2EvaluationV2 createCallRequest, UserEntity user) { public CallResponse createCallStep2EvaluationV2(CallEntity callEntity, CreateCallRequestStep2EvaluationV2 createCallRequest, UserEntity user) {
convertToDocumentEntities(createCallRequest.getDocs(), callEntity.getId(), DocumentTypeEnum.DOCUMENT); convertToDocumentEntities(createCallRequest.getDocs(), callEntity.getId(), DocumentTypeEnum.DOCUMENT);
@@ -1122,4 +1344,47 @@ public class CallDao {
createCallResponseBean.setCurrentStep(GepafinConstant.EVALUATION_V2_STEP_2); createCallResponseBean.setCurrentStep(GepafinConstant.EVALUATION_V2_STEP_2);
return createCallResponseBean; return createCallResponseBean;
} }
private Specification<CallEntity> buildCallSpecification(HttpServletRequest request, UserEntity user, Long companyId, Boolean onlyPreferredCall, Boolean onlyConfidiCall, List<String> callStatusList) {
return (root, query, criteriaBuilder) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(root.get("status").in(callStatusList));
if (Boolean.TRUE.equals(onlyPreferredCall)) {
validator.validateUserWithCompany(request, companyId);
UserWithCompanyEntity userWithCompanyEntity = companyService.getUserWithCompany(user.getId(), companyId);
List<BeneficiaryPreferredCallEntity> preferredCalls = beneficiaryPreferredCallRepository
.findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), userWithCompanyEntity.getId());
List<Long> preferredCallIds = preferredCalls.stream()
.map(BeneficiaryPreferredCallEntity::getCallId)
.collect(Collectors.toList());
predicates.add(root.get("id").in(preferredCallIds));
} else {
predicates.add(criteriaBuilder.equal(root.get("hub").get("id"), user.getHub().getId()));
}
if (validator.checkIsConfidi()) {
if (onlyConfidiCall==null || Boolean.FALSE.equals(onlyConfidiCall)) {
return criteriaBuilder.disjunction(); // Returns an empty predicate (no results)
}
if (onlyConfidiCall!=null && Boolean.TRUE.equals(onlyConfidiCall)) {
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
}
} else if (Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
predicates.add(criteriaBuilder.isFalse(root.get("confidi")));
} else {
if(onlyConfidiCall!=null) {
if (Boolean.TRUE.equals(onlyConfidiCall)) {
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
}
if (Boolean.FALSE.equals(onlyConfidiCall)) {
predicates.add(criteriaBuilder.isFalse(root.get("confidi")));
}
}
}
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
};
}
} }

View File

@@ -138,7 +138,7 @@ public class CommunicationDao {
if(validator.checkIsPreInstructor()){ if(validator.checkIsPreInstructor()){
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId()); communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
} else if(validator.checkIsBeneficiary()) { } else if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId()); communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
} }

View File

@@ -1,23 +1,33 @@
package net.gepafin.tendermanagement.dao; package net.gepafin.tendermanagement.dao;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.Pageable; // Correct package
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.log4j.Log4j2;
import net.gepafin.tendermanagement.entities.*; import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum; import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum; import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum;
import net.gepafin.tendermanagement.model.request.LimitRequest;
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
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.enums.VersionActionTypeEnum; import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest; import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
import net.gepafin.tendermanagement.repositories.ApplicationRepository; import net.gepafin.tendermanagement.repositories.ApplicationRepository;
import net.gepafin.tendermanagement.repositories.FaqRepository; import net.gepafin.tendermanagement.repositories.FaqRepository;
import net.gepafin.tendermanagement.service.feignClient.VatCheckService;
import net.gepafin.tendermanagement.util.LoggingUtil; import net.gepafin.tendermanagement.util.LoggingUtil;
import net.gepafin.tendermanagement.web.rest.api.errors.*; import net.gepafin.tendermanagement.web.rest.api.errors.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import net.gepafin.tendermanagement.config.Translator; import net.gepafin.tendermanagement.config.Translator;
@@ -27,9 +37,11 @@ import net.gepafin.tendermanagement.model.response.CompanyResponse;
import net.gepafin.tendermanagement.service.UserService; import net.gepafin.tendermanagement.service.UserService;
import net.gepafin.tendermanagement.util.Utils; import net.gepafin.tendermanagement.util.Utils;
import static net.gepafin.tendermanagement.util.Utils.convertObjectToJsonString;
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated; import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
@Component @Component
@Log4j2
public class CompanyDao { public class CompanyDao {
@Autowired @Autowired
@@ -60,6 +72,13 @@ public class CompanyDao {
@Autowired @Autowired
private HttpServletRequest request; private HttpServletRequest request;
@Autowired
private VatCheckService vatCheckService; // Service to call VAT API
private static final String NOT_FOUND_JSON = "{\"data\": \"not found\"}";
public CompanyResponse createCompany(UserEntity userEntity, CompanyRequest companyRequest) { public CompanyResponse createCompany(UserEntity userEntity, CompanyRequest companyRequest) {
CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId()); CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
@@ -410,4 +429,123 @@ public class CompanyDao {
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldUserWithCompanyData).newData(existingRelation).build()); VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldUserWithCompanyData).newData(existingRelation).build());
} }
public void updateMissingVatCheckResponses(HttpServletRequest request, LimitRequest limitRequest) {
long limit = limitRequest.getLimit();
if (limit <= 0 || limit > 3000) {
log.error("Invalid limit: {}. Limit should be between 1 and 3000.", limit);
throw new CustomValidationException(Status.VALIDATION_ERROR,
Translator.toLocale(GepafinConstant.INVALID_LIMIT));
}
int successfulUpdates = 0;
int failedUpdates = 0;
int invalidVatNumbers = 0;
Pageable pageable = PageRequest.of(0, (int) limit, Sort.by("id").ascending());
Page<CompanyEntity> companyPage = companyRepository.findCompaniesWithMissingVatCheck(pageable);
List<CompanyEntity> companies = companyPage.getContent();
if (companies.isEmpty()) {
log.info("No companies found with missing VAT check responses.");
return;
}
log.info("Processing {} companies with missing VAT check responses...", companies.size());
for (CompanyEntity company : companies) {
try {
log.info("Processing company ID: {} with VAT number: {}", company.getId(), company.getVatNumber());
VatCheckResponseBean vatResponse = companyService.checkVatNumber(request, company.getVatNumber());
CompanyEntity oldCompanyData = Utils.getClonedEntityForData(company);
if (vatResponse != null && vatResponse.getVatCheckResponse() != null) {
// Convert response to JSON and update the JSON field
String jsonResponse = Utils.convertMapIntoJsonString(vatResponse.getVatCheckResponse());
company.setJson(jsonResponse);
log.info("Company ID {}: JSON field updated successfully.", company.getId());
// Extract and set codiceAteco field
updateCodiceAtecoField(company);
successfulUpdates++;
} else {
company.setJson(NOT_FOUND_JSON);
invalidVatNumbers++;
log.warn("Company ID {}: Invalid or null VAT check response. JSON set to '{}'", company.getId(), NOT_FOUND_JSON);
}
// Adding version history log
/** This code is responsible for adding a version history log for the "Update MissingVatCheckResponses" operation. **/
loggingUtil.addVersionHistory(
VersionHistoryRequest.builder()
.request(request)
.actionType(VersionActionTypeEnum.UPDATE)
.oldData(oldCompanyData)
.newData(company)
.build());
} catch (Exception e) {
failedUpdates++;
log.error("Error updating VAT check response for company ID {}: {}", company.getId(), e.getMessage(), e);
}
}
companyRepository.saveAll(companies);
log.info("VAT check update completed. Limit: {} | Successful: {} | Invalid VAT numbers: {} | Failed: {}",
limit, successfulUpdates, invalidVatNumbers, failedUpdates);
}
private void updateCodiceAtecoField(CompanyEntity company) {
Map<String, Object> vatCheckResponse = Utils.convertJsonStringToMap(company.getJson());
if (vatCheckResponse != null && vatCheckResponse.containsKey("data")) {
Object dataObj = vatCheckResponse.get("data");
if (dataObj instanceof Map) {
Map<String, Object> dataMap = (Map<String, Object>) dataObj;
log.info("Company ID {}: Available keys inside 'data' -> {}", company.getId(), dataMap.keySet());
if (dataMap.containsKey("dettaglio")) {
Object dettaglioObj = dataMap.get("dettaglio");
if (dettaglioObj instanceof Map) {
Map<String, Object> dettaglio = (Map<String, Object>) dettaglioObj;
if (dettaglio.containsKey("codice_ateco")) {
Object codiceAtecoObj = dettaglio.get("codice_ateco");
if (codiceAtecoObj instanceof String) {
String codiceAteco = (String) codiceAtecoObj;
if (codiceAteco != null && !codiceAteco.isEmpty()) {
company.setCodiceAteco(codiceAteco);
log.info("Company ID {}: codiceAteco updated to {}", company.getId(), codiceAteco);
} else {
log.warn("Company ID {}: codiceAteco is null or empty in the response.", company.getId());
}
} else {
log.warn("Company ID {}: 'codice_ateco' is not a string, actual type: {}", company.getId(), codiceAtecoObj.getClass());
}
} else {
log.warn("Company ID {}: 'dettaglio' does not contain 'codice_ateco' key.", company.getId());
}
} else {
log.warn("Company ID {}: 'dettaglio' is not a Map, actual type: {}", company.getId(), dettaglioObj.getClass());
}
} else {
log.warn("Company ID {}: 'dettaglio' section is missing inside 'data'!", company.getId());
}
} else {
log.warn("Company ID {}: 'data' is not a Map, actual type: {}", company.getId(), dataObj.getClass());
}
} else {
log.warn("Company ID {}: 'data' section missing in the JSON response.", company.getId());
}
}
} }

View File

@@ -258,30 +258,28 @@ public class CompanyDocumentDao {
return userActionContext; return userActionContext;
} }
public DocumentResponseBean validateAndDuplicateCompanyDocument(HttpServletRequest request , Long userId ,Long companyDocumentId , Long applicationId , DocumentTypeEnum documentTypeEnum){ public DocumentResponseBean createDuplicateCompanyDocument(HttpServletRequest request , Long userId ,Long companyDocumentId , Long applicationId , DocumentTypeEnum documentTypeEnum){
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId); ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
CompanyDocumentEntity companyDocumentEntity = validateCompanyDocument(companyDocumentId); CompanyDocumentEntity companyDocumentEntity = validateCompanyDocument(companyDocumentId);
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId()); validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
String oldS3Path = companyDocumentEntity.getFilePath(); String companyDocumentPath = companyDocumentEntity.getFilePath();
String newS3Path = s3ConfigBean.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION,applicationEntity.getCall().getId(),applicationId,0L); String documentPath = s3ConfigBean.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION,applicationEntity.getCall().getId(),applicationId,0L);
log.info("Original Paths - oldPath: {}, newPath: {}", oldS3Path, newS3Path); log.info("Original Paths - oldPath: {}, newPath: {}", companyDocumentPath, documentPath);
oldS3Path = amazonS3ServiceImpl.decodeS3Key(amazonS3ServiceImpl.cleanOldPath(oldS3Path)); UploadFileOnAmazonS3Response response;
newS3Path = amazonS3ServiceImpl.cleanNewPath(oldS3Path, newS3Path); try {
log.info("Moving file from {} to {} in bucket {}", oldS3Path, newS3Path, bucketName); response = amazonS3ServiceImpl.copyFile(companyDocumentEntity.getName(), companyDocumentPath, documentPath);
} catch (Exception e) {
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldS3Path, bucketName, newS3Path); log.error("Error occurred while uploading file from Amazon S3: {}", e);
s3Client.copyObject(copyRequest); throw new CustomValidationException(Status.VALIDATION_ERROR,
log.info("File copied successfully from {} to {}", oldS3Path, newS3Path); Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
}
URL amazonS3Url = amazonS3.getUrl(bucketName, newS3Path);
String fileUrl = amazonS3Url.toString();
DocumentEntity entity = new DocumentEntity(); DocumentEntity entity = new DocumentEntity();
entity.setFilePath(fileUrl); entity.setFilePath(response.getFilePath());
entity.setFileName(companyDocumentEntity.getFileName()); entity.setFileName(response.getFileName());
entity.setSource(DocumentSourceTypeEnum.APPLICATION.getValue()); entity.setSource(DocumentSourceTypeEnum.APPLICATION.getValue());
entity.setType(documentTypeEnum.getValue()); entity.setType(documentTypeEnum.getValue());
entity.setSourceId(applicationId); entity.setSourceId(applicationId);

View File

@@ -136,8 +136,8 @@ public class DashboardDao {
} }
private void setRegisteredUsers(Widget1 widget1, UserEntity requestedUserEntity) { private void setRegisteredUsers(Widget1 widget1, UserEntity requestedUserEntity) {
Long activeUsers = userRepository.countByStatusAndRoleEntityRoleTypeAndHubId(UserStatusEnum.ACTIVE.getValue(), Long activeUsers = userRepository.countByStatusAndRoleEntityRoleTypeInAndHubId(UserStatusEnum.ACTIVE.getValue(),
RoleStatusEnum.ROLE_BENEFICIARY.getValue(), requestedUserEntity.getHub().getId()); List.of(RoleStatusEnum.ROLE_BENEFICIARY.getValue(),RoleStatusEnum.ROLE_CONFIDI.getValue()), requestedUserEntity.getHub().getId());
if (activeUsers != null) { if (activeUsers != null) {
widget1.setNumberOfResgisteredUsers(activeUsers); widget1.setNumberOfResgisteredUsers(activeUsers);
} }
@@ -183,10 +183,21 @@ public class DashboardDao {
.map(BeneficiaryPreferredCallEntity::getCallId) .map(BeneficiaryPreferredCallEntity::getCallId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<CallEntity> callEntities = callRepository.findByIdIn(callIds); List<CallEntity> callEntities = callRepository.findByIdIn(callIds);
long activeCallsCount = callEntities.stream() long activeCallsCount=0;
if(Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
activeCallsCount = callEntities.stream()
.filter(call -> CallStatusEnum.PUBLISH.getValue().equals(call.getStatus()) .filter(call -> CallStatusEnum.PUBLISH.getValue().equals(call.getStatus())
&& userEntity.getHub().getId().equals(call.getHub().getId())) && userEntity.getHub().getId().equals(call.getHub().getId()))
.count(); .count();
}
if(Boolean.TRUE.equals(validator.checkIsConfidi())) {
activeCallsCount = callEntities.stream()
.filter(call -> CallStatusEnum.PUBLISH.getValue().equals(call.getStatus())
&& userEntity.getHub().getId().equals(call.getHub().getId())
&& call.getConfidi()) // Add this condition for confidi
.count();
}
beneficiaryWidgetResponseBean.setNumberOfCalls(activeCallsCount); beneficiaryWidgetResponseBean.setNumberOfCalls(activeCallsCount);
} }

View File

@@ -128,7 +128,12 @@ public class DelegationDao {
CompanyEntity companyEntity = companyDao.validateCompany(companyId); CompanyEntity companyEntity = companyDao.validateCompany(companyId);
companyDao.getUserWithCompany(userEntity.getId(), companyId); companyDao.getUserWithCompany(userEntity.getId(), companyId);
updatePlaceholdersForDelegation(user, companyEntity, placeholders, companyDelegationRequest); updatePlaceholdersForDelegation(user, companyEntity, placeholders, companyDelegationRequest);
DocumentEntity documentEntity = documentRepository.findBySource(GepafinConstant.DELEGATION_TEMPLATE).get(0); DocumentEntity documentEntity =null;
if(Boolean.TRUE.equals(validator.checkIsConfidi())){
documentEntity = documentRepository.findBySource(GepafinConstant.DELEGATION_TEMPLATE_CONFIDI).get(0);
}else {
documentEntity = documentRepository.findBySource(GepafinConstant.DELEGATION_TEMPLATE).get(0);
}
return generateDocument(placeholders, documentEntity.getFilePath()); return generateDocument(placeholders, documentEntity.getFilePath());
} }
@@ -293,7 +298,7 @@ public class DelegationDao {
if (validator.checkIsPreInstructor()) { if (validator.checkIsPreInstructor()) {
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluationByApplicationId(applicationId); ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluationByApplicationId(applicationId);
validator.validatePreInstructor(request, applicationEvaluationEntity.getUserId()); validator.validatePreInstructor(request, applicationEvaluationEntity.getUserId());
} else if (validator.checkIsBeneficiary()) { } else if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
userId = validator.validateUser(request).getId(); userId = validator.validateUser(request).getId();
} }
return companyService.getUserWithCompany(userId, companyId); return companyService.getUserWithCompany(userId, companyId);

View File

@@ -66,7 +66,7 @@ public class FaqDao {
CallEntity callEntity = callService.validateCall(callId); CallEntity callEntity = callService.validateCall(callId);
FaqEntity entity = createOrUpdateFaqEntity(faqRequest, callEntity, userEntity, LookUpDataTypeEnum.FAQ); FaqEntity entity = createOrUpdateFaqEntity(faqRequest, callEntity, userEntity, LookUpDataTypeEnum.FAQ);
FaqEntity oldFaqEntity = Utils.getClonedEntityForData(entity); FaqEntity oldFaqEntity = Utils.getClonedEntityForData(entity);
if (validator.checkIsBeneficiary() && companyId == null) { if ((Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) && companyId == null) {
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY)); throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
} }
UserWithCompanyEntity userWithCompanyEntity=null; UserWithCompanyEntity userWithCompanyEntity=null;
@@ -132,7 +132,7 @@ public class FaqDao {
oldFaqEntity = Utils.getClonedEntityForData(faqEntity); oldFaqEntity = Utils.getClonedEntityForData(faqEntity);
actionType = VersionActionTypeEnum.UPDATE; actionType = VersionActionTypeEnum.UPDATE;
} else { } else {
if (Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))) { if (Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue())) && Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_CONFIDI.getValue()))) {
lookUpDataService.getOrCreateLookUpDataEntity(faqReq, type); lookUpDataService.getOrCreateLookUpDataEntity(faqReq, type);
} }
faqEntity = new FaqEntity(); faqEntity = new FaqEntity();

View File

@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.*; import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.model.request.FieldLabelValuePairRequest; import net.gepafin.tendermanagement.model.request.FieldLabelValuePairRequest;
import net.gepafin.tendermanagement.model.response.*; import net.gepafin.tendermanagement.model.response.*;
import net.gepafin.tendermanagement.repositories.DocumentRepository;
import net.gepafin.tendermanagement.repositories.HubRepository; import net.gepafin.tendermanagement.repositories.HubRepository;
import net.gepafin.tendermanagement.service.CallService; import net.gepafin.tendermanagement.service.CallService;
import net.gepafin.tendermanagement.util.PdfUtils; import net.gepafin.tendermanagement.util.PdfUtils;
@@ -54,6 +55,9 @@ public class PdfDao {
@Autowired @Autowired
private HubRepository hubRepository; private HubRepository hubRepository;
@Autowired
private DocumentRepository documentRepository;
public static final Logger log = LoggerFactory.getLogger(PdfDao.class); public static final Logger log = LoggerFactory.getLogger(PdfDao.class);
public byte[] generatePdf(HttpServletRequest request,Long applicationId) { public byte[] generatePdf(HttpServletRequest request,Long applicationId) {
@@ -219,8 +223,10 @@ public class PdfDao {
if (fieldValue.trim().equalsIgnoreCase("true")) { if (fieldValue.trim().equalsIgnoreCase("true")) {
// Use images for tick and cross // Use images for tick and cross
try { try {
DocumentEntity documentEntity = documentRepository.findBySource(GepafinConstant.PDF_TRUE).get(0);
// img = Image.getInstance("true.jpg"); update code after cherry-pick // img = Image.getInstance("true.jpg"); update code after cherry-pick
img = Image.getInstance("https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/true.png"); img = Image.getInstance(documentEntity.getFilePath());
} catch (IOException e) { } catch (IOException e) {
log.error("Error while uploading image for pdf for true"); log.error("Error while uploading image for pdf for true");
} }
@@ -238,7 +244,9 @@ public class PdfDao {
} else if (fieldValue.trim().equalsIgnoreCase("false")) { } else if (fieldValue.trim().equalsIgnoreCase("false")) {
// Use images for tick and cross // Use images for tick and cross
try { try {
img = Image.getInstance("https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/false.png"); DocumentEntity documentEntity = documentRepository.findBySource(GepafinConstant.PDF_FALSE).get(0);
img = Image.getInstance(documentEntity.getFilePath());
} catch (IOException e) { } catch (IOException e) {
log.error("Error while uploading image for pdf for false"); log.error("Error while uploading image for pdf for false");
} }

View File

@@ -49,7 +49,8 @@ public class ProtocolDao {
LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now()); LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
protocolEntity.setYear(utcDateTime.getYear()); protocolEntity.setYear(utcDateTime.getYear());
protocolEntity.setProtocolNumber(protocolNumber); protocolEntity.setProtocolNumber(protocolNumber);
protocolEntity.setTime(LocalTime.now()); LocalTime time = utcDateTime.toLocalTime().withNano(0);
protocolEntity.setTime(time);
protocolEntity.setApplicationId(applicationEntity.getId()); protocolEntity.setApplicationId(applicationEntity.getId());
protocolEntity.setHubId(hubId); protocolEntity.setHubId(hubId);
if(Boolean.TRUE.equals(isForApplication)){ if(Boolean.TRUE.equals(isForApplication)){

View File

@@ -24,11 +24,11 @@ import net.gepafin.tendermanagement.util.LoggingUtil;
import net.gepafin.tendermanagement.util.Utils; import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.util.Validator; import net.gepafin.tendermanagement.util.Validator;
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException; import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException; import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
import net.gepafin.tendermanagement.web.rest.api.errors.Status; import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -40,10 +40,8 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated; import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
@@ -78,6 +76,12 @@ public class UserDao {
@Value("${default.hub.uuid}") @Value("${default.hub.uuid}")
private String defaultHubUuid; private String defaultHubUuid;
@Value("${app.confidi.login.url.suffix}")
private String confidiLogin;
@Value("${app.bandi.login.url.suffix}")
private String bandiLoginUrlSuffix;
@Autowired @Autowired
private Validator validator; private Validator validator;
@@ -138,38 +142,60 @@ public class UserDao {
/** This code is responsible for adding a version history log for the "Create user" operation. **/ /** This code is responsible for adding a version history log for the "Create user" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).newData(userEntity).build()); loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).newData(userEntity).build());
if(beneficiary == null){ if(Boolean.FALSE.equals(roleEntity.getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))){
sendEmailToOnboardingUser(userEntity); sendEmailToOnboardingUser(userEntity, userReq );
} }
return token; return token;
} }
public void sendEmailToOnboardingUser(UserEntity userEntity){ public void sendEmailToOnboardingUser(UserEntity userEntity,UserReq userReq){
SystemEmailTemplateResponse emailTemplate = systemEmailTemplatesService.retrieveTemplateByTypeAndCall( SystemEmailTemplateResponse emailTemplate;
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.USER_ONBOARDING, userEntity.getHub(), null); RoleStatusEnum roleStatus = RoleStatusEnum.valueOf(userEntity.getRoleEntity().getRoleType());
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType =
roleStatus.equals(RoleStatusEnum.ROLE_CONFIDI)
? SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.USER_ONBOARDING_CONFIDI
: SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.USER_ONBOARDING_BANDI;
emailTemplate = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(templateType, userEntity.getHub(), null);
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(emailTemplate.getEmailScenario(), RecipientTypeEnum.USER, userEntity.getId(), userEntity.getEmail(), EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(emailTemplate.getEmailScenario(), RecipientTypeEnum.USER, userEntity.getId(), userEntity.getEmail(),
userEntity.getId(), null, null, null); userEntity.getId(), null, null, null);
String firstName = userEntity.getFirstName() != null ? userEntity.getFirstName() : "";
String lastName = userEntity.getLastName() != null ? userEntity.getLastName() : ""; Map<String, String> placeholders = replacePlaceholders(userEntity, userReq);
String userName = String.join(" ", firstName, lastName).trim(); String body = Utils.replacePlaceholders(emailTemplate.getHtmlContent(), placeholders);
String subject = Utils.replacePlaceholders(emailTemplate.getSubject(), Map.of(
"{{user_name}}", userName
));
String body = Utils.replacePlaceholders(emailTemplate.getHtmlContent(), Map.of(
"{{user_name}}", userName,
"{{user_email}}", userEntity.getEmail()
));
emailNotificationDao.sendMail( emailNotificationDao.sendMail(
userEntity.getHub().getId(), userEntity.getHub().getId(),
subject, emailTemplate.getSubject(),
body, body,
List.of(userEntity.getEmail()), List.of(userEntity.getEmail()),
emailLogRequest emailLogRequest
); );
} }
private Map<String, String> replacePlaceholders(UserEntity userEntity, UserReq userReq) {
RoleStatusEnum roleStatus = RoleStatusEnum.valueOf(userEntity.getRoleEntity().getRoleType());
String confidiLoginUrl = userEntity.getHub().getDomainName() + confidiLogin;
String bandiLoginUrl = userEntity.getHub().getDomainName() + bandiLoginUrlSuffix;
String hubConfigText = userEntity.getHub().getHubConfig();
JSONObject hubConfig = new JSONObject(hubConfigText);
String gepafinEmail = hubConfig.optString(GepafinConstant.EMAIL_SUPPORT, "");
String gepafinPhoneNumber = hubConfig.optString(GepafinConstant.PHONE_SUPPORT, "");
Map<String, String> placeholders = new HashMap<>();
placeholders.put("{{username}}", userEntity.getEmail());
placeholders.put("{{userpassword}}",userReq.getPassword());
String loginUrl = roleStatus.equals(RoleStatusEnum.ROLE_CONFIDI) ? confidiLoginUrl : bandiLoginUrl;
placeholders.put("{{login_url}}",loginUrl);
placeholders.put("{{gepafinphonenumber}}", gepafinPhoneNumber);
placeholders.put("{{gepafinemail}}", gepafinEmail);
return placeholders;
}
private BeneficiaryEntity createBeneficiary(RoleEntity roleEntity, UserReq userReq, HubEntity hub) { private BeneficiaryEntity createBeneficiary(RoleEntity roleEntity, UserReq userReq, HubEntity hub) {
BeneficiaryEntity beneficiaryEntity = null; BeneficiaryEntity beneficiaryEntity = null;
if (RoleStatusEnum.ROLE_BENEFICIARY.getValue().equals(roleEntity.getRoleType())) { if (RoleStatusEnum.ROLE_BENEFICIARY.getValue().equals(roleEntity.getRoleType()) || RoleStatusEnum.ROLE_CONFIDI.getValue().equals(roleEntity.getRoleType())) {
beneficiaryEntity = new BeneficiaryEntity(); beneficiaryEntity = new BeneficiaryEntity();
beneficiaryEntity.setAddress(userReq.getAddress()); beneficiaryEntity.setAddress(userReq.getAddress());
beneficiaryEntity.setCity(userReq.getCity()); beneficiaryEntity.setCity(userReq.getCity());
@@ -765,7 +791,7 @@ public class UserDao {
HubEntity hubEntity = hubService.valdateHub(userEntity.getHub().getId()); HubEntity hubEntity = hubService.valdateHub(userEntity.getHub().getId());
String beneficiaryRoleType = RoleStatusEnum.ROLE_BENEFICIARY.getValue(); String beneficiaryRoleType = RoleStatusEnum.ROLE_BENEFICIARY.getValue();
if (validator.checkIsBeneficiary()) { if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
// Validate if the new email already exists for another beneficiary in the same hub // Validate if the new email already exists for another beneficiary in the same hub
boolean emailExistsForBeneficiary = userRepository.existsByEmailIgnoreCaseForBeneficiaries( boolean emailExistsForBeneficiary = userRepository.existsByEmailIgnoreCaseForBeneficiaries(
userReq.getEmail(), hubEntity.getUniqueUuid(), beneficiaryRoleType); userReq.getEmail(), hubEntity.getUniqueUuid(), beneficiaryRoleType);

View File

@@ -66,4 +66,7 @@ public class HubEntity extends BaseEntity{
@Column(name = "EVALUATION_EXPIRATION_DAYS") @Column(name = "EVALUATION_EXPIRATION_DAYS")
private Long evaluationExpirationDays; private Long evaluationExpirationDays;
@Column(name = "HUB_CONFIG")
private String hubConfig;
} }

View File

@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.entities;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Data; import lombok.Data;
import net.gepafin.tendermanagement.config.LocalTimeAttributeConverter;
import java.time.LocalTime; import java.time.LocalTime;
@@ -20,6 +21,7 @@ public class ProtocolEntity extends BaseEntity {
private Long call; private Long call;
@Column(name = "TIME", nullable = false) @Column(name = "TIME", nullable = false)
@Convert(converter = LocalTimeAttributeConverter.class)
private LocalTime time; private LocalTime time;
@Column(name="APPLICATION_ID") @Column(name="APPLICATION_ID")

View File

@@ -52,10 +52,10 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE"), INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE"),
ADMISSIBILITY_NOTIFICATION("ADMISSIBILITY_NOTIFICATION"), ADMISSIBILITY_NOTIFICATION("ADMISSIBILITY_NOTIFICATION"),
AMENDMENT_REMINDER("AMENDMENT_REMINDER"), AMENDMENT_REMINDER("AMENDMENT_REMINDER"),
USER_ONBOARDING("USER_ONBOARDING"), USER_ONBOARDING_CONFIDI("USER_ONBOARDING_CONFIDI"),
USER_ONBOARDING_BANDI("USER_ONBOARDING_BANDI"),
PASSWORD_RESET("PASSWORD_RESET"), PASSWORD_RESET("PASSWORD_RESET"),
INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION"); INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION");
private String value; private String value;
SystemEmailTemplatesEntityTypeEnum(String value) { SystemEmailTemplatesEntityTypeEnum(String value) {

View File

@@ -4,14 +4,14 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum MatchModeEnum { public enum MatchModeEnum {
STARTSWITH("Starts with"), STARTSWITH("startsWith"),
ENDSWITH("Ends with"), ENDSWITH("endsWith"),
CONTAINS("Contains"), CONTAINS("contains"),
EQUALS("Equals"), EQUALS("equals"),
DATEIS("Date is"), DATEIS("dateIs"),
DATEISNOT("Date is not"), DATEISNOT("dateIsNot"),
BEFORE("Date is before"), BEFORE("dateBefore"),
AFTER("Date is after"); AFTER("dateAfter");
private String value; private String value;

View File

@@ -8,7 +8,8 @@ public enum RoleStatusEnum {
ROLE_SUPER_ADMIN("ROLE_SUPER_ADMIN"), ROLE_SUPER_ADMIN("ROLE_SUPER_ADMIN"),
ROLE_PRE_INSTRUCTOR("ROLE_PRE_INSTRUCTOR"), ROLE_PRE_INSTRUCTOR("ROLE_PRE_INSTRUCTOR"),
ROLE_GEPAFIN_OPERATOR("ROLE_GEPAFIN_OPERATOR"), ROLE_GEPAFIN_OPERATOR("ROLE_GEPAFIN_OPERATOR"),
ROLE_INSTRUCTOR_MANAGER("ROLE_INSTRUCTOR_MANAGER"); ROLE_INSTRUCTOR_MANAGER("ROLE_INSTRUCTOR_MANAGER"),
ROLE_CONFIDI("ROLE_CONFIDI");
private String value; private String value;

View File

@@ -65,6 +65,7 @@ public enum UserActionContextEnum {
CHECK_COMPANY_VAT_NUMBER("CHECK_COMPANY_VAT_NUMBER"), CHECK_COMPANY_VAT_NUMBER("CHECK_COMPANY_VAT_NUMBER"),
GET_COMPANY_BY_USER("GET_COMPANY_BY_USER"), GET_COMPANY_BY_USER("GET_COMPANY_BY_USER"),
REMOVE_COMPANY_FROM_USER("REMOVE_COMPANY_FROM_USER"), REMOVE_COMPANY_FROM_USER("REMOVE_COMPANY_FROM_USER"),
UPDATE_COMPANY_JSON("UPDATE_COMPANY_JSON"),
/** LookUpData action context **/ /** LookUpData action context **/
CREATE_LOOKUP_DATA("CREATE_LOOKUP_DATA"), CREATE_LOOKUP_DATA("CREATE_LOOKUP_DATA"),
@@ -213,7 +214,8 @@ public enum UserActionContextEnum {
GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION("GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION"), GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION("GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION"),
GET_ALL_USER_ACTION_BY_PAGINATION("GET_ALL_USER_ACTION_BY_PAGINATION"), GET_ALL_USER_ACTION_BY_PAGINATION("GET_ALL_USER_ACTION_BY_PAGINATION"),
GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION"), GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION"),
UPDATE_CALL_END_DATE_AND_TIME("UPDATE_CALL_END_DATE_AND_TIME"); UPDATE_CALL_END_DATE_AND_TIME("UPDATE_CALL_END_DATE_AND_TIME"),
UPDATE_EXPIRED_CALL("UPDATE_EXPIRED_CALL") ;
private final String value; private final String value;

View File

@@ -4,6 +4,7 @@ import lombok.Data;
import net.gepafin.tendermanagement.enums.CallStatusEnum; import net.gepafin.tendermanagement.enums.CallStatusEnum;
import java.util.List; import java.util.List;
import java.util.Map;
@Data @Data
public class CallPageableRequestBean { public class CallPageableRequestBean {
@@ -11,4 +12,8 @@ public class CallPageableRequestBean {
private GlobalFilters globalFilters; private GlobalFilters globalFilters;
private List<CallStatusEnum> status; private List<CallStatusEnum> status;
private Map<String, FilterCriteria> filters;
private Boolean confidi;
} }

View File

@@ -0,0 +1,8 @@
package net.gepafin.tendermanagement.model.request;
import lombok.Data;
@Data
public class LimitRequest {
private Long limit;
}

View File

@@ -46,5 +46,7 @@ public class ApplicationEvaluationFormResponse {
private EvaluationVersionEnum evaluationVersion; private EvaluationVersionEnum evaluationVersion;
private Long numberOfCheck; private Long numberOfCheck;
private Long appointmentTemplateId; private Long appointmentTemplateId;
private String companyVatNumber;
private String companyCodiceAteco;
} }

View File

@@ -47,5 +47,7 @@ public class ApplicationEvaluationResponse {
private Long numberOfCheck; private Long numberOfCheck;
private Long appointmentTemplateId; private Long appointmentTemplateId;
private EvaluationVersionEnum evaluationVersion; private EvaluationVersionEnum evaluationVersion;
private String companyVatNumber;
private String companyCodiceAteco;
} }

View File

@@ -54,4 +54,9 @@ public interface CallRepository extends JpaRepository<CallEntity, Long>, JpaSpec
List<CallEntity> findByIdIn(@Param("ids") List<Long> ids); List<CallEntity> findByIdIn(@Param("ids") List<Long> ids);
@Query("SELECT c FROM CallEntity c WHERE c.id IN :ids AND c.status IN :status AND c.confidi= :confidi")
List<CallEntity> findByIdInAndStatusInAndConfidi(@Param("ids") List<Long> ids, @Param("status") List<String> status,Boolean confidi);
public List<CallEntity> findByStatusInAndHubIdAndConfidi(List<String> callStatus, Long hubId,Boolean onlyConfidiCall);
} }

View File

@@ -1,7 +1,10 @@
package net.gepafin.tendermanagement.repositories; package net.gepafin.tendermanagement.repositories;
import org.springframework.data.domain.Pageable;
import java.util.List; import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
@@ -21,5 +24,12 @@ public interface CompanyRepository extends JpaRepository<CompanyEntity, Long> {
CompanyEntity findByVatNumberAndHubId(String vatNumber, Long hubId); CompanyEntity findByVatNumberAndHubId(String vatNumber, Long hubId);
@Query("""
SELECT c FROM CompanyEntity c
WHERE c.vatNumber IS NOT NULL
AND (c.json IS NULL OR c.json = '')
""")
Page<CompanyEntity> findCompaniesWithMissingVatCheck(Pageable pageable);
} }

View File

@@ -1,6 +1,7 @@
package net.gepafin.tendermanagement.repositories; package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
@@ -32,6 +33,10 @@ public interface UserRepository extends JpaRepository<UserEntity, Long>, JpaSpec
Long countByStatusAndRoleEntityRoleTypeAndHubId(String status, String roleName, Long hubId); Long countByStatusAndRoleEntityRoleTypeAndHubId(String status, String roleName, Long hubId);
Long countByStatusAndRoleEntityRoleTypeInAndHubId(String status,List<String> roleName, Long hubId);
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId); Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
// Boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId); // Boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);

View File

@@ -19,4 +19,6 @@ AmazonS3Service {
UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath); UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath);
UploadFileOnAmazonS3Response copyFile(String fileName, String oldS3Path, String newS3Path);
} }

View File

@@ -21,7 +21,7 @@ public interface CallService {
CallResponse getCallById (HttpServletRequest request, Long callId,Long companyId); CallResponse getCallById (HttpServletRequest request, Long callId,Long companyId);
List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall); List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall);
CallResponse validateCallData(HttpServletRequest request, Long callId); CallResponse validateCallData(HttpServletRequest request, Long callId);

View File

@@ -20,7 +20,7 @@ public interface CompanyDocumentService {
void deleteCompanyFile(HttpServletRequest request,Long companyDocumentId); void deleteCompanyFile(HttpServletRequest request,Long companyDocumentId);
DocumentResponseBean validateAndDuplicateCompanyDocument(HttpServletRequest request, Long companyDocumentId, Long applicationId, DocumentTypeEnum typeEnum); DocumentResponseBean createDuplicateCompanyDocument(HttpServletRequest request, Long companyDocumentId, Long applicationId, DocumentTypeEnum typeEnum);
List<CompanyDocumentResponseBean> getAllCompanyDocument(HttpServletRequest request ,Long companyId , CompanyDocumentTypeEnum typeEnum); List<CompanyDocumentResponseBean> getAllCompanyDocument(HttpServletRequest request ,Long companyId , CompanyDocumentTypeEnum typeEnum);

View File

@@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.gepafin.tendermanagement.model.request.LimitRequest;
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean; import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -45,4 +46,6 @@ public interface CompanyService {
UserWithCompanyEntity getUserWithCompanyEntity(Long userId,Long companyId); UserWithCompanyEntity getUserWithCompanyEntity(Long userId,Long companyId);
void removeCompanyFromList(HttpServletRequest request, Long companyId); void removeCompanyFromList(HttpServletRequest request, Long companyId);
void updateMissingVatCheckResponses(HttpServletRequest request, LimitRequest limitRequest);
} }

View File

@@ -160,20 +160,14 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
@Override @Override
public UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath) { public UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath) {
try { try {
log.info("Original Paths - oldPath: {}, newPath: {}", oldPath, newPath);
oldPath = decodeS3Key(cleanOldPath(oldPath));
newPath = cleanNewPath(oldPath, newPath);
log.info("Moving file from {} to {} in bucket {}", oldPath, newPath, bucketName); log.info("Moving file from {} to {} in bucket {}", oldPath, newPath, bucketName);
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldPath, bucketName, newPath); UploadFileOnAmazonS3Response response = copyFile(fileName, oldPath, newPath);
s3Client.copyObject(copyRequest);
log.info("File copied successfully from {} to {}", oldPath, newPath);
s3Client.deleteObject(bucketName, oldPath); s3Client.deleteObject(bucketName, decodeS3Key(cleanOldPath(oldPath)));
log.info("Original file deleted successfully: {}", oldPath); log.info("Original file deleted successfully: {}", oldPath);
String filePath = s3Url + newPath;
return UploadFileOnAmazonS3Response.builder().fileName(fileName).filePath(filePath).build(); return response;
} catch (AmazonServiceException e) { } catch (AmazonServiceException e) {
log.error("AWS service error while moving file: {}", e.getErrorMessage(), e); log.error("AWS service error while moving file: {}", e.getErrorMessage(), e);
throw e; throw e;
@@ -193,4 +187,34 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
public String cleanOldPath(String oldPath) { public String cleanOldPath(String oldPath) {
return oldPath.replace(s3Url, ""); return oldPath.replace(s3Url, "");
} }
@Override
public UploadFileOnAmazonS3Response copyFile(String fileName, String oldS3Path, String newS3Path){
try {
log.info("Copying file from {} to {} in bucket {}", oldS3Path, newS3Path, bucketName);
oldS3Path = decodeS3Key(cleanOldPath(oldS3Path));
newS3Path = cleanNewPath(oldS3Path, newS3Path);
log.info("Copying file from {} to {} in bucket {}", oldS3Path, newS3Path, bucketName);
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldS3Path, bucketName, newS3Path);
s3Client.copyObject(copyRequest);
log.info("File copied successfully from {} to {}", oldS3Path, newS3Path);
URL amazonS3Url = amazonS3.getUrl(bucketName, newS3Path);
String fileUrl = amazonS3Url.toString();
return UploadFileOnAmazonS3Response.builder().fileName(fileName).filePath(fileUrl).build();
}
catch (AmazonServiceException e) {
log.error("AWS service error while copying file: {}", e.getErrorMessage(), e);
throw e;
} catch (SdkClientException e) {
log.error("SDK client error while copying file: {}", e.getMessage(), e);
throw e;
} catch (Exception e) {
log.error("Unexpected error while copying file: {}", e.getMessage(), e);
throw e;
}
}
} }

View File

@@ -81,7 +81,7 @@ public class ApplicationServiceImpl implements ApplicationService {
validator.validateUserWithCompany(request, companyId); validator.validateUserWithCompany(request, companyId);
} }
ApplicationEntity applicationEntity =null; ApplicationEntity applicationEntity =null;
if(validator.checkIsBeneficiary()){ if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())){
if(companyId==null){ if(companyId==null){
throw new ForbiddenAccessException(Status.FORBIDDEN,Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY)); throw new ForbiddenAccessException(Status.FORBIDDEN,Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
} }

View File

@@ -61,10 +61,10 @@ public class CallServiceImpl implements CallService {
} }
@Override @Override
@Transactional(readOnly = true) @Transactional(rollbackFor = Exception.class)
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall) { public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
return callDao.getAllCalls(request,user,companyId,onlyPreferredCall); return callDao.getAllCalls(request,user,companyId,onlyPreferredCall,onlyConfidiCall);
} }
@@ -104,6 +104,7 @@ public class CallServiceImpl implements CallService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request,Long companyId , Boolean onlyPreferredCall, CallPageableRequestBean callPageableRequestBean) { public PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request,Long companyId , Boolean onlyPreferredCall, CallPageableRequestBean callPageableRequestBean) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
return callDao.getAllCallsByPagination(request,user,companyId,onlyPreferredCall,callPageableRequestBean); return callDao.getAllCallsByPagination(request,user,companyId,onlyPreferredCall,callPageableRequestBean);

View File

@@ -31,7 +31,7 @@ public class CommunicationServiceImpl implements CommunicationService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request ,CommunicationRequestBean communicationRequestBean, Long amendmentId) { public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request ,CommunicationRequestBean communicationRequestBean, Long amendmentId) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) { if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) {
validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId()); validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId());
} else { } else {
validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
@@ -43,7 +43,7 @@ public class CommunicationServiceImpl implements CommunicationService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String deleteComment(HttpServletRequest request ,Long amendmentId, Long commentId) { public String deleteComment(HttpServletRequest request ,Long amendmentId, Long commentId) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) { if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) {
validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId()); validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId());
} else { } else {
validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId()); validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());

View File

@@ -53,9 +53,9 @@ public class CompanyDocumentServiceImpl implements CompanyDocumentService {
} }
@Override @Override
public DocumentResponseBean validateAndDuplicateCompanyDocument(HttpServletRequest request, Long companyDocumentId, Long applicationId, DocumentTypeEnum typeEnum) { public DocumentResponseBean createDuplicateCompanyDocument(HttpServletRequest request, Long companyDocumentId, Long applicationId, DocumentTypeEnum typeEnum) {
UserEntity user = validator.validateUser(request); UserEntity user = validator.validateUser(request);
return companyDocumentDao.validateAndDuplicateCompanyDocument(request, user.getId(), companyDocumentId,applicationId,typeEnum); return companyDocumentDao.createDuplicateCompanyDocument(request, user.getId(), companyDocumentId,applicationId,typeEnum);
} }
@Override @Override

View File

@@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.gepafin.tendermanagement.model.request.LimitRequest;
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean; import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -130,4 +131,10 @@ public class CompanyServiceImpl implements CompanyService {
UserEntity userEntity =validator.validateUser(request); UserEntity userEntity =validator.validateUser(request);
companyDao.removeCompanyFromList(userEntity, companyId); companyDao.removeCompanyFromList(userEntity, companyId);
} }
@Override
public void updateMissingVatCheckResponses(HttpServletRequest request, LimitRequest limitRequest) {
UserEntity userEntity =validator.validateUser(request);
companyDao.updateMissingVatCheckResponses(request, limitRequest);
}
} }

View File

@@ -788,4 +788,12 @@ public class Utils {
public static boolean isValidBoolean(String value) { public static boolean isValidBoolean(String value) {
return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value); return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
} }
public static Map<String, Object> convertJsonStringToMap(String jsonString) {
try {
return mapper.readValue(jsonString, Map.class);
} catch (Exception e) {
e.printStackTrace(); // Handle the exception
return null;
}
}
} }

View File

@@ -195,4 +195,15 @@ public class Validator {
} }
return false; return false;
} }
public Boolean checkIsConfidi() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.isAuthenticated()) {
for (GrantedAuthority authority : authentication.getAuthorities()) {
if (RoleStatusEnum.ROLE_CONFIDI.getValue().equals(authority.getAuthority())) {
return true;
}
}
}
return false;
}
} }

View File

@@ -101,7 +101,7 @@ public interface CallApi {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "", @GetMapping(value = "",
produces = { "application/json" }) produces = { "application/json" })
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall); ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall,@RequestParam(value = "onlyConfidiCall", required = false) Boolean onlyConfidiCall);
@Operation(summary = "Api to validate call", @Operation(summary = "Api to validate call",

View File

@@ -33,7 +33,7 @@ public interface CommunicationApi {
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PostMapping(value = "/{amendmentId}", produces = { "application/json" }) @PostMapping(value = "/{amendmentId}", produces = { "application/json" })
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER')") @PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER') || hasRole('ROLE_CONFIDI')")
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request,
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId); @RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId);
@@ -55,7 +55,7 @@ public interface CommunicationApi {
@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 = "/{amendmentId}/{commentId}", produces = { "application/json" }) @PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER')") @PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER') || hasRole('ROLE_CONFIDI')")
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request,
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId, @PathVariable(value = "commentId") Long commentId); @RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId, @PathVariable(value = "commentId") Long commentId);

View File

@@ -3,9 +3,11 @@ package net.gepafin.tendermanagement.web.rest.api;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.gepafin.tendermanagement.model.request.LimitRequest;
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean; import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
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;
@@ -155,4 +157,16 @@ public interface CompanyApi {
ResponseEntity<Response<Void>> removeCompanyFromList(HttpServletRequest request, ResponseEntity<Response<Void>> removeCompanyFromList(HttpServletRequest request,
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId); @Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId);
@Operation(summary = "Api to update company with no data through script", 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) })) })
@PostMapping(value = "/updateCompanyJson", produces = { "application/json" })
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') ")
ResponseEntity<Response<Void>> updateMissingVatCheckResponses(HttpServletRequest request,
@Parameter(description = "Limit request object ", required = true) @RequestBody LimitRequest limitRequest);
} }

View File

@@ -102,7 +102,7 @@ public interface CompanyDocumentApi {
@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 = "/{id}/document/upload", produces = MediaType.APPLICATION_JSON_VALUE) @PutMapping(value = "/{id}/document/upload", produces = MediaType.APPLICATION_JSON_VALUE)
default ResponseEntity<Response<DocumentResponseBean>> validateAndDuplicateCompanyDocument (HttpServletRequest httpServletRequest, @Parameter(description = "Company Document Id", required = true) @PathVariable("id") Long companyDocumentId, default ResponseEntity<Response<DocumentResponseBean>> createDuplicateCompanyDocument (HttpServletRequest httpServletRequest, @Parameter(description = "Company Document Id", required = true) @PathVariable("id") Long companyDocumentId,
@Parameter(description = "Application Id", required = true) @RequestParam Long applicationId, @Parameter(description = "Application Id", required = true) @RequestParam Long applicationId,
@RequestParam("documentType") DocumentTypeEnum documentTypeEnum) { @RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@@ -93,13 +93,13 @@ public class CallApiController implements CallApi {
@Override @Override
@Transactional @Transactional
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall) { public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
/** This code is responsible for creating user action logs for the "get all Calls" operation. **/ /** This code is responsible for creating user action logs for the "get all Calls" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW) loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
.actionContext(UserActionContextEnum.GET_CALL).build()); .actionContext(UserActionContextEnum.GET_CALL).build());
List<CallDetailsResponseBean> calls = callService.getAllCalls(request, companyId, onlyPreferredCall); List<CallDetailsResponseBean> calls = callService.getAllCalls(request, companyId, onlyPreferredCall,onlyConfidiCall);
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(calls, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG))); .body(new Response<>(calls, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));

View File

@@ -6,6 +6,7 @@ import java.util.Map;
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.LimitRequest;
import net.gepafin.tendermanagement.model.request.UserActionRequest; import net.gepafin.tendermanagement.model.request.UserActionRequest;
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean; import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
import net.gepafin.tendermanagement.util.LoggingUtil; import net.gepafin.tendermanagement.util.LoggingUtil;
@@ -188,4 +189,16 @@ public class CompanyApiController implements CompanyApi{
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DELETE_SUCCESS_MSG))); .body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DELETE_SUCCESS_MSG)));
} }
@Override
public ResponseEntity<Response<Void>> updateMissingVatCheckResponses(HttpServletRequest request, LimitRequest limitRequest) {
log.info("Api to update company json field");
/** This code is responsible for creating user action logs for the "Update company json field" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_COMPANY_JSON).build());
companyService.updateMissingVatCheckResponses(request, limitRequest);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_UPDATED_SUCCESS_MSG)));
}
} }

View File

@@ -91,12 +91,12 @@ public class CompanyDocumentApiControlller implements CompanyDocumentApi {
} }
@Override @Override
public ResponseEntity<Response<DocumentResponseBean>> validateAndDuplicateCompanyDocument(HttpServletRequest httpServletRequest, Long companyDocumentId , Long applicationId,DocumentTypeEnum typeEnum) { public ResponseEntity<Response<DocumentResponseBean>> createDuplicateCompanyDocument(HttpServletRequest httpServletRequest, Long companyDocumentId , Long applicationId,DocumentTypeEnum typeEnum) {
/** This code is responsible for creating user action logs for the "duplicate company document" operation. **/ /** This code is responsible for creating user action logs for the "duplicate company document" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.DUPLICATE_COMPANY_DOCUMENT).build()); loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.DUPLICATE_COMPANY_DOCUMENT).build());
DocumentResponseBean responseBeans = companyDocumentService.validateAndDuplicateCompanyDocument(httpServletRequest, companyDocumentId,applicationId,typeEnum); DocumentResponseBean responseBeans = companyDocumentService.createDuplicateCompanyDocument(httpServletRequest, companyDocumentId,applicationId,typeEnum);
return ResponseEntity.status(HttpStatus.CREATED) return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<DocumentResponseBean>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_COPIED_SUCCESSFULLY))); .body(new Response<DocumentResponseBean>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_COPIED_SUCCESSFULLY)));
} }

View File

@@ -20,7 +20,7 @@ default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
#Login to Odessa, Appointment Creation, Upload document Configuration #Login to Odessa, Appointment Creation, Upload document Configuration
appointment.base.url=https://demo.galileonetwork.it/gateway/rest appointment.base.url=https://demo.galileonetwork.it/gateway/rest
appointment.portal.user=UtenzaAPIPortal@621 appointment.portal.user=UtenzaAPIPortal@621
appointment.portal.password=u13nzaAP1P0rtal appointment.portal.password=u13nzaAP1P0rtal!
appointment.portal.source=GEPAFINPORTAL appointment.portal.source=GEPAFINPORTAL
appointment.portal.context=GEPAFINPORTAL appointment.portal.context=GEPAFINPORTAL
flagDaFirmare=false flagDaFirmare=false

View File

@@ -18,7 +18,7 @@ default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
appointment.base.url=https://demo.galileonetwork.it/gateway/rest appointment.base.url=https://demo.galileonetwork.it/gateway/rest
appointment.portal.user=UtenzaAPIPortal@621 appointment.portal.user=UtenzaAPIPortal@621
appointment.portal.password=u13nzaAP1P0rtal appointment.portal.password=u13nzaAP1P0rtal!
appointment.portal.source=GEPAFINPORTAL appointment.portal.source=GEPAFINPORTAL
appointment.portal.context=GEPAFINPORTAL appointment.portal.context=GEPAFINPORTAL
flagDaFirmare=false flagDaFirmare=false

View File

@@ -27,7 +27,7 @@ default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
#Login to Odessa, Appointment Creation, Upload document Configuration #Login to Odessa, Appointment Creation, Upload document Configuration
appointment.base.url=https://prd.galileonetwork.it/gateway/rest appointment.base.url=https://prd.galileonetwork.it/gateway/rest
appointment.portal.user=UtenzaAPIPortal@621 appointment.portal.user=UtenzaAPIPortal@621
appointment.portal.password=u13nzaAP1P0rtal appointment.portal.password=u13nzaAP1P0rtal!
appointment.portal.source=GEPAFINPORTAL appointment.portal.source=GEPAFINPORTAL
appointment.portal.context=GEPAFINPORTAL appointment.portal.context=GEPAFINPORTAL
flagDaFirmare=true flagDaFirmare=true

View File

@@ -16,7 +16,7 @@ default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
appointment.base.url=https://demo.galileonetwork.it/gateway/rest appointment.base.url=https://demo.galileonetwork.it/gateway/rest
appointment.portal.user=UtenzaAPIPortal@621 appointment.portal.user=UtenzaAPIPortal@621
appointment.portal.password=u13nzaAP1P0rtal appointment.portal.password=u13nzaAP1P0rtal!
appointment.portal.source=GEPAFINPORTAL appointment.portal.source=GEPAFINPORTAL
appointment.portal.context=GEPAFINPORTAL appointment.portal.context=GEPAFINPORTAL
flagDaFirmare=false flagDaFirmare=false

View File

@@ -69,3 +69,6 @@ default.hub.pdf.banner=https://mementoresources.s3.amazonaws.com/gepafin/staging
spring.cloud.openfeign.client.config.default.connectTimeout=300000 spring.cloud.openfeign.client.config.default.connectTimeout=300000
spring.cloud.openfeign.client.config.default.readTimeout=300000 spring.cloud.openfeign.client.config.default.readTimeout=300000
spring.rabbitmq.connection-timeout=120000 spring.rabbitmq.connection-timeout=120000
app.bandi.login.url.suffix=/loginadmin
app.confidi.login.url.suffix=/confidi

View File

@@ -2561,5 +2561,118 @@
<sqlFile dbms="postgresql" <sqlFile dbms="postgresql"
path="db/dump/update_form_field_data_03-03-2025.sql"/> path="db/dump/update_form_field_data_03-03-2025.sql"/>
</changeSet> </changeSet>
<changeSet id="05-03-2025_NK_190115" author="Nisha Kashyap">
<sql dbms="postgresql">select
setval('gepafin_schema.role_id_seq', (select
max(id)+1
from gepafin_schema.role), false)
</sql>
<sql dbms="postgresql">select
setval('gepafin_schema.beneficiary_id_seq', (select
max(id)+1
from gepafin_schema.beneficiary), false)
</sql>
<insert tableName="role">
<column name="role_name" value="confidi"/>
<column name="role_type" value="ROLE_CONFIDI"/>
<column name="description"
value="Companies or individuals looking for financing opportunities. They can view, search, and apply to available confidi calls."/>
<column name="created_date" value="2025-03-05 00:00:00"/>
<column name="updated_date" value="2025-03-05 00:00:00"/>
<column name="permissions" value="VIEW_CONFIDI_CALLS, APPLY_CONFIDI_CALLS"/>
<column name="region_id" valueComputed="1"/>
</insert>
<insert tableName="BENEFICIARY">
<column name="EMAIL" value="confidi@test.test"/>
<column name="FIRST_NAME" value="Test"/>
<column name="LAST_NAME" value="Confidi"/>
<column name="PHONE_NUMBER" value="1234567890"/>
<column name="ORGANIZATION" value="ConfidiOrg"/>
<column name="ADDRESS" value="789 Victory Road"/>
<column name="CITY" value="Naples"/>
<column name="COUNTRY" value="Italy"/>
<column name="CODICE_FISCALE" value="0123456789"/>
<column name="DATE_OF_BIRTH" value="1985-06-15T00:00:00"/>
<column name="PRIVACY" value="true"/>
<column name="TERMS" value="true"/>
<column name="MARKETING" value="false"/>
<column name="OFFERS" value="true"/>
<column name="THIRD_PARTY" value="false"/>
<column name="HUB_ID" value="1"/>
</insert>
<insert tableName="GEPAFIN_USER">
<column name="email" value="confidi@test.test"/>
<column name="password" value="$2a$10$doUyOcEm8WPuFfpFT5y18.1DvZzF7exbqgy9X0P27cUBK7YWbfzzS"/>
<column name="first_name" value="Test"/>
<column name="last_name" value="Confidi"/>
<column name="last_login" value="2024-03-05T12:00:00"/>
<column name="organization" value="ConfidiOrg"/>
<column name="role_id" valueComputed="(SELECT id FROM role WHERE role_type = 'ROLE_CONFIDI')"/>
<column name="status" value="ACTIVE"/>
<column name="last_login" value="2024-12-19 00:00:00"/>
<column name="organization" value="ConfidiOrg"/>
<column name="address" value="789 Victory Road"/>
<column name="city" value="Naples"/>
<column name="country" value="Italy"/>
<column name="hub_id" value="1"/>
<column name="beneficiary_id" valueComputed="(SELECT id FROM BENEFICIARY WHERE EMAIL = 'confidi@test.test' ORDER BY id DESC LIMIT 1)"/>
</insert>
</changeSet>
<changeSet id="13-03-2025_PK_121745" author="Piyush Kag">
<addColumn tableName="hub">
<column name="hub_config" type="TEXT"/>
</addColumn>
<sqlFile dbms="postgresql" path="db/dump/update_hub_data_for_hub_config_13-03-2025.sql"/>
<sqlFile dbms="postgresql"
path="db/dump/update_system_email_template_for_confidi_user_13-03-2025.sql"/>
<sql dbms="postgresql">select
setval('gepafin_schema.system_email_template_id_seq', (select
max(id)+1
from gepafin_schema.system_email_template), false)
</sql>
<sqlFile dbms="postgresql"
path="db/dump/insert_system_email_template_for_user_13-03-2025.sql"/>
</changeSet>
<changeSet id="06-03-2025_NK_190111" author="Nisha Kashyap">
<update tableName="role">
<column name="permissions" value="VIEW_CONFIDI_CALLS,APPLY_CONFIDI_CALLS"/>
<where>role_type = 'ROLE_CONFIDI'</where>
</update>
</changeSet>
<changeSet id="10-03-2025_NK_180430" author="Nisha Kashyap">
<insert tableName="document">
<column name="file_name" value="PROCURA_BANDI_TEMPLATE_CONFIDI.DOCX"></column>
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/PROCURA_BANDI_TEMPLATE_CONFIDI.docx"></column>
<column name="type" value="DOCUMENT"></column>
<column name="source" value="DELEGATION_TEMPLATE_CONFIDI"></column>
</insert>
</changeSet>
<changeSet id="12-03-2025_NK_180530" author="Nisha Kashyap">
<sqlFile dbms="postgresql"
path="db/dump/update_form_field_data_12-03-2025.sql"/>
</changeSet>
<changeSet id="18-03-2025_NK_181010" author="Nisha Kashyap">
<insert tableName="document">
<column name="file_name" value="GEPAFIN_PDF_TRUE.PNG"></column>
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/true.png"></column>
<column name="type" value="IMAGE"></column>
<column name="source" value="PDF_TRUE"></column>
</insert>
<insert tableName="document">
<column name="file_name" value="GEPAFIN_PDF_FALSE.PNG"></column>
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/false.png"></column>
<column name="type" value="IMAGE"></column>
<column name="source" value="PDF_FALSE"></column>
</insert>
</changeSet>
</databaseChangeLog> </databaseChangeLog>

View File

@@ -0,0 +1,43 @@
INSERT INTO gepafin_schema.system_email_template
(template_name, "type", html_content, subject, "json", "system", is_deleted, created_date, updated_date, email_scenario)
VALUES
(
'Welcome Email for New Bandi User',
'USER_ONBOARDING_BANDI',
'<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><strong>Gentile Utente,</strong></p>
<p>Le comunichiamo che il Suo account per accedere al portale è stato creato con successo.</p>
<p><strong>Di seguito trova le credenziali di accesso:</strong></p>
<ul>
<li><strong>Indirizzo portale:</strong> <a href="{{login_url}}">{{login_url}}</a></li>
<li><strong>Nome utente:</strong> {{username}}</li>
<li><strong>Password:</strong> {{userpassword}}</li>
</ul>
<p>Al primo accesso le consigliamo di modificare la password con una nuova di Sua scelta.
Per motivi di sicurezza, Le consigliamo di scegliere una password che:</p>
<ul>
<li>Sia composta da almeno 8 caratteri</li>
<li>Contenga lettere maiuscole e minuscole</li>
<li>Includa numeri e caratteri speciali</li>
</ul>
<p>In caso di difficoltà durante laccesso o per qualsiasi chiarimento, può contattare il nostro servizio di assistenza:</p>
<ul>
<li>Email: <a href="mailto:{{gepafinemail}}">{{gepafinemail}}</a></li>
<li>Telefono: {{gepafinphonenumber}}</li>
</ul>
<p>La invitiamo a conservare queste informazioni in un luogo sicuro e a non condividerle con terzi.</p>
<p>Cordiali saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>',
'Le Sue Credenziali di Accesso al Portale Bandi',
NULL,
true,
false,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
'USER_CREATION'
);

View File

@@ -0,0 +1,6 @@
UPDATE FORM_FIELD
SET LABEL = 'Seleziona File',
SETTINGS = '[{"name": "label", "value": "Seleziona File"},{"name": "documentCategories", "value": []},{"name": "isDelegation", "value": false}]',
UPDATED_DATE = CURRENT_TIMESTAMP
WHERE NAME = 'fileselect';

View File

@@ -0,0 +1,8 @@
UPDATE hub
SET hub_config = '{"email_support": "", "phone_support": ""}'
WHERE unique_uuid = 't7jh5wfg9QXylNaTZkPoE';
-- Update hub table with specific email and phone support values
UPDATE hub
SET hub_config = '{"email_support": "assistenzaportale@gepafin.it", "phone_support": "3517561769"}'
WHERE unique_uuid = 'p4lk3bcx1RStqTaIVVbXs';

View File

@@ -0,0 +1,40 @@
UPDATE gepafin_schema.system_email_template
SET
template_name = 'Welcome Email for New Confidi User',
"type" = 'USER_ONBOARDING_CONFIDI',
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><strong>Gentile Utente,</strong></p>
<p>Le comunichiamo che il Suo account per accedere al portale Gepafin è stato creato con successo.</p>
<p><strong>Di seguito trova le credenziali di accesso:</strong></p>
<ul>
<li><strong>Indirizzo portale:</strong> <a href="{{login_url}}">{{login_url}}</a></li>
<li><strong>Nome utente:</strong> {{username}}</li>
<li><strong>Password:</strong> {{userpassword}}</li>
</ul>
<p>Al primo accesso le consigliamo di modificare la password con una nuova di Sua scelta.</p>
<p><strong>Suggerimenti per la sicurezza della password:</strong></p>
<ul>
<li>Sia composta da almeno 8 caratteri</li>
<li>Contenga lettere maiuscole e minuscole</li>
<li>Includa numeri e caratteri speciali</li>
</ul>
<p>Se non avesse effettuato alcuna richiesta di registrazione, La invitiamo a comunicarcelo tempestivamente contattando il nostro servizio di assistenza.</p>
<p><strong>Contatti per assistenza:</strong></p>
<ul>
<li>Email: <a href="mailto:{{gepafinemail}}">{{gepafinemail}}</a></li>
<li>Telefono: {{gepafinphonenumber}}</li>
</ul>
<p>La invitiamo a conservare queste informazioni in un luogo sicuro e a non condividerle con terzi.</p>
<p>Cordiali saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>',
subject = 'Le Sue Credenziali di Accesso al Portale Gepafin Confidi',
updated_date = CURRENT_TIMESTAMP
WHERE template_name = 'Welcome Email for New User' AND "type" = 'USER_ONBOARDING';

View File

@@ -53,7 +53,7 @@ call.update.successfully=Call updated successfully.
call.fetch.success=Call details fetched successfully. call.fetch.success=Call details fetched successfully.
call.not.found=Call not found. call.not.found=Call not found.
score.not.null=Score cannot be null or cannot be zero. score.not.null=Score cannot be null or cannot be zero.
field.not.null={0} cannot be null. field.not.null={0} cannot be empty.
field.not.empty={0} cannot be empty. field.not.empty={0} cannot be empty.
update_call_status_success_msg=The call status has been updated successfully. update_call_status_success_msg=The call status has been updated successfully.
status.same.error=Status is already set. status.same.error=Status is already set.
@@ -394,4 +394,7 @@ appointment.cannot.be.created = Appointment cannot be created because call doesn
appointment.not.created = Appointment not created please try again. appointment.not.created = Appointment not created please try again.
validation.failed.checklist=Validation failed for checklist. validation.failed.checklist=Validation failed for checklist.
error.invalid.limit=Limit should be between 1 and 3000.
insufficient.score.msg = Insufficient score to pass to the technical and economic-financial evaluation insufficient.score.msg = Insufficient score to pass to the technical and economic-financial evaluation
password.expired.for.login.to.odessa = Odessa login password has been expired.

View File

@@ -53,7 +53,7 @@ call.update.successfully=Chiamata aggiornata con successo.
call.fetch.success=Dettagli della chiamata recuperati con successo. call.fetch.success=Dettagli della chiamata recuperati con successo.
call.not.found=Chiamata non trovata. call.not.found=Chiamata non trovata.
score.not.null=Il punteggio non pu? essere nullo o zero. score.not.null=Il punteggio non pu? essere nullo o zero.
field.not.null={0} non pu? essere nullo. field.not.null={0} non può essere vuoto.
field.not.empty=la {0} non pu? essere vuota. field.not.empty=la {0} non pu? essere vuota.
update_call_status_success_msg=Lo stato della chiamata ? stato aggiornato con successo. update_call_status_success_msg=Lo stato della chiamata ? stato aggiornato con successo.
status.same.error=Lo stato ? gi? impostato. status.same.error=Lo stato ? gi? impostato.
@@ -385,4 +385,8 @@ appointment.cannot.be.created = Impossibile creare l'appuntamento perch<63> la ch
appointment.not.created = Appuntamento non creato, riprova appointment.not.created = Appuntamento non creato, riprova
validation.failed.checklist=Convalida fallita per la checklist. validation.failed.checklist=Convalida fallita per la checklist.
error.invalid.limit=Il limite dovrebbe essere compreso tra 1 e 3000.
insufficient.score.msg = Punteggio non sufficiente per passaggio alla valutazione tecnica ed economico finanziaria insufficient.score.msg = Punteggio non sufficiente per passaggio alla valutazione tecnica ed economico finanziaria
validation.table.message=I dati per il campo {0} non sono presenti.
password.expired.for.login.to.odessa = La password di accesso a Odessa è scaduta