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

This commit is contained in:
piyushkag
2025-02-17 15:41:41 +05:30
12 changed files with 139 additions and 54 deletions

View File

@@ -1083,7 +1083,7 @@ public class ApplicationAmendmentRequestDao {
List<ApplicationAmendmentRequestResponse> response = new ArrayList<>();
if (applicationAmendmentRequestEntity != null) {
response = applicationAmendmentRequestEntity.stream()
.map(entity -> convertEntityToResponse(entity, false))
.map(entity -> convertEntityToResponse(entity, true))
.collect(Collectors.toList());
}
return response;

View File

@@ -516,7 +516,6 @@ public class ApplicationDao {
.filter(setting -> "isRequestedAmount".equals(setting.getName()) && Boolean.TRUE.equals(setting.getValue()))
.findFirst()
.ifPresent(setting -> {
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
if(fieldValue!=null) {
try {
@@ -1133,20 +1132,28 @@ public class ApplicationDao {
// mailUtil.sendByMailGun(subject, body, List.of(defaultSystemReceiverEmail), null);
// mailUtil.sendByMailGun(subject, body, List.of(gepafinEmail), null);
// mailUtil.sendByMailGun(subject, body, List.of(rinaldoEmail), null);
if(validator.isProductionProfileActivated()) {
emailLogRequest.setRecipientEmails(carloEmail);
// mailUtil.sendByMailGun(subject, body, List.of(carloEmail), null);
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(carloEmail),emailLogRequest);
}
emailLogRequest.setRecipientEmails(hub.getEmail());
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(hub.getEmail()),emailLogRequest);
List<String> listDefaultSystemReceiverEmail = Arrays.stream(defaultSystemReceiverEmail.split(","))
// if(Boolean.TRUE.equals(hub.getUniqueUuid().equals(defaultHubUuid))) {
// if (validator.isProductionProfileActivated()) {
// emailLogRequest.setRecipientEmails(carloEmail);
//// mailUtil.sendByMailGun(subject, body, List.of(carloEmail), null);
// emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(carloEmail),emailLogRequest);
// }
// List<String> listDefaultSystemReceiverEmail = Arrays.stream(defaultSystemReceiverEmail.split(","))
// .map(String::trim)
// .filter(email -> !email.isEmpty())
// .toList();
//
// emailLogRequest.setRecipientEmails(defaultSystemReceiverEmail);
// emailNotificationDao.sendMail(hub.getId(), subject, body, listDefaultSystemReceiverEmail, emailLogRequest);
// }
List<String> hubEmails = Arrays.stream(hub.getEmail().split(","))
.map(String::trim)
.filter(email -> !email.isEmpty())
.toList();
emailLogRequest.setRecipientEmails(defaultSystemReceiverEmail);
emailNotificationDao.sendMail(hub.getId(), subject, body, listDefaultSystemReceiverEmail,emailLogRequest);
emailLogRequest.setRecipientEmails(hub.getEmail());
emailNotificationDao.sendMail(hub.getId(), subject, body,hubEmails,emailLogRequest);
emailLogRequest.setRecipientEmails(rinaldoEmail);
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail),emailLogRequest);
}

View File

@@ -153,7 +153,7 @@ public class ApplicationEvaluationDao {
Long hubId = application.getHubId();
HubEntity hub = hubService.valdateHub(hubId);
Long initialDays = (hub != null) ? hub.getEvaluationExpirationDays() : 0L;
Long initialDays = (hub != null) ? hub.getEvaluationExpirationDays() : 30L;
entity.setApplicationId(application.getId());
entity.setAssignedApplicationsEntity(assignedApplications);
@@ -165,10 +165,10 @@ public class ApplicationEvaluationDao {
entity.setMotivation(req.getMotivation());
entity.setIsDeleted(false);
entity.setInitialDays(initialDays);
entity.setRemainingDays(30L);
entity.setRemainingDays(initialDays);
entity.setSuspendedDays(0L);
entity.setStartDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
entity.setEndDate(DateTimeUtil.DateServerToUTC(application.getSubmissionDate().plusDays(30)));
entity.setEndDate(DateTimeUtil.DateServerToUTC(application.getSubmissionDate().plusDays(initialDays)));
entity.setEvaluationVersion(application.getEvaluationVersion());
entity.setStatus(ApplicationEvaluationStatusTypeEnum.OPEN.getValue());
return entity;

View File

@@ -122,10 +122,40 @@ public class CompanyDao {
userWithCompanyEntity.setPec(companyRequest.getPec());
userWithCompanyEntity.setContactName(companyRequest.getContactName());
userWithCompanyEntity.setContactEmail(companyRequest.getContactEmail());
userWithCompanyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) );
UserWithCompanyEntity userWithCompany = userWithCompanyRepository.save(userWithCompanyEntity);
/** This code is responsible for adding a version history log for the "adding user with company" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(userWithCompany).build());
if (StringUtils.isEmpty(companyEntity.getJson())) {
companyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()));
Map<String, Object> vatCheckResponse = companyRequest.getVatCheckResponse();
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
if (data != null) {
if (data.containsKey("dettaglio")) {
Map<String, Object> dettaglio = (Map<String, Object>) data.get("dettaglio");
if (dettaglio != null) {
if (dettaglio.containsKey("codice_ateco")) {
Object codiceAtecoObj = dettaglio.get("codice_ateco");
String codiceAteco = (codiceAtecoObj != null) ? codiceAtecoObj.toString() : null;
if (codiceAteco != null) {
companyEntity.setCodiceAteco(codiceAteco);
}
}
}
}
}
companyEntity = companyRepository.save(companyEntity);
/** This code is responsible for adding a version history log for "updating company json field" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder()
.request(request)
.actionType(VersionActionTypeEnum.INSERT)
.oldData(null)
.newData(companyEntity)
.build());
}
return userWithCompany;
}
@@ -143,6 +173,7 @@ public class CompanyDao {
entity.setNumberOfEmployees(request.getNumberOfEmployees());
entity.setAnnualRevenue(request.getAnnualRevenue());
entity.setHub(userEntity.getHub());
entity.setJson(Utils.convertMapIntoJsonString(request.getVatCheckResponse()));
if (request.getVatCheckResponse() != null) {
Map<String, Object> vatCheckResponse = request.getVatCheckResponse();
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
@@ -226,10 +257,10 @@ public class CompanyDao {
UserWithCompanyEntity userWithCompanyEntity = getUserWithCompany(userEntity.getId(), companyId);
//cloned entity for old data
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(userWithCompanyEntity);
if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson);
}
// if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
// String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
// setIfUpdated(companyEntity::getJson, companyEntity::setJson, responseJson);
// }
setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, companyRequest.getPec());
setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, companyRequest.getEmail());
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());