|
|
@@ -246,7 +246,7 @@ public class DownloadController {
|
|
|
titulacions = oc.getTitulacionsByTypeCentre(it.getInstancia().getLugar(), ambit);
|
|
|
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
|
|
|
for(OrganDTO x : titulacions) {
|
|
|
- HashMap<String, String> t = ic.getTemplateDataArray(x.getLugar2(), idCentre, it.getInstancia().getCursAvaluat());
|
|
|
+ HashMap<String, String> t = ic.getTemplateDataArray(x.getRuct(), idCentre, it.getInstancia().getCursAvaluat(), x.getTambit());
|
|
|
t.put("titulacio", x.getNomCas());
|
|
|
data.add(t);
|
|
|
}
|
|
|
@@ -275,9 +275,9 @@ public class DownloadController {
|
|
|
* @param response HttpServletResponse
|
|
|
* @return A byte array representing the populated template
|
|
|
*/
|
|
|
- @GetMapping(value="/download/test/template/{titulacio}/{centre}/{idProces}/{idTascap}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
+ @GetMapping(value="/download/test/template/{ruct}/{centre}/{idProces}/{idTascap}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
@ResponseBody
|
|
|
- public ResponseEntity<byte[]> testTemplate(@PathVariable("titulacio") Integer idTitulacio, @PathVariable("centre") Integer idCentre,
|
|
|
+ public ResponseEntity<byte[]> testTemplate(@PathVariable("ruct") String ruct, @PathVariable("centre") Integer idCentre,
|
|
|
@PathVariable("idTascap") Integer idTascap, @PathVariable("idProces") Integer idProces, HttpServletResponse response)
|
|
|
throws IOException, XDocReportException {
|
|
|
XDocReportRegistry.getRegistry().clear();
|
|
|
@@ -285,19 +285,18 @@ public class DownloadController {
|
|
|
|
|
|
TascaDTO tasca = tc.getByProcesTascap(idProces, idTascap);
|
|
|
ProcesDTO proces = pc.findById(idProces);
|
|
|
- OrganDTO titulacio = oc.findByID("T", idTitulacio);
|
|
|
+ OrganDTO titulacio = oc.findByRuct(Integer.parseInt(ruct));
|
|
|
OrganDTO centre = oc.findByID("C", idCentre);
|
|
|
- Integer ambit = idTitulacio/(int)1000;
|
|
|
|
|
|
/* Check if specific template exists */
|
|
|
String templatePath = this.templatePath+tasca.getCodiEvidencia().replace(".", "_")+".docx";
|
|
|
- if(titulacio.getTambit().equals("G") | idTitulacio == 1) {
|
|
|
+ if(titulacio.getTambit().equals("G")) {
|
|
|
File f = new File(this.templatePath+"/T1/"+tasca.getCodiEvidencia().replace(".", "_")+".docx");
|
|
|
if(f.exists() && !f.isDirectory()) {
|
|
|
templatePath = this.templatePath+"/T1/"+tasca.getCodiEvidencia().replace(".", "_")+".docx";
|
|
|
}
|
|
|
}
|
|
|
- else if(titulacio.getTambit().equals("M") | idTitulacio == 2) {
|
|
|
+ else if(titulacio.getTambit().equals("M")) {
|
|
|
File f = new File(this.templatePath+"/T2/"+tasca.getCodiEvidencia().replace(".", "_")+".docx");
|
|
|
if(f.exists() && !f.isDirectory()) {
|
|
|
templatePath = this.templatePath+"/T2/"+tasca.getCodiEvidencia().replace(".", "_")+".docx";
|
|
|
@@ -325,18 +324,18 @@ public class DownloadController {
|
|
|
|
|
|
if(tasca.getIdTipus() == 14) { // Iterable template task
|
|
|
List<OrganDTO> titulacions = new ArrayList<OrganDTO>();
|
|
|
- titulacions = oc.getTitulacionsByTypeCentre(centre.getLugar2(), ambit);
|
|
|
+ titulacions = oc.getTitulacionsByTypeCentre(centre.getRuct(), centre.getLugar());
|
|
|
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
|
|
|
for(OrganDTO x : titulacions) {
|
|
|
- HashMap<String, String> t = ic.getTemplateDataArray(x.getLugar2(), idCentre, proces.getCursAvaluat());
|
|
|
+ HashMap<String, String> t = ic.getTemplateDataArray(Integer.parseInt(ruct), idCentre, proces.getCursAvaluat(), x.getTambit());
|
|
|
t.put("titulacio", x.getNomCas());
|
|
|
data.add(t);
|
|
|
}
|
|
|
context.put("data", data);
|
|
|
- addToContext(ic.getTemplateData(idTitulacio, idCentre, proces.getCursAvaluat()), context);
|
|
|
+ addToContext(ic.getTemplateData(titulacio.getRuct(), idCentre, proces.getCursAvaluat()), context);
|
|
|
}
|
|
|
else { // NO iterable template task
|
|
|
- addToContext(ic.getTemplateData(idTitulacio, idCentre, proces.getCursAvaluat()), context);
|
|
|
+ addToContext(ic.getTemplateData(titulacio.getRuct(), idCentre, proces.getCursAvaluat()), context);
|
|
|
}
|
|
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
@@ -357,33 +356,30 @@ public class DownloadController {
|
|
|
* @param response HttpServletResponse
|
|
|
* @return A byte array representing the populated template
|
|
|
*/
|
|
|
- @GetMapping(value="/download/test/template2/{titulacio}/{centre}/{evidencia}/{curs}/{tipusTasca}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
+ @GetMapping(value="/download/test/template2/{ruct}/{centre}/{evidencia}/{curs}/{tipusTasca}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
@ResponseBody
|
|
|
- public ResponseEntity<byte[]> testTemplate(Model model, @PathVariable("titulacio") Integer idTitulacio, @PathVariable("centre") Integer idCentre,
|
|
|
+ public ResponseEntity<byte[]> testTemplate(Model model, @PathVariable("ruct") Integer ruct, @PathVariable("centre") Integer idCentre,
|
|
|
@PathVariable("evidencia") String evidencia, @PathVariable("curs") Integer curs, @PathVariable("tipusTasca") Integer tipusTasca,
|
|
|
HttpServletResponse response) throws IOException, XDocReportException {
|
|
|
XDocReportRegistry.getRegistry().clear();
|
|
|
String reportId = "none";
|
|
|
|
|
|
- OrganDTO titulacio = oc.findByID("T", idTitulacio);
|
|
|
+ OrganDTO titulacio = oc.findByRuct(ruct);
|
|
|
OrganDTO centre = oc.findByID("C", idCentre);
|
|
|
- Integer ambit = idTitulacio/(int)1000;
|
|
|
|
|
|
/* Check if specific template exists */
|
|
|
String templatePath = this.templatePath+evidencia.replace(".", "_").replace(" (G)", "").replace(" (M)", "")+".docx";
|
|
|
- if(idTitulacio < 2000 | idTitulacio == 1) {
|
|
|
+ if(titulacio.getLugar() < 2000 | titulacio.getLugar() == 1) {
|
|
|
File f = new File(this.templatePath+"/T1/"+evidencia.replace(".", "_").replace(" (G)", "").replace(" (M)", "")+".docx");
|
|
|
if(f.exists() && !f.isDirectory()) {
|
|
|
templatePath = this.templatePath+"/T1/"+evidencia.replace(".", "_").replace(" (G)", "").replace(" (M)", "")+".docx";
|
|
|
- }
|
|
|
- ambit = 1;
|
|
|
+ };
|
|
|
}
|
|
|
- else if((idTitulacio >= 2000 & idTitulacio < 3000) | idTitulacio == 2) {
|
|
|
+ else if((titulacio.getLugar() >= 2000 & titulacio.getLugar() < 3000) | titulacio.getLugar() == 2) {
|
|
|
File f = new File(this.templatePath+"/T2/"+evidencia.replace(".", "_").replace(" (G)", "").replace(" (M)", "")+".docx");
|
|
|
if(f.exists() && !f.isDirectory()) {
|
|
|
templatePath = this.templatePath+"/T2/"+evidencia.replace(".", "_").replace(" (G)", "").replace(" (M)", "")+".docx";
|
|
|
}
|
|
|
- ambit = 2;
|
|
|
}
|
|
|
|
|
|
InputStream in = new FileInputStream(new File(templatePath));
|
|
|
@@ -407,18 +403,18 @@ public class DownloadController {
|
|
|
|
|
|
if(tipusTasca == 14) { // Iterable template task
|
|
|
List<OrganDTO> titulacions = new ArrayList<OrganDTO>();
|
|
|
- titulacions = oc.getTitulacionsByTypeCentre(centre.getLugar2(), ambit);
|
|
|
+ titulacions = oc.getTitulacionsByTypeCentre(centre.getRuct(), centre.getLugar());
|
|
|
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
|
|
|
for(OrganDTO x : titulacions) {
|
|
|
- HashMap<String, String> t = ic.getTemplateDataArray(x.getLugar2(), idCentre, curs);
|
|
|
+ HashMap<String, String> t = ic.getTemplateDataArray(x.getRuct(), idCentre, curs, x.getTambit());
|
|
|
t.put("titulacio", x.getNomCas());
|
|
|
data.add(t);
|
|
|
}
|
|
|
context.put("data", data);
|
|
|
- addToContext(ic.getTemplateData(idTitulacio, idCentre, curs), context);
|
|
|
+ addToContext(ic.getTemplateData(ruct, idCentre, curs), context);
|
|
|
}
|
|
|
else { // NO iterable template task
|
|
|
- addToContext(ic.getTemplateData(idTitulacio, idCentre, curs), context);
|
|
|
+ addToContext(ic.getTemplateData(ruct, idCentre, curs), context);
|
|
|
}
|
|
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|