Class ContractRestController
java.lang.Object
es.kukenan.smartfi.microservice.contracts.controller.ContractRestController
Contrats controller.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringAdvance constant.static final StringPath save appointment to Contract.static final StringAuthority (role) required in order to be able to invoke greeting API.static final StringPath for Contract State info.static final StringPath for Contract Rest API.static final StringPath for detailed Contract.static final StringPath for create new Contract.static final StringPath for upload files to Contract.static final StringApplication detail path.static final StringCompany logo path.private ContractServiceContract service.protected es.kukenan.smartfi.common.service.jwt.JwtServiceJWT service for create a bearer to call products.private es.kukenan.smartfi.common.context.RequestContextManagerRequest context manager. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>>countApplications(es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application count.private StringcreateBearerToken(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) voiddownloadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractDocumentId, javax.servlet.http.HttpServletResponse response) Download document.getCompanyLogo(es.kukenan.smartfi.common.security.WalletAuthentication authentication, Integer companyId, javax.servlet.http.HttpServletResponse response) Get company logo.org.springframework.http.ResponseEntity<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>getContractDetail(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractId) Get Contracts detail.org.springframework.http.ResponseEntity<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStateDto>>getContractStates(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String type, String parentSessionId) Get User applications.org.springframework.http.ResponseEntity<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>getContractsWithFilters(es.kukenan.smartfi.common.security.WalletAuthentication authentication, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto, String parentSessionId) Get User applications with filters.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>saveAppointment(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.appointments.AppointmentAndBankRequest appointmentAndBankRequest) Save Appointment to Contract.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>saveContract(es.kukenan.smartfi.common.security.WalletAuthentication authentication, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.NewApplicationRequestDto newApplicationRequestDto, String userIp, String userAgent) Create Contract.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractDocumentId, org.springframework.web.multipart.MultipartFile file) Save specific contract document file.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadFiles(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractId, List<org.springframework.web.multipart.MultipartFile> files) Upload files.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Boolean>>validNewContract(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String type) Validation if user can create Contract.
-
Field Details
-
ADVANCE_PRODUCT
Advance constant.- See Also:
-
API_CONTRACTS_PATH
Path for Contract Rest API.- See Also:
-
API_NEW_APPLICATION_PATH
Path for create new Contract.- See Also:
-
API_CONTRACT_STATES_PATH
Path for Contract State info.- See Also:
-
API_DETAIL_APPLICATION_PATH
Path for detailed Contract.- See Also:
-
API_APPOINTMENT_APPLICATION_PATH
Path save appointment to Contract.- See Also:
-
API_UPLOAD_FILES_APPLICATION_PATH
Path for upload files to Contract.- See Also:
-
APPLICATION_CHANGE_DOCUMENT_STATUS_PATH
Application detail path.- See Also:
-
COMPANY_LOGO_PATH
Company logo path.- See Also:
-
API_AUTHORITIES
Authority (role) required in order to be able to invoke greeting API.- See Also:
-
jwtService
@Autowired protected es.kukenan.smartfi.common.service.jwt.JwtService jwtServiceJWT service for create a bearer to call products. -
contractService
Contract service. -
requestContextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManagerRequest context manager.
-
-
Constructor Details
-
ContractRestController
public ContractRestController()
-
-
Method Details
-
getContractStates
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(path="/api/v1/contracts/states", produces="application/json") public org.springframework.http.ResponseEntity<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStateDto>> getContractStates(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @RequestParam(name="type",required=false) String type, @RequestParam(required=false) String parentSessionId) Get User applications.- Parameters:
authentication- user credentials.type- contract type.parentSessionId- parent session- Returns:
- contracts.
-
validNewContract
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(path="/api/v1/contracts/new-application", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Boolean>> validNewContract(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @RequestParam(name="type",required=false,defaultValue="advance") String type) Validation if user can create Contract.- Parameters:
authentication- user authentication.type- contract type.- Returns:
- the contract validation.
-
saveContract
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PostMapping(path="/api/v1/contracts/new-application", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> saveContract(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.NewApplicationRequestDto newApplicationRequestDto, @RequestHeader(name="X-SKYLINE-USER-IP",defaultValue="N/A") String userIp, @RequestHeader(name="X-USER-AGENT",defaultValue="N/A") String userAgent) Create Contract.- Parameters:
authentication- user authentication.newApplicationRequestDto- new application data.userIp- user real ipuserAgent- user-agent header- Returns:
- the created contract.
-
getContractsWithFilters
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PostMapping(path="/api/v1/contracts", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> getContractsWithFilters(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @RequestParam(name="pageNumber",required=false,defaultValue="0") Integer pageNumber, @RequestParam(name="pageSize",required=false,defaultValue="20") Integer pageSize, @RequestParam(name="sortedBy",required=false,defaultValue="product DESC") String sortedBy, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto, @RequestParam(required=false) String parentSessionId) Get User applications with filters.- Parameters:
authentication- user credentialspageNumber- number of page to get.pageSize- size of list to return.sortedBy- sort param.getApplicationsRequestDto- body for filtering.parentSessionId- parent session- Returns:
- contracts.
-
getContractDetail
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(path="/api/v1/contracts/{contractId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> getContractDetail(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractId") String contractId) Get Contracts detail.- Parameters:
authentication- user credentialscontractId- parent session- Returns:
- contracts.
-
createBearerToken
private String createBearerToken(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) -
countApplications
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(path="/api/v1/contracts", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>> countApplications(es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application count.- Parameters:
authentication- user credentials.- Returns:
- user list.
-
uploadFiles
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PostMapping(path="/api/v1/contracts/{contractId}/upload-files", consumes="multipart/form-data", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadFiles(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractId") String contractId, @RequestPart("file") List<org.springframework.web.multipart.MultipartFile> files) Upload files.- Parameters:
authentication- user credentials.contractId- application identifier.files- list of files received.- Returns:
- upload files response.
-
saveAppointment
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PostMapping(path="/api/v1/contracts/{contractId}/appointment", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> saveAppointment(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractId") String contractId, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.appointments.AppointmentAndBankRequest appointmentAndBankRequest) Save Appointment to Contract.- Parameters:
authentication- user authentication.contractId- contract identifier.appointmentAndBankRequest- appointment data.- Returns:
- the created contract.
-
downloadContractDocument
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(path="/api/v1/contracts/documents/{contractDocumentId}", produces="application/octet-stream") public void downloadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractDocumentId") String contractDocumentId, javax.servlet.http.HttpServletResponse response) throws IOException Download document.- Parameters:
authentication- user credentials.contractDocumentId- contract document id.response- response.- Throws:
IOException- file to write response.
-
uploadContractDocument
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PostMapping(path="/api/v1/contracts/documents/{contractDocumentId}", consumes="multipart/form-data") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractDocumentId") String contractDocumentId, @RequestPart("file") org.springframework.web.multipart.MultipartFile file) Save specific contract document file.- Parameters:
authentication- user credentials.contractDocumentId- contract document id.file- file received.- Returns:
- contract updated.
-
getCompanyLogo
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(path="/api/v1/contracts/company/logo/{companyId}") public String getCompanyLogo(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="companyId") Integer companyId, javax.servlet.http.HttpServletResponse response) throws IOException Get company logo.- Parameters:
authentication- user credentials.companyId- company identifier.response- response.- Returns:
- Base64 logo image.
- Throws:
IOException- file to write response.
-