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

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