From fe2dd8b793534b563921ef68d49a04e0316d9061 Mon Sep 17 00:00:00 2001 From: Perea Date: Fri, 12 Dec 2025 12:57:18 +0100 Subject: [PATCH 1/3] union proyectos perea --- Asegasa.sln | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Asegasa.sln b/Asegasa.sln index 626e5c4..6d42cc7 100644 --- a/Asegasa.sln +++ b/Asegasa.sln @@ -7,10 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasa", "WSAsegasa\WSAs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsVeriFactu", "..\..\Comunes\tsVeriFactu\tsVeriFactu.csproj", "{DDFE8F31-9ED8-5C11-4E72-6CE96526C459}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdfactu", "..\Tecnosis\tsFactu\bdFactu\bdfactu.csproj", "{56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsVeriFactu", "..\Tecnosis\tsVeriFactu\tsVeriFactu.csproj", "{947E1B2F-7877-66E7-8DF0-282429B770F0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,14 +25,14 @@ Global {E42D668E-CB26-498B-89AF-8A205528C4EF}.Debug|Any CPU.Build.0 = Debug|Any CPU {E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.Build.0 = Release|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.Build.0 = Release|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Debug|Any CPU.Build.0 = Debug|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Release|Any CPU.ActiveCfg = Release|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Release|Any CPU.Build.0 = Release|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 2fbbc68dbd09609f55a7032f5c64e4e78b944200 Mon Sep 17 00:00:00 2001 From: Perea Date: Fri, 12 Dec 2025 13:09:16 +0100 Subject: [PATCH 2/3] agregado api ficheros --- APIFicheros/APIFicheros.csproj | 13 ++++++ APIFicheros/APIFicheros.http | 6 +++ .../Controllers/WeatherForecastController.cs | 32 +++++++++++++++ APIFicheros/Program.cs | 25 +++++++++++ APIFicheros/Properties/launchSettings.json | 41 +++++++++++++++++++ APIFicheros/WeatherForecast.cs | 12 ++++++ APIFicheros/appsettings.Development.json | 8 ++++ APIFicheros/appsettings.json | 9 ++++ Asegasa.sln | 6 +++ 9 files changed, 152 insertions(+) create mode 100644 APIFicheros/APIFicheros.csproj create mode 100644 APIFicheros/APIFicheros.http create mode 100644 APIFicheros/Controllers/WeatherForecastController.cs create mode 100644 APIFicheros/Program.cs create mode 100644 APIFicheros/Properties/launchSettings.json create mode 100644 APIFicheros/WeatherForecast.cs create mode 100644 APIFicheros/appsettings.Development.json create mode 100644 APIFicheros/appsettings.json diff --git a/APIFicheros/APIFicheros.csproj b/APIFicheros/APIFicheros.csproj new file mode 100644 index 0000000..5419ef0 --- /dev/null +++ b/APIFicheros/APIFicheros.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/APIFicheros/APIFicheros.http b/APIFicheros/APIFicheros.http new file mode 100644 index 0000000..ee91da2 --- /dev/null +++ b/APIFicheros/APIFicheros.http @@ -0,0 +1,6 @@ +@APIFicheros_HostAddress = http://localhost:5219 + +GET {{APIFicheros_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/APIFicheros/Controllers/WeatherForecastController.cs b/APIFicheros/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..9216ce9 --- /dev/null +++ b/APIFicheros/Controllers/WeatherForecastController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; + +namespace APIFicheros.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } +} diff --git a/APIFicheros/Program.cs b/APIFicheros/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/APIFicheros/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/APIFicheros/Properties/launchSettings.json b/APIFicheros/Properties/launchSettings.json new file mode 100644 index 0000000..8f79618 --- /dev/null +++ b/APIFicheros/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:3277", + "sslPort": 44319 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5219", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7224;http://localhost:5219", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/APIFicheros/WeatherForecast.cs b/APIFicheros/WeatherForecast.cs new file mode 100644 index 0000000..4d1de37 --- /dev/null +++ b/APIFicheros/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace APIFicheros; + +public class WeatherForecast +{ + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } +} diff --git a/APIFicheros/appsettings.Development.json b/APIFicheros/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/APIFicheros/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/APIFicheros/appsettings.json b/APIFicheros/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/APIFicheros/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Asegasa.sln b/Asegasa.sln index 6d42cc7..a90479f 100644 --- a/Asegasa.sln +++ b/Asegasa.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdfactu", "..\Tecnosis\tsFa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsVeriFactu", "..\Tecnosis\tsVeriFactu\tsVeriFactu.csproj", "{947E1B2F-7877-66E7-8DF0-282429B770F0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIFicheros", "APIFicheros\APIFicheros.csproj", "{729F814F-BBAF-A079-B0A1-D5890DA11543}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {947E1B2F-7877-66E7-8DF0-282429B770F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {947E1B2F-7877-66E7-8DF0-282429B770F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {947E1B2F-7877-66E7-8DF0-282429B770F0}.Release|Any CPU.Build.0 = Release|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.Build.0 = Debug|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.ActiveCfg = Release|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From b9c825b4bcd71cac7cd4a6ac73c973c28afb268a Mon Sep 17 00:00:00 2001 From: Perea Date: Mon, 15 Dec 2025 10:19:53 +0100 Subject: [PATCH 3/3] Creada api y primer verbo buscar ficheros faltantes --- APIFicheros/APIFicheros.csproj | 4 ++ .../Controllers/ObtenerFicherosController.cs | 67 +++++++++++++++++++ APIFicheros/DTOs/PolizasFaltantes.cs | 9 +++ APIFicheros/Program.cs | 9 ++- APIFicheros/appsettings.json | 6 ++ WSAsegasa/WSAsegasa.csproj | 1 + 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 APIFicheros/Controllers/ObtenerFicherosController.cs create mode 100644 APIFicheros/DTOs/PolizasFaltantes.cs diff --git a/APIFicheros/APIFicheros.csproj b/APIFicheros/APIFicheros.csproj index 5419ef0..505c4bc 100644 --- a/APIFicheros/APIFicheros.csproj +++ b/APIFicheros/APIFicheros.csproj @@ -10,4 +10,8 @@ + + + + diff --git a/APIFicheros/Controllers/ObtenerFicherosController.cs b/APIFicheros/Controllers/ObtenerFicherosController.cs new file mode 100644 index 0000000..a483c83 --- /dev/null +++ b/APIFicheros/Controllers/ObtenerFicherosController.cs @@ -0,0 +1,67 @@ +using APIFicheros.DTOs; +using bdAsegasa; +using bdAsegasa.db; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; +using static Org.BouncyCastle.Math.EC.ECCurve; + +namespace APIFicheros.Controllers +{ + [ApiController] + [Route("[controller]")] + public class ObtenerFicherosController : Controller + { + private readonly IConfiguration _configuration; + private bdAsegasa.tscgestionasegasa bd; + public ObtenerFicherosController(IConfiguration configuration) + { + + _configuration = configuration; + + var nombreConexion = _configuration["Configuracion:NombreConexionBD"]; + + bd = tscgestionasegasa.NuevoContexto(nombreConexion, true, false, true, "ObtenerFicheros"); + + } + + + [HttpPost("ObtenerFicherosFaltantes")] + public ActionResult PostNombreBD([FromBody] string numeroPoliza) + { + + try + { + + int idPoliza = bd.polizassg.First(x => x.NumeroPoliza!.Contains(numeroPoliza)).idPoliza; + + + List listadoDocumentos = new List(); + List listadoFicherosFaltantes = new List(); + + listadoDocumentos = bd.documentospolizassg.Where(x => x.idPoliza == idPoliza && x.idFichero == null).ToList(); + + + foreach (documentospolizassg documentoFaltante in listadoDocumentos) + { + listadoFicherosFaltantes.Add(new PolizasFaltantes + { + idDocumento = documentoFaltante.idDocumento, + descripcion = documentoFaltante.idDocumentoASolicitarNavigation!.idTipoNavigation!.Descripcion + }); + } + + return Ok(listadoFicherosFaltantes); + + } + catch (Exception ex) { + + return BadRequest("Ha ocurrido un error. Mensaje de error: " + ex.Message); + } + + + + + } + } +} diff --git a/APIFicheros/DTOs/PolizasFaltantes.cs b/APIFicheros/DTOs/PolizasFaltantes.cs new file mode 100644 index 0000000..f25e796 --- /dev/null +++ b/APIFicheros/DTOs/PolizasFaltantes.cs @@ -0,0 +1,9 @@ +namespace APIFicheros.DTOs +{ + public class PolizasFaltantes + { + public int idDocumento { get; set; } + public string descripcion { get; set; } + } +} + \ No newline at end of file diff --git a/APIFicheros/Program.cs b/APIFicheros/Program.cs index 48863a6..7bded67 100644 --- a/APIFicheros/Program.cs +++ b/APIFicheros/Program.cs @@ -2,11 +2,18 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. -builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); + +builder.Services.AddControllers() + .AddJsonOptions(options => + { + options.JsonSerializerOptions.ReferenceHandler = + System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles; + }); + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/APIFicheros/appsettings.json b/APIFicheros/appsettings.json index 10f68b8..48353fb 100644 --- a/APIFicheros/appsettings.json +++ b/APIFicheros/appsettings.json @@ -5,5 +5,11 @@ "Microsoft.AspNetCore": "Warning" } }, + + "Configuracion": { + "SegundosMinimosEntreProcesos": "60", + "HoraProcesosDiarios": "06:30", + "NombreConexionBD": "Producción Remoto" + }, "AllowedHosts": "*" } diff --git a/WSAsegasa/WSAsegasa.csproj b/WSAsegasa/WSAsegasa.csproj index d9a6da2..74b0d6e 100644 --- a/WSAsegasa/WSAsegasa.csproj +++ b/WSAsegasa/WSAsegasa.csproj @@ -23,6 +23,7 @@ +