cambios variables de ambiente
This commit is contained in:
parent
222d5fdc08
commit
0d67a44d36
20 changed files with 261 additions and 297 deletions
|
@ -3,8 +3,8 @@ using DAL;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Shared.DTO;
|
||||
using Shared.DTO.Integracion_DGA;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
using Shared.Helper;
|
||||
using Shared.Utils.Variables_Entorno;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -23,15 +23,13 @@ namespace BLL.Integracion_DGA
|
|||
private readonly JobsDgaVilosRepository _jobsVilos;
|
||||
private readonly JobsDgaSupFlujRepository _jobsSupFluj;
|
||||
private readonly FileLoggerHelper _fileLoggerHelper;
|
||||
private readonly NexusApiUrl _nexusApi;
|
||||
|
||||
public BusinessLogic(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs, JobsDgaVilosRepository jobsVilos, JobsDgaSupFlujRepository jobsSupFluj,NexusApiUrl nexusApiUrl) {
|
||||
public BusinessLogic(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs, JobsDgaVilosRepository jobsVilos, JobsDgaSupFlujRepository jobsSupFluj) {
|
||||
_configuration = configuration;
|
||||
_apiService = apiService;
|
||||
_jobs = jobs;
|
||||
_jobsVilos = jobsVilos;
|
||||
_jobsSupFluj = jobsSupFluj;
|
||||
_nexusApi = nexusApiUrl;
|
||||
FileLoggerHelper.ConfigureLogger(_configuration);
|
||||
}
|
||||
|
||||
|
@ -47,11 +45,11 @@ namespace BLL.Integracion_DGA
|
|||
WriteLineAndLog($"Inicia Proceso DGA");
|
||||
try
|
||||
{
|
||||
string apiUrlBase = _nexusApi.ApiUrl;
|
||||
string apiUrlBase = NexusApiUrl.ApiUrl;
|
||||
Dictionary<string, string> headers = new Dictionary<string, string>
|
||||
{
|
||||
{ "nexustoken", _nexusApi.ApiKey },
|
||||
{ "nexusapiversion", _nexusApi.Version },
|
||||
{ "nexustoken", NexusApiUrl.ApiKey },
|
||||
{ "nexusapiversion", NexusApiUrl.Version },
|
||||
{ "accept", "application/json" }
|
||||
};
|
||||
|
||||
|
@ -76,8 +74,8 @@ namespace BLL.Integracion_DGA
|
|||
}
|
||||
|
||||
HistoricRequest historicRequest = new HistoricRequest();
|
||||
historicRequest.DataSource = _nexusApi.DataSource;
|
||||
historicRequest.Resolution = _nexusApi.Resolution;
|
||||
historicRequest.DataSource = NexusApiUrl.DataSource;
|
||||
historicRequest.Resolution = NexusApiUrl.Resolution;
|
||||
historicRequest.Uids = listTagsID;
|
||||
historicRequest.StartTs = dateStart.ToUnixTimeSeconds();
|
||||
historicRequest.EndTs = dateEnd.ToUnixTimeSeconds();
|
||||
|
|
|
@ -17,39 +17,48 @@ namespace BLL.Recuperacion_DGA
|
|||
_registrarMedicion = registrarMedicion;
|
||||
}
|
||||
|
||||
public async Task<List<MedicionScada>> ObtenerMedicionesAsync()
|
||||
public async Task<bool>RegistrarMedicionesAsync()
|
||||
{
|
||||
var mediciones = await _dGAMedicionScadaRepository.ObtenerMedicionesAsync();
|
||||
|
||||
foreach (var medicion in mediciones)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(medicion.Code))
|
||||
try
|
||||
{
|
||||
var body = new MedicionSubterraneaRequest
|
||||
if (!string.IsNullOrEmpty(medicion.Code))
|
||||
{
|
||||
Autenticacion = new Autenticacion
|
||||
var body = new MedicionSubterraneaRequest
|
||||
{
|
||||
Password = string.Empty,
|
||||
RutEmpresa = string.Empty,
|
||||
RutUsuario = string.Empty
|
||||
},
|
||||
MedicionSubterranea = new Medicion
|
||||
{
|
||||
Caudal = medicion.Caudal.ToString() ?? "",
|
||||
FechaMedicion = medicion.DateOrigen?.ToString("yyyy-MM-dd") ?? "",
|
||||
HoraMedicion = medicion.DateOrigen?.ToString("HH:mm:ss") ?? "",
|
||||
NivelFreaticoDelPozo = "",
|
||||
Totalizador = medicion.Totalizador.ToString() ?? "",
|
||||
}
|
||||
};
|
||||
Autenticacion = new Autenticacion
|
||||
{
|
||||
Password = string.Empty,
|
||||
RutEmpresa = string.Empty,
|
||||
RutUsuario = string.Empty
|
||||
},
|
||||
MedicionSubterranea = new Medicion
|
||||
{
|
||||
Caudal = medicion.Caudal.ToString() ?? "",
|
||||
FechaMedicion = medicion.DateOrigen?.ToString("yyyy-MM-dd") ?? "",
|
||||
HoraMedicion = medicion.DateOrigen?.ToString("HH:mm:ss") ?? "",
|
||||
NivelFreaticoDelPozo = "",
|
||||
Totalizador = medicion.Totalizador.ToString() ?? "",
|
||||
}
|
||||
};
|
||||
|
||||
await _registrarMedicion.EnviarMedicionAsync(medicion.Code, body,medicion.Id);
|
||||
//TODO: Agregar log texto
|
||||
|
||||
await _registrarMedicion.EnviarMedicionAsync(medicion.Code, body,medicion.Id);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//TODO: Agregar log texto
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return mediciones;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue