|
|
|
@@ -71,54 +71,10 @@ namespace MP.SPEC.Data
|
|
|
|
|
|
|
|
|
|
#endregion Public Properties
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Init ricetta
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="confPath"></param>
|
|
|
|
|
/// <param name="idxPODL"></param>
|
|
|
|
|
/// <param name="CalcArgs"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
|
|
|
|
|
{
|
|
|
|
|
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Salva ricetta su MongoDB
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="currRecord"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
|
|
|
|
|
{
|
|
|
|
|
bool answ = false;
|
|
|
|
|
answ = await mongoController.RecipeSetByPODL(currRecord);
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ricerca ricetta su MongoDB dato PODL
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idxPODL"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
|
|
|
|
|
{
|
|
|
|
|
RecipeModel? result = null;
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
string readType = "MongoDB";
|
|
|
|
|
result = await mongoController.RecipeGetByPODL(idxPODL);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string CalcRecipe(RecipeModel currRecipe)
|
|
|
|
|
{
|
|
|
|
|
return mongoController.CalcRecipe(currRecipe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Public Methods
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Recupera eventuali azioni richieste
|
|
|
|
|
/// </summary>
|
|
|
|
@@ -129,7 +85,7 @@ namespace MP.SPEC.Data
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
DisplayAction? result = null;
|
|
|
|
|
// cerco in redis...
|
|
|
|
|
RedisValue rawData = await redisDb.StringGetAsync(redisActionReq);
|
|
|
|
|
RedisValue rawData = await redisDb.StringGetAsync(Utils.redisActionReq);
|
|
|
|
|
if (!string.IsNullOrEmpty($"{rawData}"))
|
|
|
|
|
{
|
|
|
|
|
result = JsonConvert.DeserializeObject<DisplayAction>($"{rawData}");
|
|
|
|
@@ -157,8 +113,7 @@ namespace MP.SPEC.Data
|
|
|
|
|
// cerco in redis...
|
|
|
|
|
string rawData = JsonConvert.SerializeObject(act2save);
|
|
|
|
|
// invio broadcast + salvo in redis
|
|
|
|
|
BroadastMsgPipe.saveAndSendMessage(redisActionReq, rawData);
|
|
|
|
|
//await redisDb.StringSetAsync(redisActionReq, rawData);
|
|
|
|
|
BroadastMsgPipe.saveAndSendMessage(Utils.redisActionReq, rawData);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Debug($"ActionSetReq REDIS send to broadcast + Write cache: {ts.TotalMilliseconds}ms");
|
|
|
|
@@ -171,7 +126,7 @@ namespace MP.SPEC.Data
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
List<ListValues>? result = new List<ListValues>();
|
|
|
|
|
// cerco in redis...
|
|
|
|
|
RedisValue rawData = await redisDb.StringGetAsync(redisStatoCom);
|
|
|
|
|
RedisValue rawData = await redisDb.StringGetAsync(Utils.redisStatoCom);
|
|
|
|
|
if (!string.IsNullOrEmpty($"{rawData}"))
|
|
|
|
|
{
|
|
|
|
|
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
|
|
|
|
@@ -184,7 +139,7 @@ namespace MP.SPEC.Data
|
|
|
|
|
result = await Task.FromResult(dbController.AnagStatiComm());
|
|
|
|
|
// serializzo e salvo...
|
|
|
|
|
rawData = JsonConvert.SerializeObject(result);
|
|
|
|
|
await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
|
|
|
|
|
await redisDb.StringSetAsync(Utils.redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms");
|
|
|
|
@@ -390,6 +345,11 @@ namespace MP.SPEC.Data
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string CalcRecipe(RecipeModel currRecipe)
|
|
|
|
|
{
|
|
|
|
|
return mongoController.CalcRecipe(currRecipe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<ConfigModel>> ConfigGetAll()
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
@@ -755,6 +715,18 @@ namespace MP.SPEC.Data
|
|
|
|
|
return outVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Init ricetta
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="confPath"></param>
|
|
|
|
|
/// <param name="idxPODL"></param>
|
|
|
|
|
/// <param name="CalcArgs"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
|
|
|
|
|
{
|
|
|
|
|
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="IdxOdl">id odl da cercare</param>
|
|
|
|
@@ -1357,6 +1329,36 @@ namespace MP.SPEC.Data
|
|
|
|
|
return dbResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ricerca ricetta su MongoDB dato PODL
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idxPODL"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
|
|
|
|
|
{
|
|
|
|
|
RecipeModel? result = null;
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
string readType = "MongoDB";
|
|
|
|
|
result = await mongoController.RecipeGetByPODL(idxPODL);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Salva ricetta su MongoDB
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="currRecord"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
|
|
|
|
|
{
|
|
|
|
|
bool answ = false;
|
|
|
|
|
answ = await mongoController.RecipeSetByPODL(currRecord);
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
|
|
|
|
|
/// </summary>
|
|
|
|
@@ -1544,14 +1546,11 @@ namespace MP.SPEC.Data
|
|
|
|
|
private const string redisPOdlByOdl = redisXdlData + "POdlByOdl";
|
|
|
|
|
private const string redisPOdlByPOdl = redisXdlData + "POdlByPOdl";
|
|
|
|
|
private const string redisPOdlList = redisXdlData + "POdlList";
|
|
|
|
|
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
|
|
|
|
|
private const string redisStatoCom = redisBaseAddrSpec + "Cache:StatoCom";
|
|
|
|
|
private const string redisTipoArt = redisBaseAddrSpec + "Cache:TipoArt";
|
|
|
|
|
private const string redisVocabolario = redisBaseAddrSpec + "Cache:Vocabolario";
|
|
|
|
|
private const string redisXdlData = redisBaseAddrSpec + "Cache:XDL:";
|
|
|
|
|
|
|
|
|
|
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static IConfiguration _configuration = null!;
|
|
|
|
|
private static ILogger<MpDataService> _logger = null!;
|
|
|
|
|
|
|
|
|
|