Class UserService
java.lang.Object
es.kukenan.smartfi.microservice.smartficore.service.UserService
User management service.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AmqpControllerAMQP Controller (for event publishing).Request/execution context manager.Request/execution context manager.private BackofficeUserCreatedMapperRequest/execution context manager.private BackofficeUserUpdatedMapperRequest/execution context manager.private ContractRepositoryContractRepository contractRepository.private ContractServiceContract service.private final org.springframework.data.domain.ExampleMatcherExample matcher configuration.private KafkaControllerKafka Controller.private es.kukenan.smartfi.common.context.RequestContextManagerRequest/execution context manager.private UserCompanyRepositoryUser Company repository.private UserDocumentRepositoryUser Document repository.private UserMongoRepositoryUsers mongo repository.private UserRepositoryUsers repository. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateUser(User user, String userOnboardingId, Boolean firstDataCheck) Create the given user, that must previously exist.Find a user by its user identifier.findUserByOnboardingId(String onboardingId, String companyId) Find a user by its user identifier.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>getClientDetail(String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Get client full object.getClientsCount(es.kukenan.smartfi.common.security.WalletAuthentication authentication) Search count of clients.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>>>getClientsList(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy) Search list of clients.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>>>getClientsOfCompanyList(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Search list of clients.voidhandleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent userUpdatedEvent) Method for handle event for update update information.voidpatchUser(User newUserData, User oldUserData, es.kukenan.smartfi.microservice.onboarding.events.modified.OnboardingModifiedEventBody body) Update the persisted data of the given user.private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>responseClientDetail(User user, String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Get client detal full object response.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 clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Get client full object.voidupdateUser(User newUserData, User oldUserData, es.kukenan.smartfi.microservice.onboarding.events.modified.OnboardingModifiedEventBody body) Update User from onboarding.
-
Field Details
-
exampleMatcher
private final org.springframework.data.domain.ExampleMatcher exampleMatcherExample matcher configuration. -
userRepository
Users repository. -
userCompanyRepository
User Company repository. -
contractService
Contract service. -
amqpController
AMQP Controller (for event publishing). -
kafkaController
Kafka Controller. -
requestContextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManagerRequest/execution context manager. -
backofficeUserCreatedMapper
Request/execution context manager. -
backofficeOnboardingUserUpdatedMapper
Request/execution context manager. -
backofficeUserUpdatedMapper
Request/execution context manager. -
backOfficeAppointmentUpdatedMapper
Request/execution context manager. -
userDocumentRepository
User Document repository. -
contractRepository
ContractRepository contractRepository. -
userMongoRepository
Users mongo repository.
-
-
Constructor Details
-
UserService
public UserService()
-
-
Method Details
-
findUser
Find a user by its user identifier.- Parameters:
userId- user identifier.companyId- user company identifier.- Returns:
- the user with the given identifier. If the user does not exist an
nullis returned.
-
findUserByOnboardingId
Find a user by its user identifier.- Parameters:
onboardingId- user identifier.companyId- user company identifier.- Returns:
- the user with the given identifier. If the user does not exist an
nullis returned.
-
createUser
Create the given user, that must previously exist.- Parameters:
user- the new user to create.userOnboardingId- id of the onboarding user.firstDataCheck- flag to check data on first login.- Returns:
- the inserted instance data.
-
patchUser
public void patchUser(User newUserData, User oldUserData, es.kukenan.smartfi.microservice.onboarding.events.modified.OnboardingModifiedEventBody body) Update the persisted data of the given user.- Parameters:
newUserData- an object that contains the information to update the existing user.oldUserData- previous user information.body- event body.
-
updateUser
public void updateUser(User newUserData, User oldUserData, es.kukenan.smartfi.microservice.onboarding.events.modified.OnboardingModifiedEventBody body) Update User from onboarding.- Parameters:
newUserData- new user informationoldUserData- old user informationbody- event body
-
getClientsList
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>>> getClientsList(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy) Search list of clients.- Parameters:
filterUserRequestDto- company info.pageNumber- number of page to get.pageSize- size of list to return.sortedBy- sort param.- Returns:
- clients list.
-
getClientsOfCompanyList
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>>> getClientsOfCompanyList(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Search list of clients.- Parameters:
filterUserRequestDto- company info.pageNumber- number of page to get.pageSize- size of list to return.sortedBy- sort param.authentication- user credentials.- Returns:
- clients list.
-
getClientDetail
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> getClientDetail(String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Get client full object.- Parameters:
clientId- client identifier.authentication- user credentials.- Returns:
- client detail.
-
getClientsCount
public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Map<String,Long>>> getClientsCount(es.kukenan.smartfi.common.security.WalletAuthentication authentication) Search count of clients.- Parameters:
authentication- user credentials.- Returns:
- clients count.
-
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 clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Get client full object.- Parameters:
updateUserDto- update information.clientId- client identifier.authentication- user credentials.- Returns:
- client detail.
-
responseClientDetail
private es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto> responseClientDetail(User user, String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Get client detal full object response.- Parameters:
user- user document.clientId- client identifier.authentication- user credentials.- Returns:
- client detail.
-
handleUserUpdatedEvent
public void handleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent userUpdatedEvent) Method for handle event for update update information.- Parameters:
userUpdatedEvent- UserUpdatedEvent update event.
-