|
|
@@ -1,9 +1,11 @@
|
|
|
package es.uv.saic.web;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigInteger;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.time.Year;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -132,8 +134,18 @@ public class ProceduresController {
|
|
|
public String updateInstanciaTascaEvidencia(Model model, Authentication auth, HttpSession session, @PathVariable BigInteger id, @RequestParam Map<String,String> params,
|
|
|
@RequestParam(required = true) List<MultipartFile> evidencias) throws IllegalStateException, IOException {
|
|
|
|
|
|
+ List<File> files;
|
|
|
+
|
|
|
+ // Convert MultipartFiles (evidencias) to Files before sending to the ProceduresClient
|
|
|
+ files = new ArrayList<>();
|
|
|
+ for (MultipartFile multipartFile : evidencias) {
|
|
|
+ File convFile = new File(filePath + multipartFile.getOriginalFilename());
|
|
|
+ multipartFile.transferTo(convFile);
|
|
|
+ files.add(convFile);
|
|
|
+ }
|
|
|
+
|
|
|
HashMap<String, Object> response =
|
|
|
- pc.updateInstanciaTascaEvidencia(id, params, evidencias, ((Usuari) auth.getPrincipal()).getUsuari());
|
|
|
+ pc.updateInstanciaTascaEvidencia(id, params, files, ((Usuari) auth.getPrincipal()).getUsuari());
|
|
|
|
|
|
if (response != null && response.get("ammount") != null) {
|
|
|
model.addAllAttributes(response);
|
|
|
@@ -157,7 +169,6 @@ public class ProceduresController {
|
|
|
@PostMapping("/procedure/{id}")
|
|
|
public String updateInstanciaTasca(Model model, Authentication auth, HttpSession session, @PathVariable BigInteger id, @RequestParam Map<String,String> params,
|
|
|
@RequestParam(required = false) List<MultipartFile> evidencias) throws IllegalStateException, IOException, InterruptedException {
|
|
|
-
|
|
|
HashMap<String, Object> response =
|
|
|
pc.updateInstanciaTasca(id, params, evidencias, ((Usuari) auth.getPrincipal()).getUsuari());
|
|
|
|
|
|
@@ -196,7 +207,7 @@ public class ProceduresController {
|
|
|
model.addAttribute("location", "procedures");
|
|
|
}
|
|
|
|
|
|
- return model.getAttribute("date").toString() == null ? "No se pudo obtener la fecha" : model.getAttribute("date").toString();
|
|
|
+ return response.get("date") == null ? "No se pudo obtener la fecha" : response.get("date").toString();
|
|
|
}
|
|
|
|
|
|
/*
|