Done ticket GEPAFINBE-35

This commit is contained in:
nisha
2024-10-08 17:31:38 +05:30
parent 654beb1c8a
commit c7727254c2
12 changed files with 65 additions and 57 deletions

View File

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

View File

@@ -83,15 +83,12 @@ public class UserDao {
beneficiaryEntity.setLastName(userReq.getLastName());
beneficiaryEntity.setOrganization(userReq.getOrganization());
beneficiaryEntity.setPhoneNumber(userReq.getPhoneNumber());
beneficiaryEntity.setGdprRead(userReq.getGdprRead());
beneficiaryEntity.setGdprComunicazione(userReq.getGdprComunicazione());
beneficiaryEntity.setGdprElaborazione(userReq.getGdprElaborazione());
beneficiaryEntity.setGdprMateriale(userReq.getGdprMateriale());
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;
@@ -159,16 +156,14 @@ public class UserDao {
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()::getGdprComunicazione, userEntity.getBeneficiary()::setGdprComunicazione, userReq.getGdprComunicazione());
setIfUpdated(userEntity.getBeneficiary()::getGdprElaborazione, userEntity.getBeneficiary()::setGdprElaborazione, userReq.getGdprElaborazione());
setIfUpdated(userEntity.getBeneficiary()::getGdprMateriale, userEntity.getBeneficiary()::setGdprMateriale, userReq.getGdprMateriale());
setIfUpdated(userEntity.getBeneficiary()::getMarketing, userEntity.getBeneficiary()::setMarketing, userReq.getMarketing());
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);
@@ -234,15 +229,12 @@ public class UserDao {
userResponseBean.setCountry(userEntity.getBeneficiary().getCountry());
userResponseBean.setCodiceFiscale(userEntity.getBeneficiary().getCodiceFiscale());
userResponseBean.setDateOfBirth(userEntity.getBeneficiary().getDateOfBirth());
userResponseBean.setGdprRead(userEntity.getBeneficiary().getGdprRead());
userResponseBean.setGdprComunicazione(userEntity.getBeneficiary().getGdprComunicazione());
userResponseBean.setGdprElaborazione(userEntity.getBeneficiary().getGdprElaborazione());
userResponseBean.setGdprMateriale(userEntity.getBeneficiary().getGdprMateriale());
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;
}