|
@@ -469,6 +469,30 @@ public class DownloadController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @GetMapping(value="/download/{idInstancia}/{idTascap}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResponseEntity<byte[]> downloadEvidenceByTascaP(@PathVariable("idInstancia") BigInteger idInstancia, @PathVariable("idTascap") Integer idTascap, HttpServletResponse response){
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ InstanciaTascaDTO i = tc.findInstanciaTascaByInstanciaAndTascaP(idInstancia, idTascap);
|
|
|
|
|
+
|
|
|
|
|
+ FileSystemResource file = null;
|
|
|
|
|
+
|
|
|
|
|
+ file = new FileSystemResource(this.filePath+i.getEvidencia());
|
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename="+i.getEvidencia());
|
|
|
|
|
+
|
|
|
|
|
+ if (!file.exists()) {
|
|
|
|
|
+ return ResponseEntity.ok(new FileSystemResource(this.fileNotFound).getInputStream().readAllBytes());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return ResponseEntity.ok(file.getInputStream().readAllBytes());
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Format a value for template insertion
|
|
* Format a value for template insertion
|
|
|
* @param v The value to format
|
|
* @param v The value to format
|