<commit_before>package dad.practica.pesemu.servicio;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.LocalDate;
import java.time.LocalTime;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import dad.practica.pesemu.model.Factura;

@RestController
public class Controlador {

	@PostMapping(value = "/")
	@ResponseStatus(HttpStatus.CREATED)
	public String generaFicheroFactura(@RequestBody Factura factura) {
		// escritura de datos
		String nombreFactura = new String();
		try {
			String pathFacturas = System.getProperty("user.home") + "/facturas";
			new File(pathFacturas).mkdirs();
			nombreFactura = "factura" + LocalDate.now().toString() + "-" + LocalTime.now().toString() + ".txt";
			//nombreFactura = "facturaPrueba.txt";
			PrintWriter pw = new PrintWriter(new FileWriter(pathFacturas + "/" + nombreFactura));
			pw.print(factura);
			pw.flush();
			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}

		String url = "http://127.0.0.1:8080/facturas/";
		return url + nombreFactura;
	}

}<commit_msg>Corregido controlador con la nueva clase Factura.<commit_after>package dad.practica.pesemu.servicio;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.LocalDate;
import java.time.LocalTime;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import dad.practica.pesemu.model.Factura;

@RestController
public class Controlador {

	@PostMapping(value = "/")
	@ResponseStatus(HttpStatus.CREATED)
	public void generaFicheroFactura(@RequestBody Factura factura) {
		String nombreFactura = new String();
		try {
			String pathFacturas = System.getProperty("user.home") + "/facturas";
			new File(pathFacturas).mkdirs();
			nombreFactura = "factura" + LocalDate.now().toString() + "-" + LocalTime.now().toString() + ".txt";
			PrintWriter pw = new PrintWriter(new FileWriter(pathFacturas + "/" + nombreFactura));
			pw.print(factura);
			pw.flush();
			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
{'fraction_non_alphanumeric': 0.13199536858355848, 'fraction_numerical': 0.0038595137012736396, 'mean_word_length': 5.05607476635514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6272920', 'n_tokens_mistral': 868, 'n_tokens_neox': 807, 'n_words': 151}