49 lines
1.9 KiB
Java
49 lines
1.9 KiB
Java
package com.iconplus.smartproc.controller;
|
|
|
|
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
|
import com.iconplus.smartproc.model.request.PrintDrpRequest;
|
|
import com.iconplus.smartproc.model.request.RolesRequest;
|
|
import com.iconplus.smartproc.model.response.GetListPrintDrpResponse;
|
|
import com.iconplus.smartproc.model.response.PrintDrpResponse;
|
|
import com.iconplus.smartproc.service.print.DrpPrintExecutionService;
|
|
import com.iconplus.smartproc.service.print.GetListPrintDrpService;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
|
@RestController
|
|
@RequestMapping("/api/drp/cetak")
|
|
public class PrintController {
|
|
|
|
private final GetListPrintDrpService getListPrintDrpService;
|
|
private final DrpPrintExecutionService drpPrintExecutionService;
|
|
|
|
public PrintController(GetListPrintDrpService getListPrintDrpService,
|
|
DrpPrintExecutionService drpPrintExecutionService) {
|
|
this.getListPrintDrpService = getListPrintDrpService;
|
|
this.drpPrintExecutionService = drpPrintExecutionService;
|
|
|
|
}
|
|
|
|
@GetMapping
|
|
public GetListPrintDrpResponse getListPrintDrpResponse(@RequestParam(name = "page", defaultValue = "1") Integer page,
|
|
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
|
|
|
Pageable pageable = PageRequest.of((page - 1), size);
|
|
PrintDrpRequest printDrpRequest = PrintDrpRequest.builder()
|
|
.pageable(pageable)
|
|
.build();
|
|
|
|
return getListPrintDrpService.execute(printDrpRequest);
|
|
|
|
}
|
|
|
|
@PostMapping("execution")
|
|
public EmptyResponse drpPrintExecution(@RequestBody PrintDrpRequest printDrpRequest) throws Exception {
|
|
return drpPrintExecutionService.execute(printDrpRequest);
|
|
}
|
|
|
|
|
|
}
|