Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into feature/GEPAFINBE-126

This commit is contained in:
piyushkag
2025-02-11 19:09:43 +05:30
17 changed files with 167 additions and 97 deletions

View File

@@ -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 dellart.10 bis della L.241/1990 e s.m.i.</p>\n" +
" <p>Distinti Saluti,</p>\n" +
" <p><strong>{{email_signature}}</strong></p>\n" +
" </div>\n" +
" </body>\n" +
"</html>";
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -33,8 +33,8 @@ 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){
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository

View File

@@ -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;
}

View File

@@ -39,6 +39,11 @@ 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"),

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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
);
}

View File

@@ -14,4 +14,7 @@ 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);
}

View File

@@ -2390,7 +2390,32 @@
<sqlFile dbms="postgresql"
path="db/dump/update_form_field_data_06-02-2025.sql"/>
</changeSet>
<changeSet id="11-02-2025_RK_111500" author="Rajesh Khore">
<addColumn tableName="system_email_template">
<column name="hub_id" type="INTEGER">
<constraints foreignKeyName="fk_hub_id"
references="hub(id)" />
</column>
</addColumn>
</changeSet>
<changeSet id="11-02-2025_RK_111515" author="Rajesh Khore">
<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_updating_amendment_mail_notification_mail_31_01_2024_1.sql"/>
</changeSet>
<changeSet id="11-02-2025_NK_180615" author="Nisha Kashyap">
<modifyDataType tableName="call" columnName="number_of_check" newDataType="INTEGER"/>
<modifyDataType tableName="call" columnName="product_id" newDataType="INTEGER"/>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,65 @@
INSERT INTO gepafin_schema.system_email_template (template_name, "type", html_content, subject, "json", "system", is_deleted, created_date, updated_date, email_scenario, hub_id)
VALUES
(
'Instructional Aid/Request for Documentation Integration Template For Sviluppumbria',
'DOCUMENTATION_INTEGRATION_REQUEST',
'<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>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>
<p>Buongiorno,</p>
<p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Bando
"<strong>{{call_name}}</strong>" di cui al <strong>Protocollo n. {{protocol_number}} del
{{protocol_date}} e {{protocol_time}}</strong>, alla luce dell''attività istruttoria svolta,
segnaliamo quanto segue:
</p>
{{note}}
<p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all''interno dello sportello
online <a href="{{platform_link}}">{{platform_link}}</a> entro e <strong>non oltre {{response_days}} giorni</strong> dal ricevimento della presente comunicazione,
precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.
</p>
<p>La documentazione trasmessa e le informazioni fornite saranno processate dall''istruttore assegnatario della pratica.
</p>
<p>Distinti Saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>',
'BANDO {{call_name}}- Domanda di concessione di finanziamento agevolato {{company_name}}',
NULL,
false,
false,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
'APPLICATION_AMENDMENT_REQUESTED',
2
);
INSERT INTO gepafin_schema.system_email_template (template_name, "type", html_content, subject, "json", "system", is_deleted, created_date, updated_date, email_scenario, hub_id)
VALUES
(
'Notification of Inadmissibility Template',
'INADMISSIBILITY_NOTIFICATION',
'<html>
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
<p>Buongiorno,</p>
<p>Si comunica che, in riferimento alla domanda a valere sul bando “<strong>{{call_name}}</strong>” di cui al
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,
la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.</p>
<p>Le motivazioni sono le seguenti: <strong>{{form_text}}</strong></p>
<p>Vi ricordiamo che i Beneficiari che hanno presentato richieste valutate non ammissibili entro 10 giorni dalla data di ricevimento della presente potranno finoltrare richiesta di chiarimenti e/o osservazioni alla scrivente Società ai sensi e per gli effetti dellart.10 bis della L.241/1990 e s.m.i.</p>
<p>Distinti Saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>',
'BANDO {{call_name}} Esito negativo istruttoria di ammissibilità {{company_name}}',
NULL,
false,
false,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
'APPLICATION_REJECTED',
2
);