Updated code
This commit is contained in:
@@ -189,15 +189,15 @@ public class CompanyDao {
|
||||
setIfUpdated(companyEntity::getCountry, companyEntity::setCountry, companyRequest.getCountry());
|
||||
setIfUpdated(companyEntity::getNumberOfEmployees, companyEntity::setNumberOfEmployees, companyRequest.getNumberOfEmployees());
|
||||
setIfUpdated(companyEntity::getAnnualRevenue, companyEntity::setAnnualRevenue, companyRequest.getAnnualRevenue());
|
||||
|
||||
if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
if(existingCompany!=null){
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
}
|
||||
companyEntity.setVatNumber(companyRequest.getVatNumber());
|
||||
|
||||
}
|
||||
//
|
||||
// if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
// CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
// if(existingCompany!=null){
|
||||
// throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
// }
|
||||
// companyEntity.setVatNumber(companyRequest.getVatNumber());
|
||||
//
|
||||
// }
|
||||
companyRepository.save(companyEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update company" operation. **/
|
||||
|
||||
Reference in New Issue
Block a user