java.lang.Object
es.kukenan.smartfi.microservice.smartficore.service.UserService

@Service public class UserService extends Object
User management service.
  • Field Details

    • exampleMatcher

      private final org.springframework.data.domain.ExampleMatcher exampleMatcher
      Example matcher configuration.
    • userRepository

      @Autowired private UserRepository userRepository
      Users repository.
    • userCompanyRepository

      @Autowired private UserCompanyRepository userCompanyRepository
      User Company repository.
    • contractService

      @Autowired private ContractService contractService
      Contract service.
    • amqpController

      @Autowired private AmqpController amqpController
      AMQP Controller (for event publishing).
    • kafkaController

      @Autowired private KafkaController kafkaController
      Kafka Controller.
    • requestContextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManager
      Request/execution context manager.
    • backofficeUserCreatedMapper

      @Autowired private BackofficeUserCreatedMapper backofficeUserCreatedMapper
      Request/execution context manager.
    • backofficeOnboardingUserUpdatedMapper

      @Autowired private BackofficeOnboardingUserUpdatedMapper backofficeOnboardingUserUpdatedMapper
      Request/execution context manager.
    • backofficeUserUpdatedMapper

      @Autowired private BackofficeUserUpdatedMapper backofficeUserUpdatedMapper
      Request/execution context manager.
    • backOfficeAppointmentUpdatedMapper

      @Autowired private BackOfficeAppointmentUpdatedMapper backOfficeAppointmentUpdatedMapper
      Request/execution context manager.
    • userDocumentRepository

      @Autowired private UserDocumentRepository userDocumentRepository
      User Document repository.
    • contractRepository

      @Autowired private ContractRepository contractRepository
      ContractRepository contractRepository.
    • userMongoRepository

      @Autowired private UserMongoRepository userMongoRepository
      Users mongo repository.
  • Constructor Details

    • UserService

      public UserService()
  • Method Details

    • findUser

      public User findUser(String userId, String companyId)
      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 null is returned.
    • findUserByOnboardingId

      public User findUserByOnboardingId(String onboardingId, String companyId)
      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 null is returned.
    • createUser

      public User createUser(User user, String userOnboardingId, Boolean firstDataCheck)
      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 information
      oldUserData - old user information
      body - 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.