Class CompanyService
java.lang.Object
es.kukenan.smartfi.microservice.backoffice.service.CompanyService
Company related services.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringCompany rol name constant.private InternalApiClientBack office clients manager.private intPassword length.private StringKey used for generate RSA cipher.private RolRepositoryRol repository.private SmtpMailNotificationHandlerComponent for handle SMTP communication inside backoffice.private UserRepositoryUser repository. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDtocompanyDetail(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Company company) Add detail data to company.companyUserCreation(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackoffice companyUserBackoffice, Rol rol, User principal, Integer companyId) Create user on DB.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>createUser(String userBackofficeId, String userJwtToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackoffice companyUserBackoffice, Integer companyId) Create user for company.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>deleteCompanyUser(String userBackofficeId, String userJwtToken, Integer companyId, String userId) Delete User for Company.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.BasicCompanyDto>>>findCompanies(String userBackofficeId, String userJwtToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy) Find Company list service.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>getCompanyDetail(String userBackofficeId, String userJwtToken, Integer companyId) Company detail service.getCompanyLogo(String userBackofficeId, String userToken, Integer companyId, javax.servlet.http.HttpServletResponse response) Find Company logo.private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>returnDetailCompany(String userBackofficeId, String userJwtToken, Integer companyId) Return detailed Company.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>updateCompany(String userBackofficeId, String userJwtToken, Integer companyId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto companyDto) Company detail service.org.springframework.http.ResponseEntity<Object>updateCompanyLogo(Integer companyId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken) Update company logo.
-
Field Details
-
passwordLength
@Value("${backoffice.password.length}") private int passwordLengthPassword length. -
publicKey
Key used for generate RSA cipher. -
COMPANY_ROL_NAME
Company rol name constant.- See Also:
-
internalApiClient
Back office clients manager. -
userRepository
User repository. -
rolRepository
Rol repository. -
smtpMailNotificationHandler
Component for handle SMTP communication inside backoffice.
-
-
Constructor Details
-
CompanyService
public CompanyService()
-
-
Method Details
-
findCompanies
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.BasicCompanyDto>>> findCompanies(String userBackofficeId, String userJwtToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy) Find Company list service.- Parameters:
userBackofficeId- backoffice user identifieruserJwtToken- user tokenfilterUserRequestDto- fields to filterpageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sort- Returns:
- company list.
-
getCompanyDetail
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> getCompanyDetail(String userBackofficeId, String userJwtToken, Integer companyId) Company detail service.- Parameters:
userBackofficeId- backoffice user identifieruserJwtToken- user tokencompanyId- company identifier- Returns:
- company detail.
-
createUser
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> createUser(String userBackofficeId, String userJwtToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackoffice companyUserBackoffice, Integer companyId) Create user for company.- Parameters:
userBackofficeId- backoffice user identifieruserJwtToken- user tokencompanyUserBackoffice- user informationcompanyId- company identifier- Returns:
- Company User Creation response.
-
returnDetailCompany
private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto> returnDetailCompany(String userBackofficeId, String userJwtToken, Integer companyId) throws InterruptedException, ExecutionException Return detailed Company.- Parameters:
userBackofficeId- user backoffice identifier.userJwtToken- user token.companyId- company identifier.- Returns:
- Detail Company Dto
- Throws:
InterruptedException- Exception if find Company fails.ExecutionException- Exception if find Company fails.
-
companyUserCreation
public User companyUserCreation(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackoffice companyUserBackoffice, Rol rol, User principal, Integer companyId) Create user on DB.- Parameters:
companyUserBackoffice- request datarol- User Rol.principal- User Father.companyId- Company Identifier.- Returns:
- Company User Backoffice Response object
-
updateCompany
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> updateCompany(String userBackofficeId, String userJwtToken, Integer companyId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto companyDto) Company detail service.- Parameters:
userBackofficeId- backoffice user identifieruserJwtToken- user tokencompanyId- company identifiercompanyDto- company data to update.- Returns:
- company detail.
-
companyDetail
private es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto companyDetail(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Company company) Add detail data to company.- Parameters:
company- Company object.- Returns:
- Detailed company.
-
deleteCompanyUser
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> deleteCompanyUser(String userBackofficeId, String userJwtToken, Integer companyId, String userId) Delete User for Company.- Parameters:
userBackofficeId- backoffice user identifieruserJwtToken- user tokencompanyId- company identifieruserId- user identifier.- Returns:
- Updated company detail.
-
getCompanyLogo
public String getCompanyLogo(String userBackofficeId, String userToken, Integer companyId, javax.servlet.http.HttpServletResponse response) throws IOException Find Company logo.- Parameters:
userBackofficeId- user backoffice identifier.userToken- user credentials.companyId- company identifierresponse- response.- Returns:
- Base64 logo image.
- Throws:
IOException- file to write response.
-
updateCompanyLogo
public org.springframework.http.ResponseEntity<Object> updateCompanyLogo(Integer companyId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken) Update company logo.- Parameters:
companyId- company identifier.userId- user backoffice identifier.file- file received.userToken- user token.- Returns:
- company Object.
-