Class CompanyController
java.lang.Object
es.kukenan.smartfi.microservice.backoffice.controller.CompanyController
Company Rest API controller.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAuthority (role) required in order to be able to invoke change application status.static final StringBase path for backoffice Rest API.static final StringBase path for backoffice company Rest API.static final StringPath for backoffice company detail.static final StringPath for backoffice company logo Rest API.static final StringPath for backoffice company user detail API.static final StringPath for backoffice company user API.private CompanyServiceCompany service for handle endpoints.private es.kukenan.smartfi.common.service.jwt.JwtServiceImplJWT service for create a bearer to call products. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.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).
-
Field Details
-
API_BASE_PATH
Base path for backoffice Rest API.- See Also:
-
API_COMPANY_BASE_PATH
Base path for backoffice company Rest API.- See Also:
-
API_COMPANY_DETAIL_PATH
Path for backoffice company detail.- See Also:
-
API_COMPANY_LOGO_BASE_PATH
Path for backoffice company logo Rest API.- See Also:
-
API_COMPANY_USER_PATH
Path for backoffice company user API.- See Also:
-
API_COMPANY_USER_DETAIL_PATH
Path for backoffice company user detail API.- See Also:
-
API_BACKOFFICE_AUTHORITIES
Authority (role) required in order to be able to invoke change application status.- See Also:
-
companyService
Company service for handle endpoints. -
jwtService
@Autowired private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl jwtServiceJWT 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 filterpageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sortauthentication- 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 identifierauthentication- 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 identifiercompanyUserBackoffice- user informationauthentication- 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 identifiercompanyDto- fields to filterauthentication- 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 identifieruserId- user identifierauthentication- 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 identifierauthentication- 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.
-