Import Desc1 to D1
This commit is contained in:
@@ -47,7 +47,6 @@ public class MorskaD1Importer : MorskaBaseImporter
|
|||||||
_logger.LogInformation("{ImporterType}: Starting import for {ImportWorkerName} ({ImportWorkerId})",
|
_logger.LogInformation("{ImporterType}: Starting import for {ImportWorkerName} ({ImportWorkerId})",
|
||||||
ImporterType, importWorker.Name, importWorker.Id);
|
ImporterType, importWorker.Name, importWorker.Id);
|
||||||
|
|
||||||
// ✅ Clear cache at start
|
|
||||||
_cachedSheetData = null;
|
_cachedSheetData = null;
|
||||||
_cachedDataKey = null;
|
_cachedDataKey = null;
|
||||||
|
|
||||||
@@ -75,13 +74,11 @@ public class MorskaD1Importer : MorskaBaseImporter
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// ✅ Clear cache after import
|
|
||||||
_cachedSheetData = null;
|
_cachedSheetData = null;
|
||||||
_cachedDataKey = null;
|
_cachedDataKey = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ Dodaj metodę cache
|
|
||||||
private IList<IList<object>>? GetSheetData()
|
private IList<IList<object>>? GetSheetData()
|
||||||
{
|
{
|
||||||
var currentDataKey = $"{SheetId}#{SheetTabName}#{DataRange}";
|
var currentDataKey = $"{SheetId}#{SheetTabName}#{DataRange}";
|
||||||
@@ -212,7 +209,6 @@ public class MorskaD1Importer : MorskaBaseImporter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// ✅ Użyj cache zamiast bezpośredniego API
|
|
||||||
var data = GetSheetData();
|
var data = GetSheetData();
|
||||||
|
|
||||||
if (data == null || data.Count < 2)
|
if (data == null || data.Count < 2)
|
||||||
@@ -252,6 +248,18 @@ public class MorskaD1Importer : MorskaBaseImporter
|
|||||||
isUpToDate = false;
|
isUpToDate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// check also Desc1 from records (Value18 in GSheet)
|
||||||
|
if (row.Count <= 18) continue;
|
||||||
|
var sheetDesc1 = row[18]?.ToString();
|
||||||
|
var recordDesc1 = record.Desc1;
|
||||||
|
|
||||||
|
var normalizedSheetDesc1 = string.IsNullOrEmpty(sheetDesc1) ? null : sheetDesc1;
|
||||||
|
var normalizedRecordDesc1 = string.IsNullOrEmpty(recordDesc1) ? null : recordDesc1;
|
||||||
|
|
||||||
|
if (normalizedSheetDesc1 == normalizedRecordDesc1) continue;
|
||||||
|
_logger.LogDebug("{ImporterType}: Desc1 mismatch for code {Code}: DB={DbValue}, Sheet={SheetValue}",
|
||||||
|
ImporterType, code, normalizedRecordDesc1, normalizedSheetDesc1);
|
||||||
|
isUpToDate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogDebug("{ImporterType}: Layer {ImportWorkerName} is {Status}",
|
_logger.LogDebug("{ImporterType}: Layer {ImportWorkerName} is {Status}",
|
||||||
@@ -287,7 +295,6 @@ public class MorskaD1Importer : MorskaBaseImporter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// ✅ Użyj cache zamiast bezpośredniego API
|
|
||||||
var data = GetSheetData();
|
var data = GetSheetData();
|
||||||
|
|
||||||
_logger.LogDebug("{ImporterType}: Using data with {RowCount} rows from cache",
|
_logger.LogDebug("{ImporterType}: Using data with {RowCount} rows from cache",
|
||||||
@@ -314,6 +321,7 @@ public class MorskaD1Importer : MorskaBaseImporter
|
|||||||
Value13 = IndexExists(t, 15) ? ParseValue(t[15]?.ToString()) : null,
|
Value13 = IndexExists(t, 15) ? ParseValue(t[15]?.ToString()) : null,
|
||||||
Value14 = IndexExists(t, 16) ? ParseValue(t[16]?.ToString()) : null,
|
Value14 = IndexExists(t, 16) ? ParseValue(t[16]?.ToString()) : null,
|
||||||
Value15 = IndexExists(t, 17) ? ParseValue(t[17]?.ToString()) : null,
|
Value15 = IndexExists(t, 17) ? ParseValue(t[17]?.ToString()) : null,
|
||||||
|
Desc1 = IndexExists(t, 18) ? t[18]?.ToString() : null,
|
||||||
CreatedAt = DateTime.UtcNow,
|
CreatedAt = DateTime.UtcNow,
|
||||||
ModifiedAt = DateTime.UtcNow
|
ModifiedAt = DateTime.UtcNow
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ public class LayersController : Controller
|
|||||||
x.Name != null && x.Name.Contains(nameFilter) &&
|
x.Name != null && x.Name.Contains(nameFilter) &&
|
||||||
x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ImportWorker") &&
|
x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ImportWorker") &&
|
||||||
x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True"
|
x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True"
|
||||||
|
&& x.Number == 5375
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
{
|
|
||||||
"PONG": "#{PING}#",
|
|
||||||
"app-version": "#{buildId}#",
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Serilog": {
|
|
||||||
"MinimumLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Override": {
|
|
||||||
"Microsoft.AspNetCore": "Warning",
|
|
||||||
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
|
|
||||||
"Microsoft.EntityFrameworkCore.Infrastructure": "Warning",
|
|
||||||
"System.Net.Http.HttpClient": "Warning",
|
|
||||||
"Google.Apis": "Warning",
|
|
||||||
"DiunaBI.Core.Services.PluginManager": "Information"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"WriteTo": [
|
|
||||||
{
|
|
||||||
"Name": "Console",
|
|
||||||
"Args": {
|
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "File",
|
|
||||||
"Args": {
|
|
||||||
"path": "/var/log/diunabi/app-.log",
|
|
||||||
"rollingInterval": "Day",
|
|
||||||
"retainedFileCountLimit": 30,
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext} {Message:lj} {Properties:j}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Seq",
|
|
||||||
"Args": {
|
|
||||||
"serverUrl": "http://localhost:5341",
|
|
||||||
"restrictedToMinimumLevel": "Information"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Enrich": ["FromLogContext", "WithMachineName", "WithThreadId"]
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"ConnectionStrings": {
|
|
||||||
"SQLDatabase": "#{db-connection-string}#"
|
|
||||||
},
|
|
||||||
"GoogleClientId": "#{google-backend-login-client-id}#",
|
|
||||||
"Secret": "#{google-backend-login-secret}#",
|
|
||||||
"apiKey": "#{api-key}#",
|
|
||||||
"powerBI-user": "#{powerBI-user}#",
|
|
||||||
"powerBI-pass": "#{powerBI-pass}#",
|
|
||||||
"morska-user": "#{morska-user}#",
|
|
||||||
"morska-pass": "#{morska-pass}#",
|
|
||||||
"exportDirectory": "#{export-directory}#",
|
|
||||||
"appLogsFile": "#{app-logs-file}#",
|
|
||||||
"apiLocalUrl": "#{api-local-url}#",
|
|
||||||
"Kestrel": {
|
|
||||||
"Endpoints": {
|
|
||||||
"Http": {
|
|
||||||
"Url": "http://#{api-local-url}#"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
###
|
###
|
||||||
GET http://localhost:5400/api/Tests/Plugins
|
GET http://localhost:5400/api/Layers/AutoImport/10763478CB738D4ecb2h76g803478CB738D4e/D1-
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user