配置天网慧眼服务器地址

FileMonitor
陈伟 2024-11-28 16:44:12 +08:00
parent ab1ba82721
commit 3ae7cd530f
2 changed files with 10 additions and 8 deletions

View File

@ -6,14 +6,12 @@ using Quartz;
namespace OpenAuth.App.ServiceApp.Job;
class FileMonitor: IJob
class FileMonitor : IJob
{
public async System.Threading.Tasks.Task Execute(IJobExecutionContext context)
{
var targetDirectory = ConfigHelper.GetConfigRoot().GetSection("Insight:Dir").Value;
var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux"};
var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux" };
// 相关文件扩展名
var shpExtensions = new[] { ".shp", ".shx", ".dbf", ".prj", ".cpg" };
var targetExtensions = new[] { ".tif", ".shp" };
@ -123,7 +121,9 @@ class FileMonitor: IJob
private static async Task<bool> AddInsTif(string tifPath)
{
using var client = new HttpClient();
var url = "http://localhost:5007/api/InsTif/Insert";
var config = ConfigHelper.GetConfigRoot();
var serverUrl = config.GetSection("Insight:ServerUrl").Value;
var url = serverUrl + "/api/InsTif/Insert";
var tifName = Path.GetFileName(tifPath);
var tifDate = new DirectoryInfo(tifPath).Parent?.Name;
@ -165,7 +165,9 @@ class FileMonitor: IJob
private static async Task<bool> AddInsAiShp(String shpPath)
{
using var client = new HttpClient();
var url = "http://localhost:5007/api/InAiShp/Insert";
var config = ConfigHelper.GetConfigRoot();
var serverUrl = config.GetSection("Insight:ServerUrl").Value;
var url = serverUrl + "/api/InAiShp/Insert";
// 县区/shp名称
var fileName = Path.GetFileName(shpPath);
@ -207,5 +209,4 @@ class FileMonitor: IJob
return false;
}
}

View File

@ -70,6 +70,7 @@
"Insight": {
"Dir": "e:/insight",
"TifDir" : "e:/insight/tif",
"AiShpDir": "E:/insight/ai解析成果"
"AiShpDir": "E:/insight/ai解析成果",
"ServerUrl": "http://localhost:5007"
}
}