Merge pull request #37 from Kitzanos/feature/GEPAFINBE-35
GEPAFINBE-35 (Beneficiary GDPR)
This commit is contained in:
@@ -21,6 +21,8 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
|
||||
@Component
|
||||
public class CompanyDao {
|
||||
|
||||
@@ -97,6 +99,8 @@ public class CompanyDao {
|
||||
entity.setEmail(request.getEmail());
|
||||
entity.setNumberOfEmployees(request.getNumberOfEmployees());
|
||||
entity.setAnnualRevenue(request.getAnnualRevenue());
|
||||
entity.setContactName(request.getContactName());
|
||||
entity.setContactEmail(request.getContactEmail());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -118,29 +122,33 @@ public class CompanyDao {
|
||||
response.setAnnualRevenue(entity.getAnnualRevenue());
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setContactName(entity.getContactName());
|
||||
response.setContactEmail(entity.getContactEmail());
|
||||
return response;
|
||||
}
|
||||
|
||||
public CompanyResponse updateCompany(UserEntity userEntity, Long companyId, CompanyRequest companyRequest) {
|
||||
CompanyEntity companyEntity = validateCompany(companyId);
|
||||
Utils.setIfUpdated(companyEntity::getCompanyName, companyEntity::setCompanyName,
|
||||
setIfUpdated(companyEntity::getCompanyName, companyEntity::setCompanyName,
|
||||
companyRequest.getCompanyName());
|
||||
Utils.setIfUpdated(companyEntity::getVatNumber, companyEntity::setVatNumber, companyRequest.getVatNumber());
|
||||
Utils.setIfUpdated(companyEntity::getCodiceFiscale, companyEntity::setCodiceFiscale,
|
||||
setIfUpdated(companyEntity::getVatNumber, companyEntity::setVatNumber, companyRequest.getVatNumber());
|
||||
setIfUpdated(companyEntity::getCodiceFiscale, companyEntity::setCodiceFiscale,
|
||||
companyRequest.getCodiceFiscale());
|
||||
Utils.setIfUpdated(companyEntity::getAddress, companyEntity::setAddress, companyRequest.getAddress());
|
||||
Utils.setIfUpdated(companyEntity::getPhoneNumber, companyEntity::setPhoneNumber,
|
||||
setIfUpdated(companyEntity::getAddress, companyEntity::setAddress, companyRequest.getAddress());
|
||||
setIfUpdated(companyEntity::getPhoneNumber, companyEntity::setPhoneNumber,
|
||||
companyRequest.getPhoneNumber());
|
||||
Utils.setIfUpdated(companyEntity::getCity, companyEntity::setCity, companyRequest.getCity());
|
||||
Utils.setIfUpdated(companyEntity::getProvince, companyEntity::setProvince, companyRequest.getProvince());
|
||||
Utils.setIfUpdated(companyEntity::getCap, companyEntity::setCap, companyRequest.getCap());
|
||||
Utils.setIfUpdated(companyEntity::getCountry, companyEntity::setCountry, companyRequest.getCountry());
|
||||
Utils.setIfUpdated(companyEntity::getPec, companyEntity::setPec, companyRequest.getPec());
|
||||
Utils.setIfUpdated(companyEntity::getEmail, companyEntity::setEmail, companyRequest.getEmail());
|
||||
Utils.setIfUpdated(companyEntity::getNumberOfEmployees, companyEntity::setNumberOfEmployees,
|
||||
setIfUpdated(companyEntity::getCity, companyEntity::setCity, companyRequest.getCity());
|
||||
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());
|
||||
Utils.setIfUpdated(companyEntity::getAnnualRevenue, companyEntity::setAnnualRevenue,
|
||||
setIfUpdated(companyEntity::getAnnualRevenue, companyEntity::setAnnualRevenue,
|
||||
companyRequest.getAnnualRevenue());
|
||||
setIfUpdated(companyEntity::getContactName,companyEntity::setContactName,companyRequest.getContactName());
|
||||
setIfUpdated(companyEntity::getContactEmail,companyEntity::setContactEmail,companyRequest.getContactEmail());
|
||||
companyRepository.save(companyEntity);
|
||||
return convertCompanyEntityToCompanyResponse(companyEntity);
|
||||
}
|
||||
|
||||
@@ -83,6 +83,12 @@ public class UserDao {
|
||||
beneficiaryEntity.setLastName(userReq.getLastName());
|
||||
beneficiaryEntity.setOrganization(userReq.getOrganization());
|
||||
beneficiaryEntity.setPhoneNumber(userReq.getPhoneNumber());
|
||||
beneficiaryEntity.setPrivacy(userReq.getPrivacy());
|
||||
beneficiaryEntity.setTerms(userReq.getTerms());
|
||||
beneficiaryEntity.setOffers(userReq.getOffers());
|
||||
beneficiaryEntity.setMarketing(userReq.getMarketing());
|
||||
beneficiaryEntity.setThirdParty(userReq.getThirdParty());
|
||||
beneficiaryEntity.setEmailPec(userReq.getEmailPec());
|
||||
beneficiaryEntity =beneficiaryRepository.save(beneficiaryEntity);
|
||||
}
|
||||
return beneficiaryEntity;
|
||||
@@ -148,10 +154,16 @@ public class UserDao {
|
||||
setIfUpdated(userEntity::getOrganization, userEntity::setOrganization, userReq.getOrganization());
|
||||
setIfUpdated(userEntity::getAddress, userEntity::setAddress, userReq.getAddress());
|
||||
setIfUpdated(userEntity::getPhoneNumber, userEntity::setPhoneNumber, userReq.getPhoneNumber());
|
||||
setIfUpdated(userEntity::getDateOfBirth, userEntity::setDateOfBirth, userReq.getDateOfBirth());
|
||||
setIfUpdated(userEntity.getBeneficiary()::getCodiceFiscale, userEntity.getBeneficiary()::setCodiceFiscale, userReq.getCodiceFiscale());
|
||||
setIfUpdated(userEntity.getBeneficiary()::getMarketing, userEntity.getBeneficiary()::setMarketing, userReq.getMarketing());
|
||||
setIfUpdated(userEntity.getBeneficiary()::getOffers, userEntity.getBeneficiary()::setOffers, userReq.getOffers());
|
||||
setIfUpdated(userEntity.getBeneficiary()::getThirdParty, userEntity.getBeneficiary()::setThirdParty, userReq.getThirdParty());
|
||||
if (userReq.getRoleId() != null) {
|
||||
RoleEntity roleEntity = roleDao.validateRole(userReq.getRoleId());
|
||||
setIfUpdated(userEntity::getRoleEntity, userEntity::setRoleEntity, roleEntity);
|
||||
}
|
||||
setIfUpdated(userEntity.getBeneficiary()::getEmailPec, userEntity.getBeneficiary()::setEmailPec, userReq.getEmailPec());
|
||||
userEntity = userRepository.save(userEntity);
|
||||
log.info("User updated with ID: {}", userEntity.getId());
|
||||
return convertUserEntityToUserResponse(userEntity);
|
||||
@@ -167,6 +179,7 @@ public class UserDao {
|
||||
userEntity.setStatus(UserStatusEnum.ACTIVE.getValue());
|
||||
userEntity.setBeneficiary(beneficiary);
|
||||
if (Boolean.FALSE.equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue().equals(roleEntity.getRoleType()))) {
|
||||
|
||||
userEntity.setFirstName(userReq.getFirstName());
|
||||
userEntity.setLastName(userReq.getLastName());
|
||||
userEntity.setOrganization(userReq.getOrganization());
|
||||
@@ -216,6 +229,12 @@ public class UserDao {
|
||||
userResponseBean.setCountry(userEntity.getBeneficiary().getCountry());
|
||||
userResponseBean.setCodiceFiscale(userEntity.getBeneficiary().getCodiceFiscale());
|
||||
userResponseBean.setDateOfBirth(userEntity.getBeneficiary().getDateOfBirth());
|
||||
userResponseBean.setPrivacy(userEntity.getBeneficiary().getPrivacy());
|
||||
userResponseBean.setTerms(userEntity.getBeneficiary().getTerms());
|
||||
userResponseBean.setOffers(userEntity.getBeneficiary().getOffers());
|
||||
userResponseBean.setMarketing(userEntity.getBeneficiary().getMarketing());
|
||||
userResponseBean.setThirdParty(userEntity.getBeneficiary().getThirdParty());
|
||||
userResponseBean.setEmailPec(userEntity.getBeneficiary().getEmailPec());
|
||||
}
|
||||
return userResponseBean;
|
||||
}
|
||||
|
||||
@@ -44,4 +44,21 @@ public class BeneficiaryEntity extends BaseEntity {
|
||||
@Column(name = "DATE_OF_BIRTH")
|
||||
private LocalDateTime dateOfBirth;
|
||||
|
||||
@Column(name = "PRIVACY")
|
||||
private Boolean privacy;
|
||||
|
||||
@Column(name = "TERMS")
|
||||
private Boolean terms;
|
||||
|
||||
@Column(name = "MARKETING")
|
||||
private Boolean marketing;
|
||||
|
||||
@Column(name = "OFFERS")
|
||||
private Boolean offers;
|
||||
|
||||
@Column(name = "THIRD_PARTY")
|
||||
private Boolean thirdParty;
|
||||
|
||||
@Column(name = "EMAIL_PEC")
|
||||
private String emailPec;
|
||||
}
|
||||
|
||||
@@ -50,4 +50,10 @@ public class CompanyEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "ANNUAL_REVENUE")
|
||||
private BigDecimal annualRevenue;
|
||||
|
||||
@Column(name = "CONTACT_NAME")
|
||||
private String contactName;
|
||||
|
||||
@Column(name = "CONTACT_EMAIL")
|
||||
private String contactEmail;
|
||||
}
|
||||
|
||||
@@ -20,5 +20,6 @@ public class CompanyRequest {
|
||||
private String email;
|
||||
private String numberOfEmployees;
|
||||
private BigDecimal annualRevenue;
|
||||
|
||||
private String contactName;
|
||||
private String contactEmail;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UpdateUserReq {
|
||||
@@ -17,4 +19,11 @@ public class UpdateUserReq {
|
||||
private String city;
|
||||
private UserStatusEnum status;
|
||||
private String country;
|
||||
private String codiceFiscale;
|
||||
private LocalDateTime dateOfBirth;
|
||||
private Boolean marketing;
|
||||
private Boolean offers;
|
||||
private Boolean thirdParty;
|
||||
|
||||
private String emailPec;
|
||||
}
|
||||
|
||||
@@ -31,5 +31,12 @@ public class UserReq {
|
||||
private String codiceFiscale;
|
||||
|
||||
private LocalDateTime dateOfBirth;
|
||||
private Boolean privacy;
|
||||
private Boolean terms;
|
||||
|
||||
private Boolean marketing;
|
||||
private Boolean offers;
|
||||
private Boolean thirdParty;
|
||||
|
||||
private String emailPec;
|
||||
}
|
||||
|
||||
@@ -21,5 +21,6 @@ public class CompanyResponse extends BaseBean{
|
||||
private String email;
|
||||
private String numberOfEmployees;
|
||||
private BigDecimal annualRevenue;
|
||||
|
||||
private String contactName;
|
||||
private String contactEmail;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,18 @@ public class LoginResponse {
|
||||
|
||||
private LocalDateTime dateOfBirth;
|
||||
|
||||
private Boolean privacy;
|
||||
|
||||
private Boolean terms;
|
||||
|
||||
private Boolean marketing;
|
||||
|
||||
private Boolean offers;
|
||||
|
||||
private Boolean thirdParty;
|
||||
|
||||
private String emailPec;
|
||||
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
private LocalDateTime updatedDate;
|
||||
|
||||
@@ -39,4 +39,12 @@ public class UserResponseBean extends BaseBean {
|
||||
private LocalDateTime dateOfBirth;
|
||||
|
||||
private List<CompanyResponse> companies;
|
||||
private Boolean privacy;
|
||||
private Boolean terms;
|
||||
|
||||
private Boolean marketing;
|
||||
private Boolean offers;
|
||||
private Boolean thirdParty;
|
||||
|
||||
private String emailPec;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,12 @@ public class AuthenticationService {
|
||||
loginResponse.setCity(user.getBeneficiary().getCity());
|
||||
loginResponse.setCodiceFiscale(user.getBeneficiary().getCodiceFiscale());
|
||||
loginResponse.setDateOfBirth(user.getBeneficiary().getDateOfBirth());
|
||||
loginResponse.setPrivacy(user.getBeneficiary().getPrivacy());
|
||||
loginResponse.setMarketing(user.getBeneficiary().getMarketing());
|
||||
loginResponse.setOffers(user.getBeneficiary().getOffers());
|
||||
loginResponse.setTerms(user.getBeneficiary().getTerms());
|
||||
loginResponse.setThirdParty(user.getBeneficiary().getThirdParty());
|
||||
loginResponse.setEmailPec(user.getBeneficiary().getEmailPec());
|
||||
}
|
||||
|
||||
return loginResponse;
|
||||
|
||||
@@ -879,6 +879,26 @@
|
||||
<sqlFile dbms="postgresql"
|
||||
path="classpath:db/dump/updated_form_field_data_03-10-2024_1.sql" />
|
||||
</changeSet>
|
||||
<changeSet id="07-10-2024_1" author="Harish Bagora">
|
||||
<addColumn tableName="beneficiary">
|
||||
<column name="PRIVACY" type="BOOLEAN">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="TERMS" type="BOOLEAN">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="MARKETING" type="BOOLEAN"/>
|
||||
<column name="OFFERS" type="BOOLEAN"/>
|
||||
<column name="THIRD_PARTY" type="BOOLEAN"/>
|
||||
<column name="email_pec" type="VARCHAR(255)"/>
|
||||
</addColumn>
|
||||
|
||||
<addColumn tableName="COMPANY">
|
||||
<column name="contact_name" type="VARCHAR(255)"/>
|
||||
<column name="contact_email" type="VARCHAR(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="07-10-2024_2" author="Nisha Kashyap">
|
||||
<modifyDataType
|
||||
tableName="application_form_field"
|
||||
|
||||
Reference in New Issue
Block a user