package es.uv.saic.feign; import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigInteger; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.core.io.FileSystemResource; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; import es.uv.saic.domain.Document; import es.uv.saic.dto.ArchiveOrganDTO; import es.uv.saic.dto.CategoriaDTO; import es.uv.saic.dto.DocumentTmpDTO; import es.uv.saic.dto.PdfDTO; import fr.opensagres.xdocreport.core.XDocReportException; @FeignClient(name = "docs-service") public interface DocumentClient { @PostMapping("/document/save") public Document save(@RequestBody Document doc); @PostMapping("/findByCategoriaOrgan") public Document findByCategoriaOrgan(@RequestBody CategoriaDTO categoria); @GetMapping("/document/{idDocument}") public Document findByID(@PathVariable("idDocument") Integer idDocument); @PostMapping("/document/upload") public String upload(@RequestBody DocumentTmpDTO documentTmpDTO); @PostMapping("/document/archive") public Document archive(@RequestBody Document doc); @PostMapping("/archiveByOrgan") public void archiveByOrgan(@RequestBody ArchiveOrganDTO organ); @GetMapping("/download/{fileName}") @ResponseBody public ResponseEntity download(@PathVariable("fileName") BigInteger idInstanciaTasca) throws IOException; @GetMapping(value="/download/document/{id}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ResponseBody public ResponseEntity downloadDocument(@PathVariable("id") Integer idDocument) throws FileNotFoundException; @GetMapping(value="/download/report/{t}/{p}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ResponseBody public ResponseEntity downloadReport(@PathVariable("t") Integer idTitulacio, @PathVariable("p") String nomProces) throws IOException, XDocReportException; @GetMapping(value="/download/template/{id}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ResponseBody public ResponseEntity downloadTemplate(@PathVariable("id") BigInteger idTascai) throws IOException, XDocReportException; @GetMapping(value="/test/template/{titulacio}/{centre}/{idProces}/{idTascap}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ResponseBody public byte[] testTemplate(@PathVariable("titulacio") Integer idTitulacio, @PathVariable("centre") Integer idCentre, @PathVariable("idTascap") Integer idTascap, @PathVariable("idProces") Integer idProces) throws IOException, XDocReportException; @GetMapping(value="/test/template2/{titulacio}/{centre}/{evidencia}/{curs}/{tipusTasca}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ResponseBody public byte[] testTemplate(@PathVariable("titulacio") Integer idTitulacio, @PathVariable("centre") Integer idCentre, @PathVariable("evidencia") String evidencia, @PathVariable("curs") Integer curs, @PathVariable("tipusTasca") Integer tipusTasca) throws IOException, XDocReportException; @GetMapping(value="/pdf/download/{idTascai}") @ResponseBody public byte[] downloadTemplatePdf(@PathVariable("idTascai") BigInteger idTascai) throws IOException, InterruptedException; @PostMapping(value="/pdf/preview") @ResponseBody public byte[] downloadTemplatePdf(@RequestBody PdfDTO pdf) throws IOException, InterruptedException; }