Updated code
This commit is contained in:
@@ -981,7 +981,8 @@ public class ApplicationDao {
|
||||
private void sendMailToUserAndCompany(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||
CallEntity call =applicationEntity.getCall();
|
||||
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||
UserWithCompanyEntity userWithCompany=companyService.getUserWithCompany(userEntity.getId(),company.getId());
|
||||
ProtocolEntity protocol= applicationEntity.getProtocol();
|
||||
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
|
||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
||||
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum.APPLICATION_SUBMISSION_TO_USER_AND_COMPANY,
|
||||
@@ -1012,8 +1013,8 @@ public class ApplicationDao {
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email),emailLogRequest);
|
||||
List<String> recipientEmails = new ArrayList<>();
|
||||
// recipientEmails.add(email);
|
||||
String companyEmail = company.getEmail();
|
||||
String contactEmail = company.getContactEmail();
|
||||
String companyEmail = userWithCompany.getEmail();
|
||||
String contactEmail = userWithCompany.getContactEmail();
|
||||
|
||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||
recipientEmails.add(companyEmail);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class CompanyDao {
|
||||
if (existingCompany != null) {
|
||||
UserWithCompanyEntity existingRelation = userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), existingCompany.getId()).orElse(null);
|
||||
if (existingRelation == null) {
|
||||
userWithCompanyEntity = createUserWithCompanyRelation(userEntity, existingCompany, companyRequest.getIsLegalRepresentant());
|
||||
userWithCompanyEntity = createUserWithCompanyRelation(userEntity, existingCompany, companyRequest.getIsLegalRepresentant(),companyRequest);
|
||||
|
||||
/** This code is responsible for adding a version history log for "adding user with company" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
@@ -79,14 +79,12 @@ public class CompanyDao {
|
||||
} else {
|
||||
validateCompany(userEntity, companyRequest);
|
||||
CompanyEntity companyEntity = convertCompanyRequestToCompanyEntity(userEntity, companyRequest);
|
||||
companyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) );
|
||||
|
||||
CompanyEntity companyData = companyRepository.save(companyEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for "creating company" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(companyData).build());
|
||||
|
||||
userWithCompanyEntity = createUserWithCompanyRelation(userEntity, companyEntity, companyRequest.getIsLegalRepresentant());
|
||||
userWithCompanyEntity = createUserWithCompanyRelation(userEntity, companyEntity, companyRequest.getIsLegalRepresentant(),companyRequest);
|
||||
|
||||
return convertCompanyEntityToCompanyResponse(companyEntity, userWithCompanyEntity);
|
||||
}
|
||||
@@ -110,7 +108,7 @@ public class CompanyDao {
|
||||
}
|
||||
}
|
||||
|
||||
private UserWithCompanyEntity createUserWithCompanyRelation(UserEntity userEntity, CompanyEntity companyEntity, Boolean isLegalRepresentant) {
|
||||
private UserWithCompanyEntity createUserWithCompanyRelation(UserEntity userEntity, CompanyEntity companyEntity, Boolean isLegalRepresentant,CompanyRequest companyRequest) {
|
||||
|
||||
UserWithCompanyEntity userWithCompanyEntity = new UserWithCompanyEntity();
|
||||
if (userEntity.getBeneficiary() != null) {
|
||||
@@ -120,6 +118,11 @@ public class CompanyDao {
|
||||
userWithCompanyEntity.setCompanyId(companyEntity.getId());
|
||||
userWithCompanyEntity.setUserId(userEntity.getId());
|
||||
userWithCompanyEntity.setIsLegalRepresentant(isLegalRepresentant);
|
||||
userWithCompanyEntity.setEmail(companyRequest.getEmail());
|
||||
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. **/
|
||||
@@ -138,12 +141,8 @@ public class CompanyDao {
|
||||
entity.setProvince(request.getProvince());
|
||||
entity.setCap(request.getCap());
|
||||
entity.setCountry(request.getCountry());
|
||||
entity.setPec(request.getPec());
|
||||
entity.setEmail(request.getEmail());
|
||||
entity.setNumberOfEmployees(request.getNumberOfEmployees());
|
||||
entity.setAnnualRevenue(request.getAnnualRevenue());
|
||||
entity.setContactName(request.getContactName());
|
||||
entity.setContactEmail(request.getContactEmail());
|
||||
entity.setHub(userEntity.getHub());
|
||||
return entity;
|
||||
}
|
||||
@@ -160,8 +159,8 @@ public class CompanyDao {
|
||||
response.setProvince(entity.getProvince());
|
||||
response.setCap(entity.getCap());
|
||||
response.setCountry(entity.getCountry());
|
||||
response.setPec(entity.getPec());
|
||||
response.setEmail(entity.getEmail());
|
||||
response.setPec(userWithCompanyEntity.getPec());
|
||||
response.setEmail(userWithCompanyEntity.getEmail());
|
||||
response.setNumberOfEmployees(entity.getNumberOfEmployees());
|
||||
response.setAnnualRevenue(entity.getAnnualRevenue());
|
||||
if(userWithCompanyEntity!=null) {
|
||||
@@ -169,8 +168,8 @@ public class CompanyDao {
|
||||
}
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setContactName(entity.getContactName());
|
||||
response.setContactEmail(entity.getContactEmail());
|
||||
response.setContactName(userWithCompanyEntity.getContactName());
|
||||
response.setContactEmail(userWithCompanyEntity.getContactEmail());
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -188,12 +187,8 @@ public class CompanyDao {
|
||||
setIfUpdated(companyEntity::getProvince, companyEntity::setProvince, companyRequest.getProvince());
|
||||
setIfUpdated(companyEntity::getCap, companyEntity::setCap, companyRequest.getCap());
|
||||
setIfUpdated(companyEntity::getCountry, companyEntity::setCountry, companyRequest.getCountry());
|
||||
setIfUpdated(companyEntity::getPec, companyEntity::setPec, companyRequest.getPec());
|
||||
setIfUpdated(companyEntity::getEmail, companyEntity::setEmail, companyRequest.getEmail());
|
||||
setIfUpdated(companyEntity::getNumberOfEmployees, companyEntity::setNumberOfEmployees, companyRequest.getNumberOfEmployees());
|
||||
setIfUpdated(companyEntity::getAnnualRevenue, companyEntity::setAnnualRevenue, companyRequest.getAnnualRevenue());
|
||||
setIfUpdated(companyEntity::getContactName, companyEntity::setContactName, companyRequest.getContactName());
|
||||
setIfUpdated(companyEntity::getContactEmail, companyEntity::setContactEmail, companyRequest.getContactEmail());
|
||||
|
||||
if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
@@ -201,8 +196,6 @@ public class CompanyDao {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
}
|
||||
companyEntity.setVatNumber(companyRequest.getVatNumber());
|
||||
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
|
||||
setIfUpdated(companyEntity::getJson, companyEntity::setJson, responseJson);
|
||||
|
||||
}
|
||||
companyRepository.save(companyEntity);
|
||||
@@ -214,8 +207,15 @@ public class CompanyDao {
|
||||
UserWithCompanyEntity userWithCompanyEntity = getUserWithCompany(userEntity.getId(), companyId);
|
||||
//cloned entity for old data
|
||||
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(userWithCompanyEntity);
|
||||
|
||||
Utils.setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant());
|
||||
if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
|
||||
setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson);
|
||||
}
|
||||
setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, userWithCompanyEntity.getPec());
|
||||
setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, userWithCompanyEntity.getEmail());
|
||||
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());
|
||||
setIfUpdated(userWithCompanyEntity::getContactEmail, userWithCompanyEntity::setContactEmail, companyRequest.getContactEmail());
|
||||
setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant());
|
||||
userWithCompanyEntity = userWithCompanyRepository.save(userWithCompanyEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update company" operation. **/
|
||||
@@ -290,36 +290,56 @@ public class CompanyDao {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.CANNOT_DELETE_COMPANY_WITH_APPLICATION_SUBMITT));
|
||||
}
|
||||
|
||||
for(ApplicationEntity application:userApplications){
|
||||
userApplications = userApplications.stream()
|
||||
.peek(application -> {
|
||||
ApplicationEntity oldApplication = Utils.getClonedEntityForData(application);
|
||||
application.setIsDeleted(Boolean.TRUE);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Soft delete application" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldApplication).newData(application).build());
|
||||
|
||||
}
|
||||
applicationRepository.saveAll(userApplications);
|
||||
|
||||
for(FaqEntity faq:faqs){
|
||||
FaqEntity oldFaq = Utils.getClonedEntityForData(faq);
|
||||
faq.setIsDeleted(Boolean.TRUE);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Soft delete Faq" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldFaq).newData(faq).build());
|
||||
}
|
||||
VersionHistoryRequest.builder()
|
||||
.request(request)
|
||||
.actionType(VersionActionTypeEnum.SOFT_DELETE)
|
||||
.oldData(oldApplication)
|
||||
.newData(application)
|
||||
.build()
|
||||
);
|
||||
})
|
||||
.toList();
|
||||
applicationRepository.saveAll(userApplications);
|
||||
|
||||
faqs = faqs.stream()
|
||||
.peek(faq -> {
|
||||
FaqEntity oldFaq = Utils.getClonedEntityForData(faq);
|
||||
faq.setIsDeleted(Boolean.TRUE);
|
||||
/** This code is responsible for adding a version history log for the "Soft delete Faq" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder()
|
||||
.request(request)
|
||||
.actionType(VersionActionTypeEnum.SOFT_DELETE)
|
||||
.oldData(oldFaq)
|
||||
.newData(faq)
|
||||
.build()
|
||||
);
|
||||
})
|
||||
.toList();
|
||||
faqRepository.saveAll(faqs);
|
||||
|
||||
for(BeneficiaryPreferredCallEntity beneficiaryPreferredCall:preferredCallEntities){
|
||||
preferredCallEntities = preferredCallEntities.stream()
|
||||
.peek(beneficiaryPreferredCall -> {
|
||||
BeneficiaryPreferredCallEntity oldPreferredCall = Utils.getClonedEntityForData(beneficiaryPreferredCall);
|
||||
beneficiaryPreferredCall.setIsDeleted(Boolean.TRUE);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Soft Delete BeneficiaryPreferredCall" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldPreferredCall).newData(beneficiaryPreferredCall).build());
|
||||
|
||||
}
|
||||
VersionHistoryRequest.builder()
|
||||
.request(request)
|
||||
.actionType(VersionActionTypeEnum.SOFT_DELETE)
|
||||
.oldData(oldPreferredCall)
|
||||
.newData(beneficiaryPreferredCall)
|
||||
.build()
|
||||
);
|
||||
})
|
||||
.toList();
|
||||
beneficiaryPreferredCallRepository.saveAll(preferredCallEntities);
|
||||
|
||||
if(userCompanyDelegationEntity!=null){
|
||||
|
||||
@@ -103,8 +103,10 @@ public class EmailNotificationDao {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> applicationEvaluationEntity = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationEntity.getId());
|
||||
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
|
||||
String companyEmail = company.getEmail();
|
||||
String contactEmail = company.getContactEmail();
|
||||
|
||||
UserWithCompanyEntity userWithCompany=companyService.getUserWithCompany(userEntity.getId(),company.getId());
|
||||
String companyEmail = userWithCompany.getEmail();
|
||||
String contactEmail = userWithCompany.getContactEmail();
|
||||
|
||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(), RecipientTypeEnum.COMPANY,company.getId() ,
|
||||
|
||||
@@ -41,24 +41,12 @@ public class CompanyEntity extends BaseEntity{
|
||||
@Column(name = "COUNTRY")
|
||||
private String country;
|
||||
|
||||
@Column(name = "PEC")
|
||||
private String pec;
|
||||
|
||||
@Column(name = "EMAIL")
|
||||
private String email;
|
||||
|
||||
@Column(name = "NUMBER_OF_EMPLOYEES")
|
||||
private String numberOfEmployees;
|
||||
|
||||
@Column(name = "ANNUAL_REVENUE")
|
||||
private BigDecimal annualRevenue;
|
||||
|
||||
@Column(name = "CONTACT_NAME")
|
||||
private String contactName;
|
||||
|
||||
@Column(name = "CONTACT_EMAIL")
|
||||
private String contactEmail;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "HUB_ID")
|
||||
private HubEntity hub;
|
||||
|
||||
@@ -22,6 +22,22 @@ public class UserWithCompanyEntity extends BaseEntity{
|
||||
@Column(name = "IS_LEGAL_REPRESENTANT")
|
||||
private Boolean isLegalRepresentant;
|
||||
|
||||
|
||||
@Column(name = "CONTACT_NAME")
|
||||
private String contactName;
|
||||
|
||||
@Column(name = "CONTACT_EMAIL")
|
||||
private String contactEmail;
|
||||
|
||||
@Column(name = "PEC")
|
||||
private String pec;
|
||||
|
||||
@Column(name = "EMAIL")
|
||||
private String email;
|
||||
|
||||
@Column(name = "JSON")
|
||||
private String json;
|
||||
|
||||
@Column(name = "IS_DELETED")
|
||||
private Boolean isDeleted = false;
|
||||
|
||||
|
||||
@@ -1961,13 +1961,6 @@
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="04-12-2024_2" author="Nisha Kashyap">
|
||||
<addColumn tableName="company">
|
||||
<column name="JSON" type="TEXT">
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet id="03-12-2024_1" author="Piyush">
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/update_system_email_template_for_updating_amendment_mail_notification_mail_03_12_2024_1.sql"/>
|
||||
@@ -1977,6 +1970,19 @@
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/update_system_email_template_for_updating_amendment_mail_notification_mail_04_12_2024_1.sql"/>
|
||||
</changeSet>
|
||||
<changeSet id="19-12-2024_1" author="Nisha Kashyap">
|
||||
<addColumn tableName="USER_WITH_COMPANY">
|
||||
<column name="contact_name" type="VARCHAR(255)"/>
|
||||
<column name="contact_email" type="VARCHAR(255)"/>
|
||||
<column name="PEC" type="VARCHAR(255)"/>
|
||||
<column name="EMAIL" type="VARCHAR(255)"/>
|
||||
<column name="JSON" type="TEXT"/>
|
||||
</addColumn>
|
||||
<dropColumn tableName="COMPANY" columnName="contact_name"/>
|
||||
<dropColumn tableName="COMPANY" columnName="contact_email"/>
|
||||
<dropColumn tableName="COMPANY" columnName="PEC"/>
|
||||
<dropColumn tableName="COMPANY" columnName="EMAIL"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="04-12-2024_3" author="Piyush">
|
||||
<addColumn tableName="hub">
|
||||
|
||||
@@ -307,6 +307,7 @@ response.days.not.null=I giorni di risposta non devono essere nulli e maggiori d
|
||||
application.cannot.approved.or.rejected=La domanda non pu<70> essere approvata o rifiutata perch<63> l'emendamento <20> attivo.
|
||||
valid.vatnumber.message=Il numero di partita IVA <20> valido.
|
||||
application.cannot.approved.or.rejected=La domanda non pu? essere approvata o rifiutata perch? l'emendamento ? attivo.
|
||||
|
||||
atleast.one.id.required=Almeno uno tra companyId o applicationId deve essere fornito.
|
||||
|
||||
#Appointment flow messages
|
||||
@@ -328,6 +329,7 @@ appointment.created.successfully = Appuntamento creato con successo.
|
||||
error.try.again = Errore di chiamata di servizio durante l'esecuzione dell'operazione. Riprovare.
|
||||
document.uploading.is.in.progress = Il documento ? in fase di caricamento.
|
||||
all.document.checked.and.one.checklist.checked=Tutti i documenti devono essere controllati e almeno una checklist deve essere controllata.
|
||||
<<<<<<< HEAD
|
||||
|
||||
#notification messsages
|
||||
notification.already.in.state=La notifica <20> gi<67> nello stato fornito.
|
||||
@@ -337,3 +339,5 @@ notification.sent.successfully=Notifica inviata con successo.
|
||||
notification.deleted.successfully=Notifica eliminata con successo.
|
||||
notification.updated.successfully=Notifica aggiornata con successo.
|
||||
user.with.company.not.found = Utente con azienda non trovato per utente o azienda.
|
||||
=======
|
||||
>>>>>>> 832666a4d412c2c81f5c1dfb5b1866aba2c40bdd
|
||||
|
||||
Reference in New Issue
Block a user