Class UserService
java.lang.Object
es.kukenan.smartfi.microservice.backoffice.service.UserService
Users related services.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringAdvance constant.private AuditServiceBackoffice endpoints implementation.private CommentRepositoryComment repository.private static final StringCompany rol name constant.private CompanyServiceCompany service.private static final StringConsultant rol name constant.private static final StringCredit constant.private final org.springframework.data.domain.ExampleMatcherExample matcher configuration.private InternalApiClientBack office clients manager.private intPassword length.private StringKey used for generate RSA cipher.private es.kukenan.smartfi.common.context.RequestContextManagerRequest context manager.private RolRepositoryRol repository.private SmtpMailNotificationHandlerComponent for handle SMTP communication inside backoffice.private UserRepositoryUser repository.Advance constant. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>addComments(es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto> responseDto) Add comments to client detail response.private es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractaddSponsor(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract contract) Add Sponsor data to given Contract.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>>changeApplicationToPayed(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateListOfContractsRequestDto updateListOfContractsRequestDto, String userId, String userJwtToken, String product) Change a list of application identifier from PAYMENT_PENDING (credit) or APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance) or ACTIVE (credit).org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>>countApplications(String userToken, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application count.countClientsUsers(String userId, String userToken, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Count clients and users service.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackofficeResponse>>>createUser(String userBackofficeId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CreateCompanyBackofficeRequestDto createUserBackofficeRequestDto) Create new backoffice consultant or company user.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>findApplicationDetail(String userToken, String applicationId) Application detail service.org.springframework.http.ResponseEntity<Object>findApplications(String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application list service.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>findClient(String userToken, String clientId) Find User by Document id endpoint.org.springframework.http.ResponseEntity<Object>findClientByDocument(String userId, String userToken, es.kukenan.smartfi.dto.backoffice.UserBackofficeRequestDTO userBackofficeRequest) Find Client by Document id.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>>findClients(String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Clients list endpoint.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.requestedfiles.DataObject>>>Find available roles for create users.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>Find User endpoint.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>>findUsers(String userId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, String type) Users list endpoint.voidgetContractDocumentFile(String userId, String userToken, String contractDocumentId, javax.servlet.http.HttpServletResponse response, boolean generate) Get contract document file.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>saveApplication(String backofficeUserId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.NewUserAndApplicationRequestDto requestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication, String userIp, String userAgent) Create new application.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>updateClient(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.UpdateUserDto updateUserDto, String userToken, String clientId, String userId) Update some client data.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>updateContractDocumentStatus(String userId, String userToken, String contractDocumentId, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateContractDocumentRequestDto updateContractDocumentRequestDto) Update application document status.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>updateContractStatus(String userId, String contractId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStatusRequestDto contractStatusRequestDto) Update application status.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadContractualFile(String contractId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken, String process) Upload contractual files.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadFile(String contractId, String userId, List<org.springframework.web.multipart.MultipartFile> files, String userToken) Upload specific contract document file.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadFile(String contractDocumentId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken) Upload files.private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>validContractResponse(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract contract) Validate if the contract response is not null to add Sponsor.
-
Field Details
-
exampleMatcher
private final org.springframework.data.domain.ExampleMatcher exampleMatcherExample matcher configuration. -
passwordLength
@Value("${backoffice.password.length}") private int passwordLengthPassword length. -
publicKey
Key used for generate RSA cipher. -
CREDIT_PRODUCT
Credit constant.- See Also:
-
ADVANCE_PRODUCT
Advance constant.- See Also:
-
CONSULTANT_ROL_NAME
Consultant rol name constant.- See Also:
-
COMPANY_ROL_NAME
Company rol name constant.- See Also:
-
VALID_NEW_USER_ROLES
Advance constant. -
internalApiClient
Back office clients manager. -
userRepository
User repository. -
rolRepository
Rol repository. -
commentRepository
Comment repository. -
auditService
Backoffice endpoints implementation. -
requestContextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManagerRequest context manager. -
smtpMailNotificationHandler
Component for handle SMTP communication inside backoffice. -
companyService
Company service.
-
-
Constructor Details
-
UserService
public UserService()
-
-
Method Details
-
findClients
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>> findClients(String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Clients list endpoint.- Parameters:
userToken- user token generated.filterUserRequestDto- fields to filter.pageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sortauthentication- user credentials.- Returns:
- user list.
-
findClient
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> findClient(String userToken, String clientId) Find User by Document id endpoint.- Parameters:
userToken- user token generated.clientId- client identifier.- Returns:
- user list.
-
findApplications
public org.springframework.http.ResponseEntity<Object> findApplications(String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application list service.- Parameters:
userToken- token generated.getApplicationsRequestDto- fields to filter.pageNumber- the page to search.pageSize- max number of rows per page.sortedBy- field to sort.authentication- user credentials.- Returns:
- user list.
-
addSponsor
private es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract addSponsor(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract contract) Add Sponsor data to given Contract.- Parameters:
contract- contract to update.- Returns:
- updated contract with sponsor data.
-
validContractResponse
private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> validContractResponse(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract contract) Validate if the contract response is not null to add Sponsor.- Parameters:
contract- contract from Core.- Returns:
- ResponseDTO.
-
findApplicationDetail
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> findApplicationDetail(String userToken, String applicationId) Application detail service.- Parameters:
userToken- token generated.applicationId- application identifier.- Returns:
- user list.
-
saveApplication
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> saveApplication(String backofficeUserId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.NewUserAndApplicationRequestDto requestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication, String userIp, String userAgent) Create new application.- Parameters:
backofficeUserId- user identifier.userToken- user bearer token.requestDto- new application data.authentication- user credentials.userIp- user real ipuserAgent- user-agent header- Returns:
- ContractResponseDto.
-
uploadFile
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadFile(String contractDocumentId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken) Upload files.- Parameters:
contractDocumentId- application identifier.userId- user identifier.file- file uploaded.userToken- user token.- Returns:
- upload files response.
-
uploadFile
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadFile(String contractId, String userId, List<org.springframework.web.multipart.MultipartFile> files, String userToken) Upload specific contract document file.- Parameters:
contractId- application identifier.userId- user identifier.files- files uploaded.userToken- user token.- Returns:
- upload files response.
-
countApplications
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>> countApplications(String userToken, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application count.- Parameters:
userToken- user credentials.authentication- user credentials.- Returns:
- user list.
-
updateContractStatus
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> updateContractStatus(String userId, String contractId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStatusRequestDto contractStatusRequestDto) Update application status.- Parameters:
userId- user identifier.contractId- application identifier.userToken- user token.contractStatusRequestDto- list of files received.- Returns:
- change status response.
-
updateContractDocumentStatus
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> updateContractDocumentStatus(String userId, String userToken, String contractDocumentId, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateContractDocumentRequestDto updateContractDocumentRequestDto) Update application document status.- Parameters:
userId- user identifier.userToken- user token.contractDocumentId- application document identifier.updateContractDocumentRequestDto- update application document data.- Returns:
- change status response.
-
getContractDocumentFile
public void getContractDocumentFile(String userId, String userToken, String contractDocumentId, javax.servlet.http.HttpServletResponse response, boolean generate) throws IOException Get contract document file.- Parameters:
userId- user identifier.userToken- user credentials.contractDocumentId- contract document identifier.response- response.generate- flag for download generated contract pdf file.- Throws:
IOException- file to write response.
-
uploadContractualFile
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadContractualFile(String contractId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken, String process) Upload contractual files.- Parameters:
contractId- application identifier.userId- user identifier.file- file uploaded.userToken- user token.process- process to call.- Returns:
- upload files response.
-
createUser
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackofficeResponse>>> createUser(String userBackofficeId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CreateCompanyBackofficeRequestDto createUserBackofficeRequestDto) Create new backoffice consultant or company user.- Parameters:
userBackofficeId- user backoffice identifier creating the new user.userToken- user authentication token.createUserBackofficeRequestDto- request dto.- Returns:
- creation message.
-
findRoles
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.requestedfiles.DataObject>>> findRoles()Find available roles for create users.- Returns:
- roles list.
-
findUsers
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>> findUsers(String userId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, String type) Users list endpoint.- Parameters:
userId- user identifier.userToken- user token generated.filterUserRequestDto- fields to filter.pageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sorttype- Type of user to search- Returns:
- user list.
-
findUser
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> findUser(String userId, String userToken) Find User endpoint.- Parameters:
userId- user identifier.userToken- user token generated.- Returns:
- user list.
-
changeApplicationToPayed
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>> changeApplicationToPayed(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateListOfContractsRequestDto updateListOfContractsRequestDto, String userId, String userJwtToken, String product) Change a list of application identifier from PAYMENT_PENDING (credit) or APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance) or ACTIVE (credit).- Parameters:
updateListOfContractsRequestDto- contract id list.userId- user identifier.userJwtToken- user credentials.product- application type.- Returns:
- ok.
-
countClientsUsers
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Map<String,Long>>> countClientsUsers(String userId, String userToken, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Count clients and users service.- Parameters:
userId- user identifier.userToken- user token generated.authentication- user credentials.- Returns:
- clients and users count list.
-
findClientByDocument
public org.springframework.http.ResponseEntity<Object> findClientByDocument(String userId, String userToken, es.kukenan.smartfi.dto.backoffice.UserBackofficeRequestDTO userBackofficeRequest) Find Client by Document id.- Parameters:
userId- core user id.userToken- user token generated.userBackofficeRequest- client document filter.- Returns:
- client object.
-
updateClient
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> updateClient(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.UpdateUserDto updateUserDto, String userToken, String clientId, String userId) Update some client data.- Parameters:
updateUserDto- update information.userToken- user token.clientId- client identifieruserId- user identifier- Returns:
- user detail.
-
addComments
private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto> addComments(es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto> responseDto) Add comments to client detail response.- Parameters:
responseDto- Client Detail Response.- Returns:
- Client detail response updated with comments.
-