Kaynağa Gözat

Find plantilla evidencia moved to docs

Mario Martínez Hernández 1 hafta önce
ebeveyn
işleme
02edaf509a

+ 16 - 1
src/main/java/es/uv/saic/service/PlantillaService.java

@@ -102,7 +102,22 @@ public class PlantillaService {
 	}
 	
 	
-	
+	public Plantilla findEvidencia(Integer codiEvidencia, Integer titulacio, String tambit) {
+		Plantilla p = this.findByID(codiEvidencia);
+		Plantilla p2 = null;
+		
+		if(titulacio > 0) {
+			if(!p.getAmbit().equals(tambit)) {
+				p2 = this.findByVersioCodiAmbit(p.getVersio(), p.getCodi(), tambit);
+			}
+		}			
+		
+		if(p2 != null) {
+			p = p2;
+		}
+
+		return p;
+	}
 	
 	
 	public String savePDF(String content, BigInteger idtascai) throws IOException, InterruptedException {

+ 6 - 0
src/main/java/es/uv/saic/web/PlantillaController.java

@@ -10,6 +10,7 @@ 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.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import es.uv.saic.service.PlantillaService;
@@ -46,6 +47,11 @@ public class PlantillaController {
         }
     }
 
+    @GetMapping("/evidencia")
+    public Plantilla findEvidencia(@RequestParam Integer codiEvidencia, @RequestParam Integer titulacio, @RequestParam String tambit) {
+        return ps.findEvidencia(codiEvidencia, titulacio, tambit);
+    }
+
     @PostMapping
     public String save(@RequestBody Plantilla plantilla) {
         try {