Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into develop
This commit is contained in:
@@ -112,6 +112,7 @@ public class GepafinConstant {
|
|||||||
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
|
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
|
||||||
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
|
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
|
||||||
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.success";
|
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.success";
|
||||||
|
public static final String GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG = "application.evaluation.version.get.success";
|
||||||
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found";
|
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found";
|
||||||
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.not.found";
|
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.not.found";
|
||||||
public static final String FORM_ID_DOES_NOT_MACTHES = "Form.not.matches.to.call.initial.form";
|
public static final String FORM_ID_DOES_NOT_MACTHES = "Form.not.matches.to.call.initial.form";
|
||||||
@@ -408,5 +409,28 @@ public class GepafinConstant {
|
|||||||
|
|
||||||
public static final String REQUIRED_REQUESTED_AMOUNT_MSG = "validation.required.requested.amount";
|
public static final String REQUIRED_REQUESTED_AMOUNT_MSG = "validation.required.requested.amount";
|
||||||
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
|
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
|
||||||
|
|
||||||
|
public static final String DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA= "<html>\n" +
|
||||||
|
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
|
||||||
|
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
|
||||||
|
" <p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>\n" +
|
||||||
|
" <p>Buongiorno,</p>\n" +
|
||||||
|
" <p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Bando \n" +
|
||||||
|
" <strong>{{call_name}}</strong> di cui al <strong>Protocollo n. {{protocol_number}} del\n" +
|
||||||
|
" {{protocol_date}} e {{protocol_time}}</strong>, alla luce dell'attività istruttoria svolta,\n" +
|
||||||
|
" segnaliamo quanto segue:\n" +
|
||||||
|
" </p>\n" +
|
||||||
|
" {{note}}\n" +
|
||||||
|
" <p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all'interno dello sportello\n" +
|
||||||
|
" online <a href=\"{{platform_link}}\">{{platform_link}}</a> entro e <strong>non oltre {{response_days}} giorni</strong> dal ricevimento della presente comunicazione,\n" +
|
||||||
|
" precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.\n" +
|
||||||
|
" </p>\n" +
|
||||||
|
" <p>La documentazione trasmessa e le informazioni fornite saranno processate dall'istruttore assegnatario della pratica.\n" +
|
||||||
|
" </p>\n" +
|
||||||
|
" <p>Distinti Saluti,</p>\n" +
|
||||||
|
" <p><strong>{{email_signature}}</strong></p>\n" +
|
||||||
|
" </div>\n" +
|
||||||
|
" </body>\n" +
|
||||||
|
"</html>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2201,5 +2201,23 @@ public class ApplicationEvaluationDao {
|
|||||||
return evaluationFormResponseBean;
|
return evaluationFormResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId){
|
||||||
|
|
||||||
|
log.info("Fetching application evaluation version with ID: {}", applicationId);
|
||||||
|
|
||||||
|
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
|
||||||
|
return buildApplicationEvaluationVersionResponse(applicationEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
private ApplicationEvaluationVersionResponse buildApplicationEvaluationVersionResponse(ApplicationEntity applicationEntity) {
|
||||||
|
ApplicationEvaluationVersionResponse response = new ApplicationEvaluationVersionResponse();
|
||||||
|
response.setApplicationId(applicationEntity.getId());
|
||||||
|
response.setCallId(applicationEntity.getCall().getId());
|
||||||
|
response.setCompanyId(applicationEntity.getCompanyId());
|
||||||
|
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationEntity.getEvaluationVersion()));
|
||||||
|
response.setEvaluationId(applicationEntity.getApplicationEvaluationId());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,15 @@ public class EmailNotificationDao {
|
|||||||
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
||||||
// bodyPlaceholders.put("{{legal_mail}}", legalMail);
|
// bodyPlaceholders.put("{{legal_mail}}", legalMail);
|
||||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
String body;
|
||||||
|
if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST)) {
|
||||||
|
bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
|
||||||
|
bodyPlaceholders.put("{{platform_link}}",hubEntity.getDomainName());
|
||||||
|
body = Utils.replacePlaceholders(GepafinConstant.DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA, bodyPlaceholders);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||||
|
}
|
||||||
|
|
||||||
return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
|
return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
public class FormDao {
|
public class FormDao {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(FormDao.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FormRepository formRepository;
|
private FormRepository formRepository;
|
||||||
|
|
||||||
@@ -203,8 +205,9 @@ public class FormDao {
|
|||||||
String formFieldId,Long evaluationCriteriaId) {
|
String formFieldId,Long evaluationCriteriaId) {
|
||||||
EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId);
|
EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId);
|
||||||
if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) {
|
if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
log.info("This evaluation criterion does not belong to the current call. Expected Call ID = {}, Found Call ID = {}",
|
||||||
Translator.toLocale(GepafinConstant.EVALUATIONCRITERIA_INVALID));
|
callEntity.getId(), evaluationCriteria.getCall().getId());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity();
|
CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity();
|
||||||
criteriaFormField.setCallId(callEntity.getId());
|
criteriaFormField.setCallId(callEntity.getId());
|
||||||
@@ -471,7 +474,9 @@ public class FormDao {
|
|||||||
|
|
||||||
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
||||||
String fieldValue = getFieldValue(contentResponseBean);
|
String fieldValue = getFieldValue(contentResponseBean);
|
||||||
validator.isRequired(value, fieldValidatorBean.getIsRequired(), fieldValue);
|
|
||||||
|
validator.isRequired(value, fieldValidatorBean.getIsRequired(), fieldValue)
|
||||||
|
.validateCustomTableValidation(value,fieldValidatorBean.getCustom(),fieldValue,contentResponseBean);
|
||||||
});
|
});
|
||||||
if (Boolean.TRUE.equals(isSendValidationError)) {
|
if (Boolean.TRUE.equals(isSendValidationError)) {
|
||||||
validator.validate();
|
validator.validate();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public enum UserActionContextEnum {
|
|||||||
/** application action context **/
|
/** application action context **/
|
||||||
GET_APPLICATION("GET_APPLICATION"),
|
GET_APPLICATION("GET_APPLICATION"),
|
||||||
CREATE_UPDATE_APPLICATION_FORM("CREATE_UPDATE_APPLICATION_FORM"),
|
CREATE_UPDATE_APPLICATION_FORM("CREATE_UPDATE_APPLICATION_FORM"),
|
||||||
|
GET_APPLICATION_EVALUATION_VERSION("GET_APPLICATION_EVALUATION_VERSION"),
|
||||||
CREATE_APPLICATION("CREATE_APPLICATION"),
|
CREATE_APPLICATION("CREATE_APPLICATION"),
|
||||||
DELETE_APPLICATION("DELETE_APPLICATION"),
|
DELETE_APPLICATION("DELETE_APPLICATION"),
|
||||||
GET_ALL_APPLICATION("GET_ALL_APPLICATION"),
|
GET_ALL_APPLICATION("GET_ALL_APPLICATION"),
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationVersionResponse {
|
||||||
|
private Long callId;
|
||||||
|
private Long companyId;
|
||||||
|
private Long applicationId;
|
||||||
|
private Long evaluationId;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
}
|
||||||
@@ -27,4 +27,6 @@ public interface ApplicationEvaluationService {
|
|||||||
|
|
||||||
ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId);
|
ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId);
|
||||||
|
|
||||||
|
ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResp
|
|||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean;
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationVersionResponse;
|
||||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
@@ -100,4 +101,12 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
|||||||
return applicationEvaluationDao.getApplicationEvaluationForm(request,applicationId,assignedApplicationId);
|
return applicationEvaluationDao.getApplicationEvaluationForm(request,applicationId,assignedApplicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return applicationEvaluationDao.getApplicationEvaluationVersion(request,applicationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,11 +147,51 @@ public class FieldValidator {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) {
|
|
||||||
|
|
||||||
|
public FieldValidator validateCustomTableValidation(String value, String customRule, String fieldId, ContentResponseBean contentResponseBean) {
|
||||||
|
if (customRule == null || value == null) {
|
||||||
|
return this; // No custom rule to validate
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (customRule) {
|
||||||
|
|
||||||
|
case GepafinConstant.NON_EMPTY_TABLES:
|
||||||
|
try {
|
||||||
|
checkTableValidation(value, fieldId, contentResponseBean, errors);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// If the custom rule is unknown, just log or add an error (optional)
|
||||||
|
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_CUSTOM), fieldId, customRule));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) throws Exception {
|
||||||
Map<String, Boolean> stateFieldMap= new HashMap<>();
|
Map<String, Boolean> stateFieldMap= new HashMap<>();
|
||||||
|
String tableType = contentResponseBean.getSettings().stream()
|
||||||
|
.filter(setting ->GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
|
||||||
|
.map(SettingResponseBean::getName) // Extract the name
|
||||||
|
.findFirst() // Get the first matching result
|
||||||
|
.orElse(null); // Default to null if no match
|
||||||
|
|
||||||
|
if (tableType!=null){
|
||||||
|
try {
|
||||||
|
Object object = PdfUtils.extractRows(value);;
|
||||||
|
value= Utils.convertToString(object);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contentResponseBean.getSettings().stream()
|
contentResponseBean.getSettings().stream()
|
||||||
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns"
|
.filter(setting -> "table_columns".equals(setting.getName()) || GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
|
||||||
.map(SettingResponseBean::getValue)
|
.map(SettingResponseBean::getValue)
|
||||||
.filter(Objects::nonNull) // Ensure value is not null
|
.filter(Objects::nonNull) // Ensure value is not null
|
||||||
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
|
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
|
||||||
|
|||||||
@@ -89,5 +89,19 @@ public interface ApplicationEvaluationApi {
|
|||||||
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||||
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get application evaluation version",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/application/{id}/version", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationVersionResponse>> getApplicationEvaluationVersion(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The application id", required = true) @PathVariable("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,4 +109,16 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<ApplicationEvaluationVersionResponse>> getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "get application evaluation version" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION_VERSION).build());
|
||||||
|
|
||||||
|
ApplicationEvaluationVersionResponse applicationEvaluationVersionResponse = applicationEvaluationService.getApplicationEvaluationVersion(request,applicationId);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(applicationEvaluationVersionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ application.created.success=Application successfully created.
|
|||||||
application.updated.success=Application successfully updated.
|
application.updated.success=Application successfully updated.
|
||||||
application.deleted.success=Application successfully deleted.
|
application.deleted.success=Application successfully deleted.
|
||||||
application.get.success=Application details fetched successfully.
|
application.get.success=Application details fetched successfully.
|
||||||
|
application.evaluation.version.get.success = Application evaluation version fetched successfully.
|
||||||
application.not.found=Application not found with the given ID.
|
application.not.found=Application not found with the given ID.
|
||||||
application.form.field.not.found=Application form field not found.
|
application.form.field.not.found=Application form field not found.
|
||||||
Form.not.matches.to.call.initial.form=Form id does not matches to initial form id of call.
|
Form.not.matches.to.call.initial.form=Form id does not matches to initial form id of call.
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ application.created.success=Applicazione creata con successo.
|
|||||||
application.updated.success=Applicazione aggiornata con successo.
|
application.updated.success=Applicazione aggiornata con successo.
|
||||||
application.deleted.success=Applicazione eliminata con successo.
|
application.deleted.success=Applicazione eliminata con successo.
|
||||||
application.get.success=Dettagli dell'applicazione recuperati con successo.
|
application.get.success=Dettagli dell'applicazione recuperati con successo.
|
||||||
|
application.evaluation.version.get.success = Versione di valutazione dell'applicazione recuperata correttamente.
|
||||||
application.not.found=Applicazione non trovata con l'ID fornito.
|
application.not.found=Applicazione non trovata con l'ID fornito.
|
||||||
application.form.field.not.found=Campo del modulo di domanda non trovato.
|
application.form.field.not.found=Campo del modulo di domanda non trovato.
|
||||||
Form.not.matches.to.call.initial.form=L'ID del modulo non corrisponde all'ID del modulo iniziale della chiamata.
|
Form.not.matches.to.call.initial.form=L'ID del modulo non corrisponde all'ID del modulo iniziale della chiamata.
|
||||||
|
|||||||
Reference in New Issue
Block a user