Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into feature/GEPAFINBE-126
This commit is contained in:
@@ -180,27 +180,27 @@ public class GepafinConstant {
|
||||
public static final String UNAUTHORIZED = "UNAUTHORIZED";
|
||||
public static final String COMPANY_ID_MANDATORY = "company.id.mandatory";
|
||||
public static final String USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company";
|
||||
public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd";
|
||||
public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd";
|
||||
public static final String DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE";
|
||||
public static final String VALIDATION_ERROR_MISSING_FIRSTNAME = "validation.error.missing.firstName";
|
||||
public static final String VALIDATION_ERROR_MISSING_LASTNAME = "validation.error.missing.lastName";
|
||||
public static final String VALIDATION_ERROR_MISSING_CODICEFISCALE = "validation.error.missing.codiceFiscale";
|
||||
public static final String DELEGATION_FILE_UPLOAD_SUCCESS = "delegation.file.upload.success";
|
||||
public static final String DELEGATION_FETCH_SUCCESS = "delegation.fetch.success";
|
||||
public static final String DELEGATION_TEMPLATE_GENERATION_ERROR = "delegation.template.generation.error";
|
||||
public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty";
|
||||
public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType";
|
||||
public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
|
||||
public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd";
|
||||
public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd";
|
||||
public static final String DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE";
|
||||
public static final String VALIDATION_ERROR_MISSING_FIRSTNAME = "validation.error.missing.firstName";
|
||||
public static final String VALIDATION_ERROR_MISSING_LASTNAME = "validation.error.missing.lastName";
|
||||
public static final String VALIDATION_ERROR_MISSING_CODICEFISCALE = "validation.error.missing.codiceFiscale";
|
||||
public static final String DELEGATION_FILE_UPLOAD_SUCCESS = "delegation.file.upload.success";
|
||||
public static final String DELEGATION_FETCH_SUCCESS = "delegation.fetch.success";
|
||||
public static final String DELEGATION_TEMPLATE_GENERATION_ERROR = "delegation.template.generation.error";
|
||||
public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty";
|
||||
public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType";
|
||||
public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
|
||||
|
||||
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet";
|
||||
public static final String CALL_ALREADY_ENDED = "call.already.ended";
|
||||
public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully";
|
||||
public static final String APPLICATION_ALREADY_IN_PREVIOUS_STATUS = "application.already.in.provided.status";
|
||||
public static final String DELEGATION_NOT_FOUND = "delegation.not.found";
|
||||
public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found";
|
||||
public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
|
||||
public static final String HH_MM_SS = "HH:mm:ss";
|
||||
public static final String DELEGATION_NOT_FOUND = "delegation.not.found";
|
||||
public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found";
|
||||
public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
|
||||
public static final String HH_MM_SS = "HH:mm:ss";
|
||||
|
||||
public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application";
|
||||
public static final String APPLICATION_SUBMITTED_CANNOT_CHANGE = "application.submitted.cannot.change";
|
||||
@@ -218,11 +218,11 @@ public class GepafinConstant {
|
||||
public static final String USER_ID_AND_BENEFICIARY_ID_ERROR = "userId.and.beneficiaryId.error";
|
||||
public static final String EITHER_USER_OR_BENEFICIARY_ID_REQUIRED = "either.user.or.beneficiary.id.required";
|
||||
public static final String USER_NOT_FOUND_WITH_BENEFICIARYID_MSG = "User.not.found.with.the.given.beneficiaryID";
|
||||
public static final String PERMISSION_DENIED = "permission.denied";
|
||||
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
|
||||
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
|
||||
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
|
||||
public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success";
|
||||
public static final String PERMISSION_DENIED = "permission.denied";
|
||||
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
|
||||
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
|
||||
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
|
||||
public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success";
|
||||
public static final String DD_MM_YYYY = "dd/MM/yyyy";
|
||||
|
||||
public static final String DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY="dashboard.widget.fetched.successfully";
|
||||
@@ -251,16 +251,16 @@ public class GepafinConstant {
|
||||
public static final String DELETE_ASSIGNED_APPLICATION_SUCCESS_MSG = "assigned.application.deleted.success";
|
||||
public static final String GET_ASSIGNED_APPLICATION_SUCCESS_MSG = "assigned.application.get.success";
|
||||
public static final String ASSIGNED_APPLICATION_UPDATE_SUCCESSFULLY_MSG = "assigned.application.update.successfully";
|
||||
|
||||
|
||||
public static final String HUB_CREATE_SUCCESS = "hub_create_success";
|
||||
public static final String HUB_UPDATE_SUCCESS = "hub_update_success";
|
||||
public static final String HUB_GET_SUCCESS = "hub_get_success";
|
||||
public static final String HUB_GET_ALL_SUCCESS = "hub_get_all_success";
|
||||
public static final String HUB_DELETE_SUCCESS = "hub_delete_success";
|
||||
public static final String HUB_NOT_FOUND = "hub_not_found";
|
||||
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
|
||||
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
|
||||
public static final String APPLICATION_NOT_IN_DRAFT_STATUS="application.not.in.draft.status";
|
||||
public static final String GET_ERROR_S3 = "get.error.s3";
|
||||
public static final String GET_ERROR_S3 = "get.error.s3";
|
||||
public static final String BENEFICIARY_EMAIL_NOT_FOUND_MSG = "beneficiary.email.not.found.msg";
|
||||
public static final String ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure";
|
||||
public static final String S3_PATH_STRUCTURE_BY_TYPE ="fetched.s3.path.structure.by.type.successfully";
|
||||
@@ -391,7 +391,7 @@ public class GepafinConstant {
|
||||
public static final String NON_EMPTY_TABLES="nonEmptyTables";
|
||||
public static final String VALIDATION_IN_TABLE = "validation.table.message";
|
||||
public static final String CALL_EXPIRED="call.expired";
|
||||
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
||||
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
||||
|
||||
|
||||
|
||||
@@ -423,44 +423,8 @@ public class GepafinConstant {
|
||||
|
||||
public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount";
|
||||
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
|
||||
|
||||
public static final String DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA= "<html>\n" +
|
||||
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
|
||||
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
|
||||
" <p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>\n" +
|
||||
" <p>Buongiorno,</p>\n" +
|
||||
" <p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Bando \n" +
|
||||
" “<strong>{{call_name}}</strong>“ di cui al <strong>Protocollo n. {{protocol_number}} del\n" +
|
||||
" {{protocol_date}} e {{protocol_time}}</strong>, alla luce dell'attività istruttoria svolta,\n" +
|
||||
" segnaliamo quanto segue:\n" +
|
||||
" </p>\n" +
|
||||
" {{note}}\n" +
|
||||
" <p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all'interno dello sportello\n" +
|
||||
" online <a href=\"{{platform_link}}\">{{platform_link}}</a> entro e <strong>non oltre {{response_days}} giorni</strong> dal ricevimento della presente comunicazione,\n" +
|
||||
" precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.\n" +
|
||||
" </p>\n" +
|
||||
" <p>La documentazione trasmessa e le informazioni fornite saranno processate dall'istruttore assegnatario della pratica.\n" +
|
||||
" </p>\n" +
|
||||
" <p>Distinti Saluti,</p>\n" +
|
||||
" <p><strong>{{email_signature}}</strong></p>\n" +
|
||||
" </div>\n" +
|
||||
" </body>\n" +
|
||||
"</html>";
|
||||
|
||||
|
||||
public static final String APPLICATION_REJECTED_SVILUPPUMBRIA = "<html>\n" +
|
||||
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
|
||||
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
|
||||
" <p>Buongiorno,</p>\n" +
|
||||
" <p>Si comunica che, in riferimento alla domanda a valere sul bando “<strong>{{call_name}}</strong>” di cui al\n" +
|
||||
" <strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,\n" +
|
||||
" la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.</p>\n" +
|
||||
" <p>Le motivazioni sono le seguenti: <strong>{{form_text}}</strong></p>\n" +
|
||||
" <p>Vi ricordiamo che i Beneficiari che hanno presentato richieste valutate non ammissibili entro 10 giorni dalla data di ricevimento della presente potranno finoltrare richiesta di chiarimenti e/o osservazioni alla scrivente Società ai sensi e per gli effetti dell’art.10 bis della L.241/1990 e s.m.i.</p>\n" +
|
||||
" <p>Distinti Saluti,</p>\n" +
|
||||
" <p><strong>{{email_signature}}</strong></p>\n" +
|
||||
" </div>\n" +
|
||||
" </body>\n" +
|
||||
"</html>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -888,6 +888,10 @@ public class ApplicationDao {
|
||||
checkCallEndDate(call);
|
||||
// call = callService.validatePublishedCall(call.getId());
|
||||
// checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
|
||||
HubEntity hubEntity = hubService.valdateHub(call.getHub().getId());
|
||||
if(hubEntity.getUniqueUuid().equals(defaultHubUuid)){
|
||||
checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
|
||||
}
|
||||
ApplicationEntity applicationEntity = createApplicationEntity(userEntity, call, userWithCompanyEntity);
|
||||
applicationEntity.setComments(applicationRequest.getComments());
|
||||
applicationEntity = saveApplicationEntity(applicationEntity);
|
||||
@@ -900,6 +904,18 @@ public class ApplicationDao {
|
||||
// }
|
||||
// }
|
||||
|
||||
public void checkIfApplicationExists(CallEntity call, UserWithCompanyEntity userWithCompanyEntity, UserEntity userEntity){
|
||||
|
||||
List<ApplicationEntity> applications = applicationRepository.findByUserIdAndUserWithCompany_IdAndCall_IdAndIsDeletedFalseAndStatusNot(
|
||||
userEntity.getId(), userWithCompanyEntity.getId(), call.getId(), ApplicationStatusTypeEnum.REJECTED.name()
|
||||
);
|
||||
|
||||
if (!applications.isEmpty()) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_EXISTS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ApplicationResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationStatusTypeEnum status) {
|
||||
|
||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||
|
||||
@@ -510,8 +510,8 @@ public class DashboardDao {
|
||||
stats.put(GepafinConstant.REQUESTED_VS_APPROVED_AMOUNTS, requestedVsApprovedAmounts.stream().map(result -> {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put(GepafinConstant.MONTH, result[0]);
|
||||
data.put(GepafinConstant.TOTAL_REQUESTED, result[1]);
|
||||
data.put(GepafinConstant.TOTAL_APPROVED, result[2]);
|
||||
data.put(GepafinConstant.TOTAL_REQUESTED, result[1]!= null ? result[1] : 0L);
|
||||
data.put(GepafinConstant.TOTAL_APPROVED, result[2] != null ? result[2] : 0L);
|
||||
return data;
|
||||
}).toList());
|
||||
return stats;
|
||||
|
||||
@@ -94,19 +94,7 @@ public class EmailNotificationDao {
|
||||
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
||||
// bodyPlaceholders.put("{{legal_mail}}", legalMail);
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body;
|
||||
if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST)) {
|
||||
bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
|
||||
bodyPlaceholders.put("{{platform_link}}",hubEntity.getDomainName());
|
||||
body = Utils.replacePlaceholders(GepafinConstant.DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA, bodyPlaceholders);
|
||||
}
|
||||
else if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE)) {
|
||||
bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
|
||||
body = Utils.replacePlaceholders(GepafinConstant.APPLICATION_REJECTED_SVILUPPUMBRIA, bodyPlaceholders);
|
||||
}
|
||||
else {
|
||||
body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
}
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
|
||||
return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ public class SystemEmailTemplatesDao {
|
||||
public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) {
|
||||
SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity = null;
|
||||
if(hub != null){
|
||||
// dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
||||
// .findByTypeAndCallId(type.getValue(), call.getId());
|
||||
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
||||
.findByTypeAndHubEntityId(type.getValue(), hub.getId());
|
||||
}
|
||||
if(dbSystemEmailTemplatesEntity == null) {
|
||||
if(dbSystemEmailTemplatesEntity == null){
|
||||
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
||||
.findByType(type.getValue());
|
||||
}
|
||||
|
||||
@@ -93,9 +93,9 @@ public class CallEntity extends BaseEntity {
|
||||
private String evaluationVersion;
|
||||
|
||||
@Column(name = "NUMBER_OF_CHECK")
|
||||
private BigDecimal numberOfCheck;
|
||||
private Long numberOfCheck;
|
||||
|
||||
@Column(name = "PRODUCT_ID")
|
||||
private BigDecimal productId;
|
||||
private Long productId;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,12 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
|
||||
|
||||
@Column(name = "email_scenario")
|
||||
private String emailScenario;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "HUB_ID")
|
||||
private HubEntity hubEntity;
|
||||
|
||||
|
||||
public enum SystemEmailTemplatesEntityTypeEnum {
|
||||
|
||||
APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"),
|
||||
|
||||
@@ -24,9 +24,9 @@ public class CreateCallRequestStep1 {
|
||||
|
||||
private BigDecimal amountMax;
|
||||
|
||||
private BigDecimal numberOfCheck;
|
||||
private Long numberOfCheck;
|
||||
|
||||
private BigDecimal productId;
|
||||
private Long productId;
|
||||
|
||||
private List<LookUpDataReq> aimedTo;
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ public class UpdateCallRequestStep1 {
|
||||
|
||||
private List<FaqReq> faq;
|
||||
|
||||
private BigDecimal numberOfCheck;
|
||||
private Long numberOfCheck;
|
||||
|
||||
private BigDecimal productId;
|
||||
private Long productId;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ public class ApplicationEvaluationResponse {
|
||||
private BigDecimal amountAccepted;
|
||||
private LocalDateTime dateAccepted;
|
||||
private LocalDateTime dateRejected;
|
||||
private BigDecimal numberOfCheck;
|
||||
private BigDecimal productId;
|
||||
private Long numberOfCheck;
|
||||
private Long productId;
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ public class AssignedApplicationsResponse extends BaseBean {
|
||||
private LocalDateTime callEndDate;
|
||||
private String companyName;
|
||||
private LocalDateTime evaluationEndDate;
|
||||
private BigDecimal numberOfCheck;
|
||||
private BigDecimal productId;
|
||||
private Long numberOfCheck;
|
||||
private Long productId;
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ public class CallDetailsResponseBean {
|
||||
|
||||
private Long preferredCallId;
|
||||
|
||||
private BigDecimal numberOfCheck;
|
||||
private Long numberOfCheck;
|
||||
|
||||
private BigDecimal productId;
|
||||
private Long productId;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ public class CallResponse {
|
||||
|
||||
private String phoneNumber;
|
||||
|
||||
private BigDecimal numberOfCheck;
|
||||
private Long numberOfCheck;
|
||||
|
||||
private BigDecimal productId;
|
||||
private Long productId;
|
||||
|
||||
@JsonSerialize(using = DynamicLocalTimeSerializer.class)
|
||||
private LocalTime startTime;
|
||||
|
||||
@@ -158,4 +158,8 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
@Param("status") String status);
|
||||
@Query("SELECT SUM(a.amountAccepted) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.userId = :userId AND a.status = 'APPROVED' AND a.userWithCompany.id = :userWithCompanyId AND a.isDeleted = false")
|
||||
BigDecimal sumAmountRequestedByHubIdAndUserId(@Param("hubId") Long hubId, @Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
|
||||
|
||||
List<ApplicationEntity> findByUserIdAndUserWithCompany_IdAndCall_IdAndIsDeletedFalseAndStatusNot(
|
||||
Long userId, Long userWithCompanyId, Long callId, String status
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,5 +13,8 @@ public interface SystemEmailTemplatesRespository extends JpaRepository<SystemEma
|
||||
|
||||
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true")
|
||||
SystemEmailTemplatesEntity findByType(@Param("type") String type);
|
||||
|
||||
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.hubEntity.id=:hubId and s.isDeleted =false and s.system = false")
|
||||
SystemEmailTemplatesEntity findByTypeAndHubEntityId(@Param("type") String type, @Param("hubId") Long hubId);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user