|
|
@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
@@ -581,6 +582,44 @@ public class ProceduresController {
|
|
|
itt.setText(it.getText());
|
|
|
}
|
|
|
}
|
|
|
+ else if(it.getTasca().getTipus().getTipus() == 3) {
|
|
|
+ itt.setCodiEvidencia(it.getTasca().getCodiEvidencia());
|
|
|
+ itt.setNomEvidenciaCas(it.getTasca().getNomEvidenciaCas());
|
|
|
+ itt.setNomEvidenciaVal(it.getTasca().getNomEvidenciaVal());
|
|
|
+ itt.setEvidencia(it.getEvidencia());
|
|
|
+
|
|
|
+ if(it.getText() == null) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+
|
|
|
+ Map<String, Object> opciones;
|
|
|
+ try {
|
|
|
+ opciones = mapper.readValue(it.getTasca().getOpcions(),
|
|
|
+ new TypeReference<Map<String, Object>>() {});
|
|
|
+ if(opciones != null) {
|
|
|
+ List<?> copiarDesdeList = (List<?>) opciones.get("copiar_desde");
|
|
|
+
|
|
|
+ if (!copiarDesdeList.isEmpty()) {
|
|
|
+ Map<?, ?> datosCopiar = (Map<?, ?>) copiarDesdeList.get(0);
|
|
|
+
|
|
|
+ if (datosCopiar.get("proces") != null && datosCopiar.get("curso") != null) {
|
|
|
+ String proces = datosCopiar.get("proces").toString();
|
|
|
+ Integer curso = Integer.parseInt(datosCopiar.get("curso").toString());
|
|
|
+
|
|
|
+ PamMetadades pam = pms.findByNomProcesAndCursActivacio(proces, curso);
|
|
|
+
|
|
|
+ itt.setText(pam.getInstanciaTasca().getText());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (JsonMappingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ itt.setText(it.getText());
|
|
|
+ }
|
|
|
+ }
|
|
|
else {
|
|
|
itt.setCodiEvidencia(it.getTasca().getCodiEvidencia());
|
|
|
itt.setNomEvidenciaCas(it.getTasca().getNomEvidenciaCas());
|
|
|
@@ -818,18 +857,4 @@ public class ProceduresController {
|
|
|
model.put("redirect", false);
|
|
|
return model;
|
|
|
}
|
|
|
-
|
|
|
- @GetMapping("/procedure/pam/import")
|
|
|
- @ResponseBody
|
|
|
- public String getPamByNomProcesAndCurs(@RequestParam String proces, @RequestParam Integer curso){
|
|
|
-
|
|
|
- PamMetadades pam = pms.findByNomProcesAndCursActivacio(proces, curso);
|
|
|
-
|
|
|
- if (pam == null) return "[]";
|
|
|
-
|
|
|
- String jsonText = pam.getInstanciaTasca().getText();
|
|
|
-
|
|
|
- return (jsonText != null && !jsonText.isEmpty()) ? jsonText : "[]";
|
|
|
- }
|
|
|
-
|
|
|
}
|