java.lang.Object
es.kukenan.smartfi.microservice.backoffice.controller.CompanyController

@RestController public class CompanyController extends Object
Company Rest API controller.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Authority (role) required in order to be able to invoke change application status.
    static final String
    Base path for backoffice Rest API.
    static final String
    Base path for backoffice company Rest API.
    static final String
    Path for backoffice company detail.
    static final String
    Path for backoffice company logo Rest API.
    static final String
    Path for backoffice company user detail API.
    static final String
    Path for backoffice company user API.
    Company service for handle endpoints.
    private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl
    JWT service for create a bearer to call products.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>
    companyDetail(Integer companyId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find Company detail.
    companyLogo(Integer companyId, es.kukenan.smartfi.common.security.WalletAuthentication authentication, javax.servlet.http.HttpServletResponse response)
    Find Company logo.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>
    createUser(Integer companyId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackoffice companyUserBackoffice, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find Company List endpoint.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>
    deleteCompanyUser(Integer companyId, String userId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Remove User from 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(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find Company List endpoint.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>>
    updateCompany(Integer companyId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto companyDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find Company List endpoint.
    org.springframework.http.ResponseEntity<Object>
    uploadPaymentProofFile(Integer companyId, org.springframework.web.multipart.MultipartFile file, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Change application from PAYMENT_PENDING (credit) or APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance) or ACTIVE (credit).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • API_BASE_PATH

      public static final String API_BASE_PATH
      Base path for backoffice Rest API.
      See Also:
    • API_COMPANY_BASE_PATH

      public static final String API_COMPANY_BASE_PATH
      Base path for backoffice company Rest API.
      See Also:
    • API_COMPANY_DETAIL_PATH

      public static final String API_COMPANY_DETAIL_PATH
      Path for backoffice company detail.
      See Also:
    • API_COMPANY_LOGO_BASE_PATH

      public static final String API_COMPANY_LOGO_BASE_PATH
      Path for backoffice company logo Rest API.
      See Also:
    • API_COMPANY_USER_PATH

      public static final String API_COMPANY_USER_PATH
      Path for backoffice company user API.
      See Also:
    • API_COMPANY_USER_DETAIL_PATH

      public static final String API_COMPANY_USER_DETAIL_PATH
      Path for backoffice company user detail API.
      See Also:
    • API_BACKOFFICE_AUTHORITIES

      public static final String API_BACKOFFICE_AUTHORITIES
      Authority (role) required in order to be able to invoke change application status.
      See Also:
    • companyService

      @Autowired private CompanyService companyService
      Company service for handle endpoints.
    • jwtService

      @Autowired private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl jwtService
      JWT service for create a bearer to call products.
  • Constructor Details

    • CompanyController

      public CompanyController()
  • Method Details

    • findCompanies

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PostMapping(path="/api/v1/backoffice/company", produces="application/json", consumes="application/json") 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(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, @RequestParam(name="pageNumber",required=false) Integer pageNumber, @RequestParam(name="pageSize",required=false) Integer pageSize, @RequestParam(name="sortedBy",required=false) String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find Company List endpoint.
      Parameters:
      filterUserRequestDto - fields to filter
      pageNumber - the page to search
      pageSize - max number of rows per page
      sortedBy - field to sort
      authentication - user credentials.
      Returns:
      Company list.
    • companyDetail

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @GetMapping(path="/api/v1/backoffice/company/{companyId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> companyDetail(@PathVariable("companyId") Integer companyId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find Company detail.
      Parameters:
      companyId - company identifier
      authentication - user credentials.
      Returns:
      Company list.
    • createUser

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PostMapping(path="/api/v1/backoffice/company/{companyId}/user", produces="application/json", consumes="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> createUser(@PathVariable("companyId") Integer companyId, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackoffice companyUserBackoffice, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find Company List endpoint.
      Parameters:
      companyId - company identifier
      companyUserBackoffice - user information
      authentication - user credentials.
      Returns:
      Company list.
    • updateCompany

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/company/{companyId}", produces="application/json", consumes="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> updateCompany(@PathVariable("companyId") Integer companyId, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto companyDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find Company List endpoint.
      Parameters:
      companyId - company identifier
      companyDto - fields to filter
      authentication - user credentials.
      Returns:
      Company list.
    • deleteCompanyUser

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @DeleteMapping(path="/api/v1/backoffice/company/{companyId}/user/{userId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.company.DetailCompanyDto>> deleteCompanyUser(@PathVariable("companyId") Integer companyId, @PathVariable("userId") String userId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Remove User from Company.
      Parameters:
      companyId - company identifier
      userId - user identifier
      authentication - user credentials.
      Returns:
      Company list.
    • companyLogo

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @GetMapping(path="/api/v1/backoffice/company/logo/{companyId}") public String companyLogo(@PathVariable("companyId") Integer companyId, es.kukenan.smartfi.common.security.WalletAuthentication authentication, javax.servlet.http.HttpServletResponse response) throws IOException
      Find Company logo.
      Parameters:
      companyId - company identifier
      authentication - user credentials.
      response - response.
      Returns:
      Base64 logo image.
      Throws:
      IOException - file to write response.
    • uploadPaymentProofFile

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/company/logo/{companyId}", produces="application/json") public org.springframework.http.ResponseEntity<Object> uploadPaymentProofFile(@PathVariable(name="companyId") Integer companyId, @RequestPart("file") org.springframework.web.multipart.MultipartFile file, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Change application from PAYMENT_PENDING (credit) or APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance) or ACTIVE (credit).
      Parameters:
      companyId - company identifier.
      file - file received.
      authentication - user credentials.
      Returns:
      company Object.