|
|
@@ -41,9 +41,9 @@ import es.uv.saic.domain.Plantilla;
|
|
|
import es.uv.saic.domain.PlantillaComentario;
|
|
|
import es.uv.saic.domain.PlantillaConversation;
|
|
|
import es.uv.saic.domain.PlantillaRepository;
|
|
|
-import es.uv.saic.domain.Proces;
|
|
|
import es.uv.saic.dto.IndicadorEnquestaDTO;
|
|
|
import es.uv.saic.dto.IndicadorEnquestaValorDTO;
|
|
|
+import es.uv.saic.dto.InstanciaTascaDTO;
|
|
|
import es.uv.saic.dto.NomProcesOrganDTO;
|
|
|
import es.uv.saic.feign.CoreClient;
|
|
|
|
|
|
@@ -96,13 +96,13 @@ public class PlantillaService {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- public String addTemplateData(InstanciaTasca it, String template){
|
|
|
+ public String addTemplateData(InstanciaTascaDTO it, String template){
|
|
|
HashMap<String, String> context = new HashMap<String, String>();
|
|
|
HashMap<String, String> header = new HashMap<String, String>();
|
|
|
HashMap<String, String> img = new HashMap<String, String>();
|
|
|
|
|
|
Integer idTitulacio = it.getInstancia().getTitulacio();
|
|
|
- Proces proces = it.getInstancia().getProces();
|
|
|
+ Integer cursAvaluat = it.getInstancia().getCursAvaluat();
|
|
|
Integer idCentre = it.getInstancia().getCentre();
|
|
|
String ambit = "G";
|
|
|
String opcionsStr = it.getTasca().getOpcions().replaceAll("^\\.$", "");
|
|
|
@@ -110,24 +110,24 @@ public class PlantillaService {
|
|
|
if(!opcionsStr.isEmpty()) {
|
|
|
opcions = opcionsStr.split(";");
|
|
|
}
|
|
|
- if(it.getInstancia().getOrgan().getId().getTlugar().equals("C")) {
|
|
|
+ if(it.getInstancia().getTlugar().equals("C")) {
|
|
|
if(it.getInstancia().getTitulacio() == 2) {
|
|
|
ambit = "M";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/** Add header information **/
|
|
|
- addHeaderData(it.getInstancia().getOrgan().getOrgan(), it.getInstancia().getOrgan(), it.getInstancia().getProces().getCursAvaluat(), header, img);
|
|
|
+ addHeaderData(it.getInstancia().getNomval(), it.getInstancia().getLugar(), it.getInstancia().getNomValTitulacio(), it.getInstancia().getCursAvaluat(), header, img);
|
|
|
|
|
|
/** Iterate elements inside {[loop]} ... {[endloop]} **/
|
|
|
- template = this.iterateLoopTag(template, idCentre, ambit, proces.getCursAvaluat(), context);
|
|
|
+ template = this.iterateLoopTag(template, idCentre, ambit, cursAvaluat, context);
|
|
|
|
|
|
/** Iterate elements with data-loop attribute **/
|
|
|
Document doc = Jsoup.parse(template);
|
|
|
- doc = iterateLoopAttr(idCentre, proces.getCursAvaluat(), doc, context);
|
|
|
+ doc = iterateLoopAttr(idCentre, cursAvaluat, doc, context);
|
|
|
|
|
|
/** Add template data (non iterated data)**/
|
|
|
- getTemplateData(idTitulacio, idCentre, proces.getCursAvaluat(), context);
|
|
|
+ getTemplateData(idTitulacio, idCentre, cursAvaluat, context);
|
|
|
this.replaceValues(doc, context, header, img);
|
|
|
|
|
|
/** Replace sections if specified in options **/
|
|
|
@@ -146,7 +146,7 @@ public class PlantillaService {
|
|
|
Organ titulacio = core.findOrganById("T", idTitulacio);
|
|
|
|
|
|
/** Add header information **/
|
|
|
- addHeaderData(centre, titulacio, curs, header, img);
|
|
|
+ addHeaderData(centre.getNomVal(), centre.getId().getLugar(), titulacio.getNomVal(), curs, header, img);
|
|
|
|
|
|
/** Iterate elements inside {[loop]} ... {[endloop]} **/
|
|
|
template = this.iterateLoopTag(template, idCentre, titulacio.getTambit(), curs, context);
|
|
|
@@ -162,9 +162,9 @@ public class PlantillaService {
|
|
|
return doc.html();
|
|
|
}
|
|
|
|
|
|
- private void addHeaderData(Organ centre, Organ titulacio, Integer curs, HashMap<String, String> header, HashMap<String, String> img) {
|
|
|
- header.put("centre", centre.getNomVal());
|
|
|
- header.put("titulacio", titulacio.getNomVal());
|
|
|
+ private void addHeaderData(String nomVal, Integer lugar, String nomValTitulacion, Integer curs, HashMap<String, String> header, HashMap<String, String> img) {
|
|
|
+ header.put("centre", nomVal);
|
|
|
+ header.put("titulacio", nomValTitulacion);
|
|
|
header.put("curs", "CURSO "+Integer.toString(curs-1)+" - "+Integer.toString(curs));
|
|
|
header.put("curs_anterior", Integer.toString(curs-2)+" - "+Integer.toString(curs-1));
|
|
|
header.put("conv-ant1", "CONVOCATORIA "+Integer.toString(curs-1)+" - "+Integer.toString(curs));
|
|
|
@@ -172,7 +172,7 @@ public class PlantillaService {
|
|
|
header.put("periode-ant1", Integer.toString(curs-6)+" - "+Integer.toString(curs-1));
|
|
|
header.put("periode-ant2", Integer.toString(curs-7)+" - "+Integer.toString(curs-2));
|
|
|
ClassPathResource fuv = new ClassPathResource("/static/logos/UV.png");
|
|
|
- ClassPathResource fc = new ClassPathResource("/static/logos/C"+Integer.toString(centre.getId().getLugar())+".png");
|
|
|
+ ClassPathResource fc = new ClassPathResource("/static/logos/C"+Integer.toString(lugar)+".png");
|
|
|
String logouv_b64;
|
|
|
String logoc_b64;
|
|
|
try {
|
|
|
@@ -183,7 +183,7 @@ public class PlantillaService {
|
|
|
try {
|
|
|
logoc_b64 = "data:image/png;base64, "+Base64.getEncoder().encodeToString(fc.getInputStream().readAllBytes());
|
|
|
} catch (IOException e) {
|
|
|
- logoc_b64 = "https://saic.uv.es/public/logos/C"+Integer.toString(centre.getId().getLugar())+".png";
|
|
|
+ logoc_b64 = "https://saic.uv.es/public/logos/C"+Integer.toString(lugar)+".png";
|
|
|
}
|
|
|
img.put("logo_centre", logoc_b64);
|
|
|
img.put("logo_uv", logouv_b64);
|
|
|
@@ -563,11 +563,11 @@ public class PlantillaService {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
- public Document replaceSection(String[] opcions, InstanciaTasca it, Document doc) {
|
|
|
+ public Document replaceSection(String[] opcions, InstanciaTascaDTO it, Document doc) {
|
|
|
if(opcions.length > 0) {
|
|
|
NomProcesOrganDTO nomProcesOrganDTO = new NomProcesOrganDTO(opcions[0],
|
|
|
- it.getInstancia().getOrgan().getId().getTlugar(),
|
|
|
- it.getInstancia().getOrgan().getId().getLugar(),
|
|
|
+ it.getInstancia().getTlugar(),
|
|
|
+ it.getInstancia().getLugar(),
|
|
|
it.getInstancia().getCentre(),
|
|
|
it.getInstancia().getTitulacio());
|
|
|
InstanciaTasca itOld = core.getReportFromNomProcesOrgan(nomProcesOrganDTO);
|